vrReferenceService

class vrReferenceService

(Inherits vrBaseService)

The reference service provides functions for querying and managing reference nodes. Additionally, settings from the preferences can be queried.

Summary

Functions:
Signals:

Functions

vrReferenceService.convertToSmart(node, useSourcePath=False)

Converts the passed node into a smart reference.

Parameters:
  • node (vrdNode) – The node which should be converted. If it can’t be converted, a new smart reference is inserted above the node.
  • useSourcePath (bool) – Use the path of the source reference for conversion.
Returns:

The converted/created reference node

Return type:

vrdNode

vrReferenceService.createSmart(parent=vrdNode())

Creates a new smart reference below the given parent.

Parameters:parent (vrdNode) – The parent node to add the reference node. If no parent is given, the reference is created below the scene root
Returns:The created reference node
Return type:vrdReferenceNode
vrReferenceService.createSource(path, parent=vrdNode())

Creates a new source reference with the given path.

Parameters:
  • path (string) – The file path
  • parent (vrdNode) – The parent node to add the reference node. If no parent is given, the reference is created below the scene root
Returns:

The created reference node

Return type:

vrdReferenceNode

vrReferenceService.getAllAvailableFileFormats()

Returns a list with all file endings used in the loaded references (source and smart).

Returns:The available file formats.
Return type:List[string]
vrReferenceService.getChildReferences(node)

Get all reference nodes in the tree below node without further sub references.

Parameters:node (vrdNode) – Root node of the tree to search
Returns:a list of reference nodes including clones
Return type:List[vrdReferenceNode]
vrReferenceService.getCustomExportPath()

Queries the custom export path.

Returns:The file system path
Return type:string
vrReferenceService.getExportLocation()

Queries the default smart export location mode.

Returns:The default export location mode
Return type:vrReferenceTypes.ExportLocation
vrReferenceService.getLoadMode()

Queries the load mode for smart references.

Returns:The current load mode
Return type:vrReferenceTypes.LoadMode
vrReferenceService.getNotificationMode()

Queries the current file change notification mode.

Returns:The notification mode
Return type:vrReferenceTypes.NotificationMode
vrReferenceService.getParentReferences(node)

Get all reference nodes in the tree above node.

Parameters:node (vrdNode) – Node of the tree to search
Returns:a list of reference nodes including clones
Return type:List[vrdReferenceNode]
vrReferenceService.getReferences(node)

Get all references tree below the given node with all sub references.

Parameters:node (vrdNode) – Root node of the tree to search
Returns:a list of reference nodes without clones
Return type:List[vrdReferenceNode]
vrReferenceService.getRevisionMonitoringEnabled()
Returns:true if update monitoring should consider file revisions
Return type:bool
vrReferenceService.getRevisionMonitoringExpressions()
Returns:A list of regular expression used to detect revision numbers in file names
Return type:List[string]
vrReferenceService.getSceneReferences()

Get all references in the scene.

Returns:a list of reference nodes without clones
Return type:List[vrdReferenceNode]
vrReferenceService.getShowConvertToSmartWarning()

Queries the convert to smart warning flag.

Returns:True Warning is enabled
Return type:bool
vrReferenceService.getUpdateMonitoringEnabled()

Checks if update monitoring is currently enabled.

Returns:True if update monitoring is enabled, False otherwise.
Return type:bool
vrReferenceService.getUpdateMonitoringInterval()

Returns the current time between background update checks in miliseconds.

Returns:The update monitoring interval.
Return type:integer
vrReferenceService.getUpdateMonitoringPaused()

Queries if the background update monitoring is currently in pause mode.

Returns:True if update check is paused, False otherwise.
Return type:bool
vrReferenceService.loadSourceReferences(references)

Opens an import dialog and loads the given list of references with the current settings. No user interaction required.

Parameters:references (List[vrdReferenceNode]) – List of references to be loaded
vrReferenceService.pauseUpdateMonitoring(state)

