[Closed] Animating between multiple Texmap's with MaxScript
I shoudl also mention that half of what you see in the modifier is hidden from a animator so that they can’t make changes to it. You needed to set a TDMode=true in the modifier to be able to see the extra rollouts.
That certainly makes sense. good tip. Thanks for posting the images, it has inspired me to do something!
could somebody enlighten me please on why this callback doesn’t update the material I’ve setup please.
the m = $.material.diffusemap at the start is just a quick and dirty way of getting the material which is applied to the selected object and I wouldn’t obviously use it fr ‘real’. The help file says that updateMTLInMedit will
[size=2][font=‘Verdana’]Performs a set of 3ds Max notifications that forces an update of the material or texture throughout 3ds Max, including the MEdit and material browser.
[/font][/size]
m = $.material.diffuseMap
fn callUpdateMapSwap =
(
print "working"
updateMTLInMedit (m)
)
callbacks.addScript #preRenderFrame "callUpdateMapSwap()" id:#MapSwap
My guess is that forcing the medit update doesn’t force it to update at the render level. Try changing an animatable bitmap parameter this should force an update of the bitmap that can be passed to the render, and you may try a postrenderframe update. Which is similar to what Bobo’s example for the text updating does.
-Eric
Thought I’d post my findings on this in case anybody strays this way looking for answers. Seems very easy to extend the Composite map in 2009 with a spinner and use that to swap multiple maps…Best to set your tangents to on/off before animating so the maps swap immediately and one immediate problem will be if any any of the maps are deleted.
plugin textureMap MapSwap
name:"MapSwap"
classID:#(0xdc98917, 0x62769fc6)
extends:CompositeTextureMap
replaceUI:false
(
parameters main rollout:params
(
MapNumber type:#integer default:1 ui:map_num animatable:true
)--end Params
rollout params "Swap Map"
(
spinner map_num "Map Number" range:[1,10,1] align:#left fieldwidth:40 type:#integer
on map_num changed val do
(
if map_num.value > delegate.opacity.count do(map_num.value = delegate.opacity.count)
for i = 1 to delegate.opacity.count do
(
delegate.opacity[i]=0
)
delegate.opacity[map_num.value]=100
)
)--end rollout
)--end plugin
Interesting, but I don’t think that will solve the problems that I ran into as I needed the whole material showing in the viewport. This ment that it was trying to show all the maps in the composite map even if it wasn’t being used at the current frame. This made it unusably slow and the reason that I built a whole new material and managed it all myself.