View Full Version : subpatchlevel lod problem

10-10-2007, 05:00 PM
Hello everybody,

Im trying to make a small script that changes the subpatchlevel depending on the distance to camera (actually only on Z axis). But now, Its only changing the subpatchlevel when moving the object, not when moving the camera. Also, it shows me an error if I switch from a model to the camera. Then, he is trying to subpatch the camera?

Has anybody a hint for me?

here is the code:

@version 2.6
@script motion

camera = Camera();


currPosition = ma.get(POSITION,time);

o = camera.firstChannel();


if (o.name == "Position.Z") camZ=o.getKeyValue(0);

o = camera.nextChannel();





if (currPosition.z >= 20+camZ && currPosition.z <= 50+camZ) SubPatchLevel(0,9);
if (currPosition.z >= 10+camZ && currPosition.z <= 20+camZ) SubPatchLevel(1,9);
if (currPosition.z >= 5+camZ && currPosition.z <= 10+camZ) SubPatchLevel(2,9);
if (currPosition.z >= 2+camZ && currPosition.z <= 5+camZ) SubPatchLevel(3,9);
if (currPosition.z <= 1+camZ) SubPatchLevel(4,9);




10-12-2007, 05:24 AM
well, there was a warning regarding calling CS commands (e.g. "SubpatchLevel") in callback funcs like motion scripts. i'm not sure how these things behave. now, i do believe there is a render subpatch level that is envelopable in LW9. if you use LW9 i think you should use this envelope instead of calling it within a motion script.

the main problem with calling SubpatchLevel is that you have to ascertain if the object you are changing levels is selected every time it calls.

10-12-2007, 08:09 AM
Why don't you use the build-in aps function? Just curious!

10-12-2007, 08:21 AM
thank you very much faulknermano, thats a great idea and maybe easy to do. I will try it:)

to 3dgfxstudio: I tried it, but I cannot run a menue from another menue... the main menue is always on the top and so you cannot enter any settings:(

10-12-2007, 08:27 AM
Thats's strange! Sounds like you need to delete your .cfg files in your documents and settings folder?

10-12-2007, 08:31 AM
no, that is normal for lscript. If you have made your own menue, you cannot start a menue from another plugin easily (maybe there is a way, but this could be very tricky). So I will make my own lodplugin with own menue in the main plugin menue... Should not be too much work I hope:)

10-12-2007, 08:38 AM
Aaah now I get it! LOL ure right

10-12-2007, 09:20 AM
It seems that I cannot use the envelope... but the subpatch gradient option could easily be used (If the Hell I would know where I can find it or what Name it has) Could not find anything in the docus. Has anybody an idea?