diff options
Diffstat (limited to 'release/scripts/startup/bl_ui')
-rw-r--r-- | release/scripts/startup/bl_ui/properties_paint_common.py | 53 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_view3d_toolbar.py | 65 |
2 files changed, 70 insertions, 48 deletions
diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py b/release/scripts/startup/bl_ui/properties_paint_common.py index 046e54d41fc..5c758b6568b 100644 --- a/release/scripts/startup/bl_ui/properties_paint_common.py +++ b/release/scripts/startup/bl_ui/properties_paint_common.py @@ -17,6 +17,7 @@ # ##### END GPL LICENSE BLOCK ##### # <pep8 compliant> +from bpy.types import Menu class UnifiedPaintPanel(): @@ -86,6 +87,18 @@ class UnifiedPaintPanel(): parent.template_color_picker(ptr, prop_name, value_slider=value_slider) +class VIEW3D_MT_tools_projectpaint_clone(Menu): + bl_label = "Clone Layer" + + def draw(self, context): + layout = self.layout + + for i, tex in enumerate(context.active_object.data.uv_textures): + props = layout.operator("wm.context_set_int", text=tex.name, translate=False) + props.data_path = "active_object.data.uv_texture_clone_index" + props.value = i + + def brush_texpaint_common(panel, context, layout, brush, settings, projpaint=False): capabilities = brush.image_paint_capabilities @@ -139,24 +152,38 @@ def brush_texpaint_common(panel, context, layout, brush, settings, projpaint=Fal elif brush.image_tool == 'CLONE': col.separator() if projpaint: - col.prop(settings, "use_clone_layer", text="Clone from paint slot") + if settings.mode == 'MATERIAL': + col.prop(settings, "use_clone_layer", text="Clone from paint slot") + elif settings.mode == 'IMAGE': + col.prop(settings, "use_clone_layer", text="Clone from image/UV map") if settings.use_clone_layer: ob = context.active_object col = layout.column() - if len(ob.material_slots) > 1: - col.label("Materials") - col.template_list("MATERIAL_UL_matslots", "", - ob, "material_slots", - ob, "active_material_index", rows=2) - - mat = ob.active_material - if mat: - col.label("Clone Slot") - col.template_list("TEXTURE_UL_texpaintslots", "", - mat, "texture_paint_images", - mat, "paint_clone_slot", rows=2) + if settings.mode == 'MATERIAL': + if len(ob.material_slots) > 1: + col.label("Materials") + col.template_list("MATERIAL_UL_matslots", "", + ob, "material_slots", + ob, "active_material_index", rows=2) + + mat = ob.active_material + if mat: + col.label("Clone Slot") + col.template_list("TEXTURE_UL_texpaintslots", "", + mat, "texture_paint_images", + mat, "paint_clone_slot", rows=2) + + elif settings.mode == 'IMAGE': + mesh = ob.data + + clone_text = mesh.uv_texture_clone.name if mesh.uv_texture_clone else "" + col.label("Image") + col.template_ID(settings, "clone_image") + col.label("UV Map") + col.menu("VIEW3D_MT_tools_projectpaint_clone", text=clone_text, translate=False) + else: col.prop(brush, "clone_image", text="Image") diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index 59c68fc615d..6b0c5b1e993 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -1026,31 +1026,39 @@ class VIEW3D_PT_slots_projectpaint(View3DPanel, Panel): ob = context.active_object col = layout.column() - if len(ob.material_slots) > 1: - col.label("Materials") - col.template_list("MATERIAL_UL_matslots", "layers", - ob, "material_slots", - ob, "active_material_index", rows=2) - - mat = ob.active_material - if mat: - col.label("Available Paint Slots") - col.template_list("TEXTURE_UL_texpaintslots", "", - mat, "texture_paint_images", - mat, "paint_active_slot", rows=2) + col.label("Painting Mode") + col.prop(settings, "mode", text = "") + col.separator() - if (not mat.use_nodes) and (context.scene.render.engine == 'BLENDER_RENDER'): - row = col.row(align=True) - row.operator_menu_enum("paint.add_texture_paint_slot", "type") - row.operator("paint.delete_texture_paint_slot", text="", icon='X') + if settings.mode == 'MATERIAL': + if len(ob.material_slots) > 1: + col.label("Materials") + col.template_list("MATERIAL_UL_matslots", "layers", + ob, "material_slots", + ob, "active_material_index", rows=2) + + mat = ob.active_material + if mat: + col.label("Available Paint Slots") + col.template_list("TEXTURE_UL_texpaintslots", "", + mat, "texture_paint_images", + mat, "paint_active_slot", rows=2) - if mat.texture_paint_slots: - slot = mat.texture_paint_slots[mat.paint_active_slot] + if (not mat.use_nodes) and (context.scene.render.engine == 'BLENDER_RENDER'): + row = col.row(align=True) + row.operator_menu_enum("paint.add_texture_paint_slot", "type") + row.operator("paint.delete_texture_paint_slot", text="", icon='X') - col.prop(mat.texture_slots[slot.index], "blend_type") - col.separator() - col.label("UV Map") - col.prop_search(slot, "uv_layer", ob.data, "uv_textures", text="") + if mat.texture_paint_slots: + slot = mat.texture_paint_slots[mat.paint_active_slot] + + col.prop(mat.texture_slots[slot.index], "blend_type") + col.separator() + col.label("UV Map") + col.prop_search(slot, "uv_layer", ob.data, "uv_textures", text="") + + elif settings.mode == 'IMAGE': + col.template_ID(settings, "canvas") col.separator() col.operator("image.save_dirty", text="Save All Images") @@ -1089,7 +1097,6 @@ class VIEW3D_PT_stencil_projectpaint(View3DPanel, Panel): col.label("Image") row = col.row(align=True) - row.operator("image.new", icon='ZOOMIN', text="Add New").texstencil = True; row.template_ID(ipaint, "stencil_image") col.label("Visualization") @@ -1643,18 +1650,6 @@ class VIEW3D_PT_imagepaint_options(View3DPaintPanel): self.unified_paint_settings(col, context) -class VIEW3D_MT_tools_projectpaint_clone(Menu): - bl_label = "Clone Layer" - - def draw(self, context): - layout = self.layout - - for i, tex in enumerate(context.active_object.data.uv_textures): - props = layout.operator("wm.context_set_int", text=tex.name, translate=False) - props.data_path = "active_object.data.uv_texture_clone_index" - props.value = i - - class VIEW3D_MT_tools_projectpaint_stencil(Menu): bl_label = "Mask Layer" |