[SDK] Very simple morpher - update problem

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

 
Thread Tools Search this Thread Display Modes
  1 Week Ago
[SDK] Very simple morpher - update problem

Hi
I'm trying to create a very simple morpher-like modifier. For now it's pretty much what the 3ds Max plugin wizard created + one additional parameter of TYPE_INODE + Custom pickbutton to pick the node. I want to copy the target verts to my mesh, as simple as that.
For now it works only with Meshes:

void aVertMorph::ModifyObject(TimeValue t, ModContext& mc, ObjectState* os, INode* node)
{
   INode* targetNode = NULL;
   pblock->GetValue(pb_targetnode, t, targetNode, FOREVER);
   if (targetNode)
   {
      BOOL deleteIt;
      TriObject* targetTriObj = GetTriObjectFromNode(targetNode, deleteIt, t);
      if (targetTriObj)
      {
         TriObject *myTriObj = (TriObject*)os->obj;
         if (myTriObj)
         {
            for (int v=0; v<myTriObj->mesh.numVerts; v++)
            {
               myTriObj->mesh.verts[v] = targetTriObj->GetMesh().verts[v];
            }
         }
      }
      if (deleteIt) targetTriObj->DeleteMe();
   }
}


And it usually works, but not always. When I add an animated noise mod to the target node and some other modifiers like edit_mesh (nothing thath turns it into poly) it sometimes (rather rarely, most of the time it works) stops updating in the viewport while moving the time slider - the ModifyObject method is not called at all. What can be the problem?

Last edited by Tamyl : 1 Week Ago at 08:58 PM.
 
  1 Week Ago
Could be caused by a variety of factors, most likely related to your modifier's validity interval. Are you setting that properly and returning it in your GetValidity function? And when your target node changes (due to animation or whatever), are you getting proper 'ref changed' messages in your NotifyRefChanged function?
__________________
http://www.tysonibele.com
 
  1 Week Ago
That was the problem indeed, NotifyRefChanged wasn't even called. I've implemented the GetValidity function and everything works now, thanks for the hint
 
reply share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 04:45 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.