Skip to content

Core::Transform

#include "Core/Nodes/Transform.h"

Inherits from Core::Node, std::enable_shared_from_this< Node >

Inherited by Core::TransformImpl< T >, Core::TransformImpl< ETransformType::AxisAngle >, Core::TransformImpl< ETransformType::EulerX >, Core::TransformImpl< ETransformType::EulerY >, Core::TransformImpl< ETransformType::EulerZ >, Core::TransformImpl< ETransformType::Free >, Core::TransformImpl< ETransformType::Frustum >, Core::TransformImpl< ETransformType::LookAt >, Core::TransformImpl< ETransformType::Ortho >, Core::TransformImpl< ETransformType::Perspective >, Core::TransformImpl< ETransformType::Quat >, Core::TransformImpl< ETransformType::Scale >, Core::TransformImpl< ETransformType::Translation >

Public Functions

Name
Transform(const TransformOperation & transformType)
voidcreateDefaults()<br>Prepare storage for second level parameters (std::map with values)
voiddisableSynergies()
voidenableSynergies()
voidfree()
intgetCurrentIndex() const
Ptr< Node >getCurrentSequence()
TransformOperation::ValueMapgetDefaultTypes() const
const Data &getDefaultValue(const std::string & name) const<br>Get the value which the transform can hold (current value stored in the transformation).
DefaultValues &getDefaultValues()
EValueStategetValueState(glm::ivec2 coords) const
boolhasMenuSynergies() const
boolhasSavedValue() const
boolhasSynergies() const
virtual voidinitDefaults()<br>Init the (non-zero) second level parameters (from LOD::SetValues) via their initDefaults and update the internal transformation matrix).
boolisInSequence() const
boolisLocked() const
virtual boolisValid() const =0<br>Checks the validity of the stored Transform matrix (used by GUI to show the corrupted flag).
voidlock()
voidnotifySequence()
voidnullSequence()
TransformOperation *properties() const
voidreloadValue()<br>Restore saved values if they exist.
virtual voidresetMatrixFromDefaults() =0<br>Reset the transform matrix visible in LOD::Full (internalValue) to match the defaultValues (from LOD::SetValues).
voidsaveValue()<br>Save current values of the transformation for future reloading.
template <typename T &gt; <br>SetValueResultsetDefaultValue(const std::string & name, T && val)<br>Setting of one second level parameter defining the transformation (in LOD::SetValues).
template <typename T &gt; <br>voidsetDefaultValueNoUpdate(const std::string & name, T && val)
voidsetDefaultValues(const DefaultValues & values)
voidsetSequence(Node * s, int index)
virtual SetValueResultsetValue(const glm::mat4 & mat) override<br>Lock non-editable values.
virtual SetValueResultsetValue(float val, glm::ivec2 coords) override
voidunlock()

Protected Functions

Name
boolcanSetValue(const ValueMask & mask, glm::ivec2 coords, float value)
Data &getDefaultValueMut(const std::string & name)
virtual voidsetDefaultValueWithSynergies(const std::string & name, Core::Data && val)<br>Function for setting values in the Set Defaults LOD.

Protected Attributes

Name
DefaultValuesm_defaultValues
boolm_hasMenuSynergies <br>True for transformations, that support synergies, such as scale, eulerAngleXYZ, ortho, frustum, and quaternion ONLY.
boolm_hasSynergies <br>applicable for: uniform scale, eulerAngleXYZ, ortho, frustum, and quat and quaternion.
boolm_isLocked <br>Edit of the matrix is limited to editable values - defined in Operations.h g_transforms.

Friends

Name
classGraphManager
classMatrixTracker
classSequence

Additional inherited members

Public Functions inherited from Core::Node

