diff options
-rw-r--r-- | release/scripts/startup/bl_ui/properties_paint_common.py | 34 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/properties_texture.py | 15 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_view3d_toolbar.py | 42 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_brush.c | 25 |
4 files changed, 69 insertions, 47 deletions
diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py b/release/scripts/startup/bl_ui/properties_paint_common.py index 94df1ed6cf5..53cf640beb9 100644 --- a/release/scripts/startup/bl_ui/properties_paint_common.py +++ b/release/scripts/startup/bl_ui/properties_paint_common.py @@ -67,3 +67,37 @@ class UnifiedPaintPanel(): ups = context.tool_settings.unified_paint_settings ptr = ups if ups.use_unified_weight else brush parent.prop(ptr, prop_name, icon=icon, text=text, slider=slider) + + +# Used in both the View3D toolbar and texture properties +def sculpt_brush_texture_settings(layout, brush): + tex_slot = brush.texture_slot + + layout.label(text="Brush Mapping:") + + # map_mode + layout.row().prop(tex_slot, "map_mode", text="") + layout.separator() + + # angle and texture_angle_source + col = layout.column() + col.active = brush.sculpt_capabilities.has_texture_angle_source + col.label(text="Angle:") + if brush.sculpt_capabilities.has_random_texture_angle: + col.prop(brush, "texture_angle_source_random", text="") + else: + col.prop(brush, "texture_angle_source_no_random", text="") + + col = layout.column() + col.active = brush.sculpt_capabilities.has_texture_angle + col.prop(tex_slot, "angle", text="") + + # scale and offset + split = layout.split() + split.prop(tex_slot, "offset") + split.prop(tex_slot, "scale") + + # texture_sample_bias + col = layout.column(align=True) + col.label(text="Sample Bias:") + col.prop(brush, "texture_sample_bias", slider=True, text="") diff --git a/release/scripts/startup/bl_ui/properties_texture.py b/release/scripts/startup/bl_ui/properties_texture.py index 32047581550..1d5e96cf701 100644 --- a/release/scripts/startup/bl_ui/properties_texture.py +++ b/release/scripts/startup/bl_ui/properties_texture.py @@ -29,6 +29,8 @@ from bpy.types import (Brush, from rna_prop_ui import PropertyPanel +from bl_ui.properties_paint_common import sculpt_brush_texture_settings + class TEXTURE_MT_specials(Menu): bl_label = "Texture Specials" @@ -856,12 +858,7 @@ class TEXTURE_PT_mapping(TextureSlotPanel, Panel): if isinstance(idblock, Brush): if context.sculpt_object: - layout.label(text="Brush Mapping:") - layout.prop(tex, "map_mode", expand=True) - - row = layout.row() - row.active = tex.map_mode in {'FIXED', 'TILED'} - row.prop(tex, "angle") + sculpt_brush_texture_settings(layout, idblock) else: if isinstance(idblock, Material): split = layout.split(percentage=0.3) @@ -884,9 +881,9 @@ class TEXTURE_PT_mapping(TextureSlotPanel, Panel): row.prop(tex, "mapping_y", text="") row.prop(tex, "mapping_z", text="") - row = layout.row() - row.column().prop(tex, "offset") - row.column().prop(tex, "scale") + row = layout.row() + row.column().prop(tex, "offset") + row.column().prop(tex, "scale") class TEXTURE_PT_influence(TextureSlotPanel, Panel): diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index f3fa1585d56..d3a8427aa16 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -20,6 +20,7 @@ import bpy from bpy.types import Menu, Panel from bl_ui.properties_paint_common import UnifiedPaintPanel +from bl_ui.properties_paint_common import sculpt_brush_texture_settings class View3DPanel(): @@ -719,45 +720,11 @@ class VIEW3D_PT_tools_brush_texture(Panel, View3DPaintPanel): col.prop(brush, "use_fixed_texture") if context.sculpt_object: - #XXX duplicated from properties_texture.py - - col.label(text="Brush Mapping:") - col.row().prop(tex_slot, "map_mode", expand=True) - - col.separator() - - col = layout.column() - col.active = tex_slot.map_mode in {'FIXED'} - col.label(text="Angle:") - if brush.sculpt_capabilities.has_random_texture_angle: - col.prop(brush, "texture_angle_source_random", text="") - else: - col.prop(brush, "texture_angle_source_no_random", text="") - - #row = col.row(align=True) - #row.label(text="Angle:") - #row.active = tex_slot.map_mode in {'FIXED', 'TILED'} - - #row = col.row(align=True) - - #col = row.column() - #col.active = tex_slot.map_mode in {'FIXED'} - #col.prop(brush, "use_rake", toggle=True, icon='PARTICLEMODE', text="") - - col = layout.column() - col.active = tex_slot.map_mode in {'FIXED', 'TILED'} - col.prop(tex_slot, "angle", text="") - - split = layout.split() - split.prop(tex_slot, "offset") - split.prop(tex_slot, "scale") - - col = layout.column(align=True) - col.label(text="Sample Bias:") - col.prop(brush, "texture_sample_bias", slider=True, text="") + sculpt_brush_texture_settings(col, brush) + # use_texture_overlay and texture_overlay_alpha col = layout.column(align=True) - col.active = tex_slot.map_mode in {'FIXED', 'TILED'} + col.active = brush.sculpt_capabilities.has_overlay col.label(text="Overlay:") row = col.row() @@ -766,7 +733,6 @@ class VIEW3D_PT_tools_brush_texture(Panel, View3DPaintPanel): else: row.prop(brush, "use_texture_overlay", toggle=True, text="", icon='RESTRICT_VIEW_ON') sub = row.row() - sub.active = tex_slot.map_mode in {'FIXED', 'TILED'} and brush.use_texture_overlay sub.prop(brush, "texture_overlay_alpha", text="Alpha") diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index e585e58f982..0a8c241f5ee 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -142,6 +142,14 @@ static int rna_SculptCapabilities_has_normal_weight_get(PointerRNA *ptr) return ELEM(br->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_SNAKE_HOOK); } +static int rna_SculptCapabilities_has_overlay_get(PointerRNA *ptr) +{ + Brush *br = (Brush *)ptr->data; + return ELEM(br->mtex.brush_map_mode, + MTEX_MAP_MODE_VIEW, + MTEX_MAP_MODE_TILED); +} + static int rna_SculptCapabilities_has_persistence_get(PointerRNA *ptr) { Brush *br = (Brush *)ptr->data; @@ -222,6 +230,20 @@ static int rna_SculptCapabilities_has_strength_get(PointerRNA *ptr) return !ELEM(br->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_SNAKE_HOOK); } +static int rna_SculptCapabilities_has_texture_angle_get(PointerRNA *ptr) +{ + Brush *br = (Brush *)ptr->data; + return ELEM(br->mtex.brush_map_mode, + MTEX_MAP_MODE_VIEW, + MTEX_MAP_MODE_TILED); +} + +static int rna_SculptCapabilities_has_texture_angle_source_get(PointerRNA *ptr) +{ + Brush *br = (Brush *)ptr->data; + return br->mtex.brush_map_mode == MTEX_MAP_MODE_VIEW; +} + static PointerRNA rna_Brush_sculpt_capabilities_get(PointerRNA *ptr) { return rna_pointer_inherit_refine(ptr, &RNA_SculptCapabilities, ptr->id.data); @@ -441,6 +463,7 @@ static void rna_def_sculpt_capabilities(BlenderRNA *brna) BRUSH_CAPABILITY(has_height, "Has Height"); BRUSH_CAPABILITY(has_jitter, "Has Jitter"); BRUSH_CAPABILITY(has_normal_weight, "Has Crease/Pinch Factor"); + BRUSH_CAPABILITY(has_overlay, "Has Overlay"); BRUSH_CAPABILITY(has_persistence, "Has Persistence"); BRUSH_CAPABILITY(has_pinch_factor, "Has Pinch Factor"); BRUSH_CAPABILITY(has_plane_offset, "Has Plane Offset"); @@ -451,6 +474,8 @@ static void rna_def_sculpt_capabilities(BlenderRNA *brna) BRUSH_CAPABILITY(has_space_attenuation, "Has Space Attenuation"); BRUSH_CAPABILITY(has_spacing, "Has Spacing"); BRUSH_CAPABILITY(has_strength, "Has Strength"); + BRUSH_CAPABILITY(has_texture_angle, "Has Texture Angle"); + BRUSH_CAPABILITY(has_texture_angle_source, "Has Texture Angle Source"); #undef SCULPT_CAPABILITY } |