Page MenuHome

Fix potential issues when loading files with missing libraries
ClosedPublic

Authored by Sebastian Parborg (zeddb) on Tue, Aug 6, 5:15 PM.

Details

Summary

This is a continuation of rB39f005eae8eed8b939579aff8c9a05a4f50e5e38

Now all the fields where we check for object type in RNA (like rna_Curve_object_poll) will have a safe guard for when this isn't the case.
For example when loading files that has missing object libraries and all missing objects are replaced with empties (placeholders).

Diff Detail

Repository
rB Blender

Event Timeline

Besides notes below, patch LGTM... Which is kind of expected since I suggested those changes to @Sebastian Parborg (zeddb) ;)

So this diff is mostly to get @Brecht Van Lommel (brecht)'s point of view on that change.

Note that the other solution here (to generate placeholder objects of the expected type) is simply impossible, as we do not store object's type info for the linked ID in our .blend file....

source/blender/editors/object/object_constraint.c
502

Think that code should not reset the pointer, otherwise we loose the connection and relocating the broken lib to its valid path won't be able to recreate that link.
Same below too.

source/blender/modifiers/intern/MOD_surfacedeform.c
1287

Better use explicit pointer == NULL than implicit boolean check for NULL pointers... At least that's in our code practices iirc?

There's probably more issues like this throughout the code. This patch is fine with me though, not sure how else this would be handled better.

source/blender/modifiers/intern/MOD_surfacedeform.c
1287

In most other places we only do a implicit check. Is this something I should change in the other files also?

source/blender/modifiers/intern/MOD_surfacedeform.c
1287

We try to apply this rule to new code, old one can be cleaned up on a lazy basis (i.e. when you need to change it anyway for another reason)…

Sebastian Parborg (zeddb) marked 3 inline comments as done.Wed, Aug 14, 12:21 PM
Sebastian Parborg (zeddb) updated this revision to Diff 17098.

I've updated the patch based on the feedback.

This revision is now accepted and ready to land.Fri, Aug 23, 12:59 PM