#include <mlabField.h>
Inherits QObject.
Inherited by MLABListField< double >, MLABListField< qint64 >, MLABListField< ml::Vector2 >, MLABListField< ml::Vector3 >, MLABListField< ml::Vector4 >, MLABBoolField, MLABEngineOutputField, MLABEnumField, MLABImageField, MLABListField< T >, MLABMLBaseField, MLABMatrixField, MLABNumberField, MLABOtherField, MLABSoNodeField, MLABSoPathField, MLABStringField, MLABTriggerField, and MLABVectorField.
Base class of all Fields in MLAB.
The MLABField is used standalone by macro modules and to wrap Inventor or ML Fields. A field normally has a MLABFieldOwner, which is an MLABModule in the current implementation. To get a field of a module, use the MLABModule::field() method. There are common stringValue() and setStringValue() methods in this base class and specialized set/get methods in the derived class.
The name of the field is given in the 'name' property:
name = ctx.field("somefield").name
or alternatively
name = ctx.field("somefield").getName()
The fields data type can be read by using the 'type' property.
thisType = ctx.field("somefield").type
or alternatively
thisType = ctx.field("somefield").getType()
The data type is generated from the fields C++ class name by stripping of the prefix 'MLAB' and the trailing 'Field', e.g., getType() of an MLABBoolField returns Bool.
- Note
- To ensure that this mechanism works for all classes derived from MLABField, it is important that the Q_OBJECT macro is added to the class definition.
All fields that have a value, implement a 'value' property, which can be accessed via Scripting for read/write access.
Read access:
value = ctx.field("somefield").value
Write access:
ctx.field("someIntField").value = 42
ctx.field("someStringField").value = "Test"
The 'value' property is always of the typical type of the field, thus a string field returns a string, while an int field returns an integer. Type conversion is done automatically by QT.
Field datatypes include:
◆ comment
| QString MLABField::comment |
( |
| ) |
|
|
slot |
Returns the comment string.
◆ connectedField
Returns the input connection of this field (connected field, NULL if none), alias for inputField().
In this case, this field is the destination of a connection.
◆ connectFrom
| bool MLABField::connectFrom |
( |
MLABField * | field | ) |
|
|
slot |
Connects to given field (if already connected, automatically disconnects old connection) and returns whether this operation was successful.
◆ connectFromUndoable
| bool MLABField::connectFromUndoable |
( |
MLABField * | field | ) |
|
|
slot |
Connects/disconnects undoable.
◆ disconnect
| void MLABField::disconnect |
( |
| ) |
|
|
slot |
◆ disconnectAll
| void MLABField::disconnectAll |
( |
| ) |
|
|
slot |
Disconnects the input and all output fields.
◆ disconnectOutputs
| void MLABField::disconnectOutputs |
( |
| ) |
|
|
slot |
◆ fullName
| QString MLABField::fullName |
( |
| ) |
const |
|
slot |
Returns the full name for debugging. This is the name of the owner (if existing) with the name of the field.
◆ getName
| QString MLABField::getName |
( |
| ) |
const |
|
inlineslot |
Returns the name of the field. You can also use the name property.
◆ getType
| QString MLABField::getType |
( |
| ) |
const |
|
inlineslot |
Returns the data type of the field by stripping of the prefix 'MLAB' and the trailing 'Field' of the fields C++ class name, e.g., getType() of an MLABBoolField returns Bool. See Detailed Description above for the available field types.
◆ infoString
| QString MLABField::infoString |
( |
| ) |
|
|
slot |
Returns an info string (for printing).
◆ inputField
Returns the input connection of this field (connected field, NULL if none), alias for connectedField().
In this case, this field is the destination of a connection.
◆ isConnected
| bool MLABField::isConnected |
( |
| ) |
|
|
slot |
Returns whether the field has an input connection.
◆ isConnectedToFieldInSameNetwork
| bool MLABField::isConnectedToFieldInSameNetwork |
( |
| ) |
|
|
slot |
Returns whether the field is connected to another field in the same network.
Returns true if connected to at least one field in the same network.
◆ isConnectionInSameNetworkPossible
| bool MLABField::isConnectionInSameNetworkPossible |
( |
MLABField * | field | ) |
|
|
slot |
Returns whether a connection between the fields is possible using isConnectionPossible() and if the fields are in the same network.
◆ isConnectionPossible
| virtual bool MLABField::isConnectionPossible |
( |
MLABField * | field | ) |
|
|
virtualslot |
Returns whether a connection between the fields is possible (taking into account the input/output type and not regarding the networks the fields are in).
NOTE: even if this method tries to be accurate, it may return true and connectFrom is still not possible. This is due to the fact that not all Inventor fields can be connected with each other and this can only be detected if trying to connect the fields.
◆ isEditable
| bool MLABField::isEditable |
( |
| ) |
const |
|
inlineslot |
Returns whether the field is editable in the GUI (can be overridden in self-defined panels).
◆ isFilePath
| bool MLABField::isFilePath |
( |
| ) |
|
|
slot |
Returns whether this field is a file path (only applicable for string fields).
◆ isHidden
| bool MLABField::isHidden |
( |
| ) |
|
|
slot |
Returns whether the field is hidden.
◆ isIgnored
| bool MLABField::isIgnored |
( |
| ) |
|
|
slot |
Returns whether this field is ignored. This is only used with Inventor fields.
◆ isInOut
| bool MLABField::isInOut |
( |
| ) |
|
|
inlineslot |
Returns whether this field is marked as an input/output (parameter) field.
◆ isInput
| bool MLABField::isInput |
( |
| ) |
|
|
inlineslot |
Returns whether this field is marked as an input field.
Mark field as input only, as output only, or as InOut: a newly created field is InOut. mainly these flags are used to avoid wrong drag/drop connections!
◆ isInSameNetwork
| bool MLABField::isInSameNetwork |
( |
MLABField * | field | ) |
|
|
slot |
Returns whether the field is in the same network as the given field.
◆ isInterfaceField
| bool MLABField::isInterfaceField |
( |
| ) |
|
|
inlineslot |
Returns whether this is a macro module's interface field.
◆ isInventorField
| bool MLABField::isInventorField |
( |
| ) |
|
|
slot |
Returns whether this is an Inventor field.
◆ isMLField
| bool MLABField::isMLField |
( |
| ) |
|
|
slot |
Returns whether this is an ML field.
◆ isOutput
| bool MLABField::isOutput |
( |
| ) |
|
|
inlineslot |
Returns whether this field is marked as an output field.
◆ isParameterField
| bool MLABField::isParameterField |
( |
| ) |
|
|
inlineslot |
Returns whether this is a parameter field.
◆ isPersistent
| bool MLABField::isPersistent |
( |
| ) |
const |
|
inlineslot |
Returns whether the field is persistent, i.e., if its values is saved together with the module.
◆ isProxy
| bool MLABField::isProxy |
( |
| ) |
|
|
inlineslot |
Returns whether a field is a used as a proxy on a macro module's interface.
◆ outputCount
| int MLABField::outputCount |
( |
| ) |
|
|
slot |
Returns the number of connected fields where this field is the source.
◆ outputField
| MLABField * MLABField::outputField |
( |
int | index | ) |
|
|
slot |
Returns the output field at the given index; the number of available fields is given via outputCount().
◆ outputFields
| QList< MLABField * > MLABField::outputFields |
( |
| ) |
|
|
slot |
Returns the list of fields that are connected from this field.
◆ owner
Returns the owner of the field (may be NULL).
◆ persistentStringValue
| virtual QString MLABField::persistentStringValue |
( |
| ) |
|
|
virtualslot |
Returns the value of the field as a string value for persistence in network files.
(Default implementation returns stringValue().)
Reimplemented in MLABStringField.
◆ priority
| int MLABField::priority |
( |
| ) |
|
|
slot |
◆ setComment
| void MLABField::setComment |
( |
const QString & | comment | ) |
|
|
slot |
Sets a comment string for the field.
◆ setHidden
| void MLABField::setHidden |
( |
bool | flag | ) |
|
|
slot |
Sets the hidden state of this field.
◆ setIgnored
| void MLABField::setIgnored |
( |
bool | flag | ) |
|
|
slot |
Sets the ignore flag, which only has an effect on Inventor fields.
◆ setIsFilePath
| void MLABField::setIsFilePath |
( |
bool | flag | ) |
|
|
slot |
Sets whether this field contains a file path (only applicable for string fields).
◆ setPersistentStringValue
| virtual void MLABField::setPersistentStringValue |
( |
const QString & | value | ) |
|
|
virtualslot |
Sets the value of the field from the persistent string value in a network file.
(Default implementation uses setStringValue().)
Reimplemented in MLABStringField.
◆ setPriority
| void MLABField::setPriority |
( |
int | aPriority | ) |
|
|
slot |
Sets a priority, currently only used for inventor field callbacks.
◆ setProxy
| void MLABField::setProxy |
( |
bool | flag | ) |
|
|
inlineslot |
Sets whether a field is used as a proxy on a macro module's interface.
◆ setStringValue
| virtual void MLABField::setStringValue |
( |
const QString & | | ) |
|
|
inlinevirtualslot |
Sets the value of the field as a string value.
Reimplemented in MLABImageField, MLABMLBaseField, MLABSoNodeField, MLABSoPathField, MLABTriggerField, MLABBoolField, MLABDoubleField, MLABEnumField, MLABFloatField, MLABIntegerField, MLABIntVector2Field, MLABIntVector3Field, MLABIntVector6Field, MLABMatrixField, MLABOtherField, MLABStringField, MLABVector2Field, MLABVector3Field, MLABVector4Field, and MLABVector6Field.
◆ setTitle
| void MLABField::setTitle |
( |
const QString & | title | ) |
|
|
slot |
Sets a default GUI title.
◆ setTriggersLoading
| void MLABField::setTriggersLoading |
( |
bool | flag | ) |
|
|
inlineslot |
Sets whether this field triggers full loading of a lazy loading module if touched.
◆ stringValue
| virtual QString MLABField::stringValue |
( |
| ) |
|
|
virtualslot |
◆ stringValueForProfiling
| virtual QString MLABField::stringValueForProfiling |
( |
| ) |
|
|
virtualslot |
◆ title
| QString MLABField::title |
( |
| ) |
|
|
slot |
Returns the default GUI title.
◆ toolTipInfo
| virtual QString MLABField::toolTipInfo |
( |
| ) |
|
|
virtualslot |
Returns an info string for the tool tip.
◆ touch
| virtual void MLABField::touch |
( |
| ) |
|
|
virtualslot |
◆ triggersLoading
| bool MLABField::triggersLoading |
( |
| ) |
const |
|
inlineslot |
Returns whether this field triggers full loading of a lazy loading module if touched.
◆ truncatedStringValue
| QString MLABField::truncatedStringValue |
( |
int | maxChars = 80 | ) |
|
|
slot |
Truncates the string value. It truncates the stringValue() if it is longer than the given number of chars and appends "...".