Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 08/12/2010 at 02:25, xxxxxxxx wrote:
User Information: Cinema 4D Version: 12 Platform: Windows ; Language(s) : C++ ;
--------- Dev. System: Visual C++ 2008 Express Edition.
When compiling our Project we get some errors.
Can anybody help us ??
Here is the source:
#include "c4d.h"
class ButtonAData : public CommandData {
public: virtual Bool Execute (BaseDocument *doc); virtual LONG GetState(BaseDocument *doc); virtual Bool RestoreLayout (void* secret); virtual void Message (const BaseContainer& msg); };
LONG ButtonAData::GetState(BaseDocument *doc) { return CMD_ENABLED; }
Bool ButtonAData::RestoreLayout (void* secret) { return TRUE; }
void ButtonAData::Message (const BaseContainer& msg) {
}
void LoopThroughObjects(BaseObject *bobj, BaseObject *altD, BaseObject *altN, BaseDocument *bdoc, AliasTrans *T) { while (bobj) { BaseObject *obj=(BaseObject* )bobj->GetClone(COPYFLAGS_NO_HIERARCHY, T); bdoc->InsertObject(obj, altD, altN, FALSE); altN=obj; altD=NULL; bdoc->AddUndo(UNDOTYPE_NEW, obj); if (bobj->GetDown()) altD=obj; LoopThroughObjects(bobj->GetDown(), altD, NULL, bdoc, T); bobj=bobj->GetNext(); } }
Bool ButtonAData::Execute(BaseDocument *doc) { LONG i; CHAR *Einer=NULL; String Inhalt=""; BaseDocument* LoadScene=NULL; BaseMaterial *material, *cmat; StopAllThreads(); AutoAlloc<BaseFile> SceneAPref; Filename Fname=Filename(GeGetPluginPath()+Filename("SceneRef.prf")); if (SceneAPref->Open(Fname, FILEOPEN_READ, FILEDIALOG_NONE)) { Einer = ( CHAR * )GeAlloc( sizeof (CHAR)*300); for (i=0; i<300; i++) { if (SceneAPref->ReadChar(Einer) && i>3) Inhalt+=String(Einer); } GeFree(Einer); if (Inhalt!="") { Fname.SetString(Inhalt); LoadScene=LoadDocument(Fname, SCENEFILTER_OBJECTS | SCENEFILTER_MATERIALS, NULL); if (LoadScene) { AutoAlloc <AliasTrans> trans; if (!trans || !trans->Init(LoadScene)) return FALSE; doc->StartUndo(); material = LoadScene->GetFirstMaterial(); while (material) { cmat = (BaseMaterial* )material->GetClone(COPYFLAGS_0, trans); doc->InsertMaterial(cmat, NULL, TRUE); doc->AddUndo(UNDOTYPE_NEW, cmat); material=material->GetNext(); } doc->EndUndo(); doc->StartUndo(); LoopThroughObjects (LoadScene->GetFirstObject(), NULL, NULL, doc, trans); doc->EndUndo(); EventAdd(); KillDocument(LoadScene); LoadScene=NULL; } } } return TRUE; }
#define ID_BUTA 1017169
Bool RegisterButtonACommand(void) { return RegisterCommandPlugin(ID_BUTA,"Scene Loader A",0,AutoBitmap("ButtonA.tif"),String("Scene Loader A"),gNew ButtonAData); }
We get these Results:
1>c:\program files\maxon\cinema 4d r12\plugins\cinema4dsdk\source ool\buttona.cpp(11) : warning C4263: 'LONG ButtonAData::Message(const BaseContainer &,BaseContainer &)': Memberfunktion überschreibt keine virtuelle Memberfunktion einer Basisklasse 1>c:\program files\maxon\cinema 4d r12\plugins\cinema4dsdk\source ool\buttona.cpp(12) : error C4264: 'Bool CommandData::Message(LONG,void * )': Keine Überschreibung für virtuelle Memberfunktion der Basis 'CommandData' verfügbar; die Funktion wird ausgeblendet 1> c:\.....\c4d_commanddata.h(47) : Siehe Deklaration von 'CommandData::Message' 1> c:\.....\c4d_commanddata.h(35) : Siehe Deklaration von 'CommandData' 1>c:\.....\source ool\buttona.cpp(25) : error C2511: 'void ButtonAData::Message(const BaseContainer &)': Überladene Memberfunktion nicht in 'ButtonAData' gefunden 1> c:\.....\source ool\buttona.cpp(3) : Siehe Deklaration von 'ButtonAData'
Thanks for any help
Ronald
On 08/12/2010 at 02:59, xxxxxxxx wrote:
Please have a look at the declaration for CommandData::Message. Your declaration doesn't match the one of CommandData.
It should be:
virtual Bool Message(LONG type, void* data);
cheers, Matthias
On 08/12/2010 at 05:57, xxxxxxxx wrote:
Thank you for your quick answer.
I could not interpret your answer. Could you please be so kind and korrekt the line(s) in my Code.
Thank 1000 times
On 09/12/2010 at 02:21, xxxxxxxx wrote:
Since you are not doing anything in CommandData::Message you simply can remove it from the class (declaration and defintion).