mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-26 22:02:15 +01:00
feat(ppro): wip on refactoring
This commit is contained in:
parent
405eaebe0a
commit
12ceadfab2
5 changed files with 73 additions and 18 deletions
|
|
@ -638,18 +638,19 @@ $.pype = {
|
|||
var pdClips = pypeData.clips;
|
||||
var hierarchy;
|
||||
var parents;
|
||||
|
||||
$.writeln('>> getClipAsInstance:clip.name ' + clip.name)
|
||||
if (pdClips[clip.name]) {
|
||||
parents = pdClips[clip.name].parents;
|
||||
hierarchy = pdClips[clip.name].hierarchy;
|
||||
}
|
||||
|
||||
if (hierarchy === null) {
|
||||
alert('First you need to rename clip sequencially with hierarchy!\nUse `Pype Rename` extension', 'No hierarchy data available at clip ' + clip.name + '!', 'error');
|
||||
$.pype.alert_message('First you need to rename clip sequencially with hierarchy!\nUse `Pype Rename` extension', 'No hierarchy data available at clip ' + clip.name + '!', 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
var interpretation = clip.projectItem.getFootageInterpretation();
|
||||
$.writeln('>> getClipAsInstance:interpretation ' + interpretation)
|
||||
var instance = {};
|
||||
instance.publish = true;
|
||||
instance.family = 'clip';
|
||||
|
|
@ -771,7 +772,8 @@ $.pype = {
|
|||
selected[s].clip,
|
||||
selected[s].sequence,
|
||||
selected[s].videoTrack,
|
||||
pypeData
|
||||
pypeData,
|
||||
presets
|
||||
);
|
||||
if (instance !== false) {
|
||||
instance.version = version;
|
||||
|
|
|
|||
|
|
@ -4,13 +4,13 @@
|
|||
"description": "pype avalon integration",
|
||||
"main": "CSXS\\manifest.xml",
|
||||
"dependencies": {
|
||||
"bluebird": "^3.7.2",
|
||||
"decompress-zip": "^0.2.2",
|
||||
"fs": "^0.0.1-security",
|
||||
"fs-extra": "^9.0.0",
|
||||
"https": "^1.0.0",
|
||||
"jsonfile": "^6.0.1",
|
||||
"junk": "^3.1.0",
|
||||
"mkdirp": "^1.0.4",
|
||||
"node-fetch": "^2.6.0",
|
||||
"node-timecodes": "^2.5.0",
|
||||
"opn": "^6.0.0",
|
||||
"os": "^0.1.1",
|
||||
|
|
|
|||
|
|
@ -114,6 +114,9 @@ var ENV;
|
|||
</div>
|
||||
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<button type="button" class="btn btn-info btn-sm btn-block" id="btn-testing">Testing Button</button>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<button type="button" class="btn btn-info btn-sm btn-block" id="btn-newWorkfileVersion">Save next workfile version</button>
|
||||
</li>
|
||||
|
|
|
|||
|
|
@ -5,9 +5,23 @@ var output = document.getElementById('output');
|
|||
var process = require('process');
|
||||
var timecodes = require('node-timecodes');
|
||||
|
||||
function displayResult (r) {
|
||||
console.log(r);
|
||||
_pype.csi.evalScript('$.writeln( ' + JSON.stringify(r) + ' )');
|
||||
output.classList.remove('error');
|
||||
output.innerText = r;
|
||||
}
|
||||
|
||||
function displayError (e) {
|
||||
output.classList.add('error');
|
||||
output.innerText = e;
|
||||
}
|
||||
|
||||
var _pype = {
|
||||
csi: csi,
|
||||
rootFolderPath: csi.getSystemPath(SystemPath.EXTENSION),
|
||||
displayResult: displayResult,
|
||||
displayError: displayError,
|
||||
getPresets: function () {
|
||||
var url = pras.getApiServerUrl();
|
||||
var projectName = 'J01_jakub_test';
|
||||
|
|
@ -39,18 +53,6 @@ var _pype = {
|
|||
// });
|
||||
// }
|
||||
|
||||
function displayResult (r) {
|
||||
console.log(r);
|
||||
_pype.csi.evalScript('$.writeln( ' + JSON.stringify(r) + ' )');
|
||||
output.classList.remove('error');
|
||||
output.innerText = r;
|
||||
}
|
||||
|
||||
function displayError (e) {
|
||||
output.classList.add('error');
|
||||
output.innerText = e;
|
||||
}
|
||||
|
||||
function loadExtensionDependencies () {
|
||||
// get extension path
|
||||
var extensionPath = _pype.csi.getSystemPath(SystemPath.EXTENSION);
|
||||
|
|
@ -392,7 +394,11 @@ $('#btn-generateRequest').click(function () {
|
|||
});
|
||||
|
||||
$('#btn-newWorkfileVersion').click(function () {
|
||||
evalScript('$.pype.versionUpWorkFile();');
|
||||
;
|
||||
});
|
||||
|
||||
$('#btn-testing').click(function () {
|
||||
pras.get_presets('J01_jakub_tes');
|
||||
});
|
||||
|
||||
_pype.getEnv();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
/* global _pype */
|
||||
// connecting pype module pype rest api server (pras)
|
||||
const fetch = require('node-fetch');
|
||||
|
||||
var pras = {
|
||||
/**
|
||||
|
|
@ -10,11 +11,41 @@ var pras = {
|
|||
var url = _pype.ENV.PYPE_REST_API_URL;
|
||||
return url
|
||||
},
|
||||
getRequestFromRestApiServer: function (url, callback) {
|
||||
_pype.displayResult('inside of getRequestFromRestApiServer: ' + url)
|
||||
fetch(url).then(
|
||||
res => res.json()).then(
|
||||
json => {callback(json)});
|
||||
},
|
||||
load_representations: function (projectName, requestList) {
|
||||
// preparation for getting representations from api server
|
||||
console.log('Load Represention:projectName: ' + projectName);
|
||||
console.log('Load Represention:requestList: ' + requestList);
|
||||
},
|
||||
get_presets: function (projectName) {
|
||||
var data = null;
|
||||
var template = '{serverUrl}/adobe/presets/{projectName}';
|
||||
var url = template.format({
|
||||
serverUrl: pras.getApiServerUrl(),
|
||||
projectName: projectName,
|
||||
});
|
||||
_pype.displayResult(url);
|
||||
|
||||
// send request to server
|
||||
pras.getRequestFromRestApiServer(url, function (result) {
|
||||
_pype.displayResult(JSON.stringify(result));
|
||||
if (result.hasOwnProperty ('success')) {
|
||||
data = result.data;
|
||||
_pype.displayResult('_ data came as dict');
|
||||
_pype.displayResult(JSON.stringify(data));
|
||||
} else {
|
||||
_pype.displayResult('data came as nothing');
|
||||
_pype.displayError(
|
||||
'No data for `{projectName}` project in database'.format(
|
||||
{projectName: projectName}));
|
||||
}
|
||||
});
|
||||
},
|
||||
register_plugin_path: function (publishPath) {
|
||||
// preparation for getting representations from api server
|
||||
},
|
||||
|
|
@ -31,3 +62,16 @@ var pras = {
|
|||
// getting context of project
|
||||
}
|
||||
};
|
||||
|
||||
String.prototype.format = function (arguments) {
|
||||
var this_string = '';
|
||||
for (var char_pos = 0; char_pos < this.length; char_pos++) {
|
||||
this_string = this_string + this[char_pos];
|
||||
}
|
||||
|
||||
for (var key in arguments) {
|
||||
var string_key = '{' + key + '}'
|
||||
this_string = this_string.replace(new RegExp(string_key, 'g'), arguments[key]);
|
||||
}
|
||||
return this_string;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue