PDA

View Full Version : SubpatchLevel Scene Edit



papou
06-28-2012, 05:47 AM
HI, I have another problem...
If i edit manually the scene file with replacing
SubPatchLevel 0 3
by
SubPatchLevel 3 3
When i load my scene the SubPatchLevel display is still set to 0 ....?!

Anybody can explain me? (space are not space?? something is hiding here...)

xchrisx
06-28-2012, 10:00 AM
Doing a quick comparison I found when I change the display value in Layout it actually changes 2 lines in the LWS file:

SubPatchLevel 3 3
APSDisplay
{ APS
Version 1
Method 0
{ VParm
{ ObjectLevel
0
{ VariantParameter
3
0
{ ParameterValue
3
0
}
}
}

papou
06-28-2012, 01:08 PM
ohoh, you got it.
I will check that!

papou
06-28-2012, 01:10 PM
what are you using? (TextPad was showing difference but it not show the lines...)

xchrisx
06-28-2012, 03:11 PM
I use WinMerge: http://winmerge.org/

Its fast and easy to see differences in the files.

Did that code I posted help you out?

papou
06-28-2012, 06:46 PM
Yes Thank you!
Here my scripts: LOAD_SUBPATCHZERO and SAVE_SUBPATCHRENDER

I was loosing so much time in loading and saving because of high subdivided objects that need to be saved with the same display subdvision as render subdvision (to prevent LWSN error).

That scripts do that, with a special bonus of writing the scene in a temp file first to prevent writing error.

(ah... feel free to clean them!)


//================================================== ====
// LOAD_SUBPATCHZERO (workflow script) (c)2012 Tais
//================================================== ====

// FORCE DISPLAY SUBPATCH TO 0 BEFORE LOADING AND SET VIEW TO FRONTWIRE


// TODO: STORE AND RECALL
// TODO: OPTIONS?

@name LOAD_SUBPATCHZERO

generic
{
OBJECTLEVELFOUND = SUBPATCHFOUND = 0; i = 1;
ddir = getdir("Content"); if(ddir==""){warn("Couldn't get ContentDir. Please check your config."); return;}
ddir = ddir+"\\Scenes\\";
Filename = ddir+"\\*.lws";

sourcename = getfile("Load Scene",Filename, ddir,1); if(sourcename == nil) return;
outputfilename = (sourcename+"_tmp");
f = File(sourcename,"r") || error("Cannot open file");
NbLines = f.linecount();
w = File(outputfilename,"w") || error("Cannot open file");

while( !f.eof() ){

lb_items += f.read();
Line[i] = f.read(i);

// ***** RETROUVE LE SUBPATCH ET 9 LIGNES EN DESSOUS OBJECT LEVEL
Ligne = parse(" ",lb_items[i]);
if (Ligne[1]=="ViewLevel"){ Line[i]=("ViewLevel 3");}
if (Ligne[1]=="SubPatchLevel"){ Line[i]=("SubPatchLevel 0 "+Ligne[3]); SUBPATCHFOUND = 1;}
if (Line[i]==" { VariantParameter"){
if (SUBPATCHFOUND == 1){ OBJECTLEVELFOUND = 1; }
}

w.writeln(Line[i]);
i++;

if (OBJECTLEVELFOUND == 1){
lb_items += f.read();
Line[i] = f.read(i);
w.writeln(" 0"); i++;
OBJECTLEVELFOUND = SUBPATCHFOUND = 0;
}
}

f.close();w.close();

// ***** CHECK NBR DE LIGNE DE LA NOUVELLES SCENE POUR LA SCENE REECRITE EST BLATTEE (DISQUE PLEIN PAR EXEMPLE...)

f = File(outputfilename,"r+") || error("Cannot open file");
NewNbLines = f.linecount();
f.close();

if (NewNbLines == NbLines) {
filecopy(outputfilename,sourcename);
filedelete(outputfilename);
}
else{
info("ERREUR: VERIFIER L'ESPACE DISQUE.");
filedelete(outputfilename);
}
LoadScene(sourcename);

}





//================================================== ====
// SAVE_SUBPATCHRENDER (workflow script) (c)2012 Tais
//================================================== ====

// FORCE SUBPATCH SAME AS RENDER AFTER SAVE


// TODO: STORE AND RECALL
// TODO: OPTIONS?

@name SAVE_SUBPATCHRENDER


generic
{
SaveSceneAs(); i= 1;
Scene = Scene(); sourcename = Scene().filename;

outputfilename = (sourcename+"_tmp");
f = File(sourcename,"r") || error("Cannot open file");
NbLines = f.linecount();
w = File(outputfilename,"w") || error("Cannot open file");

while( !f.eof() ){

lb_items += f.read();
Line[i] = f.read(i);

// ***** RETROUVE LE SUBPATCH ET 9 LIGNES EN DESSOUS OBJECT LEVEL
Ligne = parse(" ",lb_items[i]);

if (Ligne[1]=="SubPatchLevel"){ Line[i]=("SubPatchLevel "+Ligne[3]+" "+Ligne[3]); SUBPATCHFOUND = 1;}
if (Line[i]==" { VariantParameter"){
if (SUBPATCHFOUND == 1){ OBJECTLEVELFOUND = 1; }
}

w.writeln(Line[i]);
i++;

if (OBJECTLEVELFOUND == 1){
lb_items += f.read();
Line[i] = f.read(i);
w.writeln(" "+Ligne[3]); i++;
OBJECTLEVELFOUND = SUBPATCHFOUND = 0;
}
}

f.close();w.close();

// CHECK NBR DE LIGNE DE LA NOUVELLES SCENE POUR LA SCENE REECRITE EST BLATTEE (DISQUE PLEIN PAR EXEMPLE...)

f = File(outputfilename,"r+") || error("Cannot open file");
NewNbLines = f.linecount();
f.close();

if (NewNbLines == NbLines) {
filecopy(outputfilename,sourcename);
filedelete(outputfilename);
}
else{
info("ERREUR: VERIFIER L'ESPACE DISQUE.");
filedelete(outputfilename);
}


}