4 years agoFix crash fitting single point curve
Campbell Barton [Thu, 28 Jul 2016 04:12:12 +0000 (14:12 +1000)]
Fix crash fitting single point curve

4 years agoUse COMPAT_ENGINES instead of RenderEngine.use_game_engine for panel poll methods
Mitchell Stokes [Tue, 5 Jul 2016 05:05:32 +0000 (22:05 -0700)]
Use COMPAT_ENGINES instead of RenderEngine.use_game_engine for panel poll methods

This mostly affects physics panels. Any engines relying on
RenderEngine.use_game_engine flag to show/hide panels will need to be
updated. The COMPAT_ENGINES technique is how we usually deal with this.
One issue with use_game_engine is that I cannot find a way to set it; it
appears only the BGE can set it. This means (without this commit)
external RenderEngines cannot get rid of the default physics panels.

The RE_GAME flag (the C flag behind use_game_engine) is pretty hacky
and we should look into removing its usage where possible.

4 years agoFix T48951: Crash refreshing some popups
Campbell Barton [Thu, 28 Jul 2016 01:08:01 +0000 (11:08 +1000)]
Fix T48951: Crash refreshing some popups

Fix for T48874 caused popups to be tagged to be refreshed, that didnt support it.

Tag popups that can't be refreshed.

4 years agoAdd comments on behavior of spacedata and regionbase lists
Julian Eisel [Thu, 28 Jul 2016 00:36:12 +0000 (02:36 +0200)]
Add comments on behavior of spacedata and regionbase lists

4 years agoFix own mistake from c05363e8895
Julian Eisel [Thu, 28 Jul 2016 00:23:32 +0000 (02:23 +0200)]
Fix own mistake from c05363e8895

Didn't know slink->regionbase is removed when area is active. Don't see why this is done, but it's confusing :S

4 years agoFix T48790: Cycles render bug with zero strength lights.
Brecht Van Lommel [Wed, 27 Jul 2016 21:09:38 +0000 (23:09 +0200)]
Fix T48790: Cycles render bug with zero strength lights.

4 years agoFix crash closing Blender while in rendered local view
Julian Eisel [Wed, 27 Jul 2016 19:05:44 +0000 (21:05 +0200)]
Fix crash closing Blender while in rendered local view

Happens because it was always using regionbase of active/visible area, not the correct one of the (possibly inactive) 3D view. Was pretty hidden because you had to be in local view to trigger it.
Could also remove ScrArea * argument from SpaceType.id_remap now, but leaving in there to avoid bigger changes (might also be useful for some case).

Steps to reproduce:
* Default startup.blend
* Enter local view with default cube (/-key)
* Render (or open a different editor where the 3D View is)
* Close Blender - should invoke crash

4 years agoFix memory leak when closing Blender with operator popup open
Julian Eisel [Wed, 27 Jul 2016 17:45:43 +0000 (19:45 +0200)]
Fix memory leak when closing Blender with operator popup open

Steps to reproduce:
* Default startup.blend
* RMB-Click on "Cube" item in outliner
* Select Remap Users
* Close Blender using window 'x' button

4 years agoFix T48946: Blender+Tahiti+DRI3+Unity+Linux GUI corruption/not rendering
Sergey Sharybin [Wed, 27 Jul 2016 14:06:18 +0000 (16:06 +0200)]
Fix T48946: Blender+Tahiti+DRI3+Unity+Linux GUI corruption/not rendering

Enable triple buffer by default for AMD cards on opensource driver.

Should be safe now, since it was only old cards causing problems,
which we don't support now most likely anyway.

4 years agoAvoid creating multiple outputs connected to the same socket when creating a node...
Lukas Stockner [Wed, 27 Jul 2016 13:53:32 +0000 (15:53 +0200)]
Avoid creating multiple outputs connected to the same socket when creating a node group

This patch fixes the annoyance that when creating a node group where one of its nodes is connected
to several other nodes, a separate output will be created for each link, even though they're all
connected to the same socket in the group.
Now, before adding an output for an outgoing link, the existing outputs are checked to find whether
any output is already connected to the same socket. If such an output is found, it is reused instead of
creating a new one.

Reviewers: Severin

Subscribers: Blendify

Differential Revision:

4 years agoFix T48061: Crash with adaptive domain and cases when there's no smoke
Alexander Gavrilov [Wed, 27 Jul 2016 13:40:32 +0000 (15:40 +0200)]
Fix T48061: Crash with adaptive domain and cases when there's no smoke

4 years agoFix T48760: Changing Renderlayer Compositor node Layer does not update enabled output...
Sergey Sharybin [Wed, 27 Jul 2016 13:17:15 +0000 (15:17 +0200)]
Fix T48760: Changing Renderlayer Compositor node Layer does not update enabled outputs until script is finished

4 years agoCycles: Style, placement of asteric in pointers
Sergey Sharybin [Wed, 27 Jul 2016 12:10:09 +0000 (14:10 +0200)]
Cycles: Style, placement of asteric in pointers

Seems we are using `void *` much much more often in Cycles.

