MeVisLab Scripting Reference
MLABField Class Reference

#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.

Public Slots

bool isInventorField ()
 
bool isMLField ()
 
Scripting access.


QString getType () const
 
QString getName () const
 
virtual QString stringValue ()
 
virtual void setStringValue (const QString &)
 
virtual QString persistentStringValue ()
 
virtual void setPersistentStringValue (const QString &value)
 
QString truncatedStringValue (int maxChars=80)
 
virtual QString stringValueForProfiling ()
 
virtual void touch ()
 
MLABFieldOwnerowner ()
 
MLABFieldconnectedField ()
 
MLABFieldinputField ()
 
bool isConnected ()
 
bool isConnectedToFieldInSameNetwork ()
 
int outputCount ()
 
MLABFieldoutputField (int index)
 
QList< MLABField * > outputFields ()
 
bool connectFrom (MLABField *field)
 
void disconnect ()
 
void disconnectOutputs ()
 
void disconnectAll ()
 
bool connectFromUndoable (MLABField *field)
 
virtual bool isConnectionPossible (MLABField *field)
 
bool isConnectionInSameNetworkPossible (MLABField *field)
 
bool isInSameNetwork (MLABField *field)
 
virtual QString toolTipInfo ()
 
void setPriority (int aPriority)
 
int priority ()
 
void setProxy (bool flag)
 
bool isProxy ()
 
void setComment (const QString &comment)
 
QString comment ()
 
void setTitle (const QString &title)
 
QString title ()
 
QString fullName () const
 
bool isHidden ()
 
void setHidden (bool flag)
 
bool isIgnored ()
 
void setIgnored (bool flag)
 
bool isFilePath ()
 
void setIsFilePath (bool flag)
 
bool isInterfaceField ()
 
bool isParameterField ()
 
bool isInput ()
 
bool isOutput ()
 
bool isInOut ()
 
QString infoString ()
 
bool isPersistent () const
 
bool isEditable () const
 
bool triggersLoading () const
 
void setTriggersLoading (bool flag)
 

Detailed Description

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 a MLABModule in the current implementation. To get a field of a module, use the field() method of MLABModule. 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:

ctx.field("somefield").name

or alternatively

ctx.field("somefield").getName()

The fields data type can be read by using the "type" property.

ctx.field("somefield").type

or alternatively

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:

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 data types include:

Member Function Documentation

◆ comment

QString MLABField::comment ( )
slot

Returns the comment string.

◆ connectedField

MLABField * MLABField::connectedField ( )
slot

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

Disconnects input.

◆ disconnectAll

void MLABField::disconnectAll ( )
slot

Disconnects the input and all output fields.

◆ disconnectOutputs

void MLABField::disconnectOutputs ( )
slot

Disconnects all outputs.

◆ 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

MLABField * MLABField::inputField ( )
slot

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 when 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

MLABFieldOwner * MLABField::owner ( )
slot

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

Returns the priority.

◆ 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, used for displayWindowsNow (use 0 for immediate GUI update).

◆ setProxy

void MLABField::setProxy ( bool flag)
inlineslot

Sets whether a field is used as a proxy on a macro module's interface.

◆ setStringValue

◆ 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

Returns the value of the field as a string value.

Reimplemented in MLABMLBaseField, MLABSoNodeField, MLABSoPathField, and MLABTriggerField.

◆ stringValueForProfiling

virtual QString MLABField::stringValueForProfiling ( )
virtualslot

Returns the string value used for profiling, default returns the string value.

NOTE: be careful on how you re-implement this method in subclasses, since we don't want the profiling to cause side effects, e.g. changing the state of an ML image.

Reimplemented in MLABImageField, MLABMLBaseField, MLABSoNodeField, MLABSoPathField, and MLABTriggerField.

◆ 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

Forces a notify to all observers without changing the value of the field.

Reimplemented in MLABImageField, and MLABMLBaseField.

◆ 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 "...".