-
Notifications
You must be signed in to change notification settings - Fork 0
DEV add block type or parameters
Depending on the complexity of the block or parameter that you want to add, you need to take 3 different actions.
If you want to add some parameters to a block, or you want to add a block and you don't need to create new types of parameters, you just need to update the BlockType resource.
For example, if you want to add a block which generates random numbers and which doesn't accept any input from other blocks, you'll need to add (in the backend) a resource similar to the following:
{
"name": "random",
"ports": [
{
"type": "default",
"name": "out",
"out": true,
"label": "Out"
}
],
"displayName": "Random",
"parameterDefinitions": [
{
"name": "max",
"displayName": "Max",
"description": "Upper bound limit of the random number",
"default": 100,
"required": true,
"type": "number"
}
]
}
if you want to add a new type of parameter you need to create a ParameterModel and a ParameterWidget. Then you need to register the parameter. If a parameter doesn't use any other parameter (that is, its widget doesn't use the ParametersEnginge component), you can register you parameter in the primitive.js
file. Otherwise (like the DoDesignParameter, Ref DoDesignParameter you need to register your new parameter in the index.js
file.
If you need to create a new type of block that has some feature that you can't obtain through the BlockTypeDefinitio you need to create a new BlockModel or BlockWidget or both.