3 years agoAudaspace: fix incorrect parameter check in python API.
Jörg Müller [Sat, 23 Jul 2016 11:35:36 +0000 (13:35 +0200)]
Audaspace: fix incorrect parameter check in python API.

Found by PVS-Studio T48917

3 years agoCleanup: style
Campbell Barton [Fri, 22 Jul 2016 18:03:36 +0000 (04:03 +1000)]
Cleanup: style

3 years agoCleanup: warning
Campbell Barton [Fri, 22 Jul 2016 17:59:18 +0000 (03:59 +1000)]
Cleanup: warning

3 years agofix atan2f input conditional
Mike Erwin [Sat, 23 Jul 2016 00:59:31 +0000 (20:59 -0400)]
fix atan2f input conditional

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:

3 years agoOpenSubdiv: Properly respect Subdivide UVs option
Sergey Sharybin [Fri, 22 Jul 2016 15:52:30 +0000 (17:52 +0200)]
OpenSubdiv: Properly respect Subdivide UVs option

3 years agoFix crash using ID remapping on invalid ID pairs
Julian Eisel [Fri, 22 Jul 2016 15:13:23 +0000 (17:13 +0200)]
Fix crash using ID remapping on invalid ID pairs

Missing NULL checks caused crash in BKE_reportf formatting.

3 years agoOpenSubdiv: Initial support of UV maps in material shading mode
Sergey Sharybin [Fri, 22 Jul 2016 14:12:03 +0000 (16:12 +0200)]
OpenSubdiv: Initial support of UV maps in material shading mode

3 years agoOpenSubdiv: Use BLI module math functions
Sergey Sharybin [Fri, 22 Jul 2016 13:13:42 +0000 (15:13 +0200)]
OpenSubdiv: Use BLI module math functions

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.

3 years agoOpenSubdiv: Make drawing code a bit more flexible for FVar width
Sergey Sharybin [Fri, 22 Jul 2016 13:08:18 +0000 (15:08 +0200)]
OpenSubdiv: Make drawing code a bit more flexible for FVar width

3 years agoOpenSubdiv: Properly support active UV layer in textured view
Sergey Sharybin [Fri, 22 Jul 2016 12:50:21 +0000 (14:50 +0200)]
OpenSubdiv: Properly support active UV layer in textured view

3 years agoOpenSubdiv: Lay down fundamentals to support multiple UV maps
Sergey Sharybin [Fri, 22 Jul 2016 12:46:13 +0000 (14:46 +0200)]
OpenSubdiv: Lay down fundamentals to support multiple UV maps

3 years agoOpenSubdiv: Get number of UVs from topology refiner
Sergey Sharybin [Fri, 22 Jul 2016 10:50:27 +0000 (12:50 +0200)]
OpenSubdiv: Get number of UVs from topology refiner

This allows us to store more than one UV layer in the UVs array.

3 years agoOpenSubdiv: Cleanup, please don't use insanely long lines
Sergey Sharybin [Fri, 22 Jul 2016 10:41:55 +0000 (12:41 +0200)]
OpenSubdiv: Cleanup, please don't use insanely long lines

3 years agoOpenSubdiv: Cleanup, don't use camel case for variable names
Sergey Sharybin [Fri, 22 Jul 2016 10:40:53 +0000 (12:40 +0200)]
OpenSubdiv: Cleanup, don't use camel case for variable names

3 years agoCorrect mistake comparing vertices
Campbell Barton [Fri, 22 Jul 2016 08:18:59 +0000 (18:18 +1000)]
Correct mistake comparing vertices

3 years agouse bool consistently, fix redundant conditional
Mike Erwin [Fri, 22 Jul 2016 06:17:25 +0000 (02:17 -0400)]
use bool consistently, fix redundant conditional

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.

3 years agoremove double-checked conditions
Mike Erwin [Fri, 22 Jul 2016 01:31:37 +0000 (21:31 -0400)]
remove double-checked conditions

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

3 years agoAdd Subdivide Edge-Ring to menu
Campbell Barton [Fri, 22 Jul 2016 05:50:41 +0000 (15:50 +1000)]
Add Subdivide Edge-Ring to menu

3 years agoFix T48926: Subdivide edge-ring crash
Campbell Barton [Fri, 22 Jul 2016 05:41:56 +0000 (15:41 +1000)]
Fix T48926: Subdivide edge-ring crash

Also resolves: T34294

3 years agofix confusing operator precedence
Mike Erwin [Thu, 21 Jul 2016 22:52:44 +0000 (18:52 -0400)]
fix confusing operator precedence

Assigning within a conditional is confusing and error prone so I
rewrote in a more straightforward way.

Found with PVS-Studio T48917

