modify groups

   2360   5   1
User Avatar
Member
43 posts
Joined: March 2016
Offline
Hello everybody

I want to modify the content of a group.

I have a group with primitives (or points), and I want add or delete primitives based in my viewport selection, I don´t want make a new group, or add manually numbers of primitives.

I used “Reselect for Current Tool” (keyboard shortcut ' ) but, it adds a new group node with the new selection based on viewport, not modify the older one.

Thanks you
Edited by Gerardo Castellanos - June 29, 2016 10:52:59
Gerardo Castellanos
www.gerardocastellanos.com
User Avatar
Member
2537 posts
Joined: June 2008
Offline
Don't fret over a new node being created. Middle Click and HOLD on the last node created to inspect the result. Read the information in the black poup box to see the result of your new operation.

If you want all your selections in a single group node copy the numbers generated in the second group node and paste them into the first group node either at the end or the beginning of the current pattern of numbers, preserving the original numbers and extending the selection.

Argh….I manually had to do that operation.
Edited by Enivob - June 29, 2016 11:25:21
Using Houdini Indie 20.0
Windows 11 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
User Avatar
Member
43 posts
Joined: March 2016
Offline
In some nodes, as facet, color, blast, etc, you have an arrow icon next to group parameter.
you can click in that arrow and change your selection in viewport, press enter, and your list of primitives or points update automatically.
I guess why group node does not have it.
Gerardo Castellanos
www.gerardocastellanos.com
User Avatar
Member
402 posts
Joined: June 2014
Offline
Hello!

This has driven me nuts in the past, so I thought I bang it on the head meself. Try this out:
import toolutils;
node = hou.pwd();
viewer=toolutils.sceneViewer();
entity = node.parm("entity");
typename = entity.menuLabels()[entity.eval()];
typeobj = getattr(hou.geometryType, typename);
initial = node.parm("pattern").eval();
selection = viewer.selectGeometry(
    "Select geometry...",
    use_existing_selection=False,
    initial_selection_type = typeobj,
    initial_selection=initial,
    geometry_types=(typeobj,)
);
string = selection.selectionStrings()[0];
node.parm("pattern").set(string);

copy that code, create a button on the parameter interface for the group node and call it what you fancy. Paste the copied code into the callback script and try it out. It should set the geometry type to whatever the group ‘Entity’ parm is set to. Pretty rough and ready but seems to do the trick.

Let me know if it's useful
Henry Dean
User Avatar
Member
402 posts
Joined: June 2014
Offline
Hmmm, this is definitely one of those where you look back and think “probably rushed that…”, so sorry for the crappy code.
This is for me certainly a case for an RFE, but in the meantime, I'll try and cook something more sensible up with action buttons… (what the group field in supported SOPs actually use. *insert head slap here*)

PS the soputils module is a new wonder for me!
Edited by friedasparagus - June 30, 2016 11:20:51
Henry Dean
User Avatar
Member
402 posts
Joined: June 2014
Offline
import soputils;
kwargs['geometrytype'] = kwargs['node'].parmTuple('entity');
kwargs['inputindex'] = 0;
kwargs['parmtuple'] = kwargs['node'].parmTuple('pattern');
soputils.selectGroupParm(kwargs);
cough, cough… slightly tidier. Life gets so much more straightforward when you stop reinventing the bloomin wheel, possible improvement to this one is getting back the initial selection of the current ‘group pattern’
Edited by friedasparagus - June 30, 2016 11:48:00
Henry Dean
  • Quick Links