Calling function from python source editor

   3367   4   0
User Avatar
Member
64 posts
Joined: Oct. 2009
Offline
I stored some functions in the python source editor window however when I try to call the function for an expression, it doesnt work. It is very unstable sometimes i would be able to call the function, sometimes it doesnt. Am i doing something wrong ? cause i thought fucntion in the python source editor can be access from everywhere in houdini, thanks
User Avatar
Member
1904 posts
Joined: Nov. 2006
Offline
Can you provide an example? I don't think I can recall ever having problems with doing this so if you can provide a file that illustrates it then hopefully it can be fixed.
Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
64 posts
Joined: Oct. 2009
Offline
Ya sure, attached is an example file. I can't seem to call the function from python source editor in the group node, pattern parameter. It doesn not response.

Oh there is another issue everytime i try to edit the expression in the group node this error msg pop out

Error evaluating autocompletion:
“ File \”<stdin>\“, line 1
__import__('houdiniInterpreter').getCallTipOrAutoCompleteArgumentsList('grid_i=hou.evalParm(\”/obj/geo1/gridres1\")
^
SyntaxError: EOL while scanning single-quoted string

What seems to be the problem? its not affecting the running of the file but it just always appears.

Thanks alot

Attachments:
test1.hipnc (42.4 KB)

User Avatar
Member
1904 posts
Joined: Nov. 2006
Offline
There are several issues here, none of which really have to do with hou.session.

The main problem which is causing the error is that your function inside the session module is trying to use variables that don't exist inside it. You need to pass your grid_* values to the function.

Secondly your function is trying to print a value. This print statement makes the value go to the console. You need to return a value, not print. Also, you can't really just return a python list, you need to return a string of some sort. For example,
return "%s, %s, %s" % (i, j, k)
Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
64 posts
Joined: Oct. 2009
Offline
thanks alot , I see what u mean, still a very new houdini user thanks again
  • Quick Links