Jump to content

Embed Expressions Definitions


Recommended Posts

Yes, it is. You can put all your functions into a .expr file and add the .expr file to your OTL. Now you can exread the expr file out of OTL just like you'd "source" files from within an OTL. You can put the exread command into the OnCreate script or have a button for it or however you need it.

Hope this helps,

Jason

Link to comment
Share on other sites

Hi French (is it "David"?),

Here's one way to do it (there may be others):

Put all your expression functions in one file, then add it to your OTL as a new section (or add an empty section and fill it in). This is done through the OperatorTypeManager->[optype]->EditContents dialog. Let's say you put them in a section called "ExFuncs".

Next, you're going to add the following hscript command into a section of the OTL that is guaranteed to run either on every instance, or only once at load time (preferably the latter). The hscript snippet just loads the functions in the section "ExFuncs" into houdini. Something like:

exread opdef:/<optype>?ExFuncs

Where <optype> is replaced by the path to your type definition (e.g: /Sop/mySop).

Now the question is where to put this command. If the OTL already has a "CreateScript" section, then you can put the "exread..." line at the begining of that section... but then you'd have to redo this every time you alter the op definition through the UI. So perhaps a better place would be in the script that runs every time the op gets loaded: this is just another section called "OnCreated". You can either add a section by that name manually, or open up the "Operator Type Properties" dialog and add the line directly in the "Events" tab, for the event handler "On Created".

This makes houdini load all the functions embedded in "ExFuncs" every time it loads the op definition, making them available for use by the op itself, or anywhere else in the hipfile where this op is loaded.

Hope that makes sense :unsure:

Cheers!

@Jason: LOL! we posted at the same time :D (sorry for the redundancy)

Link to comment
Share on other sites

Thanks both! :)

(Yes, Mario, it's David!)

I just created a special operator that allow to flipbook-render ( could be mantra) all the steps of a modeling process as an animation in one single pass ( that is looping through all the SOPs with time), i will soon post a link to the animation ( i took an example with head modeling).

It could be nice that people share their work this way.

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