Omy Posted November 16, 2011 Share Posted November 16, 2011 The given below is a little snippet of my hda code.This is a shelf tool I am trying to implement.If i click once.It creates the operation well.But if i click the tool more than once.It does throw some error.Please let me know how to correct this.Thank you. obj = hou.node('/obj') creategeo=obj.createNode('geo','geo1') s=obj.collapseIntoSubnet((creategeo,),'HOUDIGASS').moveToGoodPosition() subnets = hou.nodeType(hou.objNodeTypeCategory(), "subnet") su_inst=subnets.instances() for x in su_inst: myhd=x.createDigitalAsset('myhda') for parm in myhd.parmTuples(): hideparm=parm.hide(True) houda=hou.node('/obj/HOUDIGASS') ol=hou.StringParmTemplate("llist","List",1,default_value=([""]),naming_scheme=hou.parmNamingScheme.Base1,string_type=hou.stringParmType.NodeReferenceList,menu_items=([]),menu_labels=([]),icon_names=([]),item_generator_script="",item_generator_script_language=hou.scriptLanguage.Python,menu_type=hou.menuType.Normal) houda.addSpareParmTuple(ol) #multiparm folder list bgeo=hou.FolderParmTemplate("bgeofolder","Add BGEO",folder_type=hou.folderType.MultiparmBlock,default_value=0,ends_tab_group=False) houda.addSpareParmTuple(bgeo) Quote Link to comment Share on other sites More sharing options...
Green-Man Posted November 16, 2011 Share Posted November 16, 2011 After first launching of the script you have "/obj/HOUDIGASS" node created with it's params. When you launch the script second time you already have the "/obj/HOUDIGASS" created. And with houda.addSpareParmTuple(ol) you want to add param tuple with the name "llist" which already exists in this node. You probably should create "/obj/HOUDIGASS" subnet not with the hardcoded name but with addition 1,2,3... to the end like Houdini does it by default. Quote Link to comment Share on other sites More sharing options...
Omy Posted November 16, 2011 Author Share Posted November 16, 2011 i think its not working.I have added a number 1 to the end.but still it throws me some error.Does it work for you? Quote Link to comment Share on other sites More sharing options...
sam.h Posted November 16, 2011 Share Posted November 16, 2011 What do you want the script to do on the second run? Quote Link to comment Share on other sites More sharing options...
Omy Posted November 17, 2011 Author Share Posted November 17, 2011 What do you want the script to do on the second run? Hi Sam, Basically nothing.I would like to behave this as a shelf tool.If the user clicks the tool for the 2nd time.I want to place the node 2nd time in the network.But if i click more than once im getting problem.Any solutions would be really coool Thanks Quote Link to comment Share on other sites More sharing options...
sam.h Posted November 17, 2011 Share Posted November 17, 2011 Why are you creating a digital asset on the script? Do you want a new digital asset each time? It seems like you don't need a shell script at all. Just make a digital asset, and you can creat a new node with the tab menu. Quote Link to comment Share on other sites More sharing options...
Omy Posted November 17, 2011 Author Share Posted November 17, 2011 Why are you creating a digital asset on the script? Do you want a new digital asset each time? It seems like you don't need a shell script at all. Just make a digital asset, and you can creat a new node with the tab menu. I thought of making it as a shelf tool. Quote Link to comment Share on other sites More sharing options...
Green-Man Posted November 17, 2011 Share Posted November 17, 2011 Yeah, its always a good idea to know what we want to have as a final result Maybe instead of creating a DA it would be better to just create a bunch of nodes and its params with your shelf tool. Now the script tends to create new DA on every using a shelf tool. But DAs didn't designed to behave like this. In addition if I'll choose HOUDIGASS from TAB menu it will creates not the same object as I'll create with a shelf tool. Its because you make changes in HOUDIGASS after creating it in your script. Quote Link to comment Share on other sites More sharing options...
Omy Posted November 17, 2011 Author Share Posted November 17, 2011 @Green Man Which is the best way to create digital assets using script.Previously i tried creating all the nodes and parms and then hda-ed.But Later i got lot of referencing problems so now planning to rewrite it again!let me know what you think Quote Link to comment Share on other sites More sharing options...
Green-Man Posted November 17, 2011 Share Posted November 17, 2011 I'm not a good specialist so you'd better to wait more responsible answer. And I think you don't really need the DA but need just a Subnetwork with operators. All the problems you had with referencing you will have if you choose the way of creating DA. Quote Link to comment Share on other sites More sharing options...
Omy Posted November 18, 2011 Author Share Posted November 18, 2011 it would be great if someone can give a hand in correcting this 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.