Scene Graph View

SceneGraphView

Module providing the SceneGraphView class which provides a view of the scene graph generated by Geolib3 from an arbitrary node.

You can find a complete set of examples using the SceneGraphView widget in $KATANA_ROOT/plugins/Src/Resources/Examples/Tabs/PrototypeSceneGraphTab.py.

Feature Summary

The following list provides a summary of the features currently provided by the SceneGraphView API:

  • View the scene graph produced from an arbitrary node, usually this will be currently viewed node (defined by the blue view flag) but this does not need to be the case.

  • Customizable columns allowing you to view attributes at any scene graph location directly in the SceneGraphView, with the ability to specify sets of columns which can be shown or hidden.

  • Ability to specify arbitrary scene graph locations to act as top-level locations from which to view the currently generated scene graph.

  • Ability to customize context menus based on the scene graph location, column and/or current selection state when they were triggered.

  • Ability to interrogate attributes at arbitrary locations in the scene graph and be notified via a callback when they have changed.

  • Support for drag and drop of items through custom event callbacks.

  • Support for changing parameter values of multiple selected items in SceneGraphView widgets. When changing the value in a cell while multiple rows are selected, the cells in other selected rows in the same column change as well.

  • Support for indicating a difference between the final value of an attribute that corresponds to a cell in a SceneGraphView widget and the value of a parameter that corresponds to the same cell, using an asterisk shown next to the value within a cell. When moving the pointer over such a cell, a pop-up widget is shown, showing the value of the attribute.

class UI4.Widgets.SceneGraphView.SceneGraphView.SceneGraphView(debugMode=False, parent=None)

Bases: object

The SceneGraphView class provides a customizable view of the scene graph as produced by Geolib3, from an arbitrary node which you specify. The following sections describe the various elements you are able to customize providing references to the relevant functions.

Example tab plug-ins that demonstrate the use of the SceneGraphView class can be found in $KATANA_ROOT/plugins/Src/Resources/Examples/Tabs/PrototypeSceneGraphTab.py.

View Node

You are able to specify any node in the node graph document from which to view the scene graph. Historically the Scene Graph tab always used the node which had the view flag set. It is possible to mirror this behavior if you wish but it does not have to be the case.

You can use the function setViewNode() to set the node you wish to view from. This can be changed at any time during the life of a SceneGraphView.

Internally, the setViewNode() function extracts the terminal Op backing the given node and uses it as the terminal Op for its managed Geolib3 client.

1.1 Example Code

You can find example code for this feature in the examples module under ExampleSceneGraphTab.

1.2 Related Functions

Column Configuration

You are able to completely customize the columns of data which are displayed in a SceneGraphView instance.

Each column supports:

  • Specifying the column title display text and optional icon.

  • Specifying the scene graph attribute to display for a given row.

  • Controlling the column’s data type which in turn drives the mode of interaction in cells of a SceneGraphView’s columns.

  • Specifying the display order of a column.

  • Controlling the editability of values in a column.

Columns can be grouped into column sets. For example, columns Color, Intensity, and Exposure could all belong to a column set Basic Light Properties. You can control the visibility of individualcolumns or the visibility of the entire set.

2.1 Example Code

You can find example code for this feature in the examples module under ColumnTestExample.

2.2 Related Functions

2.3 Related Classes

Scene Graph Attribute Inspection

Through a SceneGraphView instance you can programmatically obtain scene graph attributes for any location and register a callback for any further updates. This allows you to customize the behaviour of your own tabs based on the current state of the scene graph.

3.1 Example Code

You can find example code for this feature in the examples module under GetSceneGraphAttributesExample.

3.2 Related Functions

Top-Level Locations

You are able to specify any number of scene graph location paths to act as top-level locations within the SceneGraphView. Historically, the only top-level location has been /root. Now, any scene graph location can be used as a top-level location.

Top-level locations are efficient to add and remove and can be changed at any point during the lifetime of the SceneGraphView. They can be thought of as pointers into the larger scene graph effectively allowing you to focus a users attention on a smaller sub-tree of the larger scene graph.

4.1 Example Code

You can find example code for this feature in the examples module under TopLevelItemExampleTab.

4.2 Related Functions

Context Menu Customization

When a user right-clicks on a location in the SceneGraphView, a context menu will be displayed. The SceneGraphView provides a hook to allow you to customize the context menu and provide custom actions based on:

  • The current selection state.

  • The column in which the right-click occurred.

  • The scene graph location path and top-level item under the pointer when the context menu was triggered.

5.1 Example Code

You can find example code for this feature in the examples module under ContextMenuExample.

5.2 Related Functions

5.3 Related Classes

Filtering

You are able to configure a set of rules to filter what is displayed by the SceneGraphView. A Rule is composed of a target column, a specific evaluator (such as EqualTo or Regular Expression matching) and one or more evaluator-specific criteria.

In addition to specifying the rules that govern what is filtered, you can also specify the matching policy for the set of rules.

6.1 Example Code

You can find example code for triggering the rule filter dialog in the examples module under FilteringExample.

6.2 Related Functions

Drag & Drop

Support for dragging and dropping of items in a SceneGraphView widget is available in the form of two event callback functions that can be set using functions in the SceneGraphView API.

The first of the event callbacks, setDragMoveEventCallback(), is called when items are being dragged over a SceneGraphView widget, and can be used to determine whether the dragged items could be dropped onto the widget.

The second of the event callbacks, setDropEventCallback(), is called when dragged items are dropped onto the SceneGraphView widget, and can be used to provide custom behavior based on the number and types of the dropped items and the item onto which the dragged items have been dropped (if any).

7.1 Example Code

You can find example code for this feature in the examples module under TopLevelItemExampleTab.

7.2 Related Functions

See

SceneGraphViewColumn

See

ContextMenuEvent

classmethod GetStopAtLocationTypes()
Return type

tuple of str

Returns

The names of types of locations at which to stop expanding or collapsing the scene graph when using the Expand To or Collapse To menu commands, or when double-clicking a group location in the Scene Graph tab.

classmethod Initialize()

Initializes components of the SceneGraphView widget Python package.

classmethod SetStopAtLocationTypes(*locationTypes)

Sets the types of locations at which to stop expanding or collapsing the scene graph when using the Expand To or Collapse To menu commands, or when double-clicking a group location in the Scene Graph tab.

Parameters

locationTypes (sequence of str) – A sequence of names of types of locations at which to stop expanding or collapsing the scene graph.

__init__(debugMode=False, parent=None)

Initializes an instance of the class.

Parameters
  • debugMode (bool) – Flag that controls whether to use a DebugViewLink or a TreeWidgetViewLink implementation for the view link used by the Bridge.

  • parent (QtWidgets.QWidget or None) – The parent widget to use for the SceneGraphView widget instance, or None to initialize a top-level widget.

addAttributeDataItemType(itemTypeClass)

Adds a custom attribute data item type. This enables attribute data to be displayed as items in the widget as a child of a location. An example use case for this is displaying of error messages or collection items in the Scene Graph tab.

Parameters

itemTypeClass (type) – A class derived from AttributeDataTreeWidgetItem that implements the appearance of a custom attribute data item type.

addColumn(columnName)

Adds a stand-alone column to this SceneGraphView with the specified column name.

By default, the column will display the current location name, as a text field. As this function returns a reference to the column created you can use it to further configure it.

Parameters

columnName (str) – The name to assign to this column, the name is also used as the title text for this column.

Return type

SceneGraphColumn

Returns

A reference to the SceneGraphColumn object to allow further configuration.

addColumnSet(columnSetName)

Adds a column set with the specified name to the SceneGraphView. A column set is a grouping of column headers.

It has an ordering index which determines the relative order of its members compared to other column sets. Each member of a column set (which can be a column or other column set) itself has a local (within the group) ordering index.

Parameters

columnSetName (str) – The name given to this column set.

Return type

SceneGraphColumnSet

Returns

A reference to the SceneGraphColumnSet object.

addRule(ruleName)

Adds a new rule to the current rule set using the specified name which can be used later as a key to configure the rule.

Parameters

ruleName (str) – Name of the rule by which you can reference it later.

Raises

RuleManagerException – If ruleName already exists in the current rule set.

addTopLevelLocation(topLevelLocationPath, index=None)

Adds a new top-level location to the SceneGraphView. By default the only top level location will be /root.

If the location specified does not exist in the currently viewed scene then it will not be shown in the SceneGraphView. However, if the view node subsequently changes and the resulting scene does contain the specified location it will then be displayed in the SceneGraphView.

If the scene graph location you specify is already a top-level location this function will have no effect. You can obtain the current list of top-level locations from getTopLevelLocations().

Top-level locations will be displayed in the order they were added to the SceneGraphView.

Parameters
  • topLevelLocationPath (str) – The scene graph location path which should be added as a top-level location to this SceneGraphView.

  • index (int or None) – The index in the list of top-level locations at which to add the new location, or None to append the location to the list.

See

getTopLevelLocations()

addWorkingSetColumn(workingSetName, columnIcon=None, columnTitle=None, columnTitleToolTip=None)

Adds a column to this SceneGraphView, configured as a Working Set column using the given registered Working Set name.

Return type

SceneGraphColumn

Parameters
  • workingSetName (str) – The name of a Working Set to represent and control with the column, as registered in the Working Set Manager.

  • columnIcon (QtGui.QIcon or None) – A QtGui.QIcon instance to use for the column header. If None, no icon will be used. If provided, the displayed title style of the column will be set to SceneGraphColumnTitle.IconOnly. If you want to use both an icon and a title, you can call setTitleStyle() on the returned column object.

  • columnTitle (str or None) – The text to use on the title of the column. If None, the workingSetName will be used.

  • columnTitleToolTip (str or None) – An optional tooltip to display on the column title.

Returns

A reference to the SceneGraphColumn object to allow further configuration.

allowMultipleSelection()
Return type

bool or None

Returns

True if the user can select multiple items in the widget, otherwise False, or None if the SceneGraphView widget has been destroyed.

applyColumnVisibilitySettings(columnVisibility)
Parameters

columnVisibility (dict) – A dictionary containing visibility settings for columns and column sets in the SceneGraphView widget, indexed by name. Can be used to restore the visible columns and column sets when restoring a tab layout.

See

SceneGraphColumn

applyColumnWidthsSettings(columnWidths)
Parameters

columnWidths (dict) – A dictionary containing the widths of columns in the SceneGraphView widget, indexed by name. Can be used to restore the widths of columns when restoring a tab layout.

See

SceneGraphColumn

beginColumnConfiguration()

A function that together with endColumnConfiguration() can be used to wrap several calls of addColumnSet() and addColumn() without triggering column configuration change callback functions, to allow for efficient updating of UI widgets.

A registered column configuration change callback function is triggered when calling endColumnConfiguration().

clearExpandedLocationsRegistry(clearCurrent=False)

Clears the cache of previously expanded locations, and optionally of currently expanded locations as well.

Parameters

clearCurrent (bool) – Flag indicating whether the registry of currently expanded locations should be cleared.

Note

This does not cause any locations to be collapsed.

clearTopLevelLocations()

Removes all top-level locations from the SceneGraphView widget, so that it will be empty.

endColumnConfiguration()

A function that together with beginColumnConfiguration() can be used to wrap several calls of addColumnSet() and addColumn() without triggering column configuration change callback functions, to allow for efficient updating of UI widgets.

Triggers a registered column configuration change callback function.

frozenWhenHidden()
Return type

bool or None

Returns

True if the Geolib clients are frozen (deactivated) when the widget is hidden and thawed (activated) when it is shown, or None if the SceneGraphView widget has been destroyed.

getAllLocations(visibleOnly=False)

Returns a list of scene graph locations that are currently displayed in the SceneGraphView widget.

For each item the list contains a 2 element tuple object of the following form:

(top-level location path: str, location path: str)

Where:

  • top-level location path refers to the scene graph location path of the top-level item which the selected scene graph location path belongs to.

  • location path refers to the scene graph location path selected.

  • If the top-level location path and location path are the same you can infer it is the top-level scene graph item which has been selected.

The scene graph location paths will be in their fully qualified form, unsorted containing no duplicates.

Return type

list of tuple or None

Parameters

visibleOnly (bool) – If True, then only locations which are currently visible in the SceneGraphView widget will be returned.

Returns

List of currently visible scene graph locations and the top-level item to which they belong, or None if the SceneGraphView widget has been destroyed.

getChildLocations(locationPath, topLevelLocationPath, visibleOnly=True, allDescendants=True)

Returns a list of child locations of the given location path that are currently visible in the SceneGraphView widget.

Return type

list of str or None

Parameters
  • locationPath (str) – The location for which the visible child locations should be returned.

  • topLevelLocationPath (str or None) – The top-level location under which the visible children for the given location should be returned, or None to return all visible children under the given location under any top-level location.

  • visibleOnly (bool) – If True, then only locations which are currently visible in the SceneGraphView widget will be returned.

  • allDescendants (bool) – If True, then all descendants of the given location will be returned. Otherwise, only immediate children will be returned.

Returns

List of currently visible child locations of the given location, or None if the SceneGraphView widget has been destroyed.

getChildNameByIndex(parentLocationPath, childIndex)
Deprecated

This function is deprecated. Please use getSceneGraphChildren() instead.

getColumnByName(columnName)
Return type

SceneGraphColumn or None

Parameters

