Jump to content

[SOLVED] Set Properties from Editor Plugin


photo

Recommended Posts

Hello! I'm begginer in Unigine. And I tring developing simple pugin for UnigineEditor...

Can you help me advice for implementing next logic:

1. Create node from editor plugin (Already has and it's worked)

2. Set property (but I didn't understood how to set parameters for created Property)

So I'm not sure can I working with property without component system in UnigineEditor Plugin?
 

Link to comment

Hi evgen2023,

Quote

2. Set property (but I didn't understood how to set parameters for created Property)

You can use something like this:

NodePtr node;
PropertyPtr prop = node->getProperty(node->addProperty("PropertyName"));
prop->getParameterPtr("parameter_name")->setValueInt(5);

Please note that you can't create a new property (new .prop file) via API, only use existing ones (and attach them to the nodes/surfaces, change their parameters).

Best regards,
Alexander

  • Like 1
Link to comment

So If I try call addProperty from EditorPlugin so then got crash:

image.png.a42dbc31beece8c00d14e55f6ad3df72.png

image.png.d6c4e055f63a966fea2b6bbe6d651132.png

 


But found next way (via inherit from node_base and save later):

```

    Unigine::PropertyPtr pProperty = Unigine::Properties::findProperty("node_base")->inherit("myproperty");
    pProperty->setPath(m_sFullPathProp.toStdString().c_str());
    m_pDynamicMesh->addProperty(pProperty);
    pProperty->save();

```

it worked without initializing Component System in Editor Plugin.

 

Thanks for your reply!

Edited by evgen2023
Link to comment
  • silent changed the title to [SOLVED] Set Properties from Editor Plugin
×
×
  • Create New...