mirror of
https://github.com/jorgevasquezp/AFX_yTools.git
synced 2026-09-16 19:22:42 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
80d123f603 |
@@ -1,71 +0,0 @@
|
||||
/*
|
||||
Base ScriptUI Panel v.0.1
|
||||
|
||||
by Jorge Vásquez Pérez
|
||||
|
||||
Changes 0.2:
|
||||
- None
|
||||
|
||||
*/
|
||||
|
||||
(function createNullsFromPaths (thisObj) {
|
||||
/* Build UI */
|
||||
function buildUI(thisObj) {
|
||||
|
||||
var windowTitle = "windowTitle";
|
||||
var firstButton = "firstButton";
|
||||
var secondButton = "secondButton";
|
||||
var thirdButton = "thirdButton";
|
||||
var win = (thisObj instanceof Panel)? thisObj : new Window('palette', windowTitle);
|
||||
win.spacing = 0;
|
||||
win.margins = 4;
|
||||
var myButtonGroup = win.add ("group");
|
||||
myButtonGroup.spacing = 4;
|
||||
myButtonGroup.margins = 0;
|
||||
myButtonGroup.orientation = "row";
|
||||
win.button1 = myButtonGroup.add ("button", undefined, firstButton);
|
||||
win.button2 = myButtonGroup.add ("button", undefined, secondButton);
|
||||
win.button3 = myButtonGroup.add ("button", undefined, thirdButton);
|
||||
myButtonGroup.alignment = "center";
|
||||
myButtonGroup.alignChildren = "center";
|
||||
|
||||
win.button1.onClick = function(){
|
||||
button1Click();
|
||||
}
|
||||
win.button2.onClick = function(){
|
||||
button2Click();
|
||||
}
|
||||
win.button3.onClick = function(){
|
||||
button3Click();
|
||||
}
|
||||
|
||||
win.layout.layout(true);
|
||||
|
||||
return win
|
||||
}
|
||||
|
||||
|
||||
// Show the Panel
|
||||
var w = buildUI(thisObj);
|
||||
if (w.toString() == "[object Panel]") {
|
||||
w;
|
||||
} else {
|
||||
w.show();
|
||||
}
|
||||
|
||||
|
||||
/* General functions */
|
||||
|
||||
/* Project Specific functions */
|
||||
function button1Click(){
|
||||
alert("Button 1 was clicked");
|
||||
}
|
||||
function button2Click(){
|
||||
alert("Button 2 was clicked");
|
||||
}
|
||||
function button3Click(){
|
||||
alert("Button 3 was clicked");
|
||||
}
|
||||
|
||||
|
||||
})(this);
|
||||
@@ -54,42 +54,35 @@ function RenderToProject()
|
||||
var date_component = pad(today.getDate(),2);
|
||||
var full_year_component = String(today.getFullYear())
|
||||
var year_component = full_year_component.substr(full_year_component.length - 2,full_year_component.length );
|
||||
var tag = month_component + date_component + year_component
|
||||
//So long stupid confusing date system, hehe
|
||||
//var tag = month_component + date_component + year_component;
|
||||
var tag = year_component + month_component + date_component ;
|
||||
return tag;
|
||||
},
|
||||
getOutputBasePath : function(){
|
||||
var file = app.project.file;
|
||||
var file_path = String(app.project.file);
|
||||
var gfx_output_base = "05_Graphics_Output";
|
||||
var endtag_output_extra = "02_EndTags";
|
||||
var scene_output_extra = "01_GFX_Scenes";
|
||||
var vfx_output_base = "03_Composite_Outputs";
|
||||
var vfx_output_base;
|
||||
var gfx_string = "09_Graphics";
|
||||
var vfx_string = "08_Composite";
|
||||
var endtag_string = "EndTags";
|
||||
var file_path = String(file);
|
||||
|
||||
var search_gfx = file_path.search(gfx_string);
|
||||
var search_vfx = file_path.search(vfx_string);
|
||||
var search_endtag = file_path.search(endtag_string);
|
||||
//yorchnet folderstructure
|
||||
pro_folder = "pro"
|
||||
folder2d = "2d"
|
||||
folder3d = "3d"
|
||||
|
||||
var search_3d = file_path.search(folder3d);
|
||||
var search_2d = file_path.search(folder2d);
|
||||
var base_path;
|
||||
|
||||
if ( search_gfx != -1 ){
|
||||
var base_path = file_path.substr(0,search_gfx+gfx_string.length)+"/"+gfx_output_base;
|
||||
if ( search_endtag != -1 ){
|
||||
base_path += "/" + endtag_output_extra;
|
||||
}else{
|
||||
base_path += "/" + scene_output_extra;
|
||||
}
|
||||
if( search_2d != -1 ){
|
||||
var base_path = file_path.substr(0,file_path.search(pro_folder)+pro_folder.length) +"/"+ folder2d ;;
|
||||
}
|
||||
|
||||
if( search_vfx != -1 ){
|
||||
var base_path = file_path.substr(0,search_vfx+vfx_string.length)+"/"+vfx_output_base ;;
|
||||
if( search_3d != -1 ){
|
||||
var base_path = file_path.substr(0,file_path.search(pro_folder)+pro_folder.length) +"/"+ folder3d ;;
|
||||
}
|
||||
|
||||
//alert(base_path);
|
||||
|
||||
return base_path + "/" + this.getTodayTag();
|
||||
return base_path + "/" + "renders" + "/" + this.getTodayTag();
|
||||
|
||||
},
|
||||
/*
|
||||
setRenderToProjectPath : function( rqItem ){
|
||||
|
||||
@@ -1,145 +1 @@
|
||||
#include "../yScripts/y_JSExtensions.jsx";
|
||||
function yFlattenSelectedFolderContentsTool()
|
||||
{
|
||||
this.info =
|
||||
{
|
||||
name : "yFlatten",
|
||||
version : 0.11,
|
||||
stage : "alpha",
|
||||
description : "Set the Folder Structure for a new Project",
|
||||
url : "yorchnet.com"
|
||||
};
|
||||
this.appearence =
|
||||
{
|
||||
buttonHeight : 30,
|
||||
buttonWidth : 126
|
||||
};
|
||||
this.resources =
|
||||
{
|
||||
icon : new File('yNet.png'),
|
||||
};
|
||||
this.init = function init()
|
||||
{
|
||||
//alert("my name is:" + this.info.name);
|
||||
this.btnLauyout =
|
||||
"button\
|
||||
{\
|
||||
preferredSize: ['" + this.appearence.buttonWidth + "','" + this.appearence.buttonHeight + "'],\
|
||||
text:'" + this.info.name + "',\
|
||||
helpTip:'" + this.info.description + "'\
|
||||
}";
|
||||
|
||||
this. res =
|
||||
"window\
|
||||
{\
|
||||
type:'palette',\
|
||||
text:'" + this.info.name + ' ' + this.info.ver + ' ' + this.info.stage + "',\
|
||||
info: Group \
|
||||
{\
|
||||
alignment:['center','bottom'],\
|
||||
icon: Image \
|
||||
{\
|
||||
icon:'" + this.resources.icon.path + '/' + this.resources.icon.name + "',\
|
||||
preferredSize: [15, 18]\
|
||||
},\
|
||||
website: StaticText\
|
||||
{\
|
||||
text:'" + this.info.url + "',\
|
||||
alignment:['fill','center']\
|
||||
},\
|
||||
}\
|
||||
}";
|
||||
}
|
||||
this.createUI = function createUI()
|
||||
{
|
||||
|
||||
|
||||
this.window = new Window ( this.res );
|
||||
this.window.show() ;
|
||||
}
|
||||
|
||||
this.getSelectedProjectItems = function getSelectedProjectItems (){
|
||||
var items = [];
|
||||
var p = app.project;
|
||||
for ( var i = 1 ; i <= p.numItems ; i ++ ){
|
||||
var item = p.item(i);
|
||||
if ( item.selected ){
|
||||
items.push(item);
|
||||
}
|
||||
}
|
||||
return items;
|
||||
}
|
||||
this.getAllItems = function getAllItems( folderItem ){
|
||||
|
||||
var items = [];
|
||||
var folders = [];
|
||||
|
||||
for ( var i = 1 ; i <= folderItem.numItems ; i ++ ){
|
||||
var item = folderItem.item(i);
|
||||
|
||||
if ( (item.typeName != "Folder") ){
|
||||
//if ( (isInArray( items ,item )) == false ){
|
||||
items.push( item );
|
||||
//}
|
||||
}else{
|
||||
var new_items = yFlattenSelectedFolderContentsTool().getAllItems(item);
|
||||
for ( var j = 0 ; j < new_items.length ; j ++ ){
|
||||
new_item = new_items[j];
|
||||
//if ( (isInArray ( new_item )) == false ){
|
||||
items.push ( new_item );
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
return items
|
||||
}
|
||||
this.flatten = function flatten( items, root ){
|
||||
app.beginUndoGroup("Flatten Selected Folder Contents")
|
||||
for ( var i = 0; i < items.length ; i ++){
|
||||
item = items[i];
|
||||
item.parentFolder = root;
|
||||
}
|
||||
app.endUndoGroup()
|
||||
purgeEmptyFolders();
|
||||
return
|
||||
}
|
||||
this.purgeEmptyFolders = function purgeEmptyFolders(){
|
||||
//app.beginUndoGroup("Purge Empty Folders")
|
||||
var emptyFolders = [];
|
||||
|
||||
var p = app.project;
|
||||
for ( var i = p.numItems ; i >= 1 ; i -- ){
|
||||
item = p.item(i);
|
||||
if ( item.typeName == "Folder" ){
|
||||
if ( item.numItems <= 0 ){
|
||||
item.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//app.endUndoGroup()
|
||||
}
|
||||
this.yFlattenSelectedFolderContents = function yFlattenSelectedFolderContents()
|
||||
{
|
||||
//alert("is this working");
|
||||
//app.beginUndoGroup(yFlattenSelectedFolderContentsTool().info.description);
|
||||
yFlattenSelectedFolderContentsTool().flatten( yFlattenSelectedFolderContentsTool().getAllItems( yFlattenSelectedFolderContentsTool().getSelectedProjectItems()[0] ) , yFlattenSelectedFolderContentsTool().getSelectedProjectItems()[0] );
|
||||
//app.endUndoGroup();
|
||||
}
|
||||
|
||||
this.activate = this.yFlattenSelectedFolderContents;
|
||||
|
||||
this.init();
|
||||
return this;
|
||||
}
|
||||
|
||||
//CHECKS that the toolbox exists, and if it doesn´t it runs the script on its own.
|
||||
if (typeof(YTB)=='undefined')
|
||||
{
|
||||
yFlattenSelectedFolderContentsTool = new yFlattenSelectedFolderContentsTool();
|
||||
yFlattenSelectedFolderContentsTool.activate();
|
||||
}
|
||||
else
|
||||
{
|
||||
yFlattenSelectedFolderContentsTool = YTB.addTool(new yFlattenSelectedFolderContentsTool());
|
||||
}
|
||||
#include "../yScripts/y_JSExtensions.jsx";␍function yFlattenSelectedFolderContentsTool()␍{␍ this.info =␍ {␍ name : "yFlatten",␍ version : 0.11,␍ stage : "alpha",␍ description : "Set the Folder Structure for a new Project",␍ url : "yorchnet.com"␍ };␍ this.appearence =␍ {␍ buttonHeight : 30,␍ buttonWidth : 126␍ };␍ this.resources = ␍ {␍ icon : new File('yNet.png'),␍ };␍ this.init = function init()␍ {␍ //alert("my name is:" + this.info.name);␍ this.btnLauyout = ␍ "button\␍ {\␍ preferredSize: ['" + this.appearence.buttonWidth + "','" + this.appearence.buttonHeight + "'],\␍ text:'" + this.info.name + "',\␍ helpTip:'" + this.info.description + "'\␍ }";␍ ␍ this. res = ␍ "window\␍ {\␍ type:'palette',\␍ text:'" + this.info.name + ' ' + this.info.ver + ' ' + this.info.stage + "',\␍ info: Group \␍ {\␍ alignment:['center','bottom'],\␍ icon: Image \␍ {\␍ icon:'" + this.resources.icon.path + '/' + this.resources.icon.name + "',\␍ preferredSize: [15, 18]\␍ },\␍ website: StaticText\␍ {\␍ text:'" + this.info.url + "',\␍ alignment:['fill','center']\␍ },\␍ }\␍ }";␍ }␍ this.createUI = function createUI()␍ {␍ ␍ ␍ this.window = new Window ( this.res );␍ this.window.show() ;␍ }␍ ␍ this.getSelectedProjectItems = function getSelectedProjectItems (){␍ var items = [];␍ var p = app.project;␍ for ( var i = 1 ; i <= p.numItems ; i ++ ){␍ var item = p.item(i);␍ if ( item.selected ){␍ items.push(item);␍ }␍ }␍ return items;␍ }␍ this.getAllItems = function getAllItems( folderItem ){␍ ␍ var items = [];␍ var folders = [];␍ ␍ for ( var i = 1 ; i <= folderItem.numItems ; i ++ ){␍ var item = folderItem.item(i);␍ ␍ if ( (item.typeName != "Folder") ){␍ //if ( (isInArray( items ,item )) == false ){␍ items.push( item );␍ //}␍ }else{␍ var new_items = yFlattenSelectedFolderContentsTool().getAllItems(item);␍ for ( var j = 0 ; j < new_items.length ; j ++ ){␍ new_item = new_items[j];␍ //if ( (isInArray ( new_item )) == false ){␍ items.push ( new_item );␍ //}␍ }␍ }␍ }␍ return items␍ }␍ this.flatten = function flatten( items, root ){␍ app.beginUndoGroup("Flatten Selected Folder Contents")␍ for ( var i = 0; i < items.length ; i ++){␍ item = items[i];␍ item.parentFolder = root;␍ }␍ app.endUndoGroup()␍ purgeEmptyFolders();␍ return␍ }␍ this.purgeEmptyFolders = function purgeEmptyFolders(){␍ app.beginUndoGroup("Purge Empty Folders")␍ var emptyFolders = [];␍ ␍ var p = app.project;␍ for ( var i = p.numItems ; i >= 1 ; i -- ){␍ item = p.item(i);␍ if ( item.typeName == "Folder" ){␍ if ( item.numItems <= 0 ){␍ item.remove();␍ }␍ }␍ }␍ ␍ app.endUndoGroup()␍ }␍ this.yFlattenSelectedFolderContents = function yFlattenSelectedFolderContents()␍ {␍ //alert("is this working");␍ app.beginUndoGroup(yFlattenSelectedFolderContentsTool().info.description);␍ yFlattenSelectedFolderContentsTool().flatten( yFlattenSelectedFolderContentsTool().getAllItems( yFlattenSelectedFolderContentsTool().getSelectedProjectItems()[0] ) , yFlattenSelectedFolderContentsTool().getSelectedProjectItems()[0] );␍ app.endUndoGroup();␍ }␍ ␍ this.activate = this.yFlattenSelectedFolderContents;␍ ␍ this.init();␍ return this;␍}␍␍//CHECKS that the toolbox exists, and if it doesn´t it runs the script on its own.␍if (typeof(YTB)=='undefined')␍{␍ yFlattenSelectedFolderContentsTool = new yFlattenSelectedFolderContentsTool();␍ yFlattenSelectedFolderContentsTool.activate();␍}␍else␍{␍ yFlattenSelectedFolderContentsTool = YTB.addTool(new yFlattenSelectedFolderContentsTool());␍}␍
|
||||
@@ -59,7 +59,7 @@ function YSetProjectTool()
|
||||
{
|
||||
//alert("is this working");
|
||||
app.beginUndoGroup('ySetProject');
|
||||
var preStruct = ["01_MAIN","02_pComps","03_Images" ,"04_Movies","05_Audio" ,"06_Projects", "07_Ref", "08_Tools"];
|
||||
var preStruct = ["01 MAIN","02 PComp","03 Source Layers" ,"04 Movies","05 Other Projects","06 Audio" , "07 Reference"];
|
||||
var newStruct = [];
|
||||
var projectItems = [];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user