On 12/09/2015 at 10:31, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 16+
Platform: Windows ;
Language(s) : C++ ;
---------
Hi,
I have an Xpresso node that worked just fine in R13-R15. Now I have recompiled it with the R16 SDK and it stopped working.
The node has several inports. One of them is a static port taking an integer. Now, if that port has no connection AddNodeToCalculationTable returns true and the Calculate function is correspondingly called. BUT as soon as I make a connection there (integer is coming from a C4D iterator output) AddNodeToCalculationTable fails and Calculate is never called subsequently.
Any idea what it could be? Any help is highly appreciated.
Here is the base code of the node:
node.h
class XParticleEditNode : public GvOperatorData
{
// Defines super
INSTANCEOF(XParticleEditNode, GvOperatorData)
public:
virtual Bool AddToCalculationTable (GvNode *bn, GvRun *r);
virtual Bool iCreateOperator (GvNode *bn);
virtual Bool iGetPortDescription (GvNode* bn, GvPortIO port, Int32_C4D id, GvPortDescription* pd);
virtual Bool GetDDescription (GeListNode *node, Description *description, DESCFLAGS_DESC &flags);
Bool InitCalculation(GvNode *bn, GvCalc *c, GvRun *r);
Bool Calculate(GvNode *bn, GvPort *port, GvRun *run, GvCalc *calc);
void FreeCalculation(GvNode *bn, GvCalc *c);
static NodeData* Alloc(void)
{
return new_c4d(XParticleEditNode);
}
private:
GvValuesInfo ports;
};
node.cpp
Bool XParticleEditNode::iCreateOperator(GvNode *bn)
{
BaseContainer* data = bn->GetOpContainerInstance();
if (!data) return FALSE;
data->SetInt64 (XPARTICLE_EDIT_INDEX,0);
return SUPER::iCreateOperator(bn);
}
Bool XParticleEditNode::AddToCalculationTable(GvNode *bn, GvRun *r)
{
Bool res = r->AddNodeToCalculationTable(bn); //RETURNS 0 if there is a connection at static port
return res;
}
Bool XParticleEditNode::Calculate(GvNode *bn, GvPort *port, GvRun *run, GvCalc *calc)
{
//NEVER GETS HERE WHEN THERE IS A CONNECTION AT THE STATIC PORT
return TRUE;
}
Bool XParticleEditNode::iGetPortDescription(GvNode* bn, GvPortIO port, Int32_C4D id, GvPortDescription* pd)
{
if(!SUPER::iGetPortDescription(bn,port,id,pd)) return false;
return true;
}
Bool XParticleEditNode::GetDDescription(GeListNode *node, Description *description, DESCFLAGS_DESC &flags)
{
if (!description || !node) return FALSE;
if (!description->LoadDescription(node->GetType())) return FALSE;
flags |= DESCFLAGS_DESC_LOADED;
return SUPER::GetDDescription(node, description, flags);
}
Bool XParticleEditNode::InitCalculation(GvNode *bn, GvCalc *c, GvRun *r)
{
return GvBuildInValuesTable(bn, ports, c, r, GV_DEFINED_PORTS); //ALWAYS WORKS. VERIFIED VIA DEBUGGING
}
void XParticleEditNode::FreeCalculation(GvNode *bn, GvCalc *c)
{
GvFreeValuesTable(bn, ports);
}
node.res
CONTAINER fx_xpresso_particleedit
{
NAME fx_xpresso_particleedit;
INCLUDE GVbase;
GROUP ID_GVPROPERTIES
{
}
GROUP ID_GVPORTS
{
LONG XPARTICLE_EDIT_INDEX {MIN 0; INPORT; STATICPORT; CREATEPORT; }
VECTOR XPARTICLE_EDIT_POS {INPORT; EDITPORT; CREATEPORT;PORTONLY;}
BOOL XPARTICLE_EDIT_ALIVE {INPORT; EDITPORT; PORTONLY;}
BOOL XPARTICLE_EDIT_COLLISION{INPORT; EDITPORT; PORTONLY;}
BOOL XPARTICLE_EDIT_SPRAY {INPORT; EDITPORT; PORTONLY;}
BOOL XPARTICLE_EDIT_BUBBLE {INPORT; EDITPORT; PORTONLY;}
BOOL XPARTICLE_EDIT_TEMP {INPORT; EDITPORT; PORTONLY;}
REAL XPARTICLE_EDIT_PROP_SCALAR {INPORT; MULTIPLE; PORTONLY; NOTMOVABLE;}
VECTOR XPARTICLE_EDIT_PROP_VECTOR {INPORT; MULTIPLE; PORTONLY; NOTMOVABLE;}
BOOL XPARTICLE_EDIT_PROP_STATE {INPORT; MULTIPLE; PORTONLY; NOTMOVABLE;}
}
}