rohit.gonsalves Posted July 6, 2020 Share Posted July 6, 2020 (edited) Hello there, To add property callback I have changed the ComponentSystem.h as follows. ComponentVariable class and added two getter. class ComponentVariable { public: ComponentVariable() = default; ComponentVariable(PropertyWrapper *component, const char *name, int type, const char *title, const char *tooltip, const char *group); virtual ~ComponentVariable(); UNIGINE_INLINE int getID() const { return parameter->getID(); } UNIGINE_INLINE const char* getName() const { return name.get(); } UNIGINE_INLINE int getType() const { return type; } const char *getTypeName() const; UNIGINE_INLINE virtual Unigine::String getValueAsString() { return Unigine::String::null; } UNIGINE_INLINE virtual int nullCheck() { return 0; } /*********** [2020-07-06][Rohit Gonsalves][Added this getter to access property and PropertyParameter in Componment] **************/ UNIGINE_INLINE PropertyWrapper* getPropertyWrapper() const { return holder; } UNIGINE_INLINE PropertyParameterPtr getPropertyParameter() const { return parameter; } /*********** [2020-07-06][Rohit Gonsalves][Added this getter to access property and PropertyParameter in Componment] **************/ virtual void save(const Unigine::XmlPtr ¶meter); virtual void setParameter(const Unigine::PropertyParameterPtr ¶m); protected: int is_type_name(const char *name) const; PropertyWrapper *holder; Unigine::PropertyParameterPtr parameter; Unigine::String name; Unigine::String title; Unigine::String tooltip; Unigine::String group; int type; }; In my component header I have, PROP_PARAM(Switch, color_precision, 0, "YUV8,YUV10,RGBA8,RGB10", "Color Precision", "Digital Bit depth of colors", "General"); Now, In my Component Init, void CAroBMDDecklinkOutput::init() { PropertyPtr property = color_precision.getPropertyWrapper()->property; property->addCallback(Property::CALLBACK_PARAMETER_CHANGED, MakeCallback(this, &CAroBMDDecklinkOutput::parameter_changed)); } void CAroBMDDecklinkOutput::parameter_changed(PropertyPtr _objProperty, int _iNum) { Log::message("Parameter \"%s\" of the property \"%s\" has changed its value.\n", _objProperty->getParameterPtr(_iNum)->getName(), _objProperty->getName()); } Works as Expected. If I change the property, I get the callback and I am happy to receive it. But when I click on Reset button, There is a crash. Probably on Reset, only run is called with single argument than the two. Property and num. Regards, Rohit Edited July 6, 2020 by rohit.gonsalves Link to comment
rohit.gonsalves Posted July 8, 2020 Author Share Posted July 8, 2020 Did you able to reproduce it? Please suggest. Regards, Rohit Link to comment
alexander Posted July 8, 2020 Share Posted July 8, 2020 Hi Rohit, But when I click on Reset buttonWhat is the "Reset" button? Best regards, Alexander Link to comment
alexander Posted July 8, 2020 Share Posted July 8, 2020 PropertyPtr property = color_precision.getPropertyWrapper()->property; You don't need to do this. Component already has the "property" variable: void CAroBMDDecklinkOutput::init() { property->addCallback(Property::CALLBACK_PARAMETER_CHANGED, MakeCallback(this, &CAroBMDDecklinkOutput::parameter_changed)); } 1 Link to comment
rohit.gonsalves Posted July 8, 2020 Author Share Posted July 8, 2020 (edited) Thanks Alexander for getting rid of that change I put. I can directly access it. I got confused with many classes in-between. Thanks for this. But the crash is still there. Here is the parameter reset button. Otherwise what you call it? Regards, Rohit Edited July 8, 2020 by rohit.gonsalves Put smaller Image to understand it better. Link to comment
rohit.gonsalves Posted July 9, 2020 Author Share Posted July 9, 2020 @alexander, Do you able to reproduce this at your end? Regards, Rohit Link to comment
morbid Posted July 9, 2020 Share Posted July 9, 2020 Rohit, I'm sorry but due to the release delivery answer might take a bit longer than usual. 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
rohit.gonsalves Posted July 9, 2020 Author Share Posted July 9, 2020 Dear Morbid, No worries. Patience is all here. All the best for new release. Just pointed out this, probably you would consider for hot fix later. Regards, Rohit Link to comment
moroz Posted July 28, 2020 Share Posted July 28, 2020 Hi! Can you send source example and describe how you connect your logic to editor? Link to comment
rohit.gonsalves Posted July 28, 2020 Author Share Posted July 28, 2020 @moroz, This particular question is becoming so interesting to me. I know why did you ask for example? I thought, my implementation is normal but after your question, I try to do it the simpler way and it is not possible to have it without Plugin. So thankful for this question of yours. Please find the Comp_Prop project attached. I have written another project in the source, compdemo. Steps to follow. Please recreate the engine files after downloading the project. (Add the project and reconfigure it. I think just say Update Configuration without changing anything. Open it in editor once. Close it. Open the comp_prop.sln. Setup compdemo as the startup project and run the application. You will have one property created by component. color_producer.prop Assign this property to any node. Change the property of texture dimension and color. Check the console window. As soon as you hit reset button. It will crash (in Debug.) By the way, Moroz, When I prepared this sample for you. I have created debug as well as release configurations. Surprisingly, in Debug, the editor crashes with a respective error. and in the release, everything works just fine. This is today's invention. :-) I hope this sample will help to check and understand everything. Regards, Rohit Comp_Prop.zip Link to comment
moroz Posted July 29, 2020 Share Posted July 29, 2020 I have checked this crash. It occures because of bug in PropertyParameter::resetValue(), we will fix it. 1 Link to comment
rohit.gonsalves Posted July 29, 2020 Author Share Posted July 29, 2020 Dear @moroz, Thanks for the update. Rohit Link to comment
Recommended Posts