UI Parameters

It´s possible to create parameters within your extension which are exposed and direct available within Grid.

General

A parameter which should be visible within the inspector needs to be defined within the afterInit function.

A parameter need to be "linked" to a tab/container similar like this:

def afterInit(self):
    self.objectContainer.addFloatParameter("Example Float", 0, 0, 100)

For more details see here.


Access / Use parameter values

parameterName.value
def afterInit(self):
    self.parameter = self.objectContainer.addFloatParameter("Example", 0, 0, 100)
    
def someReadFunction(self):
    floatValue = self.parameter.value

def someSetFunction(self):
    self.parameter.value = 1.234

def onParameterFeedback(self, parameter):
    if parameter == self.parameter:
        print(self.parameter.value)

Parameter types

String

Add a parameter of the type string

.addStringParameter("ParameterLabel", "DefaultValue")

A parameter of the type string is also supporting multilines

circle-check


Text

Add a parameter of the type text

.addTextParameter("ParameterLabel", "DefaultValue")


Integer

Add a parameter of the type int

.addIntParameter("ParameterLabel", DefaultValue, MinValue, MaxValue)

circle-check


Float

Add a parameter of the type float

.addFloatParameter("ParameterLabel", DefaultValue, MinValue, MaxValue)

circle-check


Bool

Add a parameter of the type bool

.addBoolParameter("ParameterLabel", DefaultValue)


Enum / Dropdown

Add a parameter of the type enum.

Empty Enum

.addEnumParameter("ParameterLabel", defaultIndex, "")

Enum with predefined entires

.addEnumParameter("ParameterLabel", defaultIndex, "SemikolonSeparatedEntriesAsString")

circle-check

Additional enum functions

circle-info

The value is a var and can hold different parameter types like: Int, Float, String, etc.

.addOption("Enum", 1234)

.addOption("Enum", 12.34)

.addOption("Enum", "OneTwo")


Point / Vector2

Add a parameter of the type point / vector2

.addPointParameter("ParameterLabel")

circle-check


Vector

Add a parameter of the type vector3

.addVectorParameter("ParameterLabel")

circle-check


IP

Add a parameter formatted correctly for IP-addresses

.addIPParameter("ParameterLabel", AvailableAdressesOnly)

circle-check

circle-info

U can use .isValidIP() to check the given IP address. Return True or False.


Color

Add a color parameter

.addColorParameter("ParameterLabel")


File

Add a parameter which supports a file explorer search

.addFileParameter("ParameterLabel","preDefinedPath")


Trigger / Button

Add a trigger button parameter

.addTrigger("ParameterLabel")


Data

Add a data parameter to handle json formated data

.addDataParameter("ParameterLabel")

Access value from child parameter:

Set / Write value of a child parameter

Append a new child

Set complete parameter from json

circle-exclamation
triangle-exclamation

DataTarget

Adds a customizable data parameter which can be filled with json arrays.

.addDataTargetParameter("ParameterLabel", "", "")

triangle-exclamation

Object Target

Adds a target parameter which can be linked to objects

.addTargetParameter("ParameterLabel", True, "")


Parameter Target

Adds a target parameter which can be linked to objects

.addTargetParameter("ParameterLabel", False, "")


Last updated