Jump to content

Handling geometry selection in HDA


Recommended Posts

So I'm making a HDA wich has a color sop inside of it, of wich Im using the group field, thats why I need to acces this field at the upper level (the HDA interface).

So to to do this, when building the HDA interface I dragged that field directly from the color sop to the HDA interface, (pic1/3)but when I try to use it from the HDA it throws this error (pic2), wich I guess is referencing this code inside the group's script (pic4).

I've never messed around with this kind of stuff, how can I solve this?

screen1.jpg

screen2.jpg

screen3.jpg

screen4.jpg

Edited by SteveNi
Link to comment
Share on other sites

Lol, missing the .hda/.otl, too. So I can't say specifically what is wrong with that setup, share that too, and don't lock it.

At any rate, If you just promote the group parameter through the Edit Parameter Interface/Edit Operators Type Properties as you did then the group drop down menu should work by default. You should never have to touch the Action Button script area. The only code to edit would be in the Menu > MenuScript dialog if you wanted to edit it i.e.

opmenu -l color1 group

that is in hscript to reference the other group menu.

PromoteParameterFromNode.png

GroupDropDown.png

You can do this in python, too. As for using python to create it from scratch, one of the issue with the drop down menu, is you need a Label and a parameter value as an array in python. I'm probably butchering the python terms there just then. However, the label appears in the drop down menu, and the parameter value is what appears in the editable field. I think that may be stretching from the issue.

Alternatively you may just need to re-create the hda again. Sometimes shit just breaks and a clean rebuild will fix it. Example are the attached hip and hda.

GroupMenu.hip GroupMenu.hda

Edited by LaidlawFX
Notice I screwed up the code section on hscript
Link to comment
Share on other sites

So the error you are having is in the on your parameter select_some_polygons on the Menu > Menu Script Hscript code, your is on the left/top and the new one i promoted up is on the right/bottom

GroupDropDownMenuError.pngGroupDropDownMenuFix.png

for the opmenu script to work you need the name of the parameter at the end.

http://www.sidefx.com/docs/houdini/commands/opmenu

so by taking your script and adding group to it, it will work as that is the name of the parameter it is referencing.

opmenu -l color2 group

group_test.hdanc

I didn't replicate the python error, so I can't help on that.

Hope that helps.

Link to comment
Share on other sites

I just tried the same scene in 15.5.480 and it still fixes it.

You might have a red herring, as in your issue may lie elsewhere. You can copy and paste the entire text from the error message as I can not repeat it, but it is probably being caused by something else you do not notice and just causing the error to appear there. 

 At this point I would suggest discarding the HDA, and making it from scratch. That would 100% cure the issue. If it doesn't then the issue certainly lies elsewhere, and you need to look further.

Link to comment
Share on other sites

Ah OK I can repo no problem now in 16 and 15. My misunderstanding on what you were doing.

Send that to SideFX as a BUG for sure, include the video for the repo.

The code below you pointed out before is referencing the wrong node I believe, now that it is promoted. As I understand kwargs(which is piss poor) are for the the current node context. This should be a link to the original node to work as I would understand. As this would happen every time you promote this group from the color node, I would classify it as a bug. I believe it is looking what type of entity/group type you are looking for i.e. primitives, edges, groups... So in short on the color node if you also promote up the parameter entity this menu would work. Or you can force it by using the line of code like from the point sop (hou.geometryType.Points,), or (hou.geometryType.Primitives,), or (hou.geometryType.Edges,). In addition I think you can redirect the kwargs['node'].parmTuple('grouptype') to reference the value of the parameter in the HDA... But you know brain fart on my end, LOL.

import soputils
kwargs['geometrytype'] = kwargs['node'].parmTuple('grouptype')
kwargs['inputindex'] = 0
soputils.selectGroupParm(kwargs)

The catch I found when i tried other nodes, is some of them worked.... so it appears not every node uses the same code in that context, plus people may be promoting up the other referenced parameter too. Which is why I think you may have discover this where others have not bothered to look. Below is the code from the point1 group if you promote it up, this only works on points and does not reference any other types i.e. primitives.

import soputils
kwargs['geometrytype'] = (hou.geometryType.Points,)
kwargs['inputindex'] = 0
soputils.selectGroupParm(kwargs)

The delete node's group would also error out as if your promote it up, then it errors the same too.

Here is the full error output. This would be the specific error code to also share with SideFX. They could report as designed... however the error code seem to fall back on edges of all things, the least supported type. Maybe request in the least it to default to the last chosen option, i.e. the colors default is point... idk, they would know best, as that is way farther down the rabbit hole.

Traceback (most recent call last):
  File "Parameter Scripted Action", line 4, in <module>
  File "C:/PROGRA~1/SIDEEF~1/HOUDIN~1.480/houdini/python2.7libs\soputils.py", line 219, in selectGroupParm
    if hou.geometryType.Edges in geotypes and len(geotypes) > 1:
TypeError: argument of type 'NoneType' is not iterable

Good find!

Link to comment
Share on other sites

  • 1 year later...
On 4/20/2017 at 9:18 AM, SteveNi said:

I can finally reply after the maintenance on this site.

So yea, if you import the "group type" menu it will work, but not without it.

Ill report this to SideFx by also refer to this topic :)

Thanks

tip: once you have the group type you can make those parameters invisible

  • Like 1
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...