Can someone explain me why this works:
resetMaxFile() b = box() b.material = StandardMaterial() animate on ( at time 0 b.material.diffuseColor = red at time 100 b.material.diffuseColor = blue )
But this does not work:
resetMaxFile() b = box() b.material = Autodesk_Material() animate on ( at time 0 b.material.Generic_Color = red at time 100 b.material.Generic_Color = blue )
Thanks in advance
There is nothing wrong with your script, it seems that it fails to animate in the viewport when Materials are set to Standard Display with Maps. If you switch this to Hardware Display with Maps it seems to work fine. I am not 100% sure but maybe the Autodesk Generic Materials use DirectX or something like this!?
If I add a third color, the cube turns green on image 100.
resetMaxFile() b = box() b.material = Autodesk_Material() animate on ( at time 0 b.material.Generic_Color = red at time 50 b.material.Generic_Color = green at time 100 b.material.Generic_Color = blue )
It is as if there was a shift. The green is only applied at time 100 instead of time 50. And the blue never appears.
If I duplicate the lines, it is working:
resetMaxFile() b = box() b.material = Autodesk_Material() animate on ( at time 0 b.material.Generic_Color = red at time 50 b.material.Generic_Color = green at time 50 b.material.Generic_Color = green at time 100 b.material.Generic_Color = blue at time 100 b.material.Generic_Color = blue )
It should be possible to do better
Not at max now but did you try assigning the controller directly?
resetMaxFile() b = box material:(Autodesk_Material()) ctrl = Bezier_Point3() (addNewKey ctrl.keys 0).value = red as point4 (addNewKey ctrl.keys 100).value = blue as point4 clearControllerNewFlag ctrl b.material.Generic_Color.controller = ctrl
The controller type Bezier_Point3 is not compatible with the property Generic_Color. I've replaced it with a Bezier_Point4, but it still not works.
Okay, this is weird, when you change it to bezier_point4, run the script, pick the color to see it in material editor and move the timeslider, what do you see? On my machine it changes colors (and works in render too) but doesn't update color in viewport unless Show Realistic Material in Viewport is turned on (doesn't work with Show Shaded Material in Viewport either).
Forgot to add, in Track View the curves look perfectly alright, too.
I also can reproduce this behavior. Interesting thing I see is like others said, if I create the Autodesk Material manually and key it, it works fine. But even then, if I save the scene and then restart 3ds Max and reload it, the viewport animation is often lost again on my system (but not always). The compact material editor, and also the render output is correctly animated in all cases (I think), but the viewport is not working well to display the animated color.
Another test I made was after reloading the scene, and manually creating a second material, it again worked on the maul one. But the one from the previous session sometimes does not animate for me in the viewport. Switching to the realistic viewport with maps appears to solve it again for the current session.
I also tested different viewport drivers. In the legacy OpenGL driver the same behavior seems like.
So, I believe this is related to the viewport somehow, but cannot see much more related. I also tested some other animated parameters of the Autodesk Material (Generic) and it see similar problems. For example, the "Image Fade" (Generic_Image_Fade property), also does not update in teh viewport until the realistic with maps is enabled.
I will ask engineering about, but before I do does anyone have anything else to add?
thanks, kevin