PDA

View Full Version : viewport display state toggle



geo_n
12-28-2010, 09:11 AM
Is there a way to make a selected object and its display state toggle via a button or keyboard shortcut? hidden, vertices, shaded, textured, textured wire, etc.
I click Itemvisibility with command history process Itemvisibility 0,1,2 etc. So does that mean it can be made an lscript? Have no idea with scripting.:D

evenflcw
12-28-2010, 09:48 AM
Yes you can toggle item visibility via lscript. Everything in the command history can be issued through Lscript. If there isn't a specific lscript function for it, you can still call it via CommandInput("ItemVisibility 1");

Mind you, the command only works for the first selected item, even if you have multiple selected. So if you want to process multiple items, you'll have to select and execute the command once for each item.

geo_n
12-28-2010, 06:05 PM
Mind you, the command only works for the first selected item, even if you have multiple selected. So if you want to process multiple items, you'll have to select and execute the command once for each item.


That's ok. Its to toggle back and forth with a character rig.
So I just make a text file with CommandInput("ItemVisibility 1"); for example and load that as an lscript and make a kb shortcut?

evenflcw
12-28-2010, 09:56 PM
For lscript you need a few more lines so LW knows what kind of script it is and were to start.


@version 2.5
@script generic

generic
{
CommandInput("ItemVisibility 1");
}

Another option is to do a CS (CommandSequence) macro, preferably through the LScript Commander, in which case a single line will suffice, just "ItemVisibility 1" will do (without the apostrophes). Just start the LS Commander, input the line and choose something like Create Macro or Install from the panels menu, and it'll save it to a file, install it, and give it a button. I would think this is explained in the manual. If not, Proton made a video about it I think (see NT website).

geo_n
12-29-2010, 04:28 AM
Thanks for the basic lesson in lscript :D
It worked! I can switch between bounding box and shaded instantly for a selected object.:thumbsup:
I wonder if its possible to automatically select the mesh parent when activating this command so that when Im animating controllers or bones and activate it, the mesh object switches to the chosen visibility. Maestro has a button to select the mesh even if its parented to a null.

The command history is
Command History
Interactive Mode
SelectItem 10000000
SelectItem 10000000
SelectItem 10000000
SelectItem 10000000
SelectItem 10000000
SelectItem 10000000
SelectItem 10000000
SelectItem 10000000
AddRotation 0 0 0
InteractiveMode

evenflcw
12-29-2010, 05:46 AM
Maestro is written in LScript, not CS. Using CS (CommandSequence; Layouts internal command system; which is not the same as LScript) you can only execute commands. You cannot call any functions or make queries and there are no objects or data types. Only commands and their arguments.

If you want to select the mesh parent in CS you'll have to find a command to do it. You have commands to select parent, but obviously you have no means to tell when you've reached the mesh and know when to stop. A cheap substitute might be to simply call the command that switches to Object selection mode. But basically, it can't be done reliably in pure CS.

In LScript you could do it proper via a loop that that traverses the hierarchy until it finds the root mesh. I'd look on flay.com for a script that deals with parent/child selection for a quick way to learn how this is done, or pick up the LScript manual. :)

geo_n
12-29-2010, 06:01 AM
Maestro is written in LScript, not CS. Using CS (CommandSequence; Layouts internal command system; which is not the same as LScript) you can only execute commands. You cannot call any functions or make queries and there are no objects or data types. Only commands and their arguments.

If you want to select the mesh parent in CS you'll have to find a command to do it. You have commands to select parent, but obviously you have no means to tell when you've reached the mesh and know when to stop. A cheap substitute might be to simply call the command that switches to Object selection mode. But basically, it can't be done reliably in pure CS.

In LScript you could do it proper via a loop that that traverses the hierarchy until it finds the root mesh. I'd look on flay.com for a script that deals with parent/child selection for a quick way to learn how this is done, or pick up the LScript manual. :)

Yes that was the problem I saw that if there's a null or any parent over the mesh, it selects that not the mesh. Maestro does it only selecting the mesh in the hierarchy, really smart.
I will check the docs or video tuts for lscripting, even if I suck at math :D

Dodgy
12-29-2010, 06:58 AM
http://www.mikegreen.name/Lscripts.html#Visibilty

Are my versions.

Mike

geo_n
12-29-2010, 07:13 AM
How did i miss that! Its not in my mike green plugin folder and not listed in flay ot lwdb. Will check it out. Thanks.