[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [36295] trunk/blender/source/blender: Sculpting on shapekeys
Sergey Sharybin
g.ulairi at gmail.com
Sat Apr 23 11:07:46 CEST 2011
Revision: 36295
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=36295
Author: nazgul
Date: 2011-04-23 09:07:46 +0000 (Sat, 23 Apr 2011)
Log Message:
-----------
Sculpting on shapekeys
======================
All this work with sculpting on armatured/deformed mesh allowed to
implement sculpting on non-locked keys very easy -- just use the same
approach of propagating offsets from deformed PBVH to "sculpting layer".
- If key is locked, then old logic would be used.
- If there's multires modifier enabled, sculpting would happen on multires.
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/intern/cdderivedmesh.c
trunk/blender/source/blender/editors/sculpt_paint/sculpt.c
Modified: trunk/blender/source/blender/blenkernel/intern/cdderivedmesh.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/cdderivedmesh.c 2011-04-23 08:52:27 UTC (rev 36294)
+++ trunk/blender/source/blender/blenkernel/intern/cdderivedmesh.c 2011-04-23 09:07:46 UTC (rev 36295)
@@ -197,9 +197,21 @@
{
CDDerivedMesh *cddm = (CDDerivedMesh*) dm;
Mesh *me= ob->data;
+ int deformed= 0;
- if(ob->sculpt->modifiers_active) return 0;
+ /* active modifiers means extra deformation, which can't be handled correct
+ on bith of PBVH and sculpt "layer" levels, so use PBVH only for internal brush
+ stuff and show final DerivedMesh so user would see actual object shape */
+ deformed|= ob->sculpt->modifiers_active;
+ /* as in case with modifiers, we can't synchronize deformation made against
+ PBVH and non-locked keyblock, so also use PBVH only for brushes and
+ final DM to give final result to user */
+ deformed|= ob->sculpt->kb && (ob->shapeflag&OB_SHAPE_LOCK) == 0;
+
+ if(deformed)
+ return 0;
+
return (cddm->mvert == me->mvert) || ob->sculpt->kb;
}
Modified: trunk/blender/source/blender/editors/sculpt_paint/sculpt.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/sculpt.c 2011-04-23 08:52:27 UTC (rev 36294)
+++ trunk/blender/source/blender/editors/sculpt_paint/sculpt.c 2011-04-23 09:07:46 UTC (rev 36295)
@@ -175,10 +175,15 @@
int sculpt_modifiers_active(Scene *scene, Object *ob)
{
ModifierData *md;
+ Mesh *me= (Mesh*)ob->data;
MultiresModifierData *mmd= sculpt_multires_active(scene, ob);
if(mmd) return 0;
+ /* non-locked shaoe keys could be handled in the same way as deformed mesh */
+ if((ob->shapeflag&OB_SHAPE_LOCK)==0 && me->key && ob->shapenr)
+ return 1;
+
md= modifiers_getVirtualModifierList(ob);
/* exception for shape keys because we can edit those */
@@ -2708,7 +2713,7 @@
ss->modifiers_active= sculpt_modifiers_active(scene, ob);
- if((ob->shapeflag & OB_SHAPE_LOCK) && !mmd) ss->kb= ob_get_keyblock(ob);
+ if(!mmd) ss->kb= ob_get_keyblock(ob);
else ss->kb= NULL;
if(mmd) {
@@ -3342,7 +3347,7 @@
sculpt_update_tex(sd, ss);
}
-static int sculpt_brush_stroke_init(bContext *C, ReportList *reports)
+static int sculpt_brush_stroke_init(bContext *C, ReportList *UNUSED(reports))
{
Scene *scene= CTX_data_scene(C);
Object *ob= CTX_data_active_object(C);
@@ -3350,11 +3355,6 @@
SculptSession *ss = CTX_data_active_object(C)->sculpt;
Brush *brush = paint_brush(&sd->paint);
- if(ob_get_key(ob) && !(ob->shapeflag & OB_SHAPE_LOCK)) {
- BKE_report(reports, RPT_ERROR, "Shape key sculpting requires a locked shape.");
- return 0;
- }
-
view3d_operator_needs_opengl(C);
sculpt_brush_init_tex(sd, ss);
More information about the Bf-blender-cvs
mailing list