Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r--source/blender/editors/sculpt_paint/CMakeLists.txt13
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c21
-rw-r--r--source/blender/editors/sculpt_paint/paint_ops.c3
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c46
4 files changed, 63 insertions, 20 deletions
diff --git a/source/blender/editors/sculpt_paint/CMakeLists.txt b/source/blender/editors/sculpt_paint/CMakeLists.txt
index 3211763b619..364677f9a8d 100644
--- a/source/blender/editors/sculpt_paint/CMakeLists.txt
+++ b/source/blender/editors/sculpt_paint/CMakeLists.txt
@@ -19,8 +19,6 @@
#
# ***** END GPL LICENSE BLOCK *****
-FILE(GLOB SRC *.c)
-
SET(INC
../include
../../blenkernel
@@ -34,6 +32,17 @@ SET(INC
../../../../intern/guardedalloc
)
+SET(SRC
+ paint_image.c
+ paint_ops.c
+ paint_stroke.c
+ paint_undo.c
+ paint_utils.c
+ paint_vertex.c
+ sculpt.c
+ sculpt_undo.c
+)
+
IF(WIN32)
LIST(APPEND INC ${PTHREADS_INC})
ENDIF(WIN32)
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index 71754c3589a..a5b5baad4c5 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -4961,23 +4961,38 @@ static void toggle_paint_cursor(bContext *C, int enable)
settings->imapaint.paintcursor= WM_paint_cursor_activate(CTX_wm_manager(C), image_paint_poll, brush_drawcursor, NULL);
}
+/* enable the paint cursor if it isn't already.
+
+ purpose is to make sure the paint cursor is shown if paint
+ mode is enabled in the image editor. the paint poll will
+ ensure that the cursor is hidden when not in paint mode */
+void ED_space_image_paint_update(wmWindowManager *wm, ToolSettings *settings)
+{
+ ImagePaintSettings *imapaint = &settings->imapaint;
+
+ if(!imapaint->paintcursor) {
+ imapaint->paintcursor =
+ WM_paint_cursor_activate(wm, image_paint_poll,
+ brush_drawcursor, NULL);
+ }
+}
+
/* ************ image paint radial control *************/
static int paint_radial_control_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
float zoom;
ToolSettings *ts = CTX_data_scene(C)->toolsettings;
get_imapaint_zoom(C, &zoom, &zoom);
- toggle_paint_cursor(C, !ts->imapaint.paintcursor);
+ toggle_paint_cursor(C, 0);
brush_radial_control_invoke(op, paint_brush(&ts->imapaint.paint), zoom);
return WM_radial_control_invoke(C, op, event);
}
static int paint_radial_control_modal(bContext *C, wmOperator *op, wmEvent *event)
{
- ToolSettings *ts = CTX_data_scene(C)->toolsettings;
int ret = WM_radial_control_modal(C, op, event);
if(ret != OPERATOR_RUNNING_MODAL)
- toggle_paint_cursor(C, !ts->imapaint.paintcursor);
+ toggle_paint_cursor(C, 1);
return ret;
}
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c
index 2e0338b370e..6f246692987 100644
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@ -428,6 +428,9 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
keymap= WM_keymap_find(keyconf, "Image Paint", 0, 0);
keymap->poll= image_texture_paint_poll;
+ RNA_enum_set(WM_keymap_add_item(keymap, "PAINT_OT_image_paint_radial_control", FKEY, KM_PRESS, 0, 0)->ptr, "mode", WM_RADIALCONTROL_SIZE);
+ RNA_enum_set(WM_keymap_add_item(keymap, "PAINT_OT_image_paint_radial_control", FKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "mode", WM_RADIALCONTROL_STRENGTH);
+
RNA_enum_set(WM_keymap_add_item(keymap, "PAINT_OT_texture_paint_radial_control", FKEY, KM_PRESS, 0, 0)->ptr, "mode", WM_RADIALCONTROL_SIZE);
RNA_enum_set(WM_keymap_add_item(keymap, "PAINT_OT_texture_paint_radial_control", FKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "mode", WM_RADIALCONTROL_STRENGTH);
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 505e37d95f6..fccee048525 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -2815,6 +2815,36 @@ static void sculpt_cache_free(StrokeCache *cache)
MEM_freeN(cache);
}
+/* Initialize mirror modifier clipping */
+static void sculpt_init_mirror_clipping(Object *ob, SculptSession *ss)
+{
+ ModifierData *md;
+ int i;
+
+ for(md= ob->modifiers.first; md; md= md->next) {
+ if(md->type==eModifierType_Mirror &&
+ (md->mode & eModifierMode_Realtime)) {
+ MirrorModifierData *mmd = (MirrorModifierData*)md;
+
+ if(mmd->flag & MOD_MIR_CLIPPING) {
+ /* check each axis for mirroring */
+ for(i = 0; i < 3; ++i) {
+ if(mmd->flag & (MOD_MIR_AXIS_X << i)) {
+ /* enable sculpt clipping */
+ ss->cache->flag |= CLIP_X << i;
+
+ /* update the clip tolerance */
+ if(mmd->tolerance >
+ ss->cache->clip_tolerance[i])
+ ss->cache->clip_tolerance[i] =
+ mmd->tolerance;
+ }
+ }
+ }
+ }
+ }
+}
+
/* Initialize the stroke cache invariants from operator properties */
static void sculpt_update_cache_invariants(bContext* C, Sculpt *sd, SculptSession *ss, wmOperator *op, wmEvent *event)
{
@@ -2822,7 +2852,6 @@ static void sculpt_update_cache_invariants(bContext* C, Sculpt *sd, SculptSessio
Brush *brush = paint_brush(&sd->paint);
ViewContext *vc = paint_stroke_view_context(op->customdata);
Object *ob= CTX_data_active_object(C);
- ModifierData *md;
int i;
int mode;
@@ -2835,22 +2864,9 @@ static void sculpt_update_cache_invariants(bContext* C, Sculpt *sd, SculptSessio
ss->cache->plane_trim_squared = brush->plane_trim * brush->plane_trim;
- /* Initialize mirror modifier clipping */
-
ss->cache->flag = 0;
- for(md= ob->modifiers.first; md; md= md->next) {
- if(md->type==eModifierType_Mirror && (md->mode & eModifierMode_Realtime)) {
- const MirrorModifierData *mmd = (MirrorModifierData*) md;
-
- /* Mark each axis that needs clipping along with its tolerance */
- if(mmd->flag & MOD_MIR_CLIPPING) {
- ss->cache->flag |= CLIP_X << mmd->axis;
- if(mmd->tolerance > ss->cache->clip_tolerance[mmd->axis])
- ss->cache->clip_tolerance[mmd->axis] = mmd->tolerance;
- }
- }
- }
+ sculpt_init_mirror_clipping(ob, ss);
/* Initial mouse location */
if (event) {