SDK. Refine Segment - update shape


How can I update a shape node after refining a spline segment?
All works fine except for segments. I get the new knot but the segment where it lies isn’t subdivided.
If I tape “updateShape $” into the listener, the segment subdivision is created. But I can’t get to do it via SDK.
I have:

  • ComputeBezPoints() for the Spline3D
  • UpdateSels(), UpdateEdgeDists(), UpdateVertexDists() and UpdateBindList() for the BezierShape (sorting the order of them).
  • UpdateVertexDist(), UpdateEdgeDists() too for the SplineShape.
    Nothing, nor isolated nor all together seems to work.
    What am I doing wrong?


OK, I missed “InvalidateGeomCache()”.


Then I take this to a new question:
is there a way to avoid double call to topology_changed and geometry_changed if both handlers are set?


actually it’s good when you send both change messages. You send it not for yourself but for your plugin’s dependents. And you don’t know what messages they wait.


The problem is that my code does a lot of recalculations when the spline changes.
If user deletes a knot, Topology changes and does the calculation. OK.
If user undoes the action, both Topology and Geometry are triggered and thus the code does twice the same heavy calculation.


It’s a familiar situation for me. I calculate a HASH of spline first, and check if it matches the last recalculation. If it’s not I do recalculation again.

My HASH includes: curve length, number knots, points params (in, out, pos). Sometimes I add number steps and normalization flag


Great idea, as always. Thanks!.. But you make me work :rage:


you are welcome :sunglasses:


Just one more question:
when you say a HASH, are you talking of a real HASH (a number that indentifies an object’ state) or do you simply make a comparison between object’s values?
In the first case, can you show me an example of how do you combine these data (number of knots, lengths…) in a single number?



safe, quick and cheap


OK. Thanks a lot.
I’ll implement it and, I suppose, cache the value after every calculation in a new object field.