Workspace 6.21.5
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | List of all members
SceneItemType Class Referenceabstract

An abstract base class for the types of scene items or 'nodes' that make up the scene interaction tree. More...

#include <Rendering/SceneInteraction/sceneitemtype.h>

Inheritance diagram for SceneItemType:
[legend]

Public Types

enum  Category {
  AllCategories , Scene , SceneItem , MeshData ,
  Shader , Glypher , Texture , Overlay ,
  LastCategory = 999
}
 
enum  Flags { UserCanAdd = (1 << 0) , UserCanRemove = (1 << 1) , UserCanFocus = (1 << 2) }
 
using SceneInteractionWidgetItemList = QVector< SceneInteractionWidgetItem * >
 

Public Member Functions

virtual ~SceneItemType ()=default
 
virtual DataExecution::OperationaddSingleItemToScene (DataExecution::Workspace &root, const QString &sceneIdPath) const
 
virtual DataExecution::OperationaddToScene (DataExecution::Workspace &root, const QString &sceneIdPath) const =0
 
virtual bool allowMultipleConnection (QString inputName) const
 
virtual SceneInteractionWidgetItemcreateSceneInteractionWidgetItem (QTreeWidgetItem *parent, const QStringList &text, DataExecution::Operation &op) const
 
virtual SceneInteractionWidgetItemList createSceneInteractionWidgetItems (QTreeWidgetItem *parent, const QStringList &text, DataExecution::Operation &op) const
 
virtual unsigned int getFlags () const
 
virtual QString getIcon () const =0
 
virtual DataExecution::InputgetInput (DataExecution::Operation &primaryOperation, const QString &inputName) const
 
virtual QStringList getInputNameForType (unsigned int category) const
 
virtual QString getMenuPath () const
 
virtual QString getName () const =0
 
virtual QString getOperationKey () const =0
 
virtual unsigned int getOutputType () const
 
virtual QString getSceneItemOutputName () const =0
 
virtual QString getTooltipForWrongPositionInTree (const SceneInteractionWidgetItem *currentlySelectedItem) const
 
virtual bool isValidUnderTreeItem (const SceneInteractionWidgetItem *currentlySelectedItem) const
 
virtual void labelChanged (DataExecution::Workspace &root, const QString &sceneIdPath) const
 
virtual DataExecution::OperationpromptAndAddToScene (DataExecution::Workspace &root, const QString &sceneIdPath) const
 
virtual void removeFromScene (DataExecution::Workspace &root, const QString &sceneIdPath) const
 
virtual void sceneItemTypeAdded (const SceneItemType &typeJustAddedToWorkflow, DataExecution::Operation *primaryOperationJustAdded, DataExecution::Workspace &rootWorkspace, const QString &parentIdPath) const
 
virtual void sceneItemTypeRemoved (const SceneItemType &typeJustRemovedFromWorkflow, const SceneInteractionWidgetItem &treeItemRemoved, DataExecution::Operation *primaryOperationJustAdded, DataExecution::Workspace &rootWorkspace, const QString &parentIdPath) const
 Corresponding remove method.
 

Static Public Member Functions

static void repositionOperation (DataExecution::Operation &op, DataExecution::Operation &anchor, QUndoStack &undoStack)
 ‍**
 
template<typename T >
static void setOperationInput (DataExecution::Operation &op, const QString &name, const T &value)
 

Protected Member Functions

 SceneItemType ()=default
 
DataExecution::OperationaddExternalWorkspace (DataExecution::Workspace &rootWorkspace, const QString &workspaceUrl, const QString &opOutputStr, const QString &destOpIdPath) const
 
DataExecution::OperationaddExternalWorkspace (DataExecution::Workspace &rootWorkspace, const QString &workspaceUrl, const QString &opOutputStr, DataExecution::Operation &destOp, const QString &destOpInputStr, const SceneItemType *itemType) const
 
DataExecution::OperationaddOperation (DataExecution::Workspace &rootWorkspace, const QString &pluginStr, const QString &opStr, const QString &opOutputStr, const QString &destOpIdPath) const
 

Static Protected Member Functions

static bool addConnection (DataExecution::Operation &sourceOp, const QString &sourceOutputStr, DataExecution::Operation &destOp, const QString &destInputStr)
 
static bool connectMeshModelSource (DataExecution::Operation &op, const QString &opInputName, DataExecution::Operation &meshInstanceOp)
 
static DataExecution::OperationfindOperationWithGlobalName (DataExecution::Workspace &parent, const QString &globalName)
 
static QPointF getOperationPosition (DataExecution::Operation &op)
 