3 years agofix enum type / values mismatch
Mike Erwin [Thu, 21 Jul 2016 22:26:54 +0000 (18:26 -0400)]
fix enum type / values mismatch

Found with PVS-Studio T48917

3 years agofix null pointer dereferences
Mike Erwin [Thu, 21 Jul 2016 22:15:54 +0000 (18:15 -0400)]
fix null pointer dereferences

Found with PVS-Studio T48917

3 years agofix comparison of identicals
Mike Erwin [Thu, 21 Jul 2016 22:14:58 +0000 (18:14 -0400)]
fix comparison of identicals

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

3 years agoCleanup: pass pointer to texture draw state
Campbell Barton [Thu, 21 Jul 2016 21:33:29 +0000 (07:33 +1000)]
Cleanup: pass pointer to texture draw state

3 years agoBMesh: compare face angles as angles cosine
Campbell Barton [Thu, 21 Jul 2016 21:20:42 +0000 (07:20 +1000)]
BMesh: compare face angles as angles cosine

3 years agoFix broken proxy object deletion.
Bastien Montagne [Thu, 21 Jul 2016 21:02:37 +0000 (23:02 +0200)]
Fix broken proxy object deletion.

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.

3 years agofix typo in condition
Mike Erwin [Thu, 21 Jul 2016 18:13:20 +0000 (14:13 -0400)]
fix typo in condition

