Jump to content
davidyannick

Object merge and relative path

Recommended Posts

Hi

Is there a way in Python for instance to make relative path the default option when I use object merge instead of absolute path ?

 

Thanks

 

Share this post


Link to post
Share on other sites
def merge_multiple_objects(objs):
    obj_container=objs[0].parent().createNode('geo','merged_objs')
    merge_sop=obj_container.createNode('object_merge')
    
    merge_sop.parm('numobj').set(len(objs))
    for i in range(len(objs)):       
        relPath = merge_sop.relativePathTo(objs[i])
        merge_sop.parm('objpath'+str(i+1)).set(relPath)
        
    merge_sop.parm('xformtype').set(1)
    
    #orgnize node positions
    pos=objs[-1].position()
    obj_container.setPosition([pos[0]+2,pos[1]-2])
    
sels=hou.selectedNodes()
merge_multiple_objects(sels);

you can try the script as a python shelf tool by selecting objects first, hope it helps

Share this post


Link to post
Share on other sites
On 14/09/2022 at 11:04 AM, Benyee said:

def merge_multiple_objects(objs):
    obj_container=objs[0].parent().createNode('geo','merged_objs')
    merge_sop=obj_container.createNode('object_merge')
    
    merge_sop.parm('numobj').set(len(objs))
    for i in range(len(objs)):       
        relPath = merge_sop.relativePathTo(objs[i])
        merge_sop.parm('objpath'+str(i+1)).set(relPath)
        
    merge_sop.parm('xformtype').set(1)
    
    #orgnize node positions
    pos=objs[-1].position()
    obj_container.setPosition([pos[0]+2,pos[1]-2])
    
sels=hou.selectedNodes()
merge_multiple_objects(sels);

you can try the script as a python shelf tool by selecting objects first, hope it helps

gonna do this thanks for your hepl :)

Share this post


Link to post
Share on other sites

You can also right-click on the parameter and choose Make Current Value Default. Then, any newly created versions of that node will always be created in that state.

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

×