Help with Python script

   1071   2   1
User Avatar
Member
51 posts
Joined: Feb. 2016
Offline
Hi all,
I'm pretty new in scripting in Python, but I'm trying to learn it by myself (I found it really hard finding a nice tutorial for Python in Houdini). I wrote a Python script to help me managing and preparing alembic files. I'm almost done with it, but I'm struggling with the last part and I feel like I hit a brick wall with this.

I can't understand how to use a list to set a specific parameter. I've created a list of all the alembic nodes and I would like to use this to set the object path of the object merge. Is this possible to do? How?


#get all alembic archive nodes and put them in to a list:
alembic_archives =
for i in hou.node(“obj”).children():
if i.type().name()==“alembicarchive”:
alembic_archives.append(i)

#get alembic geo nodes inside alembic archives
alembic_nodes=
for i in alembic_archives:
for x in i.allSubChildren():
if x.type().name()==“alembic”:
alembic_nodes.append(x)

#create object merge node
for i in alembic_archives:
for x in i.allSubChildren():
if x.type().name()==“alembic”:
obj_merge = hou.node(“obj/destination/”).createNode(“object_merge”)
obj_merge.parm(“objpath1”).set NO IDEA HOW TO DO IT HERE

Does anyone have any idea?
Thank you so much
User Avatar
Staff
3455 posts
Joined: July 2005
Offline
haven't tested your script but it looks like you have a list of all the geo nodes -> alembic_nodes
the object_merge takes paths of operators
so for each node in your alembic_nodes list
get the path
append that path to a string
then set the objpath1 parm to that string…

HTH
Michael Goldfarb | www.odforce.net
Training Lead
SideFX
www.sidefx.com
User Avatar
Member
51 posts
Joined: Feb. 2016
Offline
goldfarb
haven't tested your script but it looks like you have a list of all the geo nodes -> alembic_nodes
the object_merge takes paths of operators
so for each node in your alembic_nodes list
get the path
append that path to a string
then set the objpath1 parm to that string…

HTH
Hi goldfarb, thank you so much for you answer. I understand what you mean but my main problem is that I don't know how to pass the string to the obj_merge.parm(“objpath1”).set().

It seems to me that the set expression only accept text or number inside it, but not string. As I said before I'm pretty new to coding in general. If is not too much of a bother can you link me to the expression you will use in this case (even for the Houdini python help page).
Thank you again
  • Quick Links