Name
virtual voidaddDeleteCallback(std::function< void(Node )> callback)<br> The callback parameters: Node = node that has been deleted
virtual voidaddPlugCallback(std::function< void(Node *, Node *, size_t, size_t)> callback)<br>Registers a callback that gets called when the node's output pins get plugged in.
virtual voidaddUnplugCallback(std::function< void(Node *, Node *, size_t, size_t)> callback)<br>Registers a callback that gets called when the node's input pins get unplugged.
virtual voidaddUpdateCallback(std::function< void(Node *)> callback)<br>Registers a callback that gets called on any updateValues() call.
voidappendChildNode(Ptr< Node > node)
boolareAllInputsPlugged()
boolareAllInputsUnplugged() const
boolareInputsPlugged(int numInputs)
template <typename T &gt; <br>Ptr< T >as()
const Data &data(size_t index =0) const<br>Get Node contents, read only.
Data &dataMut(size_t index)
voidfinalize()<br>Prepares node for its destruction, after that the destructor can be called.
IDgetId() const
Pin &getInput(size_t i)
std::vector< Pin > &getInputPins()
Data &getInternalData(size_t index =0)<br>Get data storage for read and write purposes.
const char *getLabel() const
const Operation *getOperation() const
Pin &getOutput(size_t i)
std::vector< Pin > &getOutputPins()
Ptr< Node >getOwner() const<br>Get direct owner of this node.
Ptr< Node >getPtr()<br>Get reference to this node instance.
Ptr< Node >getRootOwner()<br>Get the topmost owner of this node.
std::stringgetSignature()<br>"{node type} #{node ID}"
EValueStategetState(size_t pinIndex =0)
voidinit()<br>Initialize node id, inputs, and outputs according to the preset node type.
voidnotifyOwner()
virtual voidonInit()
booloperator!=(const Node & other) const
booloperator==(const Node & other) const
ENodePlugResultplug(const Ptr< Node > & childNode, unsigned fromIndex, unsigned toIndex)<br>Connect this (parent) node output to the childNode input.
voidpulse(size_t index)
virtual voidreceiveSignal(int inputIndex)<br>Implements the operator reaction to the change of its inputIndex input.
voidspreadSignal()<br>Spread signal to all outputs.
voidspreadSignal(size_t outIndex)<br>Spread signal to the selected output outIndex only.
virtual voidupdateValues(int inputIndex =0)<br>Computes new values of outputs based on inputs.

Protected Functions inherited from Core::Node

Name
Node(const Operation * operation)<br>Node is never constructed directory.
virtual~Node()
ENodePlugResultisPlugCorrect(const Pin & input, const Pin & output)
virtual voidonUnplugInput(size_t index)
template <typename T &gt; <br>voidsetInternalValue(const T & value, size_t index =0)<br>Sets the node value without validation.
voidsetInternalValue(float value, glm::ivec2 coordinates, size_t index =0)
boolshouldPulse(size_t inputIndex, size_t updatedInputIndex)<br>Tests if the updatedInputIndex should be pulsed.
voidtriggerDeleteCallback(Node * node)
voidtriggerPlugCallback(Node * fromNode, Node * toNode, size_t fromIndex, size_t toIndex)
voidtriggerUnplugCallback(Node * fromNode, Node * toNode, size_t fromIndex, size_t toIndex)
voidtriggerUpdateCallback(Node * node)

Public Attributes inherited from Core::Node

Name
std::vector< EValueState >m_OperatorState

Protected Attributes inherited from Core::Node

Name
std::vector< Node * >m_children <br>Nested nodes.
IDm_id
std::vector< Pin >m_inputs <br>Inputs of the box: Input tabs with glyphs.
std::vector< Data >m_internalData <br>Results of operations.
const Operation *m_operation <br>Operator node properties.
std::vector< Pin >m_outputs <br>Outputs of the box: output tabs with glyphs.
Node *m_owner <br>Owner of the node, used in complex type of nodes, such as sequence or camera.

Friends inherited from Core::Node

Name
classPin

Public Functions Documentation

function Transform

cpp
explicit Transform(
    const TransformOperation & transformType
)
explicit Transform(
    const TransformOperation & transformType
)

function createDefaults

