Check to ensure we do not delete last instancing of an indirectly used object (forbidden
because it creates 'ghost' objects user have no real way to re-instance) was defeated by
the backward pointer 'proxy_from', which generated a 'false' indirect usage of (local)
proxy object itself (the one we are trying to delete).
Fixed by actually considering that ID usage as local if proxy object itself is local
(because that pointer actually does not 'pertain' to the object holding it, but to its proxy).
Yeah, it's... complicated, twisted and ugly - it's proxy.
(A - A).norm() is always 0 so condition is always true.
(A - B).norm() and (B - A).norm() both compute the same distance so I
picked one to match surrounding code.
Found with PVS-Studio T48917
I don’t think any other codec enum makes sense here, so probably just
an extra copy/paste. Here are the video codecs:
AV_CODEC_ID_NONE
AV_CODEC_ID_MPEG4
AV_CODEC_ID_MJPEG
AV_CODEC_ID_DNXHD
AV_CODEC_ID_MPEG2VIDEO
AV_CODEC_ID_MPEG1VIDEO
AV_CODEC_ID_DVVIDEO
AV_CODEC_ID_THEORA
AV_CODEC_ID_PNG <— alpha
AV_CODEC_ID_QTRLE <— alpha
AV_CODEC_ID_FFV1 <— alpha (if enabled)
AV_CODEC_ID_HUFFYUV <— alpha
AV_CODEC_ID_H264
AV_CODEC_ID_FLV1
Found with PVS-Studio T48917
This is really not elegant solution, but simplest for now.
Ideally, we'd check all IDs first and directly 'make local' (without need to copy)
those only indirectly used by other datablocks to be made local. Would also save us from the
need of the extra 'lib_local' parameter recently added to id_make_local.
Current code seems to work well enough though, and this is not high priority to fix imho.
Those bone pointers in object's pose bite again - turns out they can be accessed
before pose actually gets rebuilt in some cases (e.g. from undo writefile), so
we need to clear the pointers immediately.
Adding make_local for vfont/gpencil/group/freestyle linestyle/mask/scene/sound/text.
Note that there are still some lose ends here, since some type are not handled by id_copy
(Scene, Sound and VFont), which means in case a datablock of that type is used both
directly and indirectly, localization will fail.
Scene copying might be doable though (maybe with a simple new 'full shalow' mode to existing BKE_scene_copy?),
not sure about sounds and vfonts... Situations where this becomes an issue should be very rare corner cases anyway.
Turns out most BKE_foo_make_local datablock-specific functions are actually doing
exactly the same thing, only two currently need special additional operations
(object and brush ones). So added a BKE_id_make_local_generic instead
of copying same code over and over.
Also, changed a bit how make_local works in case we are localizing a whole library.
We need to do the 'remap' step (from old linked ID to new local one) in the second loop,
otherwise we miss some dependencies. This fixes main part of T48907.
Mainly the changes are related on establishing API to feed UV islands
to OpenSubdiv, so it will know all the connectivity information and
will be able to do proper interpolation.
Island calculation is currently rather slow, not sure how to make it
fast and not use lots of allocations.
Shouldn't be THAT bad, since this code is only runs once when creating
OSD mesh, and it's probably still faster than our orientation code.
Note that issue has several levels here actually, first one was metaball's materials
not being properly copied into new mesh (code was commented out because of some crash it
seems, made it a bit closer to mesh one and got no crash at all...).
Then, we were calling test_object_materials when ob->data is actually *not* new tmpmesh!
Will remove this call completely in next commit (to make it easier to bisect), I cannot see
any case where object would be assigned with newly generated tmpmesh in this func.
A bit work in progress, currently the following limitations:
- Texture shading only, Material shading will come later
- No UVs subdivision yet
- Always uses active UV and currently changing active UV will
not properly update the viewport.
Well, need to start somewhere :)
The flatten brush depended on accumulate being disabled,
Adding dynotopo support for accumulate caused problems for this tool (see T44390).
Enable for existing files.
- remove edge scaling, instead avoid checking intersections with connected edges.
- replace local line intersection functions with BLI_math
- center the projection for more precise calculation.
BKE_previewimg_copy() would simply copy PreviewImage's icon_id, without bothering about
ID one.
When we duplicate an ID, we want to reset its icon_id to zero (and regenerate it on-demand),
not keep same icon_id as original, so added new BKE_previewimg_id_copy helper to handle that.
This probably makes code somewhat slower, but we can't easily know
whether we can use a shortcut and only use directional lighting from
the scene.
Need some better integration between GPU and OpenSubdiv for that.