static DataExecution::OutputtraceBackToRealOperationOutput (DataExecution::InputScalar *input)
 

Detailed Description

Some items in the scene interaction tree may have a 1:1 relationship with an actual scene item. For example a camera 'node' in the tree may represent the concept of a Camera output and the CameraBuilder that creates it. However some items are more complex such as a mesh. A mesh node in the tree may actually represent the MeshModelSourceAndProxy as well as the MeshReader and perhaps even a SurfaceSpecifier. The user interacting with the tree doesn't need to be concerned with all the parts (Operations and Connections) that make up this concept of a mesh.

Note
New types should be deriving from SceneItemTypeSingleton below rather than directly from this.

Member Typedef Documentation

◆ SceneInteractionWidgetItemList

Member Enumeration Documentation

◆ Category

enum Category
Enumerator
AllCategories 
Scene 
SceneItem 
MeshData 
Shader 
Glypher 
Texture 
Overlay 
LastCategory 

◆ Flags

enum Flags
Enumerator
UserCanAdd 
UserCanRemove 
UserCanFocus 

Constructor & Destructor Documentation

◆ ~SceneItemType()

virtual ~SceneItemType ( )
virtualdefault

◆ SceneItemType()

SceneItemType ( )
protecteddefault

Member Function Documentation

◆ addConnection()

bool addConnection ( DataExecution::Operation sourceOp,
const QString &  sourceOutputStr,
DataExecution::Operation destOp,
const QString &  destInputStr 
)
staticprotected

Helper function to be used by derived classes to add a new connection between operations.

Parameters
sourceOpThe source operation for the connection.
sourceOutputStrThe name of the output on the source operation.
destOpThe destination operation for the connection.
destInputStrThe name of the input on the destination operation.

◆ addExternalWorkspace() [1/2]

Operation * addExternalWorkspace ( DataExecution::Workspace rootWorkspace,
const QString &  workspaceUrl,
const QString &  opOutputStr,
const QString &  destOpIdPath 
) const
protected

Helper function to be used by derived classes to add a new external workspace operation.

Parameters
rootWorkspaceRoot workspace of the hierarchy.
workspaceUrlThe workspace URL of the new external workspace we're adding.
opOutputStrThe id path of the output of the new operation we're connecting.
destOpIdPathThe id path of the existing operation we're connecting the new operation to.

◆ addExternalWorkspace() [2/2]

Operation * addExternalWorkspace ( DataExecution::Workspace rootWorkspace,
const QString &  workspaceUrl,
const QString &  opOutputStr,
DataExecution::Operation destOp,
const QString &  destOpInputStr,
const SceneItemType itemType 
) const
protected

Helper function to be used by derived classes to add a new external workspace operation.

Parameters
rootWorkspaceRoot workspace of the hierarchy.
workspaceUrlThe workspace URL of the new external workspace we're adding.
opOutputStrThe id path of the output of the new operation we're connecting.
destOpThe existing operation we're connecting the new operation to.
destOpInputStrThe input name of the dest Operation we're connecting the new operation to.
itemTypeThe itemtype of the existing operation or the downstream operation that we know.

◆ addOperation()

Operation * addOperation ( DataExecution::Workspace rootWorkspace,
const QString &  pluginStr,
const QString &  opStr,
const QString &  opOutputStr,
const QString &  destOpIdPath 
) const
protected

Helper function to be used by derived classes to add a new operation.

Parameters
rootWorkspaceRoot workspace of the hierarchy.
pluginStrThe name of the plug-in that contains the new operation.
opStrThe operation's name in the plug-ins operation catalog.
opOutputStrThe id path of the output of the new operation we're connecting.
destOpIdPathThe id path of the existing operation we're connecting the new operation to.

◆ addSingleItemToScene()

CSIRO::DataExecution::Operation * addSingleItemToScene ( DataExecution::Workspace root,
const QString &  sceneIdPath 
) const
virtual
See also
addToScene. This is similar to addToScene except it should only add this single SceneItemType to the scene tree. addToScene can also add related items. This method should not do this. In most cases, only one item is added anyway, so the default implementation of this simply calls addToScene.

Reimplemented in MeshModelItemType.

◆ addToScene()

virtual DataExecution::Operation * addToScene ( DataExecution::Workspace root,
const QString &  sceneIdPath 
) const
pure virtual

◆ allowMultipleConnection()

bool allowMultipleConnection ( QString  inputName) const
virtual
Returns
Whether an input accept multiple connections. For input types like ObjectArray It's possbile to connect multiple stuff under that with some special tricks.
Parameters
inputNameThe name of the input.

