Jump to content

edit a string (path from maya)


Recommended Posts

/grp_base_objects/pSphere1_001_001/pSphere1_001_00Shape1

I get a object from Maya. Here is the path. How do edit it from that to this.

pSphere1_001

I will have a few hundered objects coming in. I need to be able to pull the name out.

I am sure there are really handy tuts out there that will show in detail how to edit strings procedurally. But I cant find them for the life of me.

 

Cheers :)

 

  • Like 1
Link to comment
Share on other sites

Add this python code after you alembic (using the python sop) and it should strip out the "shape" from the abc and it should give you what you need.
 

node = hou.pwd()
geo = node.geometry()

for prim in geo.prims():
    path = prim.attribValue("path")
    newpath = path[:path.rfind("/")]
    prim.setAttribValue("path",newpath)

 

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...