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
path: root/source
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2018-12-04 18:04:10 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2018-12-04 18:04:10 +0300
commitcf2e35fcfe31aa2c1836f51d1206901b4be6aeba (patch)
treebea7f3e6234470e70ab2aa45e6faae28b0f267a2 /source
parente666ee965c63322531fba5203905e7d9ca567ed3 (diff)
Fix T58118: Make duplicates real does nothing
The issue was caused by transflag set in geometry evaluation never copied back top original object. Now we have a dedicated operation which does all sort copy back to original object, so we don't have to worry about atomic assignments or what gets set where. Still need to move boundbox to the same function, but it needs some careful doublechecking first.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/BKE_object.h5
-rw-r--r--source/blender/blenkernel/intern/object_update.c31
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_nodes.cc8
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations.cc19
-rw-r--r--source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc1
-rw-r--r--source/blender/depsgraph/intern/depsgraph_type_defines.cc4
-rw-r--r--source/blender/depsgraph/intern/depsgraph_types.h40
-rw-r--r--source/blender/depsgraph/intern/nodes/deg_node_component.cc2
-rw-r--r--source/blender/depsgraph/intern/nodes/deg_node_component.h1
9 files changed, 78 insertions, 33 deletions
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h
index 35de1501494..ff069bcbe79 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -247,7 +247,10 @@ void BKE_object_eval_uber_data(
struct Scene *scene,
struct Object *ob);
-void BKE_object_eval_boundbox(struct Depsgraph *depsgraph, struct Object *object);
+void BKE_object_eval_boundbox(struct Depsgraph *depsgraph,
+ struct Object *object);
+void BKE_object_synchronize_to_original(struct Depsgraph *depsgraph,
+ struct Object *object);
void BKE_object_eval_ptcache_reset(
struct Depsgraph *depsgraph,
diff --git a/source/blender/blenkernel/intern/object_update.c b/source/blender/blenkernel/intern/object_update.c
index 2ac4c739e09..b95f1c821e2 100644
--- a/source/blender/blenkernel/intern/object_update.c
+++ b/source/blender/blenkernel/intern/object_update.c
@@ -142,14 +142,6 @@ void BKE_object_eval_transform_final(Depsgraph *depsgraph, Object *ob)
/* Set negative scale flag in object. */
if (is_negative_m4(ob->obmat)) ob->transflag |= OB_NEG_SCALE;
else ob->transflag &= ~OB_NEG_SCALE;
-
- if (DEG_is_active(depsgraph)) {
- Object *ob_orig = DEG_get_original_object(ob);
- copy_m4_m4(ob_orig->obmat, ob->obmat);
- copy_m4_m4(ob_orig->constinv, ob->constinv);
- ob_orig->transflag = ob->transflag;
- ob_orig->flag = ob->flag;
- }
}
void BKE_object_handle_data_update(
@@ -271,6 +263,8 @@ void BKE_object_handle_data_update(
BKE_object_eval_boundbox(depsgraph, ob);
}
+/* TODO(sergey): Ensure that bounding box is already calculated, and move this
+ * into BKE_object_synchronize_to_original(). */
void BKE_object_eval_boundbox(Depsgraph *depsgraph, Object *object)
{
if (!DEG_is_active(depsgraph)) {
@@ -286,6 +280,21 @@ void BKE_object_eval_boundbox(Depsgraph *depsgraph, Object *object)
}
}
+void BKE_object_synchronize_to_original(Depsgraph *depsgraph, Object *object)
+{
+ if (!DEG_is_active(depsgraph)) {
+ return;
+ }
+ Object *object_orig = DEG_get_original_object(object);
+ /* Base flags. */
+ object_orig->base_flag = object->base_flag;
+ /* Transformation flags. */
+ copy_m4_m4(object_orig->obmat, object->obmat);
+ copy_m4_m4(object_orig->constinv, object->constinv);
+ object_orig->transflag = object->transflag;
+ object_orig->flag = object->flag;
+}
+
bool BKE_object_eval_proxy_copy(Depsgraph *depsgraph,
Object *object)
{
@@ -430,12 +439,6 @@ void BKE_object_eval_flush_base_flags(Depsgraph *depsgraph,
}
object->base_local_view_bits = base->local_view_bits;
- /* Copy to original object datablock if needed. */
- if (DEG_is_active(depsgraph)) {
- Object *object_orig = DEG_get_original_object(object);
- object_orig->base_flag = object->base_flag;
- }
-
if (object->mode == OB_MODE_PARTICLE_EDIT) {
for (ParticleSystem *psys = object->particlesystem.first;
psys != NULL;
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
index 8726f51012e..d1837e7a69a 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
@@ -579,6 +579,7 @@ void DepsgraphNodeBuilder::build_object(int base_index,
}
/* Create ID node for object and begin init. */
IDDepsNode *id_node = add_id_node(&object->id);
+ Object *object_cow = get_cow_datablock(object);
id_node->linked_state = linked_state;
if (object == scene_->camera) {
id_node->is_directly_visible = true;
@@ -663,6 +664,13 @@ void DepsgraphNodeBuilder::build_object(int base_index,
DEG_OPCODE_PLACEHOLDER,
"Dupli");
}
+ /* Syncronization back to original object. */
+ add_operation_node(&object->id,
+ DEG_NODE_TYPE_SYNCHRONIZE,
+ function_bind(BKE_object_synchronize_to_original,
+ _1,
+ object_cow),
+ DEG_OPCODE_SYNCHRONIZE_TO_ORIGINAL);
}
void DepsgraphNodeBuilder::build_object_flags(
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index 649bc1a4275..23f1d229d6a 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -683,6 +683,12 @@ void DepsgraphRelationBuilder::build_object(Base *base, Object *object)
}
/* Point caches. */
build_object_pointcache(object);
+ /* Syncronization back to original object. */
+ OperationKey synchronize_key(&object->id,
+ DEG_NODE_TYPE_SYNCHRONIZE,
+ DEG_OPCODE_SYNCHRONIZE_TO_ORIGINAL);
+ add_relation(
+ final_transform_key, synchronize_key, "Synchronize to Original");
}
void DepsgraphRelationBuilder::build_object_flags(Base *base, Object *object)
@@ -697,6 +703,12 @@ void DepsgraphRelationBuilder::build_object_flags(Base *base, Object *object)
DEG_NODE_TYPE_OBJECT_FROM_LAYER,
DEG_OPCODE_OBJECT_BASE_FLAGS);
add_relation(view_layer_done_key, object_flags_key, "Base flags flush");
+ /* Syncronization back to original object. */
+ OperationKey synchronize_key(&object->id,
+ DEG_NODE_TYPE_SYNCHRONIZE,
+ DEG_OPCODE_SYNCHRONIZE_TO_ORIGINAL);
+ add_relation(
+ object_flags_key, synchronize_key, "Synchronize to Original");
}
void DepsgraphRelationBuilder::build_object_data(Object *object)
@@ -2023,6 +2035,13 @@ void DepsgraphRelationBuilder::build_object_data_geometry(Object *object)
}
}
}
+ /* Syncronization back to original object. */
+ ComponentKey final_geometry_jey(&object->id, DEG_NODE_TYPE_GEOMETRY);
+ OperationKey synchronize_key(&object->id,
+ DEG_NODE_TYPE_SYNCHRONIZE,
+ DEG_OPCODE_SYNCHRONIZE_TO_ORIGINAL);
+ add_relation(
+ final_geometry_jey, synchronize_key, "Synchronize to Original");
}
void DepsgraphRelationBuilder::build_object_data_geometry_datablock(ID *obdata)
diff --git a/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc b/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc
index ec1ea1e02b2..55eaf314a0a 100644
--- a/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc
+++ b/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc
@@ -421,6 +421,7 @@ static void deg_debug_graphviz_node(const DebugContext &ctx,
case DEG_NODE_TYPE_OBJECT_FROM_LAYER:
case DEG_NODE_TYPE_BATCH_CACHE:
case DEG_NODE_TYPE_DUPLI:
+ case DEG_NODE_TYPE_SYNCHRONIZE:
{
ComponentDepsNode *comp_node = (ComponentDepsNode *)node;
if (!comp_node->operations.empty()) {
diff --git a/source/blender/depsgraph/intern/depsgraph_type_defines.cc b/source/blender/depsgraph/intern/depsgraph_type_defines.cc
index 3f36b9f7831..d93882a7170 100644
--- a/source/blender/depsgraph/intern/depsgraph_type_defines.cc
+++ b/source/blender/depsgraph/intern/depsgraph_type_defines.cc
@@ -104,6 +104,8 @@ const char *nodeTypeAsString(eDepsNode_Type type)
STRINGIFY_TYPE(BATCH_CACHE);
/* Duplication. */
STRINGIFY_TYPE(DUPLI);
+ /* Synchronization. */
+ STRINGIFY_TYPE(SYNCHRONIZE);
/* Total number of meaningful node types. */
case NUM_DEG_NODE_TYPES: return "SpecialCase";
@@ -180,6 +182,8 @@ const char *operationCodeAsString(eDepsOperation_Code opcode)
/* Movie clip. */
STRINGIFY_OPCODE(MOVIECLIP_EVAL);
STRINGIFY_OPCODE(MOVIECLIP_SELECT_UPDATE);
+ /* Synchronization. */
+ STRINGIFY_OPCODE(SYNCHRONIZE_TO_ORIGINAL);
case DEG_NUM_OPCODES: return "SpecialCase";
#undef STRINGIFY_OPCODE
diff --git a/source/blender/depsgraph/intern/depsgraph_types.h b/source/blender/depsgraph/intern/depsgraph_types.h
index f8b519cb1aa..61a91c13913 100644
--- a/source/blender/depsgraph/intern/depsgraph_types.h
+++ b/source/blender/depsgraph/intern/depsgraph_types.h
@@ -157,11 +157,12 @@ typedef enum eDepsNode_Type {
DEG_NODE_TYPE_CACHE,
/* Batch Cache Component - TODO (dfelinto/sergey) rename to make it more generic. */
DEG_NODE_TYPE_BATCH_CACHE,
-
/* Duplication system. Used to force duplicated objects visible when
* when duplicator is visible.
*/
DEG_NODE_TYPE_DUPLI,
+ /* Synchronization back to original datablock. */
+ DEG_NODE_TYPE_SYNCHRONIZE,
/* Total number of meaningful node types. */
NUM_DEG_NODE_TYPES,
@@ -170,7 +171,7 @@ const char *nodeTypeAsString(eDepsNode_Type type);
/* Identifiers for common operations (as an enum). */
typedef enum eDepsOperation_Code {
- /* Generic Operations. ------------------------------ */
+ /* Generic Operations. -------------------------------------------------- */
/* Placeholder for operations which don't need special mention */
DEG_OPCODE_OPERATION = 0,
@@ -182,16 +183,16 @@ typedef enum eDepsOperation_Code {
// XXX: Placeholder while porting depsgraph code
DEG_OPCODE_PLACEHOLDER,
- /* Animation, Drivers, etc. ------------------------ */
+ /* Animation, Drivers, etc. --------------------------------------------- */
/* NLA + Action */
DEG_OPCODE_ANIMATION,
/* Driver */
DEG_OPCODE_DRIVER,
- /* Object related. --------------------------------- */
+ /* Object related. ------------------------------------------------------ */
DEG_OPCODE_OBJECT_BASE_FLAGS,
- /* Transform. -------------------------------------- */
+ /* Transform. ----------------------------------------------------------- */
/* Transform entry point - local transforms only */
DEG_OPCODE_TRANSFORM_LOCAL,
/* Parenting */
@@ -203,25 +204,25 @@ typedef enum eDepsOperation_Code {
/* Handle object-level updates, mainly proxies hacks and recalc flags. */
DEG_OPCODE_TRANSFORM_OBJECT_UBEREVAL,
- /* Rigid body. -------------------------------------- */
+ /* Rigid body. ---------------------------------------------------------- */
/* Perform Simulation */
DEG_OPCODE_RIGIDBODY_REBUILD,
DEG_OPCODE_RIGIDBODY_SIM,
/* Copy results to object */
DEG_OPCODE_RIGIDBODY_TRANSFORM_COPY,
- /* Geometry. ---------------------------------------- */
+ /* Geometry. ------------------------------------------------------------ */
/* Evaluate the whole geometry, including modifiers. */
DEG_OPCODE_GEOMETRY_UBEREVAL,
/* Evaluation of a shape key. */
DEG_OPCODE_GEOMETRY_SHAPEKEY,
- /* Object data. ------------------------------------- */
+ /* Object data. --------------------------------------------------------- */
DEG_OPCODE_LIGHT_PROBE_EVAL,
DEG_OPCODE_SPEAKER_EVAL,
- /* Pose. -------------------------------------------- */
+ /* Pose. ---------------------------------------------------------------- */
/* Init pose, clear flags, etc. */
DEG_OPCODE_POSE_INIT,
/* Initialize IK solver related pose stuff. */
@@ -234,7 +235,7 @@ typedef enum eDepsOperation_Code {
DEG_OPCODE_POSE_IK_SOLVER,
DEG_OPCODE_POSE_SPLINE_IK_SOLVER,
- /* Bone. -------------------------------------------- */
+ /* Bone. ---------------------------------------------------------------- */
/* Bone local transforms - entry point */
DEG_OPCODE_BONE_LOCAL,
/* Pose-space conversion (includes parent + restpose, */
@@ -257,37 +258,40 @@ typedef enum eDepsOperation_Code {
/* B-Bone segment shape computation (after DONE) */
DEG_OPCODE_BONE_SEGMENTS,
- /* Particles. --------------------------------------- */
+ /* Particles. ----------------------------------------------------------- */
/* Particle System evaluation. */
DEG_OPCODE_PARTICLE_SYSTEM_EVAL_INIT,
DEG_OPCODE_PARTICLE_SYSTEM_EVAL,
DEG_OPCODE_PARTICLE_SETTINGS_EVAL,
- /* Point Cache. ------------------------------------- */
+ /* Point Cache. --------------------------------------------------------- */
DEG_OPCODE_POINT_CACHE_RESET,
- /* Collections. ------------------------------------- */
+ /* Collections. --------------------------------------------------------- */
DEG_OPCODE_VIEW_LAYER_EVAL,
- /* Copy on Write. ------------------------------------ */
+ /* Copy on Write. ------------------------------------------------------- */
DEG_OPCODE_COPY_ON_WRITE,
- /* Shading. ------------------------------------------- */
+ /* Shading. ------------------------------------------------------------- */
DEG_OPCODE_SHADING,
DEG_OPCODE_MATERIAL_UPDATE,
DEG_OPCODE_WORLD_UPDATE,
- /* Batch caches. -------------------------------------- */
+ /* Batch caches. -------------------------------------------------------- */
DEG_OPCODE_GEOMETRY_SELECT_UPDATE,
- /* Masks. ------------------------------------------ */
+ /* Masks. --------------------------------------------------------------- */
DEG_OPCODE_MASK_ANIMATION,
DEG_OPCODE_MASK_EVAL,
- /* Movie clips. ------------------------------------ */
+ /* Movie clips. --------------------------------------------------------- */
DEG_OPCODE_MOVIECLIP_EVAL,
DEG_OPCODE_MOVIECLIP_SELECT_UPDATE,
+ /* Synchronization clips. ----------------------------------------------- */
+ DEG_OPCODE_SYNCHRONIZE_TO_ORIGINAL,
+
DEG_NUM_OPCODES,
} eDepsOperation_Code;
const char *operationCodeAsString(eDepsOperation_Code opcode);
diff --git a/source/blender/depsgraph/intern/nodes/deg_node_component.cc b/source/blender/depsgraph/intern/nodes/deg_node_component.cc
index 4bb9b9d17b3..c1c5899db37 100644
--- a/source/blender/depsgraph/intern/nodes/deg_node_component.cc
+++ b/source/blender/depsgraph/intern/nodes/deg_node_component.cc
@@ -401,6 +401,7 @@ DEG_COMPONENT_NODE_DEFINE(ShadingParameters, SHADING_PARAMETERS, ID_RECALC_DRAW)
DEG_COMPONENT_NODE_DEFINE(Transform, TRANSFORM, ID_RECALC_TRANSFORM);
DEG_COMPONENT_NODE_DEFINE(ObjectFromLayer, OBJECT_FROM_LAYER, ID_RECALC);
DEG_COMPONENT_NODE_DEFINE(Dupli, DUPLI, 0);
+DEG_COMPONENT_NODE_DEFINE(Synchronize, SYNCHRONIZE, 0);
/* Node Types Register =================================== */
@@ -424,6 +425,7 @@ void deg_register_component_depsnodes()
deg_register_node_typeinfo(&DNTI_TRANSFORM);
deg_register_node_typeinfo(&DNTI_OBJECT_FROM_LAYER);
deg_register_node_typeinfo(&DNTI_DUPLI);
+ deg_register_node_typeinfo(&DNTI_SYNCHRONIZE);
}
} // namespace DEG
diff --git a/source/blender/depsgraph/intern/nodes/deg_node_component.h b/source/blender/depsgraph/intern/nodes/deg_node_component.h
index e3057e1d3ce..f1ad3208952 100644
--- a/source/blender/depsgraph/intern/nodes/deg_node_component.h
+++ b/source/blender/depsgraph/intern/nodes/deg_node_component.h
@@ -200,6 +200,7 @@ DEG_COMPONENT_NODE_DECLARE_GENERIC(ShadingParameters);
DEG_COMPONENT_NODE_DECLARE_GENERIC(Transform);
DEG_COMPONENT_NODE_DECLARE_NO_COW_TAG_ON_UPDATE(ObjectFromLayer);
DEG_COMPONENT_NODE_DECLARE_GENERIC(Dupli);
+DEG_COMPONENT_NODE_DECLARE_GENERIC(Synchronize);
/* Bone Component */
struct BoneComponentDepsNode : public ComponentDepsNode {