(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

3 years agoFix T48915: Wrong threshold on scaled objects and ortho view.
Germano Cavalcante [Thu, 21 Jul 2016 19:36:20 +0000 (16:36 -0300)]
Fix T48915: Wrong threshold on scaled objects and ortho view.

`ray_is_normalized` == true in DerivedMesh

3 years agoFix crash w/ auto-insert offset
Campbell Barton [Thu, 21 Jul 2016 18:17:24 +0000 (04:17 +1000)]
Fix crash w/ auto-insert offset

3 years agoCleanup: warnings
Campbell Barton [Thu, 21 Jul 2016 18:05:38 +0000 (04:05 +1000)]
Cleanup: warnings

3 years agoremove repeated codec-supports-alpha check
Mike Erwin [Thu, 21 Jul 2016 17:50:35 +0000 (13:50 -0400)]
remove repeated codec-supports-alpha check

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_PNG <— alpha
AV_CODEC_ID_FFV1 <— alpha (if enabled)

Found with PVS-Studio T48917

3 years agoTracking: Fix bug when tracker will keep trying tracking past the footage
Sergey Sharybin [Thu, 21 Jul 2016 15:01:26 +0000 (17:01 +0200)]
Tracking: Fix bug when tracker will keep trying tracking past the footage

3 years agoAdd BKE_mesh_calc_islands_loop_poly_uvmap and use it in new OSD UV subdiv.
Bastien Montagne [Thu, 21 Jul 2016 14:53:00 +0000 (16:53 +0200)]
Add BKE_mesh_calc_islands_loop_poly_uvmap and use it in new OSD UV subdiv.

Also renamed BKE_mesh_calc_islands_loop_poly_uv to BKE_mesh_calc_islands_loop_poly_edgeseam,
to avoid confusion...

3 years agoBKE mesh mapping: add new BKE_mesh_edge_loop_map_create().
Bastien Montagne [Thu, 21 Jul 2016 14:30:57 +0000 (16:30 +0200)]
BKE mesh mapping: add new BKE_mesh_edge_loop_map_create().

Maps edges to all their pair of loops.

3 years agoFix (unreported) memleak in image copy function.
Bastien Montagne [Thu, 21 Jul 2016 14:27:30 +0000 (16:27 +0200)]
Fix (unreported) memleak in image copy function.

3 years agoFix stupid (harmless) mistake in recent commit.
Bastien Montagne [Thu, 21 Jul 2016 14:25:12 +0000 (16:25 +0200)]
Fix stupid (harmless) mistake in recent commit.

3 years agoBKE_library_make_local: clear behind us no more used linked datablocks.
Bastien Montagne [Thu, 21 Jul 2016 14:18:05 +0000 (16:18 +0200)]
BKE_library_make_local: clear behind us no more used linked datablocks.

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.

3 years agoFix (unreported) crash in some case when remapping armature data.
Bastien Montagne [Thu, 21 Jul 2016 14:15:00 +0000 (16:15 +0200)]
Fix (unreported) crash in some case when remapping armature data.

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.

3 years agoFix missing datablocks types in id_make_local.
Bastien Montagne [Thu, 21 Jul 2016 14:09:08 +0000 (16:09 +0200)]
Fix missing datablocks types in id_make_local.

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.

3 years agoCleanup: get rid of lib_indirect_test_id.
Bastien Montagne [Wed, 20 Jul 2016 17:59:21 +0000 (19:59 +0200)]
Cleanup: get rid of lib_indirect_test_id.

id_make_local and later remapping are supposed to handle that already,
and in a much much saner and more complete way.

3 years agoRefactor/deduplicate even more make_local code (and fix part of T48907).
Bastien Montagne [Wed, 20 Jul 2016 17:49:45 +0000 (19:49 +0200)]
Refactor/deduplicate even more make_local code (and fix part of T48907).

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.

3 years agoTracking: Fix possible cases when tracker will try tracking failed tracks
Sergey Sharybin [Thu, 21 Jul 2016 14:53:45 +0000 (16:53 +0200)]
Tracking: Fix possible cases when tracker will try tracking failed tracks

3 years agoAttempt to fix compilation on Windows, take 2
Kévin Dietrich [Thu, 21 Jul 2016 14:12:31 +0000 (16:12 +0200)]
Attempt to fix compilation on Windows, take 2

Previous patch was wrong apparently... :|

3 years agoAttempt to fix compilation error on Windows.
Kévin Dietrich [Thu, 21 Jul 2016 13:45:07 +0000 (15:45 +0200)]
Attempt to fix compilation error on Windows.

Patch from @fjuhec.

3 years agoOpenSubdiv: Prepare majority of things to have proper subdivided UV
Sergey Sharybin [Thu, 21 Jul 2016 10:33:11 +0000 (12:33 +0200)]
OpenSubdiv: Prepare majority of things to have proper subdivided UV

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.

3 years agoFix another Cycles OSL script node issue with shaders using bump.
Brecht Van Lommel [Thu, 21 Jul 2016 02:38:55 +0000 (04:38 +0200)]
Fix another Cycles OSL script node issue with shaders using bump.

3 years agoCleanup: use const, move comments to enum
Campbell Barton [Thu, 21 Jul 2016 01:49:30 +0000 (11:49 +1000)]
Cleanup: use const, move comments to enum

3 years agoFix Cycles OSL script node not working in shader using bump, after node type refactoring.
Brecht Van Lommel [Thu, 21 Jul 2016 00:50:30 +0000 (02:50 +0200)]
Fix Cycles OSL script node not working in shader using bump, after node type refactoring.

3 years agoFix T48908: gray out Cycles motion vector pass if motion blur is enabled, doesn't...
Brecht Van Lommel [Wed, 20 Jul 2016 23:02:21 +0000 (01:02 +0200)]
Fix T48908: gray out Cycles motion vector pass if motion blur is enabled, doesn't work then.

3 years agoCleanup: warnings
Campbell Barton [Wed, 20 Jul 2016 21:38:15 +0000 (07:38 +1000)]
Cleanup: warnings

3 years agoCleanup: unused brush DNA
Campbell Barton [Wed, 20 Jul 2016 21:15:43 +0000 (07:15 +1000)]
Cleanup: unused brush DNA

3 years agoCleanup: spelling
Campbell Barton [Wed, 20 Jul 2016 21:14:47 +0000 (07:14 +1000)]
Cleanup: spelling

3 years agoFix copy-materials resetting objects material indices
Campbell Barton [Wed, 20 Jul 2016 20:00:58 +0000 (06:00 +1000)]
Fix copy-materials resetting objects material indices

3 years agoCleanup: use BKE naming convention for object materials
Campbell Barton [Wed, 20 Jul 2016 19:56:12 +0000 (05:56 +1000)]
Cleanup: use BKE naming convention for object materials

Also remove unused 'material_from' function (which isn't very useful).

3 years agoCleanup: remove completely call to test_object_materials in BKE_mesh_new_from_object.
Bastien Montagne [Wed, 20 Jul 2016 14:40:43 +0000 (16:40 +0200)]
Cleanup: remove completely call to test_object_materials in BKE_mesh_new_from_object.

Don't know why this was ever added to start with, BKE_mesh_new_from_object shall never affect ob->data!

3 years agoFix T48898: shaders are removed from metaballs on cycles render.
Bastien Montagne [Wed, 20 Jul 2016 14:29:54 +0000 (16:29 +0200)]
Fix T48898: shaders are removed from metaballs on cycles render.

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.

3 years agoFix own error in recent heap update
Campbell Barton [Wed, 20 Jul 2016 14:33:37 +0000 (00:33 +1000)]
Fix own error in recent heap update

3 years agoOpenSubdiv: Initial work to support UV maps in textured OSD viewport
Sergey Sharybin [Tue, 19 Jul 2016 07:28:54 +0000 (09:28 +0200)]
OpenSubdiv: Initial work to support UV maps in textured OSD viewport

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 :)

3 years agoOpenSubdiv: Wrap OSD's TopologyRefier with own struct
Sergey Sharybin [Tue, 19 Jul 2016 14:12:18 +0000 (16:12 +0200)]
OpenSubdiv: Wrap OSD's TopologyRefier with own struct

This is a way for us to store extra data, such as UVs which we can
collect now on topology refiner stage.

3 years agoFix T48897: Flatten brush fails on first stroke
Campbell Barton [Wed, 20 Jul 2016 03:54:55 +0000 (13:54 +1000)]
Fix T48897: Flatten brush fails on first stroke

The flatten brush depended on accumulate being disabled,
Adding dynotopo support for accumulate caused problems for this tool (see T44390).
Enable for existing files.

3 years agopossible fix for crash mentioned in T48887 - Adjust the depth min to the object scale
Germano Cavalcante [Wed, 20 Jul 2016 01:25:13 +0000 (22:25 -0300)]
possible fix for crash mentioned in T48887 - Adjust the depth min to the object scale

3 years agoBMesh: improve BM_face_splits_check_legal
Campbell Barton [Tue, 19 Jul 2016 21:48:36 +0000 (07:48 +1000)]
BMesh: improve BM_face_splits_check_legal

- 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.

3 years agoUpdate tracker URL
Campbell Barton [Tue, 19 Jul 2016 20:34:54 +0000 (06:34 +1000)]
Update tracker URL

Also wrap line-length

3 years agoAdd 'reload' function to libraries' RNA API.
Bastien Montagne [Tue, 19 Jul 2016 15:49:01 +0000 (17:49 +0200)]
Add 'reload' function to libraries' RNA API.

3 years agoImproved warning message when creating empty export file
Gaia Clary [Tue, 19 Jul 2016 14:33:57 +0000 (16:33 +0200)]
Improved warning message when creating empty export file

3 years agoFix (IRC reported by Sergey) assert regarding icon_id of newly copied datablocks.
Bastien Montagne [Tue, 19 Jul 2016 14:27:40 +0000 (16:27 +0200)]
Fix (IRC reported by Sergey) assert regarding icon_id of newly copied datablocks.

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.

3 years agoUsual i18n/UI messages fixes...
Bastien Montagne [Tue, 19 Jul 2016 13:41:28 +0000 (15:41 +0200)]
Usual i18n/UI messages fixes...

3 years agoFix building on NetBSD
Campbell Barton [Tue, 19 Jul 2016 11:58:36 +0000 (21:58 +1000)]
Fix building on NetBSD

3 years agoOpenSubdiv: Fix wrong shading in BI texture mode
Sergey Sharybin [Tue, 19 Jul 2016 10:47:20 +0000 (12:47 +0200)]
OpenSubdiv: Fix wrong shading in BI texture mode

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.

3 years agoOpenSubdiv: Fix broken structure alignment when using color material
Sergey Sharybin [Tue, 19 Jul 2016 10:27:49 +0000 (12:27 +0200)]
OpenSubdiv: Fix broken structure alignment when using color material

3 years agoupdate player stub
Campbell Barton [Tue, 19 Jul 2016 09:31:27 +0000 (19:31 +1000)]
update player stub

3 years agoFix missing break in libblock relink
Campbell Barton [Tue, 19 Jul 2016 00:23:51 +0000 (10:23 +1000)]
Fix missing break in libblock relink

3 years agoCleanup: style, spelling
Campbell Barton [Tue, 19 Jul 2016 00:23:26 +0000 (10:23 +1000)]
Cleanup: style, spelling

3 years agoCleanup: style, spelling
Campbell Barton [Mon, 18 Jul 2016 22:39:38 +0000 (08:39 +1000)]
Cleanup: style, spelling

3 years agoCycles: add ConstantFolder class for constant folding boilerplate.
Alexander Gavrilov [Sat, 16 Jul 2016 11:16:54 +0000 (13:16 +0200)]
Cycles: add ConstantFolder class for constant folding boilerplate.

Reviewed By: brecht, sergey

Differential Revision:

3 years agoCycles: add support for motion blurring of fluid meshes.
Kévin Dietrich [Sat, 16 Jul 2016 16:56:59 +0000 (18:56 +0200)]
Cycles: add support for motion blurring of fluid meshes.

Reviewed By: brecht

Differential Revision:

3 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.

3 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

3 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

3 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

3 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

3 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

3 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:

3 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:

3 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:

2015 With no updates (compiler version 19.00.23026)

2015 With Update 2 (Compiler version 19.00.23918)

2015 With Update 3 (Compiler version 19.00.24210)

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:

3 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:

3 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.

3 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

3 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.

3 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

3 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:

3 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

3 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.

3 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

3 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.

3 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.

3 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

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

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

3 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: