Page 1 of 2 12 LastLast
Results 1 to 15 of 20

Thread: display subpatch level

  1. #1

    display subpatch level

    Hello Guys,

    My problem is the following:

    I have objects with different subpatch level settings in my scene. And there are quite a lot,at least 30.

    Because interaction was lagging I set the Display Subpatch Level to 1 for all objects and left the Render Level as it was.

    Now I want to reset the Display Subpatch Level to the Render Subpatch Level value but so far couldn't find a way to query that value.
    Is it at all possible at all I wonder? I suppose it is.

    I did some google on this topic but no success so far. I have only found a script in the plugin section at LW3DG's
    but that doesn't do a query, just set the levels to the desired value.

    All help are appreciated. Thanks.

  2. #2
    In case you can't find any script a quick way to look and edit the values is going to the Scene editor and change the property to Object:Geometry. Then you could order them by "render subpatch level" and change them in groups.

  3. #3
    Quote Originally Posted by Danner View Post
    In case you can't find any script a quick way to look and edit the values is going to the Scene editor and change the property to Object:Geometry. Then you could order them by "render subpatch level" and change them in groups.
    yes I thought about that but meanwhile I have found a script by Jeremy Hardin in an old thread and his solution is to parse the scene
    file which seems a viable road. I just need now some time to adapt his technique.

  4. #4
    da what? daforum's Avatar
    Join Date
    May 2006
    Location
    Bristol, England
    Posts
    1,677
    I thought LW Layout had scripts to do this?

    Just select all the objects in the scene you need to ( go to scene editor and highlight the objects ) then run the script "Display Subpatch Level" and enter a number, then all your objects will be changed to the same display level at once.

    There is also a script "Render Subpatch Level" to do the same for changing the level when rendering the objects.

    Hope it helps
    Montage Reel, Portfolio, PIN_01, Prime......«« go on, click on a link!

  5. #5
    thanks daforum, but I want to reset all object to the unique render subpatch level it was set to as the objects are set to different
    levels, some needs more subdivision some less.

    Btw I finished the script, it's just not very elegant.

    What I would like to have is to parse through the obejcts in the scene using getSelect and getting that damn subpatch info.

    . But how I extract subpatch subdivision information, it doesn't seem to be accessible unless I read the LWS file which is a bit clumsy.

  6. #6
    Here is the script. I used Jeremy Hardin's script from this thread:
    http://forums.newtek.com/showthread....arsing-Example

    Code:
    @warnings
    @script generic
    
    //here i'm storing the variables that will be called from more than one function.
    //their values need to be remembered.  so i'm making them global like so.
    
    var visLevel;
    var visLevelstr;
    
    
    generic
    {
    mySelection = Scene().getSelect();
    var i = 1;
    var extractinfo = 0;
    	AutoConfirm(1);
        content_dir = getdir("Content");
    	SaveSceneCopy("vis_level_bak.lws");
    	scenefile = File("vis_level_bak.lws","r");
    
    	InputLEVEL = s~^SubPatchLevel.*~;
    	InputOBJECT = s~^LoadObjectLayer.*~;
    
    	linenumber = 1;
    	
    	while(!scenefile.eof())
    	{
    	desiredline = nil;
    
    	lineread = scenefile.read();	
    
    	if(lineread == InputOBJECT)
    	{	
    	extractinfo = strsub(lineread,19,9); //extracted internal object reference
    	//info("object is: ",extractinfo);
    
    	while(desiredline != InputLEVEL)
    	{
    		lineread = scenefile.read();
    		desiredline = lineread;
    		linenumber++;
    	}
    
    	var extractlevel = strright(lineread,1);
    	visLevel = number(extractlevel);
    
    	SelectItem(mySelection[i].id);
    	SubPatchLevel(visLevel, visLevel);
    	i++;
    	} //end of inputOBJECT
    	
    	
    	}// end of while
    	
    	scenefile.close();
    	filedelete("vis_level_bak.lws");
    	chdir(content_dir);
    	AutoConfirm(0);
    
    }

  7. #7
    Axes grinder- Dongle #99
    Join Date
    Jul 2003
    Location
    Seattle
    Posts
    14,729
    Is there an underlying reason certain parameters are not available to the scripting languages?

    I've always wondered WHY.
    They only call it 'class warfare' when we fight back.
    Praise to Buddha! #resist
    Chard's Credo-"Documentation is PART of the Interface"
    Film the cops. Always FILM THE COPS. Use this app.

  8. #8
    This is just and example of how good is to have groups overriding parameters. You would just group all the objects and override their level to 1. Then when you were set you would remove the override.

    LW in terms of organization needs a lot of update.

    I'll be always here to ping-pong ideas if there's the will to move in that direction.

    Cheers

  9. #9
    Quote Originally Posted by bazsa73 View Post
    Now I want to reset the Display Subpatch Level to the Render Subpatch Level value but so far couldn't find a way to query that value.
    Is it at all possible at all I wonder? I suppose it is.

    I did some google on this topic but no success so far. I have only found a script in the plugin section at LW3DG's
    but that doesn't do a query, just set the levels to the desired value.

    All help are appreciated. Thanks.
    You can query the value via python.

    patchLevel(LWItemID item) → (display, render)¶
    Returns the interface and render patch level for item's subpatches.

    You could then use the Layout Command to set the level.
    SubPatchLevel("<display>","<render>");
    My opinions and comments do not represent those of my employer.
    www.ernestpchan.com
    www.zazzle.com/gopuggo

  10. #10
    @ernpchan:
    Boy, it took me a day to come up with this lousy absolutely non-elegant script. Whatever.
    @probiner: that's how Maya works isn't it? I have not used maya for a while but I remember vaguely. But anyways. In maya you just
    make a query and reset the values to the desired one. No need to parse scene files in occult ways.
    @jeric: I dont know Jeric, I just really dont know.

    Cheers Pals!

  11. #11
    Axes grinder- Dongle #99
    Join Date
    Jul 2003
    Location
    Seattle
    Posts
    14,729
    ernpchan, how would you store the desired value? That is: for whatever purposes you set everything to zero, how does each object know what to get reset to?
    They only call it 'class warfare' when we fight back.
    Praise to Buddha! #resist
    Chard's Credo-"Documentation is PART of the Interface"
    Film the cops. Always FILM THE COPS. Use this app.

  12. #12
    Quote Originally Posted by jeric_synergy View Post
    ernpchan, how would you store the desired value? That is: for whatever purposes you set everything to zero, how does each object know what to get reset to?
    My understanding of the OP's request is that he's only changing the Display value but eventually wants the Display value to match the Render value. So there's nothing to "store". We just need to read the current Render value.

    This would be the pseudo code for what bazsa73 wants.

    1. Get objects in scene.
    2. Begin iteration loop.
    3. Get Subpatch levels of object.
    4. Set Display Subpatch level of object based on found Render subpatch value.
    5. Increment loop to next item.


    My junk code worked....sorta.

    I wasn't able to set the Render display value because I wasn't sure what the format of the value was supposed to be in this Layout command.
    SubPatchLevel("<display>","<render>");

    But I was able to read both subpatch levels and set the Display value. I just have to figure out how to feed the "<render>" value into the Layout command. I think it wants a string but all the various incarnations of my string didn't work. I was only able to set the Display value which for the OP would work.

    I'll eventually investigate more as I'd like to figure out the proper syntax unless someone wants to chime in and give me the answer.
    My opinions and comments do not represent those of my employer.
    www.ernestpchan.com
    www.zazzle.com/gopuggo

  13. #13
    Axes grinder- Dongle #99
    Join Date
    Jul 2003
    Location
    Seattle
    Posts
    14,729
    I assumed the OP would want to set an optimum subd level, but also wanted for workflow purposes to temporarily set the subd level to some low value. So he'd want to save the various levels and later reinstate them.

    Aren't there something called "X-channels" for this kind of thing?
    They only call it 'class warfare' when we fight back.
    Praise to Buddha! #resist
    Chard's Credo-"Documentation is PART of the Interface"
    Film the cops. Always FILM THE COPS. Use this app.

  14. #14
    Quote Originally Posted by bazsa73 View Post
    I have objects with different subpatch level settings in my scene. And there are quite a lot,at least 30.

    Because interaction was lagging I set the Display Subpatch Level to 1 for all objects and left the Render Level as it was.

    Now I want to reset the Display Subpatch Level to the Render Subpatch Level value but so far couldn't find a way to query that value.
    Is it at all possible at all I wonder? I suppose it is.
    Hm, I read this as bazsa was temporarily setting all the display objects to 1 and then wanted to set the display back to what his render setting was. My guess is he's setting it to 1 to speed up interactivity but wants it back to the render value so VPR looks like the F9.

    If he wanted to save his settings to an external file to be read later that's still possible. Just insert a write command to a text file in the iteration loop.

    Either way, the answer to the question of how to query the subpatch level is to do it through python since that hooks into the sdk. That query command doesn't look to be available through lscript.
    My opinions and comments do not represent those of my employer.
    www.ernestpchan.com
    www.zazzle.com/gopuggo

  15. #15
    Quote Originally Posted by ernpchan View Post

    But I was able to read both subpatch levels and set the Display value. I just have to figure out how to feed the "<render>" value into the Layout command. I think it wants a string but all the various incarnations of my string didn't work. I was only able to set the Display value which for the OP would work.

    I'll eventually investigate more as I'd like to figure out the proper syntax unless someone wants to chime in and give me the answer.
    Jarno pointed me in the right direction. Arguments to a command are separated by a space, not a comma.
    Code:
    lwsdk.command("SubPatchLevel 6 15")
    My opinions and comments do not represent those of my employer.
    www.ernestpchan.com
    www.zazzle.com/gopuggo

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •