Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <campbell@blender.org>2022-09-21 15:02:41 +0300
committerCampbell Barton <campbell@blender.org>2022-09-22 06:41:00 +0300
commit243e28b73b888fd578530cc637d511ab0b1cafe3 (patch)
tree62acefba9514192740b0b4f9ed58b5853aa421da /release
parenta920f32ccd0bdbd24317c79648e9fb91dc108d15 (diff)
PyAPI: Support Python 3.9 (for VFX platform support)
Support Python 3.9, part of VFX platform support. The intention of restoring Python 3.9 support is so it's possible to build a (mostly) VFX compatible version of Blender, not to provide official builds on the buildbot. Includes contribution by Brecht. Reviewed By: brecht Ref D16030
Diffstat (limited to 'release')
-rw-r--r--release/scripts/startup/bl_ui/space_view3d_toolbar.py108
1 files changed, 54 insertions, 54 deletions
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 892dc9a1e42..49ac6841c35 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -483,68 +483,68 @@ class SelectPaintSlotHelper:
have_image = False
- match getattr(mode_settings, self.canvas_source_attr_name):
- case 'MATERIAL':
- if len(ob.material_slots) > 1:
- layout.template_list(
- "MATERIAL_UL_matslots", "layers",
- ob, "material_slots",
- ob, "active_material_index", rows=2,
- )
- mat = ob.active_material
- if mat and mat.texture_paint_images:
- row = layout.row()
- row.template_list(
- "TEXTURE_UL_texpaintslots", "",
- mat, "texture_paint_slots",
- mat, "paint_active_slot", rows=2,
- )
-
- if mat.texture_paint_slots:
- slot = mat.texture_paint_slots[mat.paint_active_slot]
- else:
- slot = None
-
- have_image = slot is not None
+ canvas_source = getattr(mode_settings, self.canvas_source_attr_name)
+ if canvas_source == 'MATERIAL':
+ if len(ob.material_slots) > 1:
+ layout.template_list(
+ "MATERIAL_UL_matslots", "layers",
+ ob, "material_slots",
+ ob, "active_material_index", rows=2,
+ )
+ mat = ob.active_material
+ if mat and mat.texture_paint_images:
+ row = layout.row()
+ row.template_list(
+ "TEXTURE_UL_texpaintslots", "",
+ mat, "texture_paint_slots",
+ mat, "paint_active_slot", rows=2,
+ )
+
+ if mat.texture_paint_slots:
+ slot = mat.texture_paint_slots[mat.paint_active_slot]
else:
- row = layout.row()
+ slot = None
- box = row.box()
- box.label(text="No Textures")
+ have_image = slot is not None
+ else:
+ row = layout.row()
- sub = row.column(align=True)
- sub.operator_menu_enum("paint.add_texture_paint_slot", "type", icon='ADD', text="")
+ box = row.box()
+ box.label(text="No Textures")
- case 'IMAGE':
- mesh = ob.data
- uv_text = mesh.uv_layers.active.name if mesh.uv_layers.active else ""
- layout.template_ID(mode_settings, self.canvas_image_attr_name, new="image.new", open="image.open")
- if settings.missing_uvs:
- layout.operator("paint.add_simple_uvs", icon='ADD', text="Add UVs")
- else:
- layout.menu("VIEW3D_MT_tools_projectpaint_uvlayer", text=uv_text, translate=False)
- have_image = getattr(settings, self.canvas_image_attr_name) is not None
+ sub = row.column(align=True)
+ sub.operator_menu_enum("paint.add_texture_paint_slot", "type", icon='ADD', text="")
- self.draw_image_interpolation(layout=layout, mode_settings=mode_settings)
+ elif canvas_source == 'IMAGE':
+ mesh = ob.data
+ uv_text = mesh.uv_layers.active.name if mesh.uv_layers.active else ""
+ layout.template_ID(mode_settings, self.canvas_image_attr_name, new="image.new", open="image.open")
+ if settings.missing_uvs:
+ layout.operator("paint.add_simple_uvs", icon='ADD', text="Add UVs")
+ else:
+ layout.menu("VIEW3D_MT_tools_projectpaint_uvlayer", text=uv_text, translate=False)
+ have_image = getattr(settings, self.canvas_image_attr_name) is not None
- case 'COLOR_ATTRIBUTE':
- mesh = ob.data
+ self.draw_image_interpolation(layout=layout, mode_settings=mode_settings)
- row = layout.row()
- col = row.column()
- col.template_list(
- "MESH_UL_color_attributes_selector",
- "color_attributes",
- mesh,
- "color_attributes",
- mesh.color_attributes,
- "active_color_index",
- rows=3,
- )
+ elif canvas_source == 'COLOR_ATTRIBUTE':
+ mesh = ob.data
+
+ row = layout.row()
+ col = row.column()
+ col.template_list(
+ "MESH_UL_color_attributes_selector",
+ "color_attributes",
+ mesh,
+ "color_attributes",
+ mesh.color_attributes,
+ "active_color_index",
+ rows=3,
+ )
- col = row.column(align=True)
- col.operator("geometry.color_attribute_add", icon='ADD', text="")
- col.operator("geometry.color_attribute_remove", icon='REMOVE', text="")
+ col = row.column(align=True)
+ col.operator("geometry.color_attribute_add", icon='ADD', text="")
+ col.operator("geometry.color_attribute_remove", icon='REMOVE', text="")
if settings.missing_uvs:
layout.separator()