Notifications
Clear all

[Closed] getClassInstances but in SDK??

Lol, classic. *Thanks too k

Thanks to you both, I have got this sorted*

if anyone else was following this…


Value*
getClassInstances_cf(Value** arg_list, int count)
{
   // getClassInstances <MAXClass> target:<MAXObject> asTrackViewPick:<bool> processChildren:<bool> processAllAnimatables:<bool>
   check_arg_count_with_keys(getClassInstances, 1, count);
   MAXClass *mc = (MAXClass*)arg_list[0];
   if (!mc->is_kind_of(class_tag(MAXClass)))
      type_check(mc, MAXClass, _T("getClassInstances"));
   one_typed_value_local(Array* result);
   vl.result = new Array (0);
   Value* tmp;
   BOOL processAllAnimatables = bool_key_arg(processAllAnimatables, tmp, FALSE);*
   if (processAllAnimatables)
   {
      GetInstancesProc_AnimListEnum gip(mc, vl.result);
      Animatable::EnumerateAllAnimatables(gip);
      return_value(vl.result);
   }
   // to get a handle to the scene, or use specified target
   ReferenceMaker* target = NULL;
   BOOL asTrackViewPick = bool_key_arg(asTrackViewPick, tmp, FALSE);*
   Value* targetVal = key_arg(target)->eval();
   if (is_node(targetVal))
      target = targetVal->to_node();
   else if (targetVal != &unsupplied)
      target = targetVal->to_reftarg();
   else
      target = MAXScript_interface->GetScenePointer();
   if (target == NULL)
      return &undefined;
   bool isRoot = target == MAXScript_interface->GetScenePointer();
   if (!isRoot)
   {
      INode *node = dynamic_cast<INode*>(target);
      if (node)
         isRoot = node->IsRootNode() != FALSE;
   }
   bool quickClear = !isRoot;
   BOOL processChildren = bool_key_arg(processChildren, tmp, isRoot);*
   if (asTrackViewPick)
   {
      if (target)
      {
         if (!quickClear)
         {
            ClearAnimFlagEnumProc clearProc(A_WORK3);
            clearProc.SetScope(SCOPE_ALL);
            target->EnumAnimTree(&clearProc,NULL,0);      
         }
         else
            ClearAFlagInAllAnimatables(A_WORK3);
         int scope = processChildren? SCOPE_ALL : (SCOPE_SUBANIM|SCOPE_DOCLOSED);
         GetInstancesProc_AnimEnum gip (mc, vl.result, scope);
         target->EnumAnimTree(&gip,NULL,0);
      }
   }
   else
   {
      GetInstancesProc_RefEnum gip (mc, vl.result, processChildren);
      target->EnumRefHierarchy(gip, true, true, true, quickClear);
   }
   return_value(vl.result);
}

Page 2 / 2