Unification of brush code

* rename sculpt_brush_texture_settings to brush_texture_settings
* Expose texture scale and offset in texture paint mode
* Introduce still inactive mapping mode for texture paint, tiled and
view aligned only. Projective paint uses only tiled, while 2d paint can
use both. Commit will come that will use both appropriately for both
modes, omitting fixed brush flag (which is tiled with another name)
This commit is contained in:
Antony Riakiotakis
2013-01-16 12:57:35 +00:00
parent 2095b2cddb
commit cb8158cce6
4 changed files with 42 additions and 24 deletions

View File

@@ -70,17 +70,22 @@ class UnifiedPaintPanel():
# Used in both the View3D toolbar and texture properties # Used in both the View3D toolbar and texture properties
def sculpt_brush_texture_settings(layout, brush): def brush_texture_settings(layout, brush, sculpt):
tex_slot = brush.texture_slot tex_slot = brush.texture_slot
layout.label(text="Brush Mapping:") layout.label(text="Brush Mapping:")
# map_mode # map_mode
if sculpt:
layout.row().prop(tex_slot, "map_mode", text="") layout.row().prop(tex_slot, "map_mode", text="")
layout.separator() layout.separator()
else:
layout.row().prop(tex_slot, "tex_paint_map_mode", text="")
layout.separator()
# angle and texture_angle_source # angle and texture_angle_source
col = layout.column() col = layout.column()
if sculpt:
col.active = brush.sculpt_capabilities.has_texture_angle_source col.active = brush.sculpt_capabilities.has_texture_angle_source
col.label(text="Angle:") col.label(text="Angle:")
if brush.sculpt_capabilities.has_random_texture_angle: if brush.sculpt_capabilities.has_random_texture_angle:
@@ -97,6 +102,7 @@ def sculpt_brush_texture_settings(layout, brush):
split.prop(tex_slot, "offset") split.prop(tex_slot, "offset")
split.prop(tex_slot, "scale") split.prop(tex_slot, "scale")
if sculpt:
# texture_sample_bias # texture_sample_bias
col = layout.column(align=True) col = layout.column(align=True)
col.label(text="Sample Bias:") col.label(text="Sample Bias:")

View File

@@ -30,7 +30,7 @@ from bpy.types import (Brush,
from rna_prop_ui import PropertyPanel from rna_prop_ui import PropertyPanel
from bl_ui.properties_paint_common import sculpt_brush_texture_settings from bl_ui.properties_paint_common import brush_texture_settings
class TEXTURE_MT_specials(Menu): class TEXTURE_MT_specials(Menu):
@@ -884,8 +884,8 @@ class TEXTURE_PT_mapping(TextureSlotPanel, Panel):
split.prop(tex, "object", text="") split.prop(tex, "object", text="")
if isinstance(idblock, Brush): if isinstance(idblock, Brush):
if context.sculpt_object: if context.sculpt_object or context.image_paint_object:
sculpt_brush_texture_settings(layout, idblock) brush_texture_settings(layout, idblock, context.sculpt_object)
else: else:
if isinstance(idblock, Material): if isinstance(idblock, Material):
split = layout.split(percentage=0.3) split = layout.split(percentage=0.3)

View File

@@ -20,7 +20,7 @@
import bpy import bpy
from bpy.types import Menu, Panel from bpy.types import Menu, Panel
from bl_ui.properties_paint_common import UnifiedPaintPanel from bl_ui.properties_paint_common import UnifiedPaintPanel
from bl_ui.properties_paint_common import sculpt_brush_texture_settings from bl_ui.properties_paint_common import brush_texture_settings
class View3DPanel(): class View3DPanel():
@@ -723,9 +723,9 @@ class VIEW3D_PT_tools_brush_texture(Panel, View3DPaintPanel):
if brush.use_paint_image: if brush.use_paint_image:
col.prop(brush, "use_fixed_texture") col.prop(brush, "use_fixed_texture")
if context.sculpt_object: brush_texture_settings(col, brush, context.sculpt_object)
sculpt_brush_texture_settings(col, brush)
if context.sculpt_object:
# use_texture_overlay and texture_overlay_alpha # use_texture_overlay and texture_overlay_alpha
col = layout.column(align=True) col = layout.column(align=True)
col.active = brush.sculpt_capabilities.has_overlay col.active = brush.sculpt_capabilities.has_overlay

View File

@@ -429,6 +429,12 @@ static void rna_def_brush_texture_slot(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL} {0, NULL, 0, NULL, NULL}
}; };
static EnumPropertyItem prop_tex_paint_map_mode_items[] = {
{MTEX_MAP_MODE_VIEW, "VIEW_PLANE", 0, "View Plane", ""},
{MTEX_MAP_MODE_TILED, "TILED", 0, "Tiled", ""},
{0, NULL, 0, NULL, NULL}
};
srna = RNA_def_struct(brna, "BrushTextureSlot", "TextureSlot"); srna = RNA_def_struct(brna, "BrushTextureSlot", "TextureSlot");
RNA_def_struct_sdna(srna, "MTex"); RNA_def_struct_sdna(srna, "MTex");
RNA_def_struct_ui_text(srna, "Brush Texture Slot", "Texture slot for textures in a Brush datablock"); RNA_def_struct_ui_text(srna, "Brush Texture Slot", "Texture slot for textures in a Brush datablock");
@@ -444,6 +450,12 @@ static void rna_def_brush_texture_slot(BlenderRNA *brna)
RNA_def_property_enum_items(prop, prop_map_mode_items); RNA_def_property_enum_items(prop, prop_map_mode_items);
RNA_def_property_ui_text(prop, "Mode", ""); RNA_def_property_ui_text(prop, "Mode", "");
RNA_def_property_update(prop, 0, "rna_TextureSlot_update"); RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
prop = RNA_def_property(srna, "tex_paint_map_mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "brush_map_mode");
RNA_def_property_enum_items(prop, prop_tex_paint_map_mode_items);
RNA_def_property_ui_text(prop, "Mode", "");
RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
} }
static void rna_def_sculpt_capabilities(BlenderRNA *brna) static void rna_def_sculpt_capabilities(BlenderRNA *brna)