Commit Graph

3120 Commits

Author SHA1 Message Date
Campbell Barton 8d1b289b78 Code cleanup: warnings (clang) 2014-03-30 19:37:43 +11:00
Campbell Barton c16bd951cd Enable GCC pedantic warnings with strict flags,
also modify MIN/MAX macros to prevent shadowing.
2014-03-30 15:04:20 +11:00
Campbell Barton 5819421e1b correct recent commit 2014-03-30 15:04:20 +11:00
Campbell Barton bbfeb120fc Code cleanup: use strict flags for BLI_rand 2014-03-30 15:04:20 +11:00
Campbell Barton faf529d036 BLI_rand: Add BLI_rng_get_float_unit_v3, was static rayshade func 2014-03-30 15:04:20 +11:00
Campbell Barton a6e8137983 Convenience macro for print_ funcs, saves passing id each time 2014-03-30 15:04:20 +11:00
Campbell Barton 480c5019bb Code cleanup: reflect_v3_v3v3 made redundant copies 2014-03-30 12:28:09 +11:00
Campbell Barton 3bd15fcf15 Correction for poly_to_tri_count (used over-complicated method) 2014-03-30 12:05:42 +11:00
Campbell Barton 1f58bfb8be Code cleanup: de-duplicate cotangent weight function & add arg sizes 2014-03-30 11:08:33 +11:00
Campbell Barton 23ef10c705 Code cleanup: kdopbvh, move minmax init into function 2014-03-30 10:33:01 +11:00
Campbell Barton 2100fb4094 Code cleanup: avoid setting du/dv twice with ray intersection 2014-03-29 22:38:01 +11:00
Campbell Barton fb0959f88d Code cleanup: replace dot with len_squared and is_zero checks 2014-03-29 22:24:12 +11:00
Campbell Barton ac07046e55 BMesh: optimize quad_coord, avoid duplicate sqrt calls 2014-03-28 15:25:02 +11:00
Campbell Barton 5981567ec6 Code cleanup: use len_v2v2_int for view zoom-scale 2014-03-28 15:02:57 +11:00
Campbell Barton 7199e2288f Code cleanup: use sqrtf when input and output are float 2014-03-28 14:53:37 +11:00
Campbell Barton bec7c8c7aa BMesh: optimize BM_face_legal_splits for concave faces 2014-03-27 11:48:18 +11:00
Campbell Barton 20a4e33837 Code cleanup: use consistent arg order for math api poly funcs 2014-03-27 08:30:14 +11:00
Dalai Felinto b4d259f044 New resolve_tri_uv_v3 util function
Compute barycentric coordinates (u, v) for a point with respect to a
triangle.

This is needed for Cycles baking but we decided to push this
independently of the upcoming main baking changes.

Code adapted from Christer Ericson's Real-Time Collision Detection.

Cleanup, refactoring and review from Campbell Barton.
2014-03-25 21:58:52 -03:00
Campbell Barton a7242c3162 Code cleanup: add _v2 suffix to resolve_tri/quad functions 2014-03-26 11:15:21 +11:00
Sergey Sharybin b7dbb2f48e Correction to the previous commit 2014-03-25 16:22:47 +06:00
Sergey Sharybin d4cc81d552 Fix T38870: Freezes when jumping in front of a keyframe.
Issue was caused by inverting a degenerate matrix when
evaluating drivers.

Solved by using tweaked inverse code (same as used in Cycles).

Should have no affect on cases when matrix is not degenerate.
2014-03-25 16:07:13 +06:00
Campbell Barton f0ca40f9c1 Code cleanup: function calls 2014-03-25 10:10:00 +11:00
Campbell Barton 05deec3204 Code cleanup: rename easing functions with BLI_easing_ prefix 2014-03-25 09:59:10 +11:00
Campbell Barton 673b665471 Code cleanup: rename BLI_math_easing to BLI_easing
Many hard coded values and really specific to time & keyframes.
2014-03-25 09:59:10 +11:00
Campbell Barton 32d5d072a0 Code cleanup: float/double promotion 2014-03-24 13:31:14 +11:00
Campbell Barton 551d1a1ed5 Code cleanup: style 2014-03-24 13:14:19 +11:00
Campbell Barton 25b4b5fb9f Fix for invalid abs() use (from daccaa7) 2014-03-24 12:57:18 +11:00
Antonis Ryakiotakis 1206faeb99 Warning cleanup:
* Comparison in utf detection code always failed
* Cast to integer to silence grumpy 64bit gcc
2014-03-22 14:41:38 +02:00
Thomas Dinges 44dc72334d Compile fix for Windows, M_PI was undefined. 2014-03-21 17:46:18 +01:00
Joshua Leung daccaa713b Patch T22084: Robert Penner Easing Equations for FCurves
This commit introduces support for a number of new interpolation types
which are useful for motion-graphics work. These define a number of
"easing equations" (basically, equations which define some preset
ways that one keyframe transitions to another) which reduce the amount
of manual work (inserting and tweaking keyframes) to achieve certain
common effects. For example, snappy movements, and fake-physics such
as bouncing/springing effects.

The additional interpolation types introduced in this commit can be found
in many packages and toolkits (notably Qt and all modern web browsers).
For more info and a few live demos, see [1] and [2].


Credits:
* Dan Eicher (dna)              - Original patch
* Thomas Beck (plasmasolutions) - Porting/updating patch to 2.70 codebase
* Joshua Leung (aligorith)      - Code review and a few polishing tweaks

Additional Resources:
[1] http://easings.net
[2] http://www.robertpenner.com/easing/
2014-03-22 03:00:27 +13:00
Lukas Tönne 2ea78fb28f Fix for clang build warnings: ATTR_WARN_UNUSED_RESULT is used after
the inline definitions are included, which gives lots of warnings
"attribute declaration must precede definition".

See also rB83617429cf28f2a19e991a0f71d892fc159a4419
2014-03-20 13:16:59 +01:00
Campbell Barton 27e86ed832 Code cleanup: use bools 2014-03-20 22:56:28 +11:00
Campbell Barton c6252d6e60 Math Lib: add angle_qt functions 2014-03-20 15:15:29 +11:00
Campbell Barton 19fcb4de44 Fix kdopbvh incorrect checks for failed allocs
also assert for invalid args
2014-03-20 10:49:30 +11:00
Campbell Barton a91247c2b4 Code cleanup: unreachable break/return 2014-03-19 12:47:09 +11:00
Campbell Barton ec55074f89 Code cleanup: jitter, use 2d float array 2014-03-18 10:52:38 +11:00
Antonis Ryakiotakis 06de5be90e Fix T39228 Gamma/lift/gain are burned out in the circular color pickers
and value/lightness slider stops midway.

Issue here is manyfold:

Color wheel does not support properties with different soft min/max
values than 1.0 (which after experimenting a little I left as is), and
also color management is completely destroying the mapping between the
value slider and the RNA property value range. To solve this I have
disabled color management by setting the property to gamma corrected
(only in RNA, Sequence editor coders please check!), otherwise it will
just become a big mess of tracking where color comes from and what kind
of color transforms it needs in different color pickers (if property has
non normalized range etc). HSL is not really meant to represent colors
outside a normalized space so I have disabled setting lightness above
1.0 in this model.

This will work, however it is hacking a color picker to do something
other than what it is supposed to do: pick a color from the screen
accurately. Which means normalized values always. The non normalized
colors picked for lift/gain/gamma through the pickers do not correspond
to any accurate colors; they are rather a user friendly way to 'sort of'
choose a color and a gamma with an indication of maximum value.

I think that lift/gamma/gain nodes need a dedicated widget for this
(besides it is quite clear that some options are written for that use
case) -or- a separate gamma multiplier for the picked color (which
should itself be in a normalized space)
2014-03-18 01:08:36 +02:00
Campbell Barton 7da2175271 KDTree: deprecate 'normal' argument
Normals for each kdtree node were allocated but never used,
and search args only use in particles/boids code.
2014-03-18 09:14:47 +11:00
Campbell Barton ec4e12d9a2 Code cleanup: comments and typos 2014-03-18 05:40:18 +11:00
Bastien Montagne 0e9084d5ec Fix T39210: Grid Fill is generating mesh that's inconsistent with selected edge loops
Issue was in BLI's rotation_between_vecs_to_quat(), which did not handled correctly cases where both vectors are colinear.

Patch by Campbell Barton and me.

Issue originaly tracked down by Yan Shi, many thanks!
2014-03-16 16:31:19 +01:00
Campbell Barton 2097e621ed Code cleanup: use r_ prefix for return args 2014-03-16 03:26:23 +11:00
Antonis Ryakiotakis bce924b43c HSL color wheel implementation.
This is a standard Hue - Saturation - Lightness model
(see for instance entry on wikipedia here: https://en.wikipedia.org/wiki/HSL_and_HSV)
Note though the difference between HSV and HSL saturation, which are not the same.

The advantage of having this color selection scheme is that artists can select
shades and tints of a color easily by using the lightness slider. Also colors
are arranged on (approximated) perceived lightness on the color wheel.

Beware, Old files opened with this preference saved will crash!

Reviewers: sergey, brecht, campbellbarton

Differential Revision: https://developer.blender.org/D385
2014-03-12 18:58:50 +02:00
Campbell Barton 921c829bcf Code cleanup: redundant normalize in bmbvh ray cast 2014-03-12 18:30:37 +11:00
Campbell Barton 6a4567b9ab BLI Rect: utility function to transform a point using 2 rect's 2014-03-09 15:48:09 +11:00
Bastien Montagne f01d19431d Fix T38873: Crashing on undo of ocean modifier.
Issue of this bug is that most part of fftw is not thread safe, only compute-intensive fftw_execute & co are.

Since smoke was affected by this issue as well, a global fftw mutex was added to BLI_threads.
Audaspace also uses fftw in one of its readers (AUD_BandPassReader.cpp),
but this is not an issue currently since this code is disabled in CMake/scons files.

There was another threading issue with smoke, we need to copy dm used by emit_from_derivedmesh(),
as it is modified by this func.

Reviewers: sergey, brecht

Reviewed By: brecht

CC: brecht

Differential Revision: https://developer.blender.org/D374
2014-03-01 21:05:50 +01:00
Campbell Barton 9737717234 Fix for some unlikely memory leaks, remove redundant checks 2014-03-01 20:14:20 +11:00
Campbell Barton 13ea967cce Code cleanup: correct abs use and quiet warnings 2014-03-01 14:26:18 +11:00
Campbell Barton 3a99fa5d7f Revert own changes to CLAMP and CLAMPIS, caused T38875 2014-02-28 11:47:02 +11:00
Campbell Barton b5d6f14290 Fix T38858: Crazy spaces was unpredictable with co-linear edges 2014-02-27 12:28:40 +11:00
Campbell Barton d76bcf98a3 MSVC: improve warnings for scons and cmake
Some int/float conversion warnings were disabled by buildsystems but
re-enabled by BLI_winstuff.h, the warnigns relate to conversions not
considered issues on other systems so better just quiet them.
2014-02-19 17:37:02 +11:00