PDA

View Full Version : SetRGBPrefixToSceneNameGN.ls



faulknermano
06-09-2006, 01:37 AM
save me a lot of time.:hey:

faulknermano
07-03-2006, 01:19 AM
@warnings 0
generic
{
imagesDir = getdir("Content") + "\\images" ;

sceneName = Scene().filename;
myWeek = findWeek(sceneName);
myDay = findDay(sceneName);
weekFolder = "WK" + padThis(myWeek,2);
dayFolder = "D" + padThis(myDay,2);

sp = split(sceneName);


// look for folder of the same scene name;

imagesDir = imagesDir + "\\" + weekFolder + "\\" + dayFolder + "\\";

//return;
mySP = sp[3];
//if(mySP.contains(".") == true)
mySP = searchAndReplace(sp[3],"\\.","\\\\");
//info(mySP);

createThisDirectory((imagesDir + mySP));

str = "SaveRGBPrefix " + imagesDir + sp[3] + "\\" + sp[3];
CommandInput(str);
info(imagesDir + mySP + "\\" + sp[3]);
}
findWeek: str
{
pl = parse("-",str);
return(integer(pl[1]));
}
findDay: str
{
pl = parse("-",str);
return(integer(pl[2]));
}
padThis: num, pad
{
strNum = string(num).size();

zeroes = pad - strNum;
str = "";
for(i=1;i<=zeroes;i++)
{
str = string(str,"0");
}

return(string(str,num));

}
createThisDirectory: dir
{
pd = parse("\\",dir);

str = pd[1] + "\\";
for(i=2;i<=pd.size();i++)
{
md = nil;
str = str + "\\" + pd[i] + "\\";
md = matchdirs(str,".");
if(md.size() == 0)
{
mkdir(str);
}
}
}
searchAndReplace: oName, search, replace
{
exp = regexp(search,replace);
oName ~= exp;
info(oName);
return(oName);
}



by putting a periods/dots(.) in your scene filename, the script will create a subdirectory for it. for example, for a scene file named like this:

1-5-9_Yellow_Moon.A_Test.lws

the script will create a directory structure like

\<contentDir>\images\WK01\D05\Yellow_Moon\A_Test

faulknermano
07-03-2006, 02:44 AM
ignore code above. new code below. :)


@warnings 0
generic
{
imagesDir = getdir("Content") + "\\images" ;

sceneName = Scene().filename;
myWeek = findWeek(sceneName);
myDay = findDay(sceneName);
weekFolder = "WK" + padThis(myWeek,2);
dayFolder = "D" + padThis(myDay,2);

sp = split(sceneName);


// look for folder of the same scene name;

imagesDir = imagesDir + "\\" + weekFolder + "\\" + dayFolder + "\\";

//return;
mySP = sp[3];
//if(mySP.contains(".") == true)
mySP = searchAndReplace(sp[3],"\\.","\\\\");
//info(mySP);

createThisDirectory((imagesDir + mySP));

str = "SaveRGBPrefix " + imagesDir + mySP + "\\" + sp[3];
CommandInput(str);
info(imagesDir + mySP + "\\" + sp[3]);
}
findWeek: str
{
pl = parse("-",str);
return(integer(pl[1]));
}
findDay: str
{
pl = parse("-",str);
return(integer(pl[2]));
}
padThis: num, pad
{
strNum = string(num).size();

zeroes = pad - strNum;
str = "";
for(i=1;i<=zeroes;i++)
{
str = string(str,"0");
}

return(string(str,num));

}
createThisDirectory: dir
{
pd = parse("\\",dir);

str = pd[1] + "\\";
for(i=2;i<=pd.size();i++)
{
md = nil;
str = str + "\\" + pd[i] + "\\";
md = matchdirs(str,".");
if(md.size() == 0)
{
mkdir(str);
}
}
}
searchAndReplace: oName, search, replace
{
exp = regexp(search,replace);
oName ~= exp;
info(oName);
return(oName);
}