Changeset View
Changeset View
Standalone View
Standalone View
release/scripts/startup/bl_ui/space_view3d_toolbar.py
| Context not available. | |||||
| have_image = False | have_image = False | ||||
| match getattr(mode_settings, self.canvas_source_attr_name): | canvas_source = getattr(mode_settings, self.canvas_source_attr_name) | ||||
| case 'MATERIAL': | if canvas_source == 'MATERIAL': | ||||
| if len(ob.material_slots) > 1: | if len(ob.material_slots) > 1: | ||||
| layout.template_list( | layout.template_list( | ||||
| "MATERIAL_UL_matslots", "layers", | "MATERIAL_UL_matslots", "layers", | ||||
| ob, "material_slots", | ob, "material_slots", | ||||
| ob, "active_material_index", rows=2, | ob, "active_material_index", rows=2, | ||||
| ) | ) | ||||
| mat = ob.active_material | mat = ob.active_material | ||||
| if mat and mat.texture_paint_images: | if mat and mat.texture_paint_images: | ||||
| row = layout.row() | row = layout.row() | ||||
| row.template_list( | row.template_list( | ||||
| "TEXTURE_UL_texpaintslots", "", | "TEXTURE_UL_texpaintslots", "", | ||||
| mat, "texture_paint_slots", | mat, "texture_paint_slots", | ||||
| mat, "paint_active_slot", rows=2, | mat, "paint_active_slot", rows=2, | ||||
| ) | ) | ||||
| if mat.texture_paint_slots: | if mat.texture_paint_slots: | ||||
| slot = mat.texture_paint_slots[mat.paint_active_slot] | slot = mat.texture_paint_slots[mat.paint_active_slot] | ||||
| else: | |||||
| slot = None | |||||
| have_image = slot is not None | |||||
| else: | else: | ||||
| row = layout.row() | slot = None | ||||
| box = row.box() | have_image = slot is not None | ||||
| box.label(text="No Textures") | else: | ||||
| row = layout.row() | |||||
| sub = row.column(align=True) | box = row.box() | ||||
| sub.operator_menu_enum("paint.add_texture_paint_slot", "type", icon='ADD', text="") | box.label(text="No Textures") | ||||
| case 'IMAGE': | sub = row.column(align=True) | ||||
| mesh = ob.data | sub.operator_menu_enum("paint.add_texture_paint_slot", "type", icon='ADD', text="") | ||||
| 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 | |||||
| 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': | self.draw_image_interpolation(layout=layout, mode_settings=mode_settings) | ||||
| mesh = ob.data | |||||
| row = layout.row() | elif canvas_source == 'COLOR_ATTRIBUTE': | ||||
| col = row.column() | mesh = ob.data | ||||
| col.template_list( | |||||
| "MESH_UL_color_attributes_selector", | row = layout.row() | ||||
| "color_attributes", | col = row.column() | ||||
| mesh, | col.template_list( | ||||
| "color_attributes", | "MESH_UL_color_attributes_selector", | ||||
| mesh.color_attributes, | "color_attributes", | ||||
| "active_color_index", | mesh, | ||||
| rows=3, | "color_attributes", | ||||
| ) | mesh.color_attributes, | ||||
| "active_color_index", | |||||
| rows=3, | |||||
| ) | |||||
| col = row.column(align=True) | col = row.column(align=True) | ||||
| col.operator("geometry.color_attribute_add", icon='ADD', text="") | col.operator("geometry.color_attribute_add", icon='ADD', text="") | ||||
| col.operator("geometry.color_attribute_remove", icon='REMOVE', text="") | col.operator("geometry.color_attribute_remove", icon='REMOVE', text="") | ||||
| if settings.missing_uvs: | if settings.missing_uvs: | ||||
| layout.separator() | layout.separator() | ||||
| Context not available. | |||||