Jump to content

Revert To Defaults


deecue

Recommended Posts

hi all, is there a hscript command that reverts all parms back to their defaults.. much like you would expect under the presets drop down menu under the top tow bar in the parameters pane..

i searched all over for this but can't find anything on it.. so for now i just have a bunch of opparm's set to their default values..

Link to comment
Share on other sites

hi all, is there a hscript command that reverts all parms back to their defaults.. much like you would expect under the presets drop down menu under the top tow bar in the parameters pane..

i searched all over for this but can't find anything on it.. so for now i just have a bunch of opparm's set to their default values..

21346[/snapback]

If you are using a HDA sometimes you can get away with source the creating script.....

Like....

#remove all the keyframes
chkeyrm *
#source the creationscript
source opdef:/Object/myHda?CreationScript $op

But I agree...there should be some sort of revert to default hscript command

Link to comment
Share on other sites

But I agree...there should be some sort of revert to default hscript

I'd swing over to the SESI forum and RFE it there :) Who knows, it might be easy enough to sneak in for the 8.0 release?

PS. interesting solution, Wolfwood - ne'er thought of that approach.

Link to comment
Share on other sites

this was for an hda so sourcing the creation script works out well.. nice idea.. i basically had a bunch of presets accessible through a drop down menu and loaded them from a callback script.. but i wanted each preset to return to default before setting it's own parms..

but i'll def go RFE this over at sesi now..

thanks guys..

Link to comment
Share on other sites

Just whipped this up so it isn't exactly throughly tested yet. Let me know how

you get on.

Copy it to your ../houdiniX.X/scripts folder and name it "reset.cmd". Run it

in a textport by typing reset.cmd followed by the full path to the node to be

reset (easiest way to do that is to select the node and drag it onto the textport).

# reset.cmd   -   Reset a node to its defaults

set node = $arg1

if (`opexist("$node")` == 0)
        echo "Node not found: $node"
        exit
endif

# Remove keyframes
chrm ${node}/*

# Remember the current path and switch to the network containing the node
set savePath = `oppwf()`
opcf `opfullpath ("${node}/..")`

# Reset parameters to defaults by copying parms from another temporary node
set nodeType = `optype ("$node")`
set defaultNode = `execute("opadd -v $nodeType")`
set parmList = `execute("opparm -d $defaultNode *")`
set firstSpace = `index("$parmList", " ")`
set chopOpparm = `substr("$parmList", $firstSpace, strlen("$parmList") - $firstSpace)`
set secondSpace = `index("$chopOpparm", " ")`
set defaultParms = `substr("$chopOpparm", $secondSpace, strlen("$chopOpparm") - $secondSpace)`
opparm $node $defaultParms

# Remove the temporary node
oprm $defaultNode

# Change back to the directory that called the script
opcf $savePath
set -u $savePath

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...