Hou Moudle

   7134   12   0
User Avatar
Member
52 posts
Joined: June 2009
Offline
Hi everyone,

Im learning hou moudle for the past couple of days.
i like to feed three positions as input to the python node using mouse.

i tried the following piece of code for achieving it.

import toolutils

scene_viewer = toolutils.sceneViewer()
positions = scene_viewer.selectPositions(prompt='Click to specify a position', number_of_positions = 3, connect_positions = True,
show_coordinates = True,
bbox = hou.BoundingBox(0.1,0.1,0.1,0.1,0.1,0.1),
position_type = hou.positionType.WorldSpace,
icon = None,
label = None)


but everytime im running it, im able to select the points but at the end of selections, it gives me a fatal segmentation fault..

can some one pls help me..??

Thanks a lot in advance
User Avatar
Member
3 posts
Joined: May 2009
Offline
This piece of code works for me
User Avatar
Member
52 posts
Joined: June 2009
Offline
sorry whisperwing, I forgot to mention something.
Im trying to create this python node dynamically inside a digital asset on pressing a button. When i press the button, the node is created but the above mentioned problem exists. Any idea of how to overcome it..?

If u wanna see my asset, i can upload it.

Cheers.
User Avatar
Member
1906 posts
Joined: Nov. 2006
Offline
No reason that I can think of that it wouldn't work. It would definitely help to see an example of just how exactly you are calling the code and from where.
Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
52 posts
Joined: June 2009
Offline
I have uploaded the asset. Try this out and let me know where i went wrong.

pls help me out with this guys..

Attachments:
my asset.zip (4.9 KB)

User Avatar
Member
1906 posts
Joined: Nov. 2006
Offline
It seems your zip file is missing the asset file. If you could either add that, or embed the asset in the hip file that would be great.
Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
52 posts
Joined: June 2009
Offline
Hi graham,
Sorry for that. I hav attached the otl along with this post.

Attachments:
my asset.zip (4.2 KB)

User Avatar
Member
1906 posts
Joined: Nov. 2006
Offline
Unfortunately there still doesn't seem to be the necessary stuff attached. Your 2nd file has the asset, but it's for a different type of operator than was missing in the first file. Also, this asset merely tries to create another node inside but fails because that asset definition of that node is not included.
Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
52 posts
Joined: June 2009
Offline
Since i am a newbie to this, can you telme wat is the asset file missing exactly and wat is that asset definition mean..?
User Avatar
Member
1906 posts
Joined: Nov. 2006
Offline
For every operator, Houdini essentially requires that operator to be defined by a operator type definition. When you RMB on a node and go Create Digital Asset you are in effect creating a new type definition for an operator, providing information about it (name, label, number of inputs, etc) and where it is located. When you have scenes that rely on external operator libraries, .otl files, and attempt to transfer them or provide them for other people, you must also include any relevant otl files, or embed them into the scene file so they can properly load the scene. In this case there are some missing.

Window -> Operator Type Manager allows you to view your current session and see all the operators defined in Houdini and where they are located.

In the first file you uploaded, there is the hip file, myasset.hip, that has an instance of a digital asset of type kkkkk. From what I can tell, this node has a button named “parm” in the Subnet folder that is attempting to call kk() from the assets PythonModule. I assume the code it is trying to call is the code you posted above that crashes? However, Houdini is unable to find your operator, kkkkk, and is displaying a warming. This prohibits anything involving the button to be done since as it cannot find the definition of the operator, it cannot do anything. In this case it just shows up in Houdini as an empty asset and non-functional buttons.

In the second file, there is an otl file that defines an object operator of type “myasset”. This asset contains a standard geo node and has a button Road in the my_asset folder. When attempting to press the button it generates a series of errors. The first that it cannot create a node in a locked asset, and the second, once I unlock the asset is that it is trying to create an invalid node type. Looking at the code in this assets module, it appears to be attempted to create an instance of an operator of type “road_coords”. This operation fails because it cannot find the definition of that type of operator.

In order to properly diagnose your problem, it would be best if you could upload a new zip file that has all the relevant scene and otl files in it so the steps to reproduce are minimal. Ideally you should be able to extract it, launch Houdini with the hip file, and then press the button to get the error.
Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
52 posts
Joined: June 2009
Offline
Hi graham, sorry for the delay. Got a prob with my lap. I hav attached the hip file. Chk it out pls.

Thanks a lot in advance.

Attachments:
asset.zip (15.2 KB)

User Avatar
Member
1906 posts
Joined: Nov. 2006
Offline
I was able to reproduce the crash. After talking to another developer it seems this bug is related to a rather tricky bug I encountered last week.

Basically what is happening is that in the last line of your module, where you tell it to set the new road operator as the current node it is running into a bit of an issue because it's being run from a parameter callback. If you remove that line of code it shouldn't crash anymore. Looking at the Journal I think the bug may be been fixed in today's build but it apparently didn't go through last night and I'm not able to test it out.

I do have a suggestion about your workflow though. Currently you have the position selection operation going on inside your python operators cook code. This is bad because every time your operator has to cook/recook, or you load the scene or anything like that you will have to reselect positions. A better way to do that part of the operation would be to have the selection occur in an OnCreated script. This way when you create the operator it will automatically run the selection like it does now and you can then store your selected positions in 3 position parms on the road operator. This way you don't have to reselect every time it cooks, as well as it allows you to manual tweak positions after you have interactively selected them. Depending on if you want to make the number of positions variable you could even use a multiparm to store all your positions.

Also, in my tests, if I called setCurrent() from within my OnCreated script it wouldn't crash. I would suggest moving that, as well as the call to set the display flag to this script. Alternatively, instead of using the OnCreated script, you could incorporate the code into the tool definition. However, in your case where you have a parent asset generating the node this wouldn't really work since the tool code wouldn't be called.
Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
52 posts
Joined: June 2009
Offline
Thanks a lot graham. Its not crashing after i removed the setCurrent() statement.
  • Quick Links