Material Transfer Script issue

   3708   3   1
User Avatar
Member
33 posts
Joined: Nov. 2008
Offline
Hi all,

I need to transfer material from one subnet to another subnet
for example
I have Subnet A and Subnet B
inside of Subnet A i have sphere geo named A
and inside of Subnet B also i have sphere geo named A

i used this python script to transfer material


import hou

def getNodeList(Node_A,Node_B):
getObjectsInSubnet_A=hou.node(“/obj/”+Node_A)
getObjectsInSubnet_B=hou.node(“/obj/”+Node_B)
for child in getObjectsInSubnet_A.children():
t=child.name()
for allObjects in t:
allShopPath=hou.parm(“/obj/”+Node_A+“/”+allObjects+“/shop_materialpath”).eval()
print allShopPath
getObjectsInSubnet_B.setParms({“/obj/”+Node_B+“/”+allObjects+“/shop_materialpath”:allShopPath})



and it is working fine and my issue if i rename both sphere geo to AA(or more than one letter)
its not working giving this error

Traceback (most recent call last):

File “<console>”, line 1, in <module>

File “D:\Sab_VFX\RnD\Houdini\RnD\python\hou_script\getNodeList.py”, line 10, in getNo
deList

allShopPath=hou.parm(“/obj/”+Node_A+“/”+allObjects+“/shop_materialpath”).eval()

AttributeError: ‘NoneType’ object has no attribute ‘eval’

###############################################################################################

How to sort this or any problem with python script
or any other method is there
sab
User Avatar
Member
330 posts
Joined: July 2007
Offline
sabareeshrg

allShopPath=hou.parm(“/obj/”+Node_A+“/”+allObjects+“/shop_materialpath”).eval()



maybe you can get the Node and use evalParm() instead of parm( .. ).eval()

http://www.sidefx.com/docs/houdini11.1/hom/hou/Node#evalParm [sidefx.com]
except the things that cannot be seen , nothing is like it seems .
User Avatar
Member
33 posts
Joined: Nov. 2008
Offline
hi Guys found a way adjusted script litle


import hou

def materialTransfer(getNode_A,getNode_B):
subNetA=hou.node(“/obj/”+getNode_A)
subNetB=hou.node(“/obj/”+getNode_B)
for allNodes in subNetB.children():
getAllNodes=allNodes.name()
#print getAllNodes
allShopPath=hou.parm(“/obj/”+getNode_A+“/”+getAllNodes+“/shop_materialpath”).eval()
subNetB.setParms({“/obj/”+getNode_B+“/”+getAllNodes+“/shop_materialpath”:allShopPath})
print (“Material Transfered succesfully without any Head ache”)


but its taking too much time cook materials
sab
User Avatar
Member
33 posts
Joined: Nov. 2008
Offline
maybe you can get the Node and use evalParm() instead of parm( .. ).eval()

http://www.sidefx.com/docs/houdini11.1/hom/hou/Node#evalParm [sidefx.com]


thanks Zarti

let me now its woking let me see evalParm()
sab
  • Quick Links