Fx Python Module Documentation

Hey there, I work with Silhouette professionally as a Pipeline TD. I work a lot with the fx Python Module, but I haven’t been able to find full documentation for the module anywhere. I have already found the module reference here (Silhouette Module Reference - Silhouette Wiki), but that doesn’t have everything that I need. The fx.loadProject() function for example isn’t anywhere to be found in there.

I’m working with Silhouette 2020 and 2022.

Please let me know if there is a more complete version of documentation available.

Thanks in advance for your help.

Sadly, there isn’t - it sorely needs to be updated to reflect what’s available.

There are two ways to load a project:

fx.loadProject(path) will replace the current project in the UI with the new one

p = Project()
p.load(path)     # project is loaded but is NOT activated in the UI
activate(p)      # project is now active in the UI

Hey Paul, thanks for the info. I’m specifically trying to create a new/empty project, and then save it (with overwriting if possible) to a filepath. Do you know how I could do this? I’ve tried the following:

project = fx.Project()  

But this unfortunately seems to save my entire home dir to the given file_path. I also need to do this outside of an active project, so I can’t use fx.activeProject().

Now I remember why some of this was undocumented - there were bugs regarding Project I/O from within scripting, specifically saving of new projects. These were fixed in 2022.5. Note that file_path must also end in “.sfx”.

Good to know, thanks again.

The file path I’m providing is ending in “.sfx” but the issue looks to be caused by the creation of the fx.Project() object. Creating a project like this makes the “empty” project object, with no name, path, etc. However, when I print the project, the output is C:/Users.

project = fx.Project() 
>>>Project: C:/Users

I think this is what’s causing the issue, so when I try to save this project it saves my entire Users directory to the file path I provide.

Do you know if that project saving bug has been reported or documented anywhere? Or if the fix for it is recorded somewhere? I skimmed through the 2022.5 release notes but didn’t see it mentioned.

Ah! That sounds like a bug then.
You can work around it by passing the path to Project() directly, and skipping it in the save() function:

p = Project(path)

hello can anyone help for search roto node in tree window then active it and export all roto shapes with parent layers for Nuke +9 Shapes using python code

You can use tools/objectIterator.py for that.

# code snippet to find all Roto nodes in the current Session
from tools.objectIterator import ObjectFinder

class RotoFinder(ObjectFinder):
	def checkObject(self, object):
		return object.isType("RotoNode")