Jason Posted July 9, 2004 Share Posted July 9, 2004 Like with the 456.cmd script, I want to execute some hscript from a custom operator and modifying the nodes' parameters. How do I do that? Kinda like the "Before First Created" event script, but I need the node to have been created so that I can opparm its parameters around. The "On Created" event script is closer, but this event script not run when just opening hipfiles. The "On Updated" is also close, but the definiton is not being updated. I want to do this religiously for every time I open the hipfile. I am resistant to putting special-case code in the 456.cmd - is there a way to do this? Thanks, Jason Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted July 9, 2004 Share Posted July 9, 2004 Hey Jason, I think this should work... at least worth a try anyway. Add a section to your OTL and call it CreateScript. (just like that; mind the caps ) This is a script that runs every time the optype is instanced and, AFAIK, runs immediately after initialization -- basically the "123.cmd" for each OP. The script is passed the name (full path I believe) of the op; so the begining of the script would typically look something like this: if ( "$arg1" == "" ) then echo This script is intended as a creation script exit endif opparm $arg1 std_switcher_0 ( 1 ) In other words, it's no different than your standard creation script (like the ones in $HH/scripts) that run for the factory OPs. The above fragment for example, just changes the initial active parameter tab for one of my OPs (so it shows tab 1 at startup, instead of tab 0 which is the default). Anyway; as you can see, you can use opparm on the OP ($arg1) in the script... which is what you want, right? Cheers! P.S: Oh, almost forgot; I don't think you can add this script as an event handler through the Type Properties dialog; you have to do it manually through OperatorTypeManager->EditContents. (though maybe it's there in 7.0 -- running 6.1 at the mo... rfe maybe?) Quote Link to comment Share on other sites More sharing options...
Jason Posted July 9, 2004 Author Share Posted July 9, 2004 Hey Mario, I'm not in front of Houdini right now, but isn't this only run at inital creation time? I thought I tried this with a simple "message CREATED" command and it only did it when I put down the op for the first time, and not every time I loaded the file. Thanks, jason Quote Link to comment Share on other sites More sharing options...
michael Posted July 9, 2004 Share Posted July 9, 2004 hmmm... I thought otload might help...but it doesn't... I think what you're looking for is an event like "onOtload " - so that when Houdini loads an OTL into the manager it runs a script etc...this doesn't require that the OTL be instantiated... Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted July 9, 2004 Share Posted July 9, 2004 I'm not in front of Houdini right now, but isn't this only run at inital creation time? Ah yes... OK. No good then. I guess there's no instantiation going on during a load -- all OPs must be simply loaded as raw data...hmmm... then none of the "instance" scripts (OnCreated/Updated/Deleted, etc) would work since there are no OP-related events being triggered (just guessing here). Which would leave only the OTL-related events, like "BeforeFirst", which are instance-less... and yet you need an instance to exist before you can "opparm" anything Is this to modify (on-load) some kind of "template" hip that needs to get customized for different purposes? Because if it's just a fixed set of OPs that change on each load, then maybe you can create a sort-of "trojan" otl with a "BeforeFirst" handler that does nothing more than opread some pre-saved OPs, or source some external scripts, or whatever -- i.e: it "pushes" all initialization setup into the hip that's currently loading.... hmmmm... tricky, this... Quote Link to comment Share on other sites More sharing options...
puma.snyder Posted July 9, 2004 Share Posted July 9, 2004 You could try to embed a chopnetwork containing a logic chop (which references your script) in your custom operator. When you open the file, the chop should cook and trigger the script. Maybe this works Achim Quote Link to comment Share on other sites More sharing options...
Jason Posted July 9, 2004 Author Share Posted July 9, 2004 Hmm, yeah - I could try that CHOP method. Bit of a work-around, eh? Maybe I should copy SESI on this thread and get an RFE in for this. Cheers and thanks for all your help, Jason Quote Link to comment Share on other sites More sharing options...
Marc Posted July 9, 2004 Share Posted July 9, 2004 Just as an aside, this is something a bunch of people here at Sony were trying to do. I don't believe there was ever a satisfactory resolution to the question though. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.