Jump to content

Select Script(s)


Recommended Posts

just wondering if anyone knows of a demo file for Select Scripts...

in another thread edward said :

Everything that an animator needs should be a parameter in your custom optype. So instead of having custom parameters on your controller objects, you simply add more parameters in your custom optype. If you need quick access to them when you select the object, I think you can make use of the Select Script parameter (Misc page of all object parameters). Perhaps something like "opset -C on ..; opparm .. stdswitcher( 2 ); opparm .. std_switcher_0( 2 )" where std_switcher_0 is your swticher parm name under Controls and the 2 in brackets for it is the page you want to switch to.

and I 'get it' (it's like a scriptJob in Maya), but I don't really understand how to implement it...and the reference to 'page you want to switch to' confuses me as well...

Link to comment
Share on other sites

thanks edward...but...

I made an OTL (find atached), it's just a default geo, and I promoted the tr and rot parameters up to the top.

in the Misc page of the geo I put "opset -C on ..; opparm .. stdswitcher( 2 ); opparm .. std_switcher_0( 2 )" (with quotes?)

now while inside the OTL if I select the geo I get an error :

Selection Script errors found for 'obj/selectScript_Test1/geo1': 
Unknown command : opset -C on ..; opparm .. stdswitcher( 2 ); opparm .. std_switcher_0( 2 )

if I don't put it all in quotes I get:

Selection Script errors found for 'obj/selectScript_Test1/geo1': 
Can't find ..
Can't find ..
Can't find ..

so thats problem #1 (which I'm sure is my fault...)

but problem #2 is that I have to be inside the OTL to get anything to happen when I select the geo....but I would like to be outside the OTL > up at the OBJ level when selecting things.

problem #3: the rig that I've been working on has lots of controls, and I'm nowhere near finished...so the Controls page is going to be really really long (even without any facial controls)....so what to do?....is it possible to make more control pages?...like "R_Hand Controls", "L_Hand Controls" etc etc?

selectScript_Test.otl

Link to comment
Share on other sites

hmmm...ok:

I solved problem #2 > I had "Select entire subnet" on > should be off for this to work <_<

still not getting anywhere with #1 or #3...

just playing around has led to more things I can't figure out...

what I'd like to have is a button parameter for switching between IK and FK

when the button goes from one to the other a few things need to happen:

toggle the selectability of the FK blocks/IK Handle

keying of rotations / IK Handle and/or snap to IK/rotations etc

changing the color of the FK blocks - just to provide a visual indicator of what state the rig is in

keying the IK blend and twist

all of the above can be done with hscript in the callback field...right?

something like :

if IK_FKButton == 0

do a bunch of crap

else

do some other crap

so what I've started to do is play around with making a button parameter but I'm running into some probles with the auto-link field...I've looked at a few other ops by dragging them into my OTL to see how things are done and I've tried to copy the auto-link syntax for my new button but I get infinite recursion errors and some other stuff...also I've make the FK/IK button with the menu by having token 0 = FK and token 1 = IK with a default of 0, but both IK and FK show a little star - indicating that they are both non-default.

so clearly I'm not sure what the hell I'm doing :rolleyes:

any guidence would be great!

Link to comment
Share on other sites

  • 2 weeks later...

Did you manage to work problem #1 and #3 out? First of all, the " didn't work for me, so I took them out and then I used the `opfullpath (..)` structure which worked fine. If you create folders in your optype (Create ... new folder) then the parameters to acces the folder tabs are named like std_switcher_0 for the firlst one and then std_switcher_1 and so on.

Take a look at the optype I altered from yours.

DRie.s

selectScript_Test.otl

Link to comment
Share on other sites

thanks, I'll have a look :)

edit >

works really well...

you had the same selection script in both objects, but I figured out how to change that :)

I'll have to break it down and try to understand it fully...but having a working eg. is great!

thanks again

Link to comment
Share on other sites

where is this stuff documented?

opset -C on `opfullpath("..")`; opparm `opfullpath("..")` stdswitcher( 2 ); opparm `opfullpath("..")` std_switcher_0( 1 )

some of this I understand:

opset -C on > sets the op to be current

`opfullpath("..")` > gets the op

but.. :

stdswitcher(2) > I can't find any reference to it at all...and the (2) must mean something but what?

and :

opparam `opfullpath("..")` std_switcher_0(1) > seems clear enough, changes the std_switcher_0 from whatever it currently is to 1.

Link to comment
Share on other sites

the ==>stdswitcher(2) stuff referes to the current folder being displayed for the OP in question.

The syntax is not obvious at first but seems logical.

ex. if you wanted to automatically pop the user to the Physical Tab/Folder for the default model OP in the object view--> opparm model stdswitcher ( 3 3 3 3 3)

It has five folders, hence the 5 3's and to flip to the right one you have to make them all go to the same #.

It is pretty cool if you think about it. You could use select scripts to do visual clues in the viewport and more informative display updates.

-k

Link to comment
Share on other sites

ah, OK...

I opened up an OTL in a text editor and saw the "stdswitcher ( 3 3 3 3 3)"

and I think I'm starting to understand how it works...and yeah it is cool :)

but it's hard to figure it out without documentation....how did you guys learn?...trial and error? :)

Link to comment
Share on other sites

just type in the commands in the textport and look what happens. You can navigate just like you would in a file system. You can execute expressions using this syntax ` expression `. Try echo `1+1` for example.

So there is that trial and error thing and there is the help and exhelp commands.

Good luck.

DRie.s

Link to comment
Share on other sites

opset -C on > sets the op to be current

`opfullpath("..")` > gets the op

opfullpath("..") will return the parent object.

So if your seletion script was on light2 for example.

echo `opfullpath("..")` would print out /obj.

If you want the current object just use the "."

jim.

Link to comment
Share on other sites

opparm /obj/folder stdswitcher (2); opparm /obj/folder std_switcher_1(1)
                   |                       |                                                       |
             the node                  |                                          the folder *within* that folder
                                    the page of the current node

I'm not sure about the std_switcher_#

I can't find that anywhere (in Houdini 6.1). Instead try the subswitch# opparm instead.

Create a Shader SOP and do a opscript on it. You'll see the subswitch# params.

Edward did std_switcher_# get replaced?

jim.

Link to comment
Share on other sites

opparm /obj/folder stdswitcher (2); opparm /obj/folder std_switcher_1(1)

| | |

the node | the folder *within* that folder

the paramter you are changing in THAT node, NOT the current.

opscript is a good command to get the grips with it all. Indeed, the stdswitcher parameter is not documented. But if you find out how it works, you can be proud B) you found it all yourself.

The std_switcher_# is a parameter that is added when you make new custom folders within an optype. Quite strange there is that extra underscore...

And how the f* do you guys get these nice windows?

Link to comment
Share on other sites

@Jim,

no you don't have to use all those numbers.

It is just a way to keep form, incase you forget what is what and how many folders are there I guess.

I was thinking it would be nice to have the pick script, check and see if the selected op is current, flip the parameter pane to the op and to the correct folder.. snazzy stuff.

-k

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...