This is an alternative method for fitting a curve which incrementally simplifies the curve, then re-fits.
Generally gives better results, also improves corner detection.
We need to leave tweak mode before trying to modifiy the action as doing
so will leave Blender in a semi-corrupted state.
Reviewers: #animation
Reviewed by: aligorith
Maniphest Tasks: T48397
Differential Revision: https://developer.blender.org/D2119
3D view
There was a misusage of the `outcol` and `texcol` params. The actual
formula should have been:
incol = facm * outcol + fact * ((one - outcol) * texcol * outcol +
outcol * scr);
To make sure the result is consistent with material mode, reuse the
material blend function (mix_soft), similarly to what most other texture
blend modes do.
Suspicious conditional found by PVS-Studio T48917
Original code (from Blender’s initial open-source commit!) looks like
it’s testing inputs to atan2f, to avoid undefined function values.
Passing xn=0 does *not* always evaluate to 0 though… I’m not sure if
this is a coding error or was done for a desired visual result.
Also changed xn==0 to xn>=0 to avoid function call in more cases.
Good description and visualization of atan2f function:
http://en.cppreference.com/w/c/numeric/math/atan2
It became rather annoying to have those functions duplicated.
Surely, it's not really nice it's actually a bad level call,
but similar thing is happening in OCIO and Cycles.
IMO, it's better than having functions re-implemented, and
have this solved with new OpenGL pipeline.
Redundant conditional (line 939) found with PVS-Studio T48917
There’s still a lot of true/false, 1/0, SELECT/DESELECT usage nearby.
Not a problem, just confusing to read.
Checking a condition right after we’ve checked it (and it hasn’t
changed). Most of these are trivial to understand.
split_quads in convertblender.c:
It seems quads should be processed and triangles should be marked as
not needing split. So I removed the outer vlr->v4 check.
Found with PVS-Studio T48917
Some of these check that dimensions match before running code that
assumes they do match.
For imb_stereo3d_write_anaglyph I *assume* this change reflects the
intended behavior. Before it was always grabbing alpha from buffer 0.
Found with PVS-Studio T48917
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.