columnName (str) – The name of the column to return.

Returns

The first column object found with the given name, or None if no such column exists.

getColumnPresetManager()
Return type

ColumnPresetManager

Returns

An instance of the internal ColoumnPresetManager.

getColumnVisibilitySettings()
Return type

dict

Returns

A dictionary containing the visibility settings for all columns and column sets in the SceneGraphView widget, indexed by name. Can be used to retrieve and save the visible columns and column sets when saving a tab layout.

See

SceneGraphColumn

getColumnWidthsSettings()
Return type

dict

Returns

A dictionary containing the widths of all columns in the SceneGraphView widget, indexed by name. Can be used to retrieve and save column widths when saving a tab layout.

See

SceneGraphColumn

getCurrentRules()
Return type

dict of dict

Returns

Current Rule set described as dictionary of dictionaries.

getNumberOfChildren(parentLocationPath)
Deprecated

This function is deprecated. Please use getSceneGraphChildren() instead.

getParent(locationPath)
Return type

str or None

Parameters

locationPath (str) – The path to return the parent for.

Returns

The parent path of the given location path, or None if the path is the root of the tree.

getRootColumnSet()
Return type

SceneGraphColumnSet

Returns

A reference to the root SceneGraphColumnSet object for the widget.

getSceneGraphAttributes(locationPath, callback=None, oneShot=False)

Returns the scene graph attributes at the scene graph location with the given path. The method has two modes of operation:

  • If callback is not specified and the SceneGraphView widget does not already have the requested location cached then it will return None, otherwise it will return the attributes of the requested location.

  • If callback is specified, it will first check its cache and return the attribute data stored if present via this function. Otherwise it will activate the location with Geolib3, return from this function call with None, and call you back via callback when it’s ready. This mode obeys the parameter oneShot, which, if True will only notify the callback once, otherwise the callback will be called whenever the location’s attributes change.

The callback is expected to have the following signature:

function(locationPath: str, attributes: FnAttribute.Attribute) -> bool

Where:

  • locationPath is a str providing the path of the scene graph location the corresponding attributes relate to.

  • attributes is an instance of PyFnAttribute.Attribute and contains the attributes at the specified location.

The callback is expected to return True if it should continue to receive updates for the requested location, otherwise it should return False. Note: The return value will be ignored where oneShot=True.

If the callback raises an exception, it will no longer be called for the location it was registered for. However, it will still be called for other locations it may have been registered for.

Return type

PyFnAttribute.GroupAttribute or None

Parameters
  • locationPath (str) – The path of the scene graph location whose attributes to return.

  • callback (callable) – If not None this will be called back if the location data is not immediately available.

  • oneShot (bool) – If True, and callback is not None then callback will only be called once.

Returns

A group attribute containing the attributes of the scene graph location with the given path, or None if no such attributes are available.

getSceneGraphChildren(parentLocationPath, callback=None, oneShot=False)

Returns the list of children under the scene graph location with the given path. The method has two modes of operation:

  • If callback is not specified and the SceneGraphView widget does not already have the requested location cached then it will return None, otherwise it will return the children of the requested location.

  • If callback is specified, it will first check its cache and return the children stored if present via this function. Otherwise it will activate the location with Geolib3, return from this function call with None, and call you back via callback when it’s ready. This mode obeys the parameter oneShot, which, if True will only notify the callback once, otherwise the callback will be called whenever the location’s attributes change.

The callback is expected to have the following signature:

function(parentLocationPath: str, children: list) -> bool

Where:

  • parentLocationPath is an str providing the path of the scene graph location the corresponding children relate to.

  • children is a list of names of scene graph locations that exist underneath the parent scene graph location with the given path.

The callback is expected to return True if it should continue to receive updates for the requested location, otherwise it should return False. Note: The return value will be ignored where oneShot=True.

If the callback raises an exception, it will no longer be called for the location it was registered for. However, it will still be called for other locations it may have been registered for.

Return type

list or None

Parameters
  • parentLocationPath (str) – The path of the scene graph location whose children to return.

  • callback (callable) – If not None this will be called back if the location data is not immediately available.

  • oneShot (bool) – If True, and callback is not None then callback will only be called once.

Returns

The children of the scene graph location with the given path, or None if the scene graph location does not have any children.

getSelectedItems()
Return type

list of TreeWidgetItem or None

Returns

A list of the items in the SceneGraphView widget that the user currently has selected, or None if the SceneGraphView widget has been destroyed.

getSelectedLocations(sortBySceneGraphOrder=False)

Returns a list of scene graph locations that the user currently has selected.

For each selected item the list contains a 2 element tuple object of the following form:

(top-level location path: str, location path: str)

Where:

  • top-level location path refers to the scene graph location path of the top-level item which the selected scene graph location path belongs to.

  • location path refers to the scene graph location path selected.

  • If the top-level location path and location path are the same you can infer it is the top-level scene graph item which has been selected.

The scene graph location paths will be in their fully qualified form, unsorted containing no duplicates.

Return type

list of tuple or None

Parameters

sortBySceneGraphOrder (bool) – True if the results should be sorted according to the order they appear in the widget, or False to return the locations in the order in which they were selected.

Returns

List of currently selected scene graph locations and the top-level item to which they belong, or None if the SceneGraphView widget has been destroyed.

getTopLevelLocations()

Returns a list of all top-level locations this SceneGraphView knows about.

You can infer the display order of top-level locations based on the order they are defined in the list returned by this function.

It is possible that there are locations in the list returned by this function which are not visible in the SceneGraphView. This is because the scene graph location path may refer to a location which does not exist in the currently viewed scene.

Return type

list of str

Returns

A list of the scene graph location paths which are top-level locations.

getWidget()
Return type

QtWidgets.QWidget or None

Returns

Returns a handle to a QtWidgets.QWidget instance which represents the viewable SceneGraphView widget capable of being displayed in a Qt application, or None if the SceneGraphView widget has been destroyed.

hideColumnSet(columnSetName)

Makes the column set with the given name invisible.

This function will have no effect if the specified name does not exist.

Parameters

columnSetName (str) – The name assigned to the column set that should be hidden.

See

SceneGraphColumn

interruptClientProcessing()

Cancel client processing. Useful to halt a long running cook process.

isFrozen()
Return type

bool

Returns

True if the Geolib3 clients managed by this SceneGraphView are currently frozen (not active), otherwise False.

isLocationExpanded(topLevelLocationPath, locationPath)

Indicates whether the given location is expanded in the view.

Return type

bool or None

Parameters
  • topLevelLocationPath (str) – The top level location which under which the location’s expansion state should be returned.

  • locationPath (str) – The location path whose expansion state should be returned.

Returns

The expansion state of the given location under the given top-level location, or None if the SceneGraphView widget has been destroyed.

isProcessing()
Return type

bool

Returns

True if events were processed during the last idle loop, otherwise False.

isStopping()
Return type

bool

Returns

True if the clients managed by this SceneGraphView have been interrupted and are still processing events received since the interruption, otherwise False.

locationNamesPolished()
Return type

bool or None

Returns

A boolean value indicating whether scene graph location names are being “polished” for display in the widget, or None if the SceneGraphView widget has been destroyed

removeRule(ruleName)

Removes the rule specified by ruleName from the current rule set.

Parameters

ruleName (str) – The name of the rule to remove from the rule set.

removeTopLevelLocation(topLevelLocationPath)

Removes the top level location specified by topLevelLocationPath from the SceneGraphView. This will not delete scene graph locations or modify the underlying scene graph in any way.

If you specify a location which is not a top-level item then this function will raise a TreeWidgetException.

Parameters

topLevelLocationPath (str) – The scene graph location path which should be removed from the top-level locations displayed by this SceneGraphView.

Raises

TreeWidgetException – If topLevelLocationPath is not a valid top-level scene graph location path.

saveExpandedLocations()

Saves the currently expanded locations. This can be called before performing actions which might cause the expansion state to be lost (for example, when the viewed node changes), so that locations’ expansion state can be recovered later on.

Return type

set of (str, str) or None

Returns

A set of tuples in the form (locationPath, topLevelLocationPath) indicating the currently expanded locations, or None if the SceneGraphView widget has been destroyed.

scrollToLocation(topLevelLocationPath, locationPath)

Scrolls the view so that the scene graph location specified by topLevelLocationPath and locationPath is visible.

Parameters
  • topLevelLocationPath (str) – The top-level location which under which the location should be scrolled to.

  • locationPath (str) – The location path to which to scroll the view.

selectChildLocations(replaceSelection=True)
selectLocations(locations, replaceSelection=True)

Selects the scene graph locations specified by locations, optionally replacing the current selection.

locations is a list whose elements are either 2-tuples of:

(top-level location path: str, location path: str)

or single strings representing locations paths, in which case every occurrence of each element of locations will be selected.

Parameters
  • locations (list of tuple containing a pair of str, or list of str) – A list of the locations to select, either in tuples of the form (topLevelLocationPath, locationPath) or just as a list of locations. In the latter case, every instance of the specified location will be selected (i.e. under any top-level location).

  • replaceSelection (bool) – A flag to indicate whether the specified locations should replace what is currently selected.

selectParentLocations(replaceSelection=True)
setAboutToDragCallback(callback)

Registers a function to be called when a drag action begins. This allows the MIME data for the drag event to be configured.

If this is not specified then a default will be provided that provides the textual representation of the selected scene graph location paths in a space-delimited list.

The callback is expected to have the following signature:

function(items: list, dragObject: QtGui.QDrag)

Where:

  • items is a list of specialized QtWidgets.QTreeWidgetItem instances that represent the items that are about to be dragged.

  • dragObject is an instance of QtGui.QDrag, and provides details about the drag operation.

The callback is not expected to return a value.

Parameters

callback (callable) – A callable function to handle about to drag events.

setAllowMultipleSelection(allowMultipleSelection)

Enable or disable multiple selections in the View

Parameters

allowMultipleSelection (bool) – A flag indicating whether the user can select multiple items.

setContextMenuEventCallback(callback)

Sets a function to be called when the user right-clicks on a scene graph location in the widget or into empty space within the widget, in order to customize the contents of the context menu that is shown.

The callback is expected to have the following signature:

function(contextMenuEvent: ContextMenuEvent, menu: QtWidgets.QMenu)

Where:

  • contextMenuEvent is an instance of ContextMenuEvent and allows you to interrogate the scene graph location path, top-level location path and column under the pointer when the menu was requested. It also allows you to interrogate the current selection state, thus allowing you to provide actions specific to particular scene graph locations.

  • menu is an instance of QtWidgets.QMenu to which custom actions can be added by calling its addAction() function.

The callback is not expected to return a value.

For the Name column, the context menu passed to the callback will contain the following commands by default:

  1. Expand Branches - Expands all selected locations recursively, including their child locations.

  2. Expand Branches To - Expands all selected locations recursively, including their child locations, but stops at locations of a particular type, as chosen in the submenu.

  3. Collapse Branches To - Collapses all selected locations recursively, including their child and parent locations, but stops at locations of a particular type, as chosen in the submenu.

  4. Collapse Branches - Collapses all selected locations recursively, including their child locations.

  5. Expand Locations - Shown when at least one location is selected. Expands the selected locations while keeping the expansion state of child locations.

  6. Collapse Locations - Shown when at least one location is selected. Collapses the selected locations while keeping the expansion state of child locations.

If the context menu is opened when all top-level locations are selected, the commands for expanding and collapsing branches are named Expand All, Expand All To, Collapse All To, and Collapse All, respectively. Those commands are also included when the user right-clicks into empty space within a SceneGraphView widget while no locations are selected.

Parameters

callback (callable) – A callback that will be triggered when the user right-clicks within the SceneGraphView widget.

See

ContextMenuEvent

setDragMoveEventCallback(callback)

Registers a function to be called when items are dragged over the SceneGraphView widget in order to determine whether dragged items could be dropped onto the widget.

The callback is expected to have the following signature:

function(dragMoveEvent: QtGui.QDragMoveEvent, draggedItems: list,
         parentItem: QtWidgets.QTreeWidgetItem, childItemIndex: int)

Where:

  • dragMoveEvent is an instance of QtGui.QDragMoveEvent, and provides details about the drag operation in progress.

  • draggedItems is a list of specialized QtWidgets.QTreeWidgetItem instances that represent the items that are being dragged over the widget.

  • parentItem is a specialized QtWidgets.QTreeWidgetItem instance that represents an item in the SceneGraphView widget that contains the item over which the dragged items are being dragged. parentItem is None if items are being dragged over empty space in the SceneGraphView widget.

  • childItemIndex is an integer number representing the index of the item under the pointer underneath the given parentItem.

The callback is not expected to return a value.

By default, the given dragMoveEvent is ignored, meaning that dragged items cannot be dropped. If you want to allow dragged items to be dropped, call accept() on the given dragMoveEvent in your callback.

Parameters

callback (callable) – A callable function to handle drag move events.

setDropEventCallback(callback)

Registers a function to be called when dragged items are dropped over the SceneGraphView widget in order to trigger custom behavior depending on the number and type of the dragged items and the item onto which the dragged items have been dropped.

The callback is expected to have the following signature:

function(dropEvent: QtGui.QDropEvent, droppedItems: list,
         parentItem: QtWidgets.QTreeWidgetItem, childItemIndex: int)

