projdir (lx_projdir.hpp)

From The Foundry MODO SDK wiki
Jump to: navigation, search
There are security restrictions on this page

Project Directories

nexus supports the concept of project directories to help users organize their content. There are two parts to a project: a template and an index file.

The template defines a series of relative paths that can be instanced as directories on disk. project.makeDirs will create directories for the entire hierarchy and place a project file in the root. This is really all that the template is for.

The project file contains a list of paths and their associated file types. This is used to set the initial paths for the varaious load/save dialogs, ensuring that they're always relative to the project. The project state is cached with the scene in memory to avoid excessive disk access, and switching between scenes automatically switches to the other scene's project paths, if neccessary.

Project Directory Override

The project directory is normally found by walking up the directory hierarchy containing the scene file itself to look for a .luxproject file. This can be overridden to look in an arbitrary path by implmenting an ILxProjDirOverride server.

(1) SDK: Declarations
 #define LXu_PROJDIROVERRIDE     "257bac48-5e70-42a3-b5a4-7eb33fdba114"
 #define LXa_PROJDIROVERRIDE     "projdiroverride"

The interface has a single method. Returning a failure code will cause the search to walk up the hierarchy of the scene as normal. A success code will cause the search to start from the path provided by the method. If that path is empty or doesn't exist, we will not try to find a project directory.

We only really expect one server to exist at a time, since this interface is intended for special cases only. If multiple servers are found, the order is undefined and the first one that returns a success code is the path that is tested.

(2) SDK: ILxProjDirOverride interface
         LXxMETHOD( LxResult,
 OverrideWith) (
         LXtObjectID               self,
         const char               *originalPath,
         char                     *overridePath,
         int                       overridePathLen);

Empty ProjDirOverride Python user class.

(3) PY: ProjDirOverride method