Dialog Resource File not loading
-
On 16/06/2015 at 11:08, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R16
Platform: Mac OSX ;
Language(s) : C++ ;---------
Hi,I'm working on a commandData plugin.
I first copied a commandDataplugin as example, and tried to modify it, but I had some weird problems with the dialog resource files.
So now I started from scratch, and I copied (and edited) everything that I needed.The problem is: my resource file won't load.
Here is my code:
// c4d_symbols.h enum { // string table definitions IDS_COPYPOSITIONMANAGER = 10000, IDD_COPYPOSITIONMANAGER, // End of symbol definition _DUMMY_ELEMENT_ }; // c4d_strings.str STRINGTABLE { IDS_COPYPOSITIONMANAGER "Copy Position Manager"; } // copypositionmanager.res DIALOG COPYPOSITIONMANAGER { NAME IDS_COPYPOSITIONMANAGER; CENTER_H; WINDOWPIN POSITION_WINDOW { ALIGN_LEFT; } SEPARATOR { SCALE_H; } GROUP { COLUMNS 7; SCALE_H; SCALE_V; GROUP { BUTTON GET_POSITION { NAME GET; } } } DLGGROUP { OK; CANCEL; } } // copypositionmanager.str DIALOGSTRINGS COPYPOSITIONMANAGER { IDS_COPYPOSITIONMANAGER "Position Manager"; POSITION_WINDOW "Position Manager Window"; GET "GET"; } // copyposition.h #ifndef ID_COPYPOSITIONMANAGER #define ID_COPYPOSITIONMANAGER 1000001 #endif class PositionDialog : public GeDialog { private: BaseObject* op; public: PositionDialog(void); virtual ~PositionDialog(void); virtual Bool CreateLayout(void); virtual Bool InitValues(void); virtual Bool Command(Int32 id, const BaseContainer &msg); virtual Bool AskClose(void); }; class CopyPositionManager : public CommandData { private: PositionDialog dlg; public: virtual Bool Execute(BaseDocument *doc); virtual Int32 GetState(BaseDocument *doc); }; // copyposition.cpp #include "c4d.h" #include "c4d_symbols.h" #include "copyposition.h" PositionDialog::PositionDialog(void) { } PositionDialog::~PositionDialog(void) { } Bool PositionDialog::CreateLayout(void) { Bool result = true; GeDialog::CreateLayout(); GeResource dlg_res; dlg_res.Init(); result = LoadDialogResource(IDD_COPYPOSITIONMANAGER, &dlg_res, 0); if (!result) GePrint("The Copy Manager resource file could not be loaded"); return result; } Bool PositionDialog::InitValues(void) { BaseDocument *doc = GetActiveDocument(); if (!GeDialog::InitValues()) return false; return true; } Bool PositionDialog::Command(Int32 id, const BaseContainer &msg) { switch (id) { } return true; } Bool PositionDialog::AskClose(void) { return false; } //##################################################// Bool CopyPositionManager::Execute(BaseDocument *doc) { return dlg.Open(DLG_TYPE_MODAL_RESIZEABLE, ID_COPYPOSITIONMANAGER); } Int32 CopyPositionManager::GetState(BaseDocument *doc) { return CMD_ENABLED; } Bool RegisterCopyPositionManager(void) { return RegisterCommandPlugin(ID_COPYPOSITIONMANAGER, GeLoadString(IDS_COPYPOSITIONMANAGER), 0, nullptr, "Copy Position Manager", NewObjClear(CopyPositionManager)); }
My main.h and main.cpp files are the same as the SDK example (except for other register-methods) and inside main.cpp I added:
C4D_CrashHandler old_handler; void SDKCrashHandler(Char* crashinfo) { if (old_handler) (*old_handler)(crashinfo); }
That last bit of code was just copied from my example.
Can anybody, with this information, see what could be the problem here?
It's very annoying, because this is the only thing between a perfect working plugin and the thing I have now. :sThanks in advance for your help and time!!
With kind regards,
Casimir Smets -
On 17/06/2015 at 06:40, xxxxxxxx wrote:
Hello,
is this thread related to the same topic as in your previous thread?
If so, can the other thread be closed?
Best wishes,
Sebastian -
On 30/06/2015 at 07:01, xxxxxxxx wrote:
Hi Sebastian,
This thread indeed is related to my previous thread, but I'd rather close this thread, and add a link in the other thread to my code.
Thanks for your help and time!
Greetings,
Casimir Smets