chopnet export randomize for multiple object
2305 8 0- Davide Ruzzenenti
- Member
- 31 posts
- Joined: June 2014
- Offline
A greeting!
I would like to find a solution to this problem, I hope hodini does not disappoint me!
I have a chopnet from which I export a channel, I would like to export this channel to different objects and for each one to create a random version of my wave, is it possible?
I would like to find a solution to this problem, I hope hodini does not disappoint me!
I have a chopnet from which I export a channel, I would like to export this channel to different objects and for each one to create a random version of my wave, is it possible?
English is not my native language, sorry in advance for any misunderstanding!
- SWest
- Member
- 313 posts
- Joined: Oct. 2016
- Offline
- Davide Ruzzenenti
- Member
- 31 posts
- Joined: June 2014
- Offline
SWest
Could you share a file? just a simplified concept would work. Guessing is not very effective.
Image Not Found
There he is! I would like to have more variations of the same animation with a single export from the chopnet. So that each cube had different times. it's possible?
English is not my native language, sorry in advance for any misunderstanding!
- SWest
- Member
- 313 posts
- Joined: Oct. 2016
- Offline
Like this?
Edit: The code (in this version) was done close to midnight, so it is not cleaned up. It just barely works.
Quick version:
If you want the quick version try using this in the target geo inputs. However, you will need to add it manually to each geo and change the offset number (3 in this example).
Also "../button/input" must go to the source parm that is supposed to get a time offset.
Edit: The code (in this version) was done close to midnight, so it is not cleaned up. It just barely works.
Quick version:
If you want the quick version try using this in the target geo inputs. However, you will need to add it manually to each geo and change the offset number (3 in this example).
Also "../button/input" must go to the source parm that is supposed to get a time offset.
hou.parm("../button/input").evalAsFloatAtFrame(hou.frame()+3)
Edited by SWest - Nov. 6, 2022 02:06:42
Interested in character concepts, modeling, rigging, and animation. Related tool dev with Py and VEX.
- SWest
- Member
- 313 posts
- Joined: Oct. 2016
- Offline
- Davide Ruzzenenti
- Member
- 31 posts
- Joined: June 2014
- Offline
- SWest
- Member
- 313 posts
- Joined: Oct. 2016
- Offline
Davide RuzzenentiSWest
Here's an updated version. If the video is too slow for you just jump ahead (probably with arrow keys).
Thanks does what I ask, now I try to understand the code you wrote!
The last video got cut, but you can ask your questions here.
Edit: the last part of the updated code is missing from the video (max filesize of video). Tell me if you need it. The first code also works.
import random # data input parm input_parm_path = '../button/input' # data output parm sibling_nodes_prefix = 'box' out_parm = '/ry' # settings for randomization # random frame offset (how much to depart from original frame) rand_offset_from = hou.parm('../button/a_int').eval() rand_offset_to = hou.parm('../button/b_int').eval() # used to get the same results twice seed = hou.parm('../button/c_int').eval() random.seed(seed) # fix for b_int if rand_offset_to <= rand_offset_from: rand_offset_to = rand_offset_from+1 hou.parm('../button/b_int').set(rand_offset_to) # select all box* and put in list items_list = [] parent_node_path = '/obj/geo1/' # todo: make procedural parent_node_children = hou.node(parent_node_path).children() for child in parent_node_children: if sibling_nodes_prefix in child.name(): items_list.append(child.path()) # fix for imported py code (node, not hip) hou.parm('/obj/geo1/chopnet1/export1/path').set('') hou.parm('/obj/geo1/chopnet1/export1/path').set('input') def a(): for each in items_list: r = random.randrange(int(rand_offset_from), int(rand_offset_to)) child_parm_path = each+out_parm child_parm = hou.parm(child_parm_path) hou_keyframe = hou.Keyframe() hou_keyframe.setTime(0) hou_keyframe.setExpression('hou.parm(\ "'+input_parm_path+'").\ evalAsFloatAtFrame(hou.frame()+'+str(r)+')', \ hou.exprLanguage.Python) child_parm.setKeyframe(hou_keyframe)
Edited by SWest - Nov. 6, 2022 10:29:46
Interested in character concepts, modeling, rigging, and animation. Related tool dev with Py and VEX.
- willh
- Member
- 134 posts
- Joined: Dec. 2006
- Offline
- mestela
- Member
- 1795 posts
- Joined: May 2006
- Online
-
- Quick Links