Results 1 to 3 of 3

Thread: LWMeshDeformerHandler activation

  1. #1
    Super Member
    Join Date
    Jul 2003
    Location
    somewhere
    Posts
    1,129

    LWMeshDeformerHandler activation

    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());
    	}
    }

  2. #2
    LightWave Engineer Jarno's Avatar
    Join Date
    Aug 2003
    Location
    New Zealand
    Posts
    586
    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---

  3. #3
    Super Member
    Join Date
    Jul 2003
    Location
    somewhere
    Posts
    1,129
    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.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •