On 28/04/2016 at 15:30, xxxxxxxx wrote:
Cinema 4D Version: R16
Platform: Mac ;
Language(s) : C++ ;
Hello, I have a GeDialog plugin and I'm trying to make it so when it's saved to a Layout with Save as Startup Layer for example, that certain parameters are saved are saved to the Layout. The parameters control the appearance of the dialog so if they aren't saved and loaded as well then it looks different.
I noticed BFM_LAYOUT_SETDATA and BFM_LAYOUT_GETDATA but I couldn't get anything from either of them. Thank you for any help.
On 28/04/2016 at 16:24, xxxxxxxx wrote:
One possible solution is to save the appearance information to the World Plugin Data Container (using a unique plugin ID for reference) and load similarly. See GetWorldPluginData() and SetWorldPluginData(). These set and get plugin-specific information stored globally to the Cinema 4D Preferences.
On 28/04/2016 at 19:43, xxxxxxxx wrote:
Another solution would be to store the information in a SceneHook so that the dialog information is per scene.
On 29/04/2016 at 00:38, xxxxxxxx wrote:
As you've already find out, to store per-layout data for your dialog use BFM_LAYOUT_SETDATA and BFM_LAYOUT_GETDATA messages. Let see how they have to be used.
For instance in the ActiveObjectDialog example of cinema4dsdk we could save the "Lock Element"checkbox status (stored in the dialog class as lock member):
Bool ActiveObjectDialog::Message(const BaseContainer& msg, BaseContainer& result)
case BFM_LAYOUT_SETDATA: // Called when a new layout is set
// Retrieve layout data to set with the message ID
const BaseContainer *bc = msg.GetContainerInstance(BFM_LAYOUT_SETDATA);
// Obtain dialog layout container with the unique ID of the plugin
const BaseContainer* data = bc->GetContainerInstance(ID_ACTIVEOBJECT);
lock = data->GetBool(0);
case BFM_LAYOUT_GETDATA: // Called when a layout is saved
// Setup dialog layout container
// result container has to be initialized with ID 0
result = BaseContainer(0);
// Set dialog layout container with the unique ID of the plugin
return GeDialog::Message(msg, result);
// Lock Element checkbox has to be initialized here
// Otherwise saved layout data isn't reflected
On 03/05/2016 at 10:15, xxxxxxxx wrote:
Thanks you for the responses.
I have your method working Yannick, thank you.
Robert, I had seen you mention those functions in a different post before. My understanding of them is that they're completely global, so they work for having new set parameters for the plugin across the board. If I only wanted this parameter to be different when loaded from a layout that it was saved with I'd want to go with Yannick's method correct?