[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [38841] branches/soc-2011-onion: smooth brush
Antony Riakiotakis
kalast at gmail.com
Sat Jul 30 01:06:40 CEST 2011
Revision: 38841
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38841
Author: psy-fi
Date: 2011-07-29 23:06:40 +0000 (Fri, 29 Jul 2011)
Log Message:
-----------
smooth brush
========================
-bypass keymap of uv's when smooth brush is on
-hide cursor when smooth brush is on
-dummy operator for brush, I still can't get it to work
-fix circular dependency for brushsettings.hpp(depended on itself)
Modified Paths:
--------------
branches/soc-2011-onion/extern/brushlib/CMakeLists.txt
branches/soc-2011-onion/source/blender/editors/include/ED_image.h
branches/soc-2011-onion/source/blender/editors/include/ED_screen.h
branches/soc-2011-onion/source/blender/editors/screen/screen_ops.c
branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_image.c
branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_intern.h
branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_ops.c
branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_draw.c
branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_ops.c
branches/soc-2011-onion/source/blender/makesrna/intern/rna_space.c
branches/soc-2011-onion/source/blenderplayer/bad_level_call_stubs/stubs.c
Modified: branches/soc-2011-onion/extern/brushlib/CMakeLists.txt
===================================================================
--- branches/soc-2011-onion/extern/brushlib/CMakeLists.txt 2011-07-29 22:54:53 UTC (rev 38840)
+++ branches/soc-2011-onion/extern/brushlib/CMakeLists.txt 2011-07-29 23:06:40 UTC (rev 38841)
@@ -27,7 +27,7 @@
ADD_CUSTOM_COMMAND(
OUTPUT brushsettings.hpp
COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/generate.py ${CMAKE_CURRENT_SOURCE_DIR}
- DEPENDS brushsettings.hpp ${CMAKE_CURRENT_SOURCE_DIR}/generate.py
+# DEPENDS brushsettings.hpp ${CMAKE_CURRENT_SOURCE_DIR}/generate.py
)
set(INC
Modified: branches/soc-2011-onion/source/blender/editors/include/ED_image.h
===================================================================
--- branches/soc-2011-onion/source/blender/editors/include/ED_image.h 2011-07-29 22:54:53 UTC (rev 38840)
+++ branches/soc-2011-onion/source/blender/editors/include/ED_image.h 2011-07-29 23:06:40 UTC (rev 38841)
@@ -55,6 +55,7 @@
void ED_space_image_uv_aspect(struct SpaceImage *sima, float *aspx, float *aspy);
void ED_space_image_paint_update(struct wmWindowManager *wm, struct ToolSettings *settings);
+void ED_space_image_uv_smooth_update(struct wmWindowManager *wm, struct ToolSettings *settings);
void ED_image_size(struct Image *ima, int *width, int *height);
void ED_image_aspect(struct Image *ima, float *aspx, float *aspy);
Modified: branches/soc-2011-onion/source/blender/editors/include/ED_screen.h
===================================================================
--- branches/soc-2011-onion/source/blender/editors/include/ED_screen.h 2011-07-29 22:54:53 UTC (rev 38840)
+++ branches/soc-2011-onion/source/blender/editors/include/ED_screen.h 2011-07-29 23:06:40 UTC (rev 38841)
@@ -168,6 +168,7 @@
int ED_operator_editlattice(struct bContext *C);
int ED_operator_editmball(struct bContext *C);
int ED_operator_uvedit(struct bContext *C);
+int ED_operator_uvedit_no_smooth(struct bContext *C);
int ED_operator_uvmap(struct bContext *C);
int ED_operator_uvmap_mesh(struct bContext *C);
int ED_operator_uv_seam_tag_active(struct bContext *C);
Modified: branches/soc-2011-onion/source/blender/editors/screen/screen_ops.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/screen/screen_ops.c 2011-07-29 22:54:53 UTC (rev 38840)
+++ branches/soc-2011-onion/source/blender/editors/screen/screen_ops.c 2011-07-29 23:06:40 UTC (rev 38841)
@@ -364,6 +364,14 @@
return ED_space_image_show_uvedit(sima, obedit);
}
+int ED_operator_uvedit_no_smooth(struct bContext *C)
+{
+ SpaceImage *sima= CTX_wm_space_image(C);
+ Object *obedit= CTX_data_edit_object(C);
+ return ED_space_image_show_uvedit(sima, obedit) && !(sima->flag & SI_SMOOTH_BRUSH);
+}
+
+
int ED_operator_uvmap(bContext *C)
{
Object *obedit= CTX_data_edit_object(C);
Modified: branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_image.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_image.c 2011-07-29 22:54:53 UTC (rev 38840)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_image.c 2011-07-29 23:06:40 UTC (rev 38841)
@@ -4521,7 +4521,7 @@
if(sima) {
ARegion *ar= CTX_wm_region(C);
- if(((sima->flag & SI_DRAWTOOL) || (sima->flag & SI_SMOOTH_BRUSH)) && ar->regiontype==RGN_TYPE_WINDOW)
+ if((sima->flag & SI_DRAWTOOL) && ar->regiontype==RGN_TYPE_WINDOW)
return 1;
}
}
@@ -4529,6 +4529,23 @@
return 0;
}
+static int uv_smooth_brush_poll(const bContext *C)
+{
+// Object *obact = CTX_data_active_object(C);
+ SpaceImage *sima= CTX_wm_space_image(C);
+
+ if(!image_paint_brush(C))
+ return 0;
+
+ if(sima) {
+ ARegion *ar= CTX_wm_region(C);
+ if((sima->flag & SI_SMOOTH_BRUSH) && ar->regiontype==RGN_TYPE_WINDOW)
+ return 1;
+ }
+
+ return 0;
+}
+
static int image_paint_3d_poll(bContext *C)
{
if(CTX_wm_region_view3d(C))
@@ -5062,6 +5079,17 @@
NULL);
}
+
+void ED_space_image_uv_smooth_update(wmWindowManager *wm, ToolSettings *settings)
+{
+ paint_mode_init(
+ wm,
+ &(settings->imapaint.paint),
+ OB_MODE_TEXTURE_PAINT,
+ uv_smooth_brush_poll,
+ brush_drawcursor,
+ NULL);
+}
/************************ grab clone operator ************************/
typedef struct GrabClone {
@@ -5388,6 +5416,11 @@
return (texture_paint_poll(C) || image_paint_poll(C));
}
+int uv_smooth_poll(bContext *C)
+{
+ return uv_smooth_brush_poll(C);
+}
+
int facemask_paint_poll(bContext *C)
{
return paint_facesel_test(CTX_data_active_object(C));
Modified: branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_intern.h
===================================================================
--- branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_intern.h 2011-07-29 22:54:53 UTC (rev 38840)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_intern.h 2011-07-29 23:06:40 UTC (rev 38841)
@@ -254,6 +254,9 @@
void PAINT_OT_weight_layers_images_from_view(struct wmOperatorType *ot);
void PAINT_OT_weight_layers_to_uv_images(struct wmOperatorType *ot);
+/* uv smoothing */
+int uv_smooth_poll(struct bContext *C);
+
/* paint_utils.c */
void projectf(struct bglMats *mats, const float v[3], float p[2]);
float paint_calc_object_space_radius(const struct ViewContext *vc, const float center[3], float pixel_radius);
Modified: branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_ops.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_ops.c 2011-07-29 22:54:53 UTC (rev 38840)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_ops.c 2011-07-29 23:06:40 UTC (rev 38841)
@@ -359,7 +359,29 @@
ot->prop= RNA_def_enum(ot->srna, "tool", brush_image_tool_items, 0, "Tool", "");
}
+static int uv_smooth_stroke_exec(bContext *C, wmOperator *op)
+{
+ printf("little ducks\n");
+ return OPERATOR_FINISHED;
+}
+static void UV_OT_uv_smooth_stroke(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Smooth UVs";
+ ot->description= "Smooth UVs using a brush";
+ ot->idname= "UV_OT_uv_smooth_stroke";
+
+ /* api callbacks */
+ ot->exec= uv_smooth_stroke_exec;
+ ot->poll= uv_smooth_poll;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+
+ /* props */
+}
+
/**************************** registration **********************************/
void ED_operatortypes_paint(void)
@@ -395,6 +417,9 @@
WM_operatortype_append(PAINT_OT_weight_layers_images_from_view);
WM_operatortype_append(PAINT_OT_weight_layers_to_uv_images);
+ /* uv */
+ WM_operatortype_append(UV_OT_uv_smooth_stroke);
+
/* vertex */
WM_operatortype_append(PAINT_OT_vertex_paint_toggle);
WM_operatortype_append(PAINT_OT_vpaint_stroke);
@@ -681,6 +706,11 @@
WM_keymap_add_item(keymap, "PAINT_OT_face_select_linked", LKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "PAINT_OT_face_select_linked_pick", LKEY, KM_PRESS, 0, 0);
+ keymap= WM_keymap_find(keyconf, "UV Smooth", 0, 0);
+ keymap->poll= uv_smooth_poll;
+
+ WM_keymap_add_item(keymap, "UV_OT_uv_smooth_stroke", LEFTMOUSE, KM_PRESS, 0, 0);
+
/* paint stroke */
{
wmKeyMap* keymap= paint_stroke_modal_keymap(keyconf);
Modified: branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_draw.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_draw.c 2011-07-29 22:54:53 UTC (rev 38840)
+++ branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_draw.c 2011-07-29 23:06:40 UTC (rev 38841)
@@ -935,7 +935,7 @@
draw_uvs_texpaint(sima, scene, paint_ob, ima);
}
- if(show_uvedit)
+ if(show_uvedit && !(sima->flag & SI_SMOOTH_BRUSH))
drawcursor_sima(sima, ar);
}
}
Modified: branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_ops.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_ops.c 2011-07-29 22:54:53 UTC (rev 38840)
+++ branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_ops.c 2011-07-29 23:06:40 UTC (rev 38841)
@@ -4486,7 +4486,7 @@
wmKeyMapItem *kmi;
keymap= WM_keymap_find(keyconf, "UV Editor", 0, 0);
- keymap->poll= ED_operator_uvedit;
+ keymap->poll= ED_operator_uvedit_no_smooth;
/* Mark edge seam */
WM_keymap_add_item(keymap, "UV_OT_mark_seam_uv", YKEY, KM_PRESS, 0, 0);
Modified: branches/soc-2011-onion/source/blender/makesrna/intern/rna_space.c
===================================================================
--- branches/soc-2011-onion/source/blender/makesrna/intern/rna_space.c 2011-07-29 22:54:53 UTC (rev 38840)
+++ branches/soc-2011-onion/source/blender/makesrna/intern/rna_space.c 2011-07-29 23:06:40 UTC (rev 38841)
@@ -442,6 +442,11 @@
ED_space_image_paint_update(bmain->wm.first, scene->toolsettings);
}
+static void rna_SpaceImageEditor_uv_smooth_update(Main *bmain, Scene *scene, PointerRNA *UNUSED(ptr))
+{
+ ED_space_image_uv_smooth_update(bmain->wm.first, scene->toolsettings);
+}
+
static void rna_update_island_manager(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
SpaceImage *sima= (SpaceImage*)(ptr->data);
@@ -1643,7 +1648,7 @@
RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_SMOOTH_BRUSH);
RNA_def_property_ui_text(prop, "Smooth Brush", "Enable brush for uv smoothing");
RNA_def_property_ui_icon(prop, ICON_TPAINT_HLT, 0);
- RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, "rna_SpaceImageEditor_paint_update");
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, "rna_SpaceImageEditor_uv_smooth_update");
/* grease pencil */
prop= RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
Modified: branches/soc-2011-onion/source/blenderplayer/bad_level_call_stubs/stubs.c
===================================================================
--- branches/soc-2011-onion/source/blenderplayer/bad_level_call_stubs/stubs.c 2011-07-29 22:54:53 UTC (rev 38840)
+++ branches/soc-2011-onion/source/blenderplayer/bad_level_call_stubs/stubs.c 2011-07-29 23:06:40 UTC (rev 38841)
@@ -190,6 +190,7 @@
int ED_space_image_show_render(struct SpaceImage *sima){return 0;}
int ED_space_image_show_paint(struct SpaceImage *sima){return 0;}
void ED_space_image_paint_update(struct wmWindowManager *wm, struct ToolSettings *settings){}
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list