1
$\begingroup$

How to set Viewport Shading Wire Color to Object via Python? When I right click on the Object button

enter image description here

And do Copy Full Data Path, it gives me:

bpy.data.screens["Layout"].shading.wireframe_color_type

But does not work:

enter image description here

In the Info Editor it gives me another path:

bpy.context.space_data.shading.wireframe_color_type = 'OBJECT'

which also does not work. They are all misleading.

Is this a bug? How to set this button via Python? This is a follow up question to this thread

$\endgroup$

1 Answer 1

3
$\begingroup$

I found it:

import bpy

for area in bpy.context.screen.areas:
    if area.type == 'VIEW_3D':
        for space in area.spaces:
            if space.type == 'VIEW_3D':
                space.shading.wireframe_color_type = 'OBJECT'
$\endgroup$

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.