Material control panel problem
Hi all,
I'm quite new to maxscript and I'm in trouble with a script I'm developing for a personal project.
The script will be applied to a control object, and consist in a simple panel where to change vrayLightMtl multiplier for some other objects in scene.
It works fine in current scene, but if I merge that scene in another one I get an error message ("--unknown property: "multiplier" in undefined").
I think there are some issues with material naming, but as I said I'm new to script :)
Here is the script (for 1st material, others are the same, or maybe not, but this could be another question), and attached you will find a screenshot of materials and panel:
plugin modifier MECHA_Focus_Cristalli name:"MECHA_Focus_Cristalli" classID:#(0x133078, 0x54377) version:1 ( rollout focus "CRISTALLI FOCUS" width:162 height:400 ( --------DIAMANTE label focus_dia_lab "DIAMANTE" pos:[55,8] width:50 height:15 slider focus_dia_sli "Off On" pos:[14,28] width:136 height:44 range:[0,35,0] type:#integer orient:#horizontal ticks:10 animatable:true controller: sceneMaterials["FOCUS_dia_LUCE"].multiplier.controller button focus_dia_CK "Create Key" pos:[5,85] width:65 height:15 button focus_dia_DK "Delete All Key" pos:[70,85] width:85 height:15 button focus_dia_set_0 "0" pos:[5,100] width:25 height:15 button focus_dia_set_10 "10" pos:[30,100] width:25 height:15 button focus_dia_set_15 "15" pos:[55,100] width:25 height:15 button focus_dia_set_20 "20" pos:[80,100] width:25 height:15 button focus_dia_set_25 "25" pos:[105,100] width:25 height:15 button focus_dia_set_35 "35" pos:[130,100] width:25 height:15 on focus_dia_sli buttondown do ( ( animButtonState = True addNewKey sceneMaterials["FOCUS_dia_LUCE"].multiplier.controller currentTime ) ) on focus_dia_sli buttonup do animButtonState = False on focus_dia_CK pressed do ( addNewKey sceneMaterials["FOCUS_dia_LUCE"].multiplier.controller currentTime ) on focus_dia_DK pressed do ( deleteKeys sceneMaterials["FOCUS_dia_LUCE"].multiplier.controller #allKeys ) on focus_dia_set_0 pressed do ( sceneMaterials["FOCUS_dia_LUCE"].multiplier.controller.value = 0 addNewKey sceneMaterials["FOCUS_dia_LUCE"].multiplier.controller currentTime ) on focus_dia_set_10 pressed do ( sceneMaterials["FOCUS_dia_LUCE"].multiplier.controller.value = 10 addNewKey sceneMaterials["FOCUS_dia_LUCE"].multiplier.controller currentTime ) on focus_dia_set_15 pressed do ( sceneMaterials["FOCUS_dia_LUCE"].multiplier.controller.value = 15 addNewKey sceneMaterials["FOCUS_dia_LUCE"].multiplier.controller currentTime ) on focus_dia_set_20 pressed do ( sceneMaterials["FOCUS_dia_LUCE"].multiplier.controller.value = 20 addNewKey sceneMaterials["FOCUS_dia_LUCE"].multiplier.controller currentTime ) on focus_dia_set_25 pressed do ( sceneMaterials["FOCUS_dia_LUCE"].multiplier.controller.value = 25 addNewKey sceneMaterials["FOCUS_dia_LUCE"].multiplier.controller currentTime ) on focus_dia_set_35 pressed do ( sceneMaterials["FOCUS_dia_LUCE"].multiplier.controller.value = 35 addNewKey sceneMaterials["FOCUS_dia_LUCE"].multiplier.controller currentTime ) ) )
Thanks everybody for any help!!
Attachment | Size |
---|---|
materials_01.jpg | 166.37 KB |
panel_01.jpg | 17.26 KB |
Comments
GREAT!
Thanks man,
your script works very well, you gave me a big big help :)
I modified it a little...just to complicate my life...
- "DELETE ALL KEY" now put value to zero
- I added a slider with automatic keyframing on currentTime
- I also added buttons to add exact value keyframe on currentTime
Did I worked well?
(I commented first two materials just to made things easier)
...
Yep. You complicate your life with a slider.
I will probably use Checkbutton control
bga
.
Yes, but I like hard things, and with autokey I can save a lot of clicks :)
Maybe, do you know how to set In/Out Tangents to AUTO for created keys?
I tried with inTangentType = #auto but with no luck!
...
For first key do this or loop trought all keys
bga
.
Thanks, tomorrow I will try!
...
That's all you need. If you change name of material in Material Editor or Slate
then use same name in the script.
Code is not tested but you can extend my concept.
Cheers!
bga
:)
Very nice idea!!
It give me an error and it does not create keyframes, but maybe now it's time to go to sleep and retry tomorrow morning.
Stay tuned :)
And obviously thank you very much!
...
Just post error message from listener
bga
...
I fixed the code by testing these tree materials which are nested inside Multimaterial, VrayBlendMtl and VRay2Side. Also works inside other materials also.Check again my last code.
Cheers!
bga
...
Nice script,
quite complicated to understand for me, but I'll try.
The updated version works fine, it shows me all vraylightmtl in the scene... but my script continue to give me the error, ahahh!
Another way I tried was to add variables for material name, something like this:
It works fine for VISORE and DIAMANTE, that are vrayBlendMtl, but no way to make CRISTALLI to work, because this is a vrayBlendMtl in a MultiSubobjMaterial.