Make clone tool UI slightly less horrible.
authorAntony Riakiotakis <kalast@gmail.com>
Mon, 21 Jul 2014 17:24:03 +0000 (19:24 +0200)
committerAntony Riakiotakis <kalast@gmail.com>
Mon, 21 Jul 2014 17:24:22 +0000 (19:24 +0200)
Move clone tool options as well as layer selection to the brush panel.
That should make its use more apparent and, most importantly, easy.

release/scripts/startup/bl_ui/properties_paint_common.py
release/scripts/startup/bl_ui/space_view3d_toolbar.py

index 8359ae651ffb4875e0ff2491e6e6c205f2595245..80f7db37faa32ea426b66960f8140348dc90c8cb 100644 (file)
@@ -86,7 +86,7 @@ class UnifiedPaintPanel():
         parent.template_color_picker(ptr, prop_name, value_slider=value_slider)
 
 
-def brush_texpaint_common(panel, context, layout, brush, settings):
+def brush_texpaint_common(panel, context, layout, brush, settings, projpaint=False):
     capabilities = brush.image_paint_capabilities
 
     col = layout.column()
@@ -137,8 +137,31 @@ def brush_texpaint_common(panel, context, layout, brush, settings):
 
     elif brush.image_tool == 'CLONE':
         col.separator()
-        col.prop(brush, "clone_image", text="Image")
-        col.prop(brush, "clone_alpha", text="Alpha")
+        if projpaint:
+            col.prop(settings, "use_clone_layer", text="Clone from paint slot")
+
+            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_slots",
+                                      mat, "paint_clone_slot", rows=2)
+
+        else:
+            col.prop(brush, "clone_image", text="Image")
+            col.prop(brush, "clone_alpha", text="Alpha")
+
+
 
     col.separator()
 
index 99b2b8529361cf24b41787f5e831755b4d9052a3..256110a5d806332c1dab701c8423d4d5647dc896 100644 (file)
@@ -982,7 +982,7 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel):
         # Texture Paint Mode #
 
         elif context.image_paint_object and brush:
-            brush_texpaint_common(self, context, layout, brush, settings)
+            brush_texpaint_common(self, context, layout, brush, settings, True)
 
         # Weight Paint Mode #
         elif context.weight_paint_object and brush:
@@ -1087,12 +1087,6 @@ class VIEW3D_PT_slots_projectpaint(View3DPanel, Panel):
                 row.prop(settings, "slot_yresolution_default")
                 col.prop(settings, "slot_color_default")
 
-            if brush.image_tool == 'CLONE' and settings.use_clone_layer:
-                col.label("Clone Slot")
-                col.template_list("TEXTURE_UL_texpaintslots", "",
-                                  mat, "texture_paint_slots",
-                                  mat, "paint_clone_slot", rows=2)
-
 
 class VIEW3D_PT_tools_brush_overlay(Panel, View3DPaintPanel):
     bl_category = "Options"
@@ -1637,10 +1631,6 @@ class VIEW3D_PT_tools_projectpaint(View3DPaintPanel, Panel):
         col.template_ID(ipaint, "stencil_image", new="image.new")
         col.prop(ipaint, "stencil_color")
 
-        col = layout.column()
-        col.active = (settings.brush.image_tool == 'CLONE')
-        col.prop(ipaint, "use_clone_layer", text="Clone from paint slot")
-
         layout.prop(ipaint, "seam_bleed")
         self.unified_paint_settings(layout, context)