cpp
void createDefaults()
void createDefaults()

Prepare storage for second level parameters (std::map with values)

function disableSynergies

cpp
inline void disableSynergies()
inline void disableSynergies()

function enableSynergies

cpp
inline void enableSynergies()
inline void enableSynergies()

function free

cpp
inline void free()
inline void free()

function getCurrentIndex

cpp
inline int getCurrentIndex() const
inline int getCurrentIndex() const

function getCurrentSequence

cpp
Ptr< Node > getCurrentSequence()
Ptr< Node > getCurrentSequence()

function getDefaultTypes

cpp
TransformOperation::ValueMap getDefaultTypes() const
TransformOperation::ValueMap getDefaultTypes() const

Return: A map of valueName and value pairs.

function getDefaultValue

cpp
const Data & getDefaultValue(
    const std::string & name
) const
const Data & getDefaultValue(
    const std::string & name
) const

Get the value which the transform can hold (current value stored in the transformation).

Todo: rename to getCurrentValue?

Precondition: Default value with name exists.

It is not the initial value!

function getDefaultValues

cpp
DefaultValues & getDefaultValues()
DefaultValues & getDefaultValues()

function getValueState

cpp
EValueState getValueState(
    glm::ivec2 coords
) const
EValueState getValueState(
    glm::ivec2 coords
) const

function hasMenuSynergies

cpp
inline bool hasMenuSynergies() const
inline bool hasMenuSynergies() const

function hasSavedValue

cpp
bool hasSavedValue() const
bool hasSavedValue() const

function hasSynergies

cpp
inline bool hasSynergies() const
inline bool hasSynergies() const

function initDefaults

cpp
inline virtual void initDefaults()
inline virtual void initDefaults()

Init the (non-zero) second level parameters (from LOD::SetValues) via their initDefaults and update the internal transformation matrix).

Reimplemented by: Core::TransformImpl< ETransformType::Scale >::initDefaults, Core::TransformImpl< ETransformType::EulerX >::initDefaults, Core::TransformImpl< ETransformType::EulerY >::initDefaults, Core::TransformImpl< ETransformType::EulerZ >::initDefaults, Core::TransformImpl< ETransformType::Translation >::initDefaults, Core::TransformImpl< ETransformType::AxisAngle >::initDefaults, Core::TransformImpl< ETransformType::Quat >::initDefaults, Core::TransformImpl< ETransformType::Ortho >::initDefaults, Core::TransformImpl< ETransformType::Perspective >::initDefaults, Core::TransformImpl< ETransformType::Frustum >::initDefaults, Core::TransformImpl< ETransformType::LookAt >::initDefaults

It is overriden in all transforms with their default values. This version is for nodes without the default value (now only the Free node)

function isInSequence

cpp
inline bool isInSequence() const
inline bool isInSequence() const

function isLocked

cpp
bool isLocked() const
bool isLocked() const

function isValid

cpp
virtual bool isValid() const =0
virtual bool isValid() const =0

Checks the validity of the stored Transform matrix (used by GUI to show the corrupted flag).

Return: true if the stored matrix represents a correct transform

Todo: isValid checks matrix AND parameters from the SetValues LOD (Default values)

Reimplemented by: Core::TransformImpl< ETransformType::Free >::isValid, Core::TransformImpl< ETransformType::Scale >::isValid, Core::TransformImpl< ETransformType::EulerX >::isValid, Core::TransformImpl< ETransformType::EulerY >::isValid, Core::TransformImpl< ETransformType::EulerZ >::isValid, Core::TransformImpl< ETransformType::Translation >::isValid, Core::TransformImpl< ETransformType::AxisAngle >::isValid, Core::TransformImpl< ETransformType::Quat >::isValid, Core::TransformImpl< ETransformType::Ortho >::isValid, Core::TransformImpl< ETransformType::Perspective >::isValid, Core::TransformImpl< ETransformType::Frustum >::isValid, Core::TransformImpl< ETransformType::LookAt >::isValid

function lock

cpp
void lock()
void lock()

function notifySequence

cpp
void notifySequence()
void notifySequence()

function nullSequence

cpp
inline void nullSequence()
inline void nullSequence()

Todo: MH these should not be public.

function properties

cpp
TransformOperation * properties() const
TransformOperation * properties() const

function reloadValue

cpp
void reloadValue()
void reloadValue()

Restore saved values if they exist.

function resetMatrixFromDefaults

cpp
virtual void resetMatrixFromDefaults() =0
virtual void resetMatrixFromDefaults() =0

Reset the transform matrix visible in LOD::Full (internalValue) to match the defaultValues (from LOD::SetValues).

Todo: For synergies, it has to be resolved. Most probably, it should leave the synergies unchanged.

  • for Scale When setting X value in non-uniform scale -> this switch to uniform scale (due to enable synergies)

Reimplemented by: Core::TransformImpl< ETransformType::Free >::resetMatrixFromDefaults, Core::TransformImpl< ETransformType::Scale >::resetMatrixFromDefaults, Core::TransformImpl< ETransformType::EulerX >::resetMatrixFromDefaults, Core::TransformImpl< ETransformType::EulerY >::resetMatrixFromDefaults, Core::TransformImpl< ETransformType::EulerZ >::resetMatrixFromDefaults, Core::TransformImpl< ETransformType::Translation >::resetMatrixFromDefaults, Core::TransformImpl< ETransformType::AxisAngle >::resetMatrixFromDefaults, Core::TransformImpl< ETransformType::Quat >::resetMatrixFromDefaults, Core::TransformImpl< ETransformType::Ortho >::resetMatrixFromDefaults, Core::TransformImpl< ETransformType::Perspective >::resetMatrixFromDefaults, Core::TransformImpl< ETransformType::Frustum >::resetMatrixFromDefaults, Core::TransformImpl< ETransformType::LookAt >::resetMatrixFromDefaults

Specialized functions are created for each Transform type. For transforms with no default values (now only Free), resets the matrix directly.

The opposite setup - from matrix to Defaults - is done in the setValue() functions. It should also lock the matrix.

function saveValue

cpp
void saveValue()
void saveValue()

Save current values of the transformation for future reloading.

function setDefaultValue

cpp
template <typename T >
inline SetValueResult setDefaultValue(
    const std::string & name,
    T && val
)
template <typename T >
inline SetValueResult setDefaultValue(
    const std::string & name,
    T && val
)

Setting of one second level parameter defining the transformation (in LOD::SetValues).

Parameters:

  • name Name of the parameter (such as Center)
  • val New value

Template Parameters:

  • T Type of the stored value val

You can find transform names, types, and their default values, in the file Core/Nodes/Operation.h. The initial values are hard-wired in initDefaults() of TransformImpl<ETransformType...> in TransformImpl.h

function setDefaultValueNoUpdate

cpp
template <typename T >
inline void setDefaultValueNoUpdate(
    const std::string & name,
    T && val
)
template <typename T >
inline void setDefaultValueNoUpdate(
    const std::string & name,
    T && val
)

function setDefaultValues

cpp
inline void setDefaultValues(
    const DefaultValues & values
)
inline void setDefaultValues(
    const DefaultValues & values
)

function setSequence

cpp
inline void setSequence(
    Node * s,
    int index
)
inline void setSequence(
    Node * s,
    int index
)

function setValue

cpp
virtual SetValueResult setValue(
    const glm::mat4 & mat
) override
virtual SetValueResult setValue(
    const glm::mat4 & mat
) override

Lock non-editable values.

Reimplements: Core::Node::setValue

Reimplemented by: Core::TransformImpl< ETransformType::AxisAngle >::setValue, Core::TransformImpl< ETransformType::Quat >::setValue

And enable synergies, if exist, i.e., hasSynergies() == true

function setValue

cpp
virtual SetValueResult setValue(
    float val,
    glm::ivec2 coords
) override
virtual SetValueResult setValue(
    float val,
    glm::ivec2 coords
) override

Parameters:

  • val new value
  • coords in the column major order: coords.x is the column index and coords.y is the row index.

Return:

Reimplements: Core::Node::setValue

Reimplemented by: Core::TransformImpl< ETransformType::Free >::setValue, Core::TransformImpl< ETransformType::Scale >::setValue, Core::TransformImpl< ETransformType::EulerX >::setValue, Core::TransformImpl< ETransformType::EulerY >::setValue, Core::TransformImpl< ETransformType::EulerZ >::setValue, Core::TransformImpl< ETransformType::Translation >::setValue, Core::TransformImpl< ETransformType::Ortho >::setValue, Core::TransformImpl< ETransformType::Perspective >::setValue, Core::TransformImpl< ETransformType::Frustum >::setValue

function unlock

cpp
void unlock()
void unlock()

Protected Functions Documentation

function canSetValue

cpp
bool canSetValue(
    const ValueMask & mask,
    glm::ivec2 coords,
    float value
)
bool canSetValue(
    const ValueMask & mask,
    glm::ivec2 coords,
    float value
)

function getDefaultValueMut

cpp
Data & getDefaultValueMut(
    const std::string & name
)
Data & getDefaultValueMut(
    const std::string & name
)

Precondition: Default value with name exists.

function setDefaultValueWithSynergies

cpp
virtual void setDefaultValueWithSynergies(
    const std::string & name,
    Core::Data && val
)
virtual void setDefaultValueWithSynergies(
    const std::string & name,
    Core::Data && val
)

Function for setting values in the Set Defaults LOD.

Parameters:

  • name changed data field
  • val newValue as Core::Data(newValue)!!! (as we cannot have virtual template functions)

Reimplemented by: Core::TransformImpl< ETransformType::Quat >::setDefaultValueWithSynergies, Core::TransformImpl< ETransformType::Ortho >::setDefaultValueWithSynergies, Core::TransformImpl< ETransformType::Frustum >::setDefaultValueWithSynergies

Performs default data correction based on synergies Do not use - use setDefaultValue() instead!!!

Protected Attributes Documentation

variable m_defaultValues

cpp
DefaultValues m_defaultValues;
DefaultValues m_defaultValues;

variable m_hasMenuSynergies

cpp
bool m_hasMenuSynergies = false;
bool m_hasMenuSynergies = false;

True for transformations, that support synergies, such as scale, eulerAngleXYZ, ortho, frustum, and quaternion ONLY.

Synergies variants | Transformation | hasMenuSynergies | show in Full LOD | show in SetValues | synergies force | | ------------—|---------------—|---------------—|----------------—|--------------—| | Free | no | no | no | | | Translate | no | no | no | | | AxisAngle rot | no | no | no | | | LookAt | no | no | no | | | Perspective | no | no | no | | | Ortho | yes | no | yes | | | Frustum | yes | no | yes | | | Quat | yes | no | yes | unitQuaternion | | Scale | yes | yes | yes | uniform scale | | EulerX,Y,Z | yes | yes | no | cos and sins |

variable m_hasSynergies

cpp
bool m_hasSynergies = false;
bool m_hasSynergies = false;

applicable for: uniform scale, eulerAngleXYZ, ortho, frustum, and quat and quaternion.

All other undefined (false)

variable m_isLocked

cpp
bool m_isLocked = true;
bool m_isLocked = true;

Edit of the matrix is limited to editable values - defined in Operations.h g_transforms.

Friends

friend GraphManager

cpp
friend class GraphManager(
    GraphManager 
);
friend class GraphManager(
    GraphManager 
);

friend MatrixTracker

cpp
friend class MatrixTracker(
    MatrixTracker 
);
friend class MatrixTracker(
    MatrixTracker 
);

friend Sequence

cpp
friend class Sequence(
    Sequence 
);
friend class Sequence(
    Sequence 
);

Updated on 2024-11-06 at 20:16:54 +0000