Type properties: drop-down menu of a single attribute?
316 8 0- gordig
- Member
- 54 posts
- Joined: 9月 2019
- Offline
I'm getting decent at VEX, but have NO idea about HScript or python, so I'm just trying to reverse-engineer the solution from existing nodes. The current project is an HDA to set up Daz Genesis 8 figures for APEX rigging, ragdoll, facial mocap and so on. One of the options I want is a list of all the prim-level @name entries. The best I've been able to do so far is reproducing a list of all prim-level attributes, but I don't even know how to conceptualize the solution. opmenu might be an option, but it keeps throwing up syntax errors that I can't figure out how to resolve.
- gordig
- Member
- 54 posts
- Joined: 9月 2019
- Offline
I threw this code into a wrangle:
Which outputs this:
Which, as far as I can tell from the information I've found, is how Python wants the data to be formatted in order to output a menu, but I keep getting an error message about the data needing to be a flat list of strings....so how is it not exactly that?
string @name[]; int i; int j = nuniqueval(0, "prim", "name"); string nmz[]; nmz = uniquevals(0, "prim", "name"); for (i=0; i<j; i++) { string indx = itoa(i); @name[i*2] = itoa(i); @name[i*2+1] = nmz[i]; }
Which outputs this:
[ 0, 4Syt.Shape, 1, ArctekArm.Shape, 2, DFPants.Shape, 3, HairCap.Shape, 4, HersiliaBrows.Shape, 5, HipHopSneakers.Shape, 6, Lashes.Shape, 7, LashesBase.Shape, 8, PaceHoodie.Shape, 9, visor_2.Shape ]
Which, as far as I can tell from the information I've found, is how Python wants the data to be formatted in order to output a menu, but I keep getting an error message about the data needing to be a flat list of strings....so how is it not exactly that?
Edited by gordig - 2024年12月19日 19:53:19
- tamte
- Member
- 8832 posts
- Joined: 7月 2007
- Offline
- gordig
- Member
- 54 posts
- Joined: 9月 2019
- Offline
- gordig
- Member
- 54 posts
- Joined: 9月 2019
- Offline
A couple additional questions:
A wrangle inside the HDA strips the ".Shape" from the @name, so how would I make the menu reference that wrangle, rather than the names fed into the HDA?
I've also got a slot for character name with a checkbox to make the figure name the same as the character name, but I've only been able to implement that in wrangles inside the HDA. How would I make figname = charname within the type properties depending on the value of that toggle?
A wrangle inside the HDA strips the ".Shape" from the @name, so how would I make the menu reference that wrangle, rather than the names fed into the HDA?
I've also got a slot for character name with a checkbox to make the figure name the same as the character name, but I've only been able to implement that in wrangles inside the HDA. How would I make figname = charname within the type properties depending on the value of that toggle?
Edited by gordig - 2024年12月19日 22:00:11
- tamte
- Member
- 8832 posts
- Joined: 7月 2007
- Offline
gordigChange this line
A wrangle inside the HDA strips the ".Shape" from the @name, so how would I make the menu reference that wrangle, rather than the names fed into the HDA?
geo = kwargs['node'].inputGeometry(0)
geo = kwargs['node'].node("my_internal_wrangle").geometry()
Tomas Slancik
FX Supervisor
Method Studios, NY
FX Supervisor
Method Studios, NY
- tamte
- Member
- 8832 posts
- Joined: 7月 2007
- Offline
gordigNo idea what figure name is, is it a string parm you want to populate or just some internal attribute or something?
I've also got a slot for character name with a checkbox to make the figure name the same as the character name, but I've only been able to implement that in wrangles inside the HDA. How would I make figname = charname within the type properties depending on the value of that toggle?
If character name is already a parameter and you just want that checkbox to internally use the same name for whatever figure name is, then your internal logic may be fine
If you want it to do something in the parameter pane UI then you either can do parameter callback in your checkbox or link stuff with expressions or hide/unhide different parms all depending on what you actually want to do
Tomas Slancik
FX Supervisor
Method Studios, NY
FX Supervisor
Method Studios, NY
- gordig
- Member
- 54 posts
- Joined: 9月 2019
- Offline
Sorry for not explaining. Character name is...well, self-explanatory, while figure name is the name of the actual figure geometry (by default something like "Genesis8(Female/Male).Shape". charname goes into things like Apex Scene Add Character, whereas figname goes into anything that acts on the geometry. As I go through the process, I've been getting better about renaming everything in Daz Studio before exporting to keep things clean, but I definitely haven't always done that, and other people who might end up using the HDA most likely don't.
- gordig
- Member
- 54 posts
- Joined: 9月 2019
- Offline
(Hopefully) last question on this topic: I used the above menu to select additional geometry (@addgeo) to be included as the base of the figure (footwear, for example, and this particular figure has a robot arm that is separate geo weighted to the same skeleton), but I haven't figured out how to read the value(s). charname and figname are very simple to return as strings, but addgeo isn't appearing as any type of data, even as arrays or a dictionary. How do I make the selection of menu item(s) in the HDA attach an attribute value to the selected item(s) downstream?
edit: nevermind, apparently I named the attribute addbase in type properties but was trying to reference it as addgeo.
edit: nevermind, apparently I named the attribute addbase in type properties but was trying to reference it as addgeo.
Edited by gordig - 2024年12月19日 23:03:11
-
- Quick Links