blender.git
4 years agoFix Cycles kernel build without render passes support.
Brecht Van Lommel [Sun, 17 Jul 2016 16:09:58 +0000 (18:09 +0200)]
Fix Cycles kernel build without render passes support.

4 years agoFix T48874: Nested pop-up didn't update its parent
Campbell Barton [Mon, 18 Jul 2016 19:58:41 +0000 (05:58 +1000)]
Fix T48874: Nested pop-up didn't update its parent

4 years agofix breakage caused by D2094 / rB404f41d22de46119ee8afb409011eb1ba1840092
lazydodo [Mon, 18 Jul 2016 19:08:03 +0000 (13:08 -0600)]
fix breakage caused by D2094 / rB404f41d22de46119ee8afb409011eb1ba1840092

4 years agoDocs: improve bpy.props.EnumProperty reference
Campbell Barton [Mon, 18 Jul 2016 19:03:50 +0000 (05:03 +1000)]
Docs: improve bpy.props.EnumProperty reference

4 years agoFix T48885: Wheel in image space changes wrong window
Campbell Barton [Mon, 18 Jul 2016 16:44:14 +0000 (02:44 +1000)]
Fix T48885: Wheel in image space changes wrong window

4 years agoFix missing release w/ mouse wheel over layer menu
Campbell Barton [Mon, 18 Jul 2016 16:41:50 +0000 (02:41 +1000)]
Fix missing release w/ mouse wheel over layer menu

4 years ago[bf_intern_ghost/Windows] Cleanup
Ray Molenkamp [Mon, 18 Jul 2016 13:48:16 +0000 (15:48 +0200)]
[bf_intern_ghost/Windows] Cleanup

This patch addresses the following issues in bf_intern_ghost

```
Warning C4312 'type cast': conversion from 'GHOST_TEmbedderWindowID' to 'HWND' of greater size bf_intern_ghost K:\BlenderGit\blender\intern\ghost\intern\GHOST_WindowWin32.cpp 179
Warning C4312 'type cast': conversion from 'GHOST_TEmbedderWindowID' to 'HWND' of greater size bf_intern_ghost K:\BlenderGit\blender\intern\ghost\intern\GHOST_WindowWin32.cpp 198
```

GHOST_TEmbedderWindowID is defined as long, handles are however of pointer size,
so this should have been an issue when we moved to 64 bits, guess we got lucky.
fixed by turning GHOST_TEmbedderWindowID from long into void*

```
Warning C4302 'reinterpret_cast': truncation from 'HKL' to 'LANGID' bf_intern_ghost K:\BlenderGit\blender\intern\ghost\intern\GHOST_ImeWin32.cpp 67
```

reinterpret_cast emits warnings on truncation, LOWORD does the job just
as well with no warnings.

```
Warning C4838 conversion from 'int' to 'DWORD' requires a narrowing conversion bf_intern_ghost K:\BlenderGit\blender\intern\ghost\intern\GHOST_ContextWGL.cpp 734
Warning C4838 conversion from 'int' to 'BYTE' requires a narrowing conversion bf_intern_ghost K:\BlenderGit\blender\intern\ghost\intern\GHOST_ContextWGL.cpp 734
```

Weird warning, it does a really bad job at telling you what parameter is
causing the warning , tuns out there's a bunch of parameters that cause it
but it still only yields a single warning, the problem is that every
(somevar ? a : b) construct results in an integer type. which needs to be
properly cast to get rid of the warning.

```
Warning C4996 'GetVersionExA': was declared deprecated bf_intern_ghost K:\BlenderGit\blender\intern\ghost\intern\GHOST_WindowWin32.cpp 105
Warning C4996 'GetVersionExA': was declared deprecated bf_intern_ghost K:\BlenderGit\blender\intern\ghost\intern\GHOST_WindowWin32.cpp 107
```

The warning was clear, the code not as much. The version check in place
here is quite convoluted and could be replaced by including VersionHelpers.h
and calling IsWindows7OrGreater, However, CreateInstance will just return NULL
in m_Bar if the interface is not supported, so the whole check is useless.
This however did require that the CreateInstance call actually asked for
ITaskbarList3 and not ITaskBarlist . (You're not really allowed to assign
different interface types to each-other, a roundtrip through QueryInterface
is required there, we were violating spec here by asking for ITaskBarlist and
storing it in ITaskbarList3*  )

Reviewers: sergey

Reviewed By: sergey

Subscribers: sergey

Differential Revision: https://developer.blender.org/D2094

4 years agoAdditional Waveform Drawing Mode
Sergey Sharybin [Mon, 18 Jul 2016 13:28:56 +0000 (15:28 +0200)]
Additional Waveform Drawing Mode

This diff adds a 6th drawing mode to the Waveform Scope.

The new mode shows the RGB colour channels overlaid as a "Full colour" waveform.

