Notifications
Clear all

[Closed] Deleted node and GetAnimByHandle

easiest is add the node to the paramblock as TYPE_INODE

heres a snippet from a quad cloud emitter object we use…
the object picker validation, checks the node is editable mesh and is a closed mesh

class PickNodeEmitterValidator : public PBValidator
{
private:

	BOOL Validate(PB2Value &v)
	{
		INode *node = (INode*)v.r;
		if(!node) 
			return FALSE;
		Object *tobj = node->GetObjectRef();
		
		if(!tobj->IsSubClassOf(triObjectClassID)) 
			return FALSE;

		if(::isMeshOpen(((TriObject*)tobj)->GetMesh()))
			return FALSE;

		return TRUE;
	};
};

static PickNodeEmitterValidator qc_validator;

pblock definition is then trivial


	kqc_emitter_node,	_T("EmitterMeshNode"),  TYPE_INODE,  P_RESET_DEFAULT , IDS_NONE,
		p_ui, 			TYPE_PICKNODEBUTTON,	IDC_QC_MESH_NODE_PBTN, 
		p_validator,	&qc_validator,
		p_accessor,		&qc_accessor,
		p_prompt,		IDS_QC_PICKPROMPT,
		end,

the p_accessor in our case just extracts the mesh from the node when the node is picked
it really is very easy implementation

Of course, I don’t know why didn’t I use the TYPE_INODE param, thanks a lot!
And last question, is there some kind of topologyChanged mxs callback function equivalent in SDK? I’d like to update some functions when the geometry of my node changes.

what do you want to do ? Using the paramblock means changing the INODE’s mesh invalidates the pblock forcing an “auto” update to your object.

No, let’s say that my plugin is a simple object (similar to BlobMesh) which builds a mesh wrapping another object (the picked one). So I have to update the BuildMesh function everytime the picked node changes its geometry (or transform).

edit: I checked it – the BuildMesh updates automatically when I use TYPE_INODE parameter in this case, so I can update my all functions inside the BuildMesh, but I’m still wondering if there’s a geometry or transform changing callback

Page 2 / 2