[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37176] branches/soc-2011-onion: Revision: 29596
Jason Wilkins
Jason.A.Wilkins at gmail.com
Sat Jun 4 16:57:26 CEST 2011
Revision: 37176
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37176
Author: jwilkins
Date: 2011-06-04 14:57:25 +0000 (Sat, 04 Jun 2011)
Log Message:
-----------
Revision: 29596
Author: nicholasbishop
Date: 2:46:23 PM, Monday, June 21, 2010
Message:
More changes in prepping for mask layers:
* Reversed direction of mask strength
* Changed subsurf_make_derived_from_derived to take a gridkey parameter, or NULL for the default key (just coords + normals)
** jwilkins:
** more tweaking of masking UI
** 29580 seemed to have already been applied, maybe I made a mistake in an earlier commit or something
Modified Paths:
--------------
branches/soc-2011-onion/release/scripts/startup/bl_ui/space_view3d_toolbar.py
branches/soc-2011-onion/source/blender/blenkernel/BKE_subsurf.h
branches/soc-2011-onion/source/blender/blenkernel/intern/multires.c
branches/soc-2011-onion/source/blender/blenkernel/intern/shrinkwrap.c
branches/soc-2011-onion/source/blender/blenkernel/intern/subsurf_ccg.c
branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_mask.c
branches/soc-2011-onion/source/blender/editors/sculpt_paint/sculpt.c
branches/soc-2011-onion/source/blender/gpu/intern/gpu_buffers.c
branches/soc-2011-onion/source/blender/modifiers/intern/MOD_subsurf.c
Property Changed:
----------------
branches/soc-2011-onion/
Property changes on: branches/soc-2011-onion
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/soc-2010-jwilkins:28499-37009
/branches/soc-2010-nicolasbishop:28448-29585
/trunk/blender:36833-37054
+ /branches/soc-2010-jwilkins:28499-37009
/branches/soc-2010-nicolasbishop:28448-29585,29596
/trunk/blender:36833-37054
Modified: branches/soc-2011-onion/release/scripts/startup/bl_ui/space_view3d_toolbar.py
===================================================================
--- branches/soc-2011-onion/release/scripts/startup/bl_ui/space_view3d_toolbar.py 2011-06-04 14:12:55 UTC (rev 37175)
+++ branches/soc-2011-onion/release/scripts/startup/bl_ui/space_view3d_toolbar.py 2011-06-04 14:57:25 UTC (rev 37176)
@@ -717,26 +717,26 @@
settings = self.paint_settings(context)
mesh = context.object.data
+ col = layout.column()
+ col.label("Mask:")
+
row = layout.row()
+ row.template_list(mesh, "paint_mask_layers", mesh, "active_paint_mask_index", rows=2)
- col = row.column()
- col.label("Mask:")
- col.template_list(mesh, "paint_mask_layers", mesh, "active_paint_mask_index", rows=2)
-
col = row.column(align=True)
col.operator("paint.mask_layer_add", icon='ZOOMIN', text="")
col.operator("paint.mask_layer_remove", icon='ZOOMOUT', text="")
- col = layout.column()
- col.active = mesh.active_paint_mask_index != -1
- col.operator("paint.mask_set", text="Clear").mode = 'CLEAR'
- col.operator("paint.mask_set", text="Fill").mode = 'FILL'
- col.operator("paint.mask_set", text="Invert").mode = 'INVERT'
- #col.operator("paint.mask_set", text="Random").mode = 'RANDOM'
+ row = layout.row(align=True)
+ row.active = mesh.active_paint_mask_index != -1
+ row.operator("paint.mask_set", text="Clear").mode = 'CLEAR'
+ row.operator("paint.mask_set", text="Fill").mode = 'FILL'
+ row.operator("paint.mask_set", text="Invert").mode = 'INVERT'
+ #row.operator("paint.mask_set", text="Random").mode = 'RANDOM'
if context.sculpt_object:
layout.separator()
- col = layout.column()
+ col = layout.column(align=True)
col.label("Hide:")
col.operator("sculpt.area_hide", text="Show Hidden Areas").show_all = True
col.operator("sculpt.area_hide", text="Select Area to Show")
Modified: branches/soc-2011-onion/source/blender/blenkernel/BKE_subsurf.h
===================================================================
--- branches/soc-2011-onion/source/blender/blenkernel/BKE_subsurf.h 2011-06-04 14:12:55 UTC (rev 37175)
+++ branches/soc-2011-onion/source/blender/blenkernel/BKE_subsurf.h 2011-06-04 14:57:25 UTC (rev 37176)
@@ -72,12 +72,12 @@
#define GRIDELEM_NO_OFFSET(_key) (_key->no ? (3*_key->co + _key->mask) * sizeof(float) : -1)
#define GRIDELEM_INTERP_COUNT(_key) (3*_key->co + _key->mask)
-#define GRIDELEM_AT(_grid, _elem, _key) (struct DMGridData*)(((char*)(_grid)) + (_elem) * GRIDELEM_SIZE(_key))
+#define GRIDELEM_AT(_grid, _elem, _key) ((struct DMGridData*)(((char*)(_grid)) + (_elem) * GRIDELEM_SIZE(_key)))
#define GRIDELEM_INC(_grid, _inc, _key) ((_grid) = GRIDELEM_AT(_grid, _inc, _key))
-#define GRIDELEM_CO(_grid, _key) (float*)(_grid)
-#define GRIDELEM_NO(_grid, _key) (float*)((char*)(_grid) + GRIDELEM_NO_OFFSET(_key))
-#define GRIDELEM_MASK(_grid, _key) (float*)((char*)(_grid) + GRIDELEM_MASK_OFFSET(_key))
+#define GRIDELEM_CO(_grid, _key) ((float*)(_grid))
+#define GRIDELEM_NO(_grid, _key) ((float*)((char*)(_grid) + GRIDELEM_NO_OFFSET(_key)))
+#define GRIDELEM_MASK(_grid, _key) ((float*)((char*)(_grid) + GRIDELEM_MASK_OFFSET(_key)))
#define GRIDELEM_CO_AT(_grid, _elem, _key) GRIDELEM_CO(GRIDELEM_AT(_grid, _elem, _key), _key)
#define GRIDELEM_NO_AT(_grid, _elem, _key) GRIDELEM_NO(GRIDELEM_AT(_grid, _elem, _key), _key)
@@ -86,6 +86,7 @@
struct DerivedMesh *subsurf_make_derived_from_derived(
struct DerivedMesh *dm,
struct SubsurfModifierData *smd,
+ struct GridKey *gridkey,
int useRenderParams, float (*vertCos)[3],
int isFinalCalc, int forEditMode, int inEditMode);
Modified: branches/soc-2011-onion/source/blender/blenkernel/intern/multires.c
===================================================================
--- branches/soc-2011-onion/source/blender/blenkernel/intern/multires.c 2011-06-04 14:12:55 UTC (rev 37175)
+++ branches/soc-2011-onion/source/blender/blenkernel/intern/multires.c 2011-06-04 14:57:25 UTC (rev 37176)
@@ -493,6 +493,15 @@
return multires_dm_create_from_derived(&mmd, 1, dm, ob, 0, 0);
}
+static GridKey *create_gridkey(DerivedMesh *dm)
+{
+ GridKey *gridkey = MEM_callocN(sizeof(GridKey), "create_gridkey");
+
+ GRIDELEM_KEY_INIT(gridkey, 1, 1, 1);
+
+ return gridkey;
+}
+
static DerivedMesh *subsurf_dm_create_local(Object *ob, DerivedMesh *dm, int lvl, int simple, int optimal)
{
SubsurfModifierData smd= {{NULL}};
@@ -504,7 +513,7 @@
if(optimal)
smd.flags |= eSubsurfModifierFlag_ControlEdges;
- return subsurf_make_derived_from_derived(dm, &smd, 0, NULL, 0, 0, (ob->mode & OB_MODE_EDIT));
+ return subsurf_make_derived_from_derived(dm, &smd, create_gridkey(dm), 0, NULL, 0, 0, (ob->mode & OB_MODE_EDIT));
}
@@ -819,8 +828,6 @@
/* TODO: for now we just always have a paintmask layer */
if(!stored_mask_layer) {
stored_mask_layer = CustomData_add_layer(&stored_grids[i], CD_PAINTMASK, CD_CALLOC, NULL, dGridSize*dGridSize*numVerts);
- for(x = 0; x < dGridSize*dGridSize*numVerts; ++x)
- stored_mask_layer[x] = 1;
}
}
Modified: branches/soc-2011-onion/source/blender/blenkernel/intern/shrinkwrap.c
===================================================================
--- branches/soc-2011-onion/source/blender/blenkernel/intern/shrinkwrap.c 2011-06-04 14:12:55 UTC (rev 37175)
+++ branches/soc-2011-onion/source/blender/blenkernel/intern/shrinkwrap.c 2011-06-04 14:57:25 UTC (rev 37176)
@@ -22,7 +22,7 @@
*
* The Original Code is: all of this file.
*
- * Contributor(s): Andr Pinto
+ * Contributor(s): André Pinto
*
* ***** END GPL LICENSE BLOCK *****
*/
@@ -562,7 +562,7 @@
ssmd.subdivType = ME_CC_SUBSURF; //catmull clark
ssmd.levels = smd->subsurfLevels; //levels
- ss_mesh = subsurf_make_derived_from_derived(dm, &ssmd, FALSE, NULL, 0, 0, (ob->mode & OB_MODE_EDIT));
+ ss_mesh = subsurf_make_derived_from_derived(dm, &ssmd, NULL, FALSE, NULL, 0, 0, (ob->mode & OB_MODE_EDIT));
if(ss_mesh)
{
Modified: branches/soc-2011-onion/source/blender/blenkernel/intern/subsurf_ccg.c
===================================================================
--- branches/soc-2011-onion/source/blender/blenkernel/intern/subsurf_ccg.c 2011-06-04 14:12:55 UTC (rev 37175)
+++ branches/soc-2011-onion/source/blender/blenkernel/intern/subsurf_ccg.c 2011-06-04 14:57:25 UTC (rev 37176)
@@ -2653,6 +2653,7 @@
struct DerivedMesh *subsurf_make_derived_from_derived(
struct DerivedMesh *dm,
struct SubsurfModifierData *smd,
+ struct GridKey *gridkey,
int useRenderParams, float (*vertCos)[3],
int isFinalCalc, int forEditMode, int inEditMode)
{
@@ -2661,11 +2662,12 @@
int useSubsurfUv = smd->flags & eSubsurfModifierFlag_SubsurfUv;
int drawInteriorEdges = !(smd->flags & eSubsurfModifierFlag_ControlEdges);
CCGDerivedMesh *result;
- GridKey *gridkey;
- /* TODO */
- gridkey = MEM_callocN(sizeof(GridKey), "subsurf_make_derived_from_derived.GridKey");
- GRIDELEM_KEY_INIT(gridkey, 1, 1, 1);
+ if(!gridkey) {
+ /* create default gridkey */
+ gridkey = MEM_callocN(sizeof(GridKey), "subsurf_make_derived_from_derived.GridKey");
+ GRIDELEM_KEY_INIT(gridkey, 1, 0, 1);
+ }
if(forEditMode) {
Modified: branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_mask.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_mask.c 2011-06-04 14:12:55 UTC (rev 37175)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_mask.c 2011-06-04 14:57:25 UTC (rev 37176)
@@ -28,8 +28,8 @@
static void set_mask_value(MaskSetMode mode, float *m)
{
- *m = (mode == MASKING_CLEAR ? 1 :
- mode == MASKING_FILL ? 0 :
+ *m = (mode == MASKING_CLEAR ? 0 :
+ mode == MASKING_FILL ? 1 :
mode == MASKING_INVERT ? (1 - *m) :
mode == MASKING_RANDOM ? (float)rand() / RAND_MAX : 0);
}
Modified: branches/soc-2011-onion/source/blender/editors/sculpt_paint/sculpt.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/sculpt_paint/sculpt.c 2011-06-04 14:12:55 UTC (rev 37175)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/sculpt.c 2011-06-04 14:57:25 UTC (rev 37176)
@@ -958,7 +958,7 @@
avg *= brush_curve_strength(br, len, ss->cache->radius); /* Falloff curve */
if (mask)
- avg *= *mask;
+ avg *= 1.0f - *mask;
return avg;
}
@@ -2843,7 +2843,7 @@
if(sculpt_brush_test(&test, vd.co)) {
float fade = bstrength*tex_strength(ss, brush, vd.co, NULL, test.dist)*frontface(brush, ss->cache->frontface_start, ss->cache->frontface_range, ss->cache->view_normal, origno[vd.i]);
- *vd.mask -= fade;
+ *vd.mask += fade;
CLAMP(*vd.mask, 0, 1);
if(vd.mvert)
Modified: branches/soc-2011-onion/source/blender/gpu/intern/gpu_buffers.c
===================================================================
--- branches/soc-2011-onion/source/blender/gpu/intern/gpu_buffers.c 2011-06-04 14:12:55 UTC (rev 37175)
+++ branches/soc-2011-onion/source/blender/gpu/intern/gpu_buffers.c 2011-06-04 14:57:25 UTC (rev 37176)
@@ -444,9 +444,9 @@
convert the mask strength to RGB-bytes */
static void mask_to_gpu_colors(unsigned char out[3], float mask_strength)
{
- out[0] = (unsigned char)(mask_strength*127.0f + (1.0f-mask_strength)*1.00*127.0f);
- out[1] = (unsigned char)(mask_strength*127.0f + (1.0f-mask_strength)*0.39*127.0f);
- out[2] = (unsigned char)(mask_strength*127.0f + (1.0f-mask_strength)*0.39*127.0f);
+ out[0] = (unsigned char)((1.0f-mask_strength)*128.0f + mask_strength*1.00*128.0f);
+ out[1] = (unsigned char)((1.0f-mask_strength)*128.0f + mask_strength*0.39*128.0f);
+ out[2] = (unsigned char)((1.0f-mask_strength)*128.0f + mask_strength*0.39*128.0f);
}
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list