Where:

  • dropEvent is an instance of QtGui.QDropEvent, and provides details about the drop operation.

  • droppedItems is a list of specialized QtWidgets.QTreeWidgetItem instances that represent the items that have been been dropped onto the widget.

  • parentItem is a specialized QtWidgets.QTreeWidgetItem instance that represents an item in the SceneGraphView widget that contains the item over which the dragged items have been dropped. parentItem is None if items have been dropped over empty space in the SceneGraphView widget.

  • childItemIndex is an integer number representing the index of the item under the pointer underneath the given parentItem.

The callback is not expected to return a value.

Parameters

callback (callable) – A callable function to handle drag move events.

setExpandsOnDoubleClick(expandsOnDoubleClick)

Enable or disable recursively expanding child locations when a double- click event is received. The default is True.

Parameters

expandsOnDoubleClick (bool) – Whether or not to expand child locations on double-click.

setFrozenWhenHidden(frozenWhenHidden=True)
Parameters

frozenWhenHidden (bool) – A flag indicating whether the internal Geolib clients in the widget will be frozen (deactivated) when the widget is hidden, and thawed (activated) when it is shown. Default is True.

setKeyPressEventCallback(callback)

Specifies a function to handle keyPress events from the underlying Qt widget.

The callback is expected to have the following signature:

function(keyPressEvent: QtGui.QKeyEvent)

Where:

  • keyPressEvent is an instance of QtGui.QKeyEvent, and specifies which key has been pressed.

The callback is not expected to return a value.

Parameters

callback (callable) – A callable function to handle key press events.

setLocationActive(locationPath)

Sets the scene graph location with the given path in the managed client for SceneGraphView to the active state.

Active locations are explicitly recomputed every time anything is committed to the Geolib3 runtime.

Parameters

locationPath (str) – The path of the scene graph location to activate in the managed client.

setLocationAddedOrUpdatedCallback(callback)

Sets the function to be called whenever a new location is added or updated in the scene graph view.

The callback is expected to have the following signature:

function(locationPath: str, topLevelLocationPath: str)

Where:

  • locationPath is a str containing the path to the location which has been added

  • topLevelLocationPath is a str containing the top-level location under which the given location exists in the widget

The callback is not expected to return a value.

Parameters

callback (callable) – The callback that will be called when a location is added or updated.

setLocationCollapsed(topLevelLocationPath, locationPath)

Sets the scene graph location specified by the topLevelLocationPath and locationPath to be collapsed in the view.

Parameters
  • topLevelLocationPath (str) – The top level location which under which the location should be collapsed.

  • locationPath (str) – The location path to collapse.

setLocationCollapsedCallback(callback)

Sets the function to be called whenever a location is collapsed in the scene graph view.

The callback is expected to have the following signature:

function(locationPath: str, topLevelLocationPath: str, recursive: bool)

Where:

  • locationPath is a str containing the path to the location which has been collapsed

  • topLevelLocationPath is a str containing the top-level location under which the given location was collapsed in the widget

  • recursive is a bool indicating whether the location was collapsed recursively.

The callback is not expected to return a value.

Parameters

callback (callable) – The callback that will be called when a location is collapsed in the scene graph view.

setLocationDataProcessedCallback(callback)

Sets the function to be called after all location data has finished being processed.

The callback is expected to have the following signature:

function(processedLocations: set)

Where:

  • processedLocations is a set of tuples of the form (top-level location path, location path), representing the scene graph locations whose data have been changed.

The callback is not expected to return a value.

Parameters

callback (callable) – The callback that will be called after the location update callbacks are finished being processed.

setLocationExpanded(topLevelLocationPath, locationPath)

Sets the scene graph location specified by the topLevelLocationPath and locationPath to be expanded in the view.

Parameters
  • topLevelLocationPath (str) – The top level location which under which the location should be expanded.

  • locationPath (str) – The location path to expand.

setLocationExpandedCallback(callback)

Sets the function to be called whenever a location is expanded in the scene graph view.

The callback is expected to have the following signature:

function(locationPath: str, topLevelLocationPath: str, recursive: bool)

Where:

  • locationPath is a str containing the path to the location which has been expanded

  • topLevelLocationPath is a str containing the top-level location under which the given location was expanded in the widget

  • recursive is a bool indicating whether the location was expanded recursively.

The callback is not expected to return a value.

Parameters

callback (callable) – The callback that will be called when a location is expanded in the scene graph view.

setLocationExpandedRecursive(topLevelLocationPath, locationPath)

Recursively opens the location locationPath and its descendant locations, respecting configured stop conditions.

Parameters
  • topLevelLocationPath (str) – The top level location which under which the location should be expanded.

  • locationPath (str) – The location path to expand.

setLocationNamePolishCallback(callback)

Sets the function to call to “polish” the name displayed for a scene graph location.

The callback is expected to have the following signature:

function(locationPath: str, topLevelLocationPath: str) -> str

Where:

  • locationPath is a str containing the full path of the scene graph location whose name is to be polished, e.g. '/root/world/lgt/lightRig1/lightRig1_keyLight'.

  • topLevelLocationPath is a str containing the full path of the top-level location under which this location is being polished, e.g. '/root/world/lgt'.

The callback is expected to return the polished name to use for the scene graph location with the given path, e.g. 'keyLight'.

Parameters

callback (callable) – A callable object that will be called to determine the name to be displayed for a scene graph location.

setLocationNamesPolished(namesPolished)

Sets whether name “polishing” should be applied to scene graph location names displayed in the widget.

Parameters

namesPolished (bool) – A boolean value indicating whether we wish to run the specified name polishing callback on scene graph location names displayed in the widget.

setLocationRemovedCallback(callback)

Sets the function to be called whenever a location is removed in the scene graph view. This allows users to respond to the specific locations being removed by the scene graph processing instructions.

The callback is expected to have the following signature:

function(locationPath: str, topLevelLocationPath: str)

Where:

  • locationPath is a str containing the path to the location which has been removed

  • topLevelLocationPath is a str containing the top-level location under which the given location existed in the widget

The callback is not expected to return a value.

Parameters

callback (callable) – The callback that will be called when a location is removed from the currently viewed scene.

setMaxEventsToProcess(maxEventsToProcess)

Set the maximum number of events that the client manager can process per cycle.

Parameters

maxEventsToProcess (int) – The maximum number of events that the client manager can process per cycle. A negative or zero value indicates no maximum.

setOverrideParameterRequestCallback(callback)

Sets the function to call when override parameters for attributes of scene graph locations are requested.

The callback is expected to have the following signature:

function(overrideParameters: dict)

Where:

  • overrideParameters is a nested dictionary with paths of scene graph locations and resolved names of scene graph attributes for which override parameters have been requested. The callback is expected to populate the dictionary with tuples of a node and the name of an override parameter as values: (NodegraphAPI.Node, str)

The callback is not expected to return a value.

Parameters

callback (callable) – A callable object that will be called when override parameters corresponding to attributes of scene graph locations are requested.

setRuleCriteria(ruleName, criteriaName, criteria)

Sets the criteria of the specified evaluator for a given rule.

This function will have no effect if ruleName refers to a non-existent Rule.

Parameters
  • ruleName (str) – The rule name assigned to the Rule.

  • criteriaName (str) – The criteria name required by the evaluator.

  • criteria (Criteria) – The criteria object.

setRuleEvaluator(ruleName, evaluator)

Sets the evaluator of the specified rule.

This function will have no effect if ruleName refers to a non-existent Rule.

Parameters
  • ruleName (str) – The rule name assigned to the Rule.

  • evaluator (Evaluator) – The evaluator object to set.

setRuleMatchPolicy(ruleMatchPolicy)

Sets the rule matching policy that should apply when testing scene graph locations against the current set of configured rules.

Valid policies are:

  • MatchAnyPolicy

  • MatchAllPolicy

The default policy is MatchAnyPolicy.

Parameters

ruleMatchPolicy (int) – A valid rule matching policy

setRuleTarget(ruleName, column)

Sets the target column of the specified rule.

This function will have no effect if ruleName refers to a non-existent rule.

Parameters
  • ruleName (str) – The rule name assigned to the Rule.

  • column (SceneGraphColumn) – The column which will be targeted for the rule.

Todo

Extend this function to allow target to work in Attribute or Parameter mode.

setSelectionChangedCallback(callback)

Sets the specified selection changed callback. Whenever the selection changes as a result of user interaction this callback will be triggered.

It is possible to interrogate the current selection using getSelectedLocations().

The callback is expected to take no arguments and is not expected to return a value.

Parameters

callback (callable) – A callback that will be triggered each time the selection changes.

See

getSelectedLocations()

setSelectionState(topLevelLocationPath, locationPath, selected)

Sets the scene graph location specified by topLevelLocationPath and locationPath to the given selection state.

If topLevelLocationPath is None then every occurrence of locationPath will have the selected state applied.

Parameters
  • topLevelLocationPath (str) – The top-level location path under which to set the selection state of the specified location path. If None, then every occurrence of the specified location path will have its selection state set.

  • locationPath (str) – The scene graph location path whose selection state should be set.

  • selected (bool) – The selection state to which to set the given scene graph location.

setStopRecursiveExpandAttributeNames(attributeNames)

Sets a list of attribute names whose presence at a location should stop recursive expansion.

Parameters

attributeNames (list of str) – A list of attribute names whose presence at a location should stop recursive expansion.

setStopRecursiveExpandLocationTypes(locationTypes)

Sets a list of location types at which recursive expansion should stop.

Parameters

locationTypes (list of str) – A list of location types at which recursive expansion should stop.

setTerminalOps(terminalOpArgs)

Creates a chain of Ops, based on the given Op description in the form of a sequence of Op type and Op argument tuples, and sets the last one of them to be the Op to use in the clients managed by this client manager. The Op arguments can be omitted if there are no arguments for the Op. If Op arguments has been given, an optional ‘key’ can be provided which is used to identify the Op when updating its arguments.

When created, each Op will take its input from the previous Op in the sequence. These Ops will overwrite any previously created terminal Ops.

Parameters

terminalOpArgs (tuple of tuple of (str, FnAttribute.GroupAttribute, str) or (str, FnAttribute.GroupAttribute) or (str)) – A list of Op type name, Op args and terminal Op key triplets.

setTopLevelDisplayIndex(locationPath, index)

Set the display index for the given top-level location.

Parameters
  • locationPath (str) – The scene graph location of a top level item to move.

  • index (int) – The new display index for the specified item.

setTopLevelLocations(topLevelLocationPaths)

Sets the list of paths of scene graph locations the SceneGraphView widget shows as top-level locations to the given list.

Parameters

topLevelLocationPaths (list of str) – A list of paths of scene graph locations to show as top-level locations in the SceneGraphView widget.

setUpdateViewportAutomatically(updateViewportAutomatically)

Sets whether the viewport of the SceneGraphView widget should update automatically. By default, this is True.

Parameters

updateViewportAutomatically (bool) – True if the viewport of the widget should update automatically, or False for the viewport to only update when updateViewport is called.

setViewNode(node, applyImplicitResolvers=False, extraImplicitResolverOpArgs=None)

Sets the Op used in the SceneGraphView widget’s Geolib3 client to the terminal Op for the given viewed node, optionally appending Ops related to the resolving of materials, constraints etc.

Parameters
  • node (NodegraphAPI.Node or None) – The node whose terminal Op to use for the Geolib3 client, or None to reset the Geolib3 client.

  • applyImplicitResolvers (bool) – Flag that controls whether Ops for implicit resolvers are to be appended to the given viewed node’s terminal Op in the Geolib3 client used by the SceneGraphView widget.

  • extraImplicitResolverOpArgs (dict or None) – dict mapping Op type names (str) to group attributes (GroupAttribute) describing additional arguments to pass to Ops with the given types.

setViewOp(op, applyImplicitResolvers=False, extraImplicitResolverOpArgs=None)

Sets the Op used in the SceneGraphView widget’s Geolib3 client to the given Op, optionally appending Ops related to the resolving of materials, constraints etc.

Parameters
  • op (FnGeolibOp or None) – The Op to use for the Geolib3 client, or None to reset the Geolib3 client.

  • applyImplicitResolvers (bool) – Flag that controls whether Ops for implicit resolvers are to be appended to the given viewed node’s terminal Op in the Geolib3 client used by the SceneGraphView widget.

  • extraImplicitResolverOpArgs (dict or None) – dict mapping Op type names (str) to group attributes (GroupAttribute) describing additional arguments to pass to Ops with the given types.

showColumnSet(columnSetName)

Makes the column set with the given name visible.

This function will have no effect if the specified name does not exist.

Parameters

columnSetName (str) – The name assigned to the column set that should be shown.

See

SceneGraphColumn

showRuleConfigDialog()

Makes the rule filtering configuration dialog box visible.

topLevelLocationRenamed(oldLocationPath, newLocationPath)

Notifies the SceneGraphView widget that a top-level location has been renamed. This is intended to be called in response to a UI event, e.g. a node being renamed in the Gaffer UI.

updateLocation(topLevelLocationPath, locationPath)

Refreshes the UI of the SceneGraphView for the given location path.

Parameters
  • topLevelLocationPath (str) – The top-level location which under which the location should be updated.

  • locationPath (str) – The location path to update

updateLocationIcons(topLevelLocationPath, locationPath)

Refreshes the icons displayed in the SceneGraphView for the given location path.

