Package mrv :: Package maya :: Module scene :: Class Scene
[hide private]
[frames] | no frames]

Class Scene

source code

      object --+    
               |    
  util.Singleton --+
                   |
      object --+   |
               |   |
util.EventSender --+
                   |
                  Scene

Singleton Class allowing access to the maya scene

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

>>> scene.beforeSoftwareRender = myFunctionObject
Instance Methods [hide private]

Inherited from util.EventSender: clearAllEvents, sender

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __init__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Methods [hide private]

Inherited from util.EventSender: listEventNames

    Edit Methods
 
open(cls, scenepath=None, force=False, **kwargs)
Open the scene at the given scenepath
source code
 
new(cls, force=False, **kwargs)
Create a new scene
source code
 
rename(cls, scenepath)
Rename the currently loaded file to be the file at scenepath
source code
 
save(cls, scenepath=None, autodeleteUnknown=False, **kwargs)
Save the currently opened scene under scenepath in the respective format
source code
 
export(cls, outputFile, nodeListOrIterable=None, **kwargs)
Export the given nodes or everything into the file at path
source code
    Utilities
 
deleteUnknownNodes(cls)
Deletes all unknown nodes in the scene
source code
    Query Methods
 
name(cls) source code
 
isModified(cls) source code
Static Methods [hide private]

Inherited from util.Singleton: __new__

Class Variables [hide private]
  kFileTypeMap = {"": "mayaAscii", ".ma": "mayaAscii", ".mb": "m...

Inherited from util.EventSender: reraise_on_error

    Events
  sender_as_argument = False
hash(x)
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

open(cls, scenepath=None, force=False, **kwargs)
Class Method

source code 
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

new(cls, force=False, **kwargs)
Class Method

source code 
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

rename(cls, scenepath)
Class Method

source code 
Rename the currently loaded file to be the file at scenepath
Parameters:
  • scenepath - string or Path pointing describing the new location of the scene.
Returns:
Path to scenepath
Raises:
  • RuntimeError - if the scene's extension is not supported.

Note: as opposed to the normal file -rename it will also adjust the extension

save(cls, scenepath=None, autodeleteUnknown=False, **kwargs)
Class Method

source code 
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.

export(cls, outputFile, nodeListOrIterable=None, **kwargs)
Class Method

source code 
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

deleteUnknownNodes(cls)
Class Method

source code 
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


Class Variable Details [hide private]

kFileTypeMap

Value:
{"": "mayaAscii", ".ma": "mayaAscii", ".mb": "mayaBinary"}