LWMeshDeformerHandler activation

hurley

Active member
I can't seem to get LW to call my Activation function for a LWMeshDeformerHandler plugin. Here's the relevant code. Does anyone know what I'm doing wrong. Thanks

Code:
int ActivateMeshDeformer(long version, GlobalFunc * global, LWMeshDeformerHandler * local, void * data)
{
	if (version != LWMESHMODIFIER_VERSION)
		return AFUNC_BADVERSION;
}

ServerRecord ServerDesc[] =
{
	{ LWMESHDEFORMER_HCLASS, pluginName.c_str(), (ActivateFunc*)ActivateMeshDeformer },
	{ nullptr }
};

m->lw->util.applyPlugin(itemState.lwItemID, LWMESHDEFORMER_HCLASS, pluginName);

// applyPlugin
void LW::applyPlugin(LWItemID item, const std::string& pluginClass, const std::string& pluginName)
{
	const char* plugName = itemInfo_->server(item, pluginClass.c_str(), 1);
	if (!plugName)
	{
		std::string id = ToString<LWItemID>(item);
		std::string addPlugin("ApplyServerByItemID ");
		addPlugin += id + " " + pluginClass + " " + pluginName;
		runCmd_(addPlugin.c_str());
	}
}
 

Jarno

Post-LW Engineer
For starters you appear to be making a mesh *deformer* plugin, but your activation function is checking against the mesh *modifier* version, but that shouldn't matter as they are currently the same.

Have you checked that plugName really is null? Does ToString<LWItemID>() produce a string containing a proper C/C++ format hex code? Have you tried using a mesh modifier plugin instead?

---JvdL---
 

hurley

Active member
Hi Jarno,

Thanks for the reply. I found my bug in this line in my ApplyPlugin function

const char* plugName = itemInfo_->server(item, pluginClass.c_str(), 1);

I had hardwired the 3rd parameter to 1 instead of looking up it's real index. It's working as expected now.
 
Top Bottom