Parameters
  • topLevelLocationPath (str) – The top-level location which under which the location should have its icons updated.

  • locationPath (str) – The location path to update the icons for.

updateSelection(selectedLocations, deselectedLocations)

Updates the set of selected locations, adding those in selectedLocations and removing those in deselectedLocations.

Parameters
  • selectedLocations (list of 2-tuple of str, or list of str) – A list of the locations to add to the selection, either in tuples of the form (topLevelLocationPath, locationPath) or just as a list of locations. In the latter case, every instance of the specified location will be selected (i.e. under any top-level location).

  • deselectedLocations (list of 2-tuple of str, or list of str) – A list of the locations to remove from the selection, either in tuples of the form (topLevelLocationPath, locationPath) or just as a list of locations. In the latter case, every instance of the specified location will be selected (i.e. under any top-level location).

updateTerminalOps(terminalOpArgs, txn=None)

Updates the arguments of a chain of custom terminal Ops that were previously appended to the Op tree.

Parameters
  • terminalOpArgs (tuple of tuple of (str, FnAttribute.GroupAttribute, str)) – A sequence of terminal Op type, Op arguments and terminal op key triplets.

  • txn (FnGeolib.GeolibRuntime.Transaction or None) – The transaction that will be used to set the Op arguments. If no transaction is provided, a new one is created.

updateViewport()

Refreshes the viewport of the SceneGraphView widget.

updateWidget()

Refreshes the UI of the SceneGraphView widget to reflect changes in the column configuration and in scene graph location attributes.

Bridge

Module containing the Bridge abstract base class.

class UI4.Widgets.SceneGraphView.Bridge.Bridge

Bases: abc.ABC

Abstract base class that represents the functions exposed by the Bridge to allow users to configure and interrogate the information stored about the scene graph.

abstract addAttributeDataItemType(itemTypeClass)

Adds a custom attribute data item type. This enables attribute data to be displayed as items in the widget as a child of a location. An example use-case for this is displaying of error messages or collection items in the Scene Graph tab.

Parameters

itemTypeClass (type) – A class derived from AttributeDataTreeWidgetItem that implements the appearance of a custom attribute data item type.

abstract addColumn(columnName)

Add a stand-alone column to this view with the given column title and return a handle to the column so it can be configured.

By default, the column will display the current location name, as a text field but. You must set the display index to a particular value.

abstract addColumnSet(columnSetName)

A column set is a grouping of column headers. It has an ordering index which determined where in the top-level its group members should be ordered.

Each column member itself has a local (within the group) ordering index.

abstract addRule(ruleName)
abstract addTopLevelLocation(topLevelLocationPath, index=None)

Adds a new top-level location to the SceneGraphView widget. By default the only top-level location will be /root. If index is supplied, inserts the new top-level location at the given index in the widget, otherwise appends to the widget.

Parameters
  • topLevelLocationPath (str) – Full path to location to be added as a top- level location.

  • index (int or None) – The index in the list of top-level locations at which to add the new location, or None to append the location to the list.

applyColumnVisibilitySettings(columnVisibility)
Parameters

columnVisibility (dict) – A dictionary containing the visibility settings for all columns and column sets, indexed by name. Can be used to restore the visible columns and column sets when restoring a tab layout.

See

SceneGraphColumn

applyColumnWidthsSettings(columnWidths)
Parameters

columnWidths (dict) – A dictionary containing the widths of columns, indexed by name. Can be used to restore column widths when restoring a tab layout.

See

SceneGraphColumn

abstract beginColumnConfiguration()

A function that together with endColumnConfiguration() can be used to wrap several calls of addColumnSet() and addColumn() without triggering column configuration change callback functions, to allow for efficient updating of UI widgets.

A registered column configuration change callback function is triggered when calling endColumnConfiguration().

abstract clearRuleCriteria(ruleName, triggerEvaluation=True)
abstract clearTopLevelLocations()

Removes all top-level locations from the SceneGraphView widget, so that it will be empty.

abstract collapseLocation(handle, topLevelHandle, recursive=False)

Collapses the scene graph location represented by the given handle underneath the top-level scene graph location represented by the given top-level handle, optionally recursively collapsing all its child locations.

Parameters
  • handle (SceneGraphHandle) – A handle representing the scene graph location to collapse, optionally including its children.

  • topLevelHandle (SceneGraphHandle) – A handle representing the top-level scene graph location that contains the scene graph location(s) to collapse.

  • recursive (bool) – Flag to control whether to collapse all child locations of the scene graph location represented by the given handle. If set to True, the entire hierarchy underneath the scene graph location is collapsed, if False, only the scene graph location itself is collapsed (the default).

columnResized(columnIndex, newColumnWidth)

Called by the ViewLink when a column is resized by the user.

columnTitleClicked(columnIndex, columnTitleRect)

Called by the ViewLink when a column title is clicked by the user.

abstract endColumnConfiguration()

A function that together with beginColumnConfiguration() can be used to wrap several calls of addColumnSet() and addColumn() without triggering column configuration change callback functions, to allow for efficient updating of UI widgets.

Triggers a registered column configuration change callback function.

abstract expandLocation(handle, topLevelHandle, recursive=False, stopTypes=None)

Expands the scene graph location represented by the given handle underneath the top-level scene graph location represented by the given top-level handle, optionally recursively expanding all its child locations.

Parameters
  • handle (SceneGraphHandle) – A handle representing the scene graph location to expand, optionally including its children.

  • topLevelHandle (SceneGraphHandle) – A handle representing the top-level scene graph location that contains the scene graph location(s) to expand.

  • recursive (bool) – Flag to control whether to expand all child locations of the scene graph location represented by the given handle. If set to True, the entire hierarchy underneath the scene graph location is expanded, if False, only the scene graph location itself is expanded (the default).

  • stopTypes (tuple or list or set or str or None) – A tuple or list of names of types of scene graph locations or a single location type name at which the expansion should be stopped. Only used when recursive is True.

abstract fontChanged()

Triggers an update of the columns when the font is changed.

abstract freeze()

Freezes the clients managed by this SceneGraphView. Usually wired into show/hide UI event handlers, this will freeze updates to the clients managed by this SceneGraphView. Calling this function will ensure that potentially expensive work will be deferred until the corresponding thaw() call is made. Usually called by the hide() event handler.

abstract getAttributeDataItemTypes()
Return type

list of type

Returns

A list of classes derived from AttributeDataTreeWidgetItem that are registered as custom attribute data item types.

abstract getColumnByIndex(columnIndex, visibleOnly=True)
Return type

UI4.SceneGraphView.SceneGraphViewColumn.SceneGraphColumn or None

Parameters

columnIndex (int) – The index of the column to return.

Returns

The SceneGraphColumn object with the given index, or None if no such column was found.

abstract getColumnByName(columnName)
Return type

UI4.SceneGraphView.SceneGraphViewColumn.SceneGraphColumn or None

Parameters

columnName (str) – The name of the column to return.

Returns

The first SceneGraphColumn object found with the given name, or None if no such column was found.

abstract getColumnDataType(columnIndex)
Return type

int

Parameters

columnIndex (int) – The index of the column whose data type to return.

Returns

The type of data contained in the column with the given index.

abstract getColumnPresetManager()
Return type

ColumnPresetManager

Returns

An instance of the internal ColoumnPresetManager.

getColumnVisibilitySettings()
Return type

dict

Returns

A dictionary containing the visibility settings for all columns and column sets, indexed by name. Can be used to retrieve and save the visible columns and column sets when saving a tab layout.

See

SceneGraphColumn

getColumnWidthsSettings()
Return type

dict

Returns

A dictionary containing the widths of all columns, indexed by name. Can be used to retrieve and save the column widths when saving a tab layout.

See

SceneGraphColumn

abstract getCurrentRules()
abstract getDisplayData(handle, topLevelHandle, columnIndex)
Return type

str or float or list

Returns

The data that is to be displayed in the column with the given index for the scene graph location represented by the given handles.

abstract getNumberOfChildren(locationPath)
Return type

str or None

Parameters

locationPath (str) – The path to return the number of children of.

Returns

The number of children under the given location path. This is the number of children for which we have cached location data.

abstract getNumberOfColumns()
Returns

The number of columns that should be displayed.

abstract getNumberOfTopLevelLocations()
Return type

int

Returns

The number of top-level locations displayed in the SceneGraphView widget.

abstract getOverrideNodeAndParameterName(locationPath, attributeName)
Return type

tuple of NodegraphAPI.Node or None and str or None.

Parameters
  • locationPath (str) – The path of a scene graph location for which to return an override parameter node.

  • attributeName (str) – The name of a scene graph attribute for which to return an override node and parameter name pair.

Returns

A node and parameter name pair. Where the node contains a parameter which sets the value of the scene graph attribute with the given name on the scene graph location with the given path, or a tuple containing two instances of None if no such node and parameter pair is available.

abstract getParent(locationPath)
Return type

str or None

Parameters

locationPath (str) – The path to return the parent for.

Returns

The parent path of the given location path, or None if the path is the root of the tree.

abstract getPotentialChildren(locationPath)
Return type

list of str

Parameters

locationPath (str) – The path to return the potential children of.

Returns

A list of the potential children under the given location path. These are potential children according to the data returned from the runtime, and so not all these children may end up existing in the viewed scene, and we may not have data cached for all of them. Note therefore that the size of this array may not match the result from getNumberOfChildren.

abstract getResolvedAttributeName(handle, attributeName)

Resolves names of meta attributes to names of actual attributes for a given renderer, for example material.meta.intensity to material.prmanLightParams.Intensity.

Return type

tuple of (bool, str)

Parameters
  • handle (SceneGraphHandle) – A handle representing the scene graph location that contains the attribute whose resolved name to return.

  • attributeName (str) – The potentially unresolved name of the attribute to resolve.

Returns

A tuple containing a boolean value indicating whether the attribute name needed to be resolved and was resolved, and the resolved name of the attribute with the given unresolved name contained in the scene graph location represented by the given handle, if so.

abstract getRootColumnSet()
Return type

SceneGraphColumnSet

Returns

A reference to the root SceneGraphColumnSet object for the widget.

abstract getRuleByName(ruleName)
abstract getRuleMatchInversion()
abstract getSceneGraphAttributes(locationPath, callback=None, oneShot=False)

Obtain the scene graph attributes at the specified location.

See

UI4.Widgets.SceneGraphView.SceneGraphView

abstract getSceneGraphChildren(parentLocationPath, callback=None, oneShot=False)

Obtain the children at the specified location.

See

UI4.Widgets.SceneGraphView.SceneGraphView

abstract getTitleText(columnIndex)
Return type

str

Parameters

columnIndex (int) – The index of the column whose title text to return.

Returns

The title text that should be displayed for the column with the given index.

abstract getTopLevelDisplayIndex(handle)

Get the display index for the given top-level location.

abstract getTopLevelLocations()
Return type

list of str

Returns

A list of paths of scene graph locations displayed as top-level locations in the SceneGraphView widget.

Return type

ViewLink or None

Returns

The view link set for this bridge, or None if no view link has been set.

hideColumnSet(columnSetName)

Makes the column set with the given name invisible.

This function will have no effect if the specified name does not exist.

Parameters

columnSetName (str) – The name assigned to the column set that should be hidden.

See

UI4.SceneGraphView.SceneGraphViewColumn.SceneGraphColumn

abstract interruptClientProcessing()

Cancel client processing. Useful to halt a long running cook process.

abstract isEditable(columnIndex)

Return True if the column at the given column index represents an editable piece of data.

abstract isFrozen()
Return type

bool

Returns

True if the clients managed by this SceneGraphView are frozen, otherwise False.

abstract isNameColumn(columnIndex)

Return True if the column at the given column index represents the scene graph location’s name.

abstract isProcessing()
Return type

bool

Returns

True if events were processed during the last idle loop, and the clients managed by this SceneGraphView are not frozen, otherwise False.

abstract isStopping()
Return type

bool

Returns

True if the widget has had processing interrupted, and is in the process of stopping - i.e. is still receiving incoming events from the client manager since the interruption was sent.

abstract locationNamesPolished()
Return type

bool

Returns

A boolean value indicating whether scene graph location names are being “polished” in the widget.

abstract matchRules(handle, topLevelHandle)
moveColumn(columnIndex, newColumnIndex)

Called by the ViewLink when a column is moved by the user.

abstract removeRule(ruleName)
abstract removeTopLevelLocation(topLevelLocationPath)

Removes the top-level location with the given path from the SceneGraphView widget.

Parameters

topLevelLocationPath (str) – The path of the top-level scene graph location to remove.

abstract renameRule(oldName, newName)
abstract resetAttributeDataItemTypes()

Clears all registered custom attribute data item types.

abstract setKeyPressEventCallback(callback)

Specifies a function to handle key press events from the underlying Qt widget.

The callback is expected to have the following signature:

function(keyPressEvent)

  • keyPressEvent is an instance of QtGui.QKeyEvent, and specifies which key has been pressed.

Parameters

callback (callable) – A callable function to handle key press events.

abstract setLocationActive(locationPath)

This will instruct Geolib3 to recompute the specified location whenever it receives updates for the OpTree.

Parameters

locationPath (str) – The scene graph location path that will be set as active in the Geolib3 client.

abstract setLocationAddedOrUpdatedCallback(callback)

Sets the callback which is triggered when a location is added or updated.

