Salut,
Je me suis fait une nouvelle installation du système avec Win 7, C4D R13 à R17 et Visual Studio Express 2013 pour me renouer avec le C++.
Je n'ai eu aucun soucis à compiler les exemples du SDK de la R17 du premier coup après avoir tout installé (miracle), ni même mon nouveau module qui utilise la base de l'exemple Oatom, en suivant cette doc : https://developers.maxon.net/?p=81 .
Il apparaît bien dans C4D, génère bien un cube, mais on dirait que le fichier res de la description n'est pas chargé, ni le titre de l'objet qui se trouve dans c4d_strings.
En Python ça marchait très bien, mais là, j'ai juste l'icône de l'objet, pourtant j'ai bien mis le bon nom dans l'attribut description de RegisterObjectPlugin, je pige pas.
C'est sûrement une erreur toute bête mais je trouve pas.
Voici comment se présente mon projet dans Visual Studio :
Ce que j'ai dans C4D, seul le code fonctionne bien, pas de description ni de nom :
Les fichiers sources :
main.h
Code PHP:
#ifndef MAIN_H__
#define MAIN_H__
Bool EnregistreProc3Durale(void);
#endif // MAIN_H__
main.cpp
Code PHP:
#include "c4d.h"
#include "main.h"
Bool PluginStart(void)
{
if (!EnregistreProc3Durale())
return false;
return true;
}
void PluginEnd(void)
{
}
Bool PluginMessage(Int32 id, void *data)
{
return false;
}
vonc_proc3durale.cpp
Code PHP:
#include "c4d.h"
#include "c4d_symbols.h"
#include "vonc_proc3durale.h"
#include "main.h"
class Proc3DuraleObjet : public ObjectData
{
public:
virtual Bool Init(GeListNode* node);
virtual BaseObject* GetVirtualObjects(BaseObject* op, HierarchyHelp* hh);
virtual Bool Message(GeListNode* node, Int32 type, void* t_data);
static NodeData* Alloc(void) { return NewObjClear(Proc3DuraleObjet); }
};
Bool Proc3DuraleObjet::Init(GeListNode* node)
{
//BaseObject* op = (BaseObject*)node;
//BaseContainer* data = op->GetDataInstance();
return true;
}
Bool Proc3DuraleObjet::Message(GeListNode* node, Int32 type, void* t_data)
{
if (type == MSG_DESCRIPTION_VALIDATE) {
BaseContainer* data = ((BaseObject*)node)->GetDataInstance();
}
return true;
}
BaseObject* Proc3DuraleObjet::GetVirtualObjects(BaseObject* op, HierarchyHelp* hh)
{
BaseObject* orig = op->GetDown();
if (!orig) return nullptr;
Bool dirty = false;
BaseObject* main = nullptr, *res = op->GetAndCheckHierarchyClone(hh, orig, HIERARCHYCLONEFLAGS_ASPOLY, &dirty, nullptr, false);
if (!dirty) return res;
if (!res) return nullptr;
main = BaseObject::Alloc(Ocube);
if (!main) goto error;
blDelete(res);
return main;
error:
blDelete(res);
blDelete(main);
return nullptr;
}
#define MODULE_ID 1035788
//----------------------------------------------------------------------------------------
/// Plugin help support callback. Can be used to display context sensitive help when the
/// user selects "Show Help" for an object or attribute. <B>Only return true for your own
/// object types</B>. All names are always uppercase.
/// @param[in] opType Object type name, for example "OATOM".
/// @param[in] baseType Name of base object type that opType is derived from, usually the same as opType.
/// @param[in] group Name of group in the attribute manager, for example "ID_OBJECTPROPERTIES".
/// @param[in] property Name of the object property, for example "ATOMOBJECT_SINGLE";
/// @return True if the plugin can display help for this request.
//----------------------------------------------------------------------------------------
static Bool Proc3DuraleAide(const String& opType, const String& baseType, const String& group, const String& property)
{
// Make sure that your object type name is unique and only return true if this is really your object type name and you are able to present a decent help.
if (opType == "vonc_proc3durale") {
GeOutString("If you implement custom object help, please use something better than GeOutString.", GEMB_OK);
return true;
}
else {
// You might handle more than one of your object/command/plugin types in one delegate ...
}
return false;
}
Bool EnregistreProc3Durale(void)
{
if (RegisterPluginHelpDelegate(MODULE_ID, Proc3DuraleAide) == false) return false;
return RegisterObjectPlugin(MODULE_ID, GeLoadString(VONC_PROC3DURALE_NOM), OBJECT_GENERATOR | OBJECT_INPUT, Proc3DuraleObjet::Alloc, "vonc_proc3durale", AutoBitmap("vonc_proc3durale.tif"), 0);
}
res/c4d_symbols.h
Code PHP:
enum
{
VONC_PROC3DURALE_NOM = 1000,
_DUMMY_ELEMENT_
};
res/strings_fr/c4d_strings.str
Code PHP:
STRINGTABLE
{
VONC_PROC3DURALE_NOM "Proc3Durale 2";
}
res/strings_fr/description/vonc_proc3durale.str
Code PHP:
STRINGTABLE vonc_proc3durale
{
vonc_proc3durale "Proc3Durale 2";
VONC_PROC3DURALE_PREC "Subdivision (Vue)";
VONC_PROC3DURALE_MAT "Mati_re";
VONC_PROC3DURALE_PRECR "Subdivision (Rendu)";
VONC_PROC3DURALE_BORDS "Bordures";
VONC_PROC3DURALE_LISSAGE "Lisser";
VONC_PROC3DURALE_LISSITE "It_rations";
VONC_PROC3DURALE_LUMI "Luminosit_";
VONC_PROC3DURALE_INV "Inverser";
VONC_PROC3DURALE_BORIG "Rigidit_ des bordures";
VONC_PROC3DURALE_BORPHONG "Cassure Phong des bordures";
VONC_PROC3DURALE_TAILLE "Taille";
VONC_PROC3DURALE_DECALAGE "D_calage";
VONC_PROC3DURALE_ECHELLE "_chelle";
VONC_PROC3DURALE_ANIME "Anim_";
VONC_PROC3DURALE_MAJAUTO "Actualisation auto";
VONC_PROC3DURALE_MAJ "Actualiser";
}
res/description/vonc_proc3durale.h
Code PHP:
#ifndef _vonc_proc3durale_H_
#define _vonc_proc3durale_H_
enum
{
VONC_PROC3DURALE_PREC = 1000,
VONC_PROC3DURALE_MAT = 1001,
VONC_PROC3DURALE_PRECR = 1002,
VONC_PROC3DURALE_BORDS = 1003,
VONC_PROC3DURALE_LISSAGE = 1004,
VONC_PROC3DURALE_LISSITE = 1005,
VONC_PROC3DURALE_LUMI = 1006,
VONC_PROC3DURALE_INV = 1007,
VONC_PROC3DURALE_BORIG = 1008,
VONC_PROC3DURALE_BORPHONG = 1009,
VONC_PROC3DURALE_TAILLE = 1010,
VONC_PROC3DURALE_DECALAGE = 1011,
VONC_PROC3DURALE_ECHELLE = 1012,
VONC_PROC3DURALE_ANIME = 1013,
VONC_PROC3DURALE_MAJAUTO = 1014,
VONC_PROC3DURALE_MAJ = 1015
};
#endif
res/description/vonc_proc3durale.res
Code PHP:
CONTAINER vonc_proc3durale
{
NAME vonc_proc3durale;
INCLUDE Obase;
GROUP ID_OBJECTPROPERTIES
{
VECTOR VONC_PROC3DURALE_TAILLE { UNIT METER; }
VECTOR VONC_PROC3DURALE_DECALAGE { UNIT METER; }
VECTOR VONC_PROC3DURALE_ECHELLE { UNIT PERCENT; }
SEPARATOR { LINE; }
REAL VONC_PROC3DURALE_PREC { UNIT METER; MIN 1.0; }
REAL VONC_PROC3DURALE_PRECR { UNIT METER; MIN 1.0; }
SEPARATOR { LINE; }
GROUP {
COLUMNS 3;
BUTTON VONC_PROC3DURALE_MAJ { }
BOOL VONC_PROC3DURALE_MAJAUTO { }
BOOL VONC_PROC3DURALE_ANIME { }
}
SEPARATOR { LINE; }
REAL VONC_PROC3DURALE_LUMI { UNIT PERCENT; MIN -100.0; MAX 100.0; STEP 1.0; CUSTOMGUI REALSLIDER; }
BOOL VONC_PROC3DURALE_INV { }
SEPARATOR { LINE; }
BOOL VONC_PROC3DURALE_BORDS { }
BOOL VONC_PROC3DURALE_BORPHONG { }
SEPARATOR { LINE; }
REAL VONC_PROC3DURALE_LISSAGE { UNIT PERCENT; MIN 0.0; MAX 100.0; STEP 1.0; CUSTOMGUI REALSLIDER; }
LONG VONC_PROC3DURALE_LISSITE { MIN 0; }
REAL VONC_PROC3DURALE_BORIG { UNIT PERCENT; MIN 0.0; MAX 100.0; STEP 1.0; CUSTOMGUI REALSLIDER; }
SEPARATOR { LINE; }
SEPARATOR { LINE; }
SHADERLINK VONC_PROC3DURALE_MAT { }
}
}