3 years agoCycles microdisplacement: move subdivision options to subsurf modifier
Mai Lavelle [Sat, 16 Jul 2016 23:56:45 +0000 (19:56 -0400)]
Cycles microdisplacement: move subdivision options to subsurf modifier

Subdivision options can now be found in the subsurf modifier. The modifier must
be the last in the stack or the options will be unavailable. Catmull-Clark
subdivision is still unavailable and will fallback to linear subdivision instead

Reviewed By: brecht

Differential Revision:

3 years agoCycles microdisplacement: ngons and attributes for subdivision meshes
Mai Lavelle [Sat, 16 Jul 2016 23:42:28 +0000 (19:42 -0400)]
Cycles microdisplacement: ngons and attributes for subdivision meshes

This adds support for ngons and attributes on subdivision meshes. Ngons are
needed for proper attribute interpolation as well as correct Catmull-Clark
subdivision. Several changes are made to achieve this:

- new primitive `SubdFace` added to `Mesh`
- 3 more textures are used to store info on patches from subd meshes
- Blender export uses loop interface instead of tessface for subd meshes
- `Attribute` class is updated with a simplified way to pass primitive counts
  around and to support ngons.
- extra points for ngons are generated for O(1) attribute interpolation
- curves are temporally disabled on subd meshes to avoid various bugs with
- old unneeded code is removed from `subd/`
- various fixes and improvements

Reviewed By: brecht

Differential Revision:

3 years agoMissing free for single-sided edge-slide failure
Campbell Barton [Thu, 28 Jul 2016 23:50:55 +0000 (09:50 +1000)]
Missing free for single-sided edge-slide failure

3 years agoFix Cycles OSL hair BSDF inconsistencies with SVM.
Brecht Van Lommel [Fri, 29 Jul 2016 00:22:01 +0000 (02:22 +0200)]
Fix Cycles OSL hair BSDF inconsistencies with SVM.

3 years agoFix Cycles ctests not always deleting fail.png files on success.
Brecht Van Lommel [Fri, 29 Jul 2016 00:04:45 +0000 (02:04 +0200)]
Fix Cycles ctests not always deleting fail.png files on success.

3 years agoFix use of uninitialized variable in Cycles, mostly harmless.
Brecht Van Lommel [Thu, 28 Jul 2016 23:04:01 +0000 (01:04 +0200)]
Fix use of uninitialized variable in Cycles, mostly harmless.

3 years agoMake ID types typed enum, to easily spot missing ones in core switches of library.c
Bastien Montagne [Thu, 28 Jul 2016 13:21:53 +0000 (15:21 +0200)]
Make ID types typed enum, to easily spot missing ones in core switches of library.c

Note that all deprecated/non-real ID types are kept as defines.

3 years agoFix T48965: Cannot Append Palette As Local Datablock.
Bastien Montagne [Thu, 28 Jul 2016 12:40:26 +0000 (14:40 +0200)]
Fix T48965: Cannot Append Palette As Local Datablock.

Palette and PaintCurve were totally missing from id_copy/id_make_local switch... :/

3 years agoCycles: Fix difference in Ashikhmin Shirley shader between CPU and GPU
Sergey Sharybin [Thu, 28 Jul 2016 16:46:29 +0000 (18:46 +0200)]
Cycles: Fix difference in Ashikhmin Shirley shader between CPU and GPU

The issue was caused by some NaN appearing in calculations.

Visible with scifi_armor_concept.blend from the cloud.

3 years agoCleanup: Indentation
Sergey Sharybin [Thu, 28 Jul 2016 12:17:35 +0000 (14:17 +0200)]
Cleanup: Indentation

3 years agoFix T48838: Tiling sculpt problem with custom brush
Sergey Sharybin [Thu, 28 Jul 2016 12:00:44 +0000 (14:00 +0200)]
Fix T48838: Tiling sculpt problem with custom brush

3 years agoFix T48962: Edge-slide, random edge switch order
Campbell Barton [Thu, 28 Jul 2016 11:48:07 +0000 (21:48 +1000)]
Fix T48962: Edge-slide, random edge switch order

3 years agoCycles: Fix missing mesh flags update when tweaking shaders
Sergey Sharybin [Thu, 28 Jul 2016 10:37:44 +0000 (12:37 +0200)]
Cycles: Fix missing mesh flags update when tweaking shaders

This is a bit weak, but better than tagging whole mesh manager for update.

Maybe we'll solve such dual-look up in the future.

This commit finally solves T48963: Noise when changing Diffuse node to Emission node

3 years agoCycles: Fix wrong order of light manager update tag
Sergey Sharybin [Thu, 28 Jul 2016 10:31:01 +0000 (12:31 +0200)]
Cycles: Fix wrong order of light manager update tag

Shader's has_surface_emission will only be known for sure after compilation.

3 years agoCycles: De-duplicate more checks around light emisive meshes
Sergey Sharybin [Thu, 28 Jul 2016 10:27:24 +0000 (12:27 +0200)]
Cycles: De-duplicate more checks around light emisive meshes

Once again, should be no functional changes.

3 years agoCycles: De-duplicate check for MIS shaders in meshes
Sergey Sharybin [Thu, 28 Jul 2016 10:20:47 +0000 (12:20 +0200)]
Cycles: De-duplicate check for MIS shaders in meshes

Should be no functional changes.

3 years agoCycles: Add some extra logging for light debugging
Sergey Sharybin [Thu, 28 Jul 2016 10:13:11 +0000 (12:13 +0200)]
Cycles: Add some extra logging for light debugging

3 years agoDupliObject: Remove unused and confusing index argument from the context
Sergey Sharybin [Thu, 28 Jul 2016 08:42:52 +0000 (10:42 +0200)]
DupliObject: Remove unused and confusing index argument from the context

3 years agoCurve Fitting: Use normalized projection function
Campbell Barton [Thu, 28 Jul 2016 08:33:14 +0000 (18:33 +1000)]
Curve Fitting: Use normalized projection function

3 years agoFix T48404: Translate fails w/ snap orientation option
Campbell Barton [Thu, 28 Jul 2016 08:11:43 +0000 (18:11 +1000)]
Fix T48404: Translate fails w/ snap orientation option

Rotate the object around the snap-target so it meets the snap-point.

3 years agoCleanup: unused transform member
Campbell Barton [Thu, 28 Jul 2016 06:55:57 +0000 (16:55 +1000)]
Cleanup: unused transform member

3 years agoFix T48961: Material slots become easily desynced over linked duplicates.
Bastien Montagne [Thu, 28 Jul 2016 07:23:46 +0000 (09:23 +0200)]
Fix T48961: Material slots become easily desynced over linked duplicates.

Own mistake in recent changes (split to test_object_materials()/test_all_objects_materials()).

3 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

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

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

3 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

3 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

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

3 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

3 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

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

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

3 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

3 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

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

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

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

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

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

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

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

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

3 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

3 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

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

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

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

3 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

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

3 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

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

3 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

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

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

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

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

3 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

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

3 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

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

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

3 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

3 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

3 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

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

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

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

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

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