Jump to content
Sign in to follow this  

automate task using python and vex in houdini

Recommended Posts

hello , it's my first time i use python in houdini fx i know python from before but i never used it in houdini fx and it seems it's easier than vex to achieve the same task, my problem is i have an fbx file with shop_materialpath and  there are different name in shop_materialpath

i want to create a string channel for each unique name , that string channel it will  be a path for ue4 material for example if i have 2 different name in shop_material the first one is TS_02 and the second is Roof_01 i want to create 2 string channel to expose it later to ue4 using hda 

first string pathmat1 and the second one is pathmat2 and they will be applied in an attribute name unreal_material or path , i want to automate this process because i want it  to work on random asset if i dont know the name of the shop_materialpath the python script should loop in each primitive and see how many name there are in shop_material path and create string channels for them .

i already made a script to store the name of the shop_materialpath in a dictionary and then i lost from where should i continue idk how to access primnum in python and idk how to create string channel like in vex using chs()

here is my python code 

# Run a generator Box SOP Verb
def grp_n(grp):
    for mat in grp:
        if mat in myDict:
    return myDict

node = hou.pwd()
geo = node.geometry()
for pri in geo.prims():

print l

and i made a simple code in vex but in this case i already know the shop_material names and im testing using if conditions and applying string to the unreal_material , i want to automate this process to check how many names there are in shop_material path and then creating string channels for each one, sorry i dont know how to explain this in an easy way but my english is not too good 

string id1=chs("uemat1");    
string id2=chs("uemat2");
string id3=chs("uemat3");
// testing conditions comparing the groups name


Edited by marwan131

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this