[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [29736] branches/soc-2010-jwilkins: This is a WIP to allow 'unified brush settings' ie when you change strength or size of a brush it updates for all brushes.
Tom Musgrove
LetterRip at gmail.com
Sun Jun 27 13:35:25 CEST 2010
Revision: 29736
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29736
Author: letterrip
Date: 2010-06-27 13:35:25 +0200 (Sun, 27 Jun 2010)
Log Message:
-----------
This is a WIP to allow 'unified brush settings' ie when you change strength or size of a brush it updates for all brushes. Also in this commit are stubs.c changes needed for gameengine compiling
Modified Paths:
--------------
branches/soc-2010-jwilkins/release/scripts/ui/space_userpref.py
branches/soc-2010-jwilkins/release/scripts/ui/space_view3d_toolbar.py
branches/soc-2010-jwilkins/source/blender/blenkernel/intern/brush.c
branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/paint_stroke.c
branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/sculpt.c
branches/soc-2010-jwilkins/source/blender/imbuf/intern/cineon/cineonlib.c
branches/soc-2010-jwilkins/source/blender/makesdna/DNA_brush_types.h
branches/soc-2010-jwilkins/source/blender/makesdna/DNA_userdef_types.h
branches/soc-2010-jwilkins/source/blender/makesrna/intern/rna_brush.c
branches/soc-2010-jwilkins/source/blender/makesrna/intern/rna_userdef.c
branches/soc-2010-jwilkins/source/blenderplayer/bad_level_call_stubs/stubs.c
Modified: branches/soc-2010-jwilkins/release/scripts/ui/space_userpref.py
===================================================================
--- branches/soc-2010-jwilkins/release/scripts/ui/space_userpref.py 2010-06-27 08:35:27 UTC (rev 29735)
+++ branches/soc-2010-jwilkins/release/scripts/ui/space_userpref.py 2010-06-27 11:35:25 UTC (rev 29736)
@@ -327,6 +327,16 @@
row.separator()
col = row.column()
+ col.label(text="Paint and Sculpt:")
+ col.prop(edit, "use_unified_radius_and_strength", text="Unified Size and Strength")
+ col.prop(edit, "sculpt_paint_pixel_radius", text="Unified Pixel Radius")
+ col.prop(edit, "sculpt_paint_bu_radius", text="Unified BU Radius")
+ col.prop(edit, "sculpt_paint_strength", text="Unified Strength")
+
+ col.separator()
+ col.separator()
+ col.separator()
+
col.label(text="Duplicate Data:")
col.prop(edit, "duplicate_mesh", text="Mesh")
col.prop(edit, "duplicate_surface", text="Surface")
Modified: branches/soc-2010-jwilkins/release/scripts/ui/space_view3d_toolbar.py
===================================================================
--- branches/soc-2010-jwilkins/release/scripts/ui/space_view3d_toolbar.py 2010-06-27 08:35:27 UTC (rev 29735)
+++ branches/soc-2010-jwilkins/release/scripts/ui/space_view3d_toolbar.py 2010-06-27 11:35:25 UTC (rev 29736)
@@ -553,9 +553,15 @@
row = col.row(align=True)
if brush.lock_brush_size:
- row.prop(brush, "unprojected_radius", text="Units", slider=True)
+ if bpy.context.user_preferences.edit.use_unified_radius_and_strength:
+ row.prop(bpy.context.user_preferences.edit, "sculpt_paint_bu_radius", text ="Units", slider=True)
+ else:
+ row.prop(brush, "unprojected_radius", text="Units", slider=True)
else:
- row.prop(brush, "size", slider=True, text="Pixels")
+ if bpy.context.user_preferences.edit.use_unified_radius_and_strength:
+ row.prop(bpy.context.user_preferences.edit, "sculpt_paint_pixel_radius", text="Pixels", slider=True)
+ else:
+ row.prop(brush, "size", text="Pixels", slider=True)
if brush.sculpt_tool in ('GRAB', 'SNAKE_HOOK', 'THUMB'):
row = col.row(align=True)
@@ -567,8 +573,15 @@
if brush.sculpt_tool not in ('GRAB', 'THUMB', 'SNAKE_HOOK', 'ROTATE'):
row.prop(brush, "use_size_pressure", toggle=True, text="")
- row = col.row(align=True)
- row.prop(brush, "strength", slider=True)
+ #row = col.row(align=True)
+ #row.prop(bpy.context.user_preferences.edit, "use_unified_radius_and_strength")
+ if bpy.context.user_preferences.edit.use_unified_radius_and_strength:
+ row = col.row(align=True)
+ row.prop(bpy.context.user_preferences.edit, "sculpt_paint_strength", slider=True)
+
+ else:
+ row = col.row(align=True)
+ row.prop(brush, "strength", slider=True)
row.prop(brush, "use_strength_pressure", text="")
col.prop(brush, "strength_multiplier", slider=True)
Modified: branches/soc-2010-jwilkins/source/blender/blenkernel/intern/brush.c
===================================================================
--- branches/soc-2010-jwilkins/source/blender/blenkernel/intern/brush.c 2010-06-27 08:35:27 UTC (rev 29735)
+++ branches/soc-2010-jwilkins/source/blender/blenkernel/intern/brush.c 2010-06-27 11:35:25 UTC (rev 29736)
@@ -70,43 +70,59 @@
brush= alloc_libblock(&G.main->brush, ID_BR, name);
- brush->rgb[0]= 1.0f;
+ /* BRUSH SCULPT TOOL SETTINGS */
+ brush->sculpt_tool = SCULPT_TOOL_DRAW; /* sculpting defaults to the draw tool for new brushes */
+ brush->plane_offset= 0.0f; /* how far above or below the plane that is found by averaging the faces */
+ brush->size= 50; /* radius of the brush in pixels */
+ brush->alpha= 0.5f; /* brush strength/intensity probably variable should be renamed? */
+
+ /* BRUSH PAINT TOOL SETTINGS */
+ brush->rgb[0]= 1.0f; /* default rgb color of the brush when painting - white */
brush->rgb[1]= 1.0f;
brush->rgb[2]= 1.0f;
- brush->alpha= 0.2f;
- brush->size= 25;
- brush->plane_offset= 0.0f;
- brush->texture_offset = 0.0f;
- brush->spacing= 15;
+
+
+ /* BRUSH STROKE SETTINGS */
+ brush->spacing= 12; /* how far each brush dot should be spaced as a percentage of brush diameter */
brush->smooth_stroke_radius= 75;
brush->smooth_stroke_factor= 0.9;
- brush->rate= 0.1f;
+ brush->rate= 0.1f; /* time delay between dots of paint or sculpting when doing airbrush mode */
brush->jitter= 0.0f;
brush->clone.alpha= 0.5;
- brush->sculpt_tool = SCULPT_TOOL_DRAW;
+
//brush->stroke_tool = STROKE_TOOL_FREEHAND;
brush->flag |= BRUSH_SPACE;
- brush->detail = 0.25f;
+
+ /* UNLIMITED CLAY SETTINGS */
+ brush->detail = 0.25f; /* this is how much to tesselate faces when sculpting with unlimited clay */
brush->smoothness = 0.25f;
- brush->plane_offset = 0;
- brush->texture_center_x = 0;
+
+ /* BRUSH TEXTURE SETTINGS */
+ brush->texture_offset = 0.0f; /* this determines where in the texture the midpoint of the brush is */
+ brush->texture_center_x = 0; /* center offset for textures used on brush or as stencils */
brush->texture_center_y = 0;
- brush->texture_scale_x = 1;
+
+ brush->texture_scale_x = 1; /* scaling factor for textures used on brush or as stencils */
brush->texture_scale_y = 1;
+
brush->texture_offset = 0;
- brush->overlay_texture = 0;
+
+ brush->overlay_texture = 0; /* toggles whether the texture is shown as an overlay when not sculpting 0 is off */
brush->autosmooth_factor = 0;
- brush->add_col[0] = 1.00;
+ /* color of the 'on surface' brush */
+ brush->add_col[0] = 1.00; /* add mode color is red */
brush->add_col[1] = 0.39;
brush->add_col[2] = 0.39;
- brush->sub_col[0] = 0.39;
+ brush->sub_col[0] = 0.39; /* subtract mode color is blue */
brush->sub_col[1] = 0.39;
brush->sub_col[2] = 1.00;
- brush_curve_preset(brush, CURVE_PRESET_SMOOTH);
+ /* note we should have a smoothing color also */
+ brush_curve_preset(brush, CURVE_PRESET_SMOOTH); /* the default alpha falloff curve */
+
default_mtex(&brush->mtex);
/* enable fake user by default */
Modified: branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/paint_stroke.c
===================================================================
--- branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/paint_stroke.c 2010-06-27 08:35:27 UTC (rev 29735)
+++ branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/paint_stroke.c 2010-06-27 11:35:25 UTC (rev 29736)
@@ -20,7 +20,7 @@
*
* The Original Code is: all of this file.
*
- * Contributor(s): none yet.
+ * Contributor(s): Jason Wilkins, Tom Musgrove.
*
* ***** END GPL LICENSE BLOCK *****
*
Modified: branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/sculpt.c
===================================================================
--- branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/sculpt.c 2010-06-27 08:35:27 UTC (rev 29735)
+++ branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/sculpt.c 2010-06-27 11:35:25 UTC (rev 29736)
@@ -22,7 +22,7 @@
*
* The Original Code is: all of this file.
*
- * Contributor(s): none yet.
+ * Contributor(s): Jason Wilkins, Tom Musgrove.
*
* ***** END GPL LICENSE BLOCK *****
*
Modified: branches/soc-2010-jwilkins/source/blender/imbuf/intern/cineon/cineonlib.c
===================================================================
--- branches/soc-2010-jwilkins/source/blender/imbuf/intern/cineon/cineonlib.c 2010-06-27 08:35:27 UTC (rev 29735)
+++ branches/soc-2010-jwilkins/source/blender/imbuf/intern/cineon/cineonlib.c 2010-06-27 11:35:25 UTC (rev 29736)
@@ -31,6 +31,8 @@
#include <winsock.h>
#else
#include <netinet/in.h> /* htonl() */
+#include <arpa/inet.h> /* htonl() on OS X */
+
#endif
#include <string.h> /* memset */
#include "cin_debug_stuff.h"
Modified: branches/soc-2010-jwilkins/source/blender/makesdna/DNA_brush_types.h
===================================================================
--- branches/soc-2010-jwilkins/source/blender/makesdna/DNA_brush_types.h 2010-06-27 08:35:27 UTC (rev 29735)
+++ branches/soc-2010-jwilkins/source/blender/makesdna/DNA_brush_types.h 2010-06-27 11:35:25 UTC (rev 29736)
@@ -139,7 +139,7 @@
#define BRUSH_EDGE_TO_EDGE (1<<22)
#define BRUSH_RESTORE_MESH (1<<23)
-/* Brush stroke_tool */
+/* Brush stroke_style */
//#define STROKE_TOOL_DOTS 1
//#define STROKE_TOOL_SPACE 2
//#define STROKE_TOOL_FREEHAND 3
Modified: branches/soc-2010-jwilkins/source/blender/makesdna/DNA_userdef_types.h
===================================================================
--- branches/soc-2010-jwilkins/source/blender/makesdna/DNA_userdef_types.h 2010-06-27 08:35:27 UTC (rev 29735)
+++ branches/soc-2010-jwilkins/source/blender/makesdna/DNA_userdef_types.h 2010-06-27 11:35:25 UTC (rev 29736)
@@ -341,9 +341,10 @@
short gp_settings;
short tb_leftmouse, tb_rightmouse;
struct SolidLight light[3];
+ short sculpt_paint_settings; /* user preferences for sculpt and paint */
short tw_hotspot, tw_flag, tw_handlesize, tw_size;
short textimeout,texcollectrate;
- short wmdrawmethod, wmpad;
+ short wmdrawmethod; /* removed wmpad */
int memcachelimit;
int prefetchframes;
short frameserverport;
@@ -373,6 +374,10 @@
short autokey_flag; /* flags for autokeying */
struct ColorBand coba_weight; /* from texture.h */
+ int sculpt_paint_pixel_radius; /* unified radius of brush in pixels */
+ float sculpt_paint_bu_radius; /* unified radius of brush in blender units */
+ float sculpt_paint_strength; /* unified strenght of brush scaled to brush radius */
+ float pad3;
} UserDef;
extern UserDef U; /* from blenkernel blender.c */
@@ -524,6 +529,9 @@
#define GP_PAINT_DOSMOOTH (1<<0)
#define GP_PAINT_DOSIMPLIFY (1<<1)
+/* sculpt_paint_settings */
+#define BRUSH_USE_UNIFIED_RADIUS_AND_STRENGTH (1<<0)
+
/* color picker types */
#define USER_CP_CIRCLE 0
#define USER_CP_SQUARE_SV 1
Modified: branches/soc-2010-jwilkins/source/blender/makesrna/intern/rna_brush.c
===================================================================
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list