SceneSaver - before save dialog
-
On 13/05/2013 at 21:10, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 12
Platform: Mac ;
Language(s) : C++ ;---------
My SceneSaver plugin requires one object to be selected to work correctly. At the moment this is handled through the FILEERROR return value (nothing gets saved and there is an error message in the Console). I'd rather have the user alerted right after the Export menu entry is selected. Is there a way to do this?Peter
-
On 14/05/2013 at 04:16, xxxxxxxx wrote:
See when Init() is called (NodeData from which SceneSaverData is derived). If it is only called when the plugin is about to save with Save(), then you could check there instead and abort the Save() call by setting a flag member variable (Bool for instance).
class MyPlugin : SceneSaverData { Bool abortSave; }; /// Bool MyPlugin::Init(GeListNode* node) { ... BaseDocument* doc = node->GetDocument(); if (!doc) return FALSE; abortSave = (doc->GetActiveObject())?FALSE:TRUE; return TRUE; } FILEERROR MyPlugin::Save(...) { if (abortSave) return FILEERROR_USERBREAK; // or something more appropriate (?) ... }
No idea if this would help or work. First check where Init() is called (print to the Console if needed) then see what happens with the code above added to your existing code.
-
On 15/05/2013 at 21:22, xxxxxxxx wrote:
Hi Robert
It seems I only get to MyPlugin::Save after the file dialog. I don't see a way to intercept the dialog. Maybe one of these two is possible:- return a custom FILEERROR which C4D would show in a dialog or
- instead of sending a message to the Console show some sort of dialog?
So that at east the user knows why it didn't work.