PluginMaterial & undo problems
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 01/12/2010 at 04:35, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R11
Platform:
Language(s) : C++ ;---------
I've got a small problem with the material plugin I'm writing. The plugin loads a text file which contains details used to create the description for the plugin. These details are loaded into a data structure which is a member of the plugin class. GetDDescription() uses this structure to build the interface, adding description elements as necessary.This all works fine. However, if the user changes a value in the interface (such as a Real slider) and then hits undo, the description disappears. Tracing this through shows that the class constructor is being called whenever undo is hit, which automatically initialises the data structure - so of course there's nothing for GetDDescription to use to create the interface.
Ideally what I need is a data structure which isn't initialised by the class constructor. I've tried the structure as a static member variable and as a global variable, but all I get is linker errors or (if it does link) the plugin doesn't appear in the material manager.
Does anyone have any suggestions about how I could preserve the loaded data between calls to the plugin class constructor? If I could do that, the interface would be recreated after the constructor was called.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 01/12/2010 at 06:53, xxxxxxxx wrote:
Make sure to overload Read/Write/Copy if a data structure is not stored in the materials container.
cheers,
Matthias -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 01/12/2010 at 08:11, xxxxxxxx wrote:
Thanks Matthias. I'm a bit confused though. Aren't Read & Write only required when a file is loaded/saved? My problem isn't when loading and saving, those work fine - the data in the structure is transferred into the container when the description is created, so it shouldn't be necessary to overload those functions.
Unless I've completely misunderstood (quite possible!)?