Temporarily pauses / unpauses the background update monitoring. This will suspend the asynchrounous update check but will not cancel it.

Parameters:state (bool) – True to pause, False to unpause
vrReferenceService.reimportSmartReferences(references)

Reimports the list of given smart references.

Parameters:references (List[vrdReferenceNode]) – List of smart references.
vrReferenceService.reimportSourceReferences(references)

Opens an import dialog for the given list of references.

Parameters:references (List[vrdReferenceNode]) – List of references to be re-imported
Returns:List of re-imported reference nodes.
Return type:List[vrdReferenceNode]
vrReferenceService.removeReference(node)

Converts the passed node into a none reference node.

Parameters:node (vrdReferenceNode) – The reference node to be converted
Returns:The converted node
Return type:vrdNode
vrReferenceService.setCustomExportPath(path)

Sets the custom path for exported smart references. This path will be used, when the location is set to Custom.

Parameters:path (string) – A valid file system path
vrReferenceService.setExportLocation(value)

Changes the default location mode for unsaved smart references.

Parameters:value (vrReferenceTypes.ExportLocation) – The location mode
vrReferenceService.setLoadMode(value)

Sets the load mode for smart references. LoadedReferences -> preserve the load state saved in the project AllReferences -> load all smart references NoReferences -> Do not load any smart reference LoadedSkipLeafReferences -> Load all but the leafes of the reference tree.

Parameters:value (vrReferenceTypes.LoadMode) – The load mode
vrReferenceService.setNotificationMode(value)

Sets the file change notification monitoring mode.

Parameters:value (vrReferenceTypes.NotificationMode) – The new mode.
vrReferenceService.setRevisionMonitoringEnabled(value)

Enables revision number check for update monitoring.

Parameters:value (bool) – The new value
vrReferenceService.setRevisionMonitoringExpressions(expressions)

Sets the list of regular expressions used to detect revision numbers.

Parameters:expressions (List[string]) – A list of regular expressions
vrReferenceService.setShowConvertToSmartWarning(value)

Enables or disables warnings on convert to smart.

Parameters:value (bool) – True, show warning
vrReferenceService.setUpdateMonitoringEnabled(value)

Starts / stops the background update monitoring.

This will start or stop an update check that continuously scans the loaded references for updates. It will monitor both smart and source references. If updates are available, vrReferenceService.referencesChanged(nodes) will be emitted.

Parameters:value (bool) – True to start update monitoring, False to stop it.
vrReferenceService.setUpdateMonitoringInterval(msecs)

Sets the update monitoring interval in miliseconds. The minimum allowed value is 1000.

Parameters:msecs (integer) – The time between two backgound update checks.
vrReferenceService.sortRevisions(revisions)

Sorts a list of revisions from oldest to newest.

Parameters:revisions (List[string]) –
Returns:Sorted revision list.
Return type:List[string]

Signals

vrReferenceService.referenceCreated(node)

Signal is emitted when a reference has been created.

Parameters:node (vrdReferenceNode) – The created node.
vrReferenceService.referenceEditStateChagned()

Signal is emitted when a reference has been edited or edit has been undone.

vrReferenceService.referencesChanged(nodes)

Signal is emitted when references have internal changes. If the list of nodes is empty, then all nodes should be considered as changed.

Parameters:nodes (List[vrdReferenceNode]) – List of changed reference nodes.
vrReferenceService.sceneHasReferences(state)

Signal is sent when the scene has references or the last one is deleted

Parameters:state (bool) – True when the first reference is created / loaded, False when the last reference is deleted from the scene.
vrReferenceService.sceneSelectionChanged(nodes)

This signal is sent when the selection of reference nodes in the scene graph changes.

Parameters:nodes (List[vrdReferenceNode]) – A list of all selected reference nodes
vrReferenceService.updateMonitoringChanged(state)

Signal is emitted when update monitoring is turned on or off.

Parameters:state (bool) – True, if switched on