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:
@@ -70,17 +70,22 @@ class UnifiedPaintPanel():
|
||||
|
||||
|
||||
# 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
|
||||
|
||||
layout.label(text="Brush Mapping:")
|
||||
|
||||
# map_mode
|
||||
if sculpt:
|
||||
layout.row().prop(tex_slot, "map_mode", text="")
|
||||
layout.separator()
|
||||
else:
|
||||
layout.row().prop(tex_slot, "tex_paint_map_mode", text="")
|
||||
layout.separator()
|
||||
|
||||
# angle and texture_angle_source
|
||||
col = layout.column()
|
||||
if sculpt:
|
||||
col.active = brush.sculpt_capabilities.has_texture_angle_source
|
||||
col.label(text="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, "scale")
|
||||
|
||||
if sculpt:
|
||||
# texture_sample_bias
|
||||
col = layout.column(align=True)
|
||||
col.label(text="Sample Bias:")
|
||||
|
@@ -30,7 +30,7 @@ from bpy.types import (Brush,
|
||||
|
||||
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):
|
||||
@@ -884,8 +884,8 @@ class TEXTURE_PT_mapping(TextureSlotPanel, Panel):
|
||||
split.prop(tex, "object", text="")
|
||||
|
||||
if isinstance(idblock, Brush):
|
||||
if context.sculpt_object:
|
||||
sculpt_brush_texture_settings(layout, idblock)
|
||||
if context.sculpt_object or context.image_paint_object:
|
||||
brush_texture_settings(layout, idblock, context.sculpt_object)
|
||||
else:
|
||||
if isinstance(idblock, Material):
|
||||
split = layout.split(percentage=0.3)
|
||||
|
@@ -20,7 +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
|
||||
from bl_ui.properties_paint_common import brush_texture_settings
|
||||
|
||||
|
||||
class View3DPanel():
|
||||
@@ -723,9 +723,9 @@ class VIEW3D_PT_tools_brush_texture(Panel, View3DPaintPanel):
|
||||
if brush.use_paint_image:
|
||||
col.prop(brush, "use_fixed_texture")
|
||||
|
||||
if context.sculpt_object:
|
||||
sculpt_brush_texture_settings(col, brush)
|
||||
brush_texture_settings(col, brush, context.sculpt_object)
|
||||
|
||||
if context.sculpt_object:
|
||||
# use_texture_overlay and texture_overlay_alpha
|
||||
col = layout.column(align=True)
|
||||
col.active = brush.sculpt_capabilities.has_overlay
|
||||
|
@@ -429,6 +429,12 @@ static void rna_def_brush_texture_slot(BlenderRNA *brna)
|
||||
{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");
|
||||
RNA_def_struct_sdna(srna, "MTex");
|
||||
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_ui_text(prop, "Mode", "");
|
||||
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)
|
||||
|
Reference in New Issue
Block a user