The base implementation returns false (ie. keep scalar input connect one child)

See also
getInputNameForType()

Reimplemented in MultiModelNodeColoringShaderPreprocessItemType.

◆ connectMeshModelSource()

bool connectMeshModelSource ( DataExecution::Operation op,
const QString &  opInputName,
DataExecution::Operation meshInstanceOp 
)
staticprotected
Parameters
opThe op you want the MeshModelSource connected to.
opInputNameThe name of the InputScalar on the operation you want the MeshModelSource connected to.
meshInstanceOpThe MeshModelInstance operation corresponding to the source

Helper function that, given a MeshModelInterface operation, will connect the corresponding operation that outputs the MeshModelInterface

The scene editor assumes the operation that outputs the MeshModelInterface also has an output call "Mesh" allowing it to get the source. This is the case for meshmodel.xml, meshmodelsequence.xml and meshmodelpassthrough.xml which is what the scene editor, or any workflow using the scene interaction widget, should be using.

◆ createSceneInteractionWidgetItem()

CSIRO::Rendering::SceneInteractionWidgetItem * createSceneInteractionWidgetItem ( QTreeWidgetItem *  parent,
const QStringList text,
DataExecution::Operation op 
) const
virtual

◆ createSceneInteractionWidgetItems()

CSIRO::Rendering::SceneItemType::SceneInteractionWidgetItemList createSceneInteractionWidgetItems ( QTreeWidgetItem *  parent,
const QStringList text,
DataExecution::Operation op 
) const
virtual

◆ findOperationWithGlobalName()

Operation * findOperationWithGlobalName ( DataExecution::Workspace parent,
const QString &  globalName 
)
staticprotected

Helper function to find an operation from it's global name and parent.

◆ getFlags()

unsigned int getFlags ( ) const
virtual

◆ getIcon()

virtual QString getIcon ( ) const
pure virtual

◆ getInput()

CSIRO::DataExecution::Input * getInput ( DataExecution::Operation primaryOperation,
const QString &  inputName 
) const
virtual

Return the input for the given inputName. Derived classes may need to return an Input not on the primary operation

Reimplemented in MultiModelNodeColoringShaderPreprocessItemType.

◆ getInputNameForType()

QStringList getInputNameForType ( unsigned int  category) const
virtual
Returns
The name of the input that accepts this category of types or empty QStringList if none exists.
Parameters
categoryThe category to get the input for or AllCategories to return the input names of all supported categories names.

The base implementation returns an empty QStringList (ie. does not support any item types as inputs.)

See also
getOutputType()

Reimplemented in BlinnPhongShaderItemType, ControlPointMeshItemType, LambertShaderItemType, MeshModelInstanceItemType, MultiModelNodeColoringShaderPreprocessItemType, SceneRootItemType, and TransformItemType.

◆ getMenuPath()

virtual QString getMenuPath ( ) const
inlinevirtual

◆ getName()

virtual QString getName ( ) const
pure virtual

◆ getOperationKey()

virtual QString getOperationKey ( ) const
pure virtual

◆ getOperationPosition()

QPointF getOperationPosition ( DataExecution::Operation op)
staticprotected

Helper function to get the bounding box of an operation on the workspace canvas.

◆ getOutputType()

unsigned int getOutputType ( ) const
virtual
Returns
The Category type this item produces. Will be a SceneItem::Category or some user defined type > SceneItem::LastCategory

The scene interaction code uses the category returned by this function when calling getInputNameForType() to determine if some exising item accepts this item as an input.

Clients may return other types of their own as long as they don't clash with the names of the above types. If this is done it is expected that a client has also defined one or more types that return a valid input when the new type is passed to getInputNameForType().

The base implementation returns SceneItem.

See also
getInputNameForType()

Reimplemented in AxesOverlayItemType, BlinnPhongShaderItemType, ColorStateShaderItemType, DynamicMeshModelItemType, ElementColoringShaderItemType, ElementToNodeColoringShaderItemType, ImageOverlayItemType, LambertShaderItemType, MeshModelItemType, MeshModelSequenceItemType, MultiModelNodeColoringShaderItemType, MultiModelNodeColoringShaderPreprocessItemType, NodeColoringShader2ItemType, NodeColoringShaderItemType, RodGlypherItemType, SceneRootItemType, SphereGlypherItemType, StreakGlypherItemType, SuperQuadGlypherItemType, TextOverlayItemType, Texture2dItemType, and VectorGlypherItemType.

◆ getSceneItemOutputName()

virtual QString getSceneItemOutputName ( ) const
pure virtual

