Creating new Expresso result node?
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 31/08/2008 at 13:02, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 10.5
Platform: Mac OSX ;
Language(s) : C++ ; XPRESSO ;---------
I would like to write my own XPresso result node, adding further data "types" to the list. Is there a documented way to do this?Is there any XPresso node plugin code available?
Thanks!
Kabe
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 31/08/2008 at 15:15, xxxxxxxx wrote:
Hi Kabe
How are you? The class GvOperatorData should do that for you.
Override the methods and register this class to get your own node.
Here is an example:
*click*Search keyword: GvOperatorData
In the SDK you find an example to create custom datatypes - take a look
Bye...
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 01/09/2008 at 00:52, xxxxxxxx wrote:
Here is the source of Cinema's Result node, hope this helps:
>
\> #include "gvresult.h" \> \> class GvResultOperator : public GvOperatorData \> { \> INSTANCEOF(GvResultOperator,GvOperatorData) \> \> private: \> String result; \> GvDynamicData data; \> GvValue\* v1; \> \> private: \> GvResultOperator(void); \> virtual ~GvResultOperator(void); \> \> public: \> \> virtual const String GetDetailedText(GvNode \*bn); \> virtual const String GetText(GvNode \*bn); \> \> virtual Bool iCreateOperator(GvNode \*bn); \> virtual Bool iGetPortDescription(GvNode \*bn, GvPortIO port, LONG id, GvPortDescription \*pd); \> \> virtual Bool AddToCalculationTable(GvNode \*bn, GvRun \*r); \> \> virtual Bool InitCalculation(GvNode \*bn, GvCalc \*c, GvRun \*r); \> virtual void FreeCalculation(GvNode \*bn, GvCalc \*c); \> virtual Bool Calculate(GvNode \*bn, GvPort \*port, GvRun \*r, GvCalc \*c); \> \> virtual Bool SetDParameter(GeListNode \*node, const DescID &id;,const GeData &t;\_data,LONG &flags;); \> virtual Bool GetDDescription(GeListNode \*node,Description \*description,LONG &flags;); \> \> static NodeData\* Alloc(void) { return gNew GvResultOperator; } \> \> }; \> \> //////////////////////////////// \>
>
\> #include "operators.h" \> #include "gv_result_operator.h" \> #include "lib_description.h" \> \> //////////////////////////////// \> \> GvResultOperator::GvResultOperator(void) \> { \> \> } \> \> GvResultOperator::~GvResultOperator(void) \> { \> \> } \> \> //////////////////////////////// \> \> Bool GvResultOperator::iCreateOperator(GvNode \*bn) \> { \> bn->SetShowPortNamesState(FALSE); \> BaseContainer \*bc = bn->GetOpContainerInstance(); if (!bc) return FALSE; \> bc->SetLong(GV_DYNAMIC_DATATYPE,ID_GV_DATA_TYPE_REAL); \> return SUPER::iCreateOperator(bn); \> } \> \> const String GvResultOperator::GetDetailedText(GvNode \*bn) \> { \> return GvGetOperatorDetailedText(this,bn); \> } \> \> const String GvResultOperator::GetText(GvNode \*bn) \> { \> return result; \> } \> \> //////////////////////////////// \> \> Bool GvResultOperator::iGetPortDescription(GvNode \*bn, GvPortIO port, LONG id, GvPortDescription \*pd) \> { \> if (!SUPER::iGetPortDescription(bn,port,id,pd)) return FALSE; \> \> GvDataInfo \*info = GvGetDataInfo(bn,GV_DYNAMIC_DATATYPE); \> if (!info) return FALSE; \> \> switch (id) \> { \> case GV_RESULT_INPUT: \> case GV_RESULT_OUTPUT: \> pd->data_id = info->data_handler->data_id; \> break; \> } \> return TRUE; \> } \> \> //////////////////////////////// \> \> Bool GvResultOperator::SetDParameter(GeListNode \*node, const DescID &id;,const GeData &t;\_data,LONG &flags;) \> { \> if (!SUPER::SetDParameter(node,id,t_data,flags)) return FALSE; \> \> switch (id[0].id) \> { \> case GV_DYNAMIC_DATATYPE: \> { \> GvNode \*bn = (GvNode\* )node; \> \> if (!GvCheckDataInfo(bn,GV_DYNAMIC_DATATYPE)) return FALSE; \> if (!bn->SetPortType(bn->GetInPort(0),GV_RESULT_INPUT)) return FALSE; \> if (!bn->SetPortType(bn->GetOutPort(0),GV_RESULT_OUTPUT)) return FALSE; \> } \> break; \> } \> return TRUE; \> } \> \> Bool GvResultOperator::GetDDescription(GeListNode \*node,Description \*description,LONG &flags;) \> { \> if (!SUPER::GetDDescription(node,description,flags)) return FALSE; \> \> if (flags & DESCFLAGS_DESC_LOADED) \> { \> BaseContainer \*bc = description->GetParameterI(DescLevel(GV_DYNAMIC_DATATYPE),NULL); \> if (bc) \> { \> BaseContainer types; \> GvGetWorld()->GetDataTypes(types,GV_DATA_OPTIONS_NONE,GV_CALC_STR); \> bc->SetData(DESC_CYCLE,types); \> } \> } \> return TRUE; \> } \> \> //////////////////////////////// \> \> Bool GvResultOperator::AddToCalculationTable(GvNode \*bn, GvRun \*r) \> { \> return r->AddNodeToCalculationTable(bn); \> } \> \> Bool GvResultOperator::InitCalculation(GvNode \*bn, GvCalc \*c, GvRun \*r) \> { \> v1 = bn->AllocCalculationHandler(GV_RESULT_INPUT,c,r,0); if (!v1) return FALSE; \> return GvAllocDynamicData(bn,data,c,GV_DYNAMIC_DATATYPE); \> } \> \> void GvResultOperator::FreeCalculation(GvNode \*bn, GvCalc \*c) \> { \> bn->FreeCalculationHandler(v1); \> GvFreeDynamicData(data); \> } \> \> Bool GvResultOperator::Calculate(GvNode \*bn, GvPort \*port, GvRun \*r, GvCalc \*c) \> { \> if (!v1->Calculate(bn,GV_PORT_INPUT,r,c)) return FALSE; \> if (!v1->GetPort()->CalculateRawData(NULL,&result;,r,GV_CALC_STR)) return FALSE; \> \> return bn->GetOutPort(0)->CopyPortData(v1->GetPort(),r); \> } \> \> //////////////////////////////// \>
Also don't forget to check the description files (gvresult.res, gvresult.h, gvresult.str) for the node's interface description.
cheers,
Matthias -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 02/09/2008 at 11:23, xxxxxxxx wrote:
Thanks a million!
Kabe