Jump to content

Multi line expressions in python/hscript


siddd

Recommended Posts

Hey all,

I was wondering if anyone might be able to give me a quick pointer on how to write expressions that have multiple lines of code in them inside Houdini. I basically just want to do the following (simplified version)

dist = distance(0,0,0, $TX, $TY, $TZ)
div = dist / 5

/obj/meshing/attribcreate1/value1 = div

And that's it! Does anyone know the correct python and hscript syntax for this?

Cheers,

Sid

(Total n00b)

Link to comment
Share on other sites

{
float dist = distance(0,0,0, $TX, $TY, $TZ);
float div = dist / 5;
return div;
}

in AttributeCreate/value1 parm. In case of Python expression, open expr. editor (Alt+E) and put the code as it be a body of a function.

Edited by SYmek
  • Like 3
Link to comment
Share on other sites

  • 7 months later...

How can i do this with python?

Easy by using the expresion editor but my

pre render script has some lines i want to set there from my farm rop module...

Ah by the way is pre render script expected to run before idf file generation?

Edited by katisss
Link to comment
Share on other sites

That I do is use the expression editor in the "edit / Aliases and Variables" to create a function, and then call that function.

If your expression is more then one line this is a lot easier to manage, and you can re-use it elsewhere.

Link to comment
Share on other sites

Expression editor is probably not an option, no way of putting multiline python?

Another person sets the rops and the farm rop is only managing the renders...

That I do is use the expression editor in the "edit / Aliases and Variables" to create a function, and then call that function.

If your expression is more then one line this is a lot easier to manage, and you can re-use it elsewhere.

Edited by katisss
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...