Notifications
Clear all

[Closed] SDK: get validity interval of force from WSMObject

I have a plugin that takes some spacewarp nodes and uses them to calculate forces on vertices.

While updating the validity interval of my plugin, I can’t find a way to get the validity interval of the forces from those nodes.

For example, a wind node with turbulence would be expected to wiggle my vertices each frame. But if I get the WSMObject* of the node in my listbox, it seems the interval is always ‘FOREVER’. I’ve tried the following:

ObjectState os = node->EvalWorldState(t);
valid &= os.Validity(t);
valid &= os.obj->ObjectValidity(t);
node->GetObjectTM(t, &valid);

MyEnumProc dep(FALSE);
DoEnumDependents(&dep);
for (int i = 0; i < dep.Nodes.Count(); i++)
{
dep.Nodes[i]->GetObjectTM(t, &valid);
}

When the spacewarp transform changes, the validity interval works fine. But if the spacewarp is stationary with no keyframes, the validity interval comes back as ‘FOREVER’ even though it has a turbulence value.

Any solution to this, other than simply setting my validity to Interval(t,t) when a spacewarp is applied? I looked in the source code for the flex modifier since it uses forces but didn’t see anything that jumped out as a proper force validity calculation.

3 Replies

what validity do expect to get? it sounds like you want to get an intersection of object (including state) tm validity intervals, and all controls validity intervals.
you probably have a purpose for that, and so you have to calculate it yourself.

What validity do expect to get?

Well, if a force has a setting that would cause per-frame changes to values sent to its ForceField, I’d expect a single frame validity. If the force has a static ForceField, I’d expect a validity interval of ‘FOREVER’.

Guess I’ll calculate it myself

btw… it could be a helpful extension – ‘get nested validity interval’ which searches recursively all the nested controllers as well