THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 10/06/2008 at 02:21, xxxxxxxx wrote:
You have to use the GVGENERALOBJECT description type. Please have a look at the following example code. It's a node with an object input that prints the name of the object, much like the result node.
> \> CONTAINER print_node \> { \> NAME print_node; \> INCLUDE GVbase; \> \> GROUP ID_GVPROPERTIES \> { \> GVGENERALOBJECT PRINT_NODE_INPUT { INPORT; STATICPORT; CREATEPORT; } \> } \> } \>
> \> #ifndef \_print_node_H\_ \> #define \_print_node_H\_ \> \> enum \> { \> PRINT_NODE_INPUT = 2000, \> \> PRINT_NODE\_ \> }; \> \> #endif \>
> \> STRINGTABLE print_node \> { \> print_node "Print Node"; \> \> PRINT_NODE_INPUT "Input"; \> } \>
> \> #include "c4d.h" \> #include "c4d_operatordata.h" \> \> #include "print_node.h" \> \> \> class PrintNode : public GvOperatorData \> { \> INSTANCEOF(PrintNode,GvOperatorData) \> \> private: \> BaseList2D\* result; \> GvValue\* v1; \> \> public: \> \> virtual const String GetDetailedText(GvNode \*bn); \> virtual const String GetText(GvNode \*bn); \> \> virtual Bool iCreateOperator(GvNode \*bn); \> \> 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); \> \> static NodeData\* Alloc(void) { return gNew PrintNode; } \> }; \> \> Bool PrintNode::iCreateOperator(GvNode \*bn) \> { \> bn->SetShowPortNamesState(FALSE); \> BaseContainer \*bc = bn->GetOpContainerInstance(); if (!bc) return FALSE; \> return SUPER::iCreateOperator(bn); \> } \> \> const String PrintNode::GetDetailedText(GvNode \*bn) \> { \> return GvGetOperatorDetailedText(this,bn); \> } \> \> const String PrintNode::GetText(GvNode \*bn) \> { \> if(result) \> { \> return result->GetName(); \> } \> return "no input"; \> } \> \> Bool PrintNode::AddToCalculationTable(GvNode \*bn, GvRun \*r) \> { \> return r->AddNodeToCalculationTable(bn); \> } \> \> Bool PrintNode::InitCalculation(GvNode \*bn, GvCalc \*c, GvRun \*r) \> { \> v1 = bn->AllocCalculationHandler(PRINT_NODE_INPUT,c,r,0); if (!v1) return FALSE; \> return TRUE; \> } \> \> void PrintNode::FreeCalculation(GvNode \*bn, GvCalc \*c) \> { \> bn->FreeCalculationHandler(v1); \> } \> \> Bool PrintNode::Calculate(GvNode \*bn, GvPort \*port, GvRun \*r, GvCalc \*c) \> { \> if (!v1->Calculate(bn,GV_PORT_INPUT,r,c)) return FALSE; \> if (!v1->GetPort()->GetObject(result, r)) return FALSE; \> \> return TRUE; \> } \> \> //////////////////////////////// \> \> #define GVPRINTNODE_ID 1010815 \> \> Bool RegisterPrintNode() \> { \> return GvRegisterOperatorPlugin(GVPRINTNODE_ID, "Print Node", 0, PrintNode::Alloc, "print_node", 0, ID_GV_OPCLASS_TYPE_GENERAL, ID_GV_OPGROUP_TYPE_GENERAL, 0, NULL); \> } \>
cheers,
Matthias