abstract setLocationDataProcessedCallback(callback)

Sets the callback which is triggered after any (and all) location updates have been processed.

abstract setLocationNamePolishCallback(callback)

Sets the function to call to “polish” the name for a scene graph location.

The callback is expected to have the following signature:

function(locationPath: str, topLevelLocationPath: str) -> str

Where:

  • locationPath is a str containing the full path of the scene graph location whose name is to be polished, e.g. '/root/world/lgt/lightRig1/lightRig1_keyLight'.

  • topLevelLocationPath is a str containing the full path of the top-level location under which this location is being polished, e.g. '/root/world/lgt'.

The callback is expected to return the polished name to use for the scene graph location with the given path, e.g. 'keyLight'.

Parameters

callback (callable) – A callable object that will be called to determine the polished name for a scene graph location.

abstract setLocationNamesPolished(locationNamesPolished)

Sets whether name “polishing” should be applied to scene graph location names in the widget.

Parameters

namesPolished (bool) – A boolean value indicating whether we wish to run the specified name polishing callback on scene graph location names in the widget.

abstract setLocationRemovedCallback(callback)

Sets the callback which is triggered when a location is removed.

abstract setMaxEventsToProcess(maxEventsToProcess)

Set the maximum number of events that the client manager can process per cycle.

Parameters

maxEventsToProcess (int) – The maximum number of events that the client manager can process per cycle. A negative or zero value indicates no maximum.

abstract setRuleComment(ruleName, comment)
abstract setRuleCriteria(ruleName, criteriaName, criteria)
abstract setRuleEnabled(ruleName, isEnabled)
abstract setRuleEvaluator(ruleName, evaluator, useDefaultCriteria=False)
abstract setRuleInverted(ruleName, isInverted)
abstract setRuleMatchInversion(invert)
abstract setRuleMatchPolicy(policy)
abstract setRuleShowChildren(ruleName, showChildren)
abstract setRuleTarget(ruleName, column)
abstract setStopRecursiveExpandAttributeNames(attributeNames)

Sets a list of attribute names whose presence at a location should stop recursive expansion.

Parameters

attributeNames (list of str) – A list of attribute names whose presence at a location should stop recursive expansion.

abstract setStopRecursiveExpandLocationTypes(locationTypes)

Sets a list of location types at which recursive expansion should stop.

Parameters

locationTypes (list of str) – A list of location types at which recursive expansion should stop.

abstract setTerminalOps(terminalOpArgs)

Creates a chain of Ops, based on the given Op description in the form of a sequence of Op type and Op argument tuples, and sets the last one of them to be the Op to use in the clients managed by this client manager. The Op arguments can be omitted if there are no arguments for the Op. If Op arguments has been given, an optional ‘key’ can be provided which is used to identify the Op when updating its arguments.

When created, each Op will take its input from the previous Op in the sequence. These Ops will overwrite any previously created terminal Ops.

Parameters

terminalOpArgs (tuple of tuple of (str, FnAttribute.GroupAttribute, str) or (str, FnAttribute.GroupAttribute) or (str)) – A list of Op type name, Op args and terminal Op key triplets.

abstract setTopLevelDisplayIndex(locationPath, index)

Set the display index for the given top-level location to change its order in the top-level list.

Parameters
  • locationPath (str) – A string representing the scene graph location to set.

  • index (int) – The new display index for the specified item.

abstract setTopLevelLocations(topLevelLocations)

Sets the list of paths of scene graph locations the SceneGraphView widget shows as top-level locations to the given list.

Parameters

topLevelLocations (list of str) – A list of paths of scene graph locations to show as top-level locations in the SceneGraphView widget.

abstract setUpdateViewportAutomatically(updateViewportAutomatically)

Sets whether the viewport of the SceneGraphView widget should update automatically. By default, this is True.

Parameters

updateViewportAutomatically (bool) – True if the viewport of the widget should update automatically, or False for the viewport to only update when updateViewport is called.

Deprecated

This function is deprecated.

abstract setViewNode(viewNode, applyImplicitResolvers=False, extraImplicitResolverOpArgs=None)

Sets the Op used in the SceneGraphView widget’s Geolib3 client to the terminal Op for the given viewed node, and optionally appends Ops related to resolving of materials, constraints etc.

Parameters
  • viewNode (NodegraphAPI.Node or None) – The node whose terminal Op to use for the Geolib3 client, or None to reset the Geolib3 client.

  • applyImplicitResolvers (bool) – Flag that controls whether Ops for implicit resolvers are to be appended to the given viewed node’s terminal Op in the Geolib3 client used by the SceneGraphView widget.

  • extraImplicitResolverOpArgs (dict or None) – dict mapping Op type names (str) to group attributes (GroupAttribute) describing additional arguments to pass to Ops with the given types.

abstract setViewOp(viewOp, applyImplicitResolvers=False, extraImplicitResolverOpArgs=None)

Sets the Op used in the SceneGraphView widget’s Geolib3 client to the given Op, and optionally appends Ops related to resolving of materials, constraints etc.

Parameters
  • op (FnGeolibOp or None) – The Op to use for the Geolib3 client, or None to reset the Geolib3 client.

  • applyImplicitResolvers (bool) – Flag that controls whether Ops for implicit resolvers are to be appended to the given viewed node’s terminal Op in the Geolib3 client used by the SceneGraphView widget.

  • extraImplicitResolverOpArgs (dict or None) – dict mapping Op type names (str) to group attributes (GroupAttribute) describing additional arguments to pass to Ops with the given types.

showColumnSet(columnSetName)

Makes the column set with the given name visible.

This function will have no effect if the specified name does not exist.

Parameters

columnSetName (str) – The name assigned to the column set that should be shown.

See

UI4.SceneGraphView.SceneGraphViewColumn.SceneGraphColumn

abstract thaw()

Thaws the clients managed by this SceneGraphView, thereby causing updates sent by Geolib3 to be processed and displayed in the UI.

abstract topLevelLocationRenamed(oldLocationPath, newLocationPath)

Notify the SceneGraphView widget that a top-level location has been renamed. This is intended to be called in response to a UI event, e.g. a node being renamed in the Gaffer UI.

updateTerminalOps(terminalOpArgs, txn=None)

Updates the arguments of a chain of custom terminal Ops that were previously appended to the Op tree.

Parameters
  • terminalOpArgs (tuple of tuple of (str, FnAttribute.GroupAttribute, str)) – A sequence of terminal Op type, Op arguments and terminal op key triplets.

  • txn (FnGeolib.GeolibRuntime.Transaction or None) – The transaction that will be used to set the Op arguments. If no transaction is provided, we create one.

Updates the view link that has been set for this bridge.

ColumnDataType

Module containing the RegisterDataType() function and the ColumnDataType class.

class UI4.Widgets.SceneGraphView.ColumnDataType.ColumnDataType

Bases: object

Simple class encapsulating a number of data types to drive the editing of data in a given column.

Color

alias of UI4.Widgets.SceneGraphView.ItemDelegates.ColorItemDelegate.ColorItemDelegate

Dummy

alias of UI4.Widgets.SceneGraphView.ItemDelegates.BaseItemDelegate.DummyItemDelegate

alias of UI4.Widgets.SceneGraphView.ItemDelegates.LightLinkItemDelegate.LightLinkItemDelegate

Mute

alias of UI4.Widgets.SceneGraphView.ItemDelegates.MuteAndSoloItemDelegates.MuteItemDelegate

Name

alias of UI4.Widgets.SceneGraphView.ItemDelegates.NameItemDelegate.NameItemDelegate

Number

alias of UI4.Widgets.SceneGraphView.ItemDelegates.NumberItemDelegate.NumberItemDelegate

Shader

alias of UI4.Widgets.SceneGraphView.ItemDelegates.ShaderItemDelegate.ShaderItemDelegate

Solo

alias of UI4.Widgets.SceneGraphView.ItemDelegates.MuteAndSoloItemDelegates.SoloItemDelegate

String

alias of UI4.Widgets.SceneGraphView.ItemDelegates.ParameterItemDelegate.ParameterItemDelegate

WorkingSet

alias of UI4.Widgets.SceneGraphView.ItemDelegates.WorkingSetItemDelegate.WorkingSetItemDelegate

UI4.Widgets.SceneGraphView.ColumnDataType.RegisterDataType(dataTypeName, itemDelegateClass)

Registers a data type that can be assigned to a column.

Parameters
  • dataTypeName (str) – A descriptive name by which to refer to the data type.

  • itemDelegateClass (QStyledItemDelegated-derived class) – The item delegate class to use for controlling the appearance and editing behavior of data of the given data type name.

ColumnManager

Module containing the ColumnManager class.

class UI4.Widgets.SceneGraphView.ColumnManager.ColumnManager(columnChangedCallback, columnPresetManager=None)

Bases: object

Class that handles all logic and requests for column configuration for the SceneGraphView widget.

Should be read in conjunction with SceneGraphViewColumn.py.

__init__(columnChangedCallback, columnPresetManager=None)

Initializes an instance of the class.

Parameters
  • columnChangedCallback (callable or None) – A callback to be triggered when the configuration of columns has been changed.

  • columnPresetManager (ColumnPresetManager or None) – A ColumnPresetManager to manage keyboard shortcuts and presets for column sets managed by this class.

Raises

ValueError – If the given callback object is not callable.

addColumn(columnName)
addColumnSet(columnSetName)
applyColumnVisibilitySettings(columnVisibility)
applyColumnWidthsSettings(columnWidths)
getColumnAttributeName(columnIndex, visibleOnly=True)

The SceneGraphTree module requires this special “__location_name__” attribute name to be returned in order to display the location name rather than an attribute name in location name columns.

Return type

str

Parameters
  • columnIndex (int) – The index of the column whose attribute name to return.

  • visibleOnly (bool) – Flag to control whether to skip invisible columns.

Returns

The name of the attribute whose data is to be displayed in the column with the given index.

getColumnAttributeNames(columnIndex, visibleOnly=True)

The SceneGraphTree module requires this special “__location_name__” attribute name to be returned in order to display the location name rather than an attribute name in location name columns.

Return type

list of str

Parameters
  • columnIndex (int) – The index of the column whose attribute name to return.

  • visibleOnly (bool) – Flag to control whether to skip invisible columns.

Returns

A list of names of attributes whose data are to be displayed in the column with the given index.

getColumnByIndex(columnIndex, visibleOnly=True)
getColumnByName(columnName)
getColumnCount(visibleOnly=True)
getColumnTitleText(columnIndex, visibleOnly=True)
getColumnTitles(visibleOnly=True)
getColumnVisibilitySettings()
getColumnWidths(visibleOnly=True)
getColumnWidthsSettings()
getDataType(columnIndex)
Return type

int

Parameters

columnIndex (int) – The index of the column whose data type to return.

Returns

The type of data contained in the column with the given index.

getRootColumnSet()
hideColumnSet(columnSetName)
isEditable(columnIndex, visibleOnly=True)
isLocationNameColumn(columnIndex, visibleOnly=True)
moveColumn(columnIndex, newColumnIndex, visibleOnly=True)
setColumnChangedCallback(callback)
setColumnSetVisible(columnSetName, visible)
showColumnSet(columnSetName)

ColumnPresetManager

Module containing the ColumnPreset and ColumnPresetManager classes.

class UI4.Widgets.SceneGraphView.ColumnPresetManager.ColumnPreset

Bases: object

Class representing a column configuration preset.

__init__()

Initializes an instance of the class.

activate()

Activates the preset by hiding/showing/toggling the registered columns or column sets.

addHidden(columnOrSet)

Adds a column or set which should be hidden when this preset is activated.

Parameters

columnOrSet (BaseSceneGraphColumn) – A column or set which should be hidden in this preset.

addShown(columnOrSet)

Adds a column or set which should be shown when this preset is activated.

Parameters

columnOrSet (BaseSceneGraphColumn) – A column or set which should be shown in this preset.

addToggled(columnOrSet)

Adds a column or set whose visibility state should be toggled when this preset is actived.

Parameters

columnOrSet (BaseSceneGraphColumn) – A column or set whose visibility state should be toggled when this preset is activated.

removeHidden(columnOrSet)

Removes a column or set from the list of items to hide when this preset is activated.

Parameters

columnOrSet (BaseSceneGraphColumn) – A column or set to remove from the list of items to hide when this preset is activated.

removeShown(columnOrSet)

Removes a column or set from the list of items to show when this preset is activated.

Parameters

columnOrSet (BaseSceneGraphColumn) – A column or set to remove from the list of items to show when this preset is activated.

removeToggled(columnOrSet)

Removes a column or set from the list of items whose visibility state should be toggled when this preset is actived.

Parameters

columnOrSet (BaseSceneGraphColumn) – A column or set to remove from the list of items whose visibility state should be toggled when this preset is activated.

class UI4.Widgets.SceneGraphView.ColumnPresetManager.ColumnPresetManager

Bases: object

Class implenting a manager for ColumnPresets. Handles key press events and activates any presets associated with the keys pressed.

class ShortcutMode

Bases: object

Constants used for uniquely identifying different shortcut modes which can be provided to ColumnPresetManager.setShortcutMode(). These define the behaviour of shortcuts that are added through addColumnSetShortcut(), but not addPreset().

Toggle = 1
Unique = 0
classmethod getValidShortcutModes()
Return type

list of int