The old "Red Green Blue" mode is renamed "Parade" which is the standard industry
term for RGB channels shown side-by-side.

This full colour style of waveform is very much more useful for colour grading than the
Parade mode and is the default waveform for many artists.

Files from older Blender versions which show scopes open as expected.

Patch by John Cox (johnedwardcox), thanks!

Reviewers: sergey

Reviewed By: sergey

Subscribers: campbellbarton, tmw, Blendify

Differential Revision: https://developer.blender.org/D1936

4 years ago[MSVC2015/Cycles] MSVC2015 before update 3 produce invalid builds
Ray Molenkamp [Mon, 18 Jul 2016 13:24:46 +0000 (15:24 +0200)]
[MSVC2015/Cycles] MSVC2015 before update 3 produce invalid builds

I'm not quite sure where the codegen bug gets triggered but it's easily
noticeable in the barcelona scene. (extra saturated leafs and illumination
on the right ledge of the pool)

2013 buildbot reference image:
{F320792}

2015 With no updates (compiler version 19.00.23026)
{F320793}

2015 With Update 2 (Compiler version 19.00.23918)
{F320794}

2015 With Update 3 (Compiler version 19.00.24210)
{F320795}

This patch blocks all compiler builds before update 3 in a similar way we
did for msvc 2013 update 4

Reviewers: campbellbarton, brecht, juicyfruit

Reviewed By: juicyfruit

Tags: #bf_blender

Differential Revision: https://developer.blender.org/D2100

4 years ago[MSVC/LNK4199/Cleanup] Delay loading is causing linker warnings.
Ray Molenkamp [Mon, 18 Jul 2016 13:16:45 +0000 (15:16 +0200)]
[MSVC/LNK4199/Cleanup] Delay loading is causing linker warnings.

We recently added delay-loading of the openmp dll's so we no longer had to use
the stub loader, we however put these linker flags on the global linker flags
causing any sub projects not using openmp to spit linker warning 4199 while building,

```
Warning LNK4199 /DELAYLOAD:vcomp140.dll ignored; no imports found from vcomp140.dll datatoc k:\BlenderGit\build_windows_2015a\source\blender\datatoc\LINK 1
```

This patch makes the delay-load only apply to the blender project.

Reviewers: sergey

Subscribers: sergey

Tags: #bf_blender

Differential Revision: https://developer.blender.org/D2092

4 years agoFix (unreported) ED_region_tag_redraw_partial() could override a previously defined...
Bastien Montagne [Mon, 18 Jul 2016 12:37:04 +0000 (14:37 +0200)]
Fix (unreported) ED_region_tag_redraw_partial() could override a previously defined partial redraw, instead of extending it.

Probably not an issue currently, since partial redraw is not much used
(only from sculpt code and box-rendering it seems?), but logic was broken here.

4 years agoFix T48848: Cycles - Camera Culling - Camera Culling removes objects which are still...
Sergey Sharybin [Mon, 18 Jul 2016 12:29:37 +0000 (14:29 +0200)]
Fix T48848: Cycles - Camera Culling - Camera Culling removes objects which are still in frame

4 years agoFix T48877: Lightmap Pack fails w/ 1-3 faces
Campbell Barton [Mon, 18 Jul 2016 09:44:51 +0000 (19:44 +1000)]
Fix T48877: Lightmap Pack fails w/ 1-3 faces

Unnecessary limit was applied.

4 years agoCMake: correct py-module on OSX
Campbell Barton [Mon, 18 Jul 2016 09:28:45 +0000 (19:28 +1000)]
CMake: correct py-module on OSX

4 years agoFix T48860: Cycles SSS artifacts with spatially split BVH
Sergey Sharybin [Fri, 15 Jul 2016 12:55:37 +0000 (14:55 +0200)]
Fix T48860: Cycles SSS artifacts with spatially split BVH

The issue was caused by SSS intersection code gathering all
intersections without check for duplicated ones. This caused
situations when same intersection will be recorded twice in
the case if triangle is shared by several BVH nodes.

Usually this is handled by checking intersection distance
after sorting intersections (in shadow_blocked for example)
but for SSS we don't do such sorting and using number of
intersections to calculate various things.

Didn't find anything smarter than to check intersection
distance in triangle_intersect_subsurface().

This solves render artifacts in the cost of 1.5% slowdown
of extreme case rendering (SSS object filling in whole
FullHD screen).

Reviewers: brecht

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D2105

4 years agoCycles: Fix OpenCL compilation after the recent numerical fixes
Lukas Stockner [Sun, 17 Jul 2016 17:24:53 +0000 (19:24 +0200)]
Cycles: Fix OpenCL compilation after the recent numerical fixes

