[Closed] Broadcast Time Changed
This is what I did at the beginning, but unfortunately (and unexpectedly) it doesn’t work for most constraint and scripts controllers that I want to update in one go.
isn’t that just enumerating the scene with
Animatable::EnumAnimTree
and sending something like…
NotifyDependents(FOREVER, PART_ALL, REFMSG_CHANGE);
unfortunately not … most scripts and constraints are ‘protected’ from the dependency loop and use RefTargMonitors … so they quite often ignore simple notifications (REFMSG_CHANGE).
it might be INodeMonitor or INodeTransformMonitor… if geometry used it can be RefTargMonitor. Which is better parctice to use than direct reference or node.
If you need to update the scripted controllers instead of calling the time callback, wouldn’t this work?
mapped fn UpdateControllers ctrl = ctrl.update()
UpdateControllers (getclassinstances transform_script)
this was my next option … but getclassinstances for large and complex scenes can be slow (and it it slow) and it takes a significant amount of time to find all controls and update them. Which makes a problem to update on spinner dragging for example.
This update issue is inherent in any script controller class. So another problem is finding all instances of all script controller classes.
using Serejah idea the methods that almost works for me is:
def_visible_primitive(forceUpdateAnimated, "forceUpdateAnimated");
Value* forceUpdateAnimated_cf(Value **arg_list, int count)
{
check_arg_count(forceUpdateAnimated, 0, count);
auto ip = MAXScript_interface7;
auto t = ip->GetTime() - 1;
ip->GetScene()->FlagFGAnimated(t);
return &ok;
}
time to flag must be different from the current to force script controllers to update. Using the previous makes more sense to me than the next one after the current.
Do you think there is any reason to specify a time to flag?
3dsmax.exe.pdb symbol is available so perhaps you can set a breakpoint on FlagFGAnimated call and step-into the max native code to see how the time value is used inside. I personally have close to zero debugging experience in VS.