Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2011-06-15 13:45:26 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2011-06-15 13:45:26 +0400
commit5e418071352977f0e55e0f84ffbb02ff8c5a6763 (patch)
tree6adffa0df839a882976dfe804bb7e83364165f8e
parentb09bb948ee5d59f80a4951ffd99733dd64f12a4a (diff)
Fix #27654: vertex parenting not working with constructive modifiers.
Vertex parents were not requesting the original index layer, now do this as part of depsgraph building, and make constraints with vertex groups use the same system. Fix is based on patch by Campbell, but with some changes.
-rw-r--r--source/blender/blenkernel/depsgraph_private.h3
-rw-r--r--source/blender/blenkernel/intern/constraint.c13
-rw-r--r--source/blender/blenkernel/intern/depsgraph.c17
-rw-r--r--source/blender/blenkernel/intern/object.c5
-rw-r--r--source/blender/blenloader/intern/readfile.c1
-rw-r--r--source/blender/makesdna/DNA_object_types.h5
6 files changed, 26 insertions, 18 deletions
diff --git a/source/blender/blenkernel/depsgraph_private.h b/source/blender/blenkernel/depsgraph_private.h
index 1fed115893c..ef4f320602b 100644
--- a/source/blender/blenkernel/depsgraph_private.h
+++ b/source/blender/blenkernel/depsgraph_private.h
@@ -69,8 +69,9 @@ typedef struct DagNode
void * ob;
void * first_ancestor;
int ancestor_count;
- unsigned int lay; // accumulated layers of its relations + itself
+ unsigned int lay; // accumulated layers of its relations + itself
unsigned int scelay; // layers due to being in scene
+ unsigned int customdata_mask; // customdata mask
int lasttime; // if lasttime != DagForest->time, this node was not evaluated yet for flushing
int BFS_dist; // BFS distance
int DFS_dist; // DFS distance
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index d3c14a9dd12..18c9ab7dc90 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -449,16 +449,9 @@ static void contarget_get_mesh_mat (Scene *scene, Object *ob, const char *substr
freeDM= 1;
}
else {
- /* when not in EditMode, use the 'final' derived mesh
- * - check if the custom data masks for derivedFinal mean that we can just use that
- * (this is more effficient + sufficient for most cases)
- */
- if (!(ob->lastDataMask & CD_MASK_MDEFORMVERT)) {
- dm = mesh_get_derived_final(scene, ob, CD_MASK_MDEFORMVERT);
- freeDM= 1;
- }
- else
- dm = (DerivedMesh *)ob->derivedFinal;
+ /* when not in EditMode, use the 'final' derived mesh, depsgraph
+ * ensures we build with CD_MDEFORMVERT layer */
+ dm = (DerivedMesh *)ob->derivedFinal;
}
/* only continue if there's a valid DerivedMesh */
diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c
index 472d7d77b80..c2800410657 100644
--- a/source/blender/blenkernel/intern/depsgraph.c
+++ b/source/blender/blenkernel/intern/depsgraph.c
@@ -372,6 +372,9 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
node2->first_ancestor = ob;
node2->ancestor_count += 1;
}
+
+ /* also build a custom data mask for dependencies that need certain layers */
+ node->customdata_mask= 0;
if (ob->type == OB_ARMATURE) {
if (ob->pose){
@@ -451,8 +454,12 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
case PARSKEL:
dag_add_relation(dag,node2,node,DAG_RL_DATA_DATA|DAG_RL_OB_OB, "Parent");
break;
- case PARVERT1: case PARVERT3: case PARBONE:
+ case PARVERT1: case PARVERT3:
dag_add_relation(dag,node2,node,DAG_RL_DATA_OB|DAG_RL_OB_OB, "Vertex Parent");
+ node2->customdata_mask |= CD_MASK_ORIGINDEX;
+ break;
+ case PARBONE:
+ dag_add_relation(dag,node2,node,DAG_RL_DATA_OB|DAG_RL_OB_OB, "Bone Parent");
break;
default:
if(ob->parent->type==OB_LATTICE)
@@ -647,8 +654,11 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
if (ELEM(con->type, CONSTRAINT_TYPE_FOLLOWPATH, CONSTRAINT_TYPE_CLAMPTO))
dag_add_relation(dag, node2, node, DAG_RL_DATA_OB|DAG_RL_OB_OB, cti->name);
else {
- if (ELEM3(obt->type, OB_ARMATURE, OB_MESH, OB_LATTICE) && (ct->subtarget[0]))
+ if (ELEM3(obt->type, OB_ARMATURE, OB_MESH, OB_LATTICE) && (ct->subtarget[0])) {
dag_add_relation(dag, node2, node, DAG_RL_DATA_OB|DAG_RL_OB_OB, cti->name);
+ if (obt->type == OB_MESH)
+ node2->customdata_mask |= CD_MASK_MDEFORMVERT;
+ }
else
dag_add_relation(dag, node2, node, DAG_RL_OB_OB, cti->name);
}
@@ -722,6 +732,9 @@ struct DagForest *build_dag(Main *bmain, Scene *sce, short mask)
itA->node->color |= itA->type;
}
}
+
+ /* also flush custom data mask */
+ ((Object*)node->ob)->customdata_mask= node->customdata_mask;
}
}
/* now set relations equal, so that when only one parent changes, the correct recalcs are found */
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 16fa1605467..dff62b05bd3 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -2641,11 +2641,12 @@ void object_handle_update(Scene *scene, Object *ob)
#else /* ensure CD_MASK_BAREMESH for now */
EditMesh *em = (ob == scene->obedit)? BKE_mesh_get_editmesh(ob->data): NULL;
+ unsigned int data_mask= scene->customdata_mask | ob->customdata_mask | CD_MASK_BAREMESH;
if(em) {
- makeDerivedMesh(scene, ob, em, scene->customdata_mask | CD_MASK_BAREMESH); /* was CD_MASK_BAREMESH */
+ makeDerivedMesh(scene, ob, em, data_mask); /* was CD_MASK_BAREMESH */
BKE_mesh_end_editmesh(ob->data, em);
} else
- makeDerivedMesh(scene, ob, NULL, scene->customdata_mask | CD_MASK_BAREMESH);
+ makeDerivedMesh(scene, ob, NULL, data_mask);
#endif
}
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 1e604c45772..222c4bcf6fc 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -4321,6 +4321,7 @@ static void direct_link_object(FileData *fd, Object *ob)
MEM_freeN(hook);
}
+ ob->customdata_mask= 0;
ob->bb= NULL;
ob->derivedDeform= NULL;
ob->derivedFinal= NULL;
diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h
index 54a885a0860..f4488c140a0 100644
--- a/source/blender/makesdna/DNA_object_types.h
+++ b/source/blender/makesdna/DNA_object_types.h
@@ -250,12 +250,11 @@ typedef struct Object {
struct FluidsimSettings *fluidsimSettings; /* if fluidsim enabled, store additional settings */
struct DerivedMesh *derivedDeform, *derivedFinal;
- int lastDataMask; /* the custom data layer mask that was last used to calculate derivedDeform and derivedFinal */
+ unsigned int lastDataMask; /* the custom data layer mask that was last used to calculate derivedDeform and derivedFinal */
+ unsigned int customdata_mask; /* (extra) custom data layer mask to use for creating derivedmesh, set by depsgraph */
unsigned int state; /* bit masks of game controllers that are active */
unsigned int init_state; /* bit masks of initial state as recorded by the users */
- int pad2;
-
ListBase gpulamp; /* runtime, for lamps only */
ListBase pc_ids;
ListBase *duplilist; /* for temporary dupli list storage, only for use by RNA API */