4 years agoBLI_heap: replace memarena w/ local allocator
Campbell Barton [Sun, 17 Jul 2016 09:02:01 +0000 (19:02 +1000)]
BLI_heap: replace memarena w/ local allocator

- Since element size its known it's less work to do inline.
- In test with high-poly model, gave ~9% overall speedup for decimate modifier.

4 years agoCleanup: minor edits to BLI_heap
Campbell Barton [Sun, 17 Jul 2016 07:31:27 +0000 (17:31 +1000)]
Cleanup: minor edits to BLI_heap

4 years agoCycles: Fix three numerical issues in the fresnel, normal map and Beckmann code
Lukas Stockner [Sat, 16 Jul 2016 18:48:12 +0000 (20:48 +0200)]
Cycles: Fix three numerical issues in the fresnel, normal map and Beckmann code

- In fresnel_dielectric, the differentials calculation sometimes divided by zero.
- When the normal map was (0.5, 0.5, 0.5), the code would try to normalize a zero vector. Now, it just uses the regular normal as a fallback.
- The approximate error function used in Beckmann sampling sometimes overflowed to inf while calculating r^16. The final value is 1 - 1/r^16, however,
  so now it just returns 1 if the computation would overflow otherwise.

4 years agoCycles: Deduplicate geometric factor calculation in the Beckmann distribution
Lukas Stockner [Sat, 16 Jul 2016 18:44:28 +0000 (20:44 +0200)]
Cycles: Deduplicate geometric factor calculation in the Beckmann distribution

Also, this fixes a numerical issue where A would be inf.
Since later G is set to 1 if A is larger than 1.6, the code now checks the reciprocal of A for being smaller than 1/1.6 - same effect, but no inf involved.

4 years agoFix use after free error from ab993e37
Campbell Barton [Sat, 16 Jul 2016 17:03:22 +0000 (03:03 +1000)]
Fix use after free error from ab993e37

4 years agoCleanup: spelling
Campbell Barton [Sat, 16 Jul 2016 07:48:57 +0000 (17:48 +1000)]
Cleanup: spelling

4 years agoCleanup: line length
Campbell Barton [Sat, 16 Jul 2016 06:36:30 +0000 (16:36 +1000)]
Cleanup: line length

4 years agoUse the value `VIEW_PROJ_PERSP` in the remaining places
Germano Cavalcante [Sat, 16 Jul 2016 00:25:44 +0000 (21:25 -0300)]
Use the value `VIEW_PROJ_PERSP` in the remaining places

also changes the name of the callbacks:
- walk_parent_snap_project_cb to cb_walk_parent_snap_project;
- cb_leaf_snap_vert to cb_walk_leaf_snap_vert;
- cb_leaf_snap_edge to cb_walk_leaf_snap_edge;
- test_vert_depth_cb to test_vert_ray_dist_cb;
- test_edge_depth_cb to test_edge_ray_dist_cb;

and cleanup:

4 years agoCycles: Fix refitting of regular BVH
Sergey Sharybin [Fri, 15 Jul 2016 16:12:05 +0000 (18:12 +0200)]
Cycles: Fix refitting of regular BVH

Was causing CUDA issues on viewport edits.

4 years agoUI: modifier keys now trigger number button updates
Campbell Barton [Fri, 15 Jul 2016 11:54:38 +0000 (21:54 +1000)]
UI: modifier keys now trigger number button updates

Number buttons & sliders weren't updating when shift/ctrl were pressed.

Note that this is a regression in 2.77 but hard to track down since it worked unreliably for some time.

4 years agoBump maximum threads number to 1024
Sergey Sharybin [Sun, 7 Jun 2015 20:48:51 +0000 (22:48 +0200)]
Bump maximum threads number to 1024

This commit contains all the changes required for most optimal maximum threads
number bump. This is needed to avoid possibly unneeded initialization or data
allocation on systems with lower threads count.

TODO: Still need to review arrays in render data structures from render_types.h,

P.S. We might remove actual bump of max threads from this patch, so when we'll
be applying the patch we can do all the preparation work and then do actual
bump of max threads.

Reviewers: mont29, campbellbarton

Reviewed By: mont29, campbellbarton

Maniphest Tasks: T43306

Differential Revision: https://developer.blender.org/D1343

4 years agoCycles: Add option to disable new Hair BVH
Sergey Sharybin [Thu, 7 Jul 2016 16:04:16 +0000 (18:04 +0200)]
Cycles: Add option to disable new Hair BVH

While it's an extra option added to the interface which might not be
fully obvious for artists, it allows to save up to 20% of memory in
hairy scenes.

This is high enough memory saver in my opinion which might become
handy for some production files where it's more important to make
scene to fit into memory rather than trying to use more optimal BVH
structure but go into swap or crash.

Reviewers: dingto, brecht

Reviewed By: dingto, brecht

Differential Revision: https://developer.blender.org/D2090

