biiiiioshock Posted February 7, 2019 Share Posted February 7, 2019 I'm working on an asset and I want to let the user perform different action individually on each pieces but instead of creating all the node for each pieces I would like to use a Multiparm for that. I'm really struggling to find a solution and I would really appreciate some help ! I'm attaching an simplify example to let you know more detailed what I want to do. Thank you odforce_multiparm.hipnc Quote Link to comment Share on other sites More sharing options...
LaidlawFX Posted February 8, 2019 Share Posted February 8, 2019 You need to use a foreach loop to iterate over your nodes. The add sop is a different case as it is a basic for loop. Where as you want to iterate over select items. As of note, avoid using groups to manipulate data like this. Since Foreach's no longer take groups as input it is best to handle them with attributes. Especially in consideration of the common name attribute, you save a lot of data overhead as opposed to having multiple groups to do the same work. Groups only represent Boolean data. They are either in or out. Unless in the case you have overlaps, but even then you should default to name first then groups for secondary sources. I have encapsulated the example in a subnet for a better real world example i.e. eventual use in an hda. On the subnet is the multiparm block. I split out the groups you want to work with first and bypass the rest. The multiparm list number is channel references to the max number of items in the list. Then I foreach loop on each name attribute. In a for loop like add sop you can just channel reference the multiparm number into the iteration of a for loop. Here you need to ne a bit tricky and take into account eh foreach loop will go inorder of the list of items. In order to make the user aware of what item they are rotating I made a label that indexs into the list items of the name attribute so you can identify which item is being manipulated. For additional help look at how I modified the channel references from the multiparm block to the parameters in the for loop. You need to edit the channel references so the # in the interface is the equivalent of the loop iteration in the for loop. ForLoopNameMultiparm.hip 1 Quote Link to comment Share on other sites More sharing options...
biiiiioshock Posted February 9, 2019 Author Share Posted February 9, 2019 Oh man thank you very much ! Incredible effort just to help me this is exactly what I wanted to do ! Im implemententing this is in my project at the moment and so far so good ! Quote Link to comment Share on other sites More sharing options...
biiiiioshock Posted February 9, 2019 Author Share Posted February 9, 2019 (Sorry for the double post.) I'm having trouble with making the number of multiparm tabs update along the number of pieces. How would you go about doing that ? Thank's Quote Link to comment Share on other sites More sharing options...
LaidlawFX Posted February 9, 2019 Share Posted February 9, 2019 I did notice some cook lag. You can do a callback in the group menu to update the drop down. You might be best off putting a button next to the multiparm list that will update when the user presses it. Avoid the issues where a bad cook will wipe out your settings. I would have to grab my example of it. It's a line of python or two. Sleeping baby wins this round. Quote Link to comment Share on other sites More sharing options...
biiiiioshock Posted February 9, 2019 Author Share Posted February 9, 2019 Thank's for your answer. I have to admit that I have absolutely no knowledge in python and I've never used callback... I don't use any group in my multiparm,t I just let all the pieces come in the forloop. I just want to display the same number of tabs as pieces. Like for exemple if their is 4 pieces coming I would like to display 4 tabs ! Quote Link to comment Share on other sites More sharing options...
LaidlawFX Posted February 11, 2019 Share Posted February 11, 2019 So in this example press the reload button and it will populate the number of tabs. This will help it from being autoset every time your values upstream change. You should avoid having the system inadvertently wiping previous set values in the multi-parms. This code is in the call back script. It looks for the name attribute information on the geometry of the node iterPython. Based on that if finds the length of the list. It then will set it to the multiparm. node = hou.node('iterPython'); geo = node.geometry(); attr = geo.findPrimAttrib('name'); list = attr.strings(); iter = str(len(list)); hou.parm('extrude').set(iter) ForLoopNameMultiparm_02.hip 1 Quote Link to comment Share on other sites More sharing options...
biiiiioshock Posted February 15, 2019 Author Share Posted February 15, 2019 Awesome ! Thank you very much for your help ! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.