qwert_e Posted March 21, 2019 Share Posted March 21, 2019 (edited) Im sttruggling with custom component syspem. When i create some component, i want to change its parameters attributes (such as min, max) But when i change property file (or inherited from it) of my custom component property (through API or in notepad), this happens. UPD it happens when i add in component. Why it happens? this->getProperty()->addCallback(Unigine::Property::CALLBACK_PARAMETER_CHANGED, MakeCallback(this, &Wind_control::p_changed)); Edited March 21, 2019 by qwert_e Link to comment
silent Posted March 21, 2019 Share Posted March 21, 2019 qwert_e Could you please provide a minimal reproduction sample for that? Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
qwert_e Posted March 21, 2019 Author Share Posted March 21, 2019 (edited) //Wind_control.cpp #include "Wind_control.h" REGISTER_COMPONENT(Wind_control); void Wind_control::init() { getProperty()->addCallback(Unigine::Property::CALLBACK_PARAMETER_CHANGED, MakeCallback(this, &Wind_control::p_changed)); } void Wind_control::update() {} void Wind_control::p_changed(Unigine::PropertyPtr property, int num) {} // Wind_control.h #pragma once #include <UnigineGame.h> #include "ComponentSystem/ComponentSystem.h" class Wind_control : public ComponentBase { public: COMPONENT(Wind_control, ComponentBase); COMPONENT_INIT(init); COMPONENT_UPDATE(update); PROP_NAME("wind_control"); PROP_PARAM(Double, wind_angle, 0); PROP_PARAM(Double, wind_force, 0); PROP_PARAM(Toggle, reload_property_file, 0, "Reload property"); protected: void init(); void update(); private: void p_changed(Unigine::PropertyPtr property, int num); }; Tested this with new project. If i locate this prop in Editor, add it to node and reimport it (or change in notepad), there will be crash. Edited March 21, 2019 by qwert_e Link to comment
fox Posted March 22, 2019 Share Posted March 22, 2019 Hello qwert_e, We cannot reproduce this behavior, so I have to ask you some additional questions to make things clear. Could you walk me through the exact reproduction sequence? What exactly did you do? I've tried the following: Created a new C++ project with the Component System checkbox enabled Added a new Wind_control class inherited from the ComponentBase Copied your source code from the previous post to the corresponding files Added the Component System initialization to the AppSystemLogic::init() : int AppSystemLogic::init() { // Write here code to be called on engine initialization. // initialize ComponentSystem and register all components ComponentSystem::get()->initialize(); return 1; } Compiled and launched my application (the property file was generated) Opened the default world in the Editor and assigned the generated wind_control.prop property to the material_ball node. Opened the wind_control.prop property file in the text editor and added min and max attributes to the first and second parameters: <?xml version="1.0" encoding="utf-8"?> <property version="2.7.3.0" name="wind_control" manual="1" parent_name="node_base"> <parameter name="wind_angle" type="double" min="10" max="20">0</parameter> <parameter name="wind_force" type="double" min="20" max="40">0</parameter> <parameter name="reload_property_file" type="toggle" title="Reload property">0</parameter> </property> The was property successfully reimported (no crash) If the same sequence leads to a crash in your case, I'd ask you to send a small reproduction sample project to figure out what's the problem. And provide some details on the SDK version used. Thank you! Link to comment
qwert_e Posted March 22, 2019 Author Share Posted March 22, 2019 (edited) Yes, same sequence. How can i send you my test project? UPD: problem is only in debug version Here is its config Edited March 22, 2019 by qwert_e Link to comment
fox Posted March 22, 2019 Share Posted March 22, 2019 You can either attach an archive here, or send it in a private message. Thank you! Link to comment
fox Posted March 22, 2019 Share Posted March 22, 2019 Message received! Thank you, I'll notify you of the results! Link to comment
fox Posted March 28, 2019 Share Posted March 28, 2019 Hi qwert_e, This behavior is due to a bug. It was added to our internal bugtracker, and will be fixed in future releases. Sorry for the inconvenience caused. Thank you! Link to comment
Recommended Posts