4 years agoCycles: Some minor tweaks to emission sharder
Sergey Sharybin [Wed, 27 Jul 2016 12:04:28 +0000 (14:04 +0200)]
Cycles: Some minor tweaks to emission sharder

- Nodification of shader nodes changed default strength from 10 to 1.
  If that was intentional, IMO should happen as a separate commit.

- Fixed indentation.

4 years agoFix T48829: Memory leak on Blender Exit
Sergey Sharybin [Wed, 27 Jul 2016 08:59:09 +0000 (10:59 +0200)]
Fix T48829: Memory leak on Blender Exit

It was possible to have missing outlink but GPUNodes in material.

4 years agoFix T48950: Movie Clip mode segfaults
Sergey Sharybin [Wed, 27 Jul 2016 08:18:54 +0000 (10:18 +0200)]
Fix T48950: Movie Clip mode segfaults

Missing linking code in blenloader.

4 years agoCorrect UI names of ID types
Julian Eisel [Tue, 26 Jul 2016 18:15:00 +0000 (20:15 +0200)]
Correct UI names of ID types

Also correct typo.

4 years agoMore useful block name for report popup blocks
Julian Eisel [Tue, 26 Jul 2016 17:30:18 +0000 (19:30 +0200)]
More useful block name for report popup blocks

Report popups simply reuse popup menu code, so their blocks got "UI_popup_menu_begin" assigned as name, which was a bit misleading. Now uses "UI_popup_menu_reports".
Ideally they'd have their own popup code.

4 years agoFix T45936: invalid cycles motion blur for particle rotation and children.
Alexander Gavrilov [Tue, 26 Jul 2016 16:00:07 +0000 (18:00 +0200)]
Fix T45936: invalid cycles motion blur for particle rotation and children.

Commit rB709ca0ece changed how rotation was handled for particles so
that unless actual rotation physics is enabled, there is no rotation.
However it only updated ptcache_particle_read, forgetting to change
exactly the same code in ptcache_particle_interpolate.

This means that for subframes old code that computes a rotation from
velocity is used, resulting in completely different rotation than for
integer frames. This causes rotational motion blur by itself, and also
mangles motion blur paths of child particles.

Reviewers: sergey, lukastoenne

Maniphest Tasks: T45936

Differential Revision:

4 years agoFix T48813: Custom icon is not drawn on header / addons prefs panel.
Bastien Montagne [Tue, 26 Jul 2016 15:55:18 +0000 (17:55 +0200)]
Fix T48813: Custom icon is not drawn on header / addons prefs panel.

For now use 'brute force' and refresh whole UI when new icons get rendered.

See comment of T48813 for ideas about how to handle that in future (2.8 project ?).

4 years agoCycles: Proper fix for buffer overflow in volume intersect all
Sergey Sharybin [Tue, 26 Jul 2016 14:56:40 +0000 (16:56 +0200)]
Cycles: Proper fix for buffer overflow in volume intersect all

4 years agoCycles: Revert previous fixes to intersect_all functions
Sergey Sharybin [Tue, 26 Jul 2016 14:30:13 +0000 (16:30 +0200)]
Cycles: Revert previous fixes to intersect_all functions

While they prevent legit write past the array boundary error
those fixes introduced regression in behavior when having exact
max_hits transparent intersections and nothing else.

Previous code would have considered such case a totally opaque,
but it's not correct.

Fixes T48941: Some materials don't get transparent shadows anymore

4 years agoFix issues in ID usages checks - we are not interested in self-usages here.
Bastien Montagne [Tue, 26 Jul 2016 13:12:43 +0000 (15:12 +0200)]
Fix issues in ID usages checks - we are not interested in self-usages here.

Drivers or constraints referencing self object could break deletion of proxy objects
(due to their ambiguous, half-local, half-linked status).

4 years agoFix T48902: MCE Dopesheet does not respect Left Click select
Sergey Sharybin [Tue, 26 Jul 2016 12:39:06 +0000 (14:39 +0200)]
Fix T48902: MCE Dopesheet does not respect Left Click select

Make the operator consistent with animation dopesheet now.

4 years agoDepsgraph: Use proper check whether ID is an object
Sergey Sharybin [Tue, 26 Jul 2016 08:49:54 +0000 (10:49 +0200)]
Depsgraph: Use proper check whether ID is an object

Fixes bug which resulted in making it so layers from all
layers are getting updated.

Reported by Juan Pablo Bouza.

4 years agoDepsgraph: Use proper unsigned int bitfield for layers flags
Sergey Sharybin [Tue, 26 Jul 2016 08:38:13 +0000 (10:38 +0200)]
Depsgraph: Use proper unsigned int bitfield for layers flags

4 years agoCurve Drawing: use more closely spaced samples
Campbell Barton [Mon, 25 Jul 2016 20:42:24 +0000 (06:42 +1000)]
Curve Drawing: use more closely spaced samples

Re-fitting makes better use of more samples.

4 years agoResolve undefined M_PI w/ MSVC2013
Campbell Barton [Mon, 25 Jul 2016 19:28:13 +0000 (05:28 +1000)]
Resolve undefined M_PI w/ MSVC2013

4 years agoCall to python3 for stand-alone scripts
Campbell Barton [Mon, 25 Jul 2016 19:13:39 +0000 (05:13 +1000)]
Call to python3 for stand-alone scripts

Needed since Debian & FreeBSD both move away from keeping a synlink to `python`.

4 years agoOpenSubdiv: Fix opensubdiv option obscuring the interface
Sergey Sharybin [Mon, 25 Jul 2016 16:30:48 +0000 (18:30 +0200)]
OpenSubdiv: Fix opensubdiv option obscuring the interface

4 years agoCleanup: factorize the 'ensure local' part of datablock copy into a single BKE_id_cop...
Bastien Montagne [Mon, 25 Jul 2016 14:15:37 +0000 (16:15 +0200)]
Cleanup: factorize the 'ensure local' part of datablock copy into a single BKE_id_copy_ensure_local function.

4 years agoCycles: Fix rays parallel to the surface in the triangle refine and MultiGGX code
Lukas Stockner [Mon, 25 Jul 2016 14:02:25 +0000 (16:02 +0200)]
Cycles: Fix rays parallel to the surface in the triangle refine and MultiGGX code

In the triangle intersection refinement code, rays that are parallel to the triangle caused a divide by zero.
These rays might initially hit the triangle due to the watertight intersection test, but are very rare - therefore, just skipping the refinement for them works fine.

Also, a few remaining issues in the MultiGGX code are fixed that were caused by rays parallel to the surface (which happened more often there due to smooth shading).

4 years agoCycles: Calculate differentials in the Multiscattering GGX closures
Lukas Stockner [Mon, 25 Jul 2016 14:00:36 +0000 (16:00 +0200)]
Cycles: Calculate differentials in the Multiscattering GGX closures

The Multiscattering GGX closures didn't set the omega_i differentials, which could cause undefined behaviour.

4 years agoOpenSubdiv: Support shadeless shading
Sergey Sharybin [Mon, 25 Jul 2016 13:38:28 +0000 (15:38 +0200)]
OpenSubdiv: Support shadeless shading

4 years agoOpenSubdiv: Fix missing support of flat shading in textured viewport
Sergey Sharybin [Mon, 25 Jul 2016 13:27:38 +0000 (15:27 +0200)]
OpenSubdiv: Fix missing support of flat shading in textured viewport

4 years agoOpenSubdiv: Use proper material index
Sergey Sharybin [Mon, 25 Jul 2016 13:17:37 +0000 (15:17 +0200)]
OpenSubdiv: Use proper material index

4 years agoCycles: Fix SSS with spatial splits and motion blur
Sergey Sharybin [Mon, 25 Jul 2016 11:53:30 +0000 (13:53 +0200)]
Cycles: Fix SSS with spatial splits and motion blur

4 years agoResolve build error on OSX
Campbell Barton [Mon, 25 Jul 2016 10:29:46 +0000 (20:29 +1000)]
Resolve build error on OSX

4 years agoCleanup: debug-only variable.
Bastien Montagne [Mon, 25 Jul 2016 07:31:56 +0000 (09:31 +0200)]
Cleanup: debug-only variable.

4 years agoError in curve update, uninitialized var use
Campbell Barton [Mon, 25 Jul 2016 05:12:46 +0000 (15:12 +1000)]
Error in curve update, uninitialized var use

4 years agoCurve Drawing: Use cyclic for stroke with near start/end points
Campbell Barton [Mon, 25 Jul 2016 04:16:18 +0000 (14:16 +1000)]
Curve Drawing: Use cyclic for stroke with near start/end points

4 years agoCurve Drawing: Add option to use new refit method
Campbell Barton [Mon, 25 Jul 2016 04:14:31 +0000 (14:14 +1000)]
Curve Drawing: Add option to use new refit method

4 years agoCurve Fitting: Add alternate 'refit' method
Campbell Barton [Mon, 25 Jul 2016 04:12:17 +0000 (14:12 +1000)]
Curve Fitting: Add alternate 'refit' method

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.

4 years agoFix use of uninitialized variable in recent SSS fix.
Brecht Van Lommel [Sun, 24 Jul 2016 14:39:41 +0000 (16:39 +0200)]
Fix use of uninitialized variable in recent SSS fix.

4 years agoFix T48397: Can not bake tweaked NLA
Kévin Dietrich [Sun, 24 Jul 2016 01:18:40 +0000 (03:18 +0200)]
Fix T48397: Can not bake tweaked NLA

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:

4 years agoFix T48663: The Soft Light blend type layer make the color darker in the
Kévin Dietrich [Sat, 23 Jul 2016 23:04:54 +0000 (01:04 +0200)]
Fix T48663: The Soft Light blend type layer make the color darker in the
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.

4 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

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

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

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

4 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

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

4 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

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

4 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

4 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

4 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

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

4 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

4 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

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

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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

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

4 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

4 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

4 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

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

4 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

4 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

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

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

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

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

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

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

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

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

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

4 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

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

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

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

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

4 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

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

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

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

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

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

4 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

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