Returns

A list of valid shortcut mode values.

__init__()

Initializes an instance of the class.

Presets are stored in a dictionary, indexed by the key press value. Each entry in the __presets dictionary is a list of ColumnPreset objects which should be activated for the corresponding key press. Each entry in the __shortcutsForColumnSets dictionary is a list of SceneGraphColumnSet objects which should be shown/hidden for the corresponding key press.

addColumnSetShortcut(columnSet, shortcut)

Adds a new column set to the manager, associated with the given shortcut.

Parameters
  • shortcut (string or None or int or QKeySequence) – A value that can be accepted by the QKeySequence constructor, for use as a keyboard shortcut that will activate the column set.

  • columnSet (SceneGraphColumnSet) – The column set to associate with the shortcut.

addPreset(shortcut)

Adds a new preset to the manager, and returns it.

Return type

ColumnPreset

Parameters

shortcut (string or None or int or QKeySequence) – A value that can be accepted by the QKeySequence constructor, for use as a keyboard shortcut that will activate this preset.

Returns

The new preset.

processKeyPressEvent(event)

Handles a keyPressEvent from a layout containing SceneGraphColumn objects. Checks the list of registered presets and activates any whose shortcut key matches the key pressed.

Return type

bool

Parameters

event (QtGui.QKeyEvent) – The keyPressEvent which we wish to handle.

Returns

True if the given event has been handled, otherwise False.

removeColumnSetShortcut(columnSet, shortcut)

Removes a shortcut for the given column set from the manager.

Parameters
  • columnSet (SceneGraphColumnSet) – The column set to remove from the manager.

  • shortcut (string or None or int or QKeySequence) – A value that can be accepted by the QKeySequence constructor, representing the shortcut to remove.

removeColumnSetShortcuts(columnSet)

Removes all shortcuts for the given column set from the manager.

Parameters

columnSet (SceneGraphColumnSet) – The column set to remove the shortcuts for.

removePreset(preset)

Removes a given preset from the manager.

Parameters

preset (ColumnPreset) – The preset to remove from the manager.

setShortcutMode(shortcutMode)

Sets the shortcut mode used when handling keyboard shortcuts that are added through addColumnSetShortcut(). The valid modes are defined by constants in ColumnPresetManager.ShortcutMode.

Parameters

shortcutMode (int) – The mode to use - must be one of the constants defined by ColumnPresetManager.ShortcutMode

ContextMenuEvent

Module providing the ContextMenuEvent class which encapsulates information related to context menu customization.

class UI4.Widgets.SceneGraphView.ContextMenuEvent.ContextMenuEvent(event, locationPath=None, topLevelLocationPath=None, selectedLocations=None, sceneGraphColumn=None)

Bases: PyQt5.QtGui.QContextMenuEvent

Class that provides information related to the selection state and context at the point in time when a user requests a right-click menu be displayed.

If you make use of the setContextMenuEventCallback() function, your callback will be passed an instance of this class which will be pre-populated with a range of information pertaining to the context in which the right-click menu was requested.

__init__(event, locationPath=None, topLevelLocationPath=None, selectedLocations=None, sceneGraphColumn=None)

Initialize self. See help(type(self)) for accurate signature.

getLocationPath()

Returns the path of the scene graph location under the mouse pointer when this ContextMenuEvent was triggered.

If ContextMenuEvent did not occur over a scene graph location this will return None.

Return type

str or None

Returns

Path of the scene graph location under the mouse pointer.

getSceneGraphColumn()

Returns the column object which refers to the column in which this ContextMenuEvent occurred.

Return type

SceneGraphColumn

Returns

The column object.

getSelectedLocations()

Returns a list of scene graph locations that were selected by the user when this ContextMenuEvent was triggered.

For each selected scene graph location the list contains a 2-tuple of the following form:

(top-level location path: str, location path: str)

Where:

  • top-level location path refers to the top-level scene graph location that the selected scene graph location belongs to.

  • location path refers to the selected scene graph location.

Return type

list of tuple

Returns

List of currently selected scene graph locations and the top-level scene graph locations to which they belong.

getTopLevelLocationPath()

Returns the path of the top-level scene graph location to which the scene graph location returned by getLocationPath() belongs.

If getLocationPath() returns None this function also returns None.

Return type

str or None

Returns

Top-level item’s scene graph location path or None if this event did not occur over a scene graph location.

HorizontalHeaderView

Module containing the HorizontalHeaderView class.

class UI4.Widgets.SceneGraphView.HorizontalHeaderView.HorizontalHeaderView(parent=None)

Bases: PyQt5.QtWidgets.QHeaderView

Class implementing a custom header view for the SceneGraphView widget’s tree widget. Controls resizing behaviour of columns with support for a fixed width, minimum width and maximum width set on item delegates used for the columns in the tree widget.

ClickStyleRole = 258
HeaderTitleIconRole = 260
IsToggledOnFunctionRole = 259
SectionClickableRole = 257
__init__(parent=None)

Initializes an instance of the class.

Parameters

parent (QtWidgets.QWidget) – The parent widget to use for the header view instance, should be an instance of TreeWidget.

contextMenuEvent(contextMenuEvent)

Event handler for context menu events.

Parameters

contextMenuEvent (QtGui.QContextMenuEvent) – An object containing details about the context menu event to process.

enterEvent(event)

Event handler for widget enter events.

Reimplemented in order to paint sections that are clickable in a hovered appearance.

Parameters

event (QtCore.QEvent) – An object containing details about the enter event to process.

leaveEvent(event)

Event handler for widget leave events.

Reimplemented in order to paint sections that are clickable and that had been painted in a hovered appearance in a normal appearance again.

Parameters

event (QtCore.QEvent) – An object containing details about the leave event to process.

mouseDoubleClickEvent(mouseEvent)

Event handler for mouse double-click events.

Reimplemented in order to call a specialized function of the tree widget parent to resize a column to its contents if its section handle has been double-clicked, bypassing the default behavior.

Parameters

mouseEvent (QtGui.QMouseEvent) – An object containing details about the mouse event to process.

mouseMoveEvent(mouseEvent)

Event handler for mouse move events.

Reimplemented in order to change the cursor shape when the pointer is over a section handle of a column that cannot be resized.

Parameters

mouseEvent (QtGui.QMouseEvent) – An object containing details about the mouse event to process.

mousePressEvent(mouseEvent)

Event handler for mouse press events.

Reimplemented in order to support clickable sections without making the entire header view clickable. Whether or not sections are clickable is determined by user data stored in the header view’s model. The function emits the "sectionPressed" signal if a clickable section has been clicked with the left button.

Parameters

mouseEvent (QtGui.QMouseEvent) – An object containing details about the mouse press event to process.

mouseReleaseEvent(mouseEvent)

Event handler for mouse release events.

Reimplemented in order to cause a re-draw of the title that was previously clicked.

Parameters

mouseEvent (QtGui.QMouseEvent) – An object containing details about the mouse release event to process.

paintSection(painter, rect, logicalIndex)

Paints the section specified by the given logical index, using the given painter and rectangle.

Parameters
  • painter (QtGui.QPainter) – The painter to use for drawing the section.

  • rect (QtCore.QRect) – The rectangular area of the section to draw.

  • logicalIndex (int) – The index of the section to draw.

resizeSection(logicalIndex, size)

Resizes the section specified by logicalIndex to size measured in pixels.

Reimplemented to respect item delegate column width constraints.

Parameters
  • logicalIndex (int) – Logical index of column to be resized

  • size (int) – New size

SceneGraphLocationTranslation

Module providing utility functions for working with paths of scene graph locations.

UI4.Widgets.SceneGraphView.SceneGraphLocationTranslation.GetParentPath(locationPath, topLevelLocationPath='/root')

Returns the parent scene graph location of the given locationPath.

If the path represents the root of the scene, then None is returned.

UI4.Widgets.SceneGraphView.SceneGraphLocationTranslation.GetLocationName(locationPath)

Extracts the location name from the given location path.

E.g.:

/root -> root
/root/world/geo -> geo
UI4.Widgets.SceneGraphView.SceneGraphLocationTranslation.IsLocationUnderTopLevelLocation(locationPath, topLevelLocationPath)

Returns True if locationPath exists under topLevelLocationPath, otherwise returns False.

E.g.:

/root/world/geo, /root -> True
/root/world/light, /root/world -> True
/root/world_1/geo, /root/world -> False
/root/world/geo_scalar/geo, /root/world/geo -> False
/root/world/geo/arm/hand, /root/world/geo -> True
UI4.Widgets.SceneGraphView.SceneGraphLocationTranslation.ExplodePath(locationPath)

Explodes the scene graph location path into a list of all its child locations including itself.

E.g.:

/root/world/cam -> ['/root', '/root/world', '/root/world/cam']

SceneGraphTree

Module providing the SceneGraphTree class.

class UI4.Widgets.SceneGraphView.SceneGraphTree.SceneGraphTree

Bases: object

Encapsulates a raw locations and attributes view of the scene graph that is currently being displayed by the SceneGraphView.

It is made up of TreeItem objects which each represent a single location in the scene graph. There is a single root location in the scene graph which has the location path /root. A TreeItem also contains attribute data which can be interrogated.

A TreeItem has one or more children of type TreeItem. They can be efficiently accessed in O(1) time by name or index. The index ordering is strict and defined by the scene graph processing commands that created it, this can be determined by the potential children list.

Provides an interface to the Bridge which provides efficient access to TreeItem objects.

__init__()

Initializes an instance of the class.

addOrUpdateSceneGraphLocation(locationPath, locationData)

Creates a new scene graph tree item to represent the scene graph location with the given path, and stores the given location data on it.

If the location already exists, this function updates the location data on the existing tree item.

Return type

TreeItem

Parameters
  • locationPath (str) – The path of the scene graph location for which to create or update a scene graph tree item.

  • locationData (PyFnGeolib.LocationData) – An object that contains the data to store for the scene graph location represented by the tree item to create or update.

Returns

The created or updated scene graph tree item.

clear()

Deletes all tree items in this SceneGraphTree instance.

deleteSceneGraphLocation(locationPath)

Delete the TreeItem specified by locationPath.

If locationPath refers to a TreeItem which does not exist, or has child tree items, this function will throw an error.

getTreeItem(locationPath)
Return type

TreeItem

Parameters

locationPath (str) – The path of the scene graph location for which to return the corresponding scene graph tree item.

Returns

The tree item that represents the scene graph location with the given path.

Raises

SceneGraphTreeException – If no tree item exists that corresponds to the given scene graph location path.

hasLocation(locationPath)
Return type

bool

Parameters

locationPath (str) – The path of the scene graph location for which to check whether a corresponding scene graph tree item exists.

Returns

True if there is a tree item that corresponds to the given location path, otherwise False.

exception UI4.Widgets.SceneGraphView.SceneGraphTree.SceneGraphTreeException

Bases: Exception

Exception thrown when attempting invalid tree operations.

class UI4.Widgets.SceneGraphView.SceneGraphTree.TreeItem(locationPath, locationData, parentTreeItem)

Bases: object

Is used by the SceneGraphTree to store scene graph locations and their attributes.

Provides a number of functions by which its children and location within the SceneGraphTree topology can be interrogated.

__init__(locationPath, locationData, parentTreeItem)

Initializes an instance of the class.

Parameters
  • locationPath (str) – The path of the scene graph location to represent by this tree item instance.

  • locationData (PyFnGeolib.LocationData) – Data to store in the tree item instance.

  • parentTreeItem (TreeItem or None) – The tree item to use as the parent of this tree item instance, or None if this tree item instance is to be considered the root of a scene graph tree.

addChild(childTreeItem)

Add the specified child TreeItem to children of this TreeItem.

deleteChild(childTreeItem)

Delete the specified child TreeItem from the location’s list of children

getAttributeData(attributeName, returnResolvedData=True)
Return type

str or float or int or list or None

Parameters
  • attributeName (str) – The name of the attribute whose data to return.

  • returnResolvedData (bool) – Flag to control whether to return the data of the resolved attribute if the name of a meta attribute is given. For example, attributeName could be material.meta.intensity, which could contain the name of an actual attribute, such as material.prmanLightParams.Intensity. If returnResolvedData is True, the I{data} of the actual attribute is returned. If it is False, the I{name} of the actual attribute is returned.

Returns

The data of the attribute with the given name, or None if no data for the attribute with the given name is available.

getAttributes()
Return type

PyFnAttribute.Attribute

Returns

The scene graph attributes stored at the location represented by this tree item instance.

getChildByName(locationName)
Return type

TreeItem

Parameters

locationName (str) – The name of the scene graph location whose corresponding tree item to return.

Returns

The child tree item with the given location name.

Note

The cost of this operation is O(1)

Raises

SceneGraphTreeException – If the given location name does not correspond to a child tree item of this tree item instance.

getChildBySceneGraphIndex(sceneGraphIndex)

Return the TreeItem at the specified scene graph index.

If the location name is not a child of this TreeItem then a SceneGraphTreeException will be thrown.

getChildItems()
Return type

list of TreeItem

Returns

A list of all child tree items of this tree item.

getChildNames()
Return type

list of str

Returns

A list of names of child tree items of this tree item.

getLocationData()
Return type

PyFnGeolib.LocationData

Returns

An object that contains the data stored for the scene graph location represented by this tree item instance. Can be used to test the data’s hash against new updates.

