Simple button to add more parameters

   5622   12   1
User Avatar
Member
26 posts
Joined: 9月 2010
Offline
Hello!

From what I've read, adding parameters automatically to an interface is something that can be done with Python, but most of the examples are too specific to relate to my current goal.

What I want to achieve simply is to have a simple button in an interface that, onclick, will add labelled file path fields in the same interface.

Forgive my novice question, I'm trying to use Python but I hardly have any knowledge of it

Thanks,

- Samboosa.
User Avatar
Member
26 posts
Joined: 9月 2010
Offline
To illustrate my point a bit clearer, if you look at the ADD node, in the points tab there is a ‘ + ’ to the right of the number of points field, this button does exactly what I want but I can't find it back when I try to edit the interface…

Update:

After looking into the hou.ParmTemplateGroup in the houdini help, I think I should be trying to use this:

insertAfter(self, name_or_parm_template_or_indices, parm_template)

My issue is my lack of knowledge on this part…I wouldn't know how to structure this on the callback of a button :?
User Avatar
Member
8786 posts
Joined: 7月 2007
Offline
it's called Multiparm Block

to do that just create a Folder (while editing interface) and change it's type from Tabs to one of Multiparm options
whatever parameter you put into that Folder will be part of that multiparm and will be added or removed in the same way as in Add SOP

anyway, you can see it if you edit Add SOP's interface (the Number Of Points folder is multiparm block)

EDIT: for further usage just search the forums for multiparm
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
26 posts
Joined: 9月 2010
Offline
Wow, thank you Tamte! What you suggested works like I want…looks like I was looking for the wrong thing

Edit:

Actually, the multiparm is working, but what I want is to have a button create a number of nodes based on the multiparm value,

If I put this in the callback script of the button an Invalid syntax error:

n = hou.ch('obj/geo_boxes/numboxes')
range = (0, n)
for i in range:
hou.copyNodesTo( , hou.node(“/obj/geo_boxes”) )

I get no error when I do it in the python shell What is going wrong?
User Avatar
Member
8786 posts
Joined: 7月 2007
Offline
if it's for SOPs you usually don't need to duplicate nodes by script but rather pair your multiparm with For Each SOP to get what you want
there should be a few examples on the forums for that
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
26 posts
Joined: 9月 2010
Offline
Tamte, I was actually just using dummy boxes to test it out.

My goal is to create multiple UVQuickshade nodes with a button (done) but then to have them automatically connect to a switch so I can randomly assign the materials to different objects.

Basically to add and remove multiple materials(with texture map) with just a button…
User Avatar
Member
8786 posts
Joined: 7月 2007
Offline
no need for scripting, but rather than guessing what you want exactly since UVquickshade is not at all a tool to assign material I would like to know what exactly you are aiming for

if you specify exactly what you want, you may get straight answer, if you keep asking for ways to do things way you think they might work it will be very long way to get working solution and it will probably not be the most efficient

anyway, Material SOP has multiparm inside which can be linked to yours if you have use for that
or you can make an attribute to override textures per primitive based on your multiparm as I mentioned on odforce
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
26 posts
Joined: 9月 2010
Offline
Tamte/anim,

I tried what you suggested on odforce, and I'm probably doing something wrong.

I've gotten as far as to store the filepaths in a primitive string attribute, but in a ForEach I'm trying to assign a UVQuickshade with the texture path the string attribute.

The UVquickshade filepath field and the attributecreate have the same expression to generate the filename…so why am I only seeing one texture

Attachments:
error.jpg (393.2 KB)

User Avatar
Member
8786 posts
Joined: 7月 2007
Offline
houdini cannot display different textures if they are just overriden by primitive attributes, but they will render correctly

and you don't need UV quickshade since it is assigning a material node inside etc, if you assign your own material

EDIT: and you don't need for each if you already have some ID attribute which you can use to generate your texture names from
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
26 posts
Joined: 9月 2010
Offline
Tamte, I'm still trying to grasp how to apply materials like you would a lambert in Maya, all I want is to have a basic test texture…that's kind of why I'm using a uvquickshade for ease.

Nevertheless, with the method I had a screenshot of, Houdini is still rendering only one texture
User Avatar
Member
8786 posts
Joined: 7月 2007
Offline
sure, since your attribute name is just attribute1
you need to name it the same as parameter in the shader you want to override
so if the parameter has internal name baseColorMap as in Mantra Surface, your attribute name will be the same
if it's map_base as in uvquickshades material, you need to call it that etc.

here is very simple example of overriding the texture per primitive, you need to render though as overrides happen in the shader where it uses that attribute to get texture path rather than value of the parameter

Attachments:
random_textures.hip (945.0 KB)

Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
26 posts
Joined: 9月 2010
Offline
Wow tamte! You never cease to amaze me…what you showed is exactly what I was trying to achieve.

I think the reason I had no idea how to do what you were suggesting, was that I had no idea this ‘map_base’ paramter existed.

Thanks !
User Avatar
Member
8786 posts
Joined: 7月 2007
Offline
it's not a predefined name but rather a way how VEX work
you need to always explore vop network of your shader and if you create attribute of the same name and type as any parameter it will be used instead of the parameter value
and because inside uvquickshade there is a material which has diffuse texture parameter named map_base you can override it by attribute of the same name and type, so for different material shader it will be different as I mentioned with mantra surface
Tomas Slancik
FX Supervisor
Method Studios, NY
  • Quick Links