Document

class guerilla.Document

Bases: guerilla.Node

The guerilla document singleton

>>> d = Document(); currentTime = d.Time.get()
>>> d = Document(); d.Preferences 
<guerilla.Preferences object at ...>
FirstFrame

The first frame of the project

Type:float
LastFrame

The last frame of the project

Type:float
Time

The current frame number

Type:float
filename

retrieve current scene name

Returns:scene name or an empty string if file has never been saved
Return type:str
getfilename()

Get the Document file name

Returns:The document filename
Return type:str
getpreferences()

Get the Document preferences node

Returns:The preferences of the document
Return type:Node
getreferences(topref=None)

Returns the references in the document sorted depth first.

Parameters:topref (Reference) – an optional top reference
Returns:references
Return type:list
haschanged()

Return true if the document has been modified since the last save.

load(filename, warn=True, discardmissingref=True, loadrefs=None, loadasbox=False)

Load a guerilla project file (.gproject)

Parameters:
  • filename (str) – file to load
  • warn (bool) – warn user to save current modified project before loading a new one
Returns:

True if the file was loaded

Return type:

bool

loadBakedData(node, name)

Load the data from the baked file of the SceneGraphNode (.ghostdata).

Parameters:
  • node (SceneGraphNode) – The node to use to load the data
  • name (str) – The attribute name to load
Returns:

The data

Return type:

transform or geometry or float

merge(filename)

Merge a .gproject file into the current project.

Parameters:filename (str) – The file name to merge
Returns:The merged root nodes.
Return type:{Node}
static new(warn=True, nodefault=False)

Create an empty new document

Parameters:
  • warn (bool) – if True, warn the user
  • nodefault (bool) – if True, add default objects such as default cameras
save(filename=None, warn=False, addtorecent=True)

Save scene

Parameters:
  • filename (str) – if None, save over current file
  • warn (bool) – if True, warn the user when overwriting an existing project file
  • addToRecent (bool) – if True, add to recent files
Returns:

True if the file was properly saved

Return type:

bool

selectedpaths()

Get the list of currently selected paths

Return type:list of str
>>> with Modifier() as mod: 
...     mod.select(['RenderPass', 'RenderGraph'])
>>> d = Document(); print d.selectedpaths() 
['RenderPass', 'RenderGraph']
selection()

Get the current selection

Return type:list of Node
>>> with Modifier() as mod: 
...     mod.select([pynode('RenderPass'), pynode('RenderGraph')])
>>> d = Document(); print d.selection() 
[<guerilla.RenderPass object at ...>, <guerilla.RenderGraph object at ...>]