Blender Asked by cheatPKL on September 29, 2021
I have mastering blender, but i’m absolutely beginner in python or blender script.
i just can use the script trough copy from the "Info" area then paste to "Text Editor"
then Run it.
but i get confused to change preview passes trough script
the line from the "Info" (when i switch the passes) is
bpy.data.screens["Scripting"].(null) = 'NORMAL'
i copy and paste to the editor, so like this
import bpy
bpy.data.screens["Scripting"].(null) = 'NORMAL'
and the script won’t run, its get invalid syntax
any help will be appreciated
thank you
Developer Extras
Relying on the info area to write scripts is IMO not the way to go.
Some posts explaining how to find what the property is.
Changing the shading type in Python
Blender python : How to set object appearance in viewport?
With developer extras turned on mousing over the property
Telling us the type and its property of interest View3DShading.render_pass
For a 3D viewport, will find any property setting belongs to the space. Scrolling to References at bottom of page confirms this ie SpaceView3D.shading
is an instance of View3DShading
To the python console:
>>> for i, a in enumerate(C.screen.areas):
... i, a.type
...
(0, 'PROPERTIES')
(1, 'CONSOLE')
(2, 'VIEW_3D')
(3, 'TEXT_EDITOR')
Area 2 is a view 3d, its active space
>>> space = C.screen.areas[2].spaces.active
The render pass property of shading group
>>> space.shading.render_pass
'COMBINED'
Set to something else.
>>> space.shading.render_pass = 'MIST'
>>>
Note in a script to run from the context of a view3d, then use
space = context.space_data
Correct answer by batFINGER on September 29, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP