python shelf tool doubt

   2519   6   0
User Avatar
Member
55 posts
Joined: 10月 2011
Offline
Hi I have a python script to create hda
now my doubt is that.if the user clicks the shelf tool 2 or more than 2times.
I want the hda to be created twice or n times in the obj context

obj = hou.node('/obj')
creategeo=obj.createNode('geo','geo1')
geo=hou.node('/obj').children()
s=obj.collapseIntoSubnet(geo)
subnet=hou.node('/obj/subnet1')
myhda=subnet.createDigitalAsset(name='myHDA')
User Avatar
Member
168 posts
Joined:
Offline
I'm not sure if I understood You correctly but you should also properly provide new subnet name to make it work

for eg
subnet=hou.node('/obj/' + str(s))
Albert
User Avatar
Member
55 posts
Joined: 10月 2011
Offline
tmdag
I'm not sure if I understood You correctly but you should also properly provide new subnet name to make it work

for eg
subnet=hou.node('/obj/' + str(s))
hi thank you for the reply.
for eg.
i want to behave it a point light shelf tool,when user ctrl clicks it twice i needed to place it everytime in the obj context.
Basically I tried to place several nodes in the same obj context.but for me its getting places inside the the hda.

I provided a new name for the subnet and appended str(s) as you said.
User Avatar
Member
168 posts
Joined:
Offline
but when You ctrl click on point light, you get 2 point lights and in Your code You are collapsing every children of /obj/ into one subnet

so what exactly You want to have in subnet and what you want to collapse ?

you want to have one subnet with one geo inside on every click ?
Albert
User Avatar
Member
55 posts
Joined: 10月 2011
Offline
yeah something like that.I actually want to create hdas in the obj context.In my case it happens like collapsing manner.
for eg: as u said i want one hda to have a geo node with every click on the obj context.
User Avatar
Member
168 posts
Joined:
Offline
something like this?

obj = hou.node('/obj')
creategeo=obj.createNode('geo','geo1')
s=obj.collapseIntoSubnet((creategeo, )).moveToGoodPosition()
Albert
User Avatar
Member
55 posts
Joined: 10月 2011
Offline
cool! i think it shd work.now i myt hav to loop for the type inside the obj context and convert in hda.
thank you
  • Quick Links