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/scripts/startup/bl_ui/properties_paint_common.py | |
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/scripts/startup/bl_ui/properties_paint_common.py')
-rw-r--r-- | release/scripts/startup/bl_ui/properties_paint_common.py | 53 |
1 files changed, 40 insertions, 13 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") |