Rename ReadGeo nodes by Alembic SceneGraph

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



Rename ReadGeo nodes by Alembic SceneGraph



I have 7 shots with 2 or 3 Alembic files in each and around 20 geometries per Alembic.



As I need to export my complete 3D scene in a new Alembic, I need to rename all of the ReadGeo nodes to be easily readable in other software (like Maya).


ReadGeo



For this, I want to give the geometry name from the Alembic Scenegraph to the ReadGeo but I don't see how to found Geo name with Python. I have started with this code:


Scenegraph


ReadGeo


Geo


def AlembicRename():
for s in nuke.allNodes("ReadGeo2"):
GeoName = # don't know how to find this
s['name'].setValue(GeoName)

AlembicRename()



Any idea how I can find the Geometry Name?


Geometry



Thank you.




2 Answers
2



To access ABC's Scenegraph's hierarchy in NUKE, you should try this code:


import nuke

nuke.createNode('ReadGeo', 'file /Users/swift/Desktop/scene.abc')

def AlembicRename():
for s in nuke.allNodes('ReadGeo4'):
sceneView = s['scene_view']
fullHierarchy = sceneView.getAllItems()
print fullHierarchy

AlembicRename()

# Result: ['/root/polySphere/polySphereShape']



To find out how to extract a substring from inside a string using Python read This Post. After extracting process you can assign (polySphere, for example) name to your ReadGeo node. And do not forget: there is a Python's list containing only zero index.


polySphere


ReadGeo


s['name'].setValue(fullHierarchy[0])



enter image description here





thank you, i have founded the same principle but with myReadGeoNode['scene_view'].getSelectedItems(), then i can isolate the wanted geometry
– William Eguienta
Aug 12 at 8:03






hi, yes because it's not the right name, I needed to have only selected geo name so the command i was looking for is getSelectedItems() then separate each / to have the real geo name in the last entry
– William Eguienta
Aug 13 at 5:06





In case you have several groups of geometry inside compound multilayered hierarchy, .getAllItems() nuke method + substring extraction operation are more robust and reliable than just .getSelectedItems() method.
– Gigantic Mistake
Aug 13 at 6:30



.getAllItems()


substring extraction


.getSelectedItems()





hi, can you explain why please ?
– William Eguienta
Aug 13 at 6:32





Hi)) You might have a compound geometry, not mono. So, definite layer in DAG's hierarchy has all the parts of your object but .getSelectedItems() may not select all the desired parts of geometry. In simple cases .getSelectedItems() method is quite useful.
– Gigantic Mistake
Aug 13 at 7:07



.getSelectedItems()


.getSelectedItems()



Solved with


myReadGeoNode['scene_view'].getSelectedItems()






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

How to determine optimal route across keyboard