Metasequoia BBS

| New message | Normal | Tree |
Status
Tag
Keyword
[9662] Script editor / material poperty parameters
Done [Question,Who are you?] Response
how to change material poperty- parameters  when selecting model then it changes all the materials selected object only


for obj in ObjectEnum() do
  mat = MaterialGet(obj)
  MaterialSetAlpha mat, 1.00
  MaterialSetDiffuse mat, 0.80
  MaterialSetEmission mat, 0.75
  MaterialSetSpecular mat, 0.00
  MaterialSetPower mat, 5.00
  MaterialSetAmbient mat, 0.00
  MaterialSetReflection mat, 0.00
  MaterialSetRefraction mat, 1.00
end


Error code
Failed to execute a script in line 1.
Invalid syntax. (invalid syntax)
for obj in ObjectEnum() <<<do
2023-02-09 05:13
[9663] Re: Script editor / Administrator
The 'Script' folder contains several sample Python scripts, so please refer to them first to learn the basics of scripting.
And, the 'Help' menu in the script editor contains descriptions of classes, functions, and properties.
2023-02-09 08:28
[9664] Re: Script editor / material poperty parameters
>The 'Script' folder contains several sample Python scripts, so please refer to them first to learn the basics of scripting.
>And, the 'Help' menu in the script editor contains descriptions of classes, functions, and properties.


But how i do it ? am not coder and its for me imbossibile to change 200-300 materials everytime i import from blender to meta and since i do aterials and i need to change all materials all at once selected object only! :S
2023-02-09 14:22
[9665] Re: Script editor / material poperty parameters
Tag has been changed from [Question] to [Question,help! ].
>The 'Script' folder contains several sample Python scripts, so please refer to them first to learn the basics of scripting.
>And, the 'Help' menu in the script editor contains descriptions of classes, functions, and properties.

kinda hard tryed many methods but not working idk : S
2023-02-10 06:59
[9666] Re: Script editor / material poperty parameters
Tag has been changed from [Question,help! ] to [Question,help! i rlly tiered of this].
>The 'Script' folder contains several sample Python scripts, so please refer to them first to learn the basics of scripting.
>And, the 'Help' menu in the script editor contains descriptions of classes, functions, and properties.


import random

doc = MQSystem.getDocument()
objnum = doc.numObject

for oi in range(0,objnum):
    obj = doc.object[oi]
    if obj is None: continue

    if obj.selected:
        mat = obj.material
        mat.ambient = 0.50


Error code


Show more...
2023-02-10 11:11
[9667] Re: Script editor / Administrator
What you are asking for is already in the response I have already given, but I will state the same sentence again.

The 'Help' menu in the script editor contains descriptions of classes, functions, and properties.

Please check within the help to see what properties MQObject, MQMaterial, etc. have, and what types they are.
2023-02-10 15:49