THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 12/02/2003 at 23:44, xxxxxxxx wrote:
Here's the code, what's the problem???
ErrorDialog.h
////////////////////////////////////////////////////////////////
// ErrorDialog.h
////////////////////////////////////////////////////////////////
// Error Modal Dialog class
////////////////////////////////////////////////////////////////
// V0.1 2003.02.13 Robert Templeton
////////////////////////////////////////////////////////////////
#ifndef _ERRORDIALOG_H_
#define _ERRORDIALOG_H_
// Error Dialog Types
#define ERROR_RESOURCE 0
#define ERROR_POSERNOTFOUND 1
#define ERROR_NOREADFILE 2
#define ERROR_NOWRITEFILE 3
#define ERROR_NOTACR2 4
#define ERROR_INVALIDFILE 5
#define ERROR_EOF 6
#define ERROR_NOOBJECTS 7
#define ERROR_GROUPFAIL 8
#define ERROR_LISTERROR 9
// CLASS: Error Dialog
class ErrorDialog : GeModalDialog
{
private:
INT errtype;
String errtext;
public:
ErrorDialog(INT etype, String etext);
Bool CreateLayout();
}
#endif //_ERRORDIALOG_H_
ErrorDialog.cpp
////////////////////////////////////////////////////////////////
// ErrorDialog.cpp
////////////////////////////////////////////////////////////////
// Error Modal Dialog class
////////////////////////////////////////////////////////////////
// V0.1 2003.02.13 Robert Templeton
////////////////////////////////////////////////////////////////
#include "c4d.h"
#include "c4d_symbols.h"
#include "ErrorDialog.h"
// METHODS: Error Dialog
// Constructor
ErrorDialog::ErrorDialog(INT etype, String etext)
{
errtype = etype;
errtext = etext;
}
// Layout Dialog GUI
Bool ErrorDialog::CreateLayout()
{
StatusSetText(GeLoadString(ERROR_STATUS_TEXT));
SetTitle(GeLoadString(ERROR_DIALOG_TITLE));
AddStaticText(4000,BFH_CENTER|BFV_CENTER,0,0,"",BORDER_NONE);
switch(errtype)
{
case ERROR_RESOURCE:
AddStaticText(4001,BFH_CENTER|BFV_CENTER,0,0, GeLoadString(ERROR_RESOURCE_TEXT),BORDER_NONE);
AddStaticText(4003,BFH_CENTER|BFV_CENTER,0,0,"",BORDER_NONE);
AddDlgGroup(DLG_OK);
break;
case ERROR_POSERNOTFOUND:
AddStaticText(4001,BFH_CENTER|BFV_CENTER,0,0,GeLoadString(ERROR_POSERNOTFOUND_TEXT1),BORDER_NONE);
AddStaticText(4002,BFH_CENTER|BFV_CENTER,0,0,GeLoadString(ERROR_POSERNOTFOUND_TEXT2),BORDER_NONE);
AddStaticText(4003,BFH_CENTER|BFV_CENTER,0,0,"",BORDER_NONE);
AddDlgGroup(DLG_OK|DLG_CANCEL);
break;
case ERROR_NOREADFILE:
AddStaticText(4001,BFH_CENTER|BFV_CENTER,0,0,GeLoadString(ERROR_NOREADFILE_TEXT),BORDER_NONE);
AddStaticText(4002,BFH_CENTER|BFV_CENTER,0,0,errtext,BORDER_NONE);
AddStaticText(4003,BFH_CENTER|BFV_CENTER,0,0,"",BORDER_NONE);
AddDlgGroup(DLG_OK);
break;
case ERROR_NOWRITEFILE:
AddStaticText(4001,BFH_CENTER|BFV_CENTER,0,0,GeLoadString(ERROR_NOWRITEFILE_TEXT),BORDER_NONE);
AddStaticText(4002,BFH_CENTER|BFV_CENTER,0,0,errtext,BORDER_NONE);
AddStaticText(4003,BFH_CENTER|BFV_CENTER,0,0,"",BORDER_NONE);
AddDlgGroup(DLG_OK);
break;
case ERROR_NOTACR2:
AddStaticText(4001,BFH_CENTER|BFV_CENTER,0,0,GeLoadString(ERROR_NOTACR2_TEXT1),BORDER_NONE);
AddStaticText(4002,BFH_CENTER|BFV_CENTER,0,0,GeLoadString(ERROR_NOTACR2_TEXT2),BORDER_NONE);
AddStaticText(4003,BFH_CENTER|BFV_CENTER,0,0,"",BORDER_NONE);
AddDlgGroup(DLG_OK|DLG_CANCEL);
break;
case ERROR_INVALIDFILE:
AddStaticText(4001,BFH_CENTER|BFV_CENTER,0,0,GeLoadString(ERROR_INVALIDFILE_TEXT),BORDER_NONE);
AddStaticText(4002,BFH_CENTER|BFV_CENTER,0,0,errtext,BORDER_NONE);
AddStaticText(4003,BFH_CENTER|BFV_CENTER,0,0,"",BORDER_NONE);
AddDlgGroup(DLG_OK);
break;
case ERROR_EOF:
AddStaticText(4001,BFH_CENTER|BFV_CENTER,0,0,GeLoadString(ERROR_EOF_TEXT),BORDER_NONE);
AddStaticText(4002,BFH_CENTER|BFV_CENTER,0,0,errtext,BORDER_NONE);
AddStaticText(4003,BFH_CENTER|BFV_CENTER,0,0,"",BORDER_NONE);
AddDlgGroup(DLG_OK);
break;
case ERROR_NOOBJECTS:
AddStaticText(4001,BFH_CENTER|BFV_CENTER,0,0,GeLoadString(ERROR_NOOBJECTS_TEXT),BORDER_NONE);
AddStaticText(4002,BFH_CENTER|BFV_CENTER,0,0,errtext,BORDER_NONE);
AddStaticText(4003,BFH_CENTER|BFV_CENTER,0,0,"",BORDER_NONE);
AddDlgGroup(DLG_OK);
break;
case ERROR_GROUPFAIL:
AddStaticText(4001,BFH_CENTER|BFV_CENTER,0,0,GeLoadString(ERROR_GROUPFAIL_TEXT),BORDER_NONE);
AddStaticText(4003,BFH_CENTER|BFV_CENTER,0,0,"",BORDER_NONE);
AddDlgGroup(DLG_OK);
break;
case ERROR_LISTERROR:
AddStaticText(4001,BFH_CENTER|BFV_CENTER,0,0,GeLoadString(ERROR_LISTERROR_TEXT),BORDER_NONE);
AddStaticText(4003,BFH_CENTER|BFV_CENTER,0,0,"",BORDER_NONE);
AddDlgGroup(DLG_OK);
break;
default:
break;
}
return TRUE;
}
PoserCR2Loader.cpp
////////////////////////////////////////////////////////////////
// PoserCR2Loader.cpp
////////////////////////////////////////////////////////////////
// Create a boned figure from the information
// contained within a Poser .cr2 file.
////////////////////////////////////////////////////////////////
// V0.1 2003.02.13 Robert Templeton
////////////////////////////////////////////////////////////////
// Includes
#include "c4d.h"
#include "c4d_symbols.h"
#include "ErrorDialog.h"
//#include "Config.h"
// CLASS: Poser CR2 Loader
class PoserCR2Loader : public CommandData
{
private:
//Config* configuration;
//PoserCharacter* character;
public:
virtual Bool Execute(BaseDocument* doc);
Bool CallErrorDialog(INT etype, String etext, Bool getresult);
void* CallErrorDialog_Null(INT etype, String extext);
};
Bool PoserCR2Loader::Execute(BaseDocument* doc)
{
StatusSetText(GeLoadString(IDS_PLUGIN_NAME));
CallErrorDialog(ERROR_EOF, "Hi!", FALSE);
// Create configuration storage and retrieve from/set to file
/*
configuration = new Config;
if((configuration != NULL) && configuration->SetPoserPath())
{
// Get .cr2 file and load/parse/cry
character = new PoserCharacter;
if(character != NULL)
character->Parse();
}
*/
StatusClear();
return (TRUE);
}
// Call Error Dialog returning Bool
Bool PoserCR2Loader::CallErrorDialog(INT etype, String etext, Bool getresult)
{
ErrorDialog* d;
if ((d = new ErrorDialog(etype, etext)) != NULL)
{
d->Open(-1,-1);
if (getresult) return d->GetResult();
}
else GePrint("Error creating Dialog");
return FALSE;
}
// Call Error Dialog returning NULL
void* PoserCR2Loader::CallErrorDialog_Null(INT etype, String etext)
{
ErrorDialog* d;
if ((d = new ErrorDialog(etype, etext)) != NULL) d->Open(-1,-1);
else GePrint("Error creating Dialog");
return NULL;
}
// Plugin Functions
Bool PluginStart()
{
PoserCR2Loader* poserCR2Loader = NULL;
// initialize global resource object
if (!resource.Init()) return FALSE;
// create new instance of PoserCR2Loader class
if ((poserCR2Loader = new PoserCR2Loader) == NULL)
{
GePrint(GeLoadString(IDS_PLUGIN_NAME) + ": "+GeLoadString(IDS_ERR_CONSTR));
return (FALSE);
}
// register hook and return
return (RegisterCommandPlugin(PLUGIN_ID, GeLoadString(IDS_PLUGIN_NAME), 0, "pluginicon.tif", GeLoadString(IDS_PLUGIN_DESCR), poserCR2Loader));
}
void PluginEnd()
{
}
Bool PluginMessage(LONG id, void* data)
{
return (FALSE);
}
There exists a "c4d_symbols.h" and "c4d_strings.str". Until I added the ErrorDialog code, it compiled well. Now it's nothing but these type of errors:
Compiling...
ErrorDialog.cpp
C:\Program Files\MAXON\CINEMA_4D_R8\Plugins\Kuroyume\PoserCR2Loader\source\ErrorDialog.cpp(16) : error C2143: syntax error : missing ';' before 'PCH creation point'
PoserCR2Loader.cpp
C:\Program Files\MAXON\CINEMA_4D_R8\Plugins\Kuroyume\PoserCR2Loader\source\PoserCR2Loader.cpp(18) : error C2143: syntax error : missing ';' before 'PCH creation point'
C:\Program Files\MAXON\CINEMA_4D_R8\Plugins\Kuroyume\PoserCR2Loader\source\PoserCR2Loader.cpp(52) : error C2248: 'Open' : cannot access public member declared in class 'GeModalDialog'
..\..\..\resource\_api\c4d_gui.h(436) : see declaration of 'Open'
C:\Program Files\MAXON\CINEMA_4D_R8\Plugins\Kuroyume\PoserCR2Loader\source\PoserCR2Loader.cpp(53) : error C2248: 'GetResult' : cannot access public member declared in class 'GeModalDialog'
..\..\..\resource\_api\c4d_gui.h(438) : see declaration of 'GetResult'
C:\Program Files\MAXON\CINEMA_4D_R8\Plugins\Kuroyume\PoserCR2Loader\source\PoserCR2Loader.cpp(62) : error C2248: 'Open' : cannot access public member declared in class 'GeModalDialog'
..\..\..\resource\_api\c4d_gui.h(436) : see declaration of 'Open'
Error executing cl.exe.
PoserCR2Loader.cdl - 5 error(s), 0 warning(s)
I can't fix errors like "syntax error : missing ';' before 'PCH creation point'" without knowing why they occur in this case. This is standard C++ practice to put the class definition into a header and the methods into a .cpp file, include the header in other .cpp files that need it (including the one containing the methods), and add the .cpp to the project.
If this is the incorrect approach, please feel free to demonstrate the proper way as I cannot seem to find one mentioned. There will be dozens of classes for this project, so I need to get a good understanding of what is expected.
Thanks,
Robert Templeton