diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2014-08-28 18:40:38 +0400 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2014-08-28 22:41:05 +0400 |
commit | cf3ce7322a9b6c1453869a369eba02f4fd077234 (patch) | |
tree | 94f11f57da8c00ce780e878767517cf4e428c907 /release | |
parent | 512b7383525d7b9ccdca93816a08a579db148f23 (diff) |
Texture painting:
Include explicit control for texturing:
This commit introduces a painting mode option, available in
the slots panel. The default value "Material" will create slots from the
blender material, same as just merged from the paint branch.
The new option "Image", will use an explicit image field that artists can use
to select the image to paint on. This will should allow painting regardless
of the renderer used or for use in modifiers.
Diffstat (limited to 'release')
-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" |