Compare commits
3 Commits
temp-ui-cp
...
temp-T9670
Author | SHA1 | Date | |
---|---|---|---|
bcf2ab95cc | |||
2fb62893f2 | |||
35d8726e4d |
@@ -492,7 +492,7 @@ class DisplayPanel(BrushPanel):
|
|||||||
icon='HIDE_OFF' if brush.use_cursor_overlay else 'HIDE_ON',
|
icon='HIDE_OFF' if brush.use_cursor_overlay else 'HIDE_ON',
|
||||||
)
|
)
|
||||||
|
|
||||||
if mode in {'PAINT_2D', 'PAINT_TEXTURE', 'PAINT_VERTEX', 'SCULPT'}:
|
if mode in {'PAINT_2D', 'PAINT_TEXTURE'}:
|
||||||
row = col.row(align=True)
|
row = col.row(align=True)
|
||||||
row.prop(brush, "texture_overlay_alpha", text="Texture Opacity")
|
row.prop(brush, "texture_overlay_alpha", text="Texture Opacity")
|
||||||
row.prop(brush, "use_primary_overlay_override", toggle=True, text="", icon='BRUSH_DATA')
|
row.prop(brush, "use_primary_overlay_override", toggle=True, text="", icon='BRUSH_DATA')
|
||||||
@@ -502,7 +502,7 @@ class DisplayPanel(BrushPanel):
|
|||||||
icon='HIDE_OFF' if brush.use_primary_overlay else 'HIDE_ON',
|
icon='HIDE_OFF' if brush.use_primary_overlay else 'HIDE_ON',
|
||||||
)
|
)
|
||||||
|
|
||||||
if mode in {'PAINT_TEXTURE', 'PAINT_2D'}:
|
if mode in {'PAINT_TEXTURE', 'PAINT_2D', 'PAINT_VERTEX', 'SCULPT'}:
|
||||||
row = col.row(align=True)
|
row = col.row(align=True)
|
||||||
row.prop(brush, "mask_overlay_alpha", text="Mask Texture Opacity")
|
row.prop(brush, "mask_overlay_alpha", text="Mask Texture Opacity")
|
||||||
row.prop(brush, "use_secondary_overlay_override", toggle=True, text="", icon='BRUSH_DATA')
|
row.prop(brush, "use_secondary_overlay_override", toggle=True, text="", icon='BRUSH_DATA')
|
||||||
@@ -1047,8 +1047,9 @@ def draw_color_settings(context, layout, brush, color_type=False):
|
|||||||
|
|
||||||
|
|
||||||
# Used in both the View3D toolbar and texture properties
|
# Used in both the View3D toolbar and texture properties
|
||||||
def brush_texture_settings(layout, brush, sculpt):
|
def brush_texture_settings(layout, brush, sculpt, tex_slot=None):
|
||||||
tex_slot = brush.texture_slot
|
if tex_slot is None:
|
||||||
|
tex_slot = brush.texture_slot
|
||||||
|
|
||||||
layout.use_property_split = True
|
layout.use_property_split = True
|
||||||
layout.use_property_decorate = False
|
layout.use_property_decorate = False
|
||||||
|
@@ -58,9 +58,9 @@ class VIEW3D_HT_tool_header(Header):
|
|||||||
|
|
||||||
def draw_3d_brush_settings(layout, tool_mode):
|
def draw_3d_brush_settings(layout, tool_mode):
|
||||||
layout.popover("VIEW3D_PT_tools_brush_settings_advanced", text="Brush")
|
layout.popover("VIEW3D_PT_tools_brush_settings_advanced", text="Brush")
|
||||||
if tool_mode != 'PAINT_WEIGHT':
|
if tool_mode in ('PAINT_TEXTURE', 'SCULPT', 'PAINT_VERTEX'):
|
||||||
layout.popover("VIEW3D_PT_tools_brush_texture")
|
layout.popover("VIEW3D_PT_tools_brush_texture")
|
||||||
if tool_mode == 'PAINT_TEXTURE':
|
if tool_mode in ('PAINT_TEXTURE',):
|
||||||
layout.popover("VIEW3D_PT_tools_mask_texture")
|
layout.popover("VIEW3D_PT_tools_mask_texture")
|
||||||
layout.popover("VIEW3D_PT_tools_brush_stroke")
|
layout.popover("VIEW3D_PT_tools_brush_stroke")
|
||||||
layout.popover("VIEW3D_PT_tools_brush_falloff")
|
layout.popover("VIEW3D_PT_tools_brush_falloff")
|
||||||
|
@@ -689,17 +689,22 @@ class VIEW3D_PT_tools_brush_texture(Panel, View3DPaintPanel):
|
|||||||
return (brush.image_tool == 'DRAW')
|
return (brush.image_tool == 'DRAW')
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def get_texture_slot(self, context, brush):
|
||||||
|
if context.sculpt_object or contex.vertex_paint_object:
|
||||||
|
return brush.mask_texture_slot
|
||||||
|
return brush.texture_slot
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
layout = self.layout
|
layout = self.layout
|
||||||
|
|
||||||
settings = self.paint_settings(context)
|
settings = self.paint_settings(context)
|
||||||
brush = settings.brush
|
brush = settings.brush
|
||||||
tex_slot = brush.texture_slot
|
tex_slot = self.get_texture_slot(context, brush)
|
||||||
|
|
||||||
col = layout.column()
|
col = layout.column()
|
||||||
col.template_ID_preview(tex_slot, "texture", new="texture.new", rows=3, cols=8)
|
col.template_ID_preview(tex_slot, "texture", new="texture.new", rows=3, cols=8)
|
||||||
|
|
||||||
brush_texture_settings(col, brush, context.sculpt_object)
|
brush_texture_settings(col, brush, context.sculpt_object, tex_slot=tex_slot)
|
||||||
|
|
||||||
|
|
||||||
# TODO, move to space_view3d.py
|
# TODO, move to space_view3d.py
|
||||||
|
@@ -25,7 +25,7 @@ extern "C" {
|
|||||||
|
|
||||||
/* Blender file format version. */
|
/* Blender file format version. */
|
||||||
#define BLENDER_FILE_VERSION BLENDER_VERSION
|
#define BLENDER_FILE_VERSION BLENDER_VERSION
|
||||||
#define BLENDER_FILE_SUBVERSION 0
|
#define BLENDER_FILE_SUBVERSION 1
|
||||||
|
|
||||||
/* Minimum Blender version that supports reading file written with the current
|
/* Minimum Blender version that supports reading file written with the current
|
||||||
* version. Older Blender versions will test this and show a warning if the file
|
* version. Older Blender versions will test this and show a warning if the file
|
||||||
|
@@ -37,6 +37,7 @@
|
|||||||
#include "DNA_screen_types.h"
|
#include "DNA_screen_types.h"
|
||||||
#include "DNA_space_types.h"
|
#include "DNA_space_types.h"
|
||||||
#include "DNA_text_types.h"
|
#include "DNA_text_types.h"
|
||||||
|
#include "DNA_texture_defaults.h"
|
||||||
#include "DNA_workspace_types.h"
|
#include "DNA_workspace_types.h"
|
||||||
|
|
||||||
#include "BKE_action.h"
|
#include "BKE_action.h"
|
||||||
@@ -3378,5 +3379,17 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Sculpting brushes used mtex for masking, image brushes used mtex for coloring and mask_mtex
|
||||||
|
* for masking. Converting sculpting brushes to use mask_tex for masking to make brushes more
|
||||||
|
* compatible with each other. */
|
||||||
|
// TODO(jbakker): this needs a version bump.
|
||||||
|
MTex default_texture = _DNA_DEFAULT_MTex;
|
||||||
|
LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) {
|
||||||
|
if (brush->sculpt_tool != 0) {
|
||||||
|
memcpy(&brush->mask_mtex, &brush->mtex, sizeof(MTex));
|
||||||
|
memcpy(&brush->mtex, &default_texture, sizeof(MTex));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1285,7 +1285,7 @@ static int sculpt_brush_needs_normal(const SculptSession *ss, const Brush *brush
|
|||||||
SCULPT_TOOL_ELASTIC_DEFORM,
|
SCULPT_TOOL_ELASTIC_DEFORM,
|
||||||
SCULPT_TOOL_THUMB) ||
|
SCULPT_TOOL_THUMB) ||
|
||||||
|
|
||||||
(brush->mtex.brush_map_mode == MTEX_MAP_MODE_AREA)) ||
|
(brush->mask_mtex.brush_map_mode == MTEX_MAP_MODE_AREA)) ||
|
||||||
sculpt_brush_use_topology_rake(ss, brush);
|
sculpt_brush_use_topology_rake(ss, brush);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2417,7 +2417,7 @@ float SCULPT_brush_strength_factor(SculptSession *ss,
|
|||||||
{
|
{
|
||||||
StrokeCache *cache = ss->cache;
|
StrokeCache *cache = ss->cache;
|
||||||
const Scene *scene = cache->vc->scene;
|
const Scene *scene = cache->vc->scene;
|
||||||
const MTex *mtex = &br->mtex;
|
const MTex *mtex = &br->mask_mtex;
|
||||||
float avg = 1.0f;
|
float avg = 1.0f;
|
||||||
float rgba[4];
|
float rgba[4];
|
||||||
float point[3];
|
float point[3];
|
||||||
@@ -2464,7 +2464,7 @@ float SCULPT_brush_strength_factor(SculptSession *ss,
|
|||||||
x += br->mtex.ofs[0];
|
x += br->mtex.ofs[0];
|
||||||
y += br->mtex.ofs[1];
|
y += br->mtex.ofs[1];
|
||||||
|
|
||||||
avg = paint_get_tex_pixel(&br->mtex, x, y, ss->tex_pool, thread_id);
|
avg = paint_get_tex_pixel(&br->mask_mtex, x, y, ss->tex_pool, thread_id);
|
||||||
|
|
||||||
avg += br->texture_sample_bias;
|
avg += br->texture_sample_bias;
|
||||||
}
|
}
|
||||||
@@ -3398,7 +3398,7 @@ static void do_brush_action(Sculpt *sd,
|
|||||||
update_sculpt_normal(sd, ob, nodes, totnode);
|
update_sculpt_normal(sd, ob, nodes, totnode);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (brush->mtex.brush_map_mode == MTEX_MAP_MODE_AREA) {
|
if (brush->mask_mtex.brush_map_mode == MTEX_MAP_MODE_AREA) {
|
||||||
update_brush_local_mat(sd, ob);
|
update_brush_local_mat(sd, ob);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3952,7 +3952,7 @@ static void sculpt_fix_noise_tear(Sculpt *sd, Object *ob)
|
|||||||
{
|
{
|
||||||
SculptSession *ss = ob->sculpt;
|
SculptSession *ss = ob->sculpt;
|
||||||
Brush *brush = BKE_paint_brush(&sd->paint);
|
Brush *brush = BKE_paint_brush(&sd->paint);
|
||||||
MTex *mtex = &brush->mtex;
|
MTex *mtex = &brush->mask_mtex;
|
||||||
|
|
||||||
if (ss->multires.active && mtex->tex && mtex->tex->type == TEX_NOISE) {
|
if (ss->multires.active && mtex->tex && mtex->tex->type == TEX_NOISE) {
|
||||||
multires_stitch_grids(ob);
|
multires_stitch_grids(ob);
|
||||||
@@ -5085,7 +5085,7 @@ bool SCULPT_stroke_get_location(bContext *C,
|
|||||||
static void sculpt_brush_init_tex(Sculpt *sd, SculptSession *ss)
|
static void sculpt_brush_init_tex(Sculpt *sd, SculptSession *ss)
|
||||||
{
|
{
|
||||||
Brush *brush = BKE_paint_brush(&sd->paint);
|
Brush *brush = BKE_paint_brush(&sd->paint);
|
||||||
MTex *mtex = &brush->mtex;
|
MTex *mtex = &brush->mask_mtex;
|
||||||
|
|
||||||
/* Init mtex nodes. */
|
/* Init mtex nodes. */
|
||||||
if (mtex->tex && mtex->tex->nodetree) {
|
if (mtex->tex && mtex->tex->nodetree) {
|
||||||
@@ -5484,7 +5484,7 @@ static void sculpt_stroke_update_step(bContext *C,
|
|||||||
static void sculpt_brush_exit_tex(Sculpt *sd)
|
static void sculpt_brush_exit_tex(Sculpt *sd)
|
||||||
{
|
{
|
||||||
Brush *brush = BKE_paint_brush(&sd->paint);
|
Brush *brush = BKE_paint_brush(&sd->paint);
|
||||||
MTex *mtex = &brush->mtex;
|
MTex *mtex = &brush->mask_mtex;
|
||||||
|
|
||||||
if (mtex->tex && mtex->tex->nodetree) {
|
if (mtex->tex && mtex->tex->nodetree) {
|
||||||
ntreeTexEndExecTree(mtex->tex->nodetree->execdata);
|
ntreeTexEndExecTree(mtex->tex->nodetree->execdata);
|
||||||
|
@@ -178,7 +178,7 @@ static float sculpt_expand_falloff_value_vertex_get(SculptSession *ss,
|
|||||||
return expand_cache->vert_falloff[v_i];
|
return expand_cache->vert_falloff[v_i];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!expand_cache->brush->mtex.tex) {
|
if (!expand_cache->brush->mask_mtex.tex) {
|
||||||
return expand_cache->vert_falloff[v_i];
|
return expand_cache->vert_falloff[v_i];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,7 +202,7 @@ static float sculpt_expand_max_vertex_falloff_get(ExpandCache *expand_cache)
|
|||||||
return expand_cache->max_vert_falloff;
|
return expand_cache->max_vert_falloff;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!expand_cache->brush->mtex.tex) {
|
if (!expand_cache->brush->mask_mtex.tex) {
|
||||||
return expand_cache->max_vert_falloff;
|
return expand_cache->max_vert_falloff;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1891,13 +1891,13 @@ static int sculpt_expand_modal(bContext *C, wmOperator *op, const wmEvent *event
|
|||||||
}
|
}
|
||||||
case SCULPT_EXPAND_MODAL_TEXTURE_DISTORTION_INCREASE: {
|
case SCULPT_EXPAND_MODAL_TEXTURE_DISTORTION_INCREASE: {
|
||||||
if (expand_cache->texture_distortion_strength == 0.0f) {
|
if (expand_cache->texture_distortion_strength == 0.0f) {
|
||||||
if (expand_cache->brush->mtex.tex == NULL) {
|
if (expand_cache->brush->mask_mtex.tex == NULL) {
|
||||||
BKE_report(op->reports,
|
BKE_report(op->reports,
|
||||||
RPT_WARNING,
|
RPT_WARNING,
|
||||||
"Active brush does not contain any texture to distort the expand boundary");
|
"Active brush does not contain any texture to distort the expand boundary");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (expand_cache->brush->mtex.brush_map_mode != MTEX_MAP_MODE_3D) {
|
if (expand_cache->brush->mask_mtex.brush_map_mode != MTEX_MAP_MODE_3D) {
|
||||||
BKE_report(op->reports,
|
BKE_report(op->reports,
|
||||||
RPT_WARNING,
|
RPT_WARNING,
|
||||||
"Texture mapping not set to 3D, results may be unpredictable");
|
"Texture mapping not set to 3D, results may be unpredictable");
|
||||||
@@ -2061,7 +2061,7 @@ static void sculpt_expand_cache_initial_config_set(bContext *C,
|
|||||||
IMB_colormanagement_srgb_to_scene_linear_v3(expand_cache->fill_color, expand_cache->fill_color);
|
IMB_colormanagement_srgb_to_scene_linear_v3(expand_cache->fill_color, expand_cache->fill_color);
|
||||||
|
|
||||||
expand_cache->scene = CTX_data_scene(C);
|
expand_cache->scene = CTX_data_scene(C);
|
||||||
expand_cache->mtex = &expand_cache->brush->mtex;
|
expand_cache->mtex = &expand_cache->brush->mask_mtex;
|
||||||
expand_cache->texture_distortion_strength = 0.0f;
|
expand_cache->texture_distortion_strength = 0.0f;
|
||||||
expand_cache->blend_mode = expand_cache->brush->blend;
|
expand_cache->blend_mode = expand_cache->brush->blend;
|
||||||
}
|
}
|
||||||
|
@@ -170,7 +170,9 @@ typedef struct Brush {
|
|||||||
struct BrushClone clone;
|
struct BrushClone clone;
|
||||||
/** Falloff curve. */
|
/** Falloff curve. */
|
||||||
struct CurveMapping *curve;
|
struct CurveMapping *curve;
|
||||||
|
/* Texture for coloring. */
|
||||||
struct MTex mtex;
|
struct MTex mtex;
|
||||||
|
/* Texture for masking. */
|
||||||
struct MTex mask_mtex;
|
struct MTex mask_mtex;
|
||||||
|
|
||||||
struct Brush *toggle_brush;
|
struct Brush *toggle_brush;
|
||||||
|
Reference in New Issue
Block a user