[Bf-blender-cvs] [32a7cf4] soc-2013-paint: cursor transform WIP for curves

Antony Riakiotakis noreply at git.blender.org
Sun Jul 20 11:09:16 CEST 2014


Commit: 32a7cf4db9f9f9f8f5bfe377c53be8eae04008c7
Author: Antony Riakiotakis
Date:   Fri Jul 18 12:09:28 2014 +0300
Branches: soc-2013-paint
https://developer.blender.org/rB32a7cf4db9f9f9f8f5bfe377c53be8eae04008c7

cursor transform WIP for curves

===================================================================

M	source/blender/editors/space_view3d/view3d_header.c
M	source/blender/editors/transform/transform.c
M	source/blender/editors/transform/transform_generics.c
M	source/blender/makesrna/intern/rna_brush.c

===================================================================

diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c
index e3d0e87..9bd0c8c 100644
--- a/source/blender/editors/space_view3d/view3d_header.c
+++ b/source/blender/editors/space_view3d/view3d_header.c
@@ -32,6 +32,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 
+#include "DNA_brush_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_object_types.h"
 
@@ -45,6 +46,7 @@
 #include "BKE_depsgraph.h"
 #include "BKE_main.h"
 #include "BKE_modifier.h"
+#include "BKE_paint.h"
 #include "BKE_screen.h"
 #include "BKE_editmesh.h"
 
@@ -336,8 +338,10 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
 	uiItemR(layout, &v3dptr, "viewport_shade", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
 
 	if (obedit == NULL && is_paint) {
+		Paint *p = BKE_paint_get_active(scene);
+		Brush *br = BKE_paint_brush(p);
 
-		if (ob->mode & OB_MODE_WEIGHT_PAINT) {
+		if ((ob->mode & OB_MODE_WEIGHT_PAINT) || (br && (br->flag & BRUSH_CURVE))) {
 			/* Only for Weight Paint. makes no sense in other paint modes. */
 			row = uiLayoutRow(layout, true);
 			uiItemR(row, &v3dptr, "pivot_point", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 05c1aeb..8a7f135 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -576,7 +576,8 @@ static void viewRedrawForce(const bContext *C, TransInfo *t)
 {
 	if (t->spacetype == SPACE_VIEW3D) {
 		if (t->options & CTX_PAINT_CURVE) {
-			ED_area_tag_redraw(t->sa);
+			wmWindow *window = CTX_wm_window(C);
+			WM_paint_cursor_tag_redraw(window, t->ar);
 		}
 		else {
 			/* Do we need more refined tags? */
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index 53210eb..9288775 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -1211,7 +1211,6 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
 			Paint *p = BKE_paint_get_active_from_context(C);
 			if (p && p->brush && (p->brush->flag & BRUSH_CURVE)) {
 				t->options |= CTX_PAINT_CURVE;
-				t->around = V3D_CENTER;
 			}
 		}
 
@@ -1247,7 +1246,6 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
 			Paint *p = &sce->toolsettings->imapaint.paint;
 			if (p->brush && (p->brush->flag & BRUSH_CURVE)) {
 				t->options |= CTX_PAINT_CURVE;
-				t->around = V3D_CENTER;
 			}
 		}
 		/* image not in uv edit, nor in mask mode, can happen for some tools */
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index d8ec695..0bd7c59 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -397,6 +397,12 @@ static void rna_Brush_imagepaint_tool_update(Main *bmain, Scene *scene, PointerR
 	rna_Brush_update(bmain, scene, ptr);
 }
 
+static void rna_Brush_stroke_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+{
+	WM_main_add_notifier(NC_SCENE | ND_TOOLSETTINGS, scene);
+	rna_Brush_update(bmain, scene, ptr);
+}
+
 static void rna_Brush_icon_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
 	Brush *br = (Brush *)ptr->data;
@@ -872,7 +878,7 @@ static void rna_def_brush(BlenderRNA *brna)
 	RNA_def_property_enum_items(prop, sculpt_stroke_method_items);
 	RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Brush_stroke_itemf");
 	RNA_def_property_ui_text(prop, "Stroke Method", "");
-	RNA_def_property_update(prop, 0, "rna_Brush_update");
+	RNA_def_property_update(prop, 0, "rna_Brush_stroke_update");
 
 	prop = RNA_def_property(srna, "texture_angle_source_random", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");




More information about the Bf-blender-cvs mailing list