mrv.maya.scene

Epydoc: mrv.maya.scene

Provides methodes to query and alter the currently loaded scene. It covers most of the functionality of the ‘file’ command, but has been renamed to scene as disambiguation to a filesystem file.

Functions

mrv.maya.scene.make_path(path)
Returns:A path instance of the correct type
Note:use this constructor if you use the Path.set_separator method at runtime to assure you will always create instances of the actual type, and not only of the type you imported last

Classes

Epydoc: mrv.maya.scene.Scene

class mrv.maya.scene.Scene

Bases: mrv.util.Singleton, mrv.util.EventSender

Singleton Class allowing access to the maya scene

You can register all events available in MSceneMessage easily usnig the following syntax:

>>> scene.beforeSoftwareRender = myFunctionObject
afterCreateReference
Implements Scene Callbacks
afterExport
Implements Scene Callbacks
afterExportReference
Implements Scene Callbacks
afterImport
Implements Scene Callbacks
afterImportReference
Implements Scene Callbacks
afterLoadReference
Implements Scene Callbacks
afterNew
Implements Scene Callbacks
afterOpen
Implements Scene Callbacks
afterPluginLoad
Implements Scene Callbacks
afterPluginUnload
Implements Scene Callbacks
afterReference
Implements Scene Callbacks
afterRemoveReference
Implements Scene Callbacks
afterSave
Implements Scene Callbacks
afterSoftwareFrameRender
Implements Scene Callbacks
afterSoftwareRender
Implements Scene Callbacks
afterUnloadReference
Implements Scene Callbacks
beforeCreateReference
Implements Scene Callbacks
beforeCreateReferenceCheck
Implements Scene Callbacks
beforeExport
Implements Scene Callbacks
beforeExportCheck
Implements Scene Callbacks
beforeExportReference
Implements Scene Callbacks
beforeImport
Implements Scene Callbacks
beforeImportCheck
Implements Scene Callbacks
beforeImportReference
Implements Scene Callbacks
beforeLoadReference
Implements Scene Callbacks
beforeLoadReferenceCheck
Implements Scene Callbacks
beforeNew
Implements Scene Callbacks
beforeNewCheck
Implements Scene Callbacks
beforeOpen
Implements Scene Callbacks
beforeOpenCheck
Implements Scene Callbacks
beforePluginLoad
Implements Scene Callbacks
beforePluginUnload
Implements Scene Callbacks
beforeReference
Implements Scene Callbacks
beforeReferenceCheck
Implements Scene Callbacks
beforeRemoveReference
Implements Scene Callbacks
beforeSave
Implements Scene Callbacks
beforeSaveCheck
Implements Scene Callbacks
beforeSoftwareFrameRender
Implements Scene Callbacks
beforeSoftwareRender
Implements Scene Callbacks
beforeUnloadReference
Implements Scene Callbacks
clearAllEvents()

Remove all event receivers for all events registered in this instance.

Note:This usually doesn’t need to be called directly, but might be useful in conjunction with other system that do not release your strongly bound instance
classmethod deleteUnknownNodes()

Deletes all unknown nodes in the scene

Note:only do this if you are about to change the type of the scene during save or export - otherwise the operation would fail if there are still unknown nodes in the scene
classmethod export(outputFile, nodeListOrIterable=None, **kwargs)

Export the given nodes or everything into the file at path

Parameters:
  • outputFile – Path object or path string to which the data should be written to. Parent directories will be created as needed
  • nodeListOrIterable – if None, everything will be exported. Otherwise it may be an MSelectionList ( recommended ), or a list of Nodes, MObjects or MDagPaths
  • kwargs – passed to cmds.file, see the mel docs for modifying flags
Returns:

Path to which the data was exported

exportStarted
Implements Scene Callbacks
classmethod isModified()
last
Implements Scene Callbacks
classmethod listEventNames()
Returns:list of event ids that exist on our class
mayaExiting
Implements Scene Callbacks
mayaInitialized
Implements Scene Callbacks
classmethod name()
classmethod new(force=False, **kwargs)

Create a new scene

Parameters:
  • force – if True, the new scene will be created even though there are unsaved modifications
  • kwargs – passed to cmds.file
Returns:

Path with name of the new file

classmethod open(scenepath=None, force=False, **kwargs)

Open the scene at the given scenepath

Parameters:
  • scenepath – The path to the file to be opened If None, the currently loaded file will reopened
  • force – if True, the new scene will be loaded although currently loaded contains unsaved changes
  • kwargs – passed to cmds.file
Returns:

a Path to the loaded scene

classmethod rename(scenepath)

Rename the currently loaded file to be the file at scenepath

Parameter:scenepath – string or Path pointing describing the new location of the scene.
Returns:Path to scenepath
Note:as opposed to the normal file -rename it will also adjust the extension
Raises RuntimeError:
 if the scene’s extension is not supported.
classmethod save(scenepath=None, autodeleteUnknown=False, **kwargs)

Save the currently opened scene under scenepath in the respective format

Parameters:
  • scenepath – if None, the currently opened scene will be saved, otherwise the name will be changed. Paths leading to the file will automatically be created.
  • autodeleteUnknown – if true, unknown nodes will automatically be deleted before an attempt is made to change the maya file’s type
  • kwargs – passed to cmds.file
Returns:

Path at which the scene has been saved.

sceneUpdate
Implements Scene Callbacks
sender()
Returns:instance which sent the event you are currently processing
Raises ValueError:
 if no event is currently in progress
softwareRenderInterrupted
Implements Scene Callbacks

Epydoc: mrv.maya.scene._SceneEvent

class mrv.maya.scene._SceneEvent(eventId, **kwargs)

Bases: mrv.maya.util.CallbackEventBase

Implements Scene Callbacks

class CBStorageFunction(callbackID=None)

Bases: object

callbackID()
removeCallback()
setCallbackID(callbackID)
_SceneEvent.duplicate()
_SceneEvent.remove(eventfunc)
Also removes our callback if the last receiver is gone
_SceneEvent.send(inst, *args, **kwargs)

Sets our instance prior to calling the super class

Note:must not be called manually

Table Of Contents

Previous topic

mrv.maya.ns

Next topic

mrv.maya.undo

This Page