◆ getTooltipForWrongPositionInTree()

QString getTooltipForWrongPositionInTree ( const SceneInteractionWidgetItem currentlySelectedItem) const
virtual

Return a string to display as a tooltip when the item is not available to add to the scene tree. This will appear in the context menu, when hovering over an entry. This can provide the user some useful information as to why the entry is greyed-out.

◆ isValidUnderTreeItem()

bool isValidUnderTreeItem ( const SceneInteractionWidgetItem currentlySelectedItem) const
virtual

Allows the user to inform the caller that this item is valid to be placed under currentlySelectedItem For example, a user may want their derived SceneItemType to only be addable under a Transform if that Transform is under a specific scene tree item.

Parameters
currentlySelectedItemThe item that is currently selected in the scene tree. See also SceneInteractionWidgetItem::acceptsItemTypeAsChild.

◆ labelChanged()

void labelChanged ( DataExecution::Workspace root,
const QString &  sceneIdPath 
) const
virtual

The label of this item changed

Parameters
rootRoot workspace of the hierarchy.
sceneIdPathWorkspace id path of the item we want to update.

Reimplemented in CameraItemType.

◆ promptAndAddToScene()

DataExecution::Operation * promptAndAddToScene ( DataExecution::Workspace root,
const QString &  sceneIdPath 
) const
virtual
See also
addToScene. This method mirrors addToScene but will prompt the user for missing data (e.g. file name)
Parameters
rootRoot workspace of the hierarchy.
sceneIdPathWorkspace id path of the transform parent this type should be added to.

Adds this type to an existing scene, prompting the user for any inputs it cannot automatically determine. Operations returned by this function are guaranteed to be ready to use after the function has returned.

Most subclasses will not need to override this function - its default implementation simply invokes addToScene. Only those operations that require user input in the form of dialogs will need to override this function.

E.g. Adding a MeshModel to a scene can be done in code using the addToScene function, but adding a MeshModel to a scene via the SceneInteractionWidget requires some user input for the fileName and fileType. This can be done with dialogs created in the version of this function overridden in a subclass.

Returns
The newly added operation.

Reimplemented in MeshModelItemType, MeshModelSequenceItemType, and Texture2dItemType.

◆ removeFromScene()

void removeFromScene ( DataExecution::Workspace root,
const QString &  sceneIdPath 
) const
virtual

Remove this type from an existing scene.

Parameters
rootRoot workspace of the hierarchy.
sceneIdPathWorkspace id path of the item that should be removed.

Reimplemented in MeshModelInstanceItemType.

◆ repositionOperation()

void repositionOperation ( DataExecution::Operation op,
DataExecution::Operation anchor,
QUndoStack &  undoStack 
)
static

Helper function to move a newly added operation to a nice offset from an existing operation it's connected to.

For now we just look at each operation that is connected as an input to the operation we're connecting to. We then select the lowest of these and offset ourselves from there.

◆ sceneItemTypeAdded()

void sceneItemTypeAdded ( const SceneItemType typeJustAddedToWorkflow,
DataExecution::Operation primaryOperationJustAdded,
DataExecution::Workspace rootWorkspace,
const QString &  parentIdPath 
) const
virtual

Called when the workflow under

See also
rootWorkspace has been modified due to the addition of a tree item corresponding to a SceneItemType
typeJustAddedToWorkflow. The
typeJustAddedToWorkflow has just been added to a SceneItemType of this type The default implementation does nothing.
Parameters
typeJustAddedToWorkflowThe type that has just been added
primaryOperationJustAddedThe operation that was just added as a result of adding typeJustAddedToWorkflow scene item
rootWorkspaceThe root workspace
parentIdPathThe id path of the (primary) operation that represents typeJustAddedToWorkflow

◆ sceneItemTypeRemoved()

void sceneItemTypeRemoved ( const SceneItemType typeJustRemovedFromWorkflow,
const SceneInteractionWidgetItem treeItemRemoved,
DataExecution::Operation primaryOperationJustAdded,
DataExecution::Workspace rootWorkspace,
const QString &  parentIdPath 
) const
virtual

◆ setOperationInput()

static void setOperationInput ( DataExecution::Operation op,
const QString &  name,
const T &  value 
)
inlinestatic

Helper function to set the value of an operation input

◆ traceBackToRealOperationOutput()

Output * traceBackToRealOperationOutput ( DataExecution::InputScalar input)
staticprotected
Returns
The source output connected to this input or NULL if the trace back failed.

Helper function the finds the input connected to a source. It traces back up WorkspaceInputs to find the real output, not just the output of the first WorkspaceInput.