getLocationName()
Return type

str

Returns

The leaf-level location of this tree item, for example geo for /root/world/geo, and root for /root.

getLocationPath()
Return type

str

Returns

The path of the scene graph location represented by this tree item instance.

getLocationType()
Return type

str or None

Returns

The name of the type attribute of the scene graph location represented by this tree item instance, or None if the location type is not available.

getNumberOfChildren()
Return type

int

Returns

The number of child locations under the scene graph location represented by this tree item instance.

getParent()
Return type

TreeItem or None

Returns

The parent tree item of this tree item instance, or None if this tree item instance represents the root of the scene graph tree.

getPotentialChildren()
Return type

list

Returns

A list of potential children of this tree item instance. The ordering of the returned list defines the order in which they should appear.

getSceneGraphIndexInParent()

Return the scene graph index of this TreeItem in its parent.

If this is the root of the SceneGraph then the scene graph index is 0

getSceneGraphIndexOfChildTreeItem(childTreeItem)

Return the scene graph index of the child TreeItem.

If childTreeItem is not a child of this TreeItem then a SceneGraphTreeException will be thrown.

getSceneGraphIndexOfLocationName(locationName)

Returns the scene graph index of the specified location name.

If the location name is not a child of this TreeItem then a SceneGraphTreeException will be thrown.

updateLocationData(locationData)

Updates the location data for this TreeItem and also regenerates any internal data structures.

Parameters

locationData (PyFnGeolib.LocationData) – An object that contains the data to store for the scene graph location represented by this tree item instance.

SceneGraphViewClientManager

Module containing the SceneGraphViewClientManager class.

class UI4.Widgets.SceneGraphView.SceneGraphViewClientManager.SceneGraphViewClientManager

Bases: UI4.Util.ClientManager.ClientManager

Class responsible for managing Geolib3 clients for the SceneGraphView widget.

One client is created per top-level location in the widget.

__init__()

Initialize self. See help(type(self)) for accurate signature.

topLevelLocationAdded(topLevelLocation)

Informs ClientManager that there is a new top-level location.

Parameters

topLevelLocation (str) – The top-level location being added.

topLevelLocationRemoved(topLevelLocation)

Informs ClientManager that a top-level location has been removed

Parameters

topLevelLocation (str) – The top-level location being removed.

SceneGraphViewColumn

Module providing the SceneGraphColumn, SceneGraphColumnSet and SceneGraphColumnTitle classes.

UI4.Widgets.SceneGraphView.SceneGraphViewColumn.GetNonInformationalAttributeName(attributeNames)
Return type

str or None

Parameters

attributeNames (list of str) – A list of names of attributes to filter.

Returns

The name of the first attribute that doesn’t store data for informational purposes only, or the name of the first attribute if all attribute names indicate informational purposes, or None if the given list of attribute names is empty.

class UI4.Widgets.SceneGraphView.SceneGraphViewColumn.BaseSceneGraphColumn(name='Untitled', columnChangedCallback=None, parentSet=None)

Bases: object

A base class for columns and column sets.

A column or column set may live inside a parent column set, or may stand alone.

__init__(name='Untitled', columnChangedCallback=None, parentSet=None)

Initializes an instance of the class.

Parameters
  • name (str) – The name to use for the column object.

  • columnChangedCallback (callable or None) – A callback to be triggered when the configuration of columns has been changed. This includes changes to visibility state.

  • parentSet (SceneGraphColumnSet or None) – The set to which this new instance should be added, or None if the column object is a stand-alone column or column set.

callColumnChangedCallback()

Tries to execute the callback that is set to be triggered when the configuration of columns has been changed, and logs an error if an exception occurs.

Does nothing if no such callback has been set.

getColumnChangedCallback()
Return type

callable or None

Returns

The callback to be triggered when the configuration of columns has been changed, or None if no such callback has been set.

Note

The callback is also called when the visibility state of the column or column set has been changed.

getIndex()
Return type

int

Returns

The index of this instance within its parent set, or -1 if the instance does not have a parent set.

getName()
Return type

str

Returns

The name of this column object.

getParentSet()
Return type

SceneGraphColumnSet or None

Returns

The column set that contains the column or column set represented by this instance, or None if the column is not part of a column set.

getParentSetNames()
Return type

list of str

Returns

A list of the names of all this column object’s ancestors.

getParentSets()
Return type

list of SceneGraphColumnSet

Returns

A list of all this column object’s ancestors.

isVisible()
Return type

bool

Returns

The visibility of the column or column set represented by this instance.

setColumnChangedCallback(callback)

Sets the callback that is to be triggered when the configuration of columns has been changed. This includes the visibility state of columns.

Parameters

callback (callable or None) – The callback to be triggered when the configuration of columns has been changed.

Raises

ValueError – If the given callback object is not callable.

setIndex(index)

Sets the index of this column object within its parent set to the given index.

Parameters

index (int) – The index to set for this column object within its parent set.

setName(name)

Sets the name of this column object to the given name.

Parameters

name (str) – The name to set for this column object.

setParentSet(parentSet)

Sets the parent of this column object to the given column set.

Parameters

parentSet (SceneGraphColumnSet or None) – The parent set to set for this column object, or None to make this column object a stand-alone column or column set.

setVisible(visible)

Sets the visibility of the column or column set represented by this instance to the given visibility.

Parameters

visible (bool) – The visibility to set for the column or column set represented by this instance.

class UI4.Widgets.SceneGraphView.SceneGraphViewColumn.SceneGraphColumn(columnName='Untitled', columnChangedCallback=None, parentSet=None)

Bases: UI4.Widgets.SceneGraphView.SceneGraphViewColumn.BaseSceneGraphColumn

A SceneGraphColumn represents a single column in a SceneGraphView.

__init__(columnName='Untitled', columnChangedCallback=None, parentSet=None)

Initializes an instance of the class.

Parameters
  • columnName (str) – The name of the new column.

  • columnChangedCallback (callable) – A function to be called when the configuration of columns changes. This includes changes to visibility state.

  • parentSet (SceneGraphColumnSet) – The set to which this new column should be added.

getAttributeName()
Return type

str or None

Returns

The attribute name associated with this column, or None if no attribute name is set for this column.

getAttributeNames()
Return type

list of str

Returns

The attribute names associated with this column.

classmethod getColorDisplayTypeName()
Return type

str

Returns

The data type name for color data.

See

getSupportedDisplayTypes()

getDataType()
Return type

int

Returns

The type of data that the column represents.

classmethod getDefaultDisplayTypeIndex()
Return type

int

Returns

The index of the supported default display type.

See

getSupportedDisplayTypes()

classmethod getDefaultDisplayTypeName()
Return type

str

Returns

The name of the default display type to associate with a column.

See

getSupportedDisplayTypes()

getFixedWidth()
Return type

int or None

Returns

The fixed width of the column in pixels, or None if no fixed width has been set for the column.

getLookFileMaterialAssignmentCallback()
Return type

callable or None

Returns

The callback that is used for assigning a Look File Material to a package.

getMasterMaterialCallbacks()
Deprecated

This function is deprecated. Please use getTemplateMaterialCallbacks() instead.

getMaximumWidth()
Return type

int or None

Returns

The maximum width of the column in pixels, or None if no maximum width has been set for the column.

getMinimumWidth()
Return type

int or None

Returns

The minimum width of the column in pixels, or None if no minimum width has been set for the column.

getProperties()
Return type

list of tuple of (str, object)

Returns

The list of (propertyName, propertyValue) tuples that are currently assigned to the column.

classmethod getSupportedDisplayTypes()
Return type

list of str

Returns

A list of supported column display type names. These data type names are used to differentiate between different widgets that should be displayed for a scene graph column.

getTemplateMaterialCallbacks()
Return type

tuple of callable or None

Returns

A tuple of callbacks to use for obtaining a list of paths of scene graph locations that represent Template Materials and for assigning a Template Material to a light.

getTitle()
Return type

SceneGraphColumnTitle

Returns

The title object for this column.

getTitleClickStyle()
Return type

str

Returns

The style in which the title behaves in response to click events.

getTitleClickedCallback()
Return type

callable or None

Returns

A callback that is to be triggered when the header of this column is clicked, or None if no such callback has been set for this column.

getTitleIcon()
Return type

QtGui.QIcon or None

Returns

The icon to display on the column title, if one is set.

getTitleIconName()
Return type

str

Returns

The name of the icon used for the title of this column.

Note

The title icon may or may not be displayed in the header for the column, depending on its title style.

getTitleStyle()
Return type

str

Returns

The title style for the column. Will be one of SceneGraphColumnTitle.TextOnly, IconOnly or TextAndIcon.

getTitleText()
Return type

str

Returns

The title text for the column.

Note

The title text may or may not be displayed in the header for the column, depending on its title style.

getTitleToolTip()
Return type

str

Returns

The tooltip text to display for the title.

getWidth()
Return type

int

Returns

The width of the column in pixels. This is -1 by default, indicating no preference for the width of the column.

isEditable()
Return type

bool

Returns

The editable state of the column.

isLocationName()
Return type

bool

Returns

True if this column is intended for displaying location names, otherwise False.

isTitleToggledOn()
Return type

bool

Returns

Whether the title is turned on or off. This is only valid if the title’s ClickStyle is Toggle (see setTitleClickStyle()).

isValueComparisonEnabled()
Return type

bool

Returns

True if the value of a parameter that corresponds to a cell in the column for which the item delegate instance is used is to be compared to the value of the corresponding attribute in the scene that is produced at the currently viewed node, or False if not.

See

setValueComparisonEnabled()

setAttributeName(attributeName, callCallback=True)

Sets the attribute name associated with this column.

Parameters
  • attributeName (str) – The attribute name to set for this column.

  • callCallback (bool) – An optional flag (default: True) indicating whether the column changed callback should be called if the given attribute name is different to the currently set attribute name for this column.

setAttributeNames(*attributeNames, **kwargs)

Sets the attribute names associated with this column.

Specifying callCallback=False as a keyword argument will prevent the column changed callback from being called.

Parameters

attributeNames (list of str) – The attribute names to set for this column.

setDataType(dataType)

Sets the type of data that the column represents to the given column data type.

Parameters

dataType (cls) – The type of data that the column is to represent.

setEditable(editable)

Sets the editable state of this column to the given editable state.

Parameters

editable (bool) – The editable state to set for the column.

setFixedWidth(fixedWidth)

Sets or resets the fixed width used for the column.

Parameters

fixedWidth (int or None) – The fixed width to use for the column, or None to reset the fixed width.

setIsLocationName(isLocationName)

Sets whether this column is intended for displaying location names.

Parameters

isLocationName (bool) – True if this column is intended for displaying location names, otherwise False.

setLookFileMaterialCallback(lookFileMaterialAssignmentCallback)

Sets the callback used to assign a Look File Material to a given package.

Parameters

lookFileMaterialAssignmentCallback (callable or None) – The callback to use when assigning a Look File Material to a package.

Raises

ValueError – If the given callback object is not callable.

setMasterMaterialCallbacks(masterMaterialsRequestCallback, masterMaterialAssignmentCallback)
Deprecated

This function is deprecated. Please use setTemplateMaterialCallbacks() instead.

setMaximumWidth(maximumWidth)

Sets or resets the maximum width used for the column.

Parameters

maximumWidth (int or None) – The maximum width to use for the column, or None to reset the maximum width.

setMinimumWidth(minimumWidth)

Sets or resets the minimum width used for the column.

Parameters

minimumWidth (int or None) – The minimum width to use for the column, or None to reset the minimum width.

setProperty(propertyName, propertyValue)

Sets the column property with the given name to the given value.

Parameters
  • propertyName (str) – The name of the column property to set.

  • propertyValue (object or None) – The value to set for the column property.

Raises
  • RuntimeError – When an attempt is made to set a property when the data type of the column has not been set.

  • ValueError – When the column’s data type doesn’t declare the name of the property valid.

setTemplateMaterialCallbacks(templateMaterialsRequestCallback, templateMaterialAssignmentCallback)

Sets the callbacks to use for obtaining a list of paths of scene graph locations that represent Template Materials and for assigning a Template Material to a light to the given callbacks.

Parameters
  • templateMaterialsRequestCallback (callable or None) – The callback to use for obtaining a list of paths of Template Material scene graph locations.

  • templateMaterialAssignmentCallback (callable or None) – The callback to use for assigning a Template Material to a light.

Raises

ValueError – If one of the given callback objects is not callable.

setTitleClickStyle(titleClickStyle)
Parameters

titleClickStyle (str) – The style in which the title behaves in response to click events. Must be one of SceneGraphColumnTitle.ClickStyles.MenuIndicator or SceneGraphColumnTitle.ClickStyles.Toggle. By default it is MenuIndicator.

setTitleClickedCallback(callback)

Sets a callback to be triggered when the title of this column is clicked.

Parameters

callback (callable or None) – The callback to be triggered when the header of the column is clicked, or None to reset the callback.

Raises

ValueError – If the given callback object is not callable.

setTitleIcon(icon)
Parameters

icon (QtGui.QIcon or None) – The icon to show in the column title, or None if no icon is to be shown.

setTitleIconName(titleIconName)

Sets the name of the icon to use for the title of this column to the given title icon name.

For convenience, also sets the title style to TextAndIcon if it is currently set to TextOnly. If you would like only the icon to be shown, set the title style to IconOnly using setTitleStyle().

