Removing Ornatrix from a Scene
- Table of contents
- Removing Ornatrix from a Scene
Overview
It may become necessary to remove all Ornatrix objects and traces from a scene to avoid Missing Plugin warnings when opening the scene on a Maya installation which does not include Ornatrix. For example, this may be needed if sending a scene to a render farm where Ornatrix is not installed, or to a colleague using a different computer.
Parts of scene affected by Ornatrix
Ornatrix creates various nodes and shapes within the scene. It also installs a MEL callback into Maya's pre and post render events.
Presence of Ornatrix nodes and shapes will cause the Missing Plugin error on a computer where Ornatrix is not installed. The installed MEL callback will generate an error during rendering.
Therefore, to completely clear a scene of Ornatrix two things need to be done:- MEL callback needs to be uninstalled
- Nodes and shapes need to be deleted
Uninstalling render MEL callback
If Ornatrix is installed
Simply type this line and press Enter in the MEL command line:
OxInstallRenderCallbacks( 0 )
This will be done automatically if the Ornatrix plugin is unloaded from the Plugin Manager. Unloading is a good practice in general when making sure the scene doesn't use some plugin. If there are still objects belonging to the plugin in the scene, Maya will deny unloading the plugin and list the object types that need to be removed.
The recommended way to delete hair objects from the scene is through the Operators Stack panel, see Deleting Hair.
If Ornatrix is not installed
On a computer where Ornatrix is absent you can remove the MEL callback by executing the following code inside a MEL script editor:
string $preRenderScript = `getAttr defaultRenderGlobals.preMel`;
string $postRenderScript = `getAttr defaultRenderGlobals.postMel`;
string $preRenderOxCallback = "OxSetIsRendering(true);";
string $postRenderOxCallback = "OxSetIsRendering(false);";
$preRenderScript = `substituteAllString $preRenderScript $preRenderOxCallback ""`;
$postRenderScript = `substituteAllString $postRenderScript $postRenderOxCallback ""`;
setAttr -type "string" defaultRenderGlobals.preMel $preRenderScript;
setAttr -type "string" defaultRenderGlobals.postMel $postRenderScript;
You can also remove these callbacks manually by going to Main Menu->Rendering Editors->Render Settings->Common->Render Options and clearing the Pre render MEL and Post render MEL attributes.
Removing nodes and shapes
This part is less important than the steps above because it will be benign and only cause a Missing Plugins warning. However, if you still want to remove all Ornatrix nodes and shapes you can manually select them inside the Outliner or Node Editor and delete them manually.
You can also execute on of these scripts provided externally to delete them automatically.
Python version
from pymel import *
def deleteUnknownNodes():
# 2 things to take care of:
# 1) you can't delete nodes from references.
# 2) "delete" will delete all children nodes (hierarchy) in default.
unknown = ls(type="unknown")
unknown = filter(lambda node: not node.isReferenced(), unknown)
for node in unknown:
if not objExists(node):
continue
delete(node)
MEL version
proc dgSaveDeleteUnknown()
{
string $unknown[] = `ls -type "unknown"`;
if( size($unknown) ) {
int $i;
for($i=0; $i<size($unknown); $i++) {
if(!`objExists $unknown[$i]`)
continue;
if(!`referenceQuery -inr $unknown[$i]`)
delete $unknown[$i];
}
}
}