Whether there is a way to refresh/update the Modifiers stack using C#


#1

When I change the state of a Splineshape, but it has the some modifier on it,I tried using :

ForceCompleteRedraw(true)

But it didn’t work,The state of node in the scene is not refreshed/updated.001
There’s one way I haven’t tried, because I don’t understand.

nod.NotifyDependents(g.Interval.Create(-1, -1),
(UIntPtr)0, RefMessage.Change, (SClass_ID)0xfffffff0, true, null,
NotifyDependentsOption.AllowOptimizations);
Dear experts, are you updating the stack in the command panel.


#2

it isn’t clear what you change and what you expect to happen in modifier stack


#3

Let’s say I move some knots in the Splineshape using my plugin

,In the scene, the Splineshape with the some modifier does not appear to respond immediately.


#4

given that you do something to baseobject you could try FindBaseObject and BaseObject::ForceNotify combination


#5

In other words, running the plugin already gives me what I want,But it should be showed in the viewport.When I clicked on the stack to see, it did succeed


#6

((IBaseObject)node.ObjectRef.FindBaseObject()).ForceNotify(null);

it seems to be wrong!


#7

Don’t you have to pass IInterval instead of a null value?


#8

20221109225824
This warning indicates that we cannot force the conversion.


#9

Did you try node.ObjectRef.NotifyDependents( … already?
you’d better ask @Klvnk or somebody experienced in sdk


#10

you are right,I used object’s IInterval instead of null,I succeeded!Thank you very much.


#11

you’ve got to love the sdk doc

virtual void BaseObject::ForceNotify  (  Interval &  i   )  [inline, virtual] 
 
   
Remarks:
This method is no longer used. 
Reimplemented in Modifier.

00665         {NotifyDependents(i, PART_ALL,REFMSG_CHANGE);}

from at least 2010 :slight_smile:

in short it’s probably still inlined in the class so as Serejah says

NotifyDependents(iv, PART_ALL,REFMSG_CHANGE);

should do the job too (without the risk of it being depricated in max 3024 :face_with_raised_eyebrow: )