Parameters

titleIconName (str) – The name of the title icon to use for the column.

Note

The title icon may or may not be displayed in the header for the column, depending on its title style.

setTitleStyle(titleStyle)

Sets the title style for this column to the given title style.

Parameters

titleStyle (str) – The new title style for the column. Must be one of SceneGraphColumnTitle.TextOnly, IconOnly or TextAndIcon.

setTitleText(titleText)

Sets the title text for this column to the given title text.

Parameters

titleText (str) – The new title text for the column.

Note

The title text may or may not be displayed in the header for the column, depending on its title style.

setTitleToggledOn(titleToggledOn)
Parameters

titleToggledOn (bool) – Whether the title is turned on or off.

setTitleToolTip(toolTip)

Sets the tooltip text to display for the title.

Parameters

toolTip (str) – The tooltip text to display for the title.

setValueComparisonEnabled(valueComparisonEnabled)

Sets the flag that controls whether the item delegate instance is to check if the value of a parameter that corresponds to a cell in the column for which the instance is used matches the value of the corresponding attribute in the scene that is produced at the currently viewed node. Item delegate classes can evaluate the flag in initStyleOption() functions to determine whether to alter the appearance and editing behaviour of cells for which the values differ.

Parameters

valueComparisonEnabled (bool) – The flag value.

setWidth(width)
Parameters

width (int) – The desired width of the column in pixels. This is -1 by default, indicating no preference for the width of the column.

titleClicked(columnTitleRect)

Called when the title of this column is clicked by the user.

Parameters

columnTitleRect (QtCore.QRect) – The global screen position and size of the column title that was clicked.

class UI4.Widgets.SceneGraphView.SceneGraphViewColumn.SceneGraphColumnSet(setName='Untitled', columnChangedCallback=None, parentSet=None, columnPresetManager=None)

Bases: UI4.Widgets.SceneGraphView.SceneGraphViewColumn.BaseSceneGraphColumn

A SceneGraphColumnSet contains an ordered list of columns or sets of columns.

__init__(setName='Untitled', columnChangedCallback=None, parentSet=None, columnPresetManager=None)

Initializes an instance of the class.

Parameters
  • setName (str) – The name of the new set.

  • columnChangedCallback (callable) – A function to be called when the configuration of columns changes. This includes changes to visibility state.

  • parentSet (SceneGraphColumnSet) – The set to which this new set should be added.

  • columnPresetManager (ColumnPresetManager or None) – A ColumnPresetManager to manage keyboard shortcuts and presets for this column set, and any of its children.

addChild(child, resetParentSet=True)

Adds the given child object to this set.

Parameters

child (BaseSceneGraphColumn) – The child object which we wish to add to this set.

addColumn(columnName)

Adds a new column to this set.

Return type

SceneGraphColumn

Parameters

columnName (str) – The new name of the column.

Returns

The newly created column object.

addColumnSet(setName='Untitled')

Adds a new column set to this set.

Return type

SceneGraphColumnSet

Parameters

setName (str) – The new name of the column.

Returns

The newly created column set object.

addKeyboardShortcut(shortcut)

Associates a keyboard shortcut with this column set. Depending on the ColumnPresetManager’s shortcut ‘mode’, when this key is pressed, the visibility state of this and other column sets will be altered.

Parameters

shortcut (string or None or int or QKeySequence) – A value that can be accepted by the QKeySequence constructor, for use as a keyboard shortcut that will modify the visibility of this column set.

applyColumnVisibilitySettings(columnVisibilitySettings)
Parameters

columnVisibilitySettings (dict) – A dictionary containing visibility settings this set and its child columns and column sets, indexed by name. This is used when loading a layout to restore the columns and column sets that were visible when the Tab layout was saved.

clearChildren()

Removes all child objects from this set.

getAttributeName(columnIndex, visibleOnly=True)
Return type

str or None

Parameters
  • columnIndex (int) – The index of the column whose attribute name to return.

  • visibleOnly (bool) – Flag that controls whether to only consider columns that are visible.

Returns

The name of an attribute whose value to show in the column with the given index, or None if the given index is out of range.

getAttributeNames(columnIndex, visibleOnly=True)
Return type

list of str

Parameters
  • columnIndex (int) – The index of the column whose attribute names to return.

  • visibleOnly (bool) – Flag that controls whether to only consider columns that are visible.

Returns

The names of attributes whose values to show in the column with the given index, or None if the given index is out of range.

getChildByName(childName)

Recursively searches the hierarchy in this column set for the first column or column set of the given name.

Return type

SceneGraphColumn, SceneGraphColumnSet or None

Parameters

childName (str) – The name of the column or column set to return.

Returns

The first column or column set with the given name, or None if no column or column set by that name is found.

getChildIndex(child)
Return type

int

Parameters

child (BaseSceneGraphColumn) – The child object whose index in this set we wish to get.

Returns

The index of the specified child within this set, or -1 if the child is not found.

getColumnByIndex(columnIndex, visibleOnly=True)

Return the column which would appear nth in the flattened list of all the columns in this set (which may include other sets).

If visibleOnly is True, then columns and column sets with their visibility state set to False are ignored and not included in the indexing.

Return type

BaseSceneGraphColumn

Parameters
  • columnIndex (int) – The index in the flattened list of columns in the set of the column which we will return

  • visibleOnly (bool) – Flag that controls whether to only consider columns that are visible.

Returns

The column found at the requested index, or None if the given index is out of range.

getColumnByName(columnName)

Recursively searches the hierarchy in this column set for the first column of the given name.

Return type

BaseSceneGraphColumn or None

Parameters

columnName (str) – The name of the column we will search for in the hierarchy under this set.

Returns

The first column with the specified name, or None if no column by that name is found.

getColumnCount(visibleOnly=True)
Return type

int

Parameters

visibleOnly (bool) – Flag that controls whether to only consider columns that are visible.

Returns

The total number of (visible) columns in this set and any nested sets.

getColumnSetByName(columnSetName)

Recursively searches the hierarchy in this column set for the first column set of the given name.

Return type

SceneGraphColumnSet or None

Parameters

columnSetName (str) – The name of the column set to return.

Returns

The first column set with the given name, or None if no column set by that name is found.

getColumnVisibilitySettings()
Return type

dict

Returns

A dictionary containing the visibility settings for all the columns and column sets in this column set, indexed by name. This is used to save the visible columns and column sets when saving the Tab layout.

getColumns(visibleOnly=True)
Return type

list of BaseSceneGraphColumn

Parameters

visibleOnly (bool) – Flag that controls whether to only consider columns that are visible.

Returns

A flattened list of all the columns in this set.

getDataType(columnIndex, visibleOnly=True)
Return type

int or None

Parameters
  • columnIndex (int) – The index of the column whose data type to return.

  • visibleOnly (bool) – Flag that controls whether to only consider columns that are visible.

Returns

The type of data that the column with the given index represents, or None if the given index is out of range.

getNames(visibleOnly=True)
Return type

list of str

Parameters

visibleOnly (bool) – Flag that controls whether to only consider columns that are visible.

Returns

A flattened list of all names of the columns in the hierarchy under this column set.

getTitleText(columnIndex, visibleOnly=True)
Return type

str or None

Parameters
  • columnIndex (int) – The index of the column whose title text to return.

  • visibleOnly (bool) – Flag that controls whether to only consider columns that are visible.

Returns

The title text for the column with the given index, or None if the given index is out of range.

getTitles(visibleOnly=True)
Return type

list of SceneGraphColumnTitle

Parameters

visibleOnly (bool) – Flag that controls whether to only consider columns that are visible.

Returns

A flattened list of all title objects for the columns in the hierarchy under this column set.

getWidth(columnIndex, visibleOnly=True)
Return type

int or None

Parameters
  • columnIndex (int) – The index of the column whose width to return.

  • visibleOnly (bool) – Flag that controls whether to only consider columns that are visible.

Returns

The width in pixels for the column with the given index, or None if the given index is out of range.

getWidths(visibleOnly=True)
Return type

list of int

Parameters

visibleOnly (bool) – Flag that controls whether to only consider columns that are visible.

Returns

A flattened list of all column widths for the columns in the hierarchy under this column set.

isEditable(columnIndex, visibleOnly=True)
Return type

bool or None

Parameters
  • columnIndex (int) – The index of the column whose editable state will returned.

  • visibleOnly (bool) – Flag that controls whether to only consider columns that are visible.

Returns

True if the column with the given index is editable, False if not, or None if the given index is out of range.

isLocationNameColumn(columnIndex, visibleOnly=True)
Return type

bool or None

Parameters
  • columnIndex (int) – The index of the column which we wish to interrogate.

  • visibleOnly (bool) – Should we only count visible columns in the indexing?

Returns

True if the column with the given index is a location name column, False if not, or None if the given index is out of range.

removeChild(child, resetParentSet=True)

Removes the given child object from this set.

Parameters

child (BaseSceneGraphColumn) – The child object which we wish to remove from this set.

removeKeyboardShortcut(shortcut)

Removes a keyboard shortcut that was previously associated with this column set.

Parameters

shortcut (string or None or int or QKeySequence) – A value that can be accepted by the QKeySequence constructor, representing the keyboard shortcut to remove the association for.

removeKeyboardShortcuts()

Removes all keyboard shortcuts that were previously associated with this column set.

setChildIndex(child, index)

Sets the index of the specified child within this set. Logs a warning if the given child is not found.

Parameters
  • child (BaseSceneGraphColumn) – The child object whose index in this set we wish to set.

  • index (int) – The index we wish to give to the specified child.

setColumnChangedCallback(callback)

Sets the callback that is to be triggered when the configuration of columns has been changed. This includes the visibility state of columns.

Parameters

callback (callable or None) – The callback to be triggered when the configuration of columns has been changed.

class UI4.Widgets.SceneGraphView.SceneGraphViewColumn.SceneGraphColumnTitle(text, iconName, style)

Bases: object

Class to describe the header for a column in the SceneGraphView widget.

class ClickStyles

Bases: object

Enumeration of possible values for the style of click behaviour.

All = ['menuIndicator', 'toggle']
MenuIndicator = 'menuIndicator'
Toggle = 'toggle'
DisplayStyles = ['textOnly', 'iconOnly', 'textAndIcon']
IconOnly = 'iconOnly'
TextAndIcon = 'textAndIcon'
TextOnly = 'textOnly'
__init__(text, iconName, style)

Initializes an instance of the class.

Parameters
  • text (str) – The text to display in the header.

  • iconName (str) – The name of an icon to display in the header. Mapped to an icon file by the SceneGraphViewIconManager.

  • style (str) – Whether to show text, an icon, or both in the header.

callClickedCallback(columnTitleRect)

Calls a registered callback that is to be triggered when the column title is clicked.

Parameters

columnTitleRect (QtCore.QRect) – The global screen position and size of the column title that was clicked.

getClickStyle()
Return type

str

Returns

A SceneGraphColumnTitle.ClickStyles attribute that represents the style in which to behave in response to click events.

getClickedCallback()
Return type

callable or None

Returns

A callback that is to be triggered when the header of this column is clicked, or None if no such callback has been set for this column.

getIcon()
Return type

QtGui.QIcon or None

Returns

The icon to be shown in the column title, or None if no icon has been set.

getIconName()
Return type

str

Returns

The name of the icon to display, taking into account the display style.

getStyle()
Return type

str

Returns

The style in which to display the header.

getText()
Return type

str

Returns

The text to display, taking into account the display style.

getToolTip()
Return type

str

Returns

The tooltip text to display.

isToggledOn()
Return type

bool

Returns

Whether the title is turned on or off. This is only valid if the title’s ClickStyle is Toggle (see setClickStyle()).

setClickStyle(clickStyle)
Parameters

clickStyle (str) – The style in which to behave in response to click events. Must be one of SceneGraphColumnTitle.ClickStyles.MenuIndicator or SceneGraphColumnTitle.ClickStyles.Toggle.

setClickedCallback(callback)

Sets a callback to be triggered when the column title is clicked.

Parameters

callback (callable or None) – The callback to be triggered when the header of the column is clicked, or None to reset the callback.

Raises

ValueError – If the given callback object is not callable.

setIcon(icon)

Sets the icon to use for the column title to the given icon.

Parameters

icon (QtGui.QIcon or None) – The icon to show in the column title, or None if no icon is to be shown.

Raises

TypeError – If icon is neither None nor a QtGui.QIcon.

setIconName(iconName)

Sets the name of the icon to display to the given icon name.

Parameters

iconName (str) – The name of the icon to display.

setStyle(style)
Parameters

style (str) – The style in which to display the header. Must be one of SceneGraphColumnTitle.TextOnly, SceneGraphColumnTitle.IconOnly or SceneGraphColumnTitle.TextAndIcon.

setText(text)

Sets the text to display.

Parameters

text (str) – The text to display.

setToggledOn(toggledOn)
Parameters

toggledOn (bool) – Whether the title is turned on or off.

setToolTip(toolTip)

Sets the tooltip text to display.

Parameters

toolTip (str) – The tooltip text to display.

setUpdateFunction(updateFunction, *args)

Sets an update function and any arguments that can be used to cause a redraw of the column title.

Parameters
  • updateFunction (callable or None) – An update function.

  • args (list) – Any arguments to be passed to the update function when it is run.