Isotropix Forums

List of all object types that can reference an external file

Clarisse Scripting related topics

List of all object types that can reference an external file

Unread postby bvz » Tue Nov 14, 2017 4:11 am

I am writing a function that can "fix" the $PDIR variable when localizing a referenced project.

Basically, this means I have to:

1) list all of the nodes in the recently localized (formerly referenced) project that might possibly have a reference to any other file.
2) find out if they are using the $PDIR variable and rebuild the path that they are referencing.

In order to do this, I have to make sure I don't "miss" any nodes that might make use of the $PDIR variable.

Could someone list all of the node types that might reference an external file? (especially with their Clarisse class names)?


So far I can think of:

References to clarisse projects
References to alembic scenes
A polyFile
A map file
A streamed map file
An OSL script
An Image node (for writing out files)
A 3D layer (for writing out files)
A Layer file


I am sure there are others. Is there a definitive list anywhere?

Thanks.
bvz
 
Posts: 12
Joined: Tue Dec 03, 2013 10:55 am

Re: List of all object types that can reference an external

Unread postby bvaldes » Tue Nov 14, 2017 11:45 am

Hi,

By convention all the attributes that grab files have "filename" in the attribute name. By using a simple script you can grab all the className in Clarisse that have a filename attribute:

python code

classes_factory = ix.application.get_factory().get_classes()
classes = classes_factory.get_classes("ProjectItem")
for i in range(classes.get_count()): #classes.get_count()
if not classes[i].is_abstract() and not classes[i].is_embedded_only():
ui_name = classes[i].get_ui_name()
class_name = classes[i].get_name()
item = ix.cmds.CreateObject(ui_name, class_name)
attrs = []
for id in range(item.get_attribute_count()):
attrs.append(item.get_attribute(id).get_name())
for attr in attrs:
if "filename" in attr:
ix.log_warning(class_name)
break
ix.cmds.DeleteItems([str(item)])te(id).get_name())

This code print in yellow in your Clarisse log the Classname that have filename in an attribute name. Use it to see which items you have to edit. Do not forget to check the context of type reference (which are not listed in the given script)

I hope that help, Regards.
Benoit VALDES
Isotropix
Clarisse QA
User avatar
bvaldes
 
Posts: 160
Joined: Mon Sep 26, 2016 11:44 am

Re: List of all object types that can reference an external

Unread postby bvz » Tue Nov 14, 2017 8:08 pm

That was extremely helpful. Thanks! I just used a modified version of this code to control which nodes to edit directly inside my function.

I already was handling contexts separately, but thanks for the reminder too.
bvz
 
Posts: 12
Joined: Tue Dec 03, 2013 10:55 am


Return to Scripting