4 years agofix T48857: Improved the handling of Material Alpha, based on patch D1949 with some...
Sandy Carter [Fri, 15 Jul 2016 14:14:32 +0000 (16:14 +0200)]
fix T48857: Improved the handling of Material Alpha, based on patch D1949 with some small modifications

4 years agoCollada: changed specification of material alpha from using transparency to using...
Gaia Clary [Fri, 15 Jul 2016 14:12:39 +0000 (16:12 +0200)]
Collada: changed specification of material alpha from using transparency to using transparent with opaque=A_ONE

4 years agoRe-initialize source/tools submodule
Sergey Sharybin [Fri, 15 Jul 2016 13:12:28 +0000 (15:12 +0200)]
Re-initialize source/tools submodule

4 years agomissed from last commit
Campbell Barton [Fri, 15 Jul 2016 10:00:18 +0000 (20:00 +1000)]
missed from last commit

4 years agoObject Snap: make normal argument optional
Campbell Barton [Fri, 15 Jul 2016 09:46:59 +0000 (19:46 +1000)]
Object Snap: make normal argument optional

Often its not needed, setting correctly takes some extra calculation - so allow for it to be left unset.

4 years agoFix T48855: Ruler thickness broken in ortho view
Campbell Barton [Fri, 15 Jul 2016 09:22:00 +0000 (19:22 +1000)]
Fix T48855: Ruler thickness broken in ortho view

Don't do ray-casts from the view unless cursor coords are passed.

4 years agoObject Snap: replace perspective bool with enum
Campbell Barton [Fri, 15 Jul 2016 09:14:46 +0000 (19:14 +1000)]
Object Snap: replace perspective bool with enum

Allows to set the projection as none,
to make it more obvious when we don't want to handle viewport projections in some cases.

4 years agoCorrect error in snap commit
Campbell Barton [Fri, 15 Jul 2016 08:40:16 +0000 (18:40 +1000)]
Correct error in snap commit

4 years agoCleanup: use BLI_math for paint smooth-stroke
Campbell Barton [Fri, 15 Jul 2016 07:17:42 +0000 (17:17 +1000)]
Cleanup: use BLI_math for paint smooth-stroke

4 years agoCleanup: rename snap vars
Campbell Barton [Fri, 15 Jul 2016 07:12:43 +0000 (17:12 +1000)]
Cleanup: rename snap vars

4 years agoAdd "Snap Selection to Active" option in menu
Campbell Barton [Fri, 15 Jul 2016 07:07:18 +0000 (17:07 +1000)]
Add "Snap Selection to Active" option in menu

D1963 by @wisaac, re-worked to de-duplicate logic

4 years agoSupport for loading multiple images from the file selector
Campbell Barton [Fri, 15 Jul 2016 06:02:46 +0000 (16:02 +1000)]
Support for loading multiple images from the file selector

D2035 by @jside, extended to support mixing single images and sequences in the one selection.

4 years agoFix select grouped parent, extend option was ignored
Campbell Barton [Fri, 15 Jul 2016 05:56:28 +0000 (15:56 +1000)]
Fix select grouped parent, extend option was ignored

D2067 by @mangostaniko

4 years agoUI: Remove spaces around '/'
Campbell Barton [Fri, 15 Jul 2016 05:50:42 +0000 (15:50 +1000)]
UI: Remove spaces around '/'

D2093 by @Blendify

4 years agoSequencer: Remove add effect strip filesel properties
Campbell Barton [Fri, 15 Jul 2016 05:45:45 +0000 (15:45 +1000)]
Sequencer: Remove add effect strip filesel properties

D2096 by @chadf

Unused, copy-paste error.

4 years agoFix py-driver in startup.blend crash in background mode
Campbell Barton [Fri, 15 Jul 2016 05:29:27 +0000 (15:29 +1000)]
Fix py-driver in startup.blend crash in background mode

Obscure regression in own commit from b34929786.
While this could be considered correct, it introduces a crash so disable the update call.

4 years agoCode cleanup: show unused arguments names for ShaderNode::constant_fold.
Brecht Van Lommel [Thu, 14 Jul 2016 20:48:41 +0000 (22:48 +0200)]
Code cleanup: show unused arguments names for ShaderNode::constant_fold.

4 years agofix T48857: Added support for transparency (used Patch D1949 from bwrsandman with...
Gaia Clary [Thu, 14 Jul 2016 19:42:44 +0000 (21:42 +0200)]
fix T48857: Added support for transparency (used Patch D1949 from bwrsandman with some slight changes)

4 years agoUse BMesh solver for new boolean modifiers
Campbell Barton [Thu, 14 Jul 2016 16:46:04 +0000 (02:46 +1000)]
Use BMesh solver for new boolean modifiers

4 years agoCleanup: comment blocks
Campbell Barton [Thu, 14 Jul 2016 16:36:21 +0000 (02:36 +1000)]
Cleanup: comment blocks

4 years agoFix T48844: Nodetrees of appended materials/textures/etc. were not correctly made...
Bastien Montagne [Thu, 14 Jul 2016 16:18:54 +0000 (18:18 +0200)]
Fix T48844: Nodetrees of appended materials/textures/etc. were not correctly made local.

Previous commits now allow to use id_make_local() here, as one would expect.

Note that I also checked T36003 case, working fine as well with new code.

4 years agoCorrect recent own fix to id_clear_lib_data_ex().
Bastien Montagne [Thu, 14 Jul 2016 16:16:05 +0000 (18:16 +0200)]
Correct recent own fix to id_clear_lib_data_ex().

Datablocks' nodetree are *never* in main, while shapekeys are...

4 years agoCleanup/refactor: handle shapekeys exactly like 'owned' nodetrees in make_local process.
Bastien Montagne [Thu, 14 Jul 2016 13:38:41 +0000 (15:38 +0200)]
Cleanup/refactor: handle shapekeys exactly like 'owned' nodetrees in make_local process.

4 years agoCleanup: use BKE's ntreeFromID in readfile instead of local same function.
Bastien Montagne [Thu, 14 Jul 2016 13:32:25 +0000 (15:32 +0200)]
Cleanup: use BKE's ntreeFromID in readfile instead of local same function.

Also, no need to set ntree->id.lib to NULL after BKE_libblock_copy_nolib(),
generic datablock copy function always make copy local.

4 years agoFix bad handling of datablock's nodetree id_clear_lib_data_ex().
Bastien Montagne [Thu, 14 Jul 2016 13:23:53 +0000 (15:23 +0200)]
Fix bad handling of datablock's nodetree id_clear_lib_data_ex().

Those data blocks are never shared, exactly as with shapekeys, much simpler
to also clear their lib_data (especially since they have no user!).

4 years agoGet rid of BKE_key_make_local().
Bastien Montagne [Thu, 14 Jul 2016 11:07:45 +0000 (13:07 +0200)]
Get rid of BKE_key_make_local().

This function was only a wrapper around id_clear_lib_data(), and shapekeys
are not linkable nor shareable anyway, no point keeping this currently,
was only adding confusion about shapekey 'status' as a datatblock.

4 years agoAdd option to id_make_local to force localization of datablock, even if not used...
Bastien Montagne [Thu, 14 Jul 2016 11:03:22 +0000 (13:03 +0200)]
Add option to id_make_local to force localization of datablock, even if not used locally.

Will be used by link/append code.

4 years agoFix T48843: Sequencer crash with many effects
Campbell Barton [Thu, 14 Jul 2016 16:30:37 +0000 (02:30 +1000)]
Fix T48843: Sequencer crash with many effects

Switch from a fixed stack to a linked list,
since guessing the maximum possible size may fail with invalid/overlapping strips.

4 years agoAdd developer tools submodule
Campbell Barton [Thu, 14 Jul 2016 15:26:40 +0000 (01:26 +1000)]
Add developer tools submodule

This is intended for utilities to help with development,
which aren't needed for building.

See https://wiki.blender.org/index.php/Dev:Doc/Tools/Blender_Tools_Repo for details

4 years agoCleanup: line length
Campbell Barton [Thu, 14 Jul 2016 15:26:04 +0000 (01:26 +1000)]
Cleanup: line length

4 years agoPyAPI: minor cleanup with library linking
Campbell Barton [Thu, 14 Jul 2016 11:00:05 +0000 (21:00 +1000)]
PyAPI: minor cleanup with library linking

4 years agoConsolidate multiple checks for out->rect_float in prepare_effect_imbufs()
Chad Fraleigh [Thu, 14 Jul 2016 12:15:43 +0000 (14:15 +0200)]
Consolidate multiple checks for out->rect_float in prepare_effect_imbufs()

Many checks for out->rect_float being [non-]NULL are done back-to-back.
Combining them into a single check for slightly more efficient code and
less code clutter for easier readability/understanding.

Differential Revision: https://developer.blender.org/D2097

4 years agoCleanup: Use BKE_scene_base_add for creating bases
Julian Eisel [Thu, 14 Jul 2016 11:58:40 +0000 (13:58 +0200)]
Cleanup: Use BKE_scene_base_add for creating bases

And use __func__ macro.

4 years agoCycles: Give better idea which OpenCL kernel is currently compiling
Sergey Sharybin [Thu, 14 Jul 2016 10:49:20 +0000 (12:49 +0200)]
Cycles: Give better idea which OpenCL kernel is currently compiling

4 years agoCycles: Avoid strings passed by value in OpenCL device
Sergey Sharybin [Thu, 14 Jul 2016 10:44:51 +0000 (12:44 +0200)]
Cycles: Avoid strings passed by value in OpenCL device

Also use more const qualifiers in the code.

4 years agoMake --debug-all include --debug-cycles and --debug-libmv
Sergey Sharybin [Thu, 14 Jul 2016 10:14:55 +0000 (12:14 +0200)]
Make --debug-all include --debug-cycles and --debug-libmv

4 years agoLibmv: Fix some strict compiler warnings
Sergey Sharybin [Thu, 14 Jul 2016 09:49:38 +0000 (11:49 +0200)]
Libmv: Fix some strict compiler warnings

One of them was a real bug!

4 years agoCycles: Fix wrong size of sobol texture
Sergey Sharybin [Thu, 14 Jul 2016 09:11:23 +0000 (11:11 +0200)]
Cycles: Fix wrong size of sobol texture

After reformulation of SSS indirect rays it became possible to
try accessing dimension higher than was pre-calculated on scene
preparation.

This is because we're traversing rays backwards, which means we
are using higher dimensions first now.

4 years agoCycles: Fix wrong termination criteria in intersect_all functions
Sergey Sharybin [Thu, 14 Jul 2016 09:08:24 +0000 (11:08 +0200)]
Cycles: Fix wrong termination criteria in intersect_all functions

It was possible to miss bounces termination criteria in this functions,
mainly when max_hits was set to 0.

Made the check more robust in traversal functions (which should not
affect performance, it's an operation of same complexity AFAIK).

Also avoid doing ray-scene intersection from shadow_blocked when
limit of transparent bounces was already reached.

4 years agoCMake: per-target CFLAG & CXXFLAG support
Campbell Barton [Thu, 14 Jul 2016 09:11:33 +0000 (19:11 +1000)]
CMake: per-target CFLAG & CXXFLAG support

Applying cflags globally can be problematic especially with extern, intern libs.

Now flags from target named will be used when defined,
allowing for developers to define flags for modules they maintain.

Convention is CMAKE_CFLAGS_${UPPERCASE_TARGET_NAME}, (CXXFLAGS for C++).

eg: CMAKE_CFLAGS_BF_BLENDER, CMAKE_CFLAGS_MAKESDNA, CMAKE_CXXFLAGS_CYCLES_KERNEL

On Linux run `make help` for full list of names, MSVC shows these in the solution.

4 years agoPyAPI: Leak fix caused crash w/ attr swap trick
Campbell Barton [Thu, 14 Jul 2016 08:27:20 +0000 (18:27 +1000)]
PyAPI: Leak fix caused crash w/ attr swap trick

Accessing `bpy.app.binary_path_python does search, then swaps its getset with the string it finds.
This caused a freed pointer to be stored in bpy.app's dictionary.

Fix by using the same string for get/set access.

4 years agoPyAPI: fix leak linking library data
Campbell Barton [Thu, 14 Jul 2016 07:38:22 +0000 (17:38 +1000)]
PyAPI: fix leak linking library data

4 years agoPyAPI: fix memory leaks in dictionary assignment
Campbell Barton [Thu, 14 Jul 2016 07:28:28 +0000 (17:28 +1000)]
PyAPI: fix memory leaks in dictionary assignment

Thanks to Kévin Dietrich for spotting driver leak,
checked other uses of PyDict_SetItem and found more.

4 years agoPyAPI: Use module names on initializaton
Campbell Barton [Thu, 14 Jul 2016 05:51:56 +0000 (15:51 +1000)]
PyAPI: Use module names on initializaton

No need to re-convert from C strings to PyUnicode.

4 years agoImproves the accuracy of snap to edges
Germano Cavalcante [Thu, 14 Jul 2016 03:47:32 +0000 (00:47 -0300)]
Improves the accuracy of snap to edges

Recently the snap to edges has been changed to work with coordinates 2d. Thus, the lambda of the snap pointon on edge becomes different from the actual lambda in a 3d edge.

The solution to correct the lambda was this:

```
if (is_persp) {
const float fac = depth_a / (depth_a + depth_b);
lambda *= (1.0f + (fac - 0.5f) * (1.0f - lambda));
````

...
But the lambda was still not very accurate.
Now the function uses the `dist_squared_ray_to_seg_v3` to get the coordinate of the snap point on the edge. And then tests that point.

The accuracy returned to normal values.

4 years agoCleanup: style
Campbell Barton [Thu, 14 Jul 2016 03:37:49 +0000 (13:37 +1000)]
Cleanup: style

4 years agoUse BLI_endian_switch in dna_genfile
Campbell Barton [Thu, 14 Jul 2016 01:52:53 +0000 (11:52 +1000)]
Use BLI_endian_switch in dna_genfile

4 years agoSimplify snapping functions
Germano Cavalcante [Thu, 14 Jul 2016 03:02:21 +0000 (00:02 -0300)]
Simplify snapping functions

from D2104: reference all repeated (and strange) equations (example: mul_m4_m4m4(pmat_local, pmat, obmat)) in the function `precalc_project.

This is useful for maintenance.

4 years agoFix T48846: Ruler/Protractor crash in ortho mode
Campbell Barton [Thu, 14 Jul 2016 01:06:40 +0000 (11:06 +1000)]
Fix T48846: Ruler/Protractor crash in ortho mode

Error in recent snap changes.

4 years agoFix T48845: Crash when right-clicking on a curve property
Kévin Dietrich [Wed, 13 Jul 2016 22:24:31 +0000 (00:24 +0200)]
Fix T48845: Crash when right-clicking on a curve property

Caused by typo in rBd2312602125a452e6562a76ab91779943c67396d

4 years agoFix T48734: Driver not updating when using Single From Driver within same object
Sergey Sharybin [Wed, 13 Jul 2016 13:00:29 +0000 (15:00 +0200)]
Fix T48734: Driver not updating when using Single From Driver within same object

4 years agoFix T48839: Selection from pose mode gives wrong snap results
Campbell Barton [Wed, 13 Jul 2016 12:22:37 +0000 (22:22 +1000)]
Fix T48839: Selection from pose mode gives wrong snap results

Current code changes the selection then then runs ED_armature_sync_selection
to copy to the bones rootsel flag from the parents tipsel.

Use this logic for entering edit-mode too.

4 years agoBoolean Modifier: Add back BMesh option
Campbell Barton [Wed, 13 Jul 2016 07:45:55 +0000 (17:45 +1000)]
Boolean Modifier: Add back BMesh option

There are still issues with overlapping geometry,
however some of the issues reported are are causing problems,
or fail entirely with Carve too.

4 years agoDepsgraph: Make proxy behavior closer to old depsgraph
Sergey Sharybin [Wed, 13 Jul 2016 08:55:35 +0000 (10:55 +0200)]
Depsgraph: Make proxy behavior closer to old depsgraph

Fixes possible missing update of proxy_from pointer before using
it in relations builder.

4 years agoRevert "Depsgraph: Russian electric tape bodge to have multiple proxies work"
Sergey Sharybin [Wed, 13 Jul 2016 08:39:55 +0000 (10:39 +0200)]
Revert "Depsgraph: Russian electric tape bodge to have multiple proxies work"

This reverts commit 47d0d9cca4d0c3ccbdc368e97fc24652379fd368.

Reverting the commit. Not only it did not solve all the cases of proxy popping,
but also broke real cases with single proxy involved.

4 years agoDepsgraph: Accumulate object layers from all bases
Sergey Sharybin [Wed, 13 Jul 2016 08:07:09 +0000 (10:07 +0200)]
Depsgraph: Accumulate object layers from all bases

This solves bug when same object is instanced from multiple bases.

4 years agoUse BLI_bvhtree_walk_dfs for snapping
Campbell Barton [Wed, 13 Jul 2016 04:42:00 +0000 (14:42 +1000)]
Use BLI_bvhtree_walk_dfs for snapping

The snapping functions when performed in the perspective view,
have some problems in the threshold (a distortion) and in the clip plane (the normal is incorrect).
These problems can be only observed when making the snap to edges or to vertices (nearest to ray function).

This patch propose a totally different solution.
The idea is to project the edges of bvh nodes and test the 2d projection of the snap element.

For this it used the BLI_bvhtree_walk_dfs function.

It is important to pay particular attention also to the changes in `ED_transform_snap_object_project_view3d_ex`

4 years agoVertex/Weight Paint: Support view-selected on last-stroke
Campbell Barton [Wed, 13 Jul 2016 03:57:46 +0000 (13:57 +1000)]
Vertex/Weight Paint: Support view-selected on last-stroke

D1875 by @lichtwerk

4 years agoFix 48831, Step II: UI icon code was not able to update/generate 'auto ID icon' from...
Bastien Montagne [Tue, 12 Jul 2016 19:08:38 +0000 (21:08 +0200)]
Fix 48831, Step II: UI icon code was not able to update/generate 'auto ID icon' from non-ID icon draw code.

Now using generic icon rendering system in that case too, instead of custom code
which was only handling 'deferred' custom file-loaded icons.

4 years agoFix 48831, Step I: Mismatch issues bewteen ID icon and preview system.
Bastien Montagne [Tue, 12 Jul 2016 15:49:30 +0000 (17:49 +0200)]
Fix 48831, Step I: Mismatch issues bewteen ID icon and preview system.

- icon_id from ID and PreviewImage were not guaranteed to be in sync.
- PreviewImage one was not reset on file read.
- Through RNA e.g., it was possible to ensure an ID icon via its preview image,
  which was running code designed for custom previews/icons system, instead
  of generating correct 'auto ID icon'.

4 years agoRevert "OpenJPEG: update to 2.1 from 1.5"
Sergey Sharybin [Tue, 12 Jul 2016 15:38:26 +0000 (17:38 +0200)]
Revert "OpenJPEG: update to 2.1 from 1.5"

This reverts commit f12204196fb1ee985ab9745cf9c70877601145f9.

Campbell, sorry. have to revert this for the time being.

We've missed some very important bits, such as:

- FFmpeg is usually linked against OpenJPEG
- OIIO needs OpenJPEG as well.

For FFmpeg issues we can either disable OpenJPEG there (since
we don't really use it), or bump FFmpeg to version 3.1.1 which
can use either of OpenJPEG 1.5 or 2.1.

For OIIO we do need OpenJPEG support (otherwise Cycles will
not be able to use j2k/j2c textures) and currently there is
NO solution to make OIIO working with OpenJPEG 2.1.

According to Matthias Fauconneau (aka mfv) Larry is working
on the patch to get OIIO work with OpenJPEG 2.1, but it'll
take some time still.

I've tried to look into support of some sort of build system
flag and do ifdefs, but it all becomes quite nasty, especially
with bundled OpenJPEG bumped to 2.1.

Surely such an update is something we'll have to apply to
but at this exact moment it causes quite some pain for all
developers.

Suggest to wait for until OIIO supports OpenJPEG 2.1 and then
go with the updates for real.

4 years agoFix T48818: Objects with alpha maps cast wrong ray shadows in BI
Sergey Sharybin [Tue, 12 Jul 2016 13:40:40 +0000 (15:40 +0200)]
Fix T48818: Objects with alpha maps cast wrong ray shadows in BI

4 years agoOpenJPEG: update to 2.1 from 1.5
Campbell Barton [Thu, 9 Jun 2016 11:56:29 +0000 (21:56 +1000)]
OpenJPEG: update to 2.1 from 1.5

Stream handling has changed so this required changes to how files & memory are accessed.

4 years agoFix saving jpeg2k images from Python
Campbell Barton [Tue, 12 Jul 2016 10:35:02 +0000 (20:35 +1000)]
Fix saving jpeg2k images from Python

Quality was defaulting to lowest and no codec was set.

4 years agoCleanup: remove redundant check
Campbell Barton [Tue, 12 Jul 2016 07:59:25 +0000 (17:59 +1000)]
Cleanup: remove redundant check

4 years agoFix T48830: Outliner draw crash, missing NULL check
Campbell Barton [Tue, 12 Jul 2016 04:39:39 +0000 (14:39 +1000)]
Fix T48830: Outliner draw crash, missing NULL check

Fix from @cheleb

4 years agowritefile: reuse SDNA between writes
Campbell Barton [Tue, 12 Jul 2016 02:53:49 +0000 (12:53 +1000)]
writefile: reuse SDNA between writes

Avoids decoding the SDNA string every undo step.

4 years agoreadfile: report SDNA decoding errors on file read
Campbell Barton [Tue, 12 Jul 2016 02:23:48 +0000 (12:23 +1000)]
readfile: report SDNA decoding errors on file read

This was printed to the stdout, however the error case wasn't checked or well supported.
Also, errors decoding SDNA would sometimes call exit(1).

4 years agowritefile: remove SDNA last-hit, optimize DNA reconstruct
Campbell Barton [Tue, 12 Jul 2016 01:48:04 +0000 (11:48 +1000)]
writefile: remove SDNA last-hit, optimize DNA reconstruct

- Move last-hit index out of SDNA struct
  (allows for access by multiple threads).
- Replace O(n^2) search with hash lookup in DNA reconstruction.

4 years agoRemove usercount handling from BKE_id_expand_local.
Bastien Montagne [Mon, 11 Jul 2016 19:27:15 +0000 (21:27 +0200)]
Remove usercount handling from BKE_id_expand_local.

Idea looked good, but we have too much custom situations here (some half-fake-sub-ID
being copied with their 'owner', animdata, etc.), let's let datablock copy functions
handle that themselves.

Also allows to safely call BKE_id_expand_local from all copy functions now (only when
copying linked data).

4 years agoCleanup: remove call to BKE_id_lib_local_paths() in make_local functions.
Bastien Montagne [Mon, 11 Jul 2016 19:03:02 +0000 (21:03 +0200)]
Cleanup: remove call to BKE_id_lib_local_paths() in make_local functions.

This one is already called by matching copy functions, no need to call it twice!

4 years agoUse new generic BKE_id_expand_local() for make_local() for object.
Bastien Montagne [Mon, 11 Jul 2016 18:56:28 +0000 (20:56 +0200)]
Use new generic BKE_id_expand_local() for make_local() for object.