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.
This commit is contained in:
parent
e666ee965c
commit
cf2e35fcfe
Notes:
blender-bot
2023-02-14 04:55:32 +01:00
Referenced by issue #58375, particle system convert button doesn't do anything. Referenced by issue #58118, Blender 2.8: Make duplicates real does nothing.
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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()) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue