Fix T39318: Blender 2.70 crash when I link an asset

Issue is a regression since threaded objetc update and caused
by the fact that some objects might share the same proxy object.

It's all fine but object_handle_update() will call update for
a proxy object which screws up threaded update.

The thing is, proxy object is marked as depending on a scene
object and such a call makes it so the children objetc is
being updated.

This is really bad and depsgraph is to take all responsibility
on updating the proxy objects.

So for now used a simple solution (which is safe to backport
to 'a') which is skipping proxy update if the scene update is
threaded and based on the DAG traversal.

There are some still areas which calls object update directly
and for that cases proxy object is still being updated from
object_handle_update().
This commit is contained in:
Sergey Sharybin 2014-03-24 15:10:16 +06:00
parent b69809c820
commit f48828b64e
Notes: blender-bot 2023-02-14 10:56:48 +01:00
Referenced by issue #39318, Blender 2.70 crash when I link an asset (object created in blender 2.69)
3 changed files with 15 additions and 9 deletions

View File

@ -167,7 +167,8 @@ void BKE_object_tfm_protected_restore(struct Object *ob,
void BKE_object_handle_update(struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob);
void BKE_object_handle_update_ex(struct EvaluationContext *eval_ctx,
struct Scene *scene, struct Object *ob,
struct RigidBodyWorld *rbw);
struct RigidBodyWorld *rbw,
const bool do_proxy_update);
void BKE_object_sculpt_modifiers_changed(struct Object *ob);
int BKE_object_obdata_texspace_get(struct Object *ob, short **r_texflag, float **r_loc, float **r_size, float **r_rot);

View File

@ -2843,7 +2843,8 @@ bool BKE_object_parent_loop_check(const Object *par, const Object *ob)
/* Ideally we shouldn't have to pass the rigid body world, but need bigger restructuring to avoid id */
void BKE_object_handle_update_ex(EvaluationContext *eval_ctx,
Scene *scene, Object *ob,
RigidBodyWorld *rbw)
RigidBodyWorld *rbw,
const bool do_proxy_update)
{
if (ob->recalc & OB_RECALC_ALL) {
/* speed optimization for animation lookups */
@ -3036,8 +3037,10 @@ void BKE_object_handle_update_ex(EvaluationContext *eval_ctx,
/* the no-group proxy case, we call update */
if (ob->proxy_group == NULL) {
// printf("call update, lib ob %s proxy %s\n", ob->proxy->id.name, ob->id.name);
BKE_object_handle_update(eval_ctx, scene, ob->proxy);
if (do_proxy_update) {
// printf("call update, lib ob %s proxy %s\n", ob->proxy->id.name, ob->id.name);
BKE_object_handle_update(eval_ctx, scene, ob->proxy);
}
}
}
}
@ -3048,7 +3051,7 @@ void BKE_object_handle_update_ex(EvaluationContext *eval_ctx,
*/
void BKE_object_handle_update(EvaluationContext *eval_ctx, Scene *scene, Object *ob)
{
BKE_object_handle_update_ex(eval_ctx, scene, ob, NULL);
BKE_object_handle_update_ex(eval_ctx, scene, ob, NULL, true);
}
void BKE_object_sculpt_modifiers_changed(Object *ob)

View File

@ -1270,7 +1270,7 @@ static void scene_update_all_bases(EvaluationContext *eval_ctx, Scene *scene, Sc
for (base = scene->base.first; base; base = base->next) {
Object *object = base->object;
BKE_object_handle_update_ex(eval_ctx, scene_parent, object, scene->rigidbody_world);
BKE_object_handle_update_ex(eval_ctx, scene_parent, object, scene->rigidbody_world, true);
if (object->dup_group && (object->transflag & OB_DUPLIGROUP))
BKE_group_handle_recalc_and_update(eval_ctx, scene_parent, object, object->dup_group);
@ -1304,9 +1304,11 @@ static void scene_update_object_func(TaskPool *pool, void *taskdata, int threadi
double start_time = 0.0;
bool add_to_stats = false;
PRINT("Thread %d: update object %s\n", threadid, object->id.name);
if (G.debug & G_DEBUG_DEPSGRAPH) {
if (object->recalc & OB_RECALC_ALL) {
printf("Thread %d: update object %s\n", threadid, object->id.name);
}
start_time = PIL_check_seconds_timer();
if (object->recalc & OB_RECALC_ALL) {
@ -1319,7 +1321,7 @@ static void scene_update_object_func(TaskPool *pool, void *taskdata, int threadi
* separately from main thread because of we've got no idea about
* dependencies inside the group.
*/
BKE_object_handle_update_ex(eval_ctx, scene_parent, object, scene->rigidbody_world);
BKE_object_handle_update_ex(eval_ctx, scene_parent, object, scene->rigidbody_world, false);
/* Calculate statistics. */
if (add_to_stats) {