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
...
Complicated? Come on!
You are trying to create scripted plugin. That's complicated :)
bga
...
Don't use scenematerial[#name] concept.
It's better to collect material by class and then make some changes of collected mtl's. I already show that in the concept.
It's simple
bga
...
Wow...
I studied it and now I understand what it does [I went crazy to understand m.mane... :) :) :) ]
It returns:
because FOCUS_cristalli is in fact a submaterial of FOCUS.
I'm loosing my mind... and something like this?
It works and returns me lightmat names.
But now I have to play with them...
If I go on with this
I get an error... :(
...
Why do you need modifier for this? You can use simple rollout.
It's much easier for testing.
bga
...
Mmmm... good idea, but as a newbie I'm doing sometingh wrong...
...
:)
bga
...
Let me explain the concept.
First we have dropdown list "All VRayLightMtl's" where you can get (collect) all VRayLightMtl's. Just press "Refresh". Then pick one mtl from list.
Next you can add new tag by adding CustAttribut to selected material. This way you can easely find your material in the scene even if you rename material.
And last you can search and collect all materials with specified tag name in the listbox.
If you want to see result open Listener and press "Print All Taged Light Mtls" button.
Cheers!
bga
...
Take look concept of this tool. I did'nt test this but idea is right.
bga
Yep, obviously in my original
Yep,
obviously in my original scene the material is assigned.
In the new one the material should be imported, but I receive the error even if I assign it to my object, and if I delete and reapply my script.
I'm going crazy about it... I'm quite sure there is some issue with material path name, but I can't find the bug :(
I'll attach a sample scene and the whole script if someone wants to try...
...
You need to assigne this material to some object. That's why you recive error
bga