Force SimpleMod Update


#1

Any one ever found a good way to force a plugin simpleMod to update? I have found that unless on of the parameters of the modifier is animated the modifier will not update in the scene.

I have a modifier projecting its mesh to the surface of another. The only time that the mesh updates is when the target mesh is being moved interactively moved in the scene. If you animate that mesh and scrub the time line it doesn’t update the modifier. If the object the modifier is on is moved or animated it also doesn’t update the modifier. If keys are set on any track for the modifier it will up date only between those keys.

I’m just prototyping in Max Script but wanted to release it as a freebee but if it can’t do this it really has no point.


#2

I should note that what is strange is that the gizmo for the modifier always updates correctly. It is only the verts of the mesh that don’t.


#3

notifydependents <modifier> maybe?


#4

the question is where to call it… hmm…


#5

Just remembered another strange finding. If I force the gizmo of the modifier with something like this.gizmo.transform=matrix3 1 before returning p in the map loop it updates the modifier but only when it is selected and the modifier panel is open.


#6

you can probably add any of transformable nodes that have to update the modifier to its parameter block as NodeTransformMonitor… it has to force notification and update


#7

You would think so Denis but that isn’t working since I’m already storing the target node as a node and not even a nodeTransformMonitor. This should be forcing the update if the target is animated but it doesn’t. I have also tried to store just the transform controller for the target to see if it would work and that to doesn’t.

The ugly solution that I just came up with is forcing a script controller onto a dummy track when the modifier is created. That solves all the issues but it ain’t pretty.


#8

yeah… that was my backup idea…


#9

I should try and look at how these scripted simpleMods have been implemented. They are faster then they used to be but have strange slow downs as well.

Interactively I get 200 FPS but when animated I get 15 FPS. One would assume that it is doing just as much work but it must not. Looks like the update calls are getting spammed when the time line is changing.


#10

that’s true… they much slower than expected, even so, they are written with SDK.
the same story with Skin Modifier… i do the same as skin ~50 times faster than the skin… and i have no idea what skin does do all this time. that’s puzzles me.


#11

Missed something with the script controller to force the update. This updates everything BUT when the object with the modifier is being moved interactively. Very odd. So for that I have added a #maxObject with nodeTransformMonitor with the projecting node being referenced to it.


#12

not pretty, but that’s max’s fault.


#13

i don’t know how fast is it but it doesn’t look too ugly:


  plugin simpleMod Buddy
  	name:"Buddy"
  	classID:#(0x15854bf6, 0x72fd7d4a)
  ( 
  	fn getNode = (refs.dependentnodes this)[1]
  	parameters params
  	(
  		node type:#maxobject
  		notifier type:#float
  		target type:#node
  	)
  	rollout params "Parameters"
  	(
  	)
  	local tm
  	on map i p do if isvalidnode target and node != undefined do
  	(
  		if i == 1 do
  		(
  			front = normalize (target.pos - node.node.pos)
  			side = normalize (cross front [0,0,1])
  			up = cross front side
  			tm = matrix3 front side up [0,0,0]
  		)
  		p *= tm
  	)
  	fn addNotification source: = 
  	(
  		if source == unsupplied do source = getNode()
  		node = NodeTransformMonitor node:source
  		notifier.controller = float_script script:"notifydependents this; 0"
  	)
  	on attachedtonode node do addNotification source:node
)
  
  
  delete objects 
  target = box name:"target" pos:[40,0,0] wirecolor:green
  source = box name:"source" wirecolor:orange
  addmodifier source (Buddy target:target)
  with animate on at time 100 
  (
  	target.pos = [40,0,100]
  	source.pos = [-100,0,0]
  )
  

#14

Interesting, Had not thought about the notifyDependents. This needs the script controller how ever and in my books that is ugly. I’ll have a play and see if it is anything different then what I have.

Thanks Denis.


#15

could you modify my snippet to show your way please?


#16

The only big difference is the script controller just returns 0.


#17

right. my notification in the script is unnecessary… if so there is an idea… i don’t have to check it now but… what if we use as a ‘fake’ controller just an instance of any target’s float controller from transform… x_ position for example…


#18

That could probably work unless they change the controller and it breaks it. I have a thought on how to hide it and want to see if it will work. If I create a #maxObject parameter and place a nodeTransformMonitor in it that doesn’t reference a node. Then on the NTM I add a custom attribute def with the script controller on a track in it it can’t be seen but I have not tested if it will trigger the update or not. I do this all the time for storing more complex data sets.


#19

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.