Commit Graph

3244 Commits

Author SHA1 Message Date
Campbell Barton
cd8581af8e Fix T45706: Axis aligned tri-tri intersection 2015-08-19 12:20:39 +10:00
Campbell Barton
6cee6607a2 UI: avoid subtracting shadow from winrct
For popup interactions we need to know if events are in the region or not,
however subtracting the shadow isn't so reliable, since its not always added to all sides of a popup.

Instead, get the winrct value from a popup using the block rect, otherwise the winrct as-is.
2015-08-18 14:16:58 +10:00
Bastien Montagne
d70ffd375f BLI_threads: add an helper to wait on a condition using a global mutex.
Also, factorized internal code to get global mutex from its ID.
2015-08-10 15:03:31 +02:00
Campbell Barton
62c8f46ab6 Docs: comment functions in BLI & Py API 2015-08-05 02:09:03 +10:00
Campbell Barton
559e1434d8 parenthisize macro args to avoid errors 2015-08-02 13:54:06 +10:00
Campbell Barton
03f00eb91d Docs: doxy corrections 2015-07-31 23:44:37 +10:00
Campbell Barton
90655d06d4 Math Lib: add isect_tri_tri_epsilon_v3 function 2015-07-29 20:11:54 +10:00
Campbell Barton
e4b716a03f Cleanup: warnings, style 2015-07-25 07:44:25 +10:00
Campbell Barton
07fa1b49d9 parenthisize macro args to avoid errors 2015-07-24 15:53:52 +10:00
Campbell Barton
9ae39a1312 Math Lib: use vector funcs for isect_line_line_v2_point 2015-07-21 21:49:29 +10:00
Campbell Barton
b5f282b211 Remove nonnull attribute, NULL arg is valid here. 2015-07-21 09:41:48 +10:00
Campbell Barton
595a491e63 Add tessellation data to DerivedMesh (LoopTri)
This stores loop indices into the loop array giving easier acess
to data such as vertex-colors and UV's,
removing the need to store an MFace duplicate of custom-data.

This doesn't yet move all internal code from MFace to LoopTri just yet.

Only applies to:
- opengl drawing
- sculpting (pbvh)
- vertex/weight paint

Thanks to @psy-fi for review, fixes and improvements to drawing!
2015-07-17 03:55:14 +10:00
Bastien Montagne
2daa4db8a0 Fix own stupid error in yesterday's refactor of recursive dir creation.
Missed adding return value in one place.

Thanks a lot to Thomas Szepe for reporting the issue and finding the solution!

Question remains: how could MSVC allow such a code to compile in some cases
(own win64 + scons buildbot win32 were OK with that it seems!).
Crappy compiler, not comming to the rescue of stupid dev...
2015-07-15 17:43:04 +02:00
Bastien Montagne
d7b9202567 BLI_path_utils: fix/enhance BLI_filename_make_safe(), add BLI_path_make_safe().
BLI_filename_make_safe had several issues:
* Would replace all dots ('.'), not a great idea since it would break extensions.
* Was not checking for 'control' ASCII chars (though unlikely, better to be safe here).
* Win32 only: was not checking for forbidden names (con, aux, ltp0, com0, etc.).

New BLI_path_make_safe() simply checks each path's item with BLI_filename_make_safe().
2015-07-14 18:57:38 +02:00
Bastien Montagne
d0c5eac4b7 BLI_fileops: Make BLI_dir_create_recursive() return success/error status.
Handy to know directly whether a file creation succeeded or not.

Also, made a few more changes in this func, and harmonized a bit win32/*nix versions.
2015-07-14 18:57:38 +02:00
Campbell Barton
2cffd6649b Match face tessellation order in edimode
add a negated version of axis_dominant_v3_to_m3
2015-07-14 22:29:31 +10:00
Sergey Sharybin
cba0858ccd Fix for recent optimization commit in endian switch
Pre-4.8 GCC had a bug which lead to non-exposed __builtin_bswap16() symbol.

See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52624 for details.
2015-07-14 11:33:50 +02:00
Campbell Barton
b7c42ef93e Cleanup: use ascii as suffix (as with utf8) 2015-07-14 09:17:00 +10:00
Bastien Montagne
e93b969ac9 Add BLI_math_statistics, where stats tool shall be!
For now, only contains some 3x3 matrix covariance computing.
2015-07-13 18:05:38 +02:00
Bastien Montagne
0e9842dd04 Add BLI_math_solver, where non-linear solvers should be.
For now, only has an eigen solver for 3×3 (symmetric) matrix.
2015-07-13 18:05:38 +02:00
Campbell Barton
feffbe974b Remove redundant string copy 2015-07-13 03:43:41 +10:00
Bastien Montagne
1893e5e4c2 Missed essential part in previous commit.
Or how to epic fail a fix when working on two different systems.
Or how to increase your commit rate.
2015-07-12 19:04:31 +02:00
Bastien Montagne
7e9c347c8c Fix T45375: Cant clear temp fluid cache after closing Blender (Windows).
There was two different issues here actually:
* Own (very high) stupidity only gave 8 chars to file name (sic).
* list dir returns dirpaths without a trailing slahs, but expects them to have it it seems. :|
2015-07-12 18:49:02 +02:00
Campbell Barton
5c8fc8e505 Use const for direntry strings 2015-07-12 05:50:07 +10:00
Campbell Barton
7b1489b93b Error in last commit 2015-07-12 05:35:44 +10:00
Campbell Barton
968351d916 Minor changes for more efficient endian switching 2015-07-12 05:33:04 +10:00
Bastien Montagne
909fa34c5f BLI_matrix space_transform: Add a 'local-invariant' setter.
`BLI_space_transform_from_matrices()` defines a 'global-invariant' transform
(same point in global space, two different coordinates in local and target spaces).

New `BLI_space_transform_global_from_matrices()` is kind of opposite, it defines
a 'local-invariant' transform (two different points in global space, same coordinates in local and target spaces).

Useful to 'match' meshes.
2015-07-11 00:04:27 +02:00
Bastien Montagne
7837f0e833 BLI_math 'compare' cleanup & enhancements.
This commit:
* Adds a 'compare_ff' function for absolute 'almost equal' comparison of floats.
* Makes 'compare_vxvx' functions use that new 'compare_ff' one.
* Adds a 'compare_ff_relative' function for secured ulp-based relative comparison of floats.
* Adds matching 'compare_vxvx_relative' functions.
* Adds some basic tests for compare_ff_relative.

See https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/

Note that we could replace our python/mathutils' EXPP_FloatsAreEqual() by BLI's compare_ff_relative
(using a very small absolute max_diff), but these do not have exact same behavior...
Left a comment there for now, we can do it later if/when we are sure it won't break anything!
2015-07-10 15:02:43 +02:00
Campbell Barton
a837797740 Cleanup: quiet warning 2015-07-09 19:33:02 +10:00
Bastien Montagne
2b5e150db0 BLI_GHash: add BLI_gset_str_new helpers. 2015-07-02 20:35:05 +02:00
Campbell Barton
d59721e47a Cleanup: move BLI_char_switch into BLI_string 2015-06-30 15:18:03 +10:00
Campbell Barton
d17cb3f75f Cleanup: use BLI_str prefix for BLI_replacestrN 2015-06-30 14:50:34 +10:00
Campbell Barton
8bef305b6d Cleanup: move BLI_timestr to BLI_timecode 2015-06-30 14:47:31 +10:00
Bastien Montagne
aac5485fca Fix T45216: File Browser shows negative sizes for large files.
Simply backport small part of work from asset-experiments here (using double and
adding tera-bytes unit), looks like off_t is not always 64bits even on a 64bit OS...
2015-06-27 23:39:48 +02:00
Bastien Montagne
e170d6be7f Cleanup: all params of BLI_str partition funcs can be const... 2015-06-27 11:00:47 +02:00
Bastien Montagne
4d043c99dc Extend BLI_str_partition_ex: add possibility to define a right limit to the string.
Now you can define `end` pointer as right limit of the string (allows to easily search
in substring, especially useful when searching from right).
2015-06-27 10:24:54 +02:00
Campbell Barton
a33b1ce500 Correct recent error 2015-06-24 11:21:54 +10:00
Campbell Barton
f1bad1d16b Improve dist_***_to_corner_v3v3v3 precision
Remove offset before calculating distance.

Define 'plane3' to BLI_math, since we often don't need the 4th component.
2015-06-24 07:21:11 +10:00
Campbell Barton
72e812de7c Fix T45123: 2D line intersection fails
Co-linear lines could detect as intersecting even if they weren't overlapping.
2015-06-23 21:01:12 +10:00
Campbell Barton
ec8e0336a9 Cleanup: use 2d math funcs for line intersection 2015-06-23 21:01:11 +10:00
Sergey Sharybin
aeda4dca77 Threads: Cache result of syscall when querying number of system threads
Number of system threads is quite difficult to change without need of blender
restart, so we can cache result of the systcalls (which are not really cheap)
in order to be able to call BLI_system_thread_count() without worrying of
performance issues in that function.

Reviewers: campbellbarton

Differential Revision: https://developer.blender.org/D1342
2015-06-20 22:10:30 +02:00
Campbell Barton
74b32a23f7 Cleanup: checks for unsupported MSVC versions 2015-06-20 15:17:32 +10:00
Bastien Montagne
0f171d4a25 BLI_threads Queue: add BLI_thread_queue_is_empty().
Avoids counting the whole queue when we only want to check whether it is empty or not!
2015-06-19 12:31:26 +02:00
Campbell Barton
52e95ad3d3 BLI_stack: BLI_stack_pop_n_reverse
Useful to fill an array in the order its added.
2015-06-19 20:19:37 +10:00
Campbell Barton
d4aeec9204 BLI_stack: function comments 2015-06-19 15:54:42 +10:00
Campbell Barton
28c34d332f Assert when relative paths are passed to IO ops
This is typically an error (& hangs a few seconds on win32), best catch early.
2015-06-18 12:49:10 +10:00
Campbell Barton
ecdbe3cc63 Cleanup: style 2015-06-17 07:06:59 +10:00
Campbell Barton
b986f955e9 Disable assert for polyfill
Would fail on some zero-area ngons.
2015-06-16 21:13:22 +10:00
Campbell Barton
b1a92f2b3a Fix T44701: Buffer overrun reading directories 2015-06-16 10:04:28 +10:00
Campbell Barton
532e29cd76 Win32: make DIR struct opaque 2015-06-16 10:03:12 +10:00