Notifications
Clear all

[Closed] Removing a Controller


m = standardMaterial()
m.selfillumination.controller = bezier_float()
m.selfillumination.controller = undefined -- uh uh uh... you didn't say the magic word....

So I need to use?
deleteTrackViewController

How do I get this for a material which only exists in the SME?

5 Replies
1 Reply
(@denist)
Joined: 10 months ago

Posts: 0

hmm… it’s a little more complicated with my extension:


param = paramOps.propNameToParam m #selfillumination 
paramOps.removeController m param
--or
paramOps.setController m param undefined

ha! i found that i don’t have a method that finds a subAnim (or subAnim name) by alias of property name
the problem is:
property name is #selfIllumAmount (alias #selfillumination)
sub anim name #Self_Illumination
but its client (parent) is #Shader_Basic_Parameters (not a material itself)

so i need to add something:


subAnimOps.findSubAnimByPropName m #selfillumination

Another method, another problem…


m = standardMaterial()
m.selfillumination.controller = bezier_float()
m.selfillumination.controller.value = 100

fn removeController ctrl =
(
   pblock = (refs.dependents ctrl)[1]
   for i = 1 to refs.getNumRefs pblock where refs.getReference pblock i == ctrl do refs.replaceReference pblock i undefined
   notifyDependents pblock
)
val = m.selfillumination.controller.value
(removeController m.selfillumination.controller)
m.selfillumination = val --causes system exception

Actually it’s a lot more complicated this as you can’t remove a controller once has been assigned in 3dsmax even through the UI.

So my question…

If a map has say 100 properties, what is the difference in evaluation speed of the map between if this map has;
a) No controllers assigned to properties
b) A simple controller assigned to each property – (bezier_Float() etc, no nested controllers etc)

I’m trying to work out if just doing a copy of the controller so it’s unique rather than trying to remove a controller assignment is going to be a significant penalty on a complex scene with lots of maps and lots of properties converted to controllers??

1 Reply
(@denist)
Joined: 10 months ago

Posts: 0

i think the biggest performance issue might be:

dependents notification

searching controller instances if you want to replace them with the same controller

so, i guess the situation when no controllers were assigned is fastest for solve (#1)
next by speed is to assign one same controller to all properties (#2)
next is to assign unique controllers to all properties (#3)
last is to replace controllers instances with a keeping instancing (#4)

i think that disabling before and enabling all scene ref messages after assignment has to help with performance, and it is safe enough. But in this case you have “manually” notify all dependents that ware involved in the process… (the complete redraw can be good enough)