1
1

Compare commits

...

1535 Commits

Author SHA1 Message Date
3edc6ece77 Write all non modal keymaps 2018-06-29 08:53:27 +02:00
929c78e33c EEVEE: LookDev blurred background 2018-05-29 17:50:51 +02:00
Dalai Felinto
08b8fa0863 Cleanup 2018-05-29 17:33:14 +02:00
Dalai Felinto
85d845ef98 Fix crash when moving object parented to a curve
Note, we can probably remove scene from BKE_object_where_is_calc
and force to always use it from depsgraph.
2018-05-29 17:33:07 +02:00
Dalai Felinto
5eda9732b3 Use the correct time to evaluate object in BKE_object_where_is_calc functions 2018-05-29 17:05:32 +02:00
Dalai Felinto
e2bac484e0 Use correct time for curve parent evaluation
Time should alwaus come from depsgraph, not scene.
2018-05-29 17:05:32 +02:00
36e9ed98e7 StudioLight: Calculate Specular irradiance 2018-05-29 16:29:11 +02:00
f98c838b71 EEVEE: LookDev reversed the background fadeout 2018-05-29 16:22:53 +02:00
d5889f57ae EEVEE: LookDev fadeout to the world horizon color 2018-05-29 16:22:53 +02:00
8f670dd855 Merge branch 'master' into blender2.8
Conflicts:
	source/blender/blenkernel/BKE_material.h
	source/blender/blenkernel/BKE_mesh.h
	source/blender/blenkernel/intern/library_remap.c
	source/blender/blenkernel/intern/material.c
	source/blender/editors/object/object_relations.c
	source/blender/editors/render/render_preview.c
	source/blender/makesrna/intern/rna_object.c
2018-05-29 16:02:53 +02:00
f7af08b5fe Cleanup: Get rid of G.main in BKE_material.
Note that in some cases, this only moves the G.main case to somne other
places - in particular, RNA getters/setters are becoming annoying here...
2018-05-29 15:49:21 +02:00
9d037153f7 Object Modes: disable mode switching on selection
See T55246
2018-05-29 15:47:08 +02:00
44b99d1052 For 2.8, bring back debug mode indices display. 2018-05-29 09:31:00 -04:00
43584f4a41 Missed own last commit 2018-05-29 15:17:34 +02:00
Dalai Felinto
bc54823376 Fix T55244: Parenting object(s) to curve crashes blender
There is a chance parts of Blender call BKE_object_workob_calc_parent
with ob->parent objects that are outside the depsgraph.

This we can tackle later since these are corner cases anyways,
and this fix fixes all parenting operators in Blender.
2018-05-29 15:11:20 +02:00
8b24f45e6b Object Modes: only use selection for mode switch
Selection is no longer needed for an object to be considered in a mode.

Part of T55246 design task, fixes T55187
2018-05-29 14:21:18 +02:00
03b0495d04 Fix: Only change transform mode from translation to rotation/scale when no valid bones were found in an armature
This commit fixes a problem the Spring team were having in the shot files 01_030/050 with
the camera rig, where when you tried grabbing/translating the bones of the camera rig,
they would only keep rotating/scaling instead.

The reason for this is that with the multi-object editing support added into the transform
system, this code would now get run for all the other objects that were being included
in Pose Mode, even if no bones from those armatures were selected. Since no valid translatable
bones were found in those other armatures, the transform mode would get reset upon
encountering one of those other bones.
2018-05-29 12:27:04 +02:00
756b70c6c3 UI: Expand space sub-types into the menu
Initial support for expanding editors, see: T54744
2018-05-29 12:15:26 +02:00
d4ac65d003 Cleanup: use same 'depsgraph' name everywhere outside of DEG space.
'graph' is waaaayyyyy too generic name outside of DEG context, and
better try to use same name everywhere!
2018-05-29 12:07:48 +02:00
643259415d EEVEE: LookDev fade out background option 2018-05-29 12:06:48 +02:00
a0b08e7b66 EEVEE: LookDev use_scene_light draw option
Scene lights are rendered when
 - v3d is not available
 - or shading type is other then OB_MATERIAL
 - or shading type is OB_MATERIAL and use_scene_light is true
2018-05-29 11:01:25 +02:00
2bb4977c4a Fix T55203: Particle hair weights are not preserved 2018-05-29 10:36:19 +02:00
77e32e8819 EEVEE: LookDev overlays enabling
The mirror ball and diffuse ball are only rendered when overlays are
turned on and the lookdev overlay is turned on.
2018-05-29 09:08:32 +02:00
c72a204001 make.bat : fix release build not getting the right settings. 2018-05-28 21:50:59 -06:00
6946c41340 Merge remote-tracking branch 'origin/master' into blender2.8 2018-05-28 20:07:51 -06:00
d6a4b23f8b make.bat : improve error message while detecting the msvc runtime when using clang 2018-05-28 20:07:24 -06:00
3ad9a94c9d Merge remote-tracking branch 'origin/master' into blender2.8 2018-05-28 19:57:50 -06:00
9450792bf2 make.bat : add support for building with ninja and clang together. 2018-05-28 19:56:17 -06:00
4e5d5b3a9e COW operators: Fix VIEW3D_OT_view_all cursor not updating with shift+c center cursor
This differential fixes a bug for resetting view (shift+c).
Bug description: When 3D cursor is placed randomly somewhere, and shift+c is pressed,
the cursor is not shown to reset at world center.

Reviewers: sergey, aligorith, brita_

Reviewed By: brita_

Subscribers: brita_

Differential Revision: https://developer.blender.org/D3423
2018-05-28 23:45:22 +02:00
eb2491363a Cleanup: fix some harmless compiler warnings. 2018-05-28 23:27:40 +02:00
359469a39a Fix T55204: proxy object disappearing randomly.
The problem was a missing depsgraph relation between the transforms of
the object and its proxy, it was only there for the pose.
2018-05-28 23:24:16 +02:00
9b1a15d8f8 Fix assert in workbench drawing, instance data not big enough. 2018-05-28 23:19:57 +02:00
3c1483cf1e COW operators: Fix drag and dropping of color properties 2018-05-28 23:07:23 +02:00
5d1a172783 Merge remote-tracking branch 'origin/master' into blender2.8 2018-05-28 14:35:59 -06:00
81060ff6b2 Windows: Add support for building with clang.
This commit contains the minimum to make clang build/work with blender, asan and ninja build support is forthcoming

Things to note:

1) Builds and runs, and is able to pass all tests (except for the freestyle_stroke_material.blend test which was broken at that time for all platforms by the looks of it)

2) It's slightly faster than msvc when using cycles. (time in seconds, on an i7-3370)

victor_cpu
	msvc:3099.51
	clang:2796.43

pavillon_barcelona_cpu
	msvc:1872.05
	clang:1827.72

koro_cpu
	msvc:1097.58
	clang:1006.51

fishy_cat_cpu
	msvc:815.37
	clang:722.2

classroom_cpu
	msvc:1705.39
	clang:1575.43

bmw27_cpu
	msvc:552.38
	clang:561.53

barbershop_interior_cpu
	msvc:2134.93
	clang:1922.33

3) clang on windows uses a drop in replacement for the Microsoft cl.exe (takes some of the Microsoft parameters, but not all, and takes some of the clang parameters but not all) and uses ms headers + libraries + linker, so you still need visual studio installed and will use our existing vc14 svn libs.

4) X64 only currently, X86 builds but crashes on startup.

5) Tested with llvm/clang 6.0.0

6) Requires visual studio integration, available at https://github.com/LazyDodo/llvm-vs2017-integration

7) The Microsoft compiler spawns a few copies of cl in parallel to get faster build times, clang doesn't, so the build time is 3-4x slower than with msvc.

8) No openmp support yet. Have not looked at this much, the binary distribution of clang doesn't seem to include it on windows.

9) No ASAN support yet, some of the sanitizers can be made to work, but it was decided to leave support out of this commit.

Reviewers: campbellbarton

Differential Revision: https://developer.blender.org/D3304
2018-05-28 14:34:47 -06:00
Dalai Felinto
66577c8732 Rename EEVEE visibility group > collection
I think we should rename the DNA as well, and break the 0.01 files using this feature.
But I will leave this decision to Clement.
2018-05-28 21:27:00 +02:00
cf60939a59 Ugly Hacky Fix: Clear Loc/Rot/Scale + Autokey now works for bones
This is a hacky fix so that animators can use this tool again with autokey enabled
(which they do all the time). The issue here is that the tool writes the new (0)
values to the original data, but insertkey now reads from evaluated data (so that
keying interpolated values works). However, the cleared values do not get re-evaluated
or flushed before insertkey gets to it (via auto keying), meaning that the wrong values
get keyed.

There may be better solutions for this, but for now, this is the simplest fix that
I can get working.
2018-05-28 20:25:03 +02:00
69d3a08557 EEVEE: lookdev default materials 2018-05-28 19:35:08 +02:00
e63fbc992d Fix T55231: Setting bone.select from RNA didn't tag for copy on write
This was causing problems with addons such as the Selection Sets addon used
in studio by the animators.
2018-05-28 18:52:04 +02:00
e9cf3b5347 CoW: Skip pointers that are used in Lattice edit mode. 2018-05-28 13:47:05 -03:00
46d7c55b17 Cleanup: Fix typo: updata -> update 2018-05-28 13:47:04 -03:00
f8d0447dfb CoW: Skip used pointers in MetaBall edit mode. 2018-05-28 13:47:04 -03:00
f36315dd34 CoW: Skip pointers used in Text edit mode. 2018-05-28 13:47:03 -03:00
98d4d4ce58 Tool System: workaround psys cursor conflict
This needs to be solved properly, for now add cursor-click tool
which can co-exist w/ particle paint.
2018-05-28 18:16:01 +02:00
42d6b8efc0 RNA: re-enable property notifiers
While these will be removed eventually,
it makes tracking down COW buts a hassle.
2018-05-28 18:16:01 +02:00
d2f8b48f01 Depsgraph: preserve memory caches for particles when creating Copy-on-Write
Solves issue with particle memory cache ignored.

Thanks Bastien for review!
2018-05-28 18:06:45 +02:00
2f56bf3535 Workbench: Fix uninitialized variable usage. 2018-05-28 12:27:50 -03:00
272ca5772d EEVEE: LookDev storage list wrongly used 2018-05-28 17:18:58 +02:00
9b6a30d2cb Fix T55226: outliner glitch with item open/close, after recent optimization. 2018-05-28 17:10:00 +02:00
765fd29d68 EEvEE: LookDev 2018-05-28 17:07:39 +02:00
ce5fa2deca Fix: Action/Graph editor UI's didn't update when channel properties were changed
More MessageBus-related silliness to resolve issue with toggling visibility/mute/locking
status of F-Curves/Groups/etc., as well as other things like modifying active keyframe's
values, or changing properties of F-Modifiers.

I've now ended up just whitelisting in the region subscribers all the animation-related
structs in RNA. But still, that may not be enough to deal with potential issues later
with the property sliders (shown per channel, optionally), which can come from anywhere.

(Spring bug)
2018-05-28 16:54:45 +02:00
1d320f10ac UI: Option to layout properties in two columns
Needed for proposed alternate layout, see T54951.
2018-05-28 16:49:30 +02:00
4045730d58 Fix missing animation curves update when tweaking f-curves
Action is an own datablock, meaning, changes to f-curves needs
to copy those changes to all evaluated versions of action datablock.
2018-05-28 16:45:28 +02:00
e673be1ebc Merge branch 'master' into blender2.8 2018-05-28 15:25:41 +02:00
dc0eed178a Fix Cycles + OSL build error, pass main to node editing functions. 2018-05-28 00:04:14 +02:00
95c5d1193f Merge branch 'master' into blender2.8 2018-05-27 21:10:43 +02:00
fd2c48726f UI: center align number buttons w/o text
This makes supporting split properties and text possible, see T54951
2018-05-27 21:08:50 +02:00
9c8da50106 Slightly blue tinted variation of the upcoming Flatty Dark theme.
It's been requested for a while now and with the upcoming
default dark theme this is a good companion variation.
2018-05-27 19:06:25 +02:00
e7010a05be Merge branch 'master' into blender2.8
Conflicts:
	source/blender/makesrna/intern/rna_object_api.c
	source/blender/makesrna/intern/rna_scene.c
	source/blender/makesrna/intern/rna_scene_api.c
2018-05-27 18:52:28 +02:00
38cb29d67e Cleanup: Nuke most of remaining evil G.main from RNA.
The few ones in getters/setters we cannot remove as easily, for now we
can live with those I think...
2018-05-27 18:46:39 +02:00
1863883a24 Merge branch 'master' into blender2.8 2018-05-27 17:26:59 +02:00
edce44d693 Cycles: Fix problems in the IES loader when rendering with no file selected 2018-05-27 17:16:15 +02:00
47f2b3b80d Merge branch 'master' into blender2.8 2018-05-27 12:54:21 +02:00
56254a42e0 UI: replace BLI_strncpy w/ memcpy
Size is already checked.
2018-05-27 12:50:03 +02:00
4ca4e64d25 Grid: Do not go over objects in front/side ortho views.
Fixes T55190 Grid displayed on top of objects in orthographic view
2018-05-27 11:26:17 +02:00
9a74b60367 Merge branch 'master' into blender2.8 2018-05-27 11:06:29 +02:00
474971f3d8 Cleanup: unused var 2018-05-27 11:06:11 +02:00
bc3727a943 Recently added IES conflicts w/ EEVEE 2018-05-27 11:01:46 +02:00
198be6f37b Grid: Fix T51813: Opaque grid on OSX. 2018-05-27 10:50:39 +02:00
06cb460cd7 3D View: minor change to NDOF view orbit
This change is needed for 2.8, where the NULL check isn't a reliable way
of testing if dynamic offset is needed.
2018-05-27 10:34:01 +02:00
12a9e9ae33 Fix restrict error in BLI_str_format_byte_unit
Don't use sprintf to append a string to it's self.

Also correct BLI_str_rstrip_float_zero's return value.
2018-05-27 10:28:04 +02:00
7a0699db34 make.bat : Fix builtime.txt being written in the wrong folder. 2018-05-26 19:20:07 -06:00
48155c210a Cycles: Add Support for IES files as textures for light strength
This patch adds support for IES files, a file format that is commonly used to store the directional intensity distribution of light sources.
The new IES node is supposed to be plugged into the Strength input of the Emission node of the lamp.

Since people generating IES files do not really seem to care about the standard, the parser is flexible enough to accept all test files I have tried.
Some common weirdnesses are distributing values over multiple lines that should go into one line, using commas instead of spaces as delimiters and adding various useless stuff at the end of the file.

The user interface of the node is similar to the script node, the user can either select an internal Text or load a file.
Internally, IES files are handled similar to Image textures: They are stored in slots by the LightManager and each unique IES is assigned to one slot.

The local coordinate system of the lamp is used, so that the direction of the light can be changed. For UI reasons, it's usually best to add an area light,
rotate it and then change its type, since especially the point light does not immediately show its local coordinate system in the viewport.

Reviewers: #cycles, dingto, sergey, brecht

Reviewed By: #cycles, dingto, brecht

Subscribers: OgDEV, crazyrobinhood, secundar, cardboard, pisuke, intrah, swerner, micah_denn, harvester, gottfried, disnel, campbellbarton, duarteframos, Lapineige, brecht, juicyfruit, dingto, marek, rickyblender, bliblubli, lockal, sergey

Differential Revision: https://developer.blender.org/D1543
2018-05-27 01:24:57 +02:00
aefc793a81 Workbench: Shadow: Refine camera in shadow test.
Test if all nearplane points are not in front of the shadow BBox.
2018-05-27 00:15:47 +02:00
60ddea7758 Workbench: Shadows: Add frustum check and camera occlusion test.
If the object is manifold and the camera is in the shadow side, we can
use the depth fail method to fix the inverted shadow glitch.

Unfortunately this does not really work for non-manifold.

Implementation details:
We try to be as efficient as we can, we precompute camera near plane
projected into 2D shadow space so we can test for intersection with the
shadow boundbox easily.

As the intersection test is done in 2D it's pretty fast.
Unfortunately, this means the shadow bounds are all aligned to the same
space and are not the smallest bound we could extract.
2018-05-26 23:31:17 +02:00
975828e23a Armature: Fix warning. 2018-05-26 23:24:11 +02:00
8df99a5d8a DRW: Add new DRW_debug API.
This new API aim to provide simple function that can be called by the draw
engines during any phase of the draw pipeline. All calls are saved and
issued after all engines have finished rendering.

This removes the need of setuping special passes and shading groups for some
simple debug drawing.
2018-05-26 23:24:11 +02:00
c883f09fa8 Workbench: Codestyle 2018-05-26 23:24:11 +02:00
975eac0b07 Workbench: Shadow: Add shader variant for manifold case.
Totally Manifold objects only require a single increment/decrement of the
stencil value. This result in less geometry generated and less overdraw.
2018-05-26 23:21:33 +02:00
0c9974c8cd Workbench: Shadow: Use depth fail method for manifold objects.
Since this method have no failure case for manifold objects, use it.
2018-05-26 23:01:30 +02:00
ef502854fe Threads: add spinlock hit for hyperthreading processors on Windows.
Suggested by Percy Ross Tiglao.
2018-05-26 22:35:30 +02:00
44935fdfa3 Armature: Make Custom bone have the same appearance as other bones.
I had to correct some errors in the winding order of the normal bones.
2018-05-26 22:28:52 +02:00
2241a61aab Armature: Fix missing bone edges in object mode. 2018-05-26 22:28:52 +02:00
6b38fa8cab Armature: Modify Shape outline shader to use Line adjacency instead of tri.
This is much faster and simpler. This is also to make it compatible with
custom bone shape in the future.
2018-05-26 22:28:52 +02:00
581b021a1f Cleanup: unused defines 2018-05-26 13:15:55 +02:00
c9c95ed25f Cleanup: unused defines 2018-05-26 13:12:00 +02:00
75355ef426 RNA: correct naming w/ last cleanup 2018-05-26 13:06:40 +02:00
0d559a6730 RNA: follow boolean naming conventions 2018-05-26 11:54:25 +02:00
6ebcf98943 Cleanup: whitespace, long lines, duplicate include 2018-05-26 11:05:23 +02:00
3e3f6754b4 Cleanup: rename RNA property to match UI 2018-05-26 09:51:21 +02:00
33e45658eb COW Fix: Lamp manipulators 2018-05-26 09:45:58 +02:00
c9db7ceff2 make.bat: Add support for building with ninja.
ninja is an alternative to msbuild designed for fast rebuilds. However there is no IDE support, builds only from the command line.

Comparison between msbuild and ninja for a full build, build time in seconds.

Full Clean Build
msbuild     867.5
Ninja       801.2
Difference  -66.3 (-7.6%)

Minor Change
msbuild      43.0
Ninja        14.9
Difference  -28.1 (-64.4%)

No Changes
msbuild      23.0
Ninja         6.1
Difference  -16.9 (-73.5%)
2018-05-25 21:46:42 -06:00
bae880dc9e make.bat/cleanup: removed stray echo in make.bat 2018-05-25 17:59:07 -06:00
857e4e04d8 make.bat: refactor make.bat
make.bat was starting to become hard to maintain, this refactors it into separate batch files for each stage of the process.

-Improved detection of msvc2013/2015
-Improved failure handling.
-Added check for working msbuild and C++ compiler
-Added verbose switch to ease trouble shooting.
-Added Check if svn/cmake/git are in the path before using them
-Display the build configuration before asking to download the libraries
-Offer an option to recover an interrupted checkout of the libraries.
-Automatically check out sub-modules in-case they are missing.
2018-05-25 17:57:13 -06:00
64ee6f4e9f Fix error when snapping with occlusion.
Face normal may be facing the wrong side.
2018-05-25 18:43:38 -03:00
c9f7a3b32a Fix T55207, fix T55208: hair not positioned correctly after subsurf.
The problem was that the particle system modifier was reading ob->derivedDeform
during modifier stack evaluation. Due to the mesh -> DM conversion this was no
longer set leading to wrong results.

In fact we don't really need the deformed mesh, just the original mesh topology
for face/poly index remapping. So the solution is to use that instead.
2018-05-25 23:20:20 +02:00
4dee702332 Add number and memory size formatting throughout the UI
This commit adds number formatting (thousands separator) to the baking panel. It also adds a new function to format memory sizes (KB/GB/etc) and applies it to the baking panel and scene stats. The new function is unit tested.

Reviewers: Severin
Tags: #user_interface
Differential Revision: https://developer.blender.org/D1248
2018-05-25 22:41:49 +02:00
Dalai Felinto
768706c6a5 Fix eevee render settings not working
This was no longer working since 15c2801aac.
2018-05-25 19:51:18 +02:00
a3a069f493 Tool System: cursor tool now transforms on drag 2018-05-25 19:43:23 +02:00
9dca74f0e5 [windows/make.bat] use a more reliable way of locating visual studio 2017.
The registry hack we were using wasn't very reliable, the recommended way to locating visual studio is using vswhere (15.2 and up), using it also allows to switch between the regular and pre-release versions.
2018-05-25 10:24:01 -06:00
562cf573d3 Multi-Object-Mode: EditMesh UV snap to cursor
D3422 by @Al
2018-05-25 17:28:37 +02:00
1bf2a7709f Timeline: Move Keying settings from sidebar to header as popover
Having them on the sidebar means we have to expand the editor every time.
2018-05-25 17:02:56 +02:00
8a73ea7af2 Use menu back theme colors for popover 2018-05-25 17:02:56 +02:00
988a14aa14 COW Fix: Transforming animated objects would jump when starting transforms
Just as with my earlier fix for bones (0492e56fec),
here we're reading evaluated object values into the "i" versions of each transform
property, and using the original/non-evaluated data for the pointers.

XXX:
What's not clear though is what we should be doing with the "BKE_object_where_is_calc()"
calls here. They currently use ob, but that probably shouldn't happen... and ob_eval
should in theory have a more up-to-date version of what it would need to evaluate!
2018-05-25 16:36:04 +02:00
51926de7f0 UI: popover now only centers on active button once 2018-05-25 16:31:52 +02:00
c0f9f69c7e Fix T55200: dragging object into hidden collection does not hide it. 2018-05-25 16:08:59 +02:00
5901c1ca42 UI: fix event handling direction
Correct arrow key direction in popovers,
also de-duplicate menu callback,
2018-05-25 15:47:12 +02:00
dd22080b9a Fix: X-Axis Mirror option was missing from the Pose Options popover
Although it's mostly a rigging option, sometimes it's useful to have it when posing.
2018-05-25 15:34:25 +02:00
572a9619b9 Remove DerivedMesh: paint_utils.c; Cow-ify PAINT_OT_sample_color
DM was only using it for color sampling in the 3Dview. Now it's properly
using COW evaluated versions of object and mesh instead.
2018-05-25 15:24:30 +02:00
40638e1970 Fix T55062: crash with workspace scene relations.
List of relations was saved with wrong struct type.
2018-05-25 15:06:40 +02:00
657fedbbee Style: use extra space for aligning parameters in a function. 2018-05-25 10:03:25 -03:00
8510472198 Cleanup: Change remaining BKE_scene_frame_get() in constraint.c to use DEG_get_ctime() 2018-05-25 14:49:11 +02:00
14b51b3974 Fix T55197: Dopesheet filtering settings were not triggering refresh anymore due to messagebus crap 2018-05-25 14:43:48 +02:00
Julian Eisel
dc26ef081b Fix T55198: Preferences Keybindings Crash
Operator sanitize function would be called for non operator props. Mistake from
88eafe078a.
2018-05-25 14:04:48 +02:00
45e7d609ce Fix outliner showing objects in collections instances.
It didn't do this before for groups, and while it could be useful this leads
to terrible performance when there are many instances.
2018-05-25 13:48:29 +02:00
2cc53227ab Outliner: optimize lookup of unused tree elements. 2018-05-25 13:48:29 +02:00
b11a1d5da2 UI: support for a popup panel which stays open 2018-05-25 12:55:22 +02:00
e9908134e8 UI: Move UI_paneltype_draw into layout code
No functional changes, needed for persistent popovers.
2018-05-25 12:55:22 +02:00
Dalai Felinto
fbc65c6b28 Fix T55165: Driving camera lens with property behaves unexpectedly
Differential Revision: https://developer.blender.org/D3438
2018-05-25 12:48:33 +02:00
8a78a53e3b Keymap: place cursor on press
Needed for tablet users.
2018-05-25 12:46:52 +02:00
d8a6c1d316 Cleanup/simplification for BKE_modifier_get_evaluated_mesh_from_object
* Added BKE_object_get_evaluated_mesh, which can also be used outside of
Modifier context.
* BKE_modifier_get_evaluated_mesh_from_object is now a dummy wrapper
around BKE_object_get_evaluated_mesh, we do not need anything special
anymore for RENDER quality option, since this is supposed to be handled
at depsgraph level... Maybe we can get rid of it at some point, but kind
of like the idea of keeping it for now, sounds more consitent.
2018-05-25 12:27:54 +02:00
ba6abd83b0 Cleanup: do not make functions for the pleasure of having functions... 2018-05-25 11:39:02 +02:00
f243390bd6 Cleanup: minor details in BKE paint code related to palettes.
* Always use BKE_id_new, unless you have a very good reason to use
lower-level code!
* Prefer to pass actual ID user pointer to functions like id_us_plus & co,
rather than 'floating' ID pointer, when possible. It makes it more clear
who is the user we increase count for!
2018-05-25 11:32:47 +02:00
03a80facfc Fix T55183, fix T55174: crashes with workspace / view layer relation.
Don't store pointers to ViewLayer in the workspace, only names. Add specific
relation type since the generic mechanism makes the code hard to follow.
Integrate with pointer restore for undo and library remapping code to avoid
data going out of sync.

Also add relation automatically if there doesn't exists one yet in
BKE_workspace_view_layer_get, because in general it's really hard to ensure
it will exist when making arbitrary scene changes.

Differential Revision: https://developer.blender.org/D3432
2018-05-25 11:16:58 +02:00
08da2826e0 Merge branch 'master' into blender2.8 2018-05-25 10:52:53 +02:00
9812943931 WM: check modal handlers for keymap lookups
Keep in sync with 2.8x
2018-05-25 10:51:05 +02:00
e31b8303ed UI: fix assert
Replace hard-coded button size check with UI_UNIT_X.

Caused icon-only buttons to have strings assigned based on UI-scale.
2018-05-25 10:45:48 +02:00
230943be2d Fix 3D Cursor w/ interface scale 2018-05-25 10:07:28 +02:00
ef22d2e8ad Merge branch 'master' into blender2.8 2018-05-25 10:04:25 +02:00
d02335a195 3D View: add pixelsize function w/o UI scale 2018-05-25 10:00:51 +02:00
2a6e4f7157 Cleanup: style 2018-05-25 09:45:04 +02:00
a79252d8c7 Keymap: use Ctrl-Shift-Space for fullscreen area
Closer to Shift-Space, less awkward to access.
2018-05-25 09:20:37 +02:00
f04cadd83e UI: Move Split into Mesh Menu
This doesn't just apply to faces.
2018-05-25 08:31:26 +02:00
bc9b202e65 Fix split only checking selected faces 2018-05-25 08:31:26 +02:00
51b2622814 UI: move copy/paste into the object menu
We already have per mode copy/paste in mode specific menus.
2018-05-25 08:20:19 +02:00
b611cecf4e UI: Specials menu update
- Name "Context Menu".
- Make it more context sensitive.
- Remove some more obscure items.

Patch from @billreynish
2018-05-25 08:20:19 +02:00
1be4eba27b Fix crash when entering the curve edit mode. 2018-05-24 19:22:35 -03:00
a0dbaf1d9d ED_transform_snap_object: remove unused bmain parameter in context creation. 2018-05-24 19:09:01 -03:00
302fea6b61 Change defaults
- Vertex/Edge Slide: Correct UV's = ON
- Extrude Along Normals: Even Thickness = ON
- Laplacian Smooth: Lambda Factor = 1.0
- UV/Image Editor: Normalized Coordinates = ON
- Render Image: Dithering = 1
- Image Sequence Auto Refresh = ON

See T54943
2018-05-24 21:33:39 +02:00
5e1021f78f 3D View: remove temporary edge-select hack
This caused a glitch with COW, where forcing edge selection
caused the evaluated scene to enable this afterwards.

Now pass the selection mode as an argument to the draw function.
2018-05-24 20:38:17 +02:00
c72b576aab Fix crash with snap and project to self.
Apparently the original `edit_btmesh` is being freed and the new one has to be referenced
2018-05-24 15:35:20 -03:00
357199375b Correct own last commit 2018-05-24 19:36:38 +02:00
5a431be629 Multi-Object-Editing: MESH_OT_shortest_path_select
Note from revisor: Edit the error message to match the original one.

Maniphest Tasks: T54643
Differential Revision: https://developer.blender.org/D3351
2018-05-24 19:34:22 +02:00
d209fa6e35 Fix T55184: Edge-loop select fails w/ vert/face modes 2018-05-24 19:31:07 +02:00
0983d97ab9 Fix T55186: Circle and Lasso select were not working on Pose Bones
These needed to be using the COW evaluated data, instead of the raw bone
positions.

All other datatypes still need converting to work with this though.
2018-05-24 19:13:15 +02:00
5e2f9c5c67 Cycles: Cleanup: Remove duplicated atan2f definition for OpenCL
Turns out that atan2f was already defined for OpenCL.
2018-05-24 19:08:06 +02:00
5db7f2c1ee Flatty Light
Add new Status Bar settings and minor tweaks to axis colors inspired by Andy's changes to the theme.
2018-05-24 18:50:02 +02:00
b4a8b81399 Cycles Denoising: Don't use atomics in the accumulation kernel on CPUs
The GPU kernel needs to use atomics for accumulation since all offsets are processed in
parallel, but on CPUs that's not the case, so we can disable them there for a considerable speedup.
2018-05-24 18:44:56 +02:00
b04b933acf UI: use icons in render menu 2018-05-24 18:43:16 +02:00
bef08e63d7 Keymap: remove Ctrl-Up/Down to toggle full-area
This is already accessible via Shift-Space which can be accessed
easily with one hand.
2018-05-24 18:39:05 +02:00
0864a4c1ea Always get a reference point when snapping with the projected elements option enabled. 2018-05-24 13:37:48 -03:00
8ea4539542 UI: View menu area operators now in submenu 2018-05-24 18:35:19 +02:00
f7c75e8bd7 COW Fix: Border selecting bones on rigs broke
Annoyingly, this was working as recently as yesterday...
2018-05-24 18:17:52 +02:00
12b261be41 UI: disable view context w/ OpenGL anim render
The 3D view menu can GL render from a single view
2018-05-24 18:16:06 +02:00
1cf17b257d UI: remove render panel, move operators to menu 2018-05-24 18:10:57 +02:00
132cda3925 Revert "UI: remove 'Render' top level menu"
This reverts commit 10e43c0aef.

After discussion, it's useful to have render menu
for more obscure render options.
2018-05-24 18:10:57 +02:00
7a88a7742b Drivers UI (Part of T55145) - WIP first steps towards getting a floating driver settings panel
This commit adds a new menu entry - "Edit Driver" - the RMB menu that
will show a popover panel displaying the settings for the driver you
activated the menu item on. This shows the popover panel defined in
yesterday's commit (GRAPH_PT_drivers_popover).

It is possible to edit the driver settings from this panel now.
However, do be warned that the functionality presented is highly
WIP still. There are some unresolved issues, such as:
 - The popover disappears too easily on any mouse movements/clicks
   on anything, making the panel less useful right now than it should.

 - The layout still needs refining. Currently the layout that's there
   is a bit of a placeholder until we can play around with it a bit
   more to see/feel what feels good/right or what is too much.

 - The "Open Drivers Editor" on the bottom of the panel doesn't work.
   There are some tricky context tricky things that need to happen here
   to make that case work, since the operator button won't have the necessary
   context info.
2018-05-24 18:10:21 +02:00
b2ee8e1cba Fix typo in editmesh edge delete 2018-05-24 17:49:44 +02:00
72f4bdf604 UI: add top-level 'Edit' menu
Use this for undo/redo, copy/paste & preferences.
2018-05-24 16:48:28 +02:00
6862762685 Cycles/Compositor: Add arctan2 operation to the Math node
The Math node currently has the normal atan() function, but for
actual angles this is fairly useless without additional nodes to handle the signs.

Since the node has two inputs anyways, it only makes sense to add an arctan2 option.

Reviewers: sergey, brecht

Differential Revision: https://developer.blender.org/D3430
2018-05-24 16:46:02 +02:00
d638ad3b20 Merge branch 'master' into blender2.8 2018-05-24 16:44:26 +02:00
5505ba8d47 Cycles/Eevee: Implement disk and ellipse shapes for area lamps
The implementation is pretty straightforward.

In Cycles, sampling the shapes is currently done w.r.t. area instead of solid angle.

There is a paper on solid angle sampling for disks [1], but the described algorithm is based on
simply sampling the enclosing square and rejecting samples outside of the disk, which is not exactly
great for Cycles' RNG (we'd need to setup a LCG for the repeated sampling) and for GPU divergence.

Even worse, the algorithm is only defined for disks. For ellipses, the basic idea still works, but a
way to analytically calculate the solid angle is required. This is technically possible [2], but the
calculation is extremely complex and still requires a lookup table for the Heuman Lambda function.

Therefore, I've decided to not implement that for now, we could still look into it later on.

In Eevee, the code uses the existing ltc_evaluate_disk to implement the lighting calculations.

[1]: "Solid Angle Sampling of Disk and Cylinder Lights"
[2]: "Analytical solution for the solid angle subtended at any point by an ellipse via a point source radiation vector potential"

Reviewers: sergey, brecht, fclem

Differential Revision: https://developer.blender.org/D3171
2018-05-24 16:43:47 +02:00
Dalai Felinto
e8c8ff4f86 Fix all modifiers that depended on BKE_modifier_get_evaluated_mesh_from_object
This fix applying the following modifiers:
* Boolean (working already)
* Array
* Mesh Deform
* Surface Deform
* Vertex Weight Proximity

This function was to return evaluated mesh. So it should get the evaluated
object at all times. So in this case it makes more sense to simply pass the
depsgraph (or in this case the ModifierEvalContext that contains both the
depsgraph and the flag.

Solution discussed with Bastien Montagne.
2018-05-24 16:43:21 +02:00
8d9faf840b 3D View: remove poll 3D view for copy/paste
These operators only need selected objects.
2018-05-24 16:40:33 +02:00
10e43c0aef UI: remove 'Render' top level menu
- Toggle render window is in the window menu.
- OpenGL render settings in the 3D View menu.
- Playback animation in the render panel.
2018-05-24 16:20:56 +02:00
58fadb379a Correct last commit 2018-05-24 16:09:20 +02:00
ad9278fdad UI: re-arrange 3D view menus
- Adjusted order and names for better consistency.
- Group add/edit/delete into menu sections.
- Move UV/Vertex color into 'Face Data' menu, matching 'Edge Data'.
- De-duplicate items between vertex/edge/face menu.
- Remove undo/redo menu (to be moved into 'Edit' menu).
- Remove Auto-Merge & Proportional Editing
  (already available from the 3D view).

Patch from @billreynish w/ edits
2018-05-24 16:00:11 +02:00
Dalai Felinto
ec809d0cbf Fix boolean modifier when objects have transformations
Follow up for 9406a1f195.
2018-05-24 15:56:50 +02:00
44bab06960 Fix: Name of selected object/bone + current frame in 3D view didn't take region overlap (for headers-on-bottom) into account 2018-05-24 15:43:46 +02:00
Dalai Felinto
9406a1f195 Fix cannot apply boolean modifier 2018-05-24 15:26:31 +02:00
d64fbe9456 Partial Fix for T55165: Camera manipulator was not updating when the focal length ("lens") parameter was changed directly 2018-05-24 15:26:19 +02:00
0d768cca65 Fix T55177: pose-mode manipulator placement w/ COW 2018-05-24 15:22:15 +02:00
40dfb3eed6 Oops... should rebuild before committing 2018-05-24 15:10:12 +02:00
72039cd7cc Multi Pose: Selecting a bone in one armature doesn't deselect bones in the other armatures
This was actually due to missing COW flushing of pose data on the "other"
objects (only the active object was getting tagged for updates).
2018-05-24 15:05:17 +02:00
c788bd0211 Fix: Several pose select operators were not in fact working with COW
The following operators are fixed in this commit
* POSE_OT_select_linked
* POSE_OT_select_grouped
* POSE_OT_select_mirror
2018-05-24 15:05:17 +02:00
fe820eba92 Cleanup: Some minor tweaks to code 2018-05-24 15:05:17 +02:00
dfb959b6c3 Fix missing ID pointers expansion for ID itself in readfile code.
Was breaking static override chaining (static override of a linked
datablock that is already a static override in it original lib file).

Dummy mistake, thanks to @dfelinto for finding the bug.
2018-05-24 14:56:39 +02:00
b4106ed170 Fix T55175: outliner "Show Active" not working. 2018-05-24 14:48:23 +02:00
39aea50155 Fix T55178: Cursor fails to restore on cancel
574c0fe38f caused complications
restoring the cursor.

Use WM_cursor_modal_set/restore which is intended for operator use,
calling ED_region_cursor_set after an operator runs isn't reliable.
2018-05-24 14:23:32 +02:00
Dalai Felinto
c1361d2651 Depsgraph: tag depsgraph for copy-on-write flush when RNA changes
Fixes bug with changes to properties not being flushed to the COW data.
It fixes T55144.

This is the part of rBb4b745b72064 that is required although slow.
Which was partially addressed but the rest of the commit, which in
turn broke things. So for now let's get RNA to flush slow cow, and
deal with the consequences.
2018-05-24 12:17:55 +02:00
cb3c9cba49 Fix T55171: crash with undo and linked collections.
Collections created in library file versioning need to be set as coming
from the library, otherwise they get freed on undo.
2018-05-24 12:02:56 +02:00
8766ab7526 Fix Lamps, Empties, Cameras and Speakers not using theme colors 2018-05-24 12:01:25 +02:00
b2a2983d14 Slightly smaller triangle collapse icon on panels 2018-05-24 11:23:00 +02:00
70a3b7e70c Fix T55170 and T55167: Crash adding new curve
We do the same solution as we have for mesh_evaluated.
2018-05-24 10:38:39 +02:00
Julian Eisel
2d05f91bea UI: Add theming support for the status-bar
For now not bumping subversion, even though I technically should. We can do if
needed, but would like to avoid bumping it every few days...
2018-05-24 10:26:22 +02:00
3820237ddb Workbench: in editmode the toggle xray option will be disabled
Z-Key was already taken by show hidden wires
2018-05-24 10:23:03 +02:00
7762522ecd Workbench: define to enable/disable revealage buffer. 2018-05-24 09:28:29 +02:00
e561eef3ff Workbench: Revealage buffer 2018-05-24 09:28:29 +02:00
a709e8d6bb Correct last commit 2018-05-24 09:27:13 +02:00
5df8a6eb94 Correct fix for view center
The view layers active object was not being copied.
2018-05-24 09:08:36 +02:00
153c7746ab Revert "Fix COW view center for pose mode"
This reverts commit 485990e4aa.
2018-05-24 09:08:36 +02:00
d7824de8e4 Merge branch 'master' into blender2.8 2018-05-24 09:03:07 +02:00
1318660b04 Fix T55034: Setting duplication group for multiple selected items only
affects one item

UI editing multiple selected items missed the case of PROP_POINTER
properties

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D3373
2018-05-24 09:02:17 +02:00
569a5e0d7c Merge branch 'master' into blender2.8 2018-05-24 08:48:40 +02:00
3e9b592b08 Fix Extend property of Lasso select tool in Mask editor not working
Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D3361
2018-05-24 08:41:13 +02:00
54f2e58452 Fix T54336: Extend property of Lasso select tool in Node editor does not
work

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D3360
2018-05-24 08:34:31 +02:00
5ee965eea5 Merge branch 'master' into blender2.8 2018-05-24 08:27:01 +02:00
d78894eb3e Fix T54336: Extend property of Lasso select tool in Node editor does not
work
2018-05-24 08:21:13 +02:00
176e18436c Fix T55137: Compilation failing on non-x86-64 architectures
Some conversion helper functions were (most likely by accident) contained
inside an ifdef for SSE2 support, so on e.g. ARM they would be undefined
and therefore cause compilation to fail.
2018-05-24 01:41:18 +02:00
Julian Eisel
6f20fcd598 UI: Global "Status-bar" Area (WIP)
* Add horizontal bar at bottom of all non-temp windows, similar to the Top-bar.
* Status-bar is hidden in UI-less fullscreen mode
* Current contents are preliminary and based on T54861:
** Left: Current file-path if needed. "(Modified)" note if file was changed.
** Center: Scene statistics (like in 2.7 Info Editor).
** Right: Progress-bars and reports
* Internally managed as own "STATUSBAR" editor-type (hidden in UI).
* Like with the Top-bar, Status-bar data and SDNA writing is disabled.
* Most changes in low-level screen/area code are to support layout bounds that differ from window bounds.

Design task: T54861
Main changes approved by @brecht.
2018-05-23 22:38:25 +02:00
7b58073dc0 Fix INFO_MT_surface_add
It was a copy of `INFO_MT_curve_add` (I'm sure it was not intentional).
2018-05-23 17:27:10 -03:00
67598d39b4 Revert "Depsgraph: refresh RNA that doesn't need a full rebuild"
This reverts commit b4b745b720.

This was causing a problem in 01_025_A.anim.blend from the Spring
production files, where selecting one of Autumn's bones would
result in character jumping back to the origin.
2018-05-23 20:30:17 +02:00
6955add502 Fix T55166: crash joining areas
Caused by own commit 6e40b2de7a,

Tested w/o this call and can't find any errors so commenting the call.
2018-05-23 20:25:55 +02:00
Dalai Felinto
401e975c61 Fix curve not updating when scaling Bevel Object
Note the relationship we need is from the geometry/object to the curve data,
not the curve object.

Related to T55167, though when copy-on-write is enabled, we still get a crash.
2018-05-23 20:05:17 +02:00
933a083587 UI: popup panel operator, as we have for menus 2018-05-23 19:48:28 +02:00
b642b510e1 Fix T55168: missing updates when switching particle system type. 2018-05-23 18:59:26 +02:00
b6725d3cbf Fix wrong object user count on duplicate. 2018-05-23 18:53:37 +02:00
e2a827c848 Fix crash loading without UI, after recent changes. 2018-05-23 18:32:04 +02:00
3fb38d664b Fix T55163: visibility not updated for instanced collections. 2018-05-23 18:32:04 +02:00
342d94c375 Fix compiler error: Stupid const vs non const 2018-05-23 18:29:52 +02:00
7e7680e33b Drivers UI (Part of T55145) - WIP work to prepare a panel we can shove into a popover
HINT: It's called GRAPH_PT_drivers_popover right now
2018-05-23 18:18:58 +02:00
84c3b175f6 Fix typo in header 2018-05-23 17:13:41 +02:00
485990e4aa Fix COW view center for pose mode 2018-05-23 16:45:07 +02:00
0cc2666605 Fix last usages of Scene.r.cfra in modifiers code.
Note that some modifiers-related code in BKE still uses that...
2018-05-23 16:37:36 +02:00
9cb2b9b523 Drivers UI (Part of T55145) - Show datablock that driven property belongs to instead of only the property
Otherwise, it's not clear where things are coming from.

FIXME: The icons for datablocks may not always be correct. It uses the
innermost struct's icon instead of the datablock's icon - e.g. Bone
vs Object/Armature. But, that may make more sense for users?
2018-05-23 16:32:46 +02:00
d185f5be09 Drivers UI (Part of T55145) - Refactor existing UI code to allow it to be reused
The idea is that we may be able to just take this code and put it into a
new popover panel that gets displayed when called from the UI. This should
at least work well for a first pass test of what we want this UI to look like.
2018-05-23 16:32:46 +02:00
d1e8d8f40f Drivers UI: Add the "Update Dependencies" logic into the callbacks that should be run on every button press
In theory, this should mean that we can get rid of the "Update Dependencies"
button. In practice, there may still be cases where it's still needed
(as somehow, it did end up being needed in the past, even though the RNA
calls should in theory be doing everything needed already).
2018-05-23 16:32:46 +02:00
a3ad55b346 Drivers UI: Get rid of dedicated button to remove active driver
There are multiple other ways to do it. Leaving this here just made it
easy (and dangerous) to accidentally remove the driver, and was causing
other problems with other layouts.
2018-05-23 16:32:46 +02:00
57b47ebb28 Drivers UI Cleanup (Part of T55145)
* Remove "Show Debug Info" option. Everyone has it turned on all the time,
  since it's just useful to have
* Make the "Remove Driver" button less prominent. It doesn't happen that much,
  so it shouldn't take up as much room
* Make "expressions" textbox wider (i.e. taking up the whole column width)
  by separating the label and textbox on separate lines.
* Rename "Add Variable" button to make it clearer to users what "variables"
  may be (i.e. they serve as a way to specify Inputs, just like adding a
  "Source Data" node in a nodetree)
* Regroup buttons
2018-05-23 16:32:46 +02:00
83ed0df1c2 Cleanup: Remove unused code 2018-05-23 16:32:46 +02:00
Dalai Felinto
ccabb26082 OpenGL: documentation for the builtin GPU shaders
This is intended to help developers to know how and when to use each shader.
There are plenty of undocumented shaders, but it's a matter of filling them in.

The script I used to quickly find the related shaders for a const is: P700

Original patch: D2318
2018-05-23 16:02:53 +02:00
4a2213dc9a Fix modifiers not using depsgraph time for texture evaluation.
Texture animation seems to be broken anyway currently, but at leat
modifier side it should now be OK.
2018-05-23 15:55:13 +02:00
a455e35343 UI: move vertex/edge/face into header
These are frequently accessed,
so use the newly freed space to make them more prominent.
2018-05-23 15:41:04 +02:00
Dalai Felinto
1ecfe42d37 Remove DEG_TAG_COPY_ON_WRITE tag on rna update for scene.render
This is no longer needed since rBb4b745b72064.
2018-05-23 15:34:48 +02:00
b4b745b720 Depsgraph: refresh RNA that doesn't need a full rebuild
Fixes bug with changes to properties not being flushed to the COW data.
2018-05-23 15:26:50 +02:00
6afccf6348 Workbench: Checkboard pattern for supporting objects 2018-05-23 15:22:51 +02:00
1c572b7412 Fix T55161: outliner Blender File with filter showing irrelevant libraries. 2018-05-23 14:43:24 +02:00
c44ccbc518 Cleanup: fix some weak assumptions in bone renaming code. 2018-05-23 14:23:29 +02:00
e71b12048c WM: add back Ctrl-Space to toggle full area 2018-05-23 14:11:39 +02:00
b4b569feeb Cleanup: rename idname -> name
This isn't for ID's
2018-05-23 14:11:39 +02:00
c0ac479134 Cleanup: shadow variable warning 2018-05-23 14:11:39 +02:00
7c5e174871 Fix T55160: crash renaming view layer. 2018-05-23 13:52:51 +02:00
37b947c7ef Cleanup: remove debug print. 2018-05-23 13:30:36 +02:00
07dee0f79c Fix missing autosmooth in Cycles after copy-on-write changes. 2018-05-23 13:25:06 +02:00
b20449cc08 Cycles/Render API: changes for better copy-on-write support.
Mainly just passing the depsgraph and evaluated scene and camera, instead of
the original one. Patch by Sergey, further modifications by Brecht.
2018-05-23 13:21:02 +02:00
d59b74adb3 Fix T53481: Linked scene crashes on load 2018-05-23 12:51:48 +02:00
858e8f453d Workbench: When in see through mode, only render depth of active object
in EDIT MODE
2018-05-23 12:30:42 +02:00
Julian Eisel
909d548d56 Fix T55072: Top bar disappears when loading factory settings (causing ASAN crash) 2018-05-23 12:06:38 +02:00
5667822876 Cycles: convert pointdensity from DerivedMesh to COW Mesh.
Fixes hang in regression tests.
2018-05-23 11:28:26 +02:00
8dc564096f Workbench: Renamed Object Outline to Outline.
So it fits in the pop-over
2018-05-23 10:57:50 +02:00
8d92873230 Workbench: See through
Unmultiplied the final color during compositing. Same as the revealage
buffer would do
Also use the DRW_STATE_ADDITION_FULL as it is aware of premultiplied
colors
2018-05-23 10:54:22 +02:00
e92baab348 Merge branch 'master' into blender2.8 2018-05-23 10:51:11 +02:00
d886e32270 Cleanup: strip trailing space from interface files 2018-05-23 10:48:50 +02:00
37b5c52f11 Workspace: remove deprecated view layer
Was removed in 2.80.4, this was not default and unsupported for linking.
2018-05-23 09:37:33 +02:00
8ac8ef8ec7 Workbench: Studiolights merge error? 2018-05-23 08:55:14 +02:00
44f78c95be Cleanup: move toolsystem into own include
Many files using the window manager don't access the tool-system.

This avoids rebuilding many files when the tool-system changes.
2018-05-23 08:23:16 +02:00
f5f66d4901 Workbench: Fixed Memory Leak 2018-05-23 08:20:25 +02:00
17aef80207 Multi-Object-Mode: EditCurve Subdivide
D3382 by @dgriffin91
2018-05-23 07:41:58 +02:00
647232f7f1 Multi-Object-Mode: EditCurve Select Linked
D3409 by @dgriffin91
2018-05-23 07:34:10 +02:00
504cbc1954 Merge branch 'master' into blender2.8 2018-05-23 07:30:50 +02:00
103a31f712 Fix incorrect size in aligned lockfree realloc
Thanks to @alikendarfen for finding.
2018-05-23 07:24:57 +02:00
062ee07b7f Fix some Cycles modifier stack issues with copy-on-write.
There's still many problems, but this avoids modifiers being applied twice,
subsurf render levels not being respected and hair render crashing.
2018-05-22 20:01:15 +02:00
78a26f28aa Fix own error using handler after freeing
Was introduced in e7895bac07
Only certain actions caused this, reported as T55155
2018-05-22 19:35:48 +02:00
e6c27b4dab Fix T55071: Brush preview fails 2018-05-22 19:23:06 +02:00
8aebcf8b7d Fix crash in modifier stack after recent changes. 2018-05-22 19:10:30 +02:00
2fb9a50a4f Fix T55146: hair + subsurf modifier not positioning hair correctly.
ORIGSPACE data was not being preserved correctly through subsurf.
2018-05-22 18:43:20 +02:00
c080c096ce Fix crash when HDR images are missing 2018-05-22 18:36:36 +02:00
6e8d4bcd01 Fix T55153: missing updates when changing simplify settings.
This line should not have been removed.
2018-05-22 18:17:28 +02:00
3ada840e65 blenderplayer: add stubs 2018-05-22 17:56:56 +02:00
3c44c67e96 Removed no-longer-required workaround for doubly-deformed meshes 2018-05-22 17:38:27 +02:00
66d18d93c4 Merge branch 'master' into blender2.8 2018-05-22 17:24:32 +02:00
76ece90d4a Fix T55093: Bisect + fill crash 2018-05-22 17:23:25 +02:00
f5d911f8b0 Modifiers: ported Cloth DerivedMesh → Mesh
The modifier is still quite slow; this could be due to caches being written
to a CoW datablock instead of the original one. More investigation is
needed.
2018-05-22 17:11:30 +02:00
e89fa4c85b Cloth Modifier: get time from depsgraph instead of scene 2018-05-22 17:08:57 +02:00
6953c57d2c Fix T55149: missing mesh custom data after modifier stack, after recent changes. 2018-05-22 17:07:59 +02:00
1b164cf81e Workbench: SeeThrough
added a fresnel effect

TODO: solve memory leak
2018-05-22 16:59:43 +02:00
8644eef5c3 COw operators: Fix VIEW3D_OT_snap_selected_to_grid 2018-05-22 16:44:34 +02:00
397665dea3 Fix: Deselecting bones using box select didn't work
Logic here was a bit broken.
1) We need to send updates even when deselecting bones, not only when we
   actually end up select then.
2) Also, when bones are locked for "selectability", they should not be able
   to be deselected.
2018-05-22 16:44:13 +02:00
6573af5211 Drivers Editor UI Tweaks (Part of T55145)
To bring the UI more in line with the proposed design in T54653 for the "Add Drivers"
popup panel (NOTE: this is separate from the "Drivers Editor", in previous commit!),
this commit adds a new panel - "Driven Property" to the Drivers Editor UI.

This basically duplicates the "Active F-Curve" panel (with less options)
to make it easier to see at a glance which property the Drivers Editor is
showing you.
2018-05-22 16:44:13 +02:00
c685c19df9 Drivers UI (Part of T55145): Add "Show Drivers Editor" entry to RMB menus
This commit adds an operator, "Show Drivers Editor", to the RMB menu when
clicking on properties.

As per T54653, this will open a new Graph Editor instance in a new/separate
window (much like how the User Preferences show up in a popup window now),
and will configure all the relevant panels so that you can see and edit the
driver settings immediately without doing a lot of the view configuration steps
that were previously needed.

When doing so on a property that is driven, the driver/fcurve for that property
will be made active in the editor, ready for you to start editing its settings
without having to hunt it down again first.
2018-05-22 16:44:13 +02:00
6f127b22e6 UI Tweak: Make User Preferences window slightly taller, to better fit the contents 2018-05-22 16:44:13 +02:00
6781fac42e Cleanup: warning 2018-05-22 16:12:41 +02:00
ab19609233 Fix T55069: 3D widget misses pivot-point refresh 2018-05-22 16:11:39 +02:00
53d1ec95ea Fix outliner incomplete collections right click menu in Blender File. 2018-05-22 15:49:50 +02:00
96a7ed8a15 Tool System: store operator properties in the tool
This replaces last-used property use which wasn't reliable since
properties were not considered 'set' - causing them to be ignored.
2018-05-22 15:31:06 +02:00
298f8042ef Cleanup: warning 2018-05-22 15:31:06 +02:00
cc9513d944 Fix outliner crashes when dragging elements in some cases.
Avoid rebuilding outliner tree in more cases, also helps performance.
2018-05-22 15:09:21 +02:00
d97471ddf7 Workbench: Fixed memory leak
ImBuf radiance buffers were freed incorrectly
2018-05-22 15:05:11 +02:00
dfe088c5d9 Workbench: SeeThrough draw option
Option to see through all meshes (transparency)

Works for OB_SOLID and OB_TEXTURED. Does not work for
V3D_SHADING_SHADOW.

TODO: Fresnel effect
2018-05-22 14:55:50 +02:00
ff19b527e8 Workbench: Calculate irradiance using radiance buffers 2018-05-22 14:55:50 +02:00
c7df618263 3D Cursor: Clip if behind near plane. 2018-05-22 14:33:07 +02:00
bc46034752 Cleanup: fix compiler warnings. 2018-05-22 14:17:52 +02:00
0d2aa1a7bb Cleanup: make group/collection versioning a bit more clear. 2018-05-22 14:17:51 +02:00
f99197fb2d Transform: Support mixed snap in 3d View.
Allows more than one snap mode to be enabled. So different combinations are possible.

Reviewers: campbellbarton

Reviewed By: campbellbarton

Subscribers: Christopher_Anderssarian, duarteframos

Tags: #bf_blender_2.8

Differential Revision: D3400
2018-05-22 08:58:56 -03:00
47b9d7494e Experimental Armature Drawing Tweak for Relationship Lines
Only show hierarchy relationship lines when bone or its parent is selected.
This cuts down the clutter visible in general when relationship lines are
enabled (currently they can't be disabled), which should make it more useful
to keep them on (e.g. constraint lines/hints can still be drawn this way).
2018-05-22 13:39:01 +02:00
e12df10120 COW Operators: Fix VIEW3D_OT_snap_cursor_to _active _selected _center and _grid
Reviewers: sergey, aligorith

Differential Revision: https://developer.blender.org/D3414
2018-05-22 12:20:59 +02:00
7f714fdbb2 Depsgraph: Enable copy on write by default
As was decided at today's dev kickoff, we're now moving to having
Copy-on-Write enabled by default, as 2.8 is barely functional with
it off.

To run Blender *without* COW (e.g. for testing), use:
--disable-copy-on-write
2018-05-22 12:00:23 +02:00
9fc5a0c95e Fix area tool getting out of sync w/ active tool 2018-05-22 09:41:41 +02:00
0c1676f388 WM: call keymap callback from manipulators
Not currently needed, add to avoid confusion later on.
2018-05-22 09:27:02 +02:00
6974afba82 WM: use keymap poll for manipulators 2018-05-22 09:22:20 +02:00
bb45381bc2 Merge branch 'master' into blender2.8 2018-05-22 08:49:24 +02:00
28c20fc393 Memory allocator: use lockfree calls internally
Was already used in some areas.
2018-05-22 08:45:47 +02:00
4e14437cb0 Multi-Object-Mode: EditCurve Select Random
D3405 by @dgriffin91
2018-05-22 08:25:05 +02:00
c7903f17a2 Fix memory leak in armature delete 2018-05-22 08:20:19 +02:00
ee1327a84c Multi-Object-Mode: EditLattice Select All
D3164 by @ranjian0
2018-05-22 08:11:13 +02:00
99f994e7ed Fix crash drawing edit-lattice
Edit-mode was never using batch cache.
2018-05-22 08:10:36 +02:00
17778ddeb7 Cleanup: naming
Use 'ob' prefix for objects, 'eval' suffix for evaluated data.
2018-05-22 07:48:12 +02:00
ac476375b1 Cleanup: style, whitespace 2018-05-22 07:39:16 +02:00
67cf4cb5ec Cleanup: replace MEM_SAFE_FREE -> MEM_freeN
No need to check for NULL in this case.
2018-05-22 07:28:14 +02:00
feabab6a9e Fix compilation with ndof code. 2018-05-21 21:18:12 +02:00
612364181a Static Override: Fix drivers' ID target overridability.
You need the whole chain of pointers... This was breaking static
overrides of any rig basically.

Note that this kills performances again (adding several hundreds of
thousands more stuff on a blendrig...), need a better way to handle RNA
override walking.
2018-05-21 21:14:54 +02:00
161ab6109e COW Operators: Fix VIEW3D_OT_ rotate move zoom dolly orbit roll pan smoothview and the ndof versions
Fixes camera view locking, camera related transitions and movements with the active object as pivot point
Note there can still be problems if the active object is not selectable
2018-05-21 20:33:12 +02:00
9f66d00287 CMake: only include licences for enabled libs 2018-05-21 18:41:59 +02:00
13d2df32c7 Fix broken draw code from last Thursday commit.
Seriously... Not all edges have faces!!!!!!!!

Quick fix to make it possible to load/use customshaped bones again, not
100% sure it is correct, but... At least it does not crash anymore!
2018-05-21 18:00:50 +02:00
f0fda91a55 Merge branch 'master' into blender2.8 2018-05-21 17:27:38 +02:00
20bafbd550 Cleanup: unused vars 2018-05-21 17:27:21 +02:00
605e184167 Cleanup: use const for transform internal API 2018-05-21 17:24:14 +02:00
08ba057eef Fix misuse of the use_occlusion_test parameter. 2018-05-21 11:17:19 -03:00
f14e4510ac Transform Snap: Fix normal in the wrong space. 2018-05-21 11:05:34 -03:00
575437ac90 3D View: fix scale of 3D cursor crosshair
Interface scale was applied twice.
2018-05-21 14:51:10 +02:00
fbe73d1f31 UI: fix error for tools w/o a keymap 2018-05-21 13:08:44 +02:00
3b1b625ead UI: use spacebar for toolbar
- This allows quick, consistent toolbar access
  w/o conflicting w/ the keymap.
  Where pressing space before a key activates that operator as a tool
  instead of running immediately.
- Search can still be accessed by pressing spacebar again.
- When there is no toolbar for a space, operator search still opens.
2018-05-21 12:46:26 +02:00
3102821c9c Revert "Fix/workaround RNA build error in C++ API."
This reverts commit 9f2ae547c0.

Args were reordered.
2018-05-21 12:38:52 +02:00
bdc3335016 Merge branch 'master' into blender2.8 2018-05-21 12:37:54 +02:00
882daeffc5 RNA: support for PARM_OUTPUT & PARM_RNAPTR 2018-05-21 12:34:11 +02:00
21777533fb Merge branch 'master' into blender2.8 2018-05-21 12:26:36 +02:00
6d8aa85051 Fix too much memory usage for Cycles attribute map.
Thanks to Thomas Krebs for identifying the problem and solution.
2018-05-21 11:14:59 +02:00
9f2ae547c0 Fix/workaround RNA build error in C++ API.
It seems output parameter needs to be the last one.
2018-05-21 11:13:56 +02:00
0e9605f44d Merge branch 'master' into blender2.8 2018-05-21 10:54:51 +02:00
4198c18f15 Cleanup: correct variable names 2018-05-21 10:53:50 +02:00
698dbd6500 UI: generate dynamic keymap for popup toolbar
Set keys for tools based on the current keymap.

This keeps consistency between tools immediate execution.
2018-05-21 10:46:27 +02:00
351c6d4346 Merge branch 'master' into blender2.8 2018-05-21 10:40:09 +02:00
12a60265cd WM: utility to find a keymap item from an operator
Also RNA access to WM_keyconfig_update,
needed when generating dynamic keymaps used in menus immediately after.
2018-05-21 10:35:44 +02:00
94fd828d75 Error in last commit 2018-05-21 08:22:08 +02:00
768a152883 UI: proof of concept keymap for the popup toolbar 2018-05-20 22:39:19 +02:00
e7895bac07 UI: support for custom keymaps for popovers 2018-05-20 22:39:14 +02:00
46514cf865 COW Operators: Fix VIEW3D_OT_view_all and camera mode of VIEW3D_OT_viewnumpad
Reviewers: sergey, aligorith

Maniphest Tasks: T54829

Differential Revision: https://developer.blender.org/D3314
2018-05-20 20:05:26 +02:00
8e0953eb49 COW Operators: Fix VIEW3D_OT_view_lock_to_active
Reviewers: aligorith, sergey

Maniphest Tasks: T54829

Differential Revision: https://developer.blender.org/D3365
2018-05-20 19:48:58 +02:00
d3def53be5 Workbench: Shadow: Add support for completly manifold geom.
If a mesh is known to be manifold, then it's not necessary to increment the
stencil buffer 2 times anymore. But we still need to account properly for
degenerate triangles.

In this case, only generate a quad if the tri is facing the lamp. If there
is a degenerate loop, the other edge will either cancel the increment (if
it is also facing the light) or not produce a quad (if not facing).

This will always give the correct count.
2018-05-20 19:17:11 +02:00
4bbb1d4e5e DRW: Rename some DRW_STATE_* for more consistency. 2018-05-20 19:17:11 +02:00
7a28dea1e1 Workbench: Shadow: Add Depth Fail method
Also add new debug visualisation.

Depth fail method is not used for the moment but has nice benefits. It will
be used efficiently in the future.
2018-05-20 19:14:22 +02:00
2c6106247b Workbench: Precompute light direction in object space.
Avoid 2 matrix multiplication in the shader.
2018-05-20 19:14:22 +02:00
ef90d46700 Workbench: Shadow: Add geometry instancing extension.
This give a very slight perf boost. (2ms gain over 67ms total in my test)
2018-05-20 19:14:22 +02:00
24cc976d55 Workbench: Shadows: Fix corner case with degenerate triangles.
Seems that degenerate tris are somewhat widely used in modeling. So we need
to fix this. Test the edges in the geom shader since the adjacency info is
only dependant on topology, not actual vertex placement.

This fixes most of the remaining noise issues. Only a few artifacts appear
on really weird models. So if you want to get rid of the artifacts, fix
your model!
2018-05-20 19:14:22 +02:00
687f09a8ad Workbench: Optimize Shadows.
This makes the shadows ~10 times faster in the general case.

This only create extrusion geometry on the outline edges. Also we increment
or decrement the stencil buffer by 2 for each manifold edge and only by 1
for non manifold. This make the algorithm robust yet less heavy than creating
one prism for each triangles.
2018-05-20 19:14:22 +02:00
883cb58355 GWN: Add Line Adjacency primitive support. 2018-05-20 19:14:22 +02:00
4308602d6a Fix: crash when rotating the view in pose mode 2018-05-20 17:44:50 +02:00
8cb6ede2bf UI: locate popover w/ active item under cursor
Use when popover has no parent, useful for accessing the toolbar.
2018-05-20 09:58:46 +02:00
7959617fb6 Cleanup: line length 2018-05-20 09:04:18 +02:00
12eb29fe35 Cleanup: whitespace, duplicate includes 2018-05-20 08:52:56 +02:00
96a3a62861 Hacky Fix: Changing frames by setting Scene.frame_current directly didn't update rigs in 3D viewport
Operators did not suffer from this problem as they were still just using notifiers
directly. The "proper" fix is to use the new message bus system. But, we've
got enough problems dealing with COW already as it is now... moving on.
2018-05-19 20:18:45 +02:00
0492e56fec Fix: When trying to transform animated bones, they would jump to and use random old values
The transform code needed to use data from the "_eval" copy of the posebone
instead of the main-db version, otherwise the initial/reset value would be
wrong, causing the jumping.
2018-05-19 19:54:47 +02:00
aca892832a Add back temporary exception for pose bones in DEG_get_evaluated_rna_pointer()
Without the exception, adding new poses to pose libraries took several seconds
with only <= 4 bones selected. While we may still need this for other cases too,
since bones are such a common use case, it makes sense to provide some level
of optimisation for them.
2018-05-19 19:54:47 +02:00
006b8e6092 Cleanup: Remove temporary debugging code 2018-05-19 19:54:47 +02:00
4a0dea88bf WIP: Improved implementation of DEG_get_evaluated_rna_pointer()
This now works by getting the RNA Path from the given PointerRNA to go from the
ID block to the data it points to, then uses this path to find the new data
relative to the COW ID.

Note: This currently still has all the debug prints left in - As can be seen,
I was testing this against the earlier PoseBone hack/special case. We may still
need to bring such special cases back in future, since looking up RNA Paths
like this can be slow.
2018-05-19 19:54:47 +02:00
6ba28ff8b1 WIP COW Fix: Insert keyframe operators/api now queries depsgraph for evaluated data
When using copy on write, insert keyframe operators were reading from old
bmain data instead of COW data. This meant that inserting keyframes would
often read old/stale data, resulting in invalid keyframes getting created
(e.g. from last transform operation, instead of actual current state).

This commit makes it so that keyframing operators will ask depsgraph for
the evaluated copy of the data, so that it can read values from that. It
introduces a new function - `DEG_get_evaluated_rna_pointer()`, which when
working correctly/fully, should work just like the other `DEG_get_evaluated_*()`
functions, except it lets you pass in an RNA Pointer.

However, currently, this is only done for Pose Bones (as a dirty hack, since this
is an important/pivotal requirement for production) and/or datablock
properties directly (since we can just use the DEG_get_evaluated_id() directly).
on the datablock.

Committing to a branch for now as this all needs more testing. More work to come
later at a more sane time of day!
2018-05-19 19:54:47 +02:00
06737a8258 UI: popover-once (click-drag for single actions)
Experimental support for using popovers like menus,
use this when the user hold the mouse down
(previously this did nothing).

This means turning frequently accessed menu items into
popovers doesn't add more clicks to the existing use case.
2018-05-19 19:16:47 +02:00
e65643b9a3 Cleanup: style
No need to use text keyword arg for labels
2018-05-19 16:25:40 +02:00
7cbf5db248 UI: don't disable snap popover in topbar
Snap settings still apply when transforming (holding Ctrl)

Also no need to prevent proportional edit menu from opening,
showing inactive is enough.
2018-05-19 16:23:54 +02:00
d3c89f50a0 UI: Use popover for toolbar popup operator
- Currently the popup closes immediately, could be made configurable.
- Support exiting popups when their submenu's are accessed.
2018-05-19 10:25:52 +02:00
671797e22e Correct last commit 2018-05-18 23:14:56 +02:00
ddebf1ea3b UI: Add menu to show the toolbar
For people who prefer to keep the toolbar hidden,
expose as a menu (currently Shift-Space).
2018-05-18 22:28:59 +02:00
e785048ef3 Fix snap with occlusion. 2018-05-18 17:26:22 -03:00
4df99bd601 Ruler: Fix mixed snap. 2018-05-18 17:12:20 -03:00
a0b03d3fb2 Tool System: use classmethod for drawing
Allows the toolbar to be included in a popup.
2018-05-18 21:18:33 +02:00
e7d2a4718d Fix popover args when called from Python 2018-05-18 21:00:16 +02:00
1fd11dd3ba Cleanup: comments, use negate_mat3_m4 2018-05-18 19:56:34 +02:00
ffaf55be94 Cycles/Eevee tests: add compare.html to see difference between the engines. 2018-05-18 18:08:01 +02:00
de7635f607 Fix: Use DEG_get_ctime() for rigidbody sims instead of BKE_scene_frame_get()
There are still probably other massive problems to solve (i.e. which copies
of data cache/sim gets written/read from for COW eval) that need to be solved
before we can get the sims actually running though.
2018-05-18 18:04:35 +02:00
30673ff325 Fix crash when collection view layer cannot be found 2018-05-18 17:56:17 +02:00
f9547ab313 Fix tools not being initialized on startup 2018-05-18 17:36:11 +02:00
c2d5411cbf Fix manipulator removal
The flag could be left set, removing the manipulator type again.
2018-05-18 17:36:11 +02:00
6a782ed767 Eevee: add regression tests.
This adds Eevee render tests using the Cycles files. Currently it must
be enabled by setting WITH_OPENGL_RENDER_TESTS=ON. Once we have reference
images we can enable it by default.

Some of the Cycles and Eevee tests are also currently broken due to
modifier and particle changes.

Differential Revision: https://developer.blender.org/D3182
2018-05-18 17:11:24 +02:00
00071d78bc Merge branch 'master' into blender2.8 2018-05-18 17:11:19 +02:00
29595334f0 COW Fix: POSE_OT_armature_apply (Apply Pose as Rest Pose) now works with COW 2018-05-18 17:07:46 +02:00
d712dd2f19 Cycles tests: move to render/ folder, to share with Eevee. 2018-05-18 16:46:48 +02:00
2d6bfb5b63 Transform: Improve the hierarchy in the choice of snapped elements in the mixed snap.
To snap to small edges in 3d_view is no longer obfuscated by vertices if then is also enabled.
2018-05-18 11:40:32 -03:00
a3070474e2 Clear the ParticleSettings pointer to prevent doubly-freeing it
Not happy with the approach, as it adds to nested_id_hack_discard_pointers(),
but at least it fixes a crash.
2018-05-18 16:29:16 +02:00
db2c966e2c Cleanup: remove unused function. 2018-05-18 10:55:51 -03:00
6776a55464 Fix crash rendering files with Python errors in background mode. 2018-05-18 15:50:08 +02:00
d7ba8611e2 Fix crash with shape keys and modifier stack, after recent changes. 2018-05-18 15:50:08 +02:00
6a64556ba1 Merge branch 'master' into blender2.8 2018-05-18 15:31:53 +02:00
47949fd764 Eevee: Codestyle fix. 2018-05-18 15:33:04 +02:00
83c2febaee Eevee: SSS: Fix compilation errors.
Fix T55114
2018-05-18 15:31:07 +02:00
e077285745 CMake: Add WITH_COMPILER_ASAN option
This supports easy toggling of Address Sanitizer.
2018-05-18 15:22:16 +02:00
4d19f24ba7 Cleanup: remove deprecated definitions 2018-05-18 15:22:16 +02:00
6e48afeb23 Merge branch 'master' into blender2.8 2018-05-18 14:59:38 +02:00
5e7a21a5f5 Fix T55115: crash when iterating SmokeDomainSettings color_grid property
through python
2018-05-18 14:34:27 +02:00
1cc4ab481e Fix crash drawing polygon curves 2018-05-18 14:23:53 +02:00
b167bc2f00 Merge branch 'master' into blender2.8 2018-05-18 13:45:48 +02:00
cb50c288d4 Add missing header 2018-05-18 13:43:41 +02:00
17bd5c9d4b Collections and groups unification
OVERVIEW

* In 2.7 terminology, all layers and groups are now collection datablocks.
* These collections are nestable, linkable, instanceable, overrideable, ..
  which opens up new ways to set up scenes and link + override data.
* Viewport/render visibility and selectability are now a part of the collection
  and shared across all view layers and linkable.
* View layers define which subset of the scene collection hierarchy is excluded
  for each. For many workflows one view layer can be used, these are more of an
  advanced feature now.

OUTLINER

* The outliner now has a "View Layer" display mode instead of "Collections",
  which can display the collections and/or objects in the view layer.
* In this display mode, collections can be excluded with the right click menu.
  These will then be greyed out and their objects will be excluded.
* To view collections not linked to any scene, the "Blender File" display mode
  can be used, with the new filtering option to just see Colleciton datablocks.
* The outliner right click menus for collections and objects were reorganized.
* Drag and drop still needs to be improved. Like before, dragging the icon or
  text gives different results, we'll unify this later.

LINKING AND OVERRIDES

* Collections can now be linked into the scene without creating an instance,
  with the link/append operator or from the collections view in the outliner.
* Collections can get static overrides with the right click menu in the outliner,
  but this is rather unreliable and not clearly communicated at the moment.
* We still need to improve the make override operator to turn collection instances
  into collections with overrides directly in the scene.

PERFORMANCE

* We tried to make performance not worse than before and improve it in some
  cases. The main thing that's still a bit slower is multiple scenes, we have to
  change the layer syncing to only updated affected scenes.
* Collections keep a list of their parent collections for faster incremental
  updates in syncing and caching.
* View layer bases are now in a object -> base hash to avoid quadratic time
  lookups internally and in API functions like visible_get().

VERSIONING

* Compatibility with 2.7 files should be improved due to the new visibility
  controls. Of course users may not want to set up their scenes differently
  now to avoid having separate layers and groups.
* Compatibility with 2.8 is mostly there, and was tested on Eevee demo and Hero
  files. There's a few things which are know to be not quite compatible, like
  nested layer collections inside groups.
* The versioning code for 2.8 files is quite complicated, and isolated behind
  #ifdef so it can be removed at the end of the release cycle.

KNOWN ISSUES

* The G-key group operators in the 3D viewport were left mostly as is, they
  need to be modified still to fit better.
* Same for the groups panel in the object properties. This needs to be updated
  still, or perhaps replaced by something better.
* Collections must all have a unique name. Less restrictive namespacing is to
  be done later, we'll have to see how important this is as all objects within
  the collections must also have a unique name anyway.
* Full scene copy and delete scene are exactly doing the right thing yet.

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

https://code.blender.org/2018/05/collections-and-groups/
2018-05-18 13:34:24 +02:00
70aec3732d Fix crash running in background mode, after recent changes. 2018-05-18 13:23:14 +02:00
fbcdd07c98 Cleanup: move unneeded struct out of DNA.
The real reason is that there is a conflict between Carbon header defining
a "Collection" struct, and this works around it.
2018-05-18 12:58:24 +02:00
b6a2dbbec2 Tool System: set cursors for draw & transform 2018-05-18 11:57:56 +02:00
17852b079c Tool System: support for tool cursors 2018-05-18 11:44:28 +02:00
6e40b2de7a Fix operator execution resetting the cursor
Area and region are NULL in the context if the operator finishes.
2018-05-18 11:42:58 +02:00
1cf0930e89 Fix manipulator resetting the cursor 2018-05-18 11:42:37 +02:00
2451a1951e Merge branch 'master' into blender2.8 2018-05-18 11:02:39 +02:00
278e3f7d5f Logging: add --show-log-backtrace
Useful in debug builds to see a functions callers.
2018-05-18 11:00:47 +02:00
987d1df571 Tool System: store the active tool in ScrArea
Without this we need to have the context to get the
(space_type, mode) args for an active tool lookup.

For event handling & poll its more convenient to have direct access.
2018-05-18 09:40:52 +02:00
8faa594413 Cleanup: unused DNA 2018-05-18 08:14:36 +02:00
f7e7769260 Cleanup: use '_Runtime' suffix
Allows for more easily finding runtime versions of any struct.
2018-05-18 08:02:32 +02:00
8b9db543fd Tool System: add cursor (currently unused) 2018-05-18 07:58:37 +02:00
bffa9b8012 Cleanup: remove tool definition access function
No longer needed since names not values are compared
when checking if a tool is active.
2018-05-18 07:24:17 +02:00
96fba1e101 Color: Assume Rec 709 in remaining comp nodes
Part of T54798
2018-05-17 17:20:32 -04:00
3af4a46a18 Tool System: tools now initialize on startup 2018-05-17 22:03:34 +02:00
50e3af8899 RNA: quiet warning
Harmless but annoying.
2018-05-17 20:35:46 +02:00
b0c8d35142 Tool System: use context mode
Was using object mode in the workspace API which isn't
useful for accessing tools.
2018-05-17 20:28:14 +02:00
486ff7e52c Merge branch 'master' into blender2.8 2018-05-17 19:55:27 +02:00
54a9136569 RNA: move enums to rna_rna.c
Needed for use in rna non runtime code.
2018-05-17 19:54:35 +02:00
0e0d99161a RNA: move enums to rna_rna.c
Needed for use in rna non runtime code.
2018-05-17 19:10:45 +02:00
b290048257 makesrna: error check from 2.8 2018-05-17 19:05:46 +02:00
b46c707ec2 Fix UV shadow drawing 2018-05-17 18:44:03 +02:00
cadbfa590a Static Override/RNA diffing: Use a nasty macro to factorize a bit the code.
This piece of code remains annoyingly verbose, but at least now we do
not have anymore twice the same logic duplicated between single array
element handling, and non-array properties.
2018-05-17 17:10:35 +02:00
170dd30881 Multi-Object-Mode: EditCuve Select All
D3381 by @dgriffin91
2018-05-17 17:09:02 +02:00
3b6a0f5fe0 Modifiers: ported Surface DerivedMesh → Mesh 2018-05-17 16:21:13 +02:00
edf6676a77 Tool System: per space/mode tool support
This patch adds support for:

- Per space-type tools (3D view and edit).
- Per mode tools (object, edit, weight-paint .. etc).

The top-bar shows the last activated tools options, this is a design
issue with using a global topbar to show per-space settings.

See D3395
2018-05-17 15:57:33 +02:00
20cc14e2b7 Cleanup: warning 2018-05-17 15:51:36 +02:00
9edc64e255 Tag scene & objects for COW update after physics settings changed via RNA 2018-05-17 15:48:23 +02:00
a2438373b3 Modifiers: ported Collision DerivedMesh → Mesh 2018-05-17 15:28:51 +02:00
c48a3afb16 Collision Modifier: get time from depsgraph instead of scene 2018-05-17 15:28:51 +02:00
Dalai Felinto
0ef23786fe EEVEE: Fix Motion Blur for copy-on-write
Get current frame from depsgraph, not scene.
2018-05-17 15:25:43 +02:00
2e635b6500 Outliner: add ID type filter option for Blender File and Orphaned Data. 2018-05-17 14:27:59 +02:00
75321a3d24 Outliner: move filter menu to the left in header. 2018-05-17 14:27:58 +02:00
6d706dc8c7 Outliner: in Blender File, use upper case names and icons. 2018-05-17 14:27:58 +02:00
1f3143fcc7 Outliner: rename Data-Blocks to Data API, to make clear it's low level stuff. 2018-05-17 14:27:58 +02:00
773a60d8f8 Modifiers: ported Particle Instance DerivedMesh → Mesh 2018-05-17 13:45:47 +02:00
ca1f1043d3 Particle System: fixed dupliobject drawing by getting time from depsgraph 2018-05-17 11:42:24 +02:00
12e523d12c Fix menu navigation and modal tools affecting the active region.
We updated the active region during redraw to fix missing updates on
file load, restrict it more now to avoid unwanted updates.
2018-05-17 11:17:45 +02:00
35a298db52 Armature: Fix non working Wireframe option on bones. 2018-05-17 11:11:53 +02:00
ba4d215139 T55090: Proxy bones were not selectable
- Implemented custom selection in pose mode overriding the rest. This
selection mode is only done for bone selection right now
2018-05-17 08:54:40 +02:00
41cba97f47 Cleanup: Use ED_view3d_win_to_ray_ex to get the ray and remove unused parameter. 2018-05-16 23:04:28 -03:00
efe3042368 Transform: Use isect_ray_seg_v3 instead dist_squared_ray_to_seg_v3 in the function that tests the snap on edges. 2018-05-16 22:04:41 -03:00
4b18858660 BLI_math_geom: Separate the isect_ray_seg_v3 from dist_squared_ray_to_seg_v3. 2018-05-16 21:36:41 -03:00
d038f4651e Transform: Fix bugs for the latest changes to the snap system. 2018-05-16 21:32:52 -03:00
Dalai Felinto
07b03ff74d EEVEE Scene: Set all variable as overridable 2018-05-16 23:13:28 +02:00
Dalai Felinto
83e35b682c Remove ViewLayer settings - cleanup 2/2 2018-05-16 23:13:28 +02:00
Dalai Felinto
e51bf11b15 Remove ViewLayer settings - cleanup 1/2 2018-05-16 23:13:28 +02:00
Dalai Felinto
09e419fa8d Move Clay properties into scene
Per collection overrides are gone now.
2018-05-16 23:13:28 +02:00
Dalai Felinto
15c2801aac Move EEVEE properties into scene
We handle doversion for the scene properties, but not for the
view layer overrides.

Overrides will be implemented in a different way via dynamic overrides.
For now this data is completely lost.
2018-05-16 23:13:28 +02:00
Dalai Felinto
d8dca3c3b0 Layer unittest: Disable the override tests
They are failing for some time now, and they will be obsolete soon anyways.
2018-05-16 23:13:28 +02:00
b4648ee379 Cleanup: BKE_bvhuitls: Use a struct rather than re-create each member of it. 2018-05-16 15:26:33 -03:00
91d3a5c1f7 Fix crash when duplicating an object type mesh with raycast operation enabled. 2018-05-16 14:28:28 -03:00
f6601e2deb Tool System: pass space type when setting tool
Internal change only, needed because object mode is now in top-bar.
2018-05-16 19:04:29 +02:00
9abb4b555a Cleanup: unused vars 2018-05-16 19:04:29 +02:00
527c9af48f Static overrides: reduce the amount of instantiated objects when overriding a group.
For now, do not override/instantiate objects used as boneshapes.

Note that this is a rather poor/dirty hack, it seems Spring char groups
still have a lot of other (unused???) shape objects.

Ideally lib groups should be designed more cleanly for the new Static
Override system, putting only really usable objects into 'main' group,
and placing the others in sub-groups, helpers groups, or so...
2018-05-16 19:01:04 +02:00
5ed702dc9c Armature: Fix T55068: Wireframe bones with custom shapes not working in object mode 2018-05-16 18:46:35 +02:00
1b4916054e Armature: Cleanup: Remove unused function and use less silly wire drawing. 2018-05-16 18:46:35 +02:00
f785fb299a Particle edit: Use proper modifier to get evaluated derived mesh from 2018-05-16 17:45:48 +02:00
df963a47fb Particle edit: Fix disappearing child particles when toggling edit mode
Going to object edit mode and back to particle edit mode used to loose all
children from being displayed.
2018-05-16 17:45:48 +02:00
5308e31e41 Fix memleak with meshes having IDProps in modifier stack evaluation.
*Always* use BKE_library API to handle IDs allocation and freeing,
unless you have a very, very, very good reason not to do so - and
perfectly know what you are doing.
2018-05-16 17:35:54 +02:00
48645e55e1 Fix again bloody locked proxy bones...
No idea why that was working this morning, now we do not get CoW tag
anymore (which kind of makes sense since it's set *after* copying
happens...), so just resorting to using the NO_MAIN flag instead.
2018-05-16 17:25:20 +02:00
34c98e3d41 Eevee: Fix missing Ambient Occlusion node in add node menu. 2018-05-16 16:58:32 +02:00
bcfe075f89 Armature: Fix T55070: Bones relationship lines are offsetted
Was missing object matrix multiplication.
2018-05-16 16:58:32 +02:00
a25856f2a8 GPUShader/DRW: Add Transform Feedback support.
This is a usefull feature that can be used to do a lot of precomputation on
the GPU instead of the CPU.

Implementation is simple and only covers the most usefull case.

How to use:
- Create shader with transform feedback.
- Create a pass with DRW_STATE_TRANS_FEEDBACK.
- Create a target Gwn_VertBuf (make sure it's big enough).
- Create a shading group with DRW_shgroup_transform_feedback_create().
- Add your draw calls to the shading group.
- Render your pass normaly.

Current limitation:
- Only one output buffer.
- Cannot pause/resume tfb rendering to interleave with normal drawcalls.
- Cannot get the number of verts drawn.
2018-05-16 16:58:32 +02:00
a3f4c72ec9 Eevee: Add support for Ambient Occlusion node. 2018-05-16 16:58:32 +02:00
c332e6e0d6 Eevee: Change normal buffer texture format for more precision.
This means more accurate SSR with less faceted artifacts.
2018-05-16 16:58:32 +02:00
f1a5fd90ba Shader Node Editor: Add Closure to RGB convertion node.
Patch D3205 by Kanzaki Wataru

Only implemented in Eevee for now. Collapse a closure to RGBA so we can
do NPR stuff on the resulting color.

Use an emission shader to convert the color back to a closure.

Doing this will break PBR and will kill any SSR and SSS effects the shader
the shader rely on. That said screen space refraction and ambient occlusion
are supported due to the way they are implemented.
2018-05-16 16:58:32 +02:00
e862bcd6c8 Workbench: World based studio lighting
Disabled shadows for now as the calculation of the light direction is
still to bogus.
2018-05-16 16:43:10 +02:00
def1c3eb4b Particle System: ported most DerivedMesh → Mesh
There are a few places where DerivedMesh is still used, most notably
when calling the (not yet ported) cloth simulation. There is also still
the use of Object.derivedDeform and Object.derivedFinal. Those places are
marked with a TODO.

Some functions in the editors module were copied to accept Mesh. Those
already had 'mesh' in the name; the copies are suffixed with '__real_mesh'
for easy renaming later when the DM-based functionality is removed.
2018-05-16 16:31:38 +02:00
76b5e38a76 Mesh: Set deformed_only=1 when copied mesh is from main library 2018-05-16 16:13:13 +02:00
739c3e8102 Particle System: use DEG to get current time in psys_get_particle_state() 2018-05-16 16:09:52 +02:00
eacf63c96f Particle System: Pass correct particle index when drawing
Passing the wrong index caused the particles to stop being shown when the
first particle dies.
2018-05-16 16:09:52 +02:00
1b2ba24749 fix build error in last commit. 2018-05-16 11:02:54 -03:00
f0c0d11ea2 Fix T55076: Hack around to break correct behavior of 2.8 and get back broken-used-as-feature one from 2.7.
Locked bones of proxies should not be editable, at all. But lack of
update from linked rest pose in 2.7 allows to pose and animate locked
bones (not to pose them without animation though, or you'd lose your
pose on next file save & reload).

this is used by artists to always lock all their bones in a rig, so that
proxies fully update when lib rig is modified...

For now, restore that broken behavior in 2.8 by not updating proxies
against lib armature in CoW context (makes sense anyway, we are
currently doing a lot of useless thing when copying data for depsgraph
evaluation!).
2018-05-16 15:47:50 +02:00
2ba0951e52 Snap system: Adds support to Clip Planes and uses a clip plane to simulate occlusion
This patch adds support for clip_planes (ie ignore what is behind a face)...

The idea is to first execute a raycast to get the polygon to which the mouse cursor points.
Then a snap test is done on the vertices or edges of the polygon.
Then with the normal and location obtained in raycast a new clip_plane is created and the snap over the whole scene is processed ignoring the elements behind the clip_plane.

Here 2 gif of how the previous patch would work on blender2.79:

{F497176}

{F497177}

Reviewers: mont29, campbellbarton

Reviewed By: campbellbarton

Subscribers: bliblubli

Tags: #bf_blender_2.8

Differential Revision: https://developer.blender.org/D2527
2018-05-16 10:32:54 -03:00
6a4ba9133c Fix T55097: Mesh Deformation modifier is ignoring Vgroup option 2018-05-16 15:19:10 +02:00
Dalai Felinto
b0cfd7a9b8 Fix T55082: Add Paint Slots for texture painting not working
We changed how this work since the BI removal. But since this operator
was moved to the topbar its poll function was returning false.
2018-05-16 15:02:33 +02:00
2e4c1346bd Popover for snapping settings
See T55038
2018-05-16 14:23:46 +02:00
d9e04cb594 Multi-Object-Mode: EditMesh Tool Bevel (MESH_OT_bevel)
Maniphest Tasks: T54643
Differential Revision: https://developer.blender.org/D3352
2018-05-16 14:05:57 +02:00
7fd44e2498 Reverted copying mesh->runtime.deformed_only in CDDM_from_mesh_ex
Doing that copy is the right thing, but only if the mesh has its own
deformed_only flag set correctly. This isn't generally the case, so
keeping dm->deformedOnly = 1 is better.
2018-05-16 13:06:57 +02:00
1bb9ccf887 Multi-Object-Editing: MESH_OT_faces_select_linked_flat
Reviewers: dfelinto

Maniphest Tasks: T54643

Differential Revision: https://developer.blender.org/D3372
2018-05-16 13:04:09 +02:00
d095eea19c Silence warning about functions having no prototype 2018-05-16 06:45:54 -04:00
dbe4189dcd Save 'deform_only' flag in Mesh.runtime
This flag is copied when converting between DM and Mesh.

This flag is set to true in get_mesh(), to mimick the behaviour of
CDDM_from_mesh_ex. This is necessary for the particle system to work
correctly.
2018-05-16 12:41:48 +02:00
46aec45b2a Multi-Object-Editing: intersect boolean (MESH_OT_intersect_boolean)
Reviewers: dfelinto (changed test from totvert to totfacesel before committing)

Maniphest Tasks: T54643
Differential Revision: https://developer.blender.org/D3306
2018-05-16 12:29:05 +02:00
Dalai Felinto
807afedf6c Fix check for MESH_OT_intersect 2018-05-16 12:26:32 +02:00
dffd37877d Multi-Object-Editing: intersect (MESH_OT_intersect)
Reviewers: dfelinto

Maniphest Tasks: T54643
Differential Revision: https://developer.blender.org/D3307
2018-05-16 12:17:20 +02:00
f7c37c8344 Modifiers: Port mesh_calc_modifiers from DerivedMesh to Mesh
This ports the main modifier eval loop.

A few things haven't been ported yet: tessface and shapekey related code. As
far as I can tell, shapekey code was never entered into.

https://developer.blender.org/D3342
2018-05-16 06:07:50 -04:00
c43dbc2bc2 Add modifier_deformVerts_ensure_normals, modifier_applyModifier_ensure_normals
Same as `modwrap_deformVerts` and `modwrap_applyModifier` but for `Mesh`.
2018-05-16 06:07:50 -04:00
fee50f830d Add BKE_mesh_is_valid
Non modifying version of `BKE_mesh_validate`, mirrors `DM_is_valid` more
closely. Will be used in port of `mesh_calc_modifiers`
from `DerivedMesh` to `Mesh`.
2018-05-16 06:07:50 -04:00
9bcddeca7a Popover for Pivot Point in top bar
From T55038
2018-05-16 12:03:53 +02:00
b6a822d726 Multi-Object-Editing: Weld Edges into Faces(MESH_OT_face_split_by_edges)
Reviewers: dfelinto

Maniphest Tasks: T54643

Differential Revision: https://developer.blender.org/D3308
2018-05-16 11:54:33 +02:00
a6e804eaee Particle system: get current time from depsgraph
This makes the particle animation work again!
2018-05-16 10:50:49 +02:00
ca8e9c881f Workbench: Read studiolights from USER + SYSTEM datafiles 2018-05-16 09:14:20 +02:00
d0b62ce041 Fix navigate widget w/ region overlap 2018-05-16 08:46:40 +02:00
b79fea28e3 Fix visible region overlap calculation
Existing code didn't account for top/bottom overlap.
2018-05-16 08:32:02 +02:00
0a8d6bd893 Transform: Snap: Make sure if bmesh arrays need to be recalculated. 2018-05-15 16:15:14 -03:00
9619a90da1 Scene raycast: The return index should indicate the polygon instead of the looptri.
This was the default behavior and could break some addon since looptri is almost useless for the current python API.
2018-05-15 15:38:17 -03:00
599bf05c56 Merge branch 'master' into blender2.8 2018-05-15 19:53:34 +02:00
bf0d16e30e Workbench: send right event after shadow_shift changes 2018-05-15 19:47:29 +02:00
7a69c59b35 Revert "BLI_kdopbvh: Reference clip_planes callback to find nearest projected."
This reverts commit 717dd4cecd.

It was causing problems in the protactor ruler.
I'll think of a better solution.
2018-05-15 14:37:45 -03:00
4461be1b72 Fix T55032: Redo w/ file saved in edit-mode failed
It's important edit-mode has a step stored for redo to work,
file load now ensures this in a generic way.
2018-05-15 19:37:06 +02:00
50c29e2391 Cleanup: pass the use_depth parameter to the SnapObjectParams struct in the ED_transform_snap_object_project_view3d_mixed. 2018-05-15 14:32:30 -03:00
717dd4cecd BLI_kdopbvh: Reference clip_planes callback to find nearest projected.
Clip_planes are an important parameter to be used in callbacks.
2018-05-15 14:14:25 -03:00
a2dd6fa58b COW Fix: VIEW3D_OT_select_lasso now works for Pose Bones. Other modes untested. 2018-05-15 19:13:25 +02:00
439ccd27e6 BLI_math: Added isect_point_planes_v3_negated function. 2018-05-15 14:10:41 -03:00
ca028f1387 Fix POST_OT_hide/reveal
Apparently they weren't actually working, despite seemingly working
when tested earlier. Argh!
2018-05-15 19:08:00 +02:00
747326ed25 Fix: POSE_OT_visual_transform_apply now works with Copy on Write 2018-05-15 18:39:24 +02:00
c3282cb746 COW Fix: Muting constraints or changing influence did not properly refresh
We need to manually do a copy on write tag here, or else nothing will happen
2018-05-15 18:39:24 +02:00
53c6d3399a Remove G.main usage 2018-05-15 18:39:24 +02:00
Dalai Felinto
9439df1ab8 Copy on write: VIEW3D_OT_clear_render_border + rna 2018-05-15 18:19:08 +02:00
Dalai Felinto
4f8b6428bc Copy on write: VIEW3D_OT_render_border
Drawing is using the original scene (which shouldn't), but regardless
this force tagging to work.
2018-05-15 18:03:10 +02:00
3d1f5cb9a2 Cleanup: Pass Snap Object Params * params to iter_snap_objects.
And remove unnecessary `defaulf:` labels.
2018-05-15 12:44:37 -03:00
92d4fbf5cc Fix Cycles and viewport outline mismatch due to changed sensor size. 2018-05-15 17:32:38 +02:00
13b2ba4fdd Fix Cycles motion blur not working with CoW disabled.
Not so important but convenient for testing, and makes the Cycles tests
pass again for now.
2018-05-15 17:32:38 +02:00
8c44e182f0 Fix mistake in recent outliner rebuild change. 2018-05-15 17:32:38 +02:00
77d6c09ddd Merge branch 'master' into blender2.8 2018-05-15 17:31:26 +02:00
91504ed26e Fix assert using '//' on an unsaved file
Annoying for debug builds.
2018-05-15 17:27:36 +02:00
fda05127db Particle edit: Fix generation of KD tree for emitters
Fixes crahs using puff brush with copy-on-write.
2018-05-15 17:20:02 +02:00
5d879c5d42 particle edit: Fix crash when using without copy-on-write 2018-05-15 17:20:02 +02:00
83155cce5b Particles: Fix uninitialized child orco passed to modifiers
Wrong cleanup done in 51b796ff15.
2018-05-15 17:20:02 +02:00
2d0efe2e78 Particle edit: Need to check DONE flag from evaluated psys 2018-05-15 17:20:02 +02:00
a104c41759 Particle edit: Support children particles display with copy on write 2018-05-15 17:20:02 +02:00
ed0901b47e Depsgraph: Forbid flush across scene->geometry operations
This relations is only to force geometry evaluation to happen
after scene's CoW is done. it was never meant to update geometry
when scene is being tagged.
2018-05-15 17:20:02 +02:00
f43d33d3a4 Depsgraph: Keep track of original particle system
Allows to have quicker lookup in particle edit mode.
2018-05-15 17:20:02 +02:00
4f5bcc30d3 Particle edit: Add missing looking tag in cut brush 2018-05-15 17:20:02 +02:00
e57ba1daf5 Particle edit: Allow children to be visible in edit mode
Follows tool settings, tested without copy-on-write.

Enabling copy-on-write still needs verification and likely some fixing.
2018-05-15 17:20:02 +02:00
f4fd1f1f4b Particle edit: Move cache update to particle batch cache implementation
The idea is to allow "regular" strands to update edit cache and hence
get the final update strands.
2018-05-15 17:20:02 +02:00
e83cee73eb Draw manager: Pass object to hair batch cache
Currently unused, but is required for an upcoming work.
2018-05-15 17:20:02 +02:00
fe01430f74 Particle edit: Make check to work within copy-on-write concept
Not fully optimal, we can probably store pointer to original psys
similar to ID's orig_id.
2018-05-15 17:20:02 +02:00
e5560e8d56 Particle edit: Edit path invalidate should trigger particle system path re-cache
Don't try to bend existing design, just follow it. It's not nice, but is
working. Just bring it back, then repeal and replace system as a whole,
making sure every bit is working according to a design.

Such quick patches only trying to make local sense of a system, defeating
it's design.
2018-05-15 17:20:02 +02:00
c5f469da5e Particle edit: Restore weird-looking conditions in evaluation
They might be looking weird, but they match conditions when children particles
are to be re-calculated for particle edit.
2018-05-15 17:20:02 +02:00
aa312621dc Particle edit: Re-cache edit path if it's NULL
This is what old particle drawing code was doing.
2018-05-15 17:20:02 +02:00
979c48fd66 Particle edit: Decouple caches for regular and edit strands
Makes it possible to have children strands to be visible during combing.
Actual implementation still needs work though.
2018-05-15 17:20:02 +02:00
361bc2bc50 Particle edit: Make visibility check to be per-particle system
This way we can see other particle systems while combing another one.
2018-05-15 17:20:02 +02:00
f25be56bc7 Particle edit: Use proper batch cache flag
Also tag batch for invalidation when using cut brush.
2018-05-15 17:20:02 +02:00
06e9048ade Particle edit: Tag for updates when changing tool settings related on edit mode 2018-05-15 17:20:02 +02:00
7cbb85675a Particle edit: Fix missing hair edit after toggling edit mode 2018-05-15 17:20:02 +02:00
e0b0f7afa0 Fix hair edit mode after recent fix for DEG sued from draw code 2018-05-15 17:20:02 +02:00
b6e3430417 Modifiers on Lattices now work
Tested with Hook and Armature modifiers. Requires CoW to be enabled.
2018-05-15 17:16:23 +02:00
87cd4de3ba Workbench: Renamed Overlap to Outline
Outline is reserved for the Overlap Overlay
2018-05-15 17:03:59 +02:00
a95d417db0 Fix broken PoseMode editing when CoW is enabled.
We need to get data from evaluated object/posechannel too, then...
2018-05-15 16:30:02 +02:00
10fe8ec68f Fix T55078: Assert statement 2018-05-15 16:20:34 +02:00
bcf6cc1f6b Change startup defaults
- Default Lamp increased strength (10x stronger)
- 3D View & Camera Lens = 50mm
- Camera film size = 36x24mm Full Frame
- Render Size Percentage = 100%
- Render Display = New Window
- Scene Units = Metric
- Color Management View = Filmic
- Workbench Object Overlap = ON
- Headers on top for all editors, except the Timeline at the bottom
- Default Properties tab = Object Properties
- Generate UV's = ON

See T47064
2018-05-15 16:14:16 +02:00
197af58baa Workbench: Cleaner Shadow edges own shadow 2018-05-15 15:40:12 +02:00
4d5b7696cb Change preference defaults
- Python tooltips: OFF
- Auto Perspective: ON
- Navigation Manipulator: ON
- Region Overlap: ON

See T47064
2018-05-15 14:32:13 +02:00
13dfa72f26 Add icon placeholders for all the armature ops that got recently added in the toolbar
The icon designers still need to create these, but it's better to have placeholders
so they remember to do it.
2018-05-15 13:50:52 +02:00
c6bceffc4f Fix crash linking/appending from old files in some cases.
Temporary main would not have a lock, which caused crashing when adding
datablocks.
2018-05-15 13:23:01 +02:00
3f20105622 Fix random crashes in the outliner, especially with bigger scenes.
The outliner can redraw quicker without rebuilding the tree, for example when
just moving the mouse and highlighting different items. The way this worked is
that the outliner would be tagged to avoid rebuilding, however if another
operation that does require rebuilding happens in the meantime we could go out
of sync and crash.
2018-05-15 13:02:44 +02:00
8021ac986a Pose Toolbar: Added Breakdowner/Push/Relax as separate tools
Currently all are stacked together, but perhaps if we don't get any other
tools in the meantime, it would make sense to have them separate.

Notes:
* No icons for now...
* There are some 2.8 bugs with the underlying operators (notably multi object)
2018-05-15 12:40:50 +02:00
95e7559bb6 Edit Armature Toolbar: Added some tools for "Shrink Fatten" (Alt-S) type bone transform tools
For fun, I tried adding some more edit armature tools to the toolbar to
check how this is all working. Icons are missing currently, but it's a
nice test.
2018-05-15 12:08:09 +02:00
b3d4f99d48 Fix bone-size crash
Own regression from multi-object transform.
2018-05-15 11:36:39 +02:00
e0903e20a7 Merge branch 'master' into blender2.8 2018-05-15 11:14:33 +02:00
3eb9cc69f2 Cleanup: last spacetype enum name 2018-05-15 11:12:49 +02:00
f1bc899146 Merge branch 'master' into blender2.8 2018-05-15 10:25:49 +02:00
9636cab009 Undo System: remove nested edit-mode undo calls
Regression in recent undo system changes,
This caused T55048.

When each mode had its own undo stack it was important
to initialize it when entering edit-mode.
2018-05-15 10:10:48 +02:00
55b241d32a Fix texture space transform crash
Own regression from multi-object transform.
2018-05-15 09:25:16 +02:00
0fb80cebec Fix T55061: Shadows were not updated during sclupting. 2018-05-15 09:13:47 +02:00
52cb62d502 Merge branch 'master' into blender2.8 2018-05-15 09:08:48 +02:00
ae8225ba6d Fix BMesh bisect not flagging dirty indices 2018-05-15 09:04:12 +02:00
ce27d11595 Workbench: Enable Textures in Edit Mesh Mode
Constructed UV out of BMesh data layers.
2018-05-15 08:58:25 +02:00
04fa65e356 Cleanup: Use switch statement to test the object type in snap functions. 2018-05-14 19:18:26 -03:00
c3b061278e EditMesh: updated extrude manipulator
Now plus icons are used to add,
arrows are used to adjust existing extrusions.
2018-05-14 23:21:59 +02:00
b2b8e1444a Manipulator: outline & helpline options for button 2018-05-14 23:18:36 +02:00
bac9c2dc7d Manipulator: utility to get matrix w/o offset 2018-05-14 23:15:44 +02:00
e159ec8bc1 Cleanup: compiler warnings, use const 2018-05-14 23:12:51 +02:00
bf7c46cae0 Transform: Use the new BLI_bvhtree_find_nearest_projected function to snap. 2018-05-14 16:08:17 -03:00
8cbf402eb6 New function for BLI_kdopbvh: BLI_bvhtree_find_nearest_projected.
This patch does not make any difference for a user's POV. But it is a step for adding the occlusion test for snapping functions.
This new function finds the node(aabb) whose projection is closest to a screen coordinate.

Reviewers: campbellbarton

Reviewed By: campbellbarton

Tags: #bf_blender_2.8

Differential Revision: https://developer.blender.org/D3180
2018-05-14 16:01:36 -03:00
70a60061e5 Fix crash opening 01_015_A.lighting.blend - DL_INDEX3 displist have a single normal, not one per vertex! 2018-05-14 17:41:11 +02:00
Dalai Felinto
7cb2d55bd4 View 3D: Use Z Key for "geometry occlusion" toggle
Note: The header doesn't update until you mouse hover it.
2018-05-14 17:19:10 +02:00
627a783784 Fix error in MESH_OT_edge_face_add changes
Context sensitive create also needs to check selected vertices.

Also correct indentation.
2018-05-14 16:35:51 +02:00
b0f61ea6db Fix error moving pivot
Missed updating keymap RNA paths.
2018-05-14 16:25:47 +02:00
Dalai Felinto
b1dae7bd6f Fix UI failing for vertex paint 2018-05-14 16:11:05 +02:00
Dalai Felinto
fc7316fb54 Multi-Objects: MESH_OT_vert_connect_path by Falk David
With a few changes:
* Use space after if.
* Skip for loop when no selected vertices.

Maniphest Tasks: T54643
Differential Revision: https://developer.blender.org/D3349
2018-05-14 15:56:26 +02:00
Dalai Felinto
de2d642c84 Multi-Objects: MESH_OT_edge_face_add by Guy Boicey
With changes by Dalai Felinto:
* Indentation
* Skip for loop when no vert/edge are selected

Maniphest Tasks: T54643
Differential Revision: https://developer.blender.org/D3233
2018-05-14 15:47:51 +02:00
2b09062def COW Fix: The "layers used" display for armatures did not update after bones were moved between layers
Previously, the "layers_used" value was getting updated by the drawing code.
However, when using copy on write, the drawing code gets evaluated copies of
the armature data instead of the original data, so any updates here fail to
get flushed to the original data, hence the lack of updates in the UI.

Fixed by moving the calculation to RNA when setting bone layers, as it should
have been done originally. (The one downside to this is if we set individual
layer memberships one by one - this could be slower as the recalc would have to
happen each time this changes).
2018-05-14 15:42:57 +02:00
788488b1aa Fix: With no bones selected, move bones to layer operator would display garbage layer set
Was using uninitialised memory
2018-05-14 15:42:57 +02:00
2bf4654052 Fix: POSE_OT_select_constraint_target now works with copy on write 2018-05-14 15:42:57 +02:00
Dalai Felinto
b1d016bc12 MESH_OT_select_mirror: Only report when something to report
Inspired by D3299.
2018-05-14 15:26:29 +02:00
Dalai Felinto
90c9458b2f Multi- Objects: MESH_OT_select_face_by_sides by Rainer Trummer
Maniphest Tasks: T54643
Differential Revision: https://developer.blender.org/D3301
2018-05-14 15:23:22 +02:00
Dalai Felinto
4043e4b820 Multi-Object: MESH_OT_vert_connect_concave by Guy Boicey
Maniphest Tasks: T54643
Differential Revision: https://developer.blender.org/D3255
2018-05-14 14:56:40 +02:00
9e4709e9a5 Manipulator: fix 2D icon buttons in the 3D view 2018-05-14 14:47:52 +02:00
e5b53fb28c Some cleanup in modifiers' mesh copying. 2018-05-14 14:34:00 +02:00
eabfd031fa Fix T55031: add explicit copy flag to force deep-copying shapekey datablock with 'parent' one.
Chose to change defaut behavior (0-flag one) here, for sake of
consistency. Default behavior of simple BKE_id_copy() remains unchanged
though.
2018-05-14 14:25:13 +02:00
63c2397171 T54643-Multi-Object EditMesh: MESH_OT_select_nth
With changes by Dalai Felinto:
* Move WM_operator.* outside for loop.
* Update error message to handle Mesh and Meshes.
* Skip main functionality when no vert/edge/face is selected.

Maniphest Tasks: T54643
Differential Revision: https://developer.blender.org/D3371
2018-05-14 14:07:10 +02:00
e33016c77e UI Tweaks in 3D View
* Move Shading modes out of the popover
* Move Show Overlays out of the popover
* Test moving the Mode to the topbar again
* Move submode (select vertex, edge, face) to the topbar
* Remove icon from show_manipulator toggle
2018-05-14 14:00:37 +02:00
Dalai Felinto
3ebe389605 Multi-Object: MESH_OT_select_mirror 2018-05-14 13:47:53 +02:00
bf73628978 Fix extrude adjustment on normal axis 2018-05-14 13:45:34 +02:00
80ccad07cc Fix: Skip missing COW tagging on changing armature layers via RNA
Was causing problems on Spring rig while trying to show/hide armature layers
2018-05-14 13:42:30 +02:00
5205a0f671 Fix incorrect matrix stack push/pop 2018-05-14 13:29:17 +02:00
Dalai Felinto
b942106c73 Multi-Object: MESH_OT_vert_connect_nonplanar by Aeden McClain
With indentation fixes by Dalai Felinto.

Maniphest Tasks: T54643
Differential Revision: https://developer.blender.org/D3312
2018-05-14 13:04:01 +02:00
Dalai Felinto
016ba0f38b Multi-Objects: VIEW3D_OT_snap_selected_to_gri by Leon Eckardtd
With changes by Dalai Felinto (skip for loop when no vert/edgeface selected).

Maniphest Tasks: T54643
Differential Revision: https://developer.blender.org/D3302
2018-05-14 12:52:52 +02:00
261d78a2c6 Merge branch 'blender2.8' of git.blender.org:blender into blender2.8 2018-05-14 12:44:05 +02:00
0cfe9f95df Fix extrude manipulator update w/ view orientation 2018-05-14 12:26:40 +02:00
Dalai Felinto
e1cee0ac71 Multi-Object: MESH_OT_convex_hull by Lucas Boutrot
Maniphest Tasks: T54643
Differential Revision: https://developer.blender.org/D3223
2018-05-14 12:20:15 +02:00
51341dafc3 Workbench: Named background rendering 2018-05-14 12:07:58 +02:00
6a0d7f9e41 Workbench: Render studio hdr name in selection 2018-05-14 10:32:52 +02:00
258c5f2c0f Particle edit: Avoid depsgraph tag from draw code
Some of the function was intended to be used form drawing as well,
for until that is changed in design we can not use dependency graph
tags form it.
2018-05-14 10:16:41 +02:00
783bb4e1cd Revert "Tag update when using particle edit brushes"
This reverts commit 5dba0b68f8.

Old code was supposed to use this function from draw, and we must never
poke depsgraph from drawing.
2018-05-14 10:16:41 +02:00
50bab7eb8a Workbench: Studio light better diffuse sampling
Increased steps of diffuse sampling for narrow hightlights
2018-05-14 10:04:34 +02:00
95869f5838 Workbench: Support HDR files as HDRI studio lighting
support Radiance HDR files for studio lighting.
Fix crash when studiolight folder does not exist.
2018-05-14 09:56:32 +02:00
379c3e46d5 UV: multi-object project bounds
D3368 by @Al with own edits.
2018-05-14 09:15:43 +02:00
f78ba4bcfe Merge branch 'master' into blender2.8 2018-05-14 09:01:11 +02:00
43ee4d5d7c Cleanup: quiet GCC -Wtype-limits
While the warning can normally be disabled, we don't have have as much
control of warnings when macros are used.
2018-05-14 09:00:42 +02:00
66f0c10f84 Merge branch 'master' into blender2.8 2018-05-14 08:41:15 +02:00
c1d737eb95 BLI_utildefines: re-ordering array delete macro 2018-05-14 08:38:53 +02:00
a0c564f86a Eevee: Hair: Disable SSR for hairs.
SSR does not work with hair strands. Basically, the rays are too much
random to ever converge properly and just result in a soup of self
inter reflections.

So forcing it to not produce any SSR. Could potentially save some bandwidth
by not rendering hair to the SSR buffers.
2018-05-14 00:18:00 +02:00
2c1396b6cb Eevee: Hair: Fix normal distribution of previous commit.
Now it starts to look correct!
2018-05-13 23:12:45 +02:00
0c1c69d8df Eevee: Hair: Remove old hack and replace by new hack.
This is a hack to properly shade wire hairs. Use stochastic sampling and
let TAA solve the noise.

At least it's way more correct than the previous hack.
2018-05-13 22:44:57 +02:00
402442997a GPUTexture: Add Texture Buffer support.
This is needed by opensubdiv and can be helpfull in a lot of other cases.
2018-05-13 22:44:57 +02:00
ddf308b04a EditMesh: Use tweak for extrude tool
Could too easily click to extrude without any offset.
2018-05-13 21:19:22 +02:00
dc4f94783d EditMesh: show XYZ axis for extrude
Always show normal axis since this is the most used,
even when another orientation is selected.
2018-05-13 21:15:56 +02:00
e0a4624acd Eevee: Fix lamp defaulting to no specular.
Was missing a default value.
2018-05-13 21:07:40 +02:00
913bba5038 Fix missing path callback for new Object.display struct. 2018-05-13 19:06:37 +02:00
3767c01269 Fix issue w/ recent tool name use
Use the context space type, not the workspace.
Broke setting tools for the first time.
2018-05-13 18:39:15 +02:00
d21043ba83 Icons: updated transform icons 2018-05-13 18:33:01 +02:00
c40c2b5ab7 UI: fix popovers not properly working with scroll arrows for long menus. 2018-05-13 18:24:13 +02:00
680bdef12a Build deps: avoid ffmpeg external crystalhd library dependency. 2018-05-13 18:24:13 +02:00
64245e735c Icons: fix z-sorting
Was depth sorting per mesh.
2018-05-13 17:10:20 +02:00
Julian Eisel
a23995f42a Fix/workaround crash when appending workspace in edit mode
Linking/appending in edit mode currently isn't supported. For workspaces it
should probably be, but we can look into supporting this later.

For now gray out buttons in "Add Workspace" menu while in edit mode.
2018-05-13 16:49:05 +02:00
Julian Eisel
5717612f7c Fix invisible scroll-bars after file read
Own mistake from 51efeb6834.
2018-05-13 16:39:59 +02:00
5bad5f996f Icons: optionally use material color
The RGB node is used if it exists,
this is multiplied by the vertex color.
2018-05-13 16:24:38 +02:00
Nick Milios
94a62853ae Fix build error with Visual Studio / Windows.
Differential Revision: https://developer.blender.org/D3363
2018-05-13 15:51:42 +02:00
a8e8e08bc6 Revert "UI: geometry-icon alpha blend over existing colors"
This reverts commit 9606d28d40.

Caused issue w/ overlapping triangles,
since this isn't overly important reverting.
2018-05-13 15:39:10 +02:00
9606d28d40 UI: geometry-icon alpha blend over existing colors
Useful to mix pre-defined material colors.
2018-05-13 15:14:26 +02:00
7a2e271e54 Fix compiler warnings. 2018-05-13 14:48:55 +02:00
3469e623d3 UI/Python: layout API support for setting button emboss style. 2018-05-13 13:44:49 +02:00
343c2e94f5 Cleanup: deduplicate layout item initialization. 2018-05-13 12:48:51 +02:00
1ec48f8042 Tool System: Support set w/ space-type argument 2018-05-13 11:49:21 +02:00
06a786f12d UI: show toolbar shortcuts
When toobar text is expanded, show shortcuts
(normally confined to menus).
2018-05-13 10:27:44 +02:00
e7ee9cfd9e Tool System: tools are now set by name
This avoids having to store the tool definition in the operator
properties (on redraw).

Now just set the name, note this means we can't show the keymap in the
tool-tip anymore. This will eventually be shown in the status bar.
2018-05-13 10:01:56 +02:00
e1772dac70 WM: utility to create tool keybindings 2018-05-13 09:34:22 +02:00
cee39da318 WM: Operator to set the tool by name
Needed to bind keys to tools (T55036).
2018-05-13 09:03:37 +02:00
03281c080c Cleanup: indentation 2018-05-13 08:32:47 +02:00
0414b0a0be Cleanup: add function to get class from space type 2018-05-13 08:13:13 +02:00
ece3634497 Cleanup: call toolsystem static methods directly
Note, may move these static methods into their own module.
2018-05-13 08:07:17 +02:00
03e14bfeb6 Versioning: default scene to mean center pivot 2018-05-13 07:29:46 +02:00
9d677212ee Transform: fix regression in bound-box calculation
Error in multi-object merge.
2018-05-13 07:20:35 +02:00
59c6487e93 Merge branch 'master' into blender2.8 2018-05-13 06:56:51 +02:00
b99d064e91 Cleanup: trailing space 2018-05-13 06:44:03 +02:00
7a56d31af3 Fix 3D view axis align flag
Missed from recent pivot-point move to scene.
2018-05-13 06:38:43 +02:00
6c6a394373 Cleanup: Remove unused member. 2018-05-12 23:39:36 -03:00
9c212399c6 BKE_bvhutils: allow caching NULL bvh_trees.
This prevents zero-leafs bvhtrees from being recalculated multiple times.
2018-05-12 19:43:36 -03:00
0d9f77d954 transform_snap_object: perf: Check the distance of the bound_box of objects of type armature and curve first.
And remove unused variables.
2018-05-12 19:39:21 -03:00
375c6a7967 Cleanup: transform_snap_object: Remove unused variables and reuse the precalc used to test the distance to the projected bound_box. 2018-05-12 19:10:23 -03:00
5be0dfe086 Eevee: Fix Dof shader compilation. 2018-05-12 23:28:55 +02:00
d25ec499d8 Eevee: Depht Of Field: Merge Scatter passes together.
This means only one texture to draw to and only one sprite per pixel.

The texture is twice as large and near and far planes are side by side.

The sprite choose the biggest coc to expand to and is redirected to the
area (layer) it belongs to.

The fragment shader discard every pixel that does not belong to the correct
layer.
2018-05-12 23:28:55 +02:00
2dc5a84fad Eevee: Depth of field: Code style fixes. 2018-05-12 23:28:55 +02:00
f9cfb221d6 Eevee: Depth of field: Smooth out bokeh shape.
Due to the scatter operation being done at half resolution, undersampling
is visible at bokeh shape edges (because of the hard cut).

This commit adds a smoothing function to minimize the problem.

Also optimize the bokeh shape parametrization by precomputing a lot of
constants.
2018-05-12 23:28:55 +02:00
74a08cf128 Eevee: Depth of field: Change final blending.
This new blending allows background to fill the gaps left by forground
objects. However this has a drawback, background objects that should be
partially occluded in this case can be seen through the blurred objects.

This does not fix the problem of blurred foreground over sharp background.

Also cleanup code to be simpler and remove unused geometry shader.
2018-05-12 23:28:55 +02:00
894639f9a5 Cleanup: BLI_math: Simplify dist_squared_to_projected_aabb functions. 2018-05-12 18:18:32 -03:00
f897d95372 EditMBall: multi-object select random
D3356 by @Quetzal
2018-05-12 22:16:09 +02:00
1422c0650c UI: move pivot to the topbar
Pivot variables are now stored in scene toolsettings.
2018-05-12 22:04:45 +02:00
e0a561be1f UI: move snap & pet options into the topbar
See: T55038
2018-05-12 19:13:38 +02:00
67dda3611f UI: use icons for orientation types
See: T55038
2018-05-12 19:02:38 +02:00
817bb5d40d Remove unused function: BKE_bvhtree_from_mesh_looptri. 2018-05-12 12:05:54 -03:00
7c1171c246 Replace BKE_bvhtree_from_mesh_looptri with BKE_bvhtree_from_mesh_get.
Must have had a conflict in commit rB82d59c6588d7 when merging branchs.
2018-05-12 11:53:27 -03:00
7e74916562 UI: move GL render to view menu
This was taking valuable header room for a rarely used operator.
2018-05-12 15:02:13 +02:00
90b2e4ce28 UI: move orientation to the topbar
Move manipulator toggle to overlay popover.
2018-05-12 14:56:07 +02:00
b4010005de UI: move general mode options to right of topbar 2018-05-12 14:43:29 +02:00
570455fb83 EditMode: multi-object inset
D3305 by @jfmichaud31
2018-05-12 11:01:32 +02:00
d1b969a0cd EditMode: multi-object UV cube project
D3346 by @Cykyrios
2018-05-12 10:09:37 +02:00
ea43130504 EditMode: multi-object UV cylinder project
D3345 by @Cykyrios
2018-05-12 09:59:25 +02:00
c35af3b056 EditMode: multi-object UV sphere project
D3344 by @Cykyrios
2018-05-12 09:59:18 +02:00
f410e83b2c EditMode: multi-object UV reset
D3343 by @Cykyrios
2018-05-12 09:46:35 +02:00
dcc55c89fa Modifiers: port Remesh from DerivedMesh to Mesh
D3331 by @alikendarfen
2018-05-12 09:33:30 +02:00
df2de43459 Modifiers: ported Wave from DerivedMesh to Mesh
D3350 by @alikendarfen
2018-05-12 09:22:34 +02:00
4dc91ebf81 Merge branch 'master' into blender2.8 2018-05-12 08:22:03 +02:00
1813f00b94 Fix missing fallback in recent aabb precalc func
Also comment unused vars
2018-05-12 08:19:20 +02:00
c84b8d4801 Cleanup: modifier arg wrapping 2018-05-12 08:04:56 +02:00
be8add5d50 Refactor: Move functions to get the distance to a projected aabb to BLI_match and remove confusing parameters. 2018-05-11 20:20:51 -03:00
e4f75f97ba Icons: simpler flattened icon style
Update from @billreynish
2018-05-11 22:28:39 +02:00
6aca3e43ec UI: tweaks to icon defaults
Minor changes to fit w/ new icons.
2018-05-11 22:15:05 +02:00
bd30a6350b Cleanup: remove unused RNA variable 2018-05-11 21:57:02 +02:00
f197134426 Platform: macOS. Allow building on directory with whitespace (For example /Volumes/External HD/blender-build) 2018-05-11 21:56:13 +03:00
5503e2565b Bmesh: Clear possible geometry saved at runtime when converting bmesh to mesh. 2018-05-11 15:48:14 -03:00
0a7736a2e9 Tool System: curve draw options 2018-05-11 20:25:01 +02:00
f3f309c7f8 Tool System: inset & shrink/fatten options 2018-05-11 20:24:06 +02:00
9df6978211 Tool System: mesh rip fill option 2018-05-11 20:22:04 +02:00
194cba8ba4 Merge branch 'master' into blender2.8 2018-05-11 20:13:07 +02:00
925e775818 EditMesh: remove duplicate rip macro
Change the fill setting in the keymap,
this allows tool access the macro with either setting.
2018-05-11 20:02:12 +02:00
73a7885ab3 WM: initialize last used macro properties 2018-05-11 20:01:51 +02:00
ef49a587d4 DRW: Add DRW_UNIFORM_FLOAT_COPY and DRW_UNIFORM_BOOL_COPY.
And also use a union instead of forcing the cast to void*.
2018-05-11 19:00:32 +02:00
10b9c86c80 DRW: Add DRW_view_layer_engine_data_ensure_ex. 2018-05-11 19:00:32 +02:00
054d837e65 Modifiers: ported Laplacian Deform DerivedMesh → Mesh
Reviewers: sybren

Differential Revision: https://developer.blender.org/D3326
2018-05-11 18:10:21 +02:00
f998bad211 Fix: Last of the operators from T54811 now work with Copy on Write 2018-05-11 17:44:10 +02:00
d3c4248946 Workbench: StudioLight HDRI's
The Studio lights are now loaded from disk. The location is
`datafiles/studiolights` they need to be JPG for now. JPG cannot store
HDRI color range but they are clamped inside the Workbench
engine for speed reason. I didn't select JP2K as it might not be
enabled.

Users can add upto 20 HDRI files. This limitation is inside the
RNA_space.c Currently the icons are calculated when you first open the
selection box for the HDRI's. We could add them to a background
rendering later.

I added 2 test files a sky texture rendered in Cycles and an HDRI from
cloud.blender.org.
2018-05-11 17:02:13 +02:00
68b736ce24 Modifiers: ported Laplacian Smooth DerivedMesh → Mesh
Reviewers: sybren

Differential Revision: https://developer.blender.org/D3340
2018-05-11 16:52:01 +02:00
625c2c2943 Use Light Probe icons 2018-05-11 16:02:30 +02:00
f3017bbc06 Icon for Light Probes
Including Cubemap, Grid and Planar

Designed by @wevon with minor modifications as part of T53840. Thanks!
2018-05-11 16:02:30 +02:00
66b3f0b4d0 Depsgraph: Fix redundant nodes built when animation shares same action 2018-05-11 15:49:04 +02:00
2f0aca4596 Particle mode: Fix memory leak with simple interpolated children 2018-05-11 15:40:46 +02:00
b5beb660b3 Modifiers: ported UV Project DerivedMesh → Mesh
Reviewers: sybren

Tags: #bf_blender_2.8

Differential Revision: https://developer.blender.org/D3316
2018-05-11 15:30:01 +02:00
2c6e523c1f Dar manager: Ignore non-particle-edit objects from particle mode 2018-05-11 15:12:24 +02:00
aefd181b0b Fix crash going to edit mode of particles with copy on write
We can not rely on edit->psys, it is not set for particle edit,
and there is some logic deeper inside which does different things
dependent on that.

We need to replace those checks with some some HAIR vs. PARTICLES
flag and always set psys pointer.
2018-05-11 14:55:58 +02:00
af5428aa2b Modifiers: ported Screw DerivedMesh → Mesh
Reviewers: sybren

Differential Revision: https://developer.blender.org/D3315
2018-05-11 14:43:37 +02:00
690a5f0e50 Depsgraph: Remove workaround for scene free
No functional changes commit ;)
2018-05-11 14:28:03 +02:00
210bedd7e3 Remove debug only code 2018-05-11 14:24:19 +02:00
624829515a Light Probe type name should be CUBEMAP, not SPHERE.
Change requested by @fclem
2018-05-11 13:41:52 +02:00
f74c604646 Remove unused functions which will break with copy-on-write 2018-05-11 12:49:25 +02:00
d50821f145 Particle edit: Initial support of edit with copy-on-write
The idea is that edit mode structure is owned by original object,
and used for drawing. This is a bit confusing, especially since
path cache is also in that structure and needs evaluated object
to calculate cache.

In the future we should split edit data from visualization data,
but that's bigger refactor.
2018-05-11 12:49:25 +02:00
ff3e9d0d90 Particle edit: Fix missing update after undo
Old code was doing draw-time calculations in some cases.
just do the same for now.
2018-05-11 12:49:25 +02:00
96584818b7 Draw manager: Use explicit edit structure passed in 2018-05-11 12:49:25 +02:00
a55c588559 Depsgraph: Move edit mode pointers trickery to own functions 2018-05-11 12:49:25 +02:00
1c6414dd1b Draw manager: Get number of cached segments from edit
This way we know it's in sync with edit mode.
2018-05-11 12:49:25 +02:00
327789eaf8 Draw manager: Add utility function to check whether particle systems are to be drawn 2018-05-11 12:49:25 +02:00
bac9b04778 Add comment about weird special handling of scene freeing in depsgraph. 2018-05-11 11:36:48 +02:00
20b6eabd42 Fix (unreported) broken freeing code for Sequencer.
Freeing sequencer would always do usercount, which is now forbidden when
called from main ID freeing code.

Annoying in 2.7x, much more critical issue in 2.8!

Also, moved RNA sequencer API functions to proper rna_scene_api.c file.
2018-05-11 11:36:48 +02:00
Dalai Felinto
8b41999ea0 Multi-Object: MESH_OT_loop_to_region by Oleg
Maniphest Tasks: T54643
Differential Revision: https://developer.blender.org/D3253
2018-05-11 11:34:15 +02:00
17ac0e824b Modifiers: ported Corrective Smooth DerivedMesh → Mesh
Reviewers: sybren

Differential Revision: https://developer.blender.org/D3339
2018-05-11 11:27:04 +02:00
Dalai Felinto
badd88ca02 Multi-Object: MESH_OT_screw by Nick Milios
With small changes.

Maniphest Tasks: T54643
Differential Revision: https://developer.blender.org/D3276
2018-05-11 11:25:58 +02:00
d5c1c0b10d Fix (unreported) broken freeing code for Sequencer.
Freeing sequencer would always do usercount, which is now forbidden when
called from main ID freeing code.

Annoying in 2.7x, much more critical issue in 2.8!

Also, moved RNA sequencer API functions to proper rna_scene_api.c file.
2018-05-11 11:23:11 +02:00
Dalai Felinto
eacb2eb423 Multi-Object: MESH_OT_select_loose by Falk David
Maniphest Tasks: T54643
Differential Revision: https://developer.blender.org/D3276
2018-05-11 11:13:09 +02:00
e0a41fd0ce Modifiers: ported Decimate DerivedMesh → Mesh
Two things to indicate (which als apply before the DM → M port):

- Face count in the UI is not updated and stays at 0
- When planar mode is used, the result is inverted (mirrored along X)
  compared to 2.79

Reviewers: sybren

Differential Revision: https://developer.blender.org/D3303
2018-05-11 11:12:28 +02:00
Dalai Felinto
9d0d7c375e Multi-Object-Editing : MESH_OT_rip by Miguel Pozo
Maniphest Tasks: T54643
Differential Revision: https://developer.blender.org/D3266
2018-05-11 10:59:00 +02:00
Dalai Felinto
1fd4449762 Fix memleak on MESH_OT_tris_convert_to_quads 2018-05-11 10:52:46 +02:00
d19c8605f8 Merge branch 'master' into blender2.8 2018-05-11 10:49:58 +02:00
13beeb5892 Fix (unreported) load image code calling icin/preview update from non-Main thread.
Icin/preview only works in main thread, while image loading can be done
from others too... This could have generated random crashes and such.
2018-05-11 10:48:04 +02:00
bcb245bd71 Assign totxxx mesh attributes in BKE_mesh_new_nomain
Reviewers: sybren
2018-05-11 10:37:36 +02:00
4fe5a105f6 Fix bad pointer cast when modifier is used on non-mesh object 2018-05-11 10:14:35 +02:00
b726ff4fc4 EditMesh: multi-object triangle fill
D3336 by @nabbydude
2018-05-11 08:41:04 +02:00
1d8e6c5cd0 EditMesh: multi-object select ungrouped
D3295 by @philippe-bachour
2018-05-11 08:21:26 +02:00
f2b5de6893 Cleanup: whitespace 2018-05-11 08:21:26 +02:00
6d155dc462 T54983: Bone selection overlay
Bone selection overlay is only available in pose mode.
and when active overrules the selection buffer.

This is currently `tricked` by switching the draw engines, but this is
an exception. Not sure how to solve this in a better way.

After this is solved we can look at how to localize the dim effect to only the objects connected to the active armatures. Currently it dims the whole screen (including background).

@campbellbarton I added you as reviewer as it you have done a lot in the DRW_draw_select_loop

Reviewers: campbellbarton, fclem

Reviewed By: fclem

Subscribers: campbellbarton

Tags: #bf_blender_2.8, #code_quest

Maniphest Tasks: T54983

Differential Revision: https://developer.blender.org/D3241
2018-05-11 08:17:05 +02:00
266638d783 EditMesh: multi-object recalculate normals
D3298 by @leonlg
2018-05-11 08:08:01 +02:00
e161c51e7f EditMesh: multi-object select_interior_faces
D3334 by @ThaRemo
2018-05-11 07:59:16 +02:00
b5823c25f8 Cleanup: whitespace 2018-05-11 07:55:41 +02:00
33f3298e28 Cleanup: use 'uint' in draw manager 2018-05-11 07:48:52 +02:00
df10a2e030 Cleanup: style 2018-05-11 07:47:25 +02:00
83a83a3d4b Cleanup: whitespace, duplicate includes 2018-05-11 07:43:20 +02:00
8c96cb55c3 Fix add-manipulator cursor plane calculation
Now use the closest plane facing the view z axis.
2018-05-10 23:06:55 +02:00
be1af8d44c Fix error building 2018-05-10 21:43:15 +02:00
66636e665b Cleanup: Remove redundant parameter. 2018-05-10 16:32:13 -03:00
15580470fd Paint Stroke: Fix strokes drawing. 2018-05-10 16:29:14 -03:00
3f3326af1c EditMesh: add cube interactive tool
Initial add-cube tool which uses the scale cage to resize.

The 3D cursor is currently used to project the cursor onto.

We'll likely have more orientation options in the future.
2018-05-10 20:31:10 +02:00
4332edcc3e Cleanup: warning 2018-05-10 20:31:10 +02:00
d6a7491e78 Make current frame indicator smaller with rounded corners.
Reviewed by Joshua Leung
2018-05-10 19:42:21 +02:00
5df0fed47c Timeline Header Cleanup - Part 3: Consolidate options in a "Playback" popover
The "Playback" popover now combines options from several old menus
and scattered around in other places.
2018-05-10 19:28:37 +02:00
1ac0b4e2ba Timeline Header Cleanup - Part 2: Rearrange buttons (WIP)
NOTE: This is all still heavily WIP, and still requires some additional
layout engine magic to make it all nice.

* Moved current frame, and start/end frame buttons to the end
* Put playback controls in the center
* Remove other more obscure buttons (e.g. Frame menu, lock frame to frame range)

More to follow in next commit...
2018-05-10 19:28:36 +02:00
176cb0c3f8 Timeline Header Cleanup - Part 1: Move Keying Set + Autokeying Settings to Properties Region (NKEY)
Now all Keying Set and Auto Keyframing settings can be found the in NKEY
Properties Region (right-hand-side hidden tab/drawer).

This way, we have more room to display the full names of the settings,
without clogging up the timeline header.
2018-05-10 19:28:36 +02:00
e4c7cef748 Cleanup: warnings 2018-05-10 19:10:16 +02:00
334b1cf92f Cleanup: warnings 2018-05-10 19:07:03 +02:00
55389d4899 Transform: Make snapDerivedMesh use bvhtrees from loose edges and bvhtrees from loose verts.
Bvhtrees take up a lot of memory space, reusing the common bvhtree of looptris to snap to vertices and edges is a good way to save memory.
Unfortunately we have a worsening performance in the snapping operation around 63% (addition to the original time).
But as we often do not need to build a bvhtree of loose verts and loose edges, we have an improvement in cache time :)

Since the CPU time of snapping operations (no matter how higth poly the object is) corresponds to less than 0.01% of all CPU time of a blender frame, that change is not really significant.

Snapping operations on a mesh in edit mode have not changed significantly.

Signed-off-by: Germano <germano.costa@ig.com.br>
2018-05-10 13:40:30 -03:00
a35b9cc302 BKE: bvhutils: Added support for bvhtrees from loose verts and bvhtree from loose edges 2018-05-10 13:35:48 -03:00
be400a0789 UI: Fix time cursor number box styling for Clip Editor's Dopesheet/Graph views 2018-05-10 17:56:12 +02:00
c20cc3cf14 Merge branch 'master' into blender2.8 2018-05-10 14:27:24 +02:00
27da2db0ca 3D View: utility to get matrix from cursor 2018-05-10 12:24:07 +02:00
e6814acf13 Manipulator: API call to invoke on setup
Needed for manipulators that start out interactive,
similar use-case to modal operators, except these can be tweaked after.
2018-05-09 22:43:24 +02:00
80c9cd13da Manipulator: support direct cage3d adjustment
Scale cage relied on transform code,
this adds support for the manipulator corners being modified directly.
2018-05-09 22:37:09 +02:00
d824c80e9f Cleanup: Remove redundant bvh_cache initialization. 2018-05-09 13:28:59 -03:00
37cec42e3d Clay: Cleanup, reduce indentation level 2018-05-09 16:45:04 +02:00
2d5fe40601 Eevee: Cleanup, use NULL instead of static matrix
Those are the same thing now. So no need to keep initializing matrix
over and over.
2018-05-09 16:42:15 +02:00
cb747302dc Correct previous commit 2018-05-09 16:38:38 +02:00
734a232b39 Eevee: Cleanup, reduce indentation level 2018-05-09 16:36:09 +02:00
51445f42ac Workbench: Make hair populating function shorter and nicer 2018-05-09 16:21:24 +02:00
dda7b82dd7 Depsgraph: Tag object for copy-on-write update when toggling particle edit mode 2018-05-09 16:21:24 +02:00
5d71399c04 Depsgraph: Remove particle edit code from evaluation
Everything seems to be working without this, which makes since there is no
evaluation-time edit code in master. The only tricky part here would be that
this means we might want to ensure edit structure exists from inside particle
mode in draw manager.

Other point for not having this code in evaluation is that it's possible to
have same object evaluated in different contexts at the same time, and since
edit structures are supposed to be in original object we might run into
threading conflict.
2018-05-09 16:21:24 +02:00
c7ef9969b9 Particle edit mode: Make selection settings to work with CoW 2018-05-09 16:21:24 +02:00
Dalai Felinto
1ce1ae3d32 Rename: RNA_property_override_status > RNA_property_static_override_status 2018-05-09 16:18:02 +02:00
c67a0580fc Modifiers: ported Triangulate DerivedMesh → Mesh
Reviewers: sybren

Differential Revision: https://developer.blender.org/D3237
2018-05-09 16:14:22 +02:00
Dalai Felinto
828a3d89b3 Fix T55015: Crash on selection after recent BVH changes
Runtime data should always be initialized to NULL on read-time.
2018-05-09 15:53:16 +02:00
0385b33f0b Fix broken 'check/validate libs' code with indirect libs.
Readcode always set relative paths of indirectly linked libs relative to
*current* .blend file, not to the library using it.

But BKE_library_filepath_set was then setting them relative to their
parent library, breaking checking code (and saved files even :((( ).
2018-05-09 15:52:29 +02:00
ed23bd5f3c Modifiers: ported Boolean DerivedMesh → Mesh
Reviewers: sybren

Differential Revision: https://developer.blender.org/D3236
2018-05-09 15:49:55 +02:00
8b4127abda Expanded BMALLOC_TEMPLATE_FROM_ME to accept two meshes 2018-05-09 15:44:49 +02:00
03fc491048 Outliner: move filter options to popover. 2018-05-09 15:17:17 +02:00
d3b80c4734 T55014: Optionally: objects not cast shadows in workbench 2018-05-09 15:14:43 +02:00
e8d9b7c954 Merge branch 'master' into blender2.8 2018-05-09 15:08:13 +02:00
6f891e2b87 Draw manager: Implement point selection modes for particle edit mode 2018-05-09 15:00:29 +02:00
5cea8bf435 Draw manager: Initial implementation of key points visualization
Does all points all the time, ignoring the setting in viewport header.
This is to be addressed by the next commit.
2018-05-09 14:59:48 +02:00
033c2c7131 Draw manager: Start using more explicit API for particle edit mode 2018-05-09 14:59:48 +02:00
65b0d31eb8 Modifiers: ported Hook DerivedMesh → Mesh
Differential Revision: https://developer.blender.org/D3235
2018-05-09 14:45:27 +02:00
69f2305415 Fix T54992: Lattice modifier on another Lattice object does not take the
Influence vertexgroup into account
2018-05-09 14:41:25 +02:00
0353ff5d2f BKE_id_free(): avoid UI and DEG calls when tagged with LIB_TAG_NO_MAIN
This prevents threading issues & crashes from modifiers that create
temporary meshes.
2018-05-09 14:40:03 +02:00
03abe89661 Merge branch 'master' into blender2.8 2018-05-09 14:37:25 +02:00
b73c7381cc EditMesh: multi-edit merge
D3226 by @pragma37

Note: edited so first/last option only applies to active mesh
since this doesn't make much sense to apply across objects.
2018-05-09 14:34:06 +02:00
34c474e695 Fix T54997: simple typo in property description 2018-05-09 14:26:47 +02:00
e65a2cb52c Fix crash moving grease pencil frames 2018-05-09 14:09:05 +02:00
5173861766 Cleanup: unused vars 2018-05-09 14:08:56 +02:00
5de2cd8ca7 Cleanup: quiet shadow warning 2018-05-09 13:53:01 +02:00
Dalai Felinto
e42b8c32ab Multi-object edit: MESH_OT_beautify_fill by Remi van der Laan
Maniphest Tasks: T54643, T54641
Differential Revision: https://developer.blender.org/D3291
2018-05-09 13:48:01 +02:00
Dalai Felinto
df49155cfb Multi-object edit: MESH_OT_loop_multi_select by Oleg
Maniphest Tasks: T54643
Differential Revision: https://developer.blender.org/D3245
2018-05-09 13:41:33 +02:00
c0667c2f35 T55008: Migrating RE-Collection data to Scene data
in Scene DNA is available in scene.display New DNA Struct DisplayData
Added RNA (scene.display).

We already have scene.display_settings which contains non viewpoert
specific color management settings. I did not merge those two.

Patch should be in line with the ideas that @brecht wrote in T55008.

As I am not in detail aware of the decisions that have been made for the override feature I want a short review if it is in line with the plans.

Reviewers: brecht, dfelinto

Reviewed By: brecht

Subscribers: brecht

Tags: #code_quest, #bf_blender_2.8

Differential Revision: https://developer.blender.org/D3290
2018-05-09 13:38:06 +02:00
Dalai Felinto
56d65719b3 Multi object edit: MESH_OT_region_to_loop by Oleg
Maniphest Tasks: T54643
Differential Revision: https://developer.blender.org/D3248
2018-05-09 13:03:44 +02:00
Dalai Felinto
dcf1210c44 Multi-Object Pose: POSE_OT_select_parent by Harsha
Differential Revision: https://developer.blender.org/D3283
2018-05-09 12:53:22 +02:00
74234688de Modifier stack: ShrinkWrap: move to mesh-based BVHTree code.
Now only subsurf still needs some DM...
2018-05-09 12:51:53 +02:00
aab5ac25f2 Remove Frame Server
This feature is limited (only byte PPM output, no multi-view),
only works with specific configurations.

This also causes some maintenance overhead
when testing changes to the render pipeline.
2018-05-09 12:50:26 +02:00
e53cf14280 Cleanup/refactor: Move get_mesh_eval_for_modifier from MOD_util to BKE_modifier.
Because some modifiers' actual code is in BKE... Also renamed to more
BKE-valid name BKE_modifier_get_evaluated_mesh_from_object.
2018-05-09 12:47:23 +02:00
1cc7d7d5ec Surface Deform mod: removed some stuff that shouldn't have been committed 2018-05-09 12:41:32 +02:00
2862b58a38 Mesh Deform modifier: also show result while editing the deformation mesh
There is still an issue with the modified mesh not being updated until you
disable and re-enable the modifier. However, after that it'll now also work
while editing the deformation mesh.
2018-05-09 12:39:52 +02:00
b586c81fbc Fix (unreported) bug in BVHTree 'free tessfaces' flag setting.
Same issue as in DM-based on, so follow up of rBf3efa9e15f58...
2018-05-09 12:36:05 +02:00
21298978f6 Merge branch 'master' into blender2.8 2018-05-09 12:35:16 +02:00
f3efa9e15f Fix (unreported) bug in BVHTree 'free tessfaces' flag setting.
Could lead to atempt to free NULL pointer, and/or memory leak.
2018-05-09 12:33:21 +02:00
632755a3b1 Modifiers: ported Surface Deform to Mesh
The modifier performed the 'bind' operation not in the bind operator,
but delayed in the mesh evaluation. This saved the result in a CoW copy
instead of in the actual modifier data. The binding operator now follows
the same approach as Mesh Deform: it forces the modifiers to run on the
real (non-CoW) data, making it possible for the modifier to store the
binding data.

This commit also ports the usage of DerivedMesh to Mesh.
2018-05-09 12:17:24 +02:00
Dalai Felinto
5e915baec4 Multi-Object-Editing: MESH_OT_separate by Nick Milios
Patch description:

- Reports "Nothing selected" only when all objects has no selection
  and it is in  Separate type(Mode)
- Tested all types (Seperate/By Material/By loose parts)
- Instead of using

```
BKE_view_layer_array_from_objects_in_edit_mode_unique_data
```

I used

```
BKE_view_layer_array_from_bases_in_edit_mode_unique_data
```

Because it needs the "Base" not the "Object" itself.

Maniphest Tasks: T54643
Differential Revision: https://developer.blender.org/D3267
2018-05-09 12:13:09 +02:00
Dalai Felinto
944054fbb6 Multi-Object-Editing: MESH_OT_vert_connect by Nick Milios
With changes: Skip loop when totvertsel is not 2

Maniphest Tasks: T54643
Differential Revision: https://developer.blender.org/D3273
2018-05-09 11:48:39 +02:00
Fulk33
ab8dded330 EditMesh: multi object spin support by Falk David
Maniphest Tasks: T54643
Differential Revision: https://developer.blender.org/D3279
2018-05-09 11:33:46 +02:00
0d4b165d4f Merge branch 'master' into blender2.8 2018-05-09 11:25:35 +02:00
b59b812400 MSVC: resolve near/far issue take2
Previous fix failed w/ compositor,
tested on MSVC2015, full build.
2018-05-09 11:23:32 +02:00
Dalai Felinto
1cbe3b6e03 Multi-Object-Editing : Support for Grid Fill by Falk David
With minor changes:
* Have BMOperator declaration close to its initialization.
* Move const use_prepare and const use_interp_simple outside the for loop.

Maniphest Tasks: T54643
Differential Revision: https://developer.blender.org/D3222
2018-05-09 10:53:38 +02:00
Dalai Felinto
dd93c80747 Multi-Object-Editing: MESH_OT_edges_select_sharp by Jefferson Rausseo
Maniphest Tasks: T54643
Differential Revision: https://developer.blender.org/D3280
2018-05-09 10:39:35 +02:00
49fc1d0f54 Draw manager: Initial implementation of particle edit mode
Gets edit more from the current object and displays it as a path.
this is how both hair and particle edit modes are supposed to work.

This only covers path itself, it doesn't do anything like keys
visualization or selection. However, it's already possible to
comb and such.

Only implements particle mode. There are also some settings to
do soft body and cloth. No idea yet what that all is about.

Copy-on-write is not supported either, this is due to some
edit mode ownership problems which are to be addressed from
dependency graph side.

Shading is dead-simple: uses tangent as a color. This is where
i hope to get some help from Clément.
2018-05-09 10:34:45 +02:00
afdc5c148b Draw manager: Use utility function to get particle edit mode
Makes it more local where we have to do all the tricky checks.
2018-05-09 10:34:45 +02:00
43c6ba9eed Draw manager: Add support for cached particle edit paths
Before it was only supporting hair strand paths editing.
2018-05-09 10:34:45 +02:00
25eb6d01f5 Draw manager: Correct edit mode check for particles 2018-05-09 10:34:45 +02:00
283158ecc1 Draw manager: Ignore particles when object is in particle edit mode 2018-05-09 10:34:45 +02:00
9c1c6d89a1 Draw manager: allow creation of hair batch cache from edit mode 2018-05-09 10:34:45 +02:00
b150c497dc Draw manager: De-duplicate segment counting 2018-05-09 10:34:45 +02:00
5e1445e374 Draw manager: Completely de-duplicate strands caching for parent and particles
Will make it simple to add strands from edit mode as well.
2018-05-09 10:34:45 +02:00
17d13e4107 Draw manager: Move parent particle cache fill into an own function
Should make it fairly simple to make it re-usable by children particles.
2018-05-09 10:34:45 +02:00
81e6aa1600 Draw manager: Use single function to calculate particles UVs
Will allow us to merge two code paths more easily.
2018-05-09 10:34:45 +02:00
ca5c3f767c Draw manager: Move emit_from checks to interpolation functions
Keeps main function shorter.
2018-05-09 10:34:45 +02:00
0868ccae13 Draw manager: Move UVs interpolation of child particles to a function 2018-05-09 10:34:45 +02:00
e3eaca976a Draw manager: De-duplicate calculation of parent UVs 2018-05-09 10:34:45 +02:00
cf043d51c2 Draw manager: Make parent and child particles code to be more equal
Make parent UVs calculation for simple children to match another block.
2018-05-09 10:34:45 +02:00
94553750c7 Draw manager: More meaningful variable name 2018-05-09 10:34:45 +02:00
ecc24242bb Draw manager: Reduce indentation level in particle batch populate 2018-05-09 10:34:45 +02:00
Dalai Felinto
6539c1fc41 Multi-Object-Editing : Support for MESH_OT_rip_edge by Miguel Pozo
Maniphest Tasks: T54643
Differential Revision: https://developer.blender.org/D3268
2018-05-09 10:30:49 +02:00
d152a326f9 Modifier stack: remove last usage of DM in WeightVGProximity . 2018-05-09 10:11:10 +02:00
Dalai Felinto
4da2aec2bb Multi-Object-Editing: select_non_manifold by Jefferson Rausseo
Maniphest Tasks: T54643
Differential Revision: https://developer.blender.org/D3232
2018-05-09 10:04:35 +02:00
a92557f77b Merge branch 'master' into blender2.8 2018-05-09 10:02:33 +02:00
598216c36e MSVC: remove hack for near/far name collision
windows headers define these, conflicting w/ View3D.near/far.
2018-05-09 10:00:55 +02:00
80844fdfc0 Color: Combine/Separate YCbCrA node default to rec. 709
This commit is part of T54798

Differential Revision: https://developer.blender.org/D3183
2018-05-08 22:24:58 -04:00
2d2875fc15 BKE: bvhutils: Always return NULL when the BVHtree has no leafs.
BLI_bvhkdop functions were not made to work with zero-leaf trees.
Perhaps a better solution would be to modify BLI_bvhkdop to work with zero leaf trees.
But this solution of returning NULL was already used for bvhtrees of looptris.
2018-05-08 20:31:26 -03:00
d1cd872fef ED_transform: Port ED_transform_snap_object to new Mesh-based system.
Differential Revision: https://developer.blender.org/D2896
2018-05-08 20:04:32 -03:00
7fd19bcbe1 BKE: bvhutils: Port bvhtree_from_mesh_get to take a Mesh param instead of a DerivedMesh.
Differential Revision: https://developer.blender.org/D3227
2018-05-08 20:00:51 -03:00
579c01da60 Extrude Widget: with/without axis constraint 2018-05-08 20:30:29 +02:00
b7b59a72f3 Extrude Widget: tweak draw style
Use filled circle for redo
2018-05-08 20:30:29 +02:00
4f213c1495 Cleanup: naming (prefer len over num for new code) 2018-05-08 19:36:02 +02:00
305c455ffe Cleanup: mesh_runtime naming
- BKE_mesh_get_looptri_num        -> BKE_mesh_runtime_looptri_len
- BKE_mesh_runtime_recalc_looptri -> BKE_mesh_runtime_looptri_recalc
- BKE_mesh_get_looptri_array      -> BKE_mesh_runtime_looptri_ensure
2018-05-08 19:26:36 +02:00
65ae4e27b0 Missed last commit 2018-05-08 19:16:33 +02:00
6e88075618 Merge branch 'master' into blender2.8 2018-05-08 19:15:58 +02:00
9a055d1abc Modifier stack: partial port of ShrinkWrap to new Mesh-based system.
Partial only, complete depends on BVHTree helper updates, and subsurf
updates.
2018-05-08 19:04:12 +02:00
f7727b5366 Modifier stack: Port Warp to new Mesh-based system. 2018-05-08 18:41:43 +02:00
8f7e4b314b Modifier stack: port Mask to new Mesh-based system. 2018-05-08 18:19:28 +02:00
e0a436fcff Cleanup: includes 2018-05-08 18:01:47 +02:00
0012082c10 Cleanup: move mesh conversion into own function 2018-05-08 17:54:25 +02:00
5f2a2e048d Modifier stack: Port Caqst to new Mesh-based system. 2018-05-08 17:52:53 +02:00
e6d11c6ce6 Collections: remove per collection and view layer engine overrides.
This will be handled by the new view layer override system which will
store data elsewhere, removing the code already for easier refactoring.
2018-05-08 17:46:20 +02:00
03dd109a84 Cleanup: consistent BKE_mesh naming 2018-05-08 17:28:43 +02:00
00127d03f1 Cleanup: use bool for BKE_mesh_new_from_object 2018-05-08 17:17:40 +02:00
7522af49a3 Cleanup: rename variables
DerivedMesh had some odd conventions, remove from BKE_mesh.
2018-05-08 17:15:23 +02:00
0e964afaa4 Cleanup: use 'nomain' when not in library data
Rename only.
2018-05-08 17:06:30 +02:00
fa69ce9e3a Cleanup: whitespace, duplicate includes 2018-05-08 16:57:07 +02:00
5b3559576d Modifier stack: Port Smooth to new Mesh-based system. 2018-05-08 16:42:01 +02:00
43be434310 Merge branch 'master' into blender2.8
Conflicts:
	source/blender/modifiers/intern/MOD_dynamicpaint.c
	source/blender/modifiers/intern/MOD_uvproject.c
2018-05-08 16:06:32 +02:00
4e4a93bc45 Fix building with latest versions of ffmpeg.
Some years-old deprecated stuff has now been removed.

Correct solution is probably to use valid defines etc. in own code, but
this is more FFMEPG maintainer task (since it also may change how old
FFMPEG we do support...).
2018-05-08 16:00:52 +02:00
a48186c5d7 Orientation for 3D cursor
Currently set when setting the cursor location,
optionally used as an orientation type.

Intended for use by tools too.

See: D3208
2018-05-08 15:35:04 +02:00
43e0e8defa Fix (unreported) bloody modifiers messing with ID user count in copy.
User count of IDs is handled by higher-level, generic function,
low-level copydata functions *MUST NOT* touch them anymore, ever!
2018-05-08 15:27:10 +02:00
53a56b7b6c Merge branch 'master' into blender2.8 2018-05-08 15:20:18 +02:00
3740f7593d Cleanup: Nuke empty dummy wrappers around modifier_copyData_generic().
This also changes signature of modifier copy callback, first (source)
parameter is now a const, which is saner anyway!
2018-05-08 15:04:10 +02:00
d89f9d70c5 Eevee: Fix bug with transparent object + volume rendering.
This was because the main_fb was not bound back to be updated.
Following draw calls were drawn without depth buffer.
2018-05-08 14:31:17 +02:00
b857b8f4c4 Merge branch 'master' into blender2.8 2018-05-08 14:22:46 +02:00
49fe27ee46 Modifiers: sanitize/cleanup modifiers' copying & freeing code.
Should also fix T55000: Crash with hooks and curves in Cycles render.
2018-05-08 14:22:14 +02:00
cc8672b95e Fix T54999: error when entering edit mode in texture shading
When entering edit mode the texture coordinates is not calculated by
drawcachemesh. For now fallback to solid mode. This gives wrong
artifacts when disabling overlays when in edit mode. We should make it
possible to calculate the UVLOOP from bmesh. This will be done in a next
patch
2018-05-08 14:02:45 +02:00
e04ea9d3c3 Merge branch 'master' into blender2.8 2018-05-08 13:33:48 +02:00
5358026511 Cleanup: quiet -Warray-bounds warning 2018-05-08 13:32:52 +02:00
c51b017a1a WeightVG modifiers: Cleanup, add asserts to validate expected data status... 2018-05-08 12:58:48 +02:00
7d9f1a699a Clenup: typos. 2018-05-08 12:58:48 +02:00
002dcd2001 Modifiers: pass the ob->data to the modifier if the mesh param is NULL
This enables the modifiers to access things like vertex groups. Care should
be taken to not modifier the mesh itself in this case.
2018-05-08 12:34:06 +02:00
9a79178c2e Armature: Add back Stick bone draw type.
The actual code is a bit convoluted but allows good and "pseudo efficient"
drawing. (pseudo efficient because rendering instances with that amount of
vertices is really inneficient. We should go full procedural but need to
have bufferTexture implemented first) But drawing speed is not a bottleneck
here and it's already a million time less crappy than the old (2.79) immediate
mode method.

Instead of drawing actual wires with different width we render a triangle
fan batch (containing 3 fans: bone, head, tail) which is then oriented in
screen space to the bone direction. We then interpolate a float value
accross vertices giving us a nice blend factor to blend the colors and
gives us really smooth interpolation inside the bone.

The outside edge still being geometry will be antialiased by MSAA if enabled.
2018-05-08 12:18:35 +02:00
d8706f5407 Modifier stack: port Displace to new Mesh-based system. 2018-05-08 12:01:06 +02:00
cd5b57b4fc Fix recent Curve porting: mesh pointer may also be NULL in non-EditMode case. 2018-05-08 12:01:06 +02:00
0cd3412d4c Mod_util: Add back vcos parameter to get_texture_coords_mesh().
Now we use vcos when provided, and fall back to mesh vertices' co
otherwise.

Deform modifiers usually do not have up-to-date coordinates in Mesh
itself, only in given vcos array!
2018-05-08 12:01:06 +02:00
029d3fa8b6 Mesh normals: clear runtime dirty normal flag also when computing clnors. 2018-05-08 12:01:06 +02:00
1d95dfc97b Merge branch 'master' into blender2.8 2018-05-08 11:59:22 +02:00
59ce30f32b Tracking: Use bmain from context 2018-05-08 11:58:42 +02:00
9401021f8b Clay: Simplify matcap manipulation
No need to hard-coded handling of every individual matcap.

They are in the continuous index range anyway.
2018-05-08 11:56:58 +02:00
1fd1d061ac Clay: Don't use hardcoded constant in the string
Stringify the actual constant instead.
2018-05-08 11:56:58 +02:00
Dalai Felinto
847f028b71 Multi-Object-Editing: select random by Jefferson Rausseo with changes
Aside from identation, seed should change for each object. Otherwise to objects
with a copied mesh would get the exactly same "random" selection.

And we do so in a consistent way so it doesn't vary depending on
object order.

Seed bump using hash suggested by Campbell Barton and Sergey Sharybin.

Maniphest Tasks: T54643
Differential Revision: https://developer.blender.org/D3231
2018-05-08 11:51:21 +02:00
1c0be0e90f Ported Mesh Deform modifier
This modifier still has issues that are not related to this port:

- While editing the deformation mesh, the deformed mesh doesn't update.
  This update only happens after exiting edit mode, making editing
  cumbersome.
- Binding doesn't work yet. It works fine when binding in master and
  loading pre-bound in 2.8. This was also an issue before this port, and
  will be investigated separately.
2018-05-08 11:46:28 +02:00
abb58eec53 looptri + bvhtree support for Mesh 2018-05-08 11:36:48 +02:00
Dalai Felinto
d915aa57f8 Multi-Object-Editing: vertices smooth by Jefferson Rausseo
Changes by me:
* Identation (tabs not space)
* Moving RNA_.*_get outside for loop)

Maniphest Tasks: T54643
Differential Revision: https://developer.blender.org/D3230
2018-05-08 11:33:27 +02:00
Dalai Felinto
9a125ca5fe Multi-Object-Editing : Extrude Repeat by Falk David
Maniphest Tasks: T54643
Differential Revision: https://developer.blender.org/D3224
2018-05-08 11:24:41 +02:00
271624b0f6 Prevent segfault when opening file browser while a 2.79 file was loaded.
Loading a file that was written with the master branch into the 2.8 branch,
and then trying to load or save, caused a segfault.
2018-05-08 11:18:45 +02:00
Dalai Felinto
faaffc4011 Edit Mesh: multi-object rotate_uvs support by Pablo Dobarro
Changes by me: Moving RNA_.*get outside for loop and indentation fix.

Maniphest Tasks: T54643
Differential Revision: https://developer.blender.org/D3221
2018-05-08 11:15:00 +02:00
Dalai Felinto
63951bc987 Edit Mesh: multi-object reverse_uvs support by Pablo Dobarro
Maniphest Tasks: T54643
Differential Revision: https://developer.blender.org/D3220
2018-05-08 11:09:35 +02:00
fdc967e616 Modifiers stack: port Curve to new Mesh-based system. 2018-05-08 11:05:49 +02:00
50e31136fd Rename BKE_bmesh_to_mesh to BKE_bmesh_to_mesh_nomain.
Let's be clear about functions generating datablocks outside of Main
database.
2018-05-08 11:04:20 +02:00
cf7c3462ed BKE_mesh_new → BKE_mesh_new_nomain
Including 'nomain' in the name explicitifies that the returned mesh is
NOT stored in any library.
2018-05-08 11:00:34 +02:00
86b9311926 Cleanup: quiet warning, whitespace 2018-05-08 10:58:04 +02:00
77cc265f18 Fix crash cancelling search, caused by D3207 2018-05-08 10:48:53 +02:00
66b1cd45fb Added BKE_mesh_ensure_normals()
This calls BKE_mesh_calc_normals() only if the mesh vertex normals are
marked as dirty.
2018-05-08 10:47:00 +02:00
42dfbf79c3 Added BKE_mesh_new()
This function creates a Mesh struct with a number of vertices/edges/etc.
It allocates the minimal number of CD layers needed.

Currently not yet used, but will be soon in the upcoming
BKE_new_mesh_from_curve_displist().
2018-05-08 10:47:00 +02:00
Dalai Felinto
f309c34cfe Multi-Object-Editing : Support for MESH_OT_solidify by Lucas Boutrot
Maniphest Tasks: T54641, T54643
Differential Revision: https://developer.blender.org/D3218
2018-05-08 10:40:30 +02:00
Dalai Felinto
a0a78f6da4 Multi-Object-Editing Support for MESH_OT_wireframe by Lucas Boutrot
Maniphest Tasks: T54641, T54643
Differential Revision: https://developer.blender.org/D3217
2018-05-08 10:35:51 +02:00
Dalai Felinto
9fc0c0c3de Edit Mesh: multi-object faces_shade_flat support by Pablo Dobarro
Maniphest Tasks: T54643
Differential Revision: https://developer.blender.org/D3219
2018-05-08 10:13:44 +02:00
Dalai Felinto
853e55b043 Multi-Object Editing: subdivide edgering support by Henry @Skippi
Maniphest Tasks: T54643
Differential Revision: https://developer.blender.org/D3215
2018-05-08 10:07:29 +02:00
Dalai Felinto
848d9cda0e Multi object editing - face dissolve support by Mateusz Grzeliński
Maniphest Tasks: T54643
Differential Revision: https://developer.blender.org/D3214
2018-05-08 09:51:55 +02:00
65e3af35b0 Extrude Widget: subscribe to operator settings
Needed so changing orientation refreshes.
2018-05-08 09:21:19 +02:00
b626360857 Add note about compat code in uber eval causing modifiers to be applied twice 2018-05-08 02:47:49 -04:00
6feb6235e1 WM: log message bus operations 2018-05-08 08:34:06 +02:00
6f57d12e2e Merge branch 'master' into blender2.8 2018-05-08 07:53:48 +02:00
433aaa8c2e Cleanup: remove unused wmReport struct 2018-05-08 07:52:13 +02:00
05ec0108dc WM: refresh tool on object mode switch
The tool manipulator could become disabled when set in the wrong mode.
2018-05-08 07:27:53 +02:00
469d43b1db WM: publish Object.mode changes on mode switching 2018-05-08 07:22:52 +02:00
bf593a8631 WM: quiet GCC redundant declaration warnings 2018-05-08 07:18:49 +02:00
Dalai Felinto
7f5c469716 Multi-Object-Editing : Support for Edge Dissolve by Lucas Boutrot
With minor indentation changes by me.

Maniphest Tasks: T54643
Differential Revision: https://developer.blender.org/D3211
2018-05-07 21:57:36 +02:00
Dalai Felinto
5f59a8bb11 Multi object editing - verticle dissolve support by Mateusz Grzeliński
With changes by me:
* Indentation (tabs)
* Removing RNA_boolean_get tests out of the for loop.
* Continue iterator if no selected vertice.

Maniphest Tasks: T54643
Differential Revision: https://developer.blender.org/D3210
2018-05-07 21:50:20 +02:00
eefaec4114 Extrude Widget: Add orientation to topbar
Add extrude operator that's intended to work on the current selection
and be activated as a tool.
2018-05-07 21:40:51 +02:00
170223804b Extrude Widget: orient correctly w/ rotated object 2018-05-07 21:40:51 +02:00
036eb6f2f8 Extrude Widget: don't show when moving 2018-05-07 21:40:51 +02:00
50e28092d3 Cleanup: style 2018-05-07 21:40:51 +02:00
Dalai Felinto
e4c4e8566f Multi Object Smooth shading by Ethan Brierley
With small changes by Dalai Felinto.

Differential Revision: https://developer.blender.org/D3213
2018-05-07 21:30:29 +02:00
3299b0f0dc Fix: Select all didnt' work with COW pose bones 2018-05-07 19:03:36 +02:00
da89fac348 Update Flatty Light theme with topbar and minor tweaks 2018-05-07 18:46:40 +02:00
3c79043f1b DRW: Fix incorrect blending function reset. 2018-05-07 18:29:45 +02:00
3800be695b Modifier stack: move vgroup editing modifiers to new Mesh-based system.
Some notes here:
* Proximity with non-mesh objects (like curve, see TEST_2 scene in
weightvg testfile) are not working currently. This is known TODO of COW
depsgraph project.
* Proximity modifier is slower, due to some other TODO pending on
BVHTree creation/caching for Mesh.
2018-05-07 18:18:05 +02:00
15f9ca05d1 Modifier stack: add new get_texture_coords_mesh() helper.
Will eventually fully replace get_texture_coords().
2018-05-07 18:18:05 +02:00
ac6d59db69 Fix ARMATURE_OT_layers_show_all now works with COW 2018-05-07 18:06:22 +02:00
56f7b4616a Merge branch 'master' into blender2.8 2018-05-07 18:04:16 +02:00
b49184b608 Merge branch 'master' into blender2.8 2018-05-07 18:02:48 +02:00
c09e22306a Fix (unreported) memleak when copying object with some modifiers. 2018-05-07 17:59:23 +02:00
f62b826533 Merge branch 'master' into blender2.8 2018-05-07 17:54:10 +02:00
f74d85ffc8 Cleanup: rename char/float conversion functions
- FTOCHAR       -> unit_float_to_uchar_clamp
- F3TOCHAR3     -> unit_float_to_uchar_clamp_v3 (swap args)
- F4TOCHAR4     -> unit_float_to_uchar_clamp_v4 (swap args)
- FTOUSHORT     -> unit_float_to_ushort_clamp
- USHORTTOUCHAR -> unit_ushort_to_uchar
2018-05-07 17:51:40 +02:00
905eeb0bc7 Cleanup: move unit char/short/float to functions
This caused GCC 8.1 to crash at build time,
but was also not very nice use of macros.
2018-05-07 17:50:25 +02:00
b0b2a47853 Armature: Transparent Bone: Fix envelope not being alpha blended. 2018-05-07 17:12:04 +02:00
8ab3697e21 Armature: Add new Transparent Bone overlay option.
This is half the replacement of the old wireframe mode. It's not doing any
XRay drawing at the moment.
2018-05-07 17:00:10 +02:00
2f76e95b96 DRW: Do not multiply alpha or color by alpha if not in blend more. 2018-05-07 17:00:10 +02:00
29c650c3cc DRW: Add DRW_pass_state_add and DRW_pass_state_remove 2018-05-07 17:00:10 +02:00
6c2588761c Fix: Left in debug prints 2018-05-07 16:55:13 +02:00
e7eee7764a Fixes for motion path evaluation (part of T54810 work)
This commit brings back motion path calculations working on same level
as 2.7x.  Caveats:
* You cannot actually see anything, as all the drawing code for motion
  paths was removed and not reimplmented in 2.8 draw engines yet
* This doesn't actually use a separate depsgraph instance for fast
  background calculations yet. That's a separate topic, and will require
  further investigation (probably after code quest, according to original
  planning).
* The work here *does* however pave the path forwards towards fully separate
  COW evaluation though. We only need to stub in a different depsgraph instance
  here to get things working.
2018-05-07 16:52:51 +02:00
193af4ddc8 Fix: Tag armature for copy on write when selecting bones, so active bone gets updated
see 8a2d2f1bb4 for similar

Reviewers: aligorith, sergey

Reviewed By: aligorith

Maniphest Tasks: T54812

Differential Revision: https://developer.blender.org/D3204
2018-05-07 15:58:24 +02:00
d9998f24ab Fix Movieclip editors 'graph' and 'dopesheet' view using themes region
background setting

mentioned in T54942

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D3200
2018-05-07 15:03:05 +02:00
b2443f0248 Fix T54525: crash when setting number of frames to use between dupoff
frames

caused division by zero if both dupli_frames_on and dupli_frames_off are
zero. doing this doesnt seem useful, dupliframes can be disabled in
other ways.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D3132
2018-05-07 15:03:05 +02:00
c4440cf783 UI: add particle mode popovers 2018-05-07 15:01:51 +02:00
9f4d92bb92 Workbench: Texture Shading mode
- draws the active texture of the material
- if the texture cannot be found it will fallback to solid/material
2018-05-07 15:00:16 +02:00
f09d3a7a40 Workbench: Texture Shading mode 2018-05-07 14:59:27 +02:00
66ec3c7e7f Fix Movieclip editors 'graph' and 'dopesheet' view using themes region
background setting

mentioned in T54942

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D3200
2018-05-07 14:57:05 +02:00
1f76e6c326 Fix T54525: crash when setting number of frames to use between dupoff
frames

caused division by zero if both dupli_frames_on and dupli_frames_off are
zero. doing this doesnt seem useful, dupliframes can be disabled in
other ways.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D3132
2018-05-07 14:49:09 +02:00
13aa3de697 Modifier stack: port 'normals edit' to new Mesh-based system.
Note that custom normals drawing seems to be broken, and there also are
some refresh issues in some cases... But this is same with old DM-based
code, so not related to modifiers themselves probably.
2018-05-07 14:37:56 +02:00
ca6dfa2e85 Clear dirty normals flag from Mesh at least in main BKE_mesh_calc_normals(). 2018-05-07 14:37:56 +02:00
580d10e6b6 Change mesh dirty runtime flags to signed int64_t.
Because CD_MASK_XXX are signed longlong, so when assigning to unsigned
longlong you get grumpy compiler errors!
2018-05-07 14:37:56 +02:00
77f2f23a7e Merge branch 'master' into blender2.8 2018-05-07 14:29:54 +02:00
6c243b7e40 More tweaks to strict compiler flags 2018-05-07 14:28:22 +02:00
57013c0a39 Merge branch 'master' into blender2.8 2018-05-07 14:20:47 +02:00
592c3881ba Silence compilation error around possible fall-through 2018-05-07 14:19:12 +02:00
1a3fb3e8b1 Fix wrong comparison of drop target URI on X11
Need to compare, NOT to override passed file name.
2018-05-07 14:11:33 +02:00
Julian Eisel
5003f894e7 Fix crash in debug drawing of fullscreen exit icon
Steps to recreate were:
* Go into fullscreen mode (Alt+F10)
* Open debug menu (Ctrl+Alt+D)
* Set value to 1
* Confirming should crash (at least in debug builds)
2018-05-07 13:49:52 +02:00
Julian Eisel
8bd229cadc Remove alternative action-zone drawing for collapsed regions
Was hidden behind debug values 1, 2 and 3.

Also cleaned up logic in region_azone_edge_initialize. It was using a variable
called is_hidden that actually should've been called is_visible.
2018-05-07 13:49:52 +02:00
b029cc5d74 Eevee: Hair: Fix wrong color when shader is compiling. 2018-05-07 13:08:21 +02:00
9215b41dd3 Armature: Fix BBones base face winding.
Was producing wrong outline and backface culling.
2018-05-07 13:08:21 +02:00
5c728358ec Armature: Remove big outlines for active bones & reduce axes color. 2018-05-07 13:08:21 +02:00
cd3f5983cd Fix Bevel percent mode bug 54228
Previous new adjust pass commit should have excluded percent mode.
2018-05-07 07:05:41 -04:00
8268526d22 Fix T54324: remove stencil entries from weight paint keymap
Reviewed By: mont29

Differential Revision: http://developer.blender.org/D3178
2018-05-07 12:40:06 +02:00
2496c08c39 Modifier stack: move Edge Split to new Mesh-based system. 2018-05-07 12:29:20 +02:00
4e2125e967 Modifier stack: Fix broken 'dirty normals' flag for new mesh-aware modifiers.
Since modifier stack is still primarily based on DM in blender2.8, we
need to copy over 'dirty normals' flag from temp Mesh to DM after
modifier has been evaluated.
2018-05-07 12:29:20 +02:00
9eb5aa32b8 Fix T54324: remove stencil entries from weight paint keymap
Reviewed By: mont29

Differential Revision: http://developer.blender.org/D3178
2018-05-07 12:28:15 +02:00
68c5503570 Merge branch 'master' into blender2.8 2018-05-07 12:26:06 +02:00
ea1751a038 Fix T54594: Lattice with Armature modifier not updating correctly 2018-05-07 12:05:09 +02:00
Julian Eisel
51efeb6834 UI: Hide & shrink scroll-bars based on cursor position
Scroll-bars are now hidden unless the cursor approaches them, in which case they
smoothly grow and become more & more visible. Note that since 0d309144020168e55,
scroll-bars are drawn on top of editor contents. There's no more jumping of
buttons when scroll-bars appear.

Technical notes:
* AZones are used to adjust scrollbars based on mouse movements

  We may want to support screen level AZones if we want scrollbars to also
  smoothly appear when approaching them from a different area.
  I also plan to make further changes to AZones to clean up stuff a bit.
* Had to move AZone handling to a post ARegion init stage, since we need the
  updated View2D data from there.
* View2D masks and scroller rectangles are now updated on every redraw. It's
  cheap to do that though.
2018-05-07 11:42:12 +02:00
Julian Eisel
4ec467d3b5 UI: Draw scroll-bars overlapping with editor content
Scroll-bars used to draw in a little extra space in the editor, causing
buttons to jump a bit when they appeared/disappeared. Now they draw on
top of the buttons, just small enough to avoid bigger overlaps. Followup commits
will do further adjustments.

With this we can get rid of a hack that was calling the (often Python
defined) panel definition - the panel 'draw' callback - twice.
2018-05-07 11:42:12 +02:00
Dalai Felinto
2349b9777a Multi-object edge collapse 2018-05-07 11:26:07 +02:00
83345b463e Merge branch 'master' into blender2.8 2018-05-07 11:15:31 +02:00
a3b4c3823c Fix T54966: mathutils.noise.voronoi Memory leak
C code was not correctly handling release of temp data, not technically
a memory leak, but indeed rather annoying bug! ;)
2018-05-07 11:07:11 +02:00
e3d30ffb92 Armature: Add back relationship lines. 2018-05-07 00:24:41 +02:00
17370a27a3 Object Mode: Use stipple shader for relationship lines. 2018-05-07 00:24:41 +02:00
Dalai Felinto
bcd5878aea Reset number values when entering an empty value
Note: This rely on the property having a pre-defined default.

Also, be aware that trying to multi-drag and multi-ui-edit is not working
at the moment (T54976).

With changes by Campbell Barton.

Differential Revision: https://developer.blender.org/D3207
2018-05-06 22:08:54 +02:00
Dalai Felinto
7b37beec9c RNA default: Scene start/end frames 2018-05-06 21:40:45 +02:00
77c2acdfae Fix wrong header alignment in user preferences, after recent commit. 2018-05-06 21:26:10 +02:00
b3e8bd98e8 UI: fix popover menus sometimes going off screen, after recent commit. 2018-05-06 20:43:51 +02:00
9facbcff80 UI: keep header top/bottom alignment the same when switching editor types. 2018-05-06 20:22:43 +02:00
a9ea7864ae Merge branch 'master' into blender2.8 2018-05-06 20:15:14 +02:00
c9ed78733c UI: fixes for 3D viewport popovers moving / flipping on edits.
* Ensure popover does not change direction or location.
* Open popover towards the relevant editor, like pulldown menus.
* Use a bigger maximum assumed size to deal with some corner cases.
* Do proper 3D viewport header refresh on shading mode changes.
2018-05-06 20:14:58 +02:00
16e220c959 Cleanup: deprecate area.headertype.
This was still used in a few places but not kept in sync with the actual
header position. Always get alignment from the header region now.
2018-05-06 20:14:58 +02:00
9bd2e9104a Nodes: show node labels (like image name) in material properties node view. 2018-05-06 19:28:23 +02:00
a3e74acd9e Merge branch 'master' into blender2.8 2018-05-06 18:35:39 +02:00
c769b1a553 Armature: Add a special Pass for bone axes.
In object mode, the axes are drawn like any other wire objects with
depth test and depth write. Thus enabling MSAA to work but not their xray
behaviour.

In edit armature/pose mode, draw smooth line without depth testing. This
produces wrong draw ordering problem but still gives the desired xray
behaviour. We do it outside of the MSAA pass since the xray behaviour is not
compatible with it. But we are drawing smoothed lines so no need for MSAA.
The lines are 2px thick and improve readability.
2018-05-06 18:42:23 +02:00
48ddb2b98a Armature: Fix bone axes not using bone color. 2018-05-06 18:36:47 +02:00
1c3f953565 Armature: Put passes in a struct easier to pass around. 2018-05-06 18:36:47 +02:00
2bc0c4ec59 DRW: Add DRW_STATE_WIRE_SMOOTH to draw smooth wires.
This is only useful if depth test/wire is disabled.
2018-05-06 18:36:47 +02:00
c472936074 Armature: Fix/Change bone axes display.
Now the axes are displayed correctly at the tip of the bone and with the
axes names.

I've made some modifications though:
- Axes are colored. (should not be in object mode but that's TODO)
- Axes ends are not flat arrows anymore. Replaced with a small diamond.
- Axes names are now scale by their respective axes instead of being
  affected by other axes.
- Changed axes names "font" to be a bit more sexy.
2018-05-06 18:36:47 +02:00
046904e3fc Cleanup: split rotation_from_view
Add a function that takes only a quat, instead of the 3D view.

Allows for using non-view orientations.
2018-05-06 18:32:18 +02:00
1a81ac7d9a Fix update for manipulator w/ 3D cursor change 2018-05-06 16:41:32 +02:00
2fe954f23e Cleanup: transform manipulator filename
Use matching 2d/3d suffix.
2018-05-06 16:14:10 +02:00
99190f9345 Correct extrude poll function 2018-05-06 16:14:10 +02:00
37c5145ef2 Workbench: if no material is available, use color 0.8 like default material. 2018-05-06 16:08:12 +02:00
4462c38e55 Fix use of removed Blender Internal property. 2018-05-06 16:08:12 +02:00
bb3a030306 Fix issue with hidden headers after previous commit. 2018-05-06 16:08:12 +02:00
541258bfa6 Merge branch 'master' into blender2.8 2018-05-06 16:00:27 +02:00
84474b0171 Object Snap: add object & matrix to view ray cast
Some snap functions already exposed this.
2018-05-06 15:56:09 +02:00
f28d209591 UI: region overlap now works for headers as well.
This is for the 3D viewport and image editor. A remaining issue is
that pulldown menu buttons only show text, which is not visible on
all background colors, so making the header entirely transparent
does not work well at the moment.
2018-05-06 15:43:10 +02:00
Dalai Felinto
f4c1685a16 Edit-mesh: multi-object reveal 2018-05-06 13:55:23 +02:00
Dalai Felinto
5d8937e8ba Edit-mesh: multi-object hide 2018-05-06 13:51:30 +02:00
Dalai Felinto
49be803ad6 Edit-mesh: multi-object delete edge loops 2018-05-06 13:44:11 +02:00
Dalai Felinto
4df7220874 Fix crash with select linked when nothing is under the cursor
There is no object to update anyways, and there is no valid basact when the
nified_findnearest() test fails.

How to reproduce the bug: Try to select linked (L) with selected faces but
withotu mouse hovering any mesh.

Bug introduced on: rBbfc9d426bb95 (original multi-object edit commit).
2018-05-06 13:27:46 +02:00
Dalai Felinto
b6a7fa1880 Edit-mesh: multi-object select less 2018-05-06 13:08:59 +02:00
Dalai Felinto
2309131b4d Edit-mesh: multi-object select more 2018-05-06 13:08:37 +02:00
dcc4b2cc25 Fix missing show_weight from overlay UI
Missed when moving settings out of the mesh.
2018-05-06 12:17:53 +02:00
02dbe2dcfc Show the 3D cursor by default
Was committed as part of unrelated change: D3198.
2018-05-06 11:56:26 +02:00
b7d7bbfc48 Fix extrude glitch where undo state was visible 2018-05-06 11:50:56 +02:00
466125f3d6 EditMesh: initial extrude manipulator
This manipulator is a test for mixing do/redo,
there are still some glitches that need sorting out in
transform & the undo stack.
2018-05-06 10:14:20 +02:00
47de0321bf Transform: support initial offset option
Needed to redo extrude+transform macro w/o resetting the translation.
2018-05-06 10:14:16 +02:00
f7123f0f11 WM: manipulator redo support
Support for adjusting a setting from the last executed operator.
2018-05-06 09:49:55 +02:00
4163beb818 Merge branch 'master' into blender2.8 2018-05-06 09:02:47 +02:00
632f2b5c18 WM: include macros in last-properties
Needed for 2.8 tool system storage of macro properties.
2018-05-06 08:57:53 +02:00
9e3bfd9210 IDProp API: use stored string length for IDP_repr
Also NULL check ID pointers.
2018-05-06 08:57:19 +02:00
2dd0cb4964 Fix T54801: incorrect render with zero weight transparent BSDFs. 2018-05-06 02:00:39 +02:00
Dalai Felinto
f4e9620eff Fix crash on armature drawing 2018-05-06 00:23:13 +02:00
e1e7915233 Armature: Fix object mode display.
Don't show wires if not selected.
Bone outline size match meshes outlines.
2018-05-05 22:58:46 +02:00
759ff83e88 Armature: Change Bone drawing.
This makes a few changes:
- Remove the old "overlay" wires.
- Add constraints colors to bones.
- Specify a a new "hint" color per bone. Making selection/Active state
  more obvious.
- Unify Octahedral/B-Bones/Envelope shading and colors.
- Change outline size depending on the selection/active state of the bone.

Note that thoses changes are not final and needs review.
2018-05-05 21:04:21 +02:00
817cf2a317 Armature: Rename bone shaders and add 2 colors smooth blending.
This will enable us to do more nice stuff in future commits.

This commit is a temporary commit, it will compile but will crash if
trying to display any armature. Next commit does work.
2018-05-05 21:04:21 +02:00
b2188d631a Armature: Outline: Fix outline detection in critical cases.
Outline was not generated because the normal was completely orthogonal to
the view.
2018-05-05 21:04:21 +02:00
3b075d0c8d Armature: Make bone outlines thickness variable. 2018-05-05 21:04:21 +02:00
eec3fc1273 Armature: Set outline width to 2.0.
Correspond roughly to 1px width.
2018-05-05 21:04:21 +02:00
1107223a63 Workbench: Temporary fix washed out background color.
Save our eyes until proper color management is implemented.
2018-05-05 21:04:20 +02:00
2241f14e26 Icons: add texture paint icons 2018-05-05 18:01:35 +02:00
1ddedfb2af 3D viewport: rename ambient to shadow intensity, default single color to 0.8. 2018-05-05 16:01:45 +02:00
6d980020ba UI: experiment to make popover buttons draw like enum menus.
Looks better for 3D viewport shading, but needs more tweaks to distinguish
it from other button types probably.
2018-05-05 15:54:43 +02:00
b365cc017a 3D Viewport: move overlay settings from collections to 3D viewport.
For some we may add per object overrides, but for most we plan to keep them
strictly per viewport settings. Display settings from the mesh still need to
be moved here, only collections were done to remove that code.
2018-05-05 15:54:43 +02:00
2094b45447 3D Viewport: make shading and overlay DNA match UI names.
We should use consistent naming between the internal code and UI whenever
possible, only reason not to is file compatibility.
2018-05-05 15:54:36 +02:00
1983eea98e Cleanup: remove legacy 3D view data. 2018-05-05 15:51:13 +02:00
46ee994608 Cleanup: minor code formatting tweaks for 3D view DNA. 2018-05-05 15:51:13 +02:00
cfd39887d1 Cleanup: fix compiler warnings. 2018-05-05 15:51:13 +02:00
309e9521f8 Groups: remove drawing group objects in a different color.
With the upcoming unification of groups and collections this will make
no sense anymore, as all objects will be in a collection.
2018-05-05 15:51:13 +02:00
d979f1fc62 Workbench: Fix reading and testing from depth buffer 2018-05-05 15:32:48 +02:00
29aa531e51 Merge branch 'master' into blender2.8 2018-05-05 14:42:15 +02:00
d3b3df0371 IDProp API: add native C repr function
Was using Python which wasn't very efficient (even for logging).
2018-05-05 14:41:25 +02:00
f91e9529da Merge branch 'master' into blender2.8 2018-05-05 09:57:45 +02:00
d83681807e PyAPI: add pop method to RNA struct types
This fits in with existing dict style access.
2018-05-05 09:53:30 +02:00
d2591e5c2d IDProp Py API: Add default argument to pop
Match dict.pop behavior.
2018-05-05 09:48:06 +02:00
86c2c4d513 IDProp API: Avoid redundant group replace lookup 2018-05-05 09:31:17 +02:00
3b0475bc64 Eevee: Shadows: Don't allocate more CSM layer than we need. 2018-05-04 19:24:13 +02:00
0503f31c66 Cleanup: trailing space 2018-05-04 19:22:38 +02:00
42c5c20e54 Edit Mesh: Multi object color reverse
D3173 by @la10
2018-05-04 19:17:56 +02:00
3f6fac91ff Eevee: Fix Cascaded shadow map calculation.
The first one was done correctly but the second was wrong due to the matrix
being overwritten.
2018-05-04 19:09:12 +02:00
bb063ec31e DRW: Add DRW_viewport_far/near_distance_get functions. 2018-05-04 19:09:12 +02:00
9cb397238d Fix crash selecting edit-mesh
The base and the vert/edge/face could be out of sync.
2018-05-04 19:03:32 +02:00
d9c5a35587 Fix: Fire notifiers on pose properties changed
While testing UI_OT_reset_default_button, discovered that using
Reset to Default Values on bone locations didn't work. Turns out
to be missing update on this property. So, this is probably
dependent on the property used.
2018-05-04 17:30:59 +02:00
a73c02a17b Workbench: Color selector when in single color mode 2018-05-04 17:26:10 +02:00
26d87bd577 Merge branch 'master' into blender2.8 2018-05-04 11:58:55 -03:00
b27b4743a2 BKE: bvhuils: remove member sphere_radius.
This member currently doubles the value of `ray->radius` or is not even used.
2018-05-04 11:57:01 -03:00
eccbca9e7d Depsgraph: Fix several ID blocks added multiple times to depsgraph
Ideally, we need to get rid of whole bmain iteration in depsgraph
construction, but then it's not clear which movie clips and such
to evaluate.
2018-05-04 16:37:21 +02:00
d85fd8feeb T54953: Use OCIO for display color management 2018-05-04 16:27:14 +02:00
50c5e2aa08 Workbench: Random color generation
Now the colors are determined from the name and library name of the
object. This should make more consistent random colors
2018-05-04 16:27:14 +02:00
3b25b25752 Merge branch 'master' into blender2.8 2018-05-04 11:25:40 -03:00
d0c6e2b677 Fix grid fill crash with copy on write 2018-05-04 16:23:20 +02:00
02788a9d1a Fix erroe in previous commit. 2018-05-04 11:22:50 -03:00
39050f6eee Eevee: Shadows: Compute Octahedron size from CubeMap size.
This was the otherway around before. But since we can have a different size*
for cube texture now, we can compute the correct-ish texture size.

This will give us on average the same texture appearance when we will add
support for real cubemap shadows.
2018-05-04 16:22:23 +02:00
e6ce78895d Eevee: Cap Shadow resolution to 4096px^2.
As much as I want to give freedom to the user, 1.5G of vram for a
single shadow is a big of a stability issue.

So limiting to 4096 for now, we may remove this limit in the future.
2018-05-04 16:22:23 +02:00
f48e53f562 Eevee: Shadows: Separate Cube and Cascade shadow maps into 2 texture array.
This mean we can now have different shadow resolutions for both.

However each shadow type keep the same size accross all lamps because of
future "real" Cube Shadowmaps limitation and to save texture sampler slots.

That said the cascade shadow resolution could (in the future) still be
changed to be adjustable per sun lamp.
2018-05-04 16:22:23 +02:00
d4dd872d56 Eevee: Simplify shadow test code with macros. 2018-05-04 16:22:23 +02:00
2439ac2202 Merge branch 'master' into blender2.8 2018-05-04 11:16:13 -03:00
e78ef82827 BKE: bvhutils: Unifies static functions oh bvhtrees creation. 2018-05-04 11:15:21 -03:00
501637879d Static Override: fix stupid ;istake in moving autooverride to own struct flag. 2018-05-04 15:44:19 +02:00
66be4a1136 Merge branch 'blender2.8' into tmp-static-override-insertion 2018-05-04 15:36:06 +02:00
699d5d4040 Static Override: Add overridable flag to drivers' ID pointer. 2018-05-04 15:32:22 +02:00
10fb83e3f0 Merge branch 'blender2.8' into tmp-static-override-insertion 2018-05-04 15:26:02 +02:00
554fb0e7e0 Merge branch 'master' into blender2.8 2018-05-04 15:21:42 +02:00
aa0380a6a5 Cleanup: Remove G.main from framechange_poses_clear_unkeyed() 2018-05-04 15:18:47 +02:00
844a17a3d9 Transform: use bool when local matrix is needed
Existing code checked pose/edit mode to check for transforming in an
objects local space.

This added many similar checks all over the code,
which leads to confusion.
Multi-edit caused a regression in UV transform since where UV's
had the object matrix applied by accident.

Now there is a boolean to use a local matrix,
this allows for any mode to have a 4x4 matrix
applied w/o adding mode specific checks everywhere.
2018-05-04 15:18:27 +02:00
90e61275d3 Fix mistake in boundbox center 2018-05-04 15:18:27 +02:00
0a79de526d Merge branch 'master' into blender2.8 2018-05-04 10:12:47 -03:00
78fde19e68 BKE: Smoke: Fix error with implicit declaration of function due recent changes. 2018-05-04 10:11:30 -03:00
57a5ef8c61 Depsgraph: Fix missing relations for IDs brought by drivers
This is similar to rather recent fix in nodes builder.

Fixes crash when creating static override for chicken from Dweebs.
2018-05-04 14:30:06 +02:00
02baf71409 Merge branch 'master' into blender2.8 2018-05-04 09:22:48 -03:00
aea637456e BKE: BVHtree: Replace all external references of bvhtree_from_mesh_looptri with bvhtree_from_mesh_get. 2018-05-04 09:21:42 -03:00
3f95daa31f Workbench: Shadows
Initial review of the shard shadows in the workbench engine.

Speed optimizations like transform feedback are not implemented yet. I first want this part to be reviewed and merged.

@fclem please check the note in drw_stencil_set it was holding back nequal == 0 as by default DST.stencil_mask was set to 0. questioin is should we remove the whole check or not.

Also I am still looking for a better name (or split the enum) for DRW_STATE_STENCIL_DEPTH_FAIL_INCR_DECR_WRAP

Reviewers: fclem

Reviewed By: fclem

Tags: #code_quest

Differential Revision: https://developer.blender.org/D3198
2018-05-04 14:08:40 +02:00
d8a03c77d7 Allocate/free meshes with generic library functions.
This avoids the need to use Mesh-specific functions, and makes allocation
and freeing easy oneliners.
2018-05-04 14:02:58 +02:00
3dd6912fce Mesh Remap: Face Corner Data: Do not use large epsilon values to create bvhtrees.
Use ray radius instead.
2018-05-04 09:01:56 -03:00
8c6a1d8f95 Mesh Remap: Face Data: Do not use large epsilon values to create bvhtree.
If you need the approximation, use raycast radius.
2018-05-04 08:29:00 -03:00
4880e2e75a ID management: add higher level BKE_id_new... helpers.
Those should be used in priority when you need to create either a new
datablock in Main, or a new temp one. Lower level BKE_libblock_...
should only be used when you need a very specific, uncommon behavior.
2018-05-04 12:55:36 +02:00
3248eef697 Merge branch 'master' into blender2.8 2018-05-04 12:50:40 +02:00
fa11dc6730 Depsgraph: Fix extra operations and relations created for shared armatures 2018-05-04 12:49:48 +02:00
a0f369bc13 Merge branch 'master' into blender2.8 2018-05-04 07:44:34 -03:00
b886cdf81d Mesh Remap: Change the sphere_radius parameter instead of creating a bvhtree with epsilon equal to the value of ray_radius.
This is the desirable behavior.
It also removes one more use of `bvhtree_from_mesh_looptri`.
2018-05-04 07:43:08 -03:00
3d26cf112b Constraint: Shrink Warp: Replace bvhtree_from_mesh_looptri with bvhtree_from_mesh_get.
The value of epsilon was never used to create this bvhtree because whenever we activate this constraint, a bvhtree with parameter epsilon 0.0 was created and cached.
2018-05-04 07:39:07 -03:00
82d59c6588 Mesh Lapacian: Use isect_ray_tri_watertight_v3 instead of Epsilons to prevent corners errors in raycast.
Using FLT_EPSILON can fail with large coordinate values.
This commit also avoids storing bvhtrees with different settings in BVHCache.
2018-05-04 07:33:26 -03:00
c2fe75bf26 Merge branch 'master' into blender2.8 2018-05-04 11:53:52 +02:00
d1be30f779 Fix T54935: Particle group instances don't render when hidden in viewport
Seems to be only related on linked nature of particles.

This is caused by some conflicting optimization done for viewport, which
does not do particles re-calculation if they do not depend on time
(which is crucial for big layout scene grass fields) and particle render
setting  switch which was relying on fact that render pipeline will do
particle update via time dependency.

Now we extent an old workaround for invisible objects, which now also
deals with particles in the same way as old dependency graph was dealing
with this: tag object data for update if there is particle system.

There shouldn't be any speed difference between old and new depsgraph,
since tagging was already needed and was happening.

In Blender 2.8 such things should be easier to deal with since the whole
depsgraph is to be evaluated for render engine anyway.
2018-05-04 11:40:27 +02:00
52aa1f3c6c Merge branch 'master' into blender2.8 2018-05-04 10:32:35 +02:00
bf52d20e62 Modifiers: add back dirty normal flag 2018-05-04 10:05:57 +02:00
288d7794d4 Fix T54341: Particle Instance Modifier doesn't preserve edge data 2018-05-04 09:20:57 +02:00
bdd5617c54 Cleanup: avoid local definitions for one-off args 2018-05-04 09:04:33 +02:00
14883a0945 Cleanup: avoid local definitions for one-off args 2018-05-04 08:51:04 +02:00
29fc9275c7 Modifiers: ported wire modifier to mesh 2018-05-04 08:45:43 +02:00
352aea6b0d Merge branch 'master' into blender2.8 2018-05-04 08:39:43 +02:00
75b310f489 Fix wireframe modifier w/ even offset
Was passing non-normalized axis to angle_on_axis.
2018-05-04 08:38:01 +02:00
eeab3563d7 Merge branch 'master' into blender2.8 2018-05-04 08:02:11 +02:00
c7cfee04c4 Logging: setting log level wasn't working 2018-05-04 08:00:22 +02:00
b3545ae373 Merge branch 'master' into blender2.8 2018-05-04 07:30:14 +02:00
f3c5b0394f IDProp API: expose repr utility function
Useful for logging properties passed to operators.
2018-05-04 07:29:05 +02:00
892dd3d069 Merge branch 'master' into blender2.8 2018-05-03 18:47:14 -03:00
16253285ff BKE: BVHtree: make bvhtree_from_mesh_edges a static function.
This will help us have more control over bvhtrees that are cached.
2018-05-03 18:33:16 -03:00
133dadcdee Fix Transfer Mesh Data with Edge Mapping of type Projected Edge Interpolated and Ray Radius other than 0.0.
`MREMAP_RAYCAST_APPROXIMATE_BVHEPSILON(ray_radius)` greatly increased the radius making for example that 0.1 becoming 1.5
Now the result is much more predictable.
2018-05-03 18:19:36 -03:00
Dalai Felinto
e245f7c09c Edit-Mesh: multi-object un-subdivide 2018-05-03 21:56:59 +02:00
Dalai Felinto
66ffbf9b7d Edit-Mesh: multi-object edge rotate 2018-05-03 21:44:53 +02:00
Dalai Felinto
09e14cb5bc Edit-Mesh: multi-object dissolve limited 2018-05-03 21:00:03 +02:00
32c620b0d6 Merge branch 'master' into blender2.8 2018-05-03 15:54:26 -03:00
7915cc7ddb Particle Edit: Shape Cut: Create and use bvhtree with AABB hull.
This bvhtree is only used for raycast. Currently the raycast does not benefit from general hull.
2018-05-03 15:52:09 -03:00
98ecdc4896 Dynamic Paint: Create and use bvhtree with AABB hull.
This bvhtree is only used for raycast and find_nearest which currently do not benefit from general hull.
2018-05-03 15:50:48 -03:00
5760c6b25c Merge branch 'master' into blender2.8 2018-05-03 20:24:44 +02:00
0f217de403 Fix T54927: BMesh Py error w/ select history slice 2018-05-03 20:23:32 +02:00
2cdbbfcc5a Merge branch 'master' into blender2.8 2018-05-03 19:53:19 +02:00
38b6f8e143 Cleanup: correct solidify logic
Code for side normals isn't executing at the moment,
so not essential, but better correct it.
2018-05-03 19:48:28 +02:00
5e225ddb21 Cleanup: parentheses warning 2018-05-03 19:37:20 +02:00
a9d264f5ca Merge branch 'master' into blender2.8 2018-05-03 14:33:52 -03:00
ac19483e63 BKE bvhtree: Add tree_type parameter to bvhtree_from_mesh_get.
This will allow greater control of the bvhtrees that are obtained, and helps identify problems.
It is also an additional step to unify the functions.
2018-05-03 14:26:39 -03:00
20185a8681 Cleanup "Sync Mode" (i.e. Av Sync/Framedropping) stuff
* Remove the "sync_mode" dropdown from timeline header, and move it into
  the Playback menu instead.
* Remove the confusing "Frame Dropping" and "AV Sync" entries from the
  Playback menu. These were supposed to be mutually exclusive (or else,
  the "sync_mode" menu would break).
* Turn AV Sync on by default
* Commented out the Frame Dropping and Av Sync RNA Properties too.
  THere doesn't seem to be any valid reason for these to exist?
2018-05-03 18:50:53 +02:00
8c49e6f99e Multi-Object Pose: Fix POSE_OT_flip_names 2018-05-03 18:04:29 +02:00
656d6f47b9 Fix 3D cursor being hidden on existing 2.8 files
Flip logic for the flag avoids versioning code.
2018-05-03 18:02:13 +02:00
7d61803640 Sculpt: Fix crash when using grab brush
Was wrong paint structure deducted from context.

Test plan:

With default cube, go to sculpt mode, switch to grab brush
and try to sculpt.
2018-05-03 17:42:46 +02:00
e684e0ec95 Cleanup: fix warnings, removed unused code. 2018-05-03 16:33:12 +02:00
bb92edd1c8 Depsgraph: Keep edit bones around, fixes missing edit mode with copy on write 2018-05-03 16:23:16 +02:00
Dalai Felinto
14f2a1c8e8 Fix T54805: Bones are white in edit mode 2018-05-03 16:19:55 +02:00
d8b43a8066 Depsgraph: Make sure evaluated pose channels are pointing to evaluated bones 2018-05-03 16:11:07 +02:00
a06b0d29aa Eevee: Shadows: Perf: Do not update shadows that are not inside the view. 2018-05-03 16:08:14 +02:00
ffca77814e DRW: Add plane culling test.
Usefull to see if the view frustum is totally behind a plane.
2018-05-03 16:08:14 +02:00
4d0b6652cf DRW: Silence unused function warning in release. 2018-05-03 16:08:14 +02:00
49407122ea Merge branch 'blender2.8' into tmp-static-override-insertion 2018-05-03 16:02:11 +02:00
b2b9efbe6d Merge branch 'master' into blender2.8 2018-05-03 16:01:43 +02:00
a5d0597b92 Fix tooltip for constraints' subtarget.
Thanks @aligorith for the head-up.
2018-05-03 16:00:34 +02:00
0b1c673e14 Workbench: selection method for studio lighting 2018-05-03 15:33:13 +02:00
2bf333b35d Workbench: studiolight 2018-05-03 15:31:03 +02:00
8a2d2f1bb4 Fix: Tag armature for copy on write when selecting bones, so active bone gets updated
Note: This still needs some copy-on-write magic to get the bone pointers
to get remapped properly (e.g. evaluated pose still refers to original
arm->bones, and arm->act_bone isn't getting remapped).
2018-05-03 15:18:39 +02:00
a086f61df7 Merge branch 'master' into blender2.8 2018-05-03 15:02:05 +02:00
53c43259ad Cleanup: factorize RNA constraint targets definition.
No expected changes in behavior from that commit!
2018-05-03 15:00:12 +02:00
dced0518d9 Fix crash selecting envelope bone joint 2018-05-03 14:51:29 +02:00
057e00e649 Render preview: Assign proper depsgraph for icon preview
Wondering why it only was visible when running without copy on write.
2018-05-03 14:25:29 +02:00
95b388c3df Depsgraph: Fix missing action re-map with node tree update
After copying animation data we need to re-map action, otherwise
our original DNA values will go out of symc, causing flickering
when tweaking values on animated node tree.
2018-05-03 14:16:12 +02:00
e013d2eb4b Render preview: Make it to preserve unkeyed animation
The idea is to re-use evaluated datablock from within current context.

This relies on the following factors:

- It expects scene to be fully evaluated before preview jobs starts.
- It expects datablocks to be localized.
2018-05-03 14:16:12 +02:00
181356edba Restored HQ normals in Solidify modifier 2018-05-03 14:11:22 +02:00
1677ea89c7 Metaball: Move handles shader to draw/modes/shader and reference them in draw_common.c 2018-05-03 09:11:02 -03:00
69710301cc Merge branch 'blender2.8' into tmp-static-override-insertion 2018-05-03 13:51:42 +02:00
Dalai Felinto
9c78d9ba9f Fix pose transformation helper lines
This was broken since 33bb8b785a (triple-buffer changes).
This also helps help lines as a whole.
2018-05-03 13:05:38 +02:00
ecb143fe5d Render preview: Remove dedicated depsgraph
It is not needed since render pipeline will create its own depsgraph.
2018-05-03 12:57:54 +02:00
5975d6581c Depsgraph: Tag IDs for animation update on visible update
Without this it's quite unpredictable what state of unkeyed changes
datablock will end up with.
2018-05-03 12:55:01 +02:00
ef94415060 Depsgraph: Fix threading conflict between node animation and shading update 2018-05-03 12:55:01 +02:00
98ac0188ed Depsgraph: Fix wrong debug message 2018-05-03 12:55:00 +02:00
Dalai Felinto
c4bf936d53 Fix sculpt grab cursor
This was broken since 33bb8b785a (triple-buffer changes).
We need to account to the area limits when drawing the cursor.
2018-05-03 11:48:35 +02:00
1833e8d7b0 Fix for material/node tree localization
The workaround removal was wrong, the whole id->adt of a local
copy is to be NULL.

But now instead of modifying original datablock, we tell library
manager to not copy animation data.
2018-05-03 11:25:47 +02:00
8431e0aab5 UI: Fix region_draw_azone_tab_plus missing/broken background.
This was due to the background being drawn by a batch that had its VAO
generated in the windows "UI" context.

Since we use the DRW ogl context to draw the entire area, we have to
regenerate the VAO for thoses UI batches to be drawn correctly.
2018-05-03 11:20:20 +02:00
026792ffed Workbench: Show 3D Cursor Overlay 2018-05-03 10:55:28 +02:00
Dalai Felinto
d64f12248a Initialize alpha discard for uiWidgetBaseParameters
No functional change, just playing safe and documenting how to
initialize the parameter in most of the cases.
2018-05-03 09:59:48 +02:00
31f8d05432 Merge branch 'master' into blender2.8 2018-05-03 08:31:38 +02:00
0d6ddd0a1d Cleanup: split out extrude spin/screw
Since these will have their own manipulators,
its more convenient to keep them separate.
2018-05-03 08:20:29 +02:00
e954082dda WM: warn when tool widget not found
This happens when testing adding tools, assert isn't useful.
2018-05-03 07:33:44 +02:00
d9f4ce617b Cleanup: trailing space 2018-05-03 07:22:04 +02:00
7840c593b8 Cleanup: remove axis bounds ifdef
This was added for scale-cage manipulator, but seems generally useful.
2018-05-03 07:21:06 +02:00
51aba69b89 Transform: expose 3D center/axis calculation
This is needed for other manipulator placement.
2018-05-03 07:19:33 +02:00
f5cb96704b WM: add function to access last_properties 2018-05-03 07:09:22 +02:00
e4774c0b2d Metaball: pointers used in DRW_shgroup_call_dynamic_add don't need to hold the reference. 2018-05-02 21:26:43 -03:00
36bbf80929 Armature: Envelope: Small cleanup + don't smooth the distance display.
The actual weighting calculation is not smooth as the bone display.

The bone itself can be smooth for esthetic purpose but the distance display
should match the underlying weighting formula.
2018-05-02 20:49:38 +02:00
46662a289b Armature: Envelope: Optimize outline shader. 2018-05-02 20:49:38 +02:00
0ea329d32d Armature: Envelope: Revisit envelope drawing again.
Past shader was too slow and had bad artifacts. This method is much simpler
and eficient and only exhibit some popping when the raidus of the head/tail
is changed.
2018-05-02 20:49:38 +02:00
73cb83d48f GPUShader: Remove unused envelope shaders. 2018-05-02 20:49:38 +02:00
e764d2b6ba Armature: More work and cleanup on envelope bones drawing.
- Draw tail & head sphere with point shader (no needs for another way).
- Use the same function for issuing the calls for wire and solid envelope.
2018-05-02 20:49:38 +02:00
a76d27f694 Armature: Add envelope outline shader. 2018-05-02 20:49:38 +02:00
01cec3e0c5 Armature: Envelope Bones: Change drawing method.
We now use a more pleasant and efficient way to display enveloppe bones
and their radius.

For this we use a capsule geometry that is displaced (in the vertex shader)
to a signed distance field that represents the bone shape.

The bone distance radius are now drawn in 3D using a "pseudo-fresnel" effect.
This gives a better understanding of what is inside the radius of influence.

When capsules are not needed, we switch to default raytraced points.
The capsules are not distorded by the bone's matrix (same as their actual
influence radius) and are correctly displayed even with complex scaled
parents hierarchy.
2018-05-02 20:49:38 +02:00
18071f4e0e Armature: Draw envelope on non MSAA buffer.
Appart from the performance issue, the MSAA resolve pass is not compatible
with additive passes.
2018-05-02 20:49:38 +02:00
d0d282bf2f Armature: Add multisampling to posemode. 2018-05-02 20:49:38 +02:00
6f5bf23c98 DRW: Convert DRW_cache_circle_get to use GWN_PRIM_LINE_LOOP 2018-05-02 20:49:38 +02:00
8c2a6f957a Armature: "Raytrace" bones endpoint spheres.
Here is how it works:
We render a high poly disc that we orient & scale towards the camera so that
it covers the same pixel of the sphere it's supposed to represent.

Then the pixel shader raytrace the sphere (effectively starting from
the poly disc depth) and outputs the depth to gl_FragDepth.

This approach has many benefit:
- high quality obviously: per pixel accurate depth!
- compatible with MSAA: since the sphere horizon is delimited by polygons,
  we get the coverage computed by the rasterizer. However we still gets
  aliasing if the sphere intersect directly other meshes.
- virtually no overdraw: there is no backface to shade but we still get
  overdraw because by little triangle [gpus rasterize pixel by groups of 4].
- allows early depth test: since the poly disc is set at the nearest depth
  we can output, we can use GL_ARB_conservative_depth to enable early depth
  test and discard pixels that are already behind geometry.
- can draw outline pretty easily without geometry shader.
2018-05-02 20:49:38 +02:00
a56561dcd2 DRW: Make use of new multisample resolve pass. 2018-05-02 20:49:38 +02:00
33356b7be0 DRW: Add DRW_multisamples_resolve function
This manually resolve the content of a multisample FB to a single sample FB.

It resolves color (combine the 2 framebuffers in a logical maner keeping
depth buffer occlusion etc..) instead of a plain glBlitFramebuffer copy.
2018-05-02 20:49:38 +02:00
6d8e308eae GPUShader: Optimize Multisample resolve shader.
Group all fetches together without interleived alu to let compiler optimize.

Also do the color samples only if needed.

Went from 3.86ms to [1.11-2.22]ms [min-max] for the 16samples resolve pass
on my nvidia card.
2018-05-02 20:49:38 +02:00
1fff3e02c2 DRW: Add DRW_STATE_BLEND_PREMUL blend mode. 2018-05-02 20:49:38 +02:00
12570c7373 GPUShader: Add GPU_SHADER_2D_IMAGE_MULTISAMPLE_2/4/8/16
This shader is used instead of blitting back and forth to a single sample
buffer.

This means it resolves the color and depth samples and outputs a fragment
which can be depth tested and blended on top of an existing framebuffer.

We do static shader variation with manual loop unrolling for performance
reason. In my test I get 25% more perf with intel integrated gpu and 75%
performance gain with dedicated nvidia card compared to a single shader
with a uniform for sample count.
2018-05-02 20:49:38 +02:00
2602198485 GWN: Add GWN_batch_uniform_mat4. 2018-05-02 20:49:38 +02:00
a8463284bb GPUShader: Fix simple lighting modulating alpha color 2018-05-02 20:49:38 +02:00
ad97ba3367 Object Mode: Draw non meshes before outline.
This makes the outlines occluded by the other objects. This was a problem
before the outline refactor but now there is no need for it.
2018-05-02 20:49:38 +02:00
e493a1a1ae DRW: Armature: New bone outline shader.
This fix the issue with the zfighting we were getting at bones edges.

Moreover, this enables us to render arbitrarly large outline with
varying thickness.
2018-05-02 20:49:38 +02:00
77b481fd5a DRW: Add Adjacency info for bone shapes.
Only for cube and octahedral shapes for now.
2018-05-02 20:49:38 +02:00
0c47a83fb9 GWN: Add GL_TRIANGLES_ADJACENCY to supported primitive types. 2018-05-02 20:49:38 +02:00
3f9f27e5a8 GPUTexture: Fix wrong multisample texture size. 2018-05-02 20:49:38 +02:00
7d384bcdbb Static Override: Lock 'edition' of constraints & modifiers from overridden data.
Means that you cannot move or delete constraints/modifiers coming from
the overriden linked datablock. Local inserted ones can be fully edited.
2018-05-02 18:45:22 +02:00
fd23c42faa Paint Vertex Mode: Fix shader not free. 2018-05-02 18:39:53 +02:00
1ff2646d58 Eevee: Add Lamp Specular multiplier.
It's usefull in some scenario to tweak the specular intensity of a light
without modifying the diffuse contribution.

Cycles allows it via lamps material which we currently not support in Eevee.

This is a good workaround for now.
2018-05-02 18:39:53 +02:00
Dalai Felinto
965e6ed54f Fix T54864: Assert when changing interface display scale
The asserts were introduced on rB5f6c45498c92 (top-bar).

Although the asserts are technically correct, they would fail even in master.
And the commit simply added the asserts without fixing the situation itself
(as you can see in the report, it is really simple to reproduce this issue).

I propose we remove the asserts and bring them back only when the situation
itself is fixed. It doesn't make sense to introduce asserts that would fail
with the current state of the code.
2018-05-02 18:32:44 +02:00
0fb5a39baf Static Override: add insertion for modifiers and one constraints, fix editing of inserted items in collections.
Now insertable collection items have a flag to say they are 'local' (and
hence can be freely edited).
2018-05-02 18:14:19 +02:00
d877831115 Merge branch 'blender2.8' of git.blender.org:blender into blender2.8 2018-05-02 17:37:37 +02:00
f0d67d8f6a Workbench: Linear => srgb conversion 2018-05-02 17:37:11 +02:00
Dalai Felinto
b6b17338c2 Fix mysterious crash on tooltips
This was a hard to reproduce bug, but it happens often enough.
Basically the tooltip of the active tool was been invoked when
context had no valid ScrArea which would lead to a crash.

We now just return no tooltip in these cases.
2018-05-02 17:37:05 +02:00
3fa6b6ed4c Depsgraph: Add function to iterate over all original IDs 2018-05-02 17:09:44 +02:00
7c32ef84aa Use meaningful debug name for render depsgraph 2018-05-02 17:09:44 +02:00
6560a96232 Depsgraph: Show log message when tagging specific depsgraph ID 2018-05-02 17:09:44 +02:00
b6aa8a71fd Depsgraph: Add per-depsgraph debug name which is shown in the logs
This way we can see for which depsgraph datablock is being evaluated for.
2018-05-02 17:09:44 +02:00
651a255931 Depsgraph: Cleanup, naming conventions 2018-05-02 17:09:44 +02:00
bb75c4cbe9 Depsgraph: Make all print messages to respect per-depsgraph debug flags 2018-05-02 17:09:44 +02:00
65e6654c85 Depsgraph: Allow per-depsgraph debug flags
Currently only affects EVALUATION debug messages, rest are to be
supported on per-depsgraph level.
2018-05-02 17:09:44 +02:00
2f4dea0ef9 Depsgraph: Use utility function to print CoW update function 2018-05-02 17:09:44 +02:00
c7e0bb0b90 Depsgraph: Make bAction a part of dependency graph
There are various values which depends on context in there, for example
current driver value and original DNA value f-curve is applied for.

This partially fixes issue with not being able to tweak keyed values
when material preview is open.

The material preview is not being currently updated against non-keyed
changes since every tweak of material property does full preview scene
depsgraph evaluation.
2018-05-02 17:09:44 +02:00
98461aa5dc Workbench: Fix interface change in draw maanger 2018-05-02 17:08:42 +02:00
9cfbdff71c Merge branch 'blender2.8' of git.blender.org:blender into blender2.8 2018-05-02 16:59:42 +02:00
befbf7eb9b Vertex Paint: Use Linear colors for interpolation.
This matches Cycles and Eevee's behaviour.
2018-05-02 16:45:08 +02:00
a2b05accea Eevee: Fix vertex color being in srgb space.
Now they are properly converted to Linear space before interpolation.

Since the only way to get vertex color in eevee and cycles is via the
attribute node with the CD_AUTO_FROM_NAME flag, we have to know at binding
time which type of buffer will be connected to this auto input.

We store this information inside the batch cache (together with the according
uniform name) and pass it as uniform to the shader which does conversion if
needed. The same shader can then be reused to draw another mesh with
different auto layers configuration.
2018-05-02 16:45:08 +02:00
648de1be52 Modifiers: ported Skin modifier DerivedMesh → Mesh 2018-05-02 16:39:22 +02:00
3f2f27642e Renamed 1st parameter of BKE_bmesh_to_mesh from me to be
It's a BMesh, it shouldn't be called `me`
2018-05-02 16:39:22 +02:00
6a9e6b1448 Merge branch 'blender2.8' into tmp-static-override-insertion 2018-05-02 16:16:17 +02:00
ce7575c823 Static Override: Move 'auto' flag into override struct, expose it to RNA. 2018-05-02 16:15:52 +02:00
40771a0e9e Modifiers: ported Solidify modifier DerivedMesh → Mesh 2018-05-02 16:03:16 +02:00
2450b70efa Mesh: add runtime customdata dirty flags 2018-05-02 15:52:59 +02:00
9e477bdf63 Mesh: move runtime members to own struct 2018-05-02 15:48:17 +02:00
ae1ba7679c Workbench: update of 3dview 2018-05-02 15:32:59 +02:00
5659d8bc0a Merge branch 'master' into blender2.8 2018-05-02 14:40:00 +02:00
23fe6e7eab Merge branch 'master' into blender2.8 2018-05-02 14:37:32 +02:00
eaf6345d4b Lattice modifier: take comparison out of loop 2018-05-02 13:51:31 +02:00
1f8720cf05 Modifiers: ported Lattice modifier DerivedMesh → Mesh 2018-05-02 13:42:09 +02:00
d09920687c Merge branch 'master' into blender2.8 2018-05-02 12:46:14 +02:00
adc17317c5 UI: open toolbar hold buttons on drag
Allows for faster tool switching, no need to wait for it to open.
2018-05-02 12:20:11 +02:00
81175eb40d Modifiers: ported Bevel modifier DerivedMesh → Mesh
This introduces `BKE_mesh_to_bmesh_ex()`, which exposes all of the
`BMeshFromMeshParams` parameters to the caller. This is required to enable
the `calc_face_normal` flag, which is required for the Bevel modifier.

This also introduces `BKE_bmesh_to_mesh()`, which allocates a new `Mesh`,
converts the `BMesh` to it, and returns it. The returned mesh is owned by
the caller.
2018-05-02 12:15:00 +02:00
baf0547de5 Workbench: Single Color Modes
- ability to switch between Single Color, Object Color, Material Color
and Random Color
 - fixed Shading and Lighting popover
 - Renamed Solid -> Single Color
2018-05-02 12:05:40 +02:00
62ed13340b UI: don't allow disabled popovers to open w/ drag
First dragging over active menu items could be used to open a disabled
popover.
2018-05-02 12:02:50 +02:00
404758cc20 Cleanup. 2018-05-02 11:49:27 +02:00
77ac911b3c Static Override: Add proper 'apply' callback for object constraints insertion.
Seems to be working fine, still need to figure out how to make inserted
constraints fully overridable... ;)
2018-05-02 11:35:24 +02:00
43f9b6ba45 Tweak constraint copying code for static override needs.
No expected change in any existing behaviour from this commit.
2018-05-02 11:34:19 +02:00
31d5fcd2a7 UI: run redo poll check in operators context 2018-05-02 11:33:24 +02:00
85dcdb87d2 UI: fix operator redo showing empty popovers
Many operators have no options,
showing a popover button with no content isn't good.
2018-05-02 11:03:03 +02:00
2bc9396b55 UI: disable popovers when panel poll fails 2018-05-02 11:03:03 +02:00
9b21055dfb WM: utility to check if an operator will draw a UI
Checking if a redo operator will show something is needed
to avoid empty redo popover.
2018-05-02 11:03:03 +02:00
Dalai Felinto
3def6c7f8e Edit Mesh: look-cut copy-on-write support
Note: As already commented in the code, the ideal solution would
be to pass select mode as parameter to ED_view3D_backbuf_validate.

Without that we have to resort to the hack solution of writing to
evaluation data.
2018-05-02 10:13:22 +02:00
c7947b2115 Static override: Add basic two-passes system needed for apply insert op.
And a dummy placeholder for object constraints... All this is WIP of
course!
2018-05-02 09:54:42 +02:00
429c1d60a4 Static overrides: make it clear collections need specific apply callbacks. 2018-05-02 09:54:42 +02:00
9e87069c3e Static override: initial work for generating 'insertion' in collections.
Does not yet support applying those operations, only detecting
insertions and generating matching rules was already rather complicated.

Also got rid of ;ost rna_path string allocation in collection diffing
code, could help a bit with speed too.
2018-05-02 09:54:42 +02:00
c052346fbf UI: move object selector into 3D view
This matches the new convention for left-handed mode selectors,
however we're still undecided on exactly how this should work.

For now test this out as a convention for all space types.
2018-05-01 22:33:10 +02:00
e1bd883df3 Eevee: Don't enable temporal AA when using 1 sample only.
This was producing infinite rendering but wasn't noticeable.
2018-05-01 19:39:18 +02:00
20c1edf592 Eevee: Shadows: Only tag as shadow caster if a shadow is cast.
This leads to great improvement if the scene have moving objects without
shadows (shadows disabled in the material panel).
2018-05-01 19:39:18 +02:00
52f1510613 UI: move space-mode selectors before menu items
This adds a convention to have a spaces primary mode selector
positioned to at the left of the header.
2018-05-01 18:56:52 +02:00
0d61cab7ce Modifiers: Fix crash when entering edit mode on unported modifiers 2018-05-01 18:47:26 +02:00
Dalai Felinto
3eca0af19c Fix number sliders for the topbar 2018-05-01 18:35:11 +02:00
334b55fd2e Extract common modifier parameters into ModifierEvalContext struct
The contents of the ModifierEvalContext struct are constant while iterating
over the modifier stack. The struct thus should be only created once, outside
any loop over the modifiers.
2018-05-01 18:02:17 +02:00
6b9f1ffe6e Formatting 2018-05-01 18:02:17 +02:00
2d6620a100 Modifiers: Array DerivedMesh → Mesh 2018-05-01 18:02:17 +02:00
1553f6b656 Introduced CDDM_from_mesh_ex() to create a non-referencing CDDM
This allows the mesh to be freed and the CDDM kept.
2018-05-01 18:02:17 +02:00
4211d02ab5 Modifiers: Mirror DerivedMesh → Mesh 2018-05-01 18:02:17 +02:00
eb6fc05f25 Modifiers: Armature DerivedMesh → Mesh
The mesh parameter of armature_deform_verts() is now const, to indicate
that it's safe to pass ob->data to it directly.
2018-05-01 18:02:17 +02:00
7efc75c709 Modifiers: Simple Deform & Build, DerivedMesh → Mesh
This commit introduces `EditMeshData`. The fields in this struct are
extracted from `EditDerivedBMesh` into their own struct `EditMeshData`,
which can then also be used by the `Mesh` struct. This allows passing
deformed vertices efficiently to the draw routines.

The modifier code constructs a new Mesh instead of writing to ob->data;
even when ob->data is a CoW copy, it can still be used by different
objects and thus shouldn't be modified by a modifier.
2018-05-01 18:02:17 +02:00
be4df85919 Modifiers: Add wrapper functions with Mesh / DerivedMesh conversion
Makes the follow changes:

- Add new `deform*` and `apply*` function pointers to `ModifierTypeInfo` that take `Mesh`, and rename the old functions to indicate that they take `DerivedMesh`. These new functions are currently set to `NULL` for all modifiers.
- Add wrapper `modifier_deform*` and `modifier_apply*` functions in two variants: one that works with `Mesh` and the other which works with `DerivedMesh` that is named with `*_DM_depercated`. These functions check which type of data the modifier supports and converts if necessary
- Update the rest of Blender to be aware and make use of these new functions

The goal of these changes is to make it possible to port to using `Mesh` incrementally without ever needing to enter into a state where modifiers don't work. After everything has been ported over the old functions and wrappers could be removed.

Reviewers: campbellbarton, sergey, mont29

Subscribers: sybren

Tags: #bf_blender_2.8

Differential Revision: https://developer.blender.org/D3155
2018-05-01 18:02:17 +02:00
9fcb4e6406 Typo fix 2018-05-01 18:02:17 +02:00
b83d48b574 Added note about potential crash in add_orco_dm() 2018-05-01 18:02:17 +02:00
01a720fc9f Eevee: Fix crash when using visibility groups with dupli objects. 2018-05-01 17:59:40 +02:00
1bef7f9318 Eevee: Contact Shadows: Add slope based bias & fix brightening. 2018-05-01 17:59:40 +02:00
8c92a02720 Eevee: Fix raytracing.
- Fix the confusing naming in raycast()
- Fix raytrace acne caused by the rays not being correctly centered on
  the texel.
2018-05-01 17:59:40 +02:00
92fd931e53 Fix: Silence |RNA_boolean_get: WM_OT_save_as_mainfile.exit not found." warning on exit
The operator in question doesn't define this property.
I'm commenting out for now in case another operator actually still uses it.
2018-05-01 17:43:18 +02:00
f6c1762bb3 Fix previous commit, sorry about that :/ 2018-05-01 17:03:23 +02:00
691c532506 Static override: rename highly confusing var name in apply code.
We use 'reference' to designate the linked ID which is being overridden
by the local one, so using 'reference' to designate the stored local ID
in apply RNA code was... not a good idea. ;)
2018-05-01 17:02:30 +02:00
0636acc59a Icons: updated icons from @billreynish
This adds vertex paint & sculpt icons + other minor changes.
2018-05-01 16:52:12 +02:00
43452c254e Merge branch 'blender2.8' of git.blender.org:blender into blender2.8 2018-05-01 16:28:02 +02:00
be88f23b83 Overlay: Enabled wireframe drawing for vertex/weight paint
This is a temp hack, so that billrey can use blender 2.8 for
drawing the icons. Hack will be phased out by T54910
2018-05-01 16:26:31 +02:00
c5c3fa3eac Fix compiler warning: Uninitialised var 2018-05-01 16:22:36 +02:00
30093a6596 Add/finish rna read-only access to actual override rules.
For some reasons did not add operations themselves previously...
2018-05-01 15:18:30 +02:00
3166086c60 Static Override: fix 'search matching override operation' function.
Previous code was waaaayyyy to flacky, returning matches for things that
did not actually have much in common!
2018-05-01 15:08:38 +02:00
522bee3fc8 Refactoring: bvhutils: Use a function that gets the bvhtree through an identifier type.
Reviewed By: @campbellbarton
Differential Revision: https://developer.blender.org/D3192
2018-05-01 10:03:28 -03:00
008a5d9106 Depsgraph: Add missing relations needed for nested datablock relations 2018-05-01 13:22:55 +02:00
3f4a81232a UI: expose radial gradient as option
Was a separate tool, use option so we can extend more easily.
2018-05-01 12:48:35 +02:00
f38fbc9bed UI: add weight paint sample tools
Also use unified weight.
2018-05-01 12:20:53 +02:00
314420e193 Fix crash opening file saved in weight paint mode 2018-05-01 12:07:38 +02:00
f0982220be Nodes: Remove workaround for action copy
Actions shouldn't be copying by new library management code.
Or at least should be possible to make it to not copy actions
or do unneeded user management.

This way we avoid modification of original data which could
and does cause threading conflict with copy-on-write which
could be happening for viewport.
2018-05-01 12:07:38 +02:00
70d352d994 Tool System: add paint poll which ignores the tool
Needed for tools which ensure paint context but aren't brushes
(color sample & gradient).
2018-05-01 11:42:25 +02:00
2c9670b92d Tool System: support non-brush tools w/ paint modes
Allows select, gradient tools not to conflict with brush keymap.
2018-05-01 11:23:46 +02:00
Dalai Felinto
1e8021a58a Fix missing copy-on-write update when changing edit mode selection mode 2018-05-01 11:15:48 +02:00
0be4b0f7a5 Fix edit mesh selection with copy-on-write enabled 2018-05-01 11:02:55 +02:00
98c767244d Merge branch 'blender2.8' of git.blender.org:blender into blender2.8 2018-05-01 10:44:31 +02:00
aad0e52e38 Workbench: Shading popover
- Moved random object color and object outline to shading popover as
these are draw options.
2018-05-01 10:43:27 +02:00
2ce94cc24b Fix crash opening files saved in sculpt/vertex paint modes
Skip access to any evaluated data when operator is run on file load,
we don't have depsgraph evaluated yet. In this case we skip part of
sculpt session initialization, since it will be done during depsgraph
evaluation which happens after DEG_on_visible_update().

We can not skip sculpt session initialization since during normal
operation we want all the data to be initialized on mode change,
and not on initial brush stroke.
2018-05-01 10:14:20 +02:00
af508a1e39 Mark localized node trees and materials as such
Makes it easier to see where the datablock is coming from.
2018-05-01 09:17:17 +02:00
2bd2a2ac03 Depsgraph: Extra sanity checks for copy-on-write tagging 2018-05-01 09:17:17 +02:00
8cf9c58906 Depsgraph: Put original and evaluated ID node pointers to graphviz 2018-05-01 09:17:17 +02:00
04ee606383 Depsgraph: use human readable node type for graphviz debug output 2018-05-01 09:17:17 +02:00
2daab40717 Depsgraph: Cleanup, simplify operation code stringification 2018-05-01 09:17:17 +02:00
2a89ef3da7 Depsgraph: Cleanup, remove unused code 2018-05-01 09:17:17 +02:00
e52dce6408 Animation: Don't user-copunter copy-on-written action block 2018-05-01 09:17:17 +02:00
ed51b93bed Icons: write object children
Allows for sharing geometry between icons.
2018-05-01 08:40:07 +02:00
Dalai Felinto
c21ceb3317 Edit-Mesh: multi-object mark freestyle face
Freestyle face drawing is not working, but I tested it in 2.79, all good.
2018-04-30 22:38:06 +02:00
Dalai Felinto
9ce4a7e824 Edit Mesh: multi-object mark freestyle edge
Freestyle edge drawing is not working though.
2018-04-30 22:38:06 +02:00
Dalai Felinto
0ac3d5f7db Edit Mesh: multi-object mark sharp 2018-04-30 22:38:06 +02:00
Dalai Felinto
61f0608b4a Edit Mesh: multi-object mark seams
Note that I'm using bm->totedgesel instead of bm->totfacesel to skip objects.
2018-04-30 22:38:06 +02:00
2e98524b58 Add support for area lights to the Apply Transform operator
Since area lights are affected by scaling them, it only makes sense to support applying the scale to the lamp size.
Of course, applying location or rotation does not work.

If a scaling that changes the aspect ratio is applied to a square lamp, the mode is automatically changed to Rectangle.
2018-04-30 22:09:23 +02:00
b93a76fe75 Add missing tools to vertex paint 2018-04-30 21:58:35 +02:00
7770d38303 Cleanup: simplify GLSL logic in outlines drawing.
No functional changes.
2018-04-30 16:55:16 -03:00
Dalai Felinto
32c4158047 Fix Merge > To Cursor
In master this is working fine, but in 2.8 ob->imat was identity matrix.
Committing this in master to simplify merging.
2018-04-30 21:42:16 +02:00
Dalai Felinto
aaf85e29a1 Popover: tiny cleanup 2018-04-30 21:13:37 +02:00
40f27e520f Fix T54901: Crash renaming UV layer 2018-04-30 21:03:16 +02:00
a44d5b59d3 UI: order edit-mesh tools
See T54885
2018-04-30 20:40:36 +02:00
ba339379fe Fix linking brushes crashing on load
We need to link brushes for all windows that use a workspace.
2018-04-30 20:09:39 +02:00
33bb8b785a Fix T54900: radial control drawing in wrong place after recent WM changes. 2018-04-30 20:02:39 +02:00
f56b7fb863 Cleanup: de-duplicate paint access from object 2018-04-30 19:42:58 +02:00
188c4a22c9 Cleanup: de-duplicate paint access from object 2018-04-30 18:58:43 +02:00
6e67d8e3bb Cleanup: Move FOREACH_PCHAN_*_IN_OBJECT_*() macros to BKE_armature.h
This reduces the number of headers we need to import (and/or dependencies
on the order of them), as these depend on PBONE_VISIBLE(), which is already
in BKE_armature.h
2018-04-30 18:46:52 +02:00
0020a326ee Copy on write support for Bone Group operators 2018-04-30 18:38:56 +02:00
005f4748c1 Multi-Object Pose: POSE_OT_group_assign/unassign
Like the select/deselect operators, we only support doing this for the
active object for now. From the UI panels, it doesn't make sense to be
operating on bone groups which may not appear/line up with those in the panel
that we're currently dealing with.

This can be reviewed later, but for now, it's easier and makes more sense
this way.
2018-04-30 18:23:05 +02:00
de1405949a UI: show topbar brush options w/ texture paint 2018-04-30 17:06:03 +02:00
3b9554ce9d UI: share common paint panels between all modes 2018-04-30 16:59:16 +02:00
7720525873 UI: add texture paint brushes to toolbar 2018-04-30 16:43:36 +02:00
9114ebe850 Multi-Object Pose Fixes for POSE_OT_armature_apply()
This operator was only partially converted to multi-object editing,
as on one hand, it was using the new "objects in mode" iterator,
while on the other hand, it was also using the context iterator inside
that, making all selected bones across armatures get included.
2018-04-30 16:40:50 +02:00
09dcb6d60c Multi-Object Pose: Fix POSE_OT_group_select and POSE_OT_group_deselect
We only want these to operate on the "active" armature only at a time
(where the "active" one is whichever the groups from the UI came from).
The fix therefore is to make it not use the context functions
(which were changed to always take bones from all selected armatures
instead).
2018-04-30 16:40:50 +02:00
8e78282a94 Eevee: Use GPU_RG16 for velocity pass instead of GPU_RG32F. 2018-04-30 16:39:26 +02:00
0a73000dfc GPUTexture: Add support for GPU_RG16. 2018-04-30 16:39:26 +02:00
eb7188802d DRW: Remove DRWTextureFormat in favor or GPUTextureFormat.
Because:
- Less redundancy.
- Better suffixes.

Also a few modification to GPU_texture_create_* to simplify the API:
- make the format explicit to the texture creation process.
- remove the component count as it's specified in the GPUTextureFormat.
2018-04-30 16:39:26 +02:00
41431eacfa Eevee: TAA: Use safe color when outputing the final color.
This prevent any NANs pixel to spear accross the history. This does not
mean we should allow NANs at all!
2018-04-30 16:39:26 +02:00
630c24fc61 Overlay: missed in last commit 2018-04-30 16:27:34 +02:00
5dab34df50 Overlay: Integration of TexturePaint with Workbench 2018-04-30 16:16:07 +02:00
9aef2d961d UI: add weight paint brushes to toolbar 2018-04-30 16:08:15 +02:00
cbe57acddf Workbench: Integration VertexPaint and WeightPaint modes
- Disable VertexPaint and WeightPaint for OB_MATERIAL and OB_RENDER. Users want to see the final result
 - When in OB_SOLID, the active object should be rendered without any color. The lighting information is multiplied with the VertexPaint/WeightPaint color
 - Removed the use_shading flag from VertexPaint and WeightPaint
 - add method to check if render engine should draw without color (DRW_object_in_only_lighting_mode)

Reviewers: fclem

Tags: #code_quest

Maniphest Tasks: T54894

Differential Revision: https://developer.blender.org/D3191
2018-04-30 15:54:38 +02:00
Julian Eisel
e76a65e359 UV editing: Make 'Select Linked' work consistent to 3D View
Don't see a good reason for the old behavior, so better have it consistent.
2018-04-30 15:42:29 +02:00
d9f395ac39 UI: add vertex paint tools
Generalize logic to show the paintbrush as a tool so
different paint modes can use it.
2018-04-30 15:23:04 +02:00
b5f5e6ce29 Depsgraph: Fix missing node tree update when adding keyframes
Need to make sure animation data is copied from original tree to a copy,
it is NOT enough to only copy node socket values.
2018-04-30 15:16:51 +02:00
05cf7863c3 Fix: UI layout for "Pause" button on timeline header was broken (leaving a gap)
A recent change in the UI layout code probably broke how the scale_x
for layouts was getting handled. This was leaving a large gap
(and causing layouts to pop) when trying to scrub the timeline.

This commit fixes this with a manually-found value that largely seems
to get rid of the popping problem. There's still a little jumping (1-2 px)
but it's less distracting now.
2018-04-30 15:11:43 +02:00
7714d6dd65 COW Fix: Material property update callbacks need to tag depsgraph for COW updates
Otherwise, trying to change color/material properties of EEVEE materials
that have been keyframed doesn't work until a new keyframe has been inserted.

NOTE: There's still some wonkiness if you edit more than one keyframed value
before keyframing (i.e. the other unkeyed value temporarily gets reset). But
that's more of a general COW+animation issue.
2018-04-30 14:49:07 +02:00
36324f9dab ANIM_apply_keyingset() - Tag modified datablocks for copy on write update for good measure 2018-04-30 14:49:07 +02:00
5f8ad885e1 Fix some popup menus that don't support it refreshing and crashing. 2018-04-30 14:27:44 +02:00
78f13ee46c UI: use "none" icon if loading fails
Workaround for issues w/ two column layout when icons are missing.

Also fix reloading icons when some values aren't valid.
2018-04-30 13:57:47 +02:00
85221f6fa7 Fix Eevee shadows not working in certain cases, after recent WM changes. 2018-04-30 13:52:25 +02:00
005711ffef Fix sculpt ToolDef generation
With non-default sculpt brushes, tool generation could fail.
2018-04-30 13:46:01 +02:00
ea2146c3e1 Correct error in toolbar update 2018-04-30 12:46:23 +02:00
310bfe1a77 3D View: refresh on Overlay & Shading changes 2018-04-30 12:36:23 +02:00
bfe88006a3 Remove unused function
Is not needed anymore since 9577ebde79.
2018-04-30 12:27:18 +02:00
a88a8528f1 Draw manager: Fix wrong engine type used for view update
Was causing temporal sampling artifacts when scene is set to Cycles
and viewport is set to Eevee. Visually was looking like ghosting or
motion blur when moving objects.
2018-04-30 12:20:30 +02:00
f4697b392d Tool System: change internal definitions (again)
Was using classes to define tools, however this makes it awkward to
dynamically generate them (we can do it, but its not very "Pythonic").

Move to a named tuple.
2018-04-30 12:14:46 +02:00
98fe9da37d Add NULL check for transform manipulator
Removes need for empty keymap
2018-04-30 12:14:10 +02:00
Julian Eisel
5ea85d0b04 DNA: Unnecessarily big padding size in Object struct
Was added in 159806140f.
2018-04-30 11:18:54 +02:00
cb37080627 Topbar: Enable Vertex Paint tools
Discussed with Campbell just to use the .dummy for now.
2018-04-30 10:40:54 +02:00
422a325acf Fix build of Alembic test. 2018-04-30 10:04:29 +02:00
128506eeb1 BLI Color: YUV to/from rgb colorspace option
This commit does two things:

- Adds an option to do the calculation in different color spaces (BT601
or BT709).
- Changes the default caluclation from legacy BT601 to BT709.

This affects several areas:

- UI areas (mainly scopes)
- ViewLevelsNode
- Several other nodes that use `COM_ConvertOperation.h`
2018-04-29 18:00:45 -04:00
7297b1881e Fix accidentally removed code in recent commit. 2018-04-29 22:11:15 +02:00
7a9f64e665 UI: better support for dynamically sized regions in topbar.
Dynamically sized regions in the topbar were flickering due to only updating
their size after redraws. Now there is an optional layout() callback for
all regions in an area to do UI layout first, then refresh the region layout,
and then do the actual drawing for each region.

Task T54753
2018-04-29 22:11:12 +02:00
0c512a6f95 Fix missing NULL check when setting the tool 2018-04-29 19:14:51 +02:00
4218a94b1e UI: disable top-bar tool name drawing
Makes text jump about.
2018-04-29 18:03:01 +02:00
b5985831e2 UI: show add/subtract as icons
Saves space in the topbar
2018-04-29 17:38:17 +02:00
5cdeae2105 UI: show basic sculpt options in topbar 2018-04-29 17:33:08 +02:00
e84735de45 Cleanup: rename snake_hook 2018-04-29 17:08:24 +02:00
60ce3275c1 UI: use sculpt icons in the toolbar 2018-04-29 17:01:10 +02:00
7c3a028e85 UI: new sculpt icons from @billraynish 2018-04-29 17:00:46 +02:00
79638c5c30 UI: backface cull generated icons
Allows for keeping icons 3D without adding extra geometry at export.
2018-04-29 16:51:15 +02:00
695326eb8f UI: remove toolbar separator between categories
Made cursor split from selection tools, giving ugly 2 column layout.
2018-04-29 16:49:24 +02:00
65d78f4695 UI: group sculpt brushes in the toolbar
All sculpt brushes are accessible from the toolbar, grouped by type
to keep the toolbar a fixed size.
2018-04-29 16:36:31 +02:00
6f544f635b UI: fix toolbar groups w/ data_blocks 2018-04-29 16:24:40 +02:00
8c4ff84ed6 UI: hide sculpt panels from toolbar
These are already available from the topbar.
2018-04-29 16:22:40 +02:00
3b785be8f4 Cleanup: warning, use STRNCPY macro 2018-04-29 14:48:30 +02:00
76282a986d UI: initial dynamically generated sculpt tools
Lots more work needed, this just lists sculpt tools in the toolbar.
2018-04-29 14:31:00 +02:00
6e76a35f07 Tool System: support data-blocks in tools
Needed so tools can set the active brush.
2018-04-29 14:30:09 +02:00
f4ba7667dc UI: support tool generators (no visible change)
This allows toolbar definitions to dynamically generate tools,
needed for generating a tool list from brushes for eg.
2018-04-29 12:28:21 +02:00
e017876f78 3D View: add initial view.shading and view.overlay in RNA.
These are mostly empty still, many properties need to be renamed and moved there.
2018-04-29 09:55:47 +02:00
16c05161e7 Cycles: Cleanup: Remove double semicolons 2018-04-29 09:28:41 +02:00
03957b9487 3D View: move shading and overlay settings into popovers.
* This is just moving buttons to get a bit closer to the intended design,
  better naming and layout is needed.
* Popovers currently work best when the 3D view header is at the top, with
  the most important settings nearest to the mouse. Open design question is
  if we should flip (part of) the buttons if header is at the bottom.
* Another question is if selecintg a shading mode enum should immediately
  close the popover since those are changed often, unlike the other settings
  for which it seems more convenient to keep the popover open.
2018-04-29 09:22:00 +02:00
97c7db168d UI: auto open adjacent pulldown and popover buttons. 2018-04-29 09:18:54 +02:00
fc32bd729c UI: don't flip contents of popovers, avoid closing when size changes. 2018-04-29 09:18:54 +02:00
cb53c9bc7b Fix use of removed Blender Internal properties. 2018-04-29 09:18:54 +02:00
a56d6e467b UI: show popover arrow directly under the button
A visual hint but looks broken when its not pointing to the button.
2018-04-29 09:16:32 +02:00
ca7964c24b UI: fix toolbar not snapping properly with system DPI and display scale. 2018-04-28 20:50:47 +02:00
b5d3fcc9f5 Python/UI: add more convenient API for drawing based on DPI.
system.ui_scale: size multiplier to use when drawing custom UI elements.
system.ui_line_width: suggested line thickness and point size in pixels.
2018-04-28 20:49:46 +02:00
e87dd9aa00 Edit Mesh: loop-cut multi-object support 2018-04-28 18:26:44 +02:00
Dalai Felinto
922ea41395 UI: Number Slider - treat percentage as a special case
This is to address things like a percentage slider with a fixed soft mininum.

For example, the render resolution ranges from 1% to 100% and it is really
strange to have the slider showing nothing filled when the ui shows 1%.
2018-04-28 16:55:17 +02:00
Dalai Felinto
9b0ea92be7 UI: Number slider uniform filling
Now we always fill the slider with a vertical boundary. A bit hard to explain,
but very easy to see the difference.

I split the widget in three parts and used fragment shader discard to remove the
undesired bits. That means all the widget program is doing a bit extra
calculation.

Reviewers: fclem

Subscribers: billreynish

Differential Revision: https://developer.blender.org/D3186
2018-04-28 16:54:57 +02:00
Dalai Felinto
c06bfe9d09 UI: Remove hardcoded 11 uniform parameters
Using a define makes it easy to increase this later.
2018-04-28 16:33:15 +02:00
Dalai Felinto
c6fccbf842 UI: Remove deprecated drawing code 2018-04-28 16:33:15 +02:00
54aa834b7d Cleanup: fix compiler warnings on macOS / clang. 2018-04-28 16:28:19 +02:00
bf75b24818 UI: fix incorrect scaling of manipulator widgets with DPI.
U.ui_scale is the setting from the user preferences and should never be used
for drawing. UI_DPI_FAC is the final scale after DPI from the operating system
is taken into account.
2018-04-28 16:16:04 +02:00
61759f3b55 Cleanup: remove code for removed Blender Internal properties. 2018-04-28 16:15:42 +02:00
b6e66a66c2 Fix number button sides exiting continuous grab 2018-04-28 15:38:33 +02:00
d5a766a9ed Merge branch 'master' into blender2.8 2018-04-28 14:49:08 +02:00
60f4cb24da Fix vertex paint alpha brush setting color black 2018-04-28 14:47:53 +02:00
ffda096413 Cleanup: meaningful names for color blending 2018-04-28 14:45:10 +02:00
a74097dc19 UI: Add icon color saturation preference
Toolbar icon saturation can now be set from the preferences,
(use 0.4 by default).
2018-04-28 13:34:52 +02:00
69ca12c45c Revert "UI: don't highlight number button while dragging"
This reverts commit bb513b173e.

Broke click events.
2018-04-28 12:20:38 +02:00
e1417c665d UI: split toolbar layout from button creation
Having single & multi-column checks inline were becoming unmanageable.

Use a generator to define the layout,
allows for easily adding different layouts in the future.
2018-04-28 11:42:53 +02:00
a14005c070 UI: fix popover menus not refreshing when changing settings. 2018-04-28 10:42:58 +02:00
a593cc046c UI: put active tool buttons in center topbar region. 2018-04-28 10:42:58 +02:00
128b7ddd83 Fix multi-editmode memory leak
Previous commit only removed return's.
2018-04-28 09:34:48 +02:00
159a7e8b38 UI: replace transform hand icon w/ 4 arrows
The hand doesn't have a hotspot which you might want using manipulators
2018-04-28 09:14:02 +02:00
617534327a Cleanup: style, duplicate includes 2018-04-28 09:02:22 +02:00
cfa1700792 UI: add loopcut & edge offset tools
Also fix minor layout bug.
2018-04-27 23:08:25 +02:00
c42a47d177 UI: add new transform tool that enables all widgets
Also add bevel tool.
2018-04-27 22:49:52 +02:00
bb513b173e UI: don't highlight number button while dragging 2018-04-27 22:25:54 +02:00
e97ab28a03 Edit Mesh: skip unselected meshes w/ fill holes 2018-04-27 21:52:08 +02:00
69b95b45f4 Edit Mesh: multi-object support for 'Fill Holes' 2018-04-27 21:22:21 +02:00
e724238457 Tool System: use release_confirm for extrude 2018-04-27 20:43:41 +02:00
c4a24a7f5d Tool System: inset tool now completes on release 2018-04-27 20:38:29 +02:00
c0c9eb7fe2 Fix quad view region dividing lines not drawing after recent changes. 2018-04-27 20:33:58 +02:00
0adabe33bd UI: respect separators for row layout 2018-04-27 20:03:43 +02:00
970cf6f765 UI: use the layouts scale_x to scale icon width 2018-04-27 20:03:43 +02:00
Dalai Felinto
a6fb54f236 UI: Set cursor to X_MOV when editing number button middle area
Reviewers: campbellbarton, brecht

Differential Revision: https://developer.blender.org/D3184
2018-04-27 19:38:18 +02:00
782240636c UI: use new extrude icon and correct keymap 2018-04-27 19:16:00 +02:00
fd68bdf7f9 UI: updated icons from @billreynish
- black outlines (better readability).
- add bone roll.
- add extrude to cursor.
2018-04-27 19:02:44 +02:00
a55016d5ef Draw Edit Curve Overlay: Fix the offset direction of the contour of selected handles 2018-04-27 14:00:22 -03:00
9cc9db87bb Fix missing action zones and emboss in the 3D viewport.
Not really happy with the fix, but it works. With the new window draw method
we are no longer storing the 3D viewport in 4 buffers, by having the GPU
viewport function directly as the 3rd buffer. This means we need to draw the
action zones into it, and so we need to keep the framebuffer bound a little
longer.
2018-04-27 18:52:19 +02:00
351d782286 UI: disable 3 column toolbars
They conflict a little with showing a narrow toolbar w/ text.
2018-04-27 18:20:48 +02:00
eb4c60124c UI: multi-column toolbar support 2018-04-27 18:02:45 +02:00
Dalai Felinto
964a2dd73f UI: Bring Embossing for the top-bar and quad-view
Note: Quad-View region overlay drawing is not working because of e01cadd657.
However I tested this patch after reverting that commit locally and this
patch's code seems fine.

Partial revert of 3d62230ed6.
2018-04-27 17:47:19 +02:00
ca66112b29 Fix missing icons in non-portable local builds.
The problem is that some local path is always returned by
bpy_resource_path. The function does not enforce a check for existence
of the path in the low level code.

Since client code may indeed not care about existence of the directory,
I leave bpy_resource_path alone and patch the python code to check for
existence. An  extra argument that enforces the check might be a better
solution, but I will be leaving this to the UI team.
2018-04-27 17:10:39 +03:00
c6d68916ed Fix multi-editmode memory leak 2018-04-27 15:38:35 +02:00
84a706a366 Minor fix, report missing instead of corrupt icon if file does not exist 2018-04-27 15:34:54 +03:00
85ea14df2f UI: support for tool settings in the top-bar
This uses the operators last used properties
to store settings to use on the next execution.
2018-04-27 14:17:12 +02:00
9504652687 UI: move tool definitions to classes
Originally it was nice to have a small list of definitions
with tools inline.

However we need to be able to define drawing functions for tools
which Python can't easily inline.

Use function for keymap definition,
support creating a function from a tuple as well
(handy for simple key-maps).
2018-04-27 13:55:04 +02:00
e01cadd657 WM: new offscreen window draw method to replace all existing methods.
For Blender 2.8 we had to be compatible with very old OpenGL versions, and
triple buffer was designed to work without offscreen rendering, by copying
the the backbuffer to a texture right before swapping. This way we could
avoid redrawing unchanged regions by copying them from this texture on the
next redraws. Triple buffer used to suffer from poor performance and driver
bugs on specific cards, so alternative draw methods remained available.

Now that we require newer OpenGL, we can have just a single draw method
that draw each region into an offscreen buffer, and then draws those to
the screen. This has some advantages:

* Poor 3D view performance when using Region Overlap should be solved now,
  since we can also cache overlapping regions in offscreen buffers.
* Page flip, anaglyph and interlace stereo drawing can be a little faster
  by avoiding a copy to an intermediate texture.
* The new 3D view drawing already writes to an offscreen buffer, which we
  can draw from directly instead of duplicating it to another buffer.
* Eventually we will be able to remove depth and stencil buffers from the
  window and save memory, though at the moment there are still some tools
  using it so it's not possible yet.
* This also fixes a bug with Eevee sampling not progressing with stereo
  drawing in the 3D viewport.

Differential Revision: https://developer.blender.org/D3061
2018-04-27 12:14:14 +02:00
868c9ac408 UI: show active tool in the topbar 2018-04-27 10:50:11 +02:00
3556838983 Fix build error after recent changes (missing FILE). 2018-04-27 10:21:56 +02:00
b756e869ee WM: Add function to access last operator props
Needed for tool-settings to control options for a tool
which has not yet been executed.
2018-04-27 10:05:03 +02:00
0908fc1190 Tool System: publish/subscribe to tool changes 2018-04-27 08:24:20 +02:00
5752e4f06f WM: message bus rna utilkity macros 2018-04-27 08:23:16 +02:00
226c757b44 UI: add darker theme color for toolbar items 2018-04-26 21:18:27 +02:00
9183592698 Animation: Make it possible to keyframe to with copy-on-write
The issue was that every object tweak was doing a full copy
of original datablock onto evaluated version, and was updating
animation. This made it impossible to tweak properties which
has keyframes.

Proposed solution is to:

- Always apply animation on frame change, and when object
  is explicitly tagged for animation update.

  This will store original DNA value of animated property
  in the f-curve.

- When applying animation in other cases, we check original
  DNA value stored in f-curve with the actual original DNA
  property. If they differ, it means user started to tweak
  animated property, and we should skip animation.

  If the value is the same, we apply animation.

This is just a first step towards proper final implementation,
but seems to be the direction we want to take.
2018-04-26 18:11:58 +02:00
c86be7345b Tool System: expose tool space-type 2018-04-26 17:58:37 +02:00
3ca20148c4 Animation: Split f-curve reading and writing functions
This way we can re-use reading part.
2018-04-26 17:24:00 +02:00
46a256b5d1 Depsgraph: Make it possible to check for ID directly tagged for animation recalc 2018-04-26 17:22:17 +02:00
67b014af48 Workspaces: active view layer now always comes from workspace, not scene.
Both the scene and workspace had an active view layer, and it was confusing
which settings were being used or displayed where. Now we always have one,
so there is no mismatch.

The "View Layers" tab in the properties editor is now "View Layer", no longer
showing a list of layers. Instead view layers can be added and removed with
the workspace view layer selector. They are also listed and selectable in the
outliner.

Single layer rendering uses the active view layer from the workspace.

This fixes bugs where the wrong active view layer was used, but more places
remain that are wrong and are now using the first view layer in the scene.
These are all marked with BKE_view_layer_context_active_PLACEHOLDER.
2018-04-26 17:06:14 +02:00
c490428bd4 UI: desaturate toolbar icons that the mouse is not over.
This does not look great with light toolbar buttons as in the default,
so consider this a work in progress.
2018-04-26 16:37:59 +02:00
5876856f7b Properties: remove redundant settings from workspaces tab.
Use render settings and active view layer will be handled elsewhere.
Also change icon to not be confusing with render layers.

Probably we should get rid of the workspace tab entirely and do it in
the user preferences, but that's for later.
2018-04-26 16:37:59 +02:00
11995c5a6e Fix reversed diff output order in view layer tests. 2018-04-26 16:37:59 +02:00
d60be68100 Fix crash with depsgraph iterator and empty scene.
This causes crashes in the view layer tests.
2018-04-26 16:37:59 +02:00
Julian Eisel
a31807ed7c Reduce size of scrollbars that don't contain scale markings
More changes will follow, this is just an initial tweak.
2018-04-26 15:34:39 +02:00
2fc5f3f378 UI: support icon reloading (F8 key) 2018-04-26 15:19:56 +02:00
29e96158b9 Icons: correct arg parsing
Use _PyArg_ParseTupleAndKeywordsFast
2018-04-26 15:18:00 +02:00
05c9ddb2d6 UI: correct icon 2018-04-26 15:02:50 +02:00
b98311f847 Cleanup: avoid direct access to private class 2018-04-26 14:55:46 +02:00
26644cd424 Merge branch 'master' into blender2.8 2018-04-26 14:36:00 +02:00
3f1df6f6fc Fix T54836: Select sharp edges doesn't flush to faces 2018-04-26 14:35:55 +02:00
57405054b2 Fix T54836: Select sharp edges doesn't flush to faces 2018-04-26 14:32:35 +02:00
Julian Eisel
35742e882f Merge branch 'master' into blender2.8 2018-04-26 14:24:41 +02:00
2ebcde701a BLF: Fix problem with drawing with fonts with multiple size.
Fix T54838 : Text display glitch w/ fonts at different sizes.

This was cause by the cache not being flushed when changing font texture.
2018-04-26 14:21:16 +02:00
df3ea82b84 Workbench: GLSL layout locations
Added layout locations
2018-04-26 14:12:39 +02:00
Julian Eisel
3c7500ca71 Cleanup: Use enums for View2D value defines
Makes the file much less cluttered and more structured.
Also made some whitespace tweaks.
2018-04-26 14:07:03 +02:00
6a0264896b UI: toolbar single column size snapping
Once a region is set to it's snapped size, zooming keeps the size.
2018-04-26 12:08:58 +02:00
e0c088f8fb GHOST: WGL: Make background rendering works on windows.
When creating an offscreen context we need wglCreatePbufferARB to create
a drawable. In non-background mode wglCreatePbufferARB would have been set
by the main window creation code. But in background mode this is not the
case so we need to create a dummy context using the screen window to init
wglew properly.
2018-04-26 11:49:47 +02:00
d37dcc4880 Fix discontinuity in default UVs for a torus
Reported in T47489 by Simon Windmill (coolpowers) who also provided the
fix, thanx.

Reviewed by Sebastian Witt (witt)
2018-04-26 11:18:59 +02:00
7fcdccbb6c Fix vertex slide regression from multi-edit
- Invalid casts.
- Leaked memory on mode switching.
2018-04-26 10:18:03 +02:00
ba9b01d3c0 Merge branch 'blender2.8-workbench' into blender2.8 2018-04-26 08:47:28 +02:00
badab5cb7d Workbench: Hair rendering 2018-04-26 08:46:58 +02:00
6c608b2f8a Workbench: Environment Light
- Changed defaults
 - Updated render panel
2018-04-26 08:31:14 +02:00
4afbbb8cf9 UI: correct toolbar w/ text display
Missed in tuple to dict refactor.
2018-04-26 08:18:41 +02:00
f7d9db5e68 Missed last commit 2018-04-26 08:10:52 +02:00
52454f1290 UI: fix toolbar naming collision bug
Active tool name needed to be unique from all other tools.
This caused problems since different modes have different tools with the
same name (Armature/Mesh click to extrude for eg).

Tool names now only need to be unique per mode.
2018-04-26 08:09:03 +02:00
27d837a6ac Workbench: Shader compilation 2018-04-26 08:06:22 +02:00
e4ee23f780 Merge branch 'blender2.8' into blender2.8-workbench 2018-04-26 07:52:09 +02:00
3e2edb160f UI: update tool docstring
Also assert on invalid tool definitions.
2018-04-26 07:39:15 +02:00
37ca6ef7d8 UI: use dict for tool definitions
Using tuple was becoming too cryptic - new settings needed to be added
last and the purpose of each wasn't very clear.
2018-04-26 07:31:39 +02:00
db68166ed8 UI: update icons from @billreynish 2018-04-25 22:03:47 +02:00
c509922605 UI: use a wider minimum menu width
Icon only buttons with menus would be too narrow,
especially buttons for selecting tools.
2018-04-25 21:54:29 +02:00
6c1a121aef Workbench: normal packing
Normal packing. The sign is stored in the A of the color buffer.
if the A == 1.0 the normal should be inverted. before use.

The reason is that packing has more precision for frontfaces, than for
backfaces
2018-04-25 21:33:59 +02:00
8430249791 UI: shrink operator menu hold triangle a little 2018-04-25 21:24:55 +02:00
7a67bb7018 UI: workaround for text & icon alignment
Blender's icons weren't written to draw different sizes.
For now ifdef in a hack to show toolbar icons larger.
2018-04-25 21:02:50 +02:00
700012b66e UI: icon-only hold popup uses region alignment
Gives nicer tool popups for icon only buttons.
2018-04-25 20:51:49 +02:00
81f19b0c5f Fix selection with image planes 2018-04-25 19:01:41 +02:00
ce7c6e3894 Multi-Pose: Port POSE_OT_select_mirror 2018-04-25 18:35:20 +02:00
46bfdb48a1 WM: Add GHOST lazy init for background mode.
This allows for background rendering with EEVEE and other opengl render
engine.

I've only tested it on Linux for the moment so I can't say about other
platforms.

We do lazy init because we cannot assume we will need Ghost for rendering
before having parsed all arguments and we cannot know if a script will
trigger rendering. This is also because it currently does not work without
any display server (blender will crash).
2018-04-25 17:43:18 +02:00
56fbdd7908 GHOST: Fix missing glXCreatePbuffer initialisation.
For some reason this happened if no windows are created before creating an
offscreen context.
2018-04-25 17:43:18 +02:00
284dbd56df GHOST: GLX: Remove old version check. 2018-04-25 17:43:18 +02:00
5337f66e81 EEVEE: UI: Add missing separator. 2018-04-25 17:43:18 +02:00
d19dc5f891 EEVEE: UI: Merge the custom parallax checkbox with the panel title. 2018-04-25 17:43:18 +02:00
0113693129 Merge branch 'master' into blender2.8 2018-04-25 17:27:23 +02:00
f69feb4957 UI: optionally pass icon size to widget_draw_icon
No functional changes.
2018-04-25 17:26:45 +02:00
e584f3d8d2 Depsgraph: Don;t use copy actions flag
Is useless without main.
2018-04-25 17:00:41 +02:00
99c5bd0cd9 Merge branch 'master' into blender2.8 2018-04-25 17:00:19 +02:00
89bcc80c25 Library: Add assert to catch unsupported copy flags combination
Thanks Bastien for review!
2018-04-25 16:59:35 +02:00
fa43886690 Workbench: make normal packing optional 2018-04-25 16:57:18 +02:00
75e0767849 Merge branch 'master' into blender2.8 2018-04-25 16:35:11 +02:00
a153acde1d Depsgraph: Introduce flag top indicate scene is evaluating for a new frame 2018-04-25 16:34:55 +02:00
e5633114cd Depsgraph: Preserve CoW ID recalc flags
Previously they would have been replaced with flag from original
datablock, which is not what we want.
2018-04-25 16:34:55 +02:00
29631ff013 Depsgraph: Ensure we only expand scene datablock on evaluation
Previously it could have happened on every request to evaluated scene
or view layer.

This commit also removes expansion of view layer and scene from iterator.
Iterator is not to be used before depsgraph is evaluated.
2018-04-25 16:34:55 +02:00
09da47b67a Depsgraph: Avoid hash lookup for every evaluated scene query
Cache pointer to evaluated scene datablock on relations build time,
that pointer never changes after that.
2018-04-25 16:34:55 +02:00
331e97bcf3 Depsgraph: Fix missing relations in array modifier
Found by Dr. Sybren while working on modifiers port.
2018-04-25 16:34:01 +02:00
5f97331ffc Workbench: Added studio lighting to view layer 2018-04-25 15:59:15 +02:00
a9d3f9f54d Revert "UI: fix inconsistency in button rounding when zooming in."
This isn't working well when zoomed out in the properties editor,
we should be taking into account properties editor zoom level.

This reverts commit 1ba91ae2c0.
2018-04-25 15:42:41 +02:00
cc7460eaa4 Fix multi-edit mode on file load
Setting up the initial object mode would change objects which were
already moved into their mode along with the active object.
2018-04-25 15:29:20 +02:00
4b8d7a143e Merge branch 'master' into blender2.8 2018-04-25 14:54:34 +02:00
13b6867d1f CDDM: correct (disabled) logic in merge verts 2018-04-25 14:53:44 +02:00
cdfc4c0d1d Search local before system path
This works in both cases,
where system path would return a path even when it's missing.
2018-04-25 14:13:32 +02:00
c392f2448c Merge branch 'blender2.8' of git.blender.org:blender into blender2.8 2018-04-25 13:44:45 +02:00
a8f114258a Merge branch 'master' into blender2.8 2018-04-25 13:35:38 +02:00
Dalai Felinto
0357493033 Fix T54806: Editors drawing glitch when using lasso selection
We should always reset to default glBlendFunc after done drawing.
2018-04-25 13:08:34 +02:00
74b0976926 Merge branch 'blender2.8-workbench' into blender2.8
Support of hair in workbench
2018-04-25 13:08:02 +02:00
fe149da993 Edit Mesh: don't recalc all meshes w/ extrude 2018-04-25 13:06:03 +02:00
9e3e648a08 Depsgraph: Clarify python API
Follow same naming convention as for C:

- Original data is named without any extra prefix/suffix.
- Evaluated data is named with _eval suffix.
2018-04-25 13:04:14 +02:00
5345f28229 Workbench: Enabled Hair rendering 2018-04-25 13:00:18 +02:00
53dc251fd3 Remove developer exception hack
This caused too much trouble, also it's possible users run with
'release' in their CWD causing issues.

Developers can symlink "release/" to "bin/2.79".
2018-04-25 12:54:27 +02:00
d7d20b483a Revert "Fix (unreported) broken 'get system path' in some cases."
This reverts commit f1bc0aedde.
2018-04-25 12:48:51 +02:00
Dalai Felinto
1d7bdbd273 Edit Mesh: multi-object extrude_region
Technically this is the following operator:
bpy.ops.view3d.edit_mesh_extrude_move_normal

But this is a Python operator that in turns calls:
MESH_OT_extrude_region_move

Which in turns calls:
* MESH_OT_extrude_region
* TRANSFORM_OT_translate
2018-04-25 12:37:10 +02:00
7958a2b40e Docs: correct debug help message 2018-04-25 12:30:11 +02:00
26dab9c2fe Buildbot: Attempt to link against Blosc statically
Was broken by f1e6838376.
2018-04-25 12:27:35 +02:00
2de00f495d Merge branch 'master' into blender2.8 2018-04-25 12:26:26 +02:00
9a7f963a02 Cleanup: comments 2018-04-25 12:25:47 +02:00
fca3dbdba5 Fixed wrong merge 2018-04-25 12:23:44 +02:00
336abd6fac Merge branch 'blender2.8' into blender2.8-workbench 2018-04-25 12:20:45 +02:00
Dalai Felinto
791b9d821b Multi-View: Moving panel to render, and rename to Stereoscopy
Multi-View was never a per-viewlayer option. And now that we have viewlayer
it is better to name it in a more recognizable way:

"Stereoscopy" instad of plain "Views".
2018-04-25 12:12:43 +02:00
3315963f0a Merge branch 'blender2.8' of git.blender.org:blender into blender2.8 2018-04-25 12:06:03 +02:00
e236b2977c Overlay: Codestyle
removed unused code
2018-04-25 12:03:27 +02:00
c115021f8b Cleanup: unused vars 2018-04-25 11:59:52 +02:00
8f76d05fa5 Workbench: GLSL performance + code style
- store normal in vec2
 - use rgba_8 for colorBuffer
2018-04-25 11:54:02 +02:00
83528feeed Merge branch 'blender2.8' of git.blender.org:blender into blender2.8 2018-04-25 11:31:03 +02:00
f938ff1010 Workbench: Dither background color/gradient 2018-04-25 11:30:38 +02:00
9befee49a7 Fix: Silence texture stack owner_id warnings in debug mode from anim_filtering code
The Blender Internal removal (51b796ff15)
removed support for texture slots from Materials/Lamps/Worlds,
but didn't remove the relevant parts from the animation editor filtering
code that were responsible for adding the texture slots for those channels.
2018-04-25 11:18:45 +02:00
35220ccde0 Silhouette Overlap Overlay
Added Object Overlap Overlay

 - Added R32UI support to GPU_framebuffer
 - Added R32U support to draw manager
 - The overlay mode has a object data pass that will render 'needed' data to specific buffers so we can mix them together via a deferred rendering. In future will also add UV's and other data
 - Overlap is implemented as an overlay so it could be used on top of the Scene lighted Solid mode (that will be rendered by Eevee.

Reviewers: fclem, brecht

Reviewed By: fclem

Subscribers: sergey

Tags: #code_quest

Maniphest Tasks: T54726

Differential Revision: https://developer.blender.org/D3174
2018-04-25 11:09:49 +02:00
Dalai Felinto
fc8d903000 Edit Mesh: multi-object split 2018-04-25 10:58:59 +02:00
e649feea14 Merge branch 'master' into blender2.8 2018-04-25 10:39:51 +02:00
f1bc0aedde Fix (unreported) broken 'get system path' in some cases.
There were two issues here actually:
* The hack to allow running Blender directly from the source directory
would just check for a 'release' directory, without actually ensuring it
is release dir from blender source tree, and not some other random
folder.
* GHOST_getSystemDir returns nothing for portable installations, now
we'll then check directly in the blender binary dir in that case.

This fix is more critical in 2.8 branch, where that system path is used
to retrieve new '3D' icons...
2018-04-25 10:37:36 +02:00
5f8b85e253 Cleanup: use blender terminology 2018-04-25 10:17:31 +02:00
6866547517 Fix cursor switching w/ transform redo
Recent cursor changes stopped number button continuous grab.
2018-04-25 10:15:20 +02:00
3ae4aa720f Cleanup: indentation 2018-04-25 10:10:00 +02:00
f210c93945 UI: disable advanced option for redo popover 2018-04-25 10:08:04 +02:00
d63b66be82 CMake: only write edited file when changes made
Caused cmake to run after every icon update.
2018-04-25 09:58:38 +02:00
0d69dfbfc1 Cleanup: typos 2018-04-25 09:58:38 +02:00
Dalai Felinto
dfd82b18df Merge remote-tracking branch 'origin/master' into blender2.8 2018-04-25 09:31:25 +02:00
Dalai Felinto
5285de16f3 Fix string comparison in GNUMakefile for linux systems 2018-04-25 09:30:55 +02:00
2fe35914e1 CMake: generate icon list for installation
MSVC users weren't getting icons installed, since glob isn't reliable,
list all files in a section which the update script maintains.
2018-04-25 09:24:54 +02:00
4d6cdb8b89 UI: add extrude icon 2018-04-25 09:21:49 +02:00
deb98cfe5a UI: show all pain mode panels in the topbar
This shows some which need to be hidden (eventually).
2018-04-25 08:20:01 +02:00
ca49a9edce UI: move mode options to the topbar
Remove toolbar panels which have items available in menus.
2018-04-25 08:16:21 +02:00
b00d971efe UI: Apply remove redo region
This was a disabled part of the top-bar merge (code by @Severin)

The only change made is to move to redo UI into a popover.
2018-04-25 07:55:50 +02:00
e944e215bf UI: remove history & object tools
Add object shading menu.
2018-04-25 07:25:08 +02:00
021444c827 UI: mesh rip icons 2018-04-25 07:15:30 +02:00
6a9d215ad5 UI: remove mesh panel 2018-04-25 07:12:34 +02:00
64e3051ebe UI: remove shading & uv's panel 2018-04-24 21:07:05 +02:00
987fc30959 UI: disable grease pencil panel
Disable poll functions since branch replaces this code.
2018-04-24 21:05:24 +02:00
1a8b24e1b1 UI: move rigid body physics to menu 2018-04-24 20:46:18 +02:00
f3692c6ab9 UI: remove animation panel 2018-04-24 20:37:37 +02:00
Julian Eisel
2cd9a0ce5c Hide top-bar in fullscreen
Fullscreen as in the Alt+F10 fullscreen.
2018-04-24 20:16:44 +02:00
34d6b48c47 UI: remove relations panel 2018-04-24 19:54:22 +02:00
5d3f1d1f78 UI: remove transform panels 2018-04-24 19:35:11 +02:00
0c4ceda75b Fix NULL pointer check 2018-04-24 19:34:09 +02:00
d6e7ec6253 Cleanup: unused var 2018-04-24 19:28:53 +02:00
b05fd95f8a Current Frame Indicator tweaks
* Draw the frame/time number box over the scrollbar instead of above it,
  to reduce the clutter/clashes with markers.

* Draw the box centered around the line instead of off to one side,
  making it clearer that the frame shown is the one being affected.

* Make the box larger than the scrollbar + use white text to make it
  stand out from the neighbouring frame numbers (otherwise, it's easy
  to misread that it's just another one of those)
2018-04-24 19:18:31 +02:00
9511cc13d7 Bind Camera to Markers - Various tweaks to make this nicer to work with
Based on discussions here in the office, this commit introduces a number of
changes to make the "Bind Camera to Markers" feature (introduced during Sintel
to facilitate camera switching, and now an integral part of the UI for doing this)
nicer to use.

Main changes:
* "Camera Markers" are now drawn using Camera icons, making it easier to
   distinguish between them and other ("normal") markers

* "Camera Markers" will display the name of the bound marker, making it
   easier to see what camera each marker uses. This will then also stay
   in sync with the camera being used (though a manual refresh is needed
   after renaming objects to make the timeline update), fixing the problem
   where the marker's camera and the name get out of sync.

* Behaviour of Ctrl-B has been modified to make it easier to quickly add
  these markers. Now, it will directly add a new marker on the current frame,
  bound to the currently selected camera object. If there's an existing marker
  on that frame, the existing marker's camera will be replaced instead of making
  a new marker.
2018-04-24 19:18:31 +02:00
ef08e77a46 Markers: Move "Bind Camera to Marker" from 'View' Menu to the Markers menu proper
It was always weird that this tool for markers was stored in a different
menu where it was hard to find.
2018-04-24 19:18:31 +02:00
58650a7599 UI Tweak: Don't hide frame range indicators when preview range is shown
After discussing with UI team, it's better to show both ranges, to make it
clearer that we have an "overlay" with the preview range.
2018-04-24 19:18:31 +02:00
b671b1759c EEVEE: Fix TAA spreading black disease.
The SSR has a bug that creates NAN pixels values. Reported here T54795.
2018-04-24 17:54:39 +02:00
b60617ffab Error in last commit 2018-04-24 17:46:51 +02:00
bd40b2c402 Icons: only write icons from group 'Export'
Allows reference objects not to get mixed up with finished icons.
2018-04-24 17:45:19 +02:00
00d4e99955 UI: move mesh-weights from panels to menus
Also de-duplicate edit/object mode menus.
2018-04-24 17:04:43 +02:00
354dbdde01 UI: hide toolbar text when narrow 2018-04-24 16:33:38 +02:00
e4724b1c8b UI: remove create panel
Move create to the menus.
2018-04-24 16:13:03 +02:00
a59bf99f1d UI: remove toolbar header 2018-04-24 16:04:07 +02:00
9c5025d67d UI: use new icons in toolbar 2018-04-24 15:32:45 +02:00
174cb39192 UI: icons from @billreynish 2018-04-24 15:32:45 +02:00
2a9d008283 Manipulators: Fix Rotate manipulator arc drawing issue. 2018-04-24 15:06:27 +02:00
19808c347d Manipulators: Make rotate manipulator smoother. 2018-04-24 15:06:27 +02:00
adb915c1a6 Manipulators: Enable AntiAliased drawing of manipulators by default.
This exhibit some little artifacts inherent to GL_LINE/POLYHON_SMOOTH but
it's far less distracting than really bad Aliasing.
2018-04-24 15:06:27 +02:00
dd14145511 EEVEE: Fix contact shadows on flat objects/backfaces. 2018-04-24 15:06:27 +02:00
4e0a535670 EEVEE: Group Timing stats for probe rendering. 2018-04-24 15:06:27 +02:00
40199c1d10 Manipulator: Use evaluated object's matrix to get maipulator position
With the clear separation between data and a state we need to make sure
operators and other areas are readingstate from evaluated datablocks.

Code-wise it means that all evaluated values are to be read from dataglock
which is owned by dependency graph, using DEG_get_evaluated_id() or similar
helper.

Reviewers: brecht, mont29, campbellbarton, dfelinto

Differential Revision: https://developer.blender.org/D3036
2018-04-24 14:50:40 +02:00
bb92d9a946 BLI BVHTree Walk DFS: Decreases the size of the stack space used for the recursive function.
Each parameter of the function is copied into the memory stack.
This also brought an improvement in peformance of snapping functions between 5% and 12% in my tests.
2018-04-24 09:48:14 -03:00
eb521b22b2 Make View Selected to be aware of copy-on-write 2018-04-24 14:44:31 +02:00
4376bb6405 Multi-Object Pose: Apply Visual Transforms operator 2018-04-24 14:31:56 +02:00
b96f8bf7fb UI: display icons w/ OSA even when very large 2018-04-24 14:18:56 +02:00
c56bbf60d8 Outliner: reorganize collection related display modes.
* "Scenes" now shows for each scene lists of all view layers, collections and
  objects contained in it. This is the place to see all collections and objects
  in the scene even if they are not used in any view layer. Objects are nested
  according to parenting here.
* "Collections" now shows all collections in the view layer, and the objects
  in those collections. Objects are not nested by parenting, only collections
  since it would be too confusing if the children are in a different collection.
* "Groups" is unchanged.
* "View Layer" was removed, replaced by "Collections".

Part of T54790.
2018-04-24 14:01:51 +02:00
d67b120f17 UI: disable writing icon size
Causes staircasing, just use byte range
2018-04-24 13:52:25 +02:00
011c0b6113 Cleanup: correct comments 2018-04-24 13:50:31 +02:00
Stefan Werner
f1e6838376 Build: Added explicit search for Blosc in CMake files. Unix build will now disable WITH_OPENVDB_BLOSC if Blosc libraries cannot be found. 2018-04-24 13:26:54 +02:00
Stefan Werner
0ab30f9e39 Build deps: Fixed TBB build with GCC 6 and newer, turning off dead store elimination. 2018-04-24 13:23:52 +02:00
3e26b84397 Camera manipulator: Make it aware of evaluated version of object
Reviewers: brecht, dfelinto

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D3159
2018-04-24 12:57:43 +02:00
15bfa175f8 EEVEE: LightProbe: Implement Visibility Group.
Works on every probe type.

The function to see is EEVEE_lightprobes_obj_visibility_cb.

Set pinfo->vis_data.cached to true makes the computation faster for multiple
views using the same group.

We could even sort the probes by group for that mater to speed things up
even more (only applies to dynamic probes like the planar reflections because
other probes are only rendered one at a time).
2018-04-24 12:48:43 +02:00
2ff8f965df DRW: Add visibility callback function.
This add a callback function that runs after frustum culling test.

This callback returns the final visibility for this object.

Be aware that it's called for EVERY drawcalls that use this callback even
if their visibility has been cached.
2018-04-24 12:48:43 +02:00
8fb9dfbec5 EEVEE: LightProbes: Add Visibility Group to DNA/RNA/UI. 2018-04-24 12:48:43 +02:00
9ff8195535 OpenGL: Remove remaining instances of GL_RGBA16F_ARB.
There is no need for it now that we use opengl 3.3. Use GL_RGBA16F instead.
2018-04-24 12:48:43 +02:00
7d859da513 Arc: Use proper lacding branch 2018-04-24 12:26:37 +02:00
Dalai Felinto
08e4808318 Fix EEVEE lamps with shadows by default but wrong UI
Reported on T54788: Actually this was what BI was doing as well.
But anyways fixed for good now.

That includes a subversion bump.
2018-04-24 12:25:41 +02:00
24bde1ca43 Add "make icons_geom" convenience target
Generates icons from the blend file in lib.
2018-04-24 12:09:31 +02:00
67f23cff53 Topbar: clarify command settings name, remove placeholder button. 2018-04-24 11:35:25 +02:00
1ba91ae2c0 UI: fix inconsistency in button rounding when zooming in.
Some widgets would have rounding relative to the button size, others
absolute. Now it's always absolute. Note changing Display Scale in the
user prefs is not zooming, the rounding still scales with that.
2018-04-24 11:10:08 +02:00
1da1288544 Check LOCAL datafiles if SYSTEM not found 2018-04-24 10:45:57 +02:00
Stefan Werner
dac8b08f4c Build deps: Fixed capitalisation of CMake modules path for OpenVDB. Before, OpenVDB would always build without BLOSC and TBB support on case-sensitive file systems. 2018-04-24 10:28:38 +02:00
76b7142690 Merge branch 'blender2.8-workbench' of git.blender.org:blender into blender2.8-workbench 2018-04-24 07:59:18 +02:00
ab10181d57 Merge branch 'blender2.8' into blender2.8-workbench 2018-04-23 20:45:24 +02:00
1fe4ade251 Merge branch 'blender2.8-workbench' of git.blender.org:blender into blender2.8-workbench 2018-04-23 17:04:13 +02:00
d2f4b4962f Overlay: Object Overlap overlay
- Added UInt R support to framebuffers
- Added the overlap as an overlay so should be reusable by other engines
(Scene lighted Solid mode)

Differential Revision: https://developer.blender.org/D3175
2018-04-23 15:13:22 +02:00
86f988cede Overlay: Object Overlap overlay
- Added UInt R support to framebuffers
- Added the overlap as an overlay so should be reusable by other engines
(Scene lighted Solid mode)
2018-04-23 14:54:18 +02:00
1132 changed files with 57208 additions and 37406 deletions

View File

@@ -2,5 +2,6 @@
"project_id" : "Blender",
"conduit_uri" : "https://developer.blender.org/",
"git.default-relative-commit" : "origin/blender2.8",
"arc.land.update.default" : "rebase"
"arc.land.update.default" : "rebase",
"arc.land.onto.default" : "blender2.8"
}

View File

@@ -66,21 +66,12 @@ endif()
# set_property(GLOBAL PROPERTY RULE_MESSAGES OFF)
# global compile definitions since add_definitions() adds for all.
if(NOT (${CMAKE_VERSION} VERSION_LESS 3.0))
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS
$<$<CONFIG:Debug>:DEBUG;_DEBUG>
$<$<CONFIG:Release>:NDEBUG>
$<$<CONFIG:MinSizeRel>:NDEBUG>
$<$<CONFIG:RelWithDebInfo>:NDEBUG>
)
else()
# keep until CMake-3.0 is min requirement
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_DEBUG DEBUG _DEBUG)
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_RELEASE NDEBUG)
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_MINSIZEREL NDEBUG)
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_RELWITHDEBINFO NDEBUG)
endif()
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS
$<$<CONFIG:Debug>:DEBUG;_DEBUG>
$<$<CONFIG:Release>:NDEBUG>
$<$<CONFIG:MinSizeRel>:NDEBUG>
$<$<CONFIG:RelWithDebInfo>:NDEBUG>
)
#-----------------------------------------------------------------------------
# Set policy
@@ -319,7 +310,6 @@ option(WITH_IMAGE_TIFF "Enable LibTIFF Support" ON)
option(WITH_IMAGE_DDS "Enable DDS Image Support" ON)
option(WITH_IMAGE_CINEON "Enable CINEON and DPX Image Support" ON)
option(WITH_IMAGE_HDR "Enable HDR Image Support" ON)
option(WITH_IMAGE_FRAMESERVER "Enable image FrameServer Support for rendering" ON)
# Audio/Video format support
option(WITH_CODEC_AVI "Enable Blenders own AVI file support (raw/jpeg)" ON)
@@ -521,6 +511,45 @@ if(CMAKE_COMPILER_IS_GNUCC)
mark_as_advanced(WITH_LINKER_GOLD)
endif()
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
option(WITH_COMPILER_ASAN "Build and link against address sanitizer (only for Debug & RelWithDebInfo targets)." OFF)
mark_as_advanced(WITH_COMPILER_ASAN)
if(WITH_COMPILER_ASAN)
set(_asan_defaults "\
-fsanitize=address \
-fsanitize=bool \
-fsanitize=bounds \
-fsanitize=enum \
-fsanitize=float-cast-overflow \
-fsanitize=float-divide-by-zero \
-fsanitize=leak \
-fsanitize=nonnull-attribute \
-fsanitize=object-size \
-fsanitize=returns-nonnull-attribute \
-fsanitize=signed-integer-overflow \
-fsanitize=undefined \
-fsanitize=vla-bound \
-fno-sanitize=alignment \
")
set(COMPILER_ASAN_CFLAGS "${_asan_defaults}" CACHE STRING "C flags for address sanitizer")
mark_as_advanced(COMPILER_ASAN_CFLAGS)
set(COMPILER_ASAN_CXXFLAGS "${_asan_defaults}" CACHE STRING "C++ flags for address sanitizer")
mark_as_advanced(COMPILER_ASAN_CXXFLAGS)
unset(_asan_defaults)
find_library(COMPILER_ASAN_LIBRARY asan ${CMAKE_C_IMPLICIT_LINK_DIRECTORIES})
mark_as_advanced(COMPILER_ASAN_LIBRARY)
endif()
endif()
# Dependency graph
option(WITH_LEGACY_DEPSGRAPH "Build Blender with legacy dependency graph" ON)
mark_as_advanced(WITH_LEGACY_DEPSGRAPH)
if(WIN32)
# Use hardcoded paths or find_package to find externals
option(WITH_WINDOWS_FIND_MODULES "Use find_package to locate libraries" OFF)
@@ -781,6 +810,15 @@ set(PLATFORM_LINKLIBS "")
set(PLATFORM_LINKFLAGS "")
set(PLATFORM_LINKFLAGS_DEBUG "")
if(WITH_COMPILER_ASAN)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${COMPILER_ASAN_CFLAGS}")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} ${COMPILER_ASAN_CFLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${COMPILER_ASAN_CXXFLAGS}")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${COMPILER_ASAN_CXXFLAGS}")
set(PLATFORM_LINKFLAGS_DEBUG "${COMPILER_ASAN_LIBRARY}")
endif()
#-----------------------------------------------------------------------------
#Platform specifics
@@ -1510,7 +1548,12 @@ else()
endif()
# Visual Studio has all standards it supports available by default
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang" OR CMAKE_C_COMPILER_ID MATCHES "Intel")
# Clang on windows copies this behavior and does not support these switches
if(
CMAKE_COMPILER_IS_GNUCC OR
(CMAKE_C_COMPILER_ID MATCHES "Clang" AND (NOT MSVC)) OR
(CMAKE_C_COMPILER_ID MATCHES "Intel")
)
# Use C99 + GNU extensions, works with GCC, Clang, ICC
if(WITH_C11)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11")

View File

@@ -236,9 +236,10 @@ help: .FORCE
@echo " * check_descriptions - check for duplicate/invalid descriptions"
@echo ""
@echo "Utilities (not associated with building blender)"
@echo " * icons - updates PNG icons from SVG files."
@echo " * tgz - create a compressed archive of the source code."
@echo " * update - updates git and all submodules"
@echo " * icons - updates PNG icons from SVG files."
@echo " * icons_geom - updates Geometry icons from BLEND file."
@echo " * tgz - create a compressed archive of the source code."
@echo " * update - updates git and all submodules"
@echo ""
@echo "Environment Variables"
@echo " * BUILD_CMAKE_ARGS - arguments passed to CMake."
@@ -423,8 +424,12 @@ icons: .FORCE
"$(BLENDER_DIR)/release/datafiles/blender_icons_update.py"
"$(BLENDER_DIR)/release/datafiles/prvicons_update.py"
icons_geom: .FORCE
BLENDER_BIN="$(BUILD_DIR)/bin/blender" \
"$(BLENDER_DIR)/release/datafiles/blender_icons_geom_update.py"
update: .FORCE
if [ "$(OS_NCASE)" == "darwin" ] && [ ! -d "../lib/$(OS_NCASE)" ]; then \
if [ "$(OS_NCASE)" = "darwin" ] && [ ! -d "../lib/$(OS_NCASE)" ]; then \
svn checkout https://svn.blender.org/svnroot/bf-blender/trunk/lib/$(OS_NCASE) ../lib/$(OS_NCASE) ; \
fi
if [ -d "../lib" ]; then \

View File

@@ -103,6 +103,7 @@ ExternalProject_Add(external_ffmpeg
--disable-indev=jack
--disable-indev=alsa
--disable-outdev=alsa
--disable-crystalhd
PATCH_COMMAND ${PATCH_CMD} --verbose -p 0 -N -d ${BUILD_DIR}/ffmpeg/src/external_ffmpeg < ${PATCH_DIR}/ffmpeg.diff
BUILD_COMMAND ${CONFIGURE_ENV_NO_PERL} && cd ${BUILD_DIR}/ffmpeg/src/external_ffmpeg/ && make -j${MAKE_THREADS}
INSTALL_COMMAND ${CONFIGURE_ENV_NO_PERL} && cd ${BUILD_DIR}/ffmpeg/src/external_ffmpeg/ && make install

View File

@@ -13,3 +13,25 @@
-# pragma message("Unknown compiler version - please run the configure tests and report the results")
-# endif
-#endif
--- a/boost/type_traits/has_nothrow_assign.hpp 2015-12-13 05:49:42 -0700
+++ b/boost/type_traits/has_nothrow_assign.hpp 2018-05-27 11:11:02 -0600
@@ -24,7 +24,7 @@
#include <boost/type_traits/remove_reference.hpp>
#endif
#endif
-#if defined(__GNUC__) || defined(__SUNPRO_CC)
+#if defined(__GNUC__) || defined(__SUNPRO_CC) || defined(__clang__)
#include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/is_volatile.hpp>
#include <boost/type_traits/is_assignable.hpp>
--- a/boost/type_traits/has_nothrow_constructor.hpp 2015-12-13 05:49:42 -0700
+++ b/boost/type_traits/has_nothrow_constructor.hpp 2018-05-27 11:11:02 -0600
@@ -17,7 +17,7 @@
#if defined(BOOST_MSVC) || defined(BOOST_INTEL)
#include <boost/type_traits/has_trivial_constructor.hpp>
#endif
-#if defined(__GNUC__ ) || defined(__SUNPRO_CC)
+#if defined(__GNUC__ ) || defined(__SUNPRO_CC) || defined(__clang__)
#include <boost/type_traits/is_default_constructible.hpp>
#endif

View File

@@ -8,7 +8,7 @@ project(OpenVDB)
# --------------------------------------------------------------------------------
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules")
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
# --------------------------------------------------------------------------------

View File

@@ -88,6 +88,14 @@ elseif(WIN32)
set(DISABLE_RTTI "/EHs- /GR- ")
endif()
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag("-flifetime-dse=1" SUPPORTS_FLIFETIME)
if (SUPPORTS_FLIFETIME)
add_definitions(-flifetime-dse=1)
endif()
endif()
# Linker export definitions
if (WIN32)
add_custom_command(OUTPUT tbb.def

View File

@@ -10,3 +10,29 @@ diff -Naur osl/src/external_osl/src/cmake/flexbison.cmake osl_bak/src/external_o
MAIN_DEPENDENCY ${flexsrc}
DEPENDS ${${compiler_headers}}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} )
--- a/src/include/OSL/oslconfig.h 2016-10-31 16:48:19 -0600
+++ b/src/include/OSL/oslconfig.h 2018-05-27 11:18:08 -0600
@@ -44,12 +44,18 @@
// same if another packages is compiling against OSL and using these headers
// (OSL may be C++11 but the client package may be older, or vice versa --
// use these two symbols to differentiate these cases, when important).
-#if (__cplusplus >= 201402L)
-# define OSL_CPLUSPLUS_VERSION 14
-#elif (__cplusplus >= 201103L)
-# define OSL_CPLUSPLUS_VERSION 11
+
+// Force C++03 for MSVC in blender since svn the libraries are build with that
+#if !defined(_MSC_VER)
+ #if (__cplusplus >= 201402L)
+ # define OSL_CPLUSPLUS_VERSION 14
+ #elif (__cplusplus >= 201103L)
+ # define OSL_CPLUSPLUS_VERSION 11
+ #else
+ # define OSL_CPLUSPLUS_VERSION 3 /* presume C++03 */
+ #endif
#else
-# define OSL_CPLUSPLUS_VERSION 3 /* presume C++03 */
+ # define OSL_CPLUSPLUS_VERSION 3 /* presume C++03 */
#endif
// Symbol export defines

View File

@@ -139,6 +139,10 @@ set(ZLIB_LIBRARY "/usr/lib${MULTILIB}/libz.a" CACHE STRING "" FORCE)
# OpenVDB
set(OPENVDB_LIBRARY
/opt/lib/openvdb/lib/libopenvdb.a
CACHE BOOL "" FORCE
)
set(BLOSC_LIBRARY
/opt/lib/blosc/lib/libblosc.a
CACHE BOOL "" FORCE
)

View File

@@ -0,0 +1,72 @@
# - Find Blosc library
# Find the native Blosc includes and library
# This module defines
# BLOSC_INCLUDE_DIRS, where to find blosc.h, Set when
# Blosc is found.
# BLOSC_LIBRARIES, libraries to link against to use Blosc.
# BLOSC_ROOT_DIR, The base directory to search for Blosc.
# This can also be an environment variable.
# BLOSC_FOUND, If false, do not try to use Blosc.
#
# also defined, but not for general use are
# BLOSC_LIBRARY, where to find the Blosc library.
#=============================================================================
# Copyright 2018 Blender Foundation.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# If BLOSC_ROOT_DIR was defined in the environment, use it.
IF(NOT BLOSC_ROOT_DIR AND NOT $ENV{BLOSC_ROOT_DIR} STREQUAL "")
SET(BLOSC_ROOT_DIR $ENV{BLOSC_ROOT_DIR})
ENDIF()
SET(_blosc_SEARCH_DIRS
${BLOSC_ROOT_DIR}
/usr/local
/sw # Fink
/opt/local # DarwinPorts
/opt/lib/blosc
)
FIND_PATH(BLOSC_INCLUDE_DIR
NAMES
blosc.h
HINTS
${_blosc_SEARCH_DIRS}
PATH_SUFFIXES
include
)
FIND_LIBRARY(BLOSC_LIBRARY
NAMES
blosc
HINTS
${_blosc_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
# handle the QUIETLY and REQUIRED arguments and set BLOSC_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(BLOSC DEFAULT_MSG
BLOSC_LIBRARY BLOSC_INCLUDE_DIR)
IF(BLOSC_FOUND)
SET(BLOSC_LIBRARIES ${BLOSC_LIBRARY})
SET(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIR})
ELSE()
SET(BLOSC_BLOSC_FOUND FALSE)
ENDIF()
MARK_AS_ADVANCED(
BLOSC_INCLUDE_DIR
BLOSC_LIBRARY
)

View File

@@ -23,7 +23,6 @@ set(WITH_IK_SOLVER ON CACHE BOOL "" FORCE)
set(WITH_IK_ITASC ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_CINEON ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_DDS ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_FRAMESERVER ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_HDR ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_OPENEXR ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_OPENJPEG ON CACHE BOOL "" FORCE)

View File

@@ -28,7 +28,6 @@ set(WITH_IK_SOLVER OFF CACHE BOOL "" FORCE)
set(WITH_IK_ITASC OFF CACHE BOOL "" FORCE)
set(WITH_IMAGE_CINEON OFF CACHE BOOL "" FORCE)
set(WITH_IMAGE_DDS OFF CACHE BOOL "" FORCE)
set(WITH_IMAGE_FRAMESERVER OFF CACHE BOOL "" FORCE)
set(WITH_IMAGE_HDR OFF CACHE BOOL "" FORCE)
set(WITH_IMAGE_OPENEXR OFF CACHE BOOL "" FORCE)
set(WITH_IMAGE_OPENJPEG OFF CACHE BOOL "" FORCE)

View File

@@ -23,7 +23,6 @@ set(WITH_IK_SOLVER ON CACHE BOOL "" FORCE)
set(WITH_IK_ITASC ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_CINEON ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_DDS ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_FRAMESERVER ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_HDR ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_OPENEXR ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_OPENJPEG ON CACHE BOOL "" FORCE)

View File

@@ -425,7 +425,7 @@ function(setup_liblinks
target_link_libraries(${target} ${OPENSUBDIV_LIBRARIES})
endif()
if(WITH_OPENVDB)
target_link_libraries(${target} ${OPENVDB_LIBRARIES} ${TBB_LIBRARIES})
target_link_libraries(${target} ${OPENVDB_LIBRARIES} ${TBB_LIBRARIES} ${BLOSC_LIBRARIES})
endif()
if(WITH_CYCLES_OSL)
target_link_libraries(${target} ${OSL_LIBRARIES})
@@ -581,6 +581,7 @@ function(SETUP_BLENDER_SORTED_LIBS)
bf_editor_space_outliner
bf_editor_space_script
bf_editor_space_sequencer
bf_editor_space_statusbar
bf_editor_space_text
bf_editor_space_time
bf_editor_space_topbar

View File

@@ -358,7 +358,7 @@ if(WITH_LLVM)
execute_process(COMMAND ${LLVM_CONFIG} --libfiles
OUTPUT_VARIABLE LLVM_LIBRARY
OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REPLACE " " ";" LLVM_LIBRARY ${LLVM_LIBRARY})
string(REPLACE ".a /" ".a;/" LLVM_LIBRARY ${LLVM_LIBRARY})
else()
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -lLLVM-3.4")
endif()
@@ -418,7 +418,7 @@ if(${XCODE_VERSION} VERSION_EQUAL 5 OR ${XCODE_VERSION} VERSION_GREATER 5)
endif()
# Get rid of eventually clashes, we export some symbols explicite as local
set(PLATFORM_LINKFLAGS
"${PLATFORM_LINKFLAGS} -Xlinker -unexported_symbols_list -Xlinker ${CMAKE_SOURCE_DIR}/source/creator/osx_locals.map"
"${PLATFORM_LINKFLAGS} -Xlinker -unexported_symbols_list -Xlinker '${CMAKE_SOURCE_DIR}/source/creator/osx_locals.map'"
)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")

View File

@@ -237,10 +237,14 @@ endif()
if(WITH_OPENVDB)
find_package_wrapper(OpenVDB)
find_package_wrapper(TBB)
find_package_wrapper(Blosc)
if(NOT OPENVDB_FOUND OR NOT TBB_FOUND)
set(WITH_OPENVDB OFF)
set(WITH_OPENVDB_BLOSC OFF)
message(STATUS "OpenVDB not found, disabling it")
elseif(NOT BLOSC_FOUND)
set(WITH_OPENVDB_BLOSC OFF)
message(STATUS "Blosc not found, disabling it")
endif()
endif()

View File

@@ -29,7 +29,15 @@ if(NOT MSVC)
message(FATAL_ERROR "Compiler is unsupported")
endif()
# Libraries configuration for Windows when compiling with MSVC.
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
set(MSVC_CLANG On)
set(MSVC_REDIST_DIR $ENV{VCToolsRedistDir})
if (DEFINED MSVC_REDIST_DIR)
file(TO_CMAKE_PATH ${MSVC_REDIST_DIR} MSVC_REDIST_DIR)
else()
message("Unable to detect the Visual Studio redist directory, copying of the runtime dlls will not work, try running from the visual studio developer prompt.")
endif()
endif()
set_property(GLOBAL PROPERTY USE_FOLDERS ${WINDOWS_USE_VISUAL_STUDIO_FOLDERS})
@@ -119,8 +127,18 @@ set(CMAKE_INSTALL_OPENMP_LIBRARIES ${WITH_OPENMP})
set(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION .)
include(InstallRequiredSystemLibraries)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /nologo /J /Gd /MP /EHsc")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /nologo /J /Gd /MP")
remove_cc_flag("/MDd" "/MD")
if(MSVC_CLANG) # Clangs version of cl doesn't support all flags
if(NOT WITH_CXX11) # C++11 is on by default in clang-cl and can't be turned off, if c++11 is not enabled in blender repress some c++11 related warnings.
set(CXX_WARN_FLAGS "-Wno-inconsistent-missing-override")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_WARN_FLAGS} /nologo /J /Gd /EHsc -Wno-unused-command-line-argument -Wno-microsoft-enum-forward-reference ")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /nologo /J /Gd -Wno-unused-command-line-argument -Wno-microsoft-enum-forward-reference")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /nologo /J /Gd /MP /EHsc")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /nologo /J /Gd /MP")
endif()
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MTd")

View File

@@ -0,0 +1,17 @@
echo No explicit msvc version requested, autodetecting version.
call "%~dp0\detect_msvc2013.cmd"
if %ERRORLEVEL% EQU 0 goto DetectionComplete
call "%~dp0\detect_msvc2015.cmd"
if %ERRORLEVEL% EQU 0 goto DetectionComplete
call "%~dp0\detect_msvc2017.cmd"
if %ERRORLEVEL% EQU 0 goto DetectionComplete
echo Compiler Detection failed. Use verbose switch for more information.
exit /b 1
:DetectionComplete
echo Compiler Detection successfull, detected VS%BUILD_VS_YEAR%
exit /b 0

View File

@@ -0,0 +1,26 @@
if "%NOBUILD%"=="1" goto EOF
echo %TIME% > %BUILD_DIR%\buildtime.txt
msbuild ^
%BUILD_DIR%\Blender.sln ^
/target:build ^
/property:Configuration=%BUILD_TYPE% ^
/maxcpucount:2 ^
/verbosity:minimal ^
/p:platform=%MSBUILD_PLATFORM% ^
/flp:Summary;Verbosity=minimal;LogFile=%BUILD_DIR%\Build.log
if errorlevel 1 (
echo Error during build, see %BUILD_DIR%\Build.log for details
exit /b 1
)
msbuild ^
%BUILD_DIR%\INSTALL.vcxproj ^
/property:Configuration=%BUILD_TYPE% ^
/verbosity:minimal ^
/p:platform=%MSBUILD_PLATFORM%
if errorlevel 1 (
echo Error during install phase
exit /b 1
)
echo %TIME% >> %BUILD_DIR%\buildtime.txt
:EOF

View File

@@ -0,0 +1,16 @@
if "%NOBUILD%"=="1" goto EOF
set HAS_ERROR=
cd %BUILD_DIR%
echo %TIME% > buildtime.txt
ninja install
if errorlevel 1 (
set HAS_ERROR=1
)
echo %TIME% >>buildtime.txt
cd %BLENDER_DIR%
if "%HAS_ERROR%" == "1" (
echo Error during build
exit /b 1
)
:EOF

View File

@@ -0,0 +1,54 @@
if "%BUILD_VS_YEAR%"=="2013" set BUILD_VS_LIBDIRPOST=vc12
if "%BUILD_VS_YEAR%"=="2015" set BUILD_VS_LIBDIRPOST=vc14
if "%BUILD_VS_YEAR%"=="2017" set BUILD_VS_LIBDIRPOST=vc14
if "%BUILD_ARCH%"=="x64" (
set BUILD_VS_SVNDIR=win64_%BUILD_VS_LIBDIRPOST%
) else if "%BUILD_ARCH%"=="x86" (
set BUILD_VS_SVNDIR=windows_%BUILD_VS_LIBDIRPOST%
)
set BUILD_VS_LIBDIR="%BLENDER_DIR%..\lib\%BUILD_VS_SVNDIR%"
if NOT "%verbose%" == "" (
echo Library Directory = "%BUILD_VS_LIBDIR%"
)
if NOT EXIST %BUILD_VS_LIBDIR% (
rem libs not found, but svn is on the system
echo
if not "%SVN%"=="" (
echo.
echo The required external libraries in %BUILD_VS_LIBDIR% are missing
echo.
set /p GetLibs= "Would you like to download them? (y/n)"
if /I "!GetLibs!"=="Y" (
echo.
echo Downloading %BUILD_VS_SVNDIR% libraries, please wait.
echo.
:RETRY
"%SVN%" checkout https://svn.blender.org/svnroot/bf-blender/trunk/lib/%BUILD_VS_SVNDIR% %BUILD_VS_LIBDIR%
if errorlevel 1 (
set /p LibRetry= "Error during donwload, retry? y/n"
if /I "!LibRetry!"=="Y" (
cd %BUILD_VS_LIBDIR%
"%SVN%" cleanup
cd %BLENDER_DIR%
goto RETRY
)
echo.
echo Error: Download of external libraries failed.
echo This is needed for building, please manually run 'svn cleanup' and 'svn update' in
echo %BUILD_VS_LIBDIR% , until this is resolved you CANNOT make a successfull blender build
echo.
exit /b 1
)
)
)
)
if NOT EXIST %BUILD_VS_LIBDIR% (
echo.
echo Error: Required libraries not found at "%BUILD_VS_LIBDIR%"
echo This is needed for building, aborting!
echo.
exit /b 1
)

View File

@@ -0,0 +1,6 @@
set BLENDER_DIR_NOSPACES=%BLENDER_DIR: =%
if not "%BLENDER_DIR%"=="%BLENDER_DIR_NOSPACES%" (
echo There are spaces detected in the build path "%BLENDER_DIR%", this is currently not supported, exiting....
exit /b 1
)

View File

@@ -0,0 +1,20 @@
if NOT exist "%BLENDER_DIR%/source/tools" (
echo Checking out sub-modules
if not "%GIT%" == "" (
"%GIT%" submodule update --init --recursive --progress
if errorlevel 1 goto FAIL
"%GIT%" submodule foreach git checkout master
if errorlevel 1 goto FAIL
"%GIT%" submodule foreach git pull --rebase origin master
if errorlevel 1 goto FAIL
goto EOF
) else (
echo Blender submodules not found, and git not found in path to retrieve them.
goto FAIL
)
)
goto EOF
:FAIL
exit /b 1
:EOF

View File

@@ -0,0 +1,67 @@
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -G "Visual Studio %BUILD_VS_VER% %BUILD_VS_YEAR%%WINDOWS_ARCH%" %TESTS_CMAKE_ARGS%
if "%BUILD_ARCH%"=="x64" (
set MSBUILD_PLATFORM=x64
) else if "%BUILD_ARCH%"=="x86" (
set MSBUILD_PLATFORM=win32
if "%WITH_CLANG%"=="1" (
echo Clang not supported for X86
exit /b 1
)
)
if "%WITH_CLANG%"=="1" (
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -T"LLVM-vs2017"
)
if NOT EXIST %BUILD_DIR%\nul (
mkdir %BUILD_DIR%
)
if "%MUST_CLEAN%"=="1" (
echo Cleaning %BUILD_DIR%
msbuild ^
%BUILD_DIR%\Blender.sln ^
/target:clean ^
/property:Configuration=%BUILD_TYPE% ^
/verbosity:minimal ^
/p:platform=%MSBUILD_PLATFORM%
)
if NOT EXIST %BUILD_DIR%\Blender.sln set MUST_CONFIGURE=1
if "%NOBUILD%"=="1" set MUST_CONFIGURE=1
if "%MUST_CONFIGURE%"=="1" (
if NOT "%verbose%" == "" (
echo %CMAKE% %BUILD_CMAKE_ARGS% -H%BLENDER_DIR% -B%BUILD_DIR%
)
cmake ^
%BUILD_CMAKE_ARGS% ^
-H%BLENDER_DIR% ^
-B%BUILD_DIR%
if %ERRORLEVEL% NEQ 0 (
echo "Configuration Failed"
exit /b 1
)
)
echo call "%VCVARS%" %BUILD_ARCH% > %BUILD_DIR%\rebuild.cmd
echo "%CMAKE%" . >> %BUILD_DIR%\rebuild.cmd
echo echo %%TIME%% ^> buildtime.txt >> %BUILD_DIR%\rebuild.cmd
echo msbuild ^
%BUILD_DIR%\Blender.sln ^
/target:build ^
/property:Configuration=%BUILD_TYPE% ^
/maxcpucount:2 ^
/verbosity:minimal ^
/p:platform=%MSBUILD_PLATFORM% ^
/flp:Summary;Verbosity=minimal;LogFile=%BUILD_DIR%\Build.log >> %BUILD_DIR%\rebuild.cmd
echo msbuild ^
%BUILD_DIR%\INSTALL.vcxproj ^
/property:Configuration=%BUILD_TYPE% ^
/verbosity:minimal ^
/p:platform=%MSBUILD_PLATFORM% >> %BUILD_DIR%\rebuild.cmd
echo echo %%TIME%% ^>^> buildtime.txt >> %BUILD_DIR%\rebuild.cmd

View File

@@ -0,0 +1,64 @@
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -G "Ninja" %TESTS_CMAKE_ARGS% -DCMAKE_BUILD_TYPE=%BUILD_TYPE%
if "%WITH_CLANG%" == "1" (
set LLVM_DIR=
for /F "usebackq skip=2 tokens=1-2*" %%A IN (`REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\LLVM\LLVM" /ve 2^>nul`) DO set LLVM_DIR=%%C
if DEFINED LLVM_DIR (
if NOT "%verbose%" == "" (
echo LLVM Detected at "%LLVM_DIR%"
)
goto DetectionComplete
)
REM Check 32 bits
for /F "usebackq skip=2 tokens=1-2*" %%A IN (`REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\LLVM\LLVM" /ve 2^>nul`) DO set LLVM_DIR=%%C
if DEFINED LLVM_DIR (
if NOT "%verbose%" == "" (
echo LLVM Detected at "%LLVM_DIR%"
)
goto DetectionComplete
)
echo LLVM not found
exit /b 1
:DetectionComplete
set CC=%LLVM_DIR%\bin\clang-cl
set CXX=%LLVM_DIR%\bin\clang-cl
rem build and tested against 2017 15.7
set CFLAGS=-m64 -fmsc-version=1914
set CXXFLAGS=-m64 -fmsc-version=1914
)
if NOT "%verbose%" == "" (
echo BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS%
)
if NOT EXIST %BUILD_DIR%\nul (
mkdir %BUILD_DIR%
)
if "%MUST_CLEAN%"=="1" (
echo Cleaning %BUILD_DIR%
cd %BUILD_DIR%
%CMAKE% cmake --build . --config Clean
)
if NOT EXIST %BUILD_DIR%\Blender.sln set MUST_CONFIGURE=1
if "%NOBUILD%"=="1" set MUST_CONFIGURE=1
if "%MUST_CONFIGURE%"=="1" (
cmake ^
%BUILD_CMAKE_ARGS% ^
-H%BLENDER_DIR% ^
-B%BUILD_DIR%
if %ERRORLEVEL% NEQ 0 (
echo "Configuration Failed"
exit /b 1
)
)
echo call "%VCVARS%" %BUILD_ARCH% > %BUILD_DIR%\rebuild.cmd
echo echo %%TIME%% ^> buildtime.txt >> %BUILD_DIR%\rebuild.cmd
echo ninja install >> %BUILD_DIR%\rebuild.cmd
echo echo %%TIME%% ^>^> buildtime.txt >> %BUILD_DIR%\rebuild.cmd

View File

@@ -0,0 +1,16 @@
if "%BUILD_ARCH%"=="" (
if "%PROCESSOR_ARCHITECTURE%" == "AMD64" (
set WINDOWS_ARCH= Win64
set BUILD_ARCH=x64
) else if "%PROCESSOR_ARCHITEW6432%" == "AMD64" (
set WINDOWS_ARCH= Win64
set BUILD_ARCH=x64
) else (
set WINDOWS_ARCH=
set BUILD_ARCH=x86
)
) else if "%BUILD_ARCH%"=="x64" (
set WINDOWS_ARCH= Win64
) else if "%BUILD_ARCH%"=="x86" (
set WINDOWS_ARCH=
)

View File

@@ -0,0 +1,3 @@
set BUILD_VS_VER=12
set BUILD_VS_YEAR=2013
call "%~dp0\detect_msvc_classic.cmd"

View File

@@ -0,0 +1,3 @@
set BUILD_VS_VER=14
set BUILD_VS_YEAR=2015
call "%~dp0\detect_msvc_classic.cmd"

View File

@@ -0,0 +1,70 @@
if NOT "%verbose%" == "" (
echo Detecting msvc 2017
)
set BUILD_VS_VER=15
set ProgramFilesX86=%ProgramFiles(x86)%
if not exist "%ProgramFilesX86%" set ProgramFilesX86=%ProgramFiles%
set vs_where=%ProgramFilesX86%\Microsoft Visual Studio\Installer\vswhere.exe
if not exist "%vs_where%" (
if NOT "%verbose%" == "" (
echo Visual Studio 2017 ^(15.2 or newer^) is not detected
goto FAIL
)
)
for /f "usebackq tokens=1* delims=: " %%i in (`"%vs_where%" -latest %VSWHERE_ARGS% -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64`) do (
if /i "%%i"=="installationPath" set VS_InstallDir=%%j
)
if "%VS_InstallDir%"=="" (
if NOT "%verbose%" == "" (
echo Visual Studio is detected but the "Desktop development with C++" workload has not been instlled
goto FAIL
)
)
set VCVARS=%VS_InstallDir%\VC\Auxiliary\Build\vcvarsall.bat
if exist "%VCVARS%" (
call "%VCVARS%" %BUILD_ARCH%
) else (
if NOT "%verbose%" == "" (
echo "%VCVARS%" not found
)
goto FAIL
)
rem try msbuild
msbuild /version > NUL
if errorlevel 1 (
if NOT "%verbose%" == "" (
echo Visual Studio %BUILD_VS_YEAR% msbuild not found
)
goto FAIL
)
if NOT "%verbose%" == "" (
echo Visual Studio %BUILD_VS_YEAR% msbuild found
)
REM try the c++ compiler
cl 2> NUL 1>&2
if errorlevel 1 (
if NOT "%verbose%" == "" (
echo Visual Studio %BUILD_VS_YEAR% C/C++ Compiler not found
)
goto FAIL
)
if NOT "%verbose%" == "" (
echo Visual Studio %BUILD_VS_YEAR% C/C++ Compiler found
)
if NOT "%verbose%" == "" (
echo Visual Studio 2017 is detected successfully
)
goto EOF
:FAIL
exit /b 1
:EOF

View File

@@ -0,0 +1,69 @@
if NOT "%verbose%" == "" (
echo Detecting msvc %BUILD_VS_YEAR%
)
set KEY_NAME="HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\%BUILD_VS_VER%.0\Setup\VC"
for /F "usebackq skip=2 tokens=1-2*" %%A IN (`REG QUERY %KEY_NAME% /v ProductDir 2^>nul`) DO set MSVC_VC_DIR=%%C
if DEFINED MSVC_VC_DIR (
if NOT "%verbose%" == "" (
echo Visual Studio %BUILD_VS_YEAR% on Win64 detected at "%MSVC_VC_DIR%"
)
goto msvc_detect_finally
)
REM Check 32 bits
set KEY_NAME="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\%BUILD_VS_VER%.0\Setup\VC"
for /F "usebackq skip=2 tokens=1-2*" %%A IN (`REG QUERY %KEY_NAME% /v ProductDir 2^>nul`) DO set MSVC_VC_DIR=%%C
if DEFINED MSVC_VC_DIR (
if NOT "%verbose%" == "" (
echo Visual Studio %BUILD_VS_YEAR% on Win32 detected at "%MSVC_VC_DIR%"
)
goto msvc_detect_finally
)
if NOT "%verbose%" == "" (
echo Visual Studio %BUILD_VS_YEAR% not found.
)
goto FAIL
:msvc_detect_finally
set VCVARS=%MSVC_VC_DIR%\vcvarsall.bat
if not exist "%VCVARS%" (
echo "%VCVARS%" not found.
goto FAIL
)
call "%vcvars%" %BUILD_ARCH%
rem try msbuild
msbuild /version > NUL
if errorlevel 1 (
if NOT "%verbose%" == "" (
echo Visual Studio %BUILD_VS_YEAR% msbuild not found
)
goto FAIL
)
if NOT "%verbose%" == "" (
echo Visual Studio %BUILD_VS_YEAR% msbuild found
)
REM try the c++ compiler
cl 2> NUL 1>&2
if errorlevel 1 (
if NOT "%verbose%" == "" (
echo Visual Studio %BUILD_VS_YEAR% C/C++ Compiler not found
)
goto FAIL
)
if NOT "%verbose%" == "" (
echo Visual Studio %BUILD_VS_YEAR% C/C++ Compiler found
)
goto DetectionComplete
:FAIL
exit /b 1
:DetectionComplete
if NOT "%verbose%" == "" (
echo Visual Studio %BUILD_VS_YEAR% Detected successfuly
)
exit /b 0

View File

@@ -0,0 +1,13 @@
REM find all dependencies and set the corresponding environement variables.
for %%X in (svn.exe) do (set SVN=%%~$PATH:X)
for %%X in (cmake.exe) do (set CMAKE=%%~$PATH:X)
for %%X in (git.exe) do (set GIT=%%~$PATH:X)
if NOT "%verbose%" == "" (
echo svn : %SVN%
echo cmake : %CMAKE%
echo git : %GIT%
)
if "%CMAKE%" == "" (
echo Cmake not found in path, required for building, exiting...
exit /b 1
)

View File

@@ -0,0 +1,82 @@
set BUILD_DIR=%BLENDER_DIR%..\build_windows
set BUILD_TYPE=Release
:argv_loop
if NOT "%1" == "" (
REM Help Message
if "%1" == "help" (
set SHOW_HELP=1
goto EOF
)
REM Build Types
if "%1" == "debug" (
set BUILD_TYPE=Debug
REM Build Configurations
) else if "%1" == "noge" (
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -DWITH_GAMEENGINE=OFF -DWITH_PLAYER=OFF
set BUILD_NGE=_noge
) else if "%1" == "builddir" (
set BUILD_DIR_OVERRRIDE="%BLENDER_DIR%..\%2"
shift /1
) else if "%1" == "with_tests" (
set TESTS_CMAKE_ARGS=-DWITH_GTESTS=On
) else if "%1" == "full" (
set TARGET=Full
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% ^
-C"%BLENDER_DIR%\build_files\cmake\config\blender_full.cmake"
) else if "%1" == "lite" (
set TARGET=Lite
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -C"%BLENDER_DIR%\build_files\cmake\config\blender_lite.cmake"
) else if "%1" == "cycles" (
set TARGET=Cycles
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -C"%BLENDER_DIR%\build_files\cmake\config\cycles_standalone.cmake"
) else if "%1" == "headless" (
set TARGET=Headless
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -C"%BLENDER_DIR%\build_files\cmake\config\blender_headless.cmake"
) else if "%1" == "bpy" (
set TARGET=Bpy
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -C"%BLENDER_DIR%\build_files\cmake\config\bpy_module.cmake"
) else if "%1" == "clang" (
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS%
set WITH_CLANG=1
) else if "%1" == "release" (
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -C"%BLENDER_DIR%\build_files\cmake\config\blender_release.cmake"
set TARGET=Release
) else if "%1" == "x86" (
set BUILD_ARCH=x86
) else if "%1" == "x64" (
set BUILD_ARCH=x64
) else if "%1" == "2017" (
set BUILD_VS_YEAR=2017
) else if "%1" == "2017pre" (
set BUILD_VS_YEAR=2017
set VSWHERE_ARGS=-prerelease
) else if "%1" == "2015" (
set BUILD_VS_YEAR=2015
) else if "%1" == "2013" (
set BUILD_VS_YEAR=2013
) else if "%1" == "packagename" (
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -DCPACK_OVERRIDE_PACKAGENAME="%2"
shift /1
) else if "%1" == "nobuild" (
set NOBUILD=1
) else if "%1" == "showhash" (
SET BUILD_SHOW_HASHES=1
REM Non-Build Commands
) else if "%1" == "update" (
SET BUILD_UPDATE=1
) else if "%1" == "ninja" (
SET BUILD_WITH_NINJA=1
) else if "%1" == "clean" (
set MUST_CLEAN=1
) else if "%1" == "verbose" (
set VERBOSE=1
) else (
echo Command "%1" unknown, aborting!
exit /b 1
)
shift /1
goto argv_loop
)
:EOF
exit /b 0

View File

@@ -0,0 +1,24 @@
rem reset all variables so they do not get accidentally get carried over from previous builds
set BUILD_DIR_OVERRRIDE=
set BUILD_CMAKE_ARGS=
set BUILD_ARCH=
set BUILD_VS_VER=
set BUILD_VS_YEAR=
set BUILD_VS_LIBDIRPOST=
set BUILD_VS_LIBDIR=
set BUILD_VS_SVNDIR=
set BUILD_NGE=
set KEY_NAME=
set MSBUILD_PLATFORM=
set MUST_CLEAN=
set NOBUILD=
set TARGET=
set VERBOSE=
set WINDOWS_ARCH=
set TESTS_CMAKE_ARGS=
set VSWHERE_ARGS=
set BUILD_UPDATE=
set BUILD_SHOW_HASHES=
set SHOW_HELP=
set BUILD_WITH_NINJA=
set WITH_CLANG=

View File

@@ -0,0 +1,4 @@
set BUILD_DIR=%BUILD_DIR%_%TARGET%%BUILD_NGE%_%BUILD_ARCH%_vc%BUILD_VS_VER%_%BUILD_TYPE%
if NOT "%BUILD_DIR_OVERRRIDE%"=="" (
set BUILD_DIR=%BUILD_DIR_OVERRRIDE%
)

View File

@@ -0,0 +1,12 @@
if "%GIT%" == "" (
echo Git not found, cannot show hashes.
goto EOF
)
cd "%BLENDER_DIR%"
for /f "delims=" %%i in ('%GIT% rev-parse HEAD') do echo Branch_hash=%%i
cd "%BLENDER_DIR%/release/datafiles/locale"
for /f "delims=" %%i in ('%GIT% rev-parse HEAD') do echo Locale_hash=%%i
cd "%BLENDER_DIR%/release/scripts/addons"
for /f "delims=" %%i in ('%GIT% rev-parse HEAD') do echo Addons_Hash=%%i
cd "%BLENDER_DIR%"
:EOF

View File

@@ -0,0 +1,29 @@
echo.
echo Convenience targets
echo - release ^(identical to the official blender.org builds^)
echo - full ^(same as release minus the cuda kernels^)
echo - lite
echo - headless
echo - cycles
echo - bpy
echo.
echo Utilities ^(not associated with building^)
echo - clean ^(Target must be set^)
echo - update
echo - nobuild ^(only generate project files^)
echo - showhash ^(Show git hashes of source tree^)
echo.
echo Configuration options
echo - verbose ^(enable diagnostic output during configuration^)
echo - with_tests ^(enable building unit tests^)
echo - noge ^(disable building game enginge and player^)
echo - debug ^(Build an unoptimized debuggable build^)
echo - packagename [newname] ^(override default cpack package name^)
echo - buildir [newdir] ^(override default build folder^)
echo - x86 ^(override host auto-detect and build 32 bit code^)
echo - x64 ^(override host auto-detect and build 64 bit code^)
echo - 2013 ^(build with visual studio 2013^)
echo - 2015 ^(build with visual studio 2015^) [EXPERIMENTAL]
echo - 2017 ^(build with visual studio 2017^) [EXPERIMENTAL]
echo - 2017pre ^(build with visual studio 2017 pre-release^) [EXPERIMENTAL]
echo.

View File

@@ -0,0 +1,16 @@
if "%SVN%" == "" (
echo svn not found, cannot update libraries
goto UPDATE_GIT
)
"%SVN%" up "%BLENDER_DIR%/../lib/*"
:UPDATE_GIT
if "%GIT%" == "" (
echo Git not found, cannot update code
goto EOF
)
"%GIT%" pull --rebase
"%GIT%" submodule foreach git pull --rebase origin master
:EOF

View File

@@ -20,6 +20,6 @@ The execution context is one of:
'EXEC_SCREEN')
"""
# group add popup
# collection add popup
import bpy
bpy.ops.object.group_instance_add('INVOKE_DEFAULT')
bpy.ops.object.collection_instance_add('INVOKE_DEFAULT')

View File

@@ -335,7 +335,7 @@ template<> EIGEN_STRONG_INLINE void prefetch<float>(const float* addr) { _mm_p
template<> EIGEN_STRONG_INLINE void prefetch<double>(const double* addr) { _mm_prefetch((const char*)(addr), _MM_HINT_T0); }
template<> EIGEN_STRONG_INLINE void prefetch<int>(const int* addr) { _mm_prefetch((const char*)(addr), _MM_HINT_T0); }
#if defined(_MSC_VER) && defined(_WIN64) && !defined(__INTEL_COMPILER)
#if defined(_MSC_VER) && defined(_WIN64) && !defined(__INTEL_COMPILER) && !defined(__clang__)
// The temporary variable fixes an internal compilation error in vs <= 2008 and a wrong-result bug in vs 2010
// Direct of the struct members fixed bug #62.
template<> EIGEN_STRONG_INLINE float pfirst<Packet4f>(const Packet4f& a) { return a.m128_f32[0]; }

12
extern/Eigen3/patches/blender.diff vendored Normal file
View File

@@ -0,0 +1,12 @@
diff -Naur c:\blender-git\blender\extern\Eigen3/Eigen/src/Core/arch/SSE/PacketMath.h k:\BlenderGit\blender\extern\Eigen3/Eigen/src/Core/arch/SSE/PacketMath.h
--- c:\blender-git\blender\extern\Eigen3/Eigen/src/Core/arch/SSE/PacketMath.h 2018-05-25 13:29:14 -0600
+++ k:\BlenderGit\blender\extern\Eigen3/Eigen/src/Core/arch/SSE/PacketMath.h 2018-05-26 19:56:36 -0600
@@ -335,7 +335,7 @@
template<> EIGEN_STRONG_INLINE void prefetch<double>(const double* addr) { _mm_prefetch((const char*)(addr), _MM_HINT_T0); }
template<> EIGEN_STRONG_INLINE void prefetch<int>(const int* addr) { _mm_prefetch((const char*)(addr), _MM_HINT_T0); }
-#if defined(_MSC_VER) && defined(_WIN64) && !defined(__INTEL_COMPILER)
+#if defined(_MSC_VER) && defined(_WIN64) && !defined(__INTEL_COMPILER) && !defined(__clang__)
// The temporary variable fixes an internal compilation error in vs <= 2008 and a wrong-result bug in vs 2010
// Direct of the struct members fixed bug #62.
template<> EIGEN_STRONG_INLINE float pfirst<Packet4f>(const Packet4f& a) { return a.m128_f32[0]; }

View File

@@ -1,3 +1,34 @@
diff --git a/extern/bullet2/src/LinearMath/btScalar.h b/extern/bullet2/src/LinearMath/btScalar.h
--- a/extern/bullet2/src/LinearMath/btScalar.h
+++ b/extern/bullet2/src/LinearMath/btScalar.h
@@ -16,6 +16,9 @@
#ifndef BT_SCALAR_H
#define BT_SCALAR_H
+#if defined(_MSC_VER) && defined(__clang__) /* clang supplies it's own overloads already */
+#define BT_NO_SIMD_OPERATOR_OVERLOADS
+#endif
#ifdef BT_MANAGED_CODE
//Aligned data types not supported in managed code
@@ -83,7 +86,7 @@
#ifdef BT_USE_SSE
#if (_MSC_FULL_VER >= 170050727)//Visual Studio 2012 can compile SSE4/FMA3 (but SSE4/FMA3 is not enabled by default)
- #define BT_ALLOW_SSE4
+ //#define BT_ALLOW_SSE4 //disable this cause blender targets sse2
#endif //(_MSC_FULL_VER >= 160040219)
//BT_USE_SSE_IN_API is disabled under Windows by default, because
@@ -102,7 +105,7 @@
#endif //__MINGW32__
#ifdef BT_DEBUG
- #ifdef _MSC_VER
+ #if defined(_MSC_VER) && !defined(__clang__)
#include <stdio.h>
#define btAssert(x) { if(!(x)){printf("Assert "__FILE__ ":%u ("#x")\n", __LINE__);__debugbreak(); }}
#else//_MSC_VER
diff --git a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorld.h b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorld.h
index be9eca6..ec40c96 100644
--- a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorld.h

View File

@@ -16,6 +16,9 @@ subject to the following restrictions:
#ifndef BT_SCALAR_H
#define BT_SCALAR_H
#if defined(_MSC_VER) && defined(__clang__) /* clang supplies it's own overloads already */
#define BT_NO_SIMD_OPERATOR_OVERLOADS
#endif
#ifdef BT_MANAGED_CODE
//Aligned data types not supported in managed code
@@ -83,7 +86,7 @@ inline int btGetVersion()
#ifdef BT_USE_SSE
#if (_MSC_FULL_VER >= 170050727)//Visual Studio 2012 can compile SSE4/FMA3 (but SSE4/FMA3 is not enabled by default)
#define BT_ALLOW_SSE4
//#define BT_ALLOW_SSE4 //disable this cause blender targets sse2
#endif //(_MSC_FULL_VER >= 160040219)
//BT_USE_SSE_IN_API is disabled under Windows by default, because
@@ -102,7 +105,7 @@ inline int btGetVersion()
#endif //__MINGW32__
#ifdef BT_DEBUG
#ifdef _MSC_VER
#if defined(_MSC_VER) && !defined(__clang__)
#include <stdio.h>
#define btAssert(x) { if(!(x)){printf("Assert "__FILE__ ":%u ("#x")\n", __LINE__);__debugbreak(); }}
#else//_MSC_VER

View File

@@ -40,7 +40,11 @@
#include <windows.h>
#include <intrin.h>
/******************************************************************************/
#if defined (__clang__)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wincompatible-pointer-types"
#endif
/* 64-bit operations. */
#if (LG_SIZEOF_PTR == 8 || LG_SIZEOF_INT == 8)
/* Unsigned */
@@ -205,4 +209,9 @@ ATOMIC_INLINE int8_t atomic_fetch_and_or_int8(int8_t *p, int8_t b)
#endif
}
#if defined (__clang__)
# pragma GCC diagnostic pop
#endif
#endif /* __ATOMIC_OPS_MSVC_H__ */

View File

@@ -146,10 +146,13 @@ void CLG_exit(void);
void CLG_output_set(void *file_handle);
void CLG_output_use_basename_set(int value);
void CLG_fatal_fn_set(void (*fatal_fn)(void *file_handle));
void CLG_backtrace_fn_set(void (*fatal_fn)(void *file_handle));
void CLG_type_filter_include(const char *type_filter, int type_filter_len);
void CLG_type_filter_exclude(const char *type_filter, int type_filter_len);
void CLG_level_set(int level);
void CLG_logref_init(CLG_LogRef *clg_ref);
/** Declare outside function, declare as extern in header. */

View File

@@ -81,6 +81,7 @@ typedef struct CLogContext {
struct {
void (*fatal_fn)(void *file_handle);
void (*backtrace_fn)(void *file_handle);
} callbacks;
} CLogContext;
@@ -328,15 +329,23 @@ static CLG_LogType *clg_ctx_type_register(CLogContext *ctx, const char *identifi
return ty;
}
static void clg_ctx_fatal_action(CLogContext *ctx, FILE *file_handle)
static void clg_ctx_fatal_action(CLogContext *ctx)
{
if (ctx->callbacks.fatal_fn != NULL) {
ctx->callbacks.fatal_fn(file_handle);
ctx->callbacks.fatal_fn(ctx->output_file);
}
fflush(file_handle);
fflush(ctx->output_file);
abort();
}
static void clg_ctx_backtrace(CLogContext *ctx)
{
/* Note: we avoid writing fo 'FILE', for backtrace we make an exception,
* if necessary we could have a version of the callback that writes to file descriptor all at once. */
ctx->callbacks.backtrace_fn(ctx->output_file);
fflush(ctx->output_file);
}
/** \} */
/* -------------------------------------------------------------------- */
@@ -404,12 +413,17 @@ void CLG_log_str(
clg_str_append(&cstr, "\n");
/* could be optional */
write(lg->ctx->output, cstr.data, cstr.len);
int bytes_written = write(lg->ctx->output, cstr.data, cstr.len);
(void)bytes_written;
clg_str_free(&cstr);
if (lg->ctx->callbacks.backtrace_fn) {
clg_ctx_backtrace(lg->ctx);
}
if (severity == CLG_SEVERITY_FATAL) {
clg_ctx_fatal_action(lg->ctx, lg->ctx->output_file);
clg_ctx_fatal_action(lg->ctx);
}
}
@@ -435,12 +449,17 @@ void CLG_logf(
clg_str_append(&cstr, "\n");
/* could be optional */
write(lg->ctx->output, cstr.data, cstr.len);
int bytes_written = write(lg->ctx->output, cstr.data, cstr.len);
(void)bytes_written;
clg_str_free(&cstr);
if (lg->ctx->callbacks.backtrace_fn) {
clg_ctx_backtrace(lg->ctx);
}
if (severity == CLG_SEVERITY_FATAL) {
clg_ctx_fatal_action(lg->ctx, lg->ctx->output_file);
clg_ctx_fatal_action(lg->ctx);
}
}
@@ -470,6 +489,11 @@ static void CLG_ctx_fatal_fn_set(CLogContext *ctx, void (*fatal_fn)(void *file_h
ctx->callbacks.fatal_fn = fatal_fn;
}
static void CLG_ctx_backtrace_fn_set(CLogContext *ctx, void (*backtrace_fn)(void *file_handle))
{
ctx->callbacks.backtrace_fn = backtrace_fn;
}
static void clg_ctx_type_filter_append(CLG_IDFilter **flt_list, const char *type_match, int type_match_len)
{
if (type_match_len == 0) {
@@ -492,6 +516,14 @@ static void CLG_ctx_type_filter_include(CLogContext *ctx, const char *type_match
clg_ctx_type_filter_append(&ctx->filters[1], type_match, type_match_len);
}
static void CLG_ctx_level_set(CLogContext *ctx, int level)
{
ctx->default_type.level = level;
for (CLG_LogType *ty = ctx->types; ty; ty = ty->next) {
ty->level = level;
}
}
static CLogContext *CLG_ctx_init(void)
{
CLogContext *ctx = MEM_callocN(sizeof(*ctx), __func__);
@@ -559,6 +591,11 @@ void CLG_fatal_fn_set(void (*fatal_fn)(void *file_handle))
CLG_ctx_fatal_fn_set(g_ctx, fatal_fn);
}
void CLG_backtrace_fn_set(void (*fatal_fn)(void *file_handle))
{
CLG_ctx_backtrace_fn_set(g_ctx, fatal_fn);
}
void CLG_type_filter_exclude(const char *type_match, int type_match_len)
{
CLG_ctx_type_filter_exclude(g_ctx, type_match, type_match_len);
@@ -569,6 +606,12 @@ void CLG_type_filter_include(const char *type_match, int type_match_len)
CLG_ctx_type_filter_include(g_ctx, type_match, type_match_len);
}
void CLG_level_set(int level)
{
CLG_ctx_level_set(g_ctx, level);
}
/** \} */
/* -------------------------------------------------------------------- */

View File

@@ -31,7 +31,7 @@ elseif(NOT WITH_CPU_SSE)
set(CXX_HAS_SSE FALSE)
set(CXX_HAS_AVX FALSE)
set(CXX_HAS_AVX2 FALSE)
elseif(WIN32 AND MSVC)
elseif(WIN32 AND MSVC AND NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CXX_HAS_SSE TRUE)
set(CXX_HAS_AVX TRUE)
set(CXX_HAS_AVX2 TRUE)
@@ -306,7 +306,7 @@ if(WITH_CYCLES_CUDA_BINARIES AND (NOT WITH_CYCLES_CUBIN_COMPILER))
elseif(${CUDA_VERSION} EQUAL "9.1")
set(MAX_MSVC 1911)
endif()
if(NOT MSVC_VERSION LESS ${MAX_MSVC})
if(NOT MSVC_VERSION LESS ${MAX_MSVC} OR CMAKE_C_COMPILER_ID MATCHES "Clang")
message(STATUS "nvcc not supported for this compiler version, using cycles_cubin_cc instead.")
set(WITH_CYCLES_CUBIN_COMPILER ON)
endif()

View File

@@ -66,31 +66,32 @@ class CyclesRender(bpy.types.RenderEngine):
engine.free(self)
# final render
def update(self, data, scene):
def update(self, data, depsgraph):
if not self.session:
if self.is_preview:
cscene = bpy.context.scene.cycles
use_osl = cscene.shading_system and cscene.device == 'CPU'
engine.create(self, data, scene,
None, None, None, use_osl)
engine.create(self, data, preview_osl=use_osl)
else:
engine.create(self, data, scene)
else:
engine.reset(self, data, scene)
engine.create(self, data)
engine.reset(self, data, depsgraph)
def render_to_image(self, depsgraph):
engine.render(self, depsgraph)
def bake(self, depsgraph, scene, obj, pass_type, pass_filter, object_id, pixel_array, num_pixels, depth, result):
def bake(self, depsgraph, obj, pass_type, pass_filter, object_id, pixel_array, num_pixels, depth, result):
engine.bake(self, depsgraph, obj, pass_type, pass_filter, object_id, pixel_array, num_pixels, depth, result)
# viewport render
def view_update(self, context):
if not self.session:
engine.create(self, context.blend_data, context.scene,
engine.create(self, context.blend_data,
context.region, context.space_data, context.region_data)
engine.update(self, context.depsgraph, context.blend_data, context.scene)
engine.reset(self, context.blend_data, context.depsgraph)
engine.sync(self, context.depsgraph, context.blend_data)
def render_to_view(self, context):
engine.draw(self, context.depsgraph, context.region, context.space_data, context.region_data)

View File

@@ -123,13 +123,12 @@ def exit():
_cycles.exit()
def create(engine, data, scene, region=None, v3d=None, rv3d=None, preview_osl=False):
import bpy
def create(engine, data, region=None, v3d=None, rv3d=None, preview_osl=False):
import _cycles
import bpy
data = data.as_pointer()
userpref = bpy.context.user_preferences.as_pointer()
scene = scene.as_pointer()
if region:
region = region.as_pointer()
if v3d:
@@ -137,13 +136,8 @@ def create(engine, data, scene, region=None, v3d=None, rv3d=None, preview_osl=Fa
if rv3d:
rv3d = rv3d.as_pointer()
if bpy.app.debug_value == 256:
_cycles.debug_flags_update(scene)
else:
_cycles.debug_flags_reset()
engine.session = _cycles.create(
engine.as_pointer(), userpref, data, scene, region, v3d, rv3d, preview_osl)
engine.as_pointer(), userpref, data, region, v3d, rv3d, preview_osl)
def free(engine):
@@ -167,14 +161,21 @@ def bake(engine, depsgraph, obj, pass_type, pass_filter, object_id, pixel_array,
_cycles.bake(engine.session, depsgraph.as_pointer(), obj.as_pointer(), pass_type, pass_filter, object_id, pixel_array.as_pointer(), num_pixels, depth, result.as_pointer())
def reset(engine, data, scene):
def reset(engine, data, depsgraph):
import _cycles
import bpy
if bpy.app.debug_value == 256:
_cycles.debug_flags_update(depsgraph.scene)
else:
_cycles.debug_flags_reset()
data = data.as_pointer()
scene = scene.as_pointer()
_cycles.reset(engine.session, data, scene)
depsgraph = depsgraph.as_pointer()
_cycles.reset(engine.session, data, depsgraph)
def update(engine, depsgraph, data, scene):
def sync(engine, depsgraph, data):
import _cycles
_cycles.sync(engine.session, depsgraph.as_pointer())

View File

@@ -112,7 +112,8 @@ def update_script_node(node, report):
if ok:
# now update node with new sockets
ok = _cycles.osl_update_node(node.id_data.as_pointer(), node.as_pointer(), oso_path)
data = bpy.data.as_pointer()
ok = _cycles.osl_update_node(data, node.id_data.as_pointer(), node.as_pointer(), oso_path)
if not ok:
report({'ERROR'}, "OSL query failed to open " + oso_path)

View File

@@ -1195,7 +1195,7 @@ class CyclesCurveRenderSettings(bpy.types.PropertyGroup):
def update_render_passes(self, context):
scene = context.scene
rd = scene.render
view_layer = scene.view_layers.active
view_layer = context.view_layer
view_layer.update_render_passes()
class CyclesRenderLayerSettings(bpy.types.PropertyGroup):

View File

@@ -436,8 +436,8 @@ class CYCLES_RENDER_PT_performance(CyclesButtonsPanel, Panel):
split.prop(cscene, "preview_start_resolution")
class CYCLES_RENDER_PT_layer_options(CyclesButtonsPanel, Panel):
bl_label = "Layer"
class CYCLES_RENDER_PT_filter(CyclesButtonsPanel, Panel):
bl_label = "Filter"
bl_context = "view_layer"
def draw(self, context):
@@ -446,7 +446,7 @@ class CYCLES_RENDER_PT_layer_options(CyclesButtonsPanel, Panel):
scene = context.scene
rd = scene.render
view_layer = scene.view_layers.active
view_layer = context.view_layer
col = layout.column()
col.prop(view_layer, "use_sky", "Use Environment")
@@ -471,7 +471,7 @@ class CYCLES_RENDER_PT_layer_passes(CyclesButtonsPanel, Panel):
scene = context.scene
rd = scene.render
view_layer = scene.view_layers.active
view_layer = context.view_layer
cycles_view_layer = view_layer.cycles
split = layout.split()
@@ -538,49 +538,6 @@ class CYCLES_RENDER_PT_layer_passes(CyclesButtonsPanel, Panel):
col.prop(cycles_view_layer, "pass_debug_ray_bounces")
class CYCLES_RENDER_PT_views(CyclesButtonsPanel, Panel):
bl_label = "Views"
bl_context = "view_layer"
bl_options = {'DEFAULT_CLOSED'}
def draw_header(self, context):
rd = context.scene.render
self.layout.prop(rd, "use_multiview", text="")
def draw(self, context):
layout = self.layout
scene = context.scene
rd = scene.render
rv = rd.views.active
layout.active = rd.use_multiview
basic_stereo = (rd.views_format == 'STEREO_3D')
row = layout.row()
row.prop(rd, "views_format", expand=True)
if basic_stereo:
row = layout.row()
row.template_list("VIEWLAYER_UL_renderviews", "name", rd, "stereo_views", rd.views, "active_index", rows=2)
row = layout.row()
row.label(text="File Suffix:")
row.prop(rv, "file_suffix", text="")
else:
row = layout.row()
row.template_list("VIEWLAYER_UL_renderviews", "name", rd, "views", rd.views, "active_index", rows=2)
col = row.column(align=True)
col.operator("scene.render_view_add", icon='ZOOMIN', text="")
col.operator("scene.render_view_remove", icon='ZOOMOUT', text="")
row = layout.row()
row.label(text="Camera Suffix:")
row.prop(rv, "camera_suffix", text="")
class CYCLES_RENDER_PT_denoising(CyclesButtonsPanel, Panel):
bl_label = "Denoising"
bl_context = "view_layer"
@@ -588,7 +545,7 @@ class CYCLES_RENDER_PT_denoising(CyclesButtonsPanel, Panel):
def draw_header(self, context):
scene = context.scene
view_layer = scene.view_layers.active
view_layer = context.view_layer
cycles_view_layer = view_layer.cycles
cscene = scene.cycles
layout = self.layout
@@ -600,7 +557,7 @@ class CYCLES_RENDER_PT_denoising(CyclesButtonsPanel, Panel):
scene = context.scene
cscene = scene.cycles
view_layer = scene.view_layers.active
view_layer = context.view_layer
cycles_view_layer = view_layer.cycles
layout.active = cycles_view_layer.use_denoising
@@ -952,9 +909,9 @@ class CYCLES_LAMP_PT_lamp(CyclesButtonsPanel, Panel):
col.prop(lamp, "shape", text="")
sub = col.column(align=True)
if lamp.shape == 'SQUARE':
if lamp.shape in {'SQUARE', 'DISK'}:
sub.prop(lamp, "size")
elif lamp.shape == 'RECTANGLE':
elif lamp.shape in {'RECTANGLE', 'ELLIPSE'}:
sub.prop(lamp, "size", text="Size X")
sub.prop(lamp, "size_y", text="Size Y")
@@ -1310,7 +1267,6 @@ class CYCLES_MATERIAL_PT_viewport(CyclesButtonsPanel, Panel):
col = split.column(align=True)
col.label("Specular:")
col.prop(mat, "specular_color", text="")
col.prop(mat, "specular_hardness", text="Hardness")
class CYCLES_RENDER_PT_bake(CyclesButtonsPanel, Panel):
@@ -1588,9 +1544,8 @@ def get_panels():
'DATA_PT_spot',
'MATERIAL_PT_context_material',
'MATERIAL_PT_preview',
'VIEWLAYER_PT_layer_options',
'VIEWLAYER_PT_filter',
'VIEWLAYER_PT_layer_passes',
'VIEWLAYER_PT_views',
'RENDER_PT_post_processing',
'SCENE_PT_simplify',
}
@@ -1613,9 +1568,8 @@ classes = (
CYCLES_RENDER_PT_motion_blur,
CYCLES_RENDER_PT_film,
CYCLES_RENDER_PT_performance,
CYCLES_RENDER_PT_layer_options,
CYCLES_RENDER_PT_filter,
CYCLES_RENDER_PT_layer_passes,
CYCLES_RENDER_PT_views,
CYCLES_RENDER_PT_denoising,
CYCLES_PT_post_processing,
CYCLES_CAMERA_PT_dof,
@@ -1650,7 +1604,7 @@ classes = (
def register():
from bpy.utils import register_class
bpy.types.RENDER_PT_render.append(draw_device)
bpy.types.RENDER_PT_context.append(draw_device)
bpy.types.VIEW3D_HT_header.append(draw_pause)
for panel in get_panels():
@@ -1663,7 +1617,7 @@ def register():
def unregister():
from bpy.utils import unregister_class
bpy.types.RENDER_PT_render.remove(draw_device)
bpy.types.RENDER_PT_context.remove(draw_device)
bpy.types.VIEW3D_HT_header.remove(draw_pause)
for panel in get_panels():

View File

@@ -95,8 +95,8 @@ static void blender_camera_init(BlenderCamera *bcam,
bcam->type = CAMERA_PERSPECTIVE;
bcam->zoom = 1.0f;
bcam->pixelaspect = make_float2(1.0f, 1.0f);
bcam->sensor_width = 32.0f;
bcam->sensor_height = 18.0f;
bcam->sensor_width = 36.0f;
bcam->sensor_height = 24.0f;
bcam->sensor_fit = BlenderCamera::AUTO;
bcam->shuttertime = 1.0f;
bcam->motion_position = Camera::MOTION_POSITION_CENTER;

View File

@@ -1189,7 +1189,7 @@ Mesh *BlenderSync::sync_mesh(BL::Depsgraph& b_depsgraph,
BL::Mesh b_mesh = object_to_mesh(b_data,
b_ob,
b_depsgraph,
true,
false,
need_undeformed,
mesh->subdivision_type);
@@ -1277,7 +1277,7 @@ void BlenderSync::sync_mesh_motion(BL::Depsgraph& b_depsgraph,
b_mesh = object_to_mesh(b_data,
b_ob,
b_depsgraph,
true,
false,
false,
Mesh::SUBDIVISION_NONE);
}

View File

@@ -162,10 +162,24 @@ void BlenderSync::sync_light(BL::Object& b_parent,
light->axisu = transform_get_column(&tfm, 0);
light->axisv = transform_get_column(&tfm, 1);
light->sizeu = b_area_lamp.size();
if(b_area_lamp.shape() == BL::AreaLamp::shape_RECTANGLE)
light->sizev = b_area_lamp.size_y();
else
light->sizev = light->sizeu;
switch(b_area_lamp.shape()) {
case BL::AreaLamp::shape_SQUARE:
light->sizev = light->sizeu;
light->round = false;
break;
case BL::AreaLamp::shape_RECTANGLE:
light->sizev = b_area_lamp.size_y();
light->round = false;
break;
case BL::AreaLamp::shape_DISK:
light->sizev = light->sizeu;
light->round = true;
break;
case BL::AreaLamp::shape_ELLIPSE:
light->sizev = b_area_lamp.size_y();
light->round = true;
break;
}
light->type = LIGHT_AREA;
break;
}

View File

@@ -203,10 +203,10 @@ static PyObject *exit_func(PyObject * /*self*/, PyObject * /*args*/)
static PyObject *create_func(PyObject * /*self*/, PyObject *args)
{
PyObject *pyengine, *pyuserpref, *pydata, *pyscene, *pyregion, *pyv3d, *pyrv3d;
PyObject *pyengine, *pyuserpref, *pydata, *pyregion, *pyv3d, *pyrv3d;
int preview_osl;
if(!PyArg_ParseTuple(args, "OOOOOOOi", &pyengine, &pyuserpref, &pydata, &pyscene,
if(!PyArg_ParseTuple(args, "OOOOOOi", &pyengine, &pyuserpref, &pydata,
&pyregion, &pyv3d, &pyrv3d, &preview_osl))
{
return NULL;
@@ -225,10 +225,6 @@ static PyObject *create_func(PyObject * /*self*/, PyObject *args)
RNA_main_pointer_create((Main*)PyLong_AsVoidPtr(pydata), &dataptr);
BL::BlendData data(dataptr);
PointerRNA sceneptr;
RNA_id_pointer_create((ID*)PyLong_AsVoidPtr(pyscene), &sceneptr);
BL::Scene scene(sceneptr);
PointerRNA regionptr;
RNA_pointer_create(NULL, &RNA_Region, pylong_as_voidptr_typesafe(pyregion), &regionptr);
BL::Region region(regionptr);
@@ -249,27 +245,13 @@ static PyObject *create_func(PyObject * /*self*/, PyObject *args)
int width = region.width();
int height = region.height();
session = new BlenderSession(engine, userpref, data, scene, v3d, rv3d, width, height);
session = new BlenderSession(engine, userpref, data, v3d, rv3d, width, height);
}
else {
/* override some settings for preview */
if(engine.is_preview()) {
PointerRNA cscene = RNA_pointer_get(&sceneptr, "cycles");
RNA_boolean_set(&cscene, "shading_system", preview_osl);
RNA_boolean_set(&cscene, "use_progressive_refine", true);
}
/* offline session or preview render */
session = new BlenderSession(engine, userpref, data, scene);
session = new BlenderSession(engine, userpref, data, preview_osl);
}
python_thread_state_save(&session->python_thread_state);
session->create();
python_thread_state_restore(&session->python_thread_state);
return PyLong_FromVoidPtr(session);
}
@@ -316,7 +298,7 @@ static PyObject *bake_func(PyObject * /*self*/, PyObject *args)
BlenderSession *session = (BlenderSession*)PyLong_AsVoidPtr(pysession);
PointerRNA depsgraphptr;
RNA_id_pointer_create((ID*)PyLong_AsVoidPtr(pydepsgraph), &depsgraphptr);
RNA_pointer_create(NULL, &RNA_Depsgraph, PyLong_AsVoidPtr(pydepsgraph), &depsgraphptr);
BL::Depsgraph b_depsgraph(depsgraphptr);
PointerRNA objectptr;
@@ -360,9 +342,9 @@ static PyObject *draw_func(PyObject * /*self*/, PyObject *args)
static PyObject *reset_func(PyObject * /*self*/, PyObject *args)
{
PyObject *pysession, *pydata, *pyscene;
PyObject *pysession, *pydata, *pydepsgraph;
if(!PyArg_ParseTuple(args, "OOO", &pysession, &pydata, &pyscene))
if(!PyArg_ParseTuple(args, "OOO", &pysession, &pydata, &pydepsgraph))
return NULL;
BlenderSession *session = (BlenderSession*)PyLong_AsVoidPtr(pysession);
@@ -371,13 +353,13 @@ static PyObject *reset_func(PyObject * /*self*/, PyObject *args)
RNA_main_pointer_create((Main*)PyLong_AsVoidPtr(pydata), &dataptr);
BL::BlendData b_data(dataptr);
PointerRNA sceneptr;
RNA_id_pointer_create((ID*)PyLong_AsVoidPtr(pyscene), &sceneptr);
BL::Scene b_scene(sceneptr);
PointerRNA depsgraphptr;
RNA_pointer_create(NULL, &RNA_Depsgraph, PyLong_AsVoidPtr(pydepsgraph), &depsgraphptr);
BL::Depsgraph b_depsgraph(depsgraphptr);
python_thread_state_save(&session->python_thread_state);
session->reset_session(b_data, b_scene);
session->reset_session(b_data, b_depsgraph);
python_thread_state_restore(&session->python_thread_state);
@@ -394,7 +376,7 @@ static PyObject *sync_func(PyObject * /*self*/, PyObject *args)
BlenderSession *session = (BlenderSession*)PyLong_AsVoidPtr(pysession);
PointerRNA depsgraphptr;
RNA_id_pointer_create((ID*)PyLong_AsVoidPtr(pydepsgraph), &depsgraphptr);
RNA_pointer_create(NULL, &RNA_Depsgraph, PyLong_AsVoidPtr(pydepsgraph), &depsgraphptr);
BL::Depsgraph b_depsgraph(depsgraphptr);
python_thread_state_save(&session->python_thread_state);
@@ -428,13 +410,17 @@ static PyObject *available_devices_func(PyObject * /*self*/, PyObject * /*args*/
static PyObject *osl_update_node_func(PyObject * /*self*/, PyObject *args)
{
PyObject *pynodegroup, *pynode;
PyObject *pydata, *pynodegroup, *pynode;
const char *filepath = NULL;
if(!PyArg_ParseTuple(args, "OOs", &pynodegroup, &pynode, &filepath))
if(!PyArg_ParseTuple(args, "OOOs", &pydata, &pynodegroup, &pynode, &filepath))
return NULL;
/* RNA */
PointerRNA dataptr;
RNA_main_pointer_create((Main*)PyLong_AsVoidPtr(pydata), &dataptr);
BL::BlendData b_data(dataptr);
PointerRNA nodeptr;
RNA_pointer_create((ID*)PyLong_AsVoidPtr(pynodegroup), &RNA_ShaderNodeScript, (void*)PyLong_AsVoidPtr(pynode), &nodeptr);
BL::ShaderNodeScript b_node(nodeptr);
@@ -532,7 +518,7 @@ static PyObject *osl_update_node_func(PyObject * /*self*/, PyObject *args)
b_sock = b_node.outputs[param->name.string()];
/* remove if type no longer matches */
if(b_sock && b_sock.bl_idname() != socket_type) {
b_node.outputs.remove(b_sock);
b_node.outputs.remove(b_data, b_sock);
b_sock = BL::NodeSocket(PointerRNA_NULL);
}
}
@@ -540,7 +526,7 @@ static PyObject *osl_update_node_func(PyObject * /*self*/, PyObject *args)
b_sock = b_node.inputs[param->name.string()];
/* remove if type no longer matches */
if(b_sock && b_sock.bl_idname() != socket_type) {
b_node.inputs.remove(b_sock);
b_node.inputs.remove(b_data, b_sock);
b_sock = BL::NodeSocket(PointerRNA_NULL);
}
}
@@ -548,9 +534,9 @@ static PyObject *osl_update_node_func(PyObject * /*self*/, PyObject *args)
if(!b_sock) {
/* create new socket */
if(param->isoutput)
b_sock = b_node.outputs.create(socket_type.c_str(), param->name.c_str(), param->name.c_str());
b_sock = b_node.outputs.create(b_data, socket_type.c_str(), param->name.c_str(), param->name.c_str());
else
b_sock = b_node.inputs.create(socket_type.c_str(), param->name.c_str(), param->name.c_str());
b_sock = b_node.inputs.create(b_data, socket_type.c_str(), param->name.c_str(), param->name.c_str());
/* set default value */
if(data_type == BL::NodeSocket::type_VALUE) {
@@ -584,7 +570,7 @@ static PyObject *osl_update_node_func(PyObject * /*self*/, PyObject *args)
for(b_node.inputs.begin(b_input); b_input != b_node.inputs.end(); ++b_input) {
if(used_sockets.find(b_input->ptr.data) == used_sockets.end()) {
b_node.inputs.remove(*b_input);
b_node.inputs.remove(b_data, *b_input);
removed = true;
break;
}
@@ -592,7 +578,7 @@ static PyObject *osl_update_node_func(PyObject * /*self*/, PyObject *args)
for(b_node.outputs.begin(b_output); b_output != b_node.outputs.end(); ++b_output) {
if(used_sockets.find(b_output->ptr.data) == used_sockets.end()) {
b_node.outputs.remove(*b_output);
b_node.outputs.remove(b_data, *b_output);
removed = true;
break;
}

View File

@@ -52,22 +52,22 @@ int BlenderSession::end_resumable_chunk = 0;
BlenderSession::BlenderSession(BL::RenderEngine& b_engine,
BL::UserPreferences& b_userpref,
BL::BlendData& b_data,
BL::Scene& b_scene)
: b_engine(b_engine),
bool preview_osl)
: session(NULL),
b_engine(b_engine),
b_userpref(b_userpref),
b_data(b_data),
b_render(b_engine.render()),
b_depsgraph(PointerRNA_NULL),
b_scene(b_scene),
b_scene(PointerRNA_NULL),
b_v3d(PointerRNA_NULL),
b_rv3d(PointerRNA_NULL),
width(0),
height(0),
preview_osl(preview_osl),
python_thread_state(NULL)
{
/* offline render */
width = render_resolution_x(b_render);
height = render_resolution_y(b_render);
background = true;
last_redraw_time = 0.0;
start_resize_time = 0.0;
@@ -77,24 +77,24 @@ BlenderSession::BlenderSession(BL::RenderEngine& b_engine,
BlenderSession::BlenderSession(BL::RenderEngine& b_engine,
BL::UserPreferences& b_userpref,
BL::BlendData& b_data,
BL::Scene& b_scene,
BL::SpaceView3D& b_v3d,
BL::RegionView3D& b_rv3d,
int width, int height)
: b_engine(b_engine),
: session(NULL),
b_engine(b_engine),
b_userpref(b_userpref),
b_data(b_data),
b_render(b_scene.render()),
b_render(b_engine.render()),
b_depsgraph(PointerRNA_NULL),
b_scene(b_scene),
b_scene(PointerRNA_NULL),
b_v3d(b_v3d),
b_rv3d(b_rv3d),
width(width),
height(height),
preview_osl(false),
python_thread_state(NULL)
{
/* 3d view render */
background = false;
last_redraw_time = 0.0;
start_resize_time = 0.0;
@@ -168,18 +168,40 @@ void BlenderSession::create_session()
update_resumable_tile_manager(session_params.samples);
}
void BlenderSession::reset_session(BL::BlendData& b_data_, BL::Scene& b_scene_)
void BlenderSession::reset_session(BL::BlendData& b_data, BL::Depsgraph& b_depsgraph)
{
b_data = b_data_;
b_render = b_engine.render();
b_scene = b_scene_;
this->b_data = b_data;
this->b_depsgraph = b_depsgraph;
this->b_scene = b_depsgraph.scene_eval();
if (preview_osl) {
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
RNA_boolean_set(&cscene, "shading_system", preview_osl);
}
if (b_v3d) {
this->b_render = b_scene.render();
}
else {
this->b_render = b_engine.render();
width = render_resolution_x(b_render);
height = render_resolution_y(b_render);
}
if (session == NULL) {
create();
}
if (b_v3d) {
/* NOTE: We need to create session, but all the code from below
* will make viewport render to stuck on initialization.
*/
return;
}
SessionParams session_params = BlenderSync::get_session_params(b_engine, b_userpref, b_scene, background);
SceneParams scene_params = BlenderSync::get_scene_params(b_scene, background);
width = render_resolution_x(b_render);
height = render_resolution_y(b_render);
if(scene->params.modified(scene_params) ||
session->params.modified(session_params) ||
!scene_params.persistent_data)
@@ -372,7 +394,7 @@ void BlenderSession::render(BL::Depsgraph& b_depsgraph_)
BufferParams buffer_params = BlenderSync::get_buffer_params(b_render, b_v3d, b_rv3d, scene->camera, width, height);
/* render each layer */
BL::ViewLayer b_view_layer = b_depsgraph.view_layer();
BL::ViewLayer b_view_layer = b_depsgraph.view_layer_eval();
/* We do some special meta attributes when we only have single layer. */
const bool is_single_layer = (b_scene.view_layers.length() == 1);

View File

@@ -37,12 +37,11 @@ public:
BlenderSession(BL::RenderEngine& b_engine,
BL::UserPreferences& b_userpref,
BL::BlendData& b_data,
BL::Scene& b_scene);
bool preview_osl);
BlenderSession(BL::RenderEngine& b_engine,
BL::UserPreferences& b_userpref,
BL::BlendData& b_data,
BL::Scene& b_scene,
BL::SpaceView3D& b_v3d,
BL::RegionView3D& b_rv3d,
int width, int height);
@@ -56,7 +55,7 @@ public:
void free_session();
void reset_session(BL::BlendData& b_data,
BL::Scene& b_scene);
BL::Depsgraph& b_depsgraph);
/* offline render */
void render(BL::Depsgraph& b_depsgraph);
@@ -119,6 +118,7 @@ public:
double last_status_time;
int width, height;
bool preview_osl;
double start_resize_time;
void *python_thread_state;

View File

@@ -811,6 +811,22 @@ static ShaderNode *add_node(Scene *scene,
get_tex_mapping(&sky->tex_mapping, b_texture_mapping);
node = sky;
}
else if(b_node.is_a(&RNA_ShaderNodeTexIES)) {
BL::ShaderNodeTexIES b_ies_node(b_node);
IESLightNode *ies = new IESLightNode();
switch(b_ies_node.mode()) {
case BL::ShaderNodeTexIES::mode_EXTERNAL:
ies->filename = blender_absolute_path(b_data, b_ntree, b_ies_node.filepath());
break;
case BL::ShaderNodeTexIES::mode_INTERNAL:
ies->ies = get_text_datablock_content(b_ies_node.ies().ptr);
if(ies->ies.empty()) {
ies->ies = "\n";
}
break;
}
node = ies;
}
else if(b_node.is_a(&RNA_ShaderNodeNormalMap)) {
BL::ShaderNodeNormalMap b_normal_map_node(b_node);
NormalMapNode *nmap = new NormalMapNode();
@@ -1229,7 +1245,7 @@ void BlenderSync::sync_materials(BL::Depsgraph& b_depsgraph, bool update_all)
++b_mat_orig)
{
/* TODO(sergey): Iterate over evaluated data rather than using mapping. */
BL::Material b_mat_(b_depsgraph.evaluated_id_get(*b_mat_orig));
BL::Material b_mat_(b_depsgraph.id_eval_get(*b_mat_orig));
BL::Material *b_mat = &b_mat_;
Shader *shader;
@@ -1403,7 +1419,7 @@ void BlenderSync::sync_lamps(BL::Depsgraph& b_depsgraph, bool update_all)
++b_lamp_orig)
{
/* TODO(sergey): Iterate over evaluated data rather than using mapping. */
BL::Lamp b_lamp_(b_depsgraph.evaluated_id_get(*b_lamp_orig));
BL::Lamp b_lamp_(b_depsgraph.id_eval_get(*b_lamp_orig));
BL::Lamp *b_lamp = &b_lamp_;
Shader *shader;

View File

@@ -195,7 +195,7 @@ void BlenderSync::sync_data(BL::RenderSettings& b_render,
int width, int height,
void **python_thread_state)
{
BL::ViewLayer b_view_layer = b_depsgraph.view_layer();
BL::ViewLayer b_view_layer = b_depsgraph.view_layer_eval();
sync_view_layer(b_v3d, b_view_layer);
sync_integrator();
@@ -796,7 +796,8 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine& b_engine,
params.text_timeout = (double)get_float(cscene, "debug_text_timeout");
/* progressive refine */
params.progressive_refine = get_boolean(cscene, "use_progressive_refine") &&
params.progressive_refine = (b_engine.is_preview() ||
get_boolean(cscene, "use_progressive_refine")) &&
!b_r.use_save_buffers();
if(params.progressive_refine) {

View File

@@ -53,6 +53,7 @@ static inline BL::Mesh object_to_mesh(BL::BlendData& data,
bool subsurf_mod_show_render = false;
bool subsurf_mod_show_viewport = false;
/* TODO: make this work with copy-on-write, modifiers are already evaluated. */
if(subdivision_type != Mesh::SUBDIVISION_NONE) {
BL::Modifier subsurf_mod = object.modifiers[object.modifiers.length()-1];
@@ -467,6 +468,21 @@ static inline string blender_absolute_path(BL::BlendData& b_data,
return path;
}
static inline string get_text_datablock_content(const PointerRNA& ptr)
{
if(ptr.data == NULL) {
return "";
}
string content;
BL::Text::lines_iterator iter;
for(iter.begin(ptr); iter; ++iter) {
content += iter->body() + "\n";
}
return content;
}
/* Texture Space */
static inline void mesh_texture_space(BL::Mesh& b_mesh,

View File

@@ -248,7 +248,7 @@ void Device::draw_pixels(
if(rgba.data_type == TYPE_HALF) {
GLhalf *data_pointer = (GLhalf*)rgba.host_pointer;
data_pointer += 4 * y * w;
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F_ARB, w, h, 0, GL_RGBA, GL_HALF_FLOAT, data_pointer);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F, w, h, 0, GL_RGBA, GL_HALF_FLOAT, data_pointer);
}
else {
uint8_t *data_pointer = (uint8_t*)rgba.host_pointer;

View File

@@ -1684,7 +1684,7 @@ public:
min_blocks *= 8;
}
uint step_samples = divide_up(min_blocks * num_threads_per_block, wtile->w * wtile->h);;
uint step_samples = divide_up(min_blocks * num_threads_per_block, wtile->w * wtile->h);
/* Render all samples. */
int start_sample = rtile.start_sample;
@@ -1893,7 +1893,7 @@ public:
glGenTextures(1, &pmem.cuTexId);
glBindTexture(GL_TEXTURE_2D, pmem.cuTexId);
if(mem.data_type == TYPE_HALF)
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F_ARB, pmem.w, pmem.h, 0, GL_RGBA, GL_HALF_FLOAT, NULL);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F, pmem.w, pmem.h, 0, GL_RGBA, GL_HALF_FLOAT, NULL);
else
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, pmem.w, pmem.h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);

View File

@@ -73,12 +73,13 @@ struct SocketType
INTERNAL = (1 << 2) | (1 << 3),
LINK_TEXTURE_GENERATED = (1 << 4),
LINK_TEXTURE_UV = (1 << 5),
LINK_INCOMING = (1 << 6),
LINK_NORMAL = (1 << 7),
LINK_POSITION = (1 << 8),
LINK_TANGENT = (1 << 9),
DEFAULT_LINK_MASK = (1 << 4) | (1 << 5) | (1 << 6) | (1 << 7) | (1 << 8) | (1 << 9)
LINK_TEXTURE_NORMAL = (1 << 5),
LINK_TEXTURE_UV = (1 << 6),
LINK_INCOMING = (1 << 7),
LINK_NORMAL = (1 << 8),
LINK_POSITION = (1 << 9),
LINK_TANGENT = (1 << 10),
DEFAULT_LINK_MASK = (1 << 4) | (1 << 5) | (1 << 6) | (1 << 7) | (1 << 8) | (1 << 9) | (1 << 10)
};
ustring name;

View File

@@ -178,6 +178,7 @@ set(SRC_SVM_HEADERS
svm/svm_geometry.h
svm/svm_gradient.h
svm/svm_hsv.h
svm/svm_ies.h
svm/svm_image.h
svm/svm_invert.h
svm/svm_light_path.h

View File

@@ -37,15 +37,22 @@ CCL_NAMESPACE_BEGIN
ccl_device void bsdf_transparent_setup(ShaderData *sd, const float3 weight, int path_flag)
{
/* Check cutoff weight. */
float sample_weight = fabsf(average(weight));
if(!(sample_weight >= CLOSURE_WEIGHT_CUTOFF)) {
return;
}
if(sd->flag & SD_TRANSPARENT) {
sd->closure_transparent_extinction += weight;
/* Add weight to existing transparent BSDF. */
for(int i = 0; i < sd->num_closure; i++) {
ShaderClosure *sc = &sd->closure[i];
if(sc->type == CLOSURE_BSDF_TRANSPARENT_ID) {
sc->weight += weight;
sc->sample_weight += fabsf(average(weight));
sc->sample_weight += sample_weight;
break;
}
}
@@ -61,11 +68,15 @@ ccl_device void bsdf_transparent_setup(ShaderData *sd, const float3 weight, int
sd->num_closure_left = 1;
}
ShaderClosure *bsdf = bsdf_alloc(sd, sizeof(ShaderClosure), weight);
/* Create new transparent BSDF. */
ShaderClosure *bsdf = closure_alloc(sd, sizeof(ShaderClosure), CLOSURE_BSDF_TRANSPARENT_ID, weight);
if(bsdf) {
bsdf->sample_weight = sample_weight;
bsdf->N = sd->N;
bsdf->type = CLOSURE_BSDF_TRANSPARENT_ID;
}
else if(path_flag & PATH_RAY_TERMINATE) {
sd->num_closure_left = 0;
}
}
}

View File

@@ -61,8 +61,13 @@ ccl_device_inline void kernel_filter_construct_gramian(int x, int y,
make_int2(x+dx, y+dy), buffer + q_offset,
pass_stride, *rank, design_row, transform, stride);
#ifdef __KERNEL_GPU__
math_trimatrix_add_gramian_strided(XtWX, (*rank)+1, design_row, weight, stride);
math_vec3_add_strided(XtWY, (*rank)+1, design_row, weight * q_color, stride);
#else
math_trimatrix_add_gramian(XtWX, (*rank)+1, design_row, weight);
math_vec3_add(XtWY, (*rank)+1, design_row, weight * q_color);
#endif
}
ccl_device_inline void kernel_filter_finalize(int x, int y,

View File

@@ -44,7 +44,7 @@ typedef struct LightSample {
*
* Note: light_p is modified when sample_coord is true.
*/
ccl_device_inline float area_light_sample(float3 P,
ccl_device_inline float rect_light_sample(float3 P,
float3 *light_p,
float3 axisu, float3 axisv,
float randu, float randv,
@@ -125,6 +125,60 @@ ccl_device_inline float area_light_sample(float3 P,
return 0.0f;
}
ccl_device_inline float3 ellipse_sample(float3 ru, float3 rv, float randu, float randv)
{
to_unit_disk(&randu, &randv);
return ru*randu + rv*randv;
}
ccl_device float3 disk_light_sample(float3 v, float randu, float randv)
{
float3 ru, rv;
make_orthonormals(v, &ru, &rv);
return ellipse_sample(ru, rv, randu, randv);
}
ccl_device float3 distant_light_sample(float3 D, float radius, float randu, float randv)
{
return normalize(D + disk_light_sample(D, randu, randv)*radius);
}
ccl_device float3 sphere_light_sample(float3 P, float3 center, float radius, float randu, float randv)
{
return disk_light_sample(normalize(P - center), randu, randv)*radius;
}
ccl_device float spot_light_attenuation(float3 dir, float spot_angle, float spot_smooth, LightSample *ls)
{
float3 I = ls->Ng;
float attenuation = dot(dir, I);
if(attenuation <= spot_angle) {
attenuation = 0.0f;
}
else {
float t = attenuation - spot_angle;
if(t < spot_smooth && spot_smooth != 0.0f)
attenuation *= smoothstepf(t/spot_smooth);
}
return attenuation;
}
ccl_device float lamp_light_pdf(KernelGlobals *kg, const float3 Ng, const float3 I, float t)
{
float cos_pi = dot(Ng, I);
if(cos_pi <= 0.0f)
return 0.0f;
return t*t/cos_pi;
}
/* Background Light */
#ifdef __BACKGROUND_MIS__
@@ -170,7 +224,7 @@ float3 background_map_sample(KernelGlobals *kg, float randu, float randv, float
float2 cdf_last_v = kernel_tex_fetch(__light_background_marginal_cdf, res);
/* importance-sampled V direction */
float dv = (randv - cdf_v.y) / (cdf_next_v.y - cdf_v.y);
float dv = inverse_lerp(cdf_v.y, cdf_next_v.y, randv);
float v = (index_v + dv) / res;
/* this is basically std::lower_bound as used by pbrt */
@@ -196,7 +250,7 @@ float3 background_map_sample(KernelGlobals *kg, float randu, float randv, float
float2 cdf_last_u = kernel_tex_fetch(__light_background_conditional_cdf, index_v * cdf_count + res);
/* importance-sampled U direction */
float du = (randu - cdf_u.y) / (cdf_next_u.y - cdf_u.y);
float du = inverse_lerp(cdf_u.y, cdf_next_u.y, randu);
float u = (index_u + du) / res;
/* compute pdf */
@@ -295,11 +349,19 @@ ccl_device_inline float background_portal_pdf(KernelGlobals *kg,
const ccl_global KernelLight *klight = &kernel_tex_fetch(__lights, portal);
float3 axisu = make_float3(klight->area.axisu[0], klight->area.axisu[1], klight->area.axisu[2]);
float3 axisv = make_float3(klight->area.axisv[0], klight->area.axisv[1], klight->area.axisv[2]);
bool is_round = (klight->area.invarea < 0.0f);
if(!ray_quad_intersect(P, direction, 1e-4f, FLT_MAX, lightpos, axisu, axisv, dir, NULL, NULL, NULL, NULL))
if(!ray_quad_intersect(P, direction, 1e-4f, FLT_MAX, lightpos, axisu, axisv, dir, NULL, NULL, NULL, NULL, is_round))
continue;
portal_pdf += area_light_sample(P, &lightpos, axisu, axisv, 0.0f, 0.0f, false);
if(is_round) {
float t;
float3 D = normalize_len(lightpos - P, &t);
portal_pdf += fabsf(klight->area.invarea) * lamp_light_pdf(kg, dir, -D, t);
}
else {
portal_pdf += rect_light_sample(P, &lightpos, axisu, axisv, 0.0f, 0.0f, false);
}
}
if(ignore_portal >= 0) {
@@ -349,15 +411,26 @@ ccl_device float3 background_portal_sample(KernelGlobals *kg,
const ccl_global KernelLight *klight = &kernel_tex_fetch(__lights, portal);
float3 axisu = make_float3(klight->area.axisu[0], klight->area.axisu[1], klight->area.axisu[2]);
float3 axisv = make_float3(klight->area.axisv[0], klight->area.axisv[1], klight->area.axisv[2]);
bool is_round = (klight->area.invarea < 0.0f);
*pdf = area_light_sample(P, &lightpos,
axisu, axisv,
randu, randv,
true);
float3 D;
if(is_round) {
lightpos += ellipse_sample(axisu*0.5f, axisv*0.5f, randu, randv);
float t;
D = normalize_len(lightpos - P, &t);
*pdf = fabsf(klight->area.invarea) * lamp_light_pdf(kg, dir, -D, t);
}
else {
*pdf = rect_light_sample(P, &lightpos,
axisu, axisv,
randu, randv,
true);
D = normalize(lightpos - P);
}
*pdf /= num_possible;
*sampled_portal = p;
return normalize(lightpos - P);
return D;
}
portal--;
@@ -458,55 +531,6 @@ ccl_device float background_light_pdf(KernelGlobals *kg, float3 P, float3 direct
/* Regular Light */
ccl_device float3 disk_light_sample(float3 v, float randu, float randv)
{
float3 ru, rv;
make_orthonormals(v, &ru, &rv);
to_unit_disk(&randu, &randv);
return ru*randu + rv*randv;
}
ccl_device float3 distant_light_sample(float3 D, float radius, float randu, float randv)
{
return normalize(D + disk_light_sample(D, randu, randv)*radius);
}
ccl_device float3 sphere_light_sample(float3 P, float3 center, float radius, float randu, float randv)
{
return disk_light_sample(normalize(P - center), randu, randv)*radius;
}
ccl_device float spot_light_attenuation(float3 dir, float spot_angle, float spot_smooth, LightSample *ls)
{
float3 I = ls->Ng;
float attenuation = dot(dir, I);
if(attenuation <= spot_angle) {
attenuation = 0.0f;
}
else {
float t = attenuation - spot_angle;
if(t < spot_smooth && spot_smooth != 0.0f)
attenuation *= smoothstepf(t/spot_smooth);
}
return attenuation;
}
ccl_device float lamp_light_pdf(KernelGlobals *kg, const float3 Ng, const float3 I, float t)
{
float cos_pi = dot(Ng, I);
if(cos_pi <= 0.0f)
return 0.0f;
return t*t/cos_pi;
}
ccl_device_inline bool lamp_light_sample(KernelGlobals *kg,
int lamp,
float randu, float randv,
@@ -601,26 +625,39 @@ ccl_device_inline bool lamp_light_sample(KernelGlobals *kg,
float3 D = make_float3(klight->area.dir[0],
klight->area.dir[1],
klight->area.dir[2]);
float invarea = fabsf(klight->area.invarea);
bool is_round = (klight->area.invarea < 0.0f);
if(dot(ls->P - P, D) > 0.0f) {
return false;
}
float3 inplane = ls->P;
ls->pdf = area_light_sample(P, &ls->P,
axisu, axisv,
randu, randv,
true);
float3 inplane;
if(is_round) {
inplane = ellipse_sample(axisu*0.5f, axisv*0.5f, randu, randv);
ls->P += inplane;
ls->pdf = invarea;
}
else {
inplane = ls->P;
ls->pdf = rect_light_sample(P, &ls->P,
axisu, axisv,
randu, randv,
true);
inplane = ls->P - inplane;
}
inplane = ls->P - inplane;
ls->u = dot(inplane, axisu) * (1.0f / dot(axisu, axisu)) + 0.5f;
ls->v = dot(inplane, axisv) * (1.0f / dot(axisv, axisv)) + 0.5f;
ls->Ng = D;
ls->D = normalize_len(ls->P - P, &ls->t);
float invarea = klight->area.invarea;
ls->eval_fac = 0.25f*invarea;
if(is_round) {
ls->pdf *= lamp_light_pdf(kg, D, -ls->D, ls->t);
}
}
}
@@ -731,7 +768,8 @@ ccl_device bool lamp_light_eval(KernelGlobals *kg, int lamp, float3 P, float3 D,
}
else if(type == LIGHT_AREA) {
/* area light */
float invarea = klight->area.invarea;
float invarea = fabsf(klight->area.invarea);
bool is_round = (klight->area.invarea < 0.0f);
if(invarea == 0.0f)
return false;
@@ -754,14 +792,20 @@ ccl_device bool lamp_light_eval(KernelGlobals *kg, int lamp, float3 P, float3 D,
if(!ray_quad_intersect(P, D, 0.0f, t, light_P,
axisu, axisv, Ng,
&ls->P, &ls->t,
&ls->u, &ls->v))
&ls->u, &ls->v,
is_round))
{
return false;
}
ls->D = D;
ls->Ng = Ng;
ls->pdf = area_light_sample(P, &light_P, axisu, axisv, 0, 0, false);
if(is_round) {
ls->pdf = invarea * lamp_light_pdf(kg, Ng, -D, ls->t);
}
else {
ls->pdf = rect_light_sample(P, &light_P, axisu, axisv, 0, 0, false);
}
ls->eval_fac = 0.25f*invarea;
}
else {

View File

@@ -81,5 +81,8 @@ KERNEL_TEX(uint, __sobol_directions)
/* image textures */
KERNEL_TEX(TextureInfo, __texture_info)
/* ies lights */
KERNEL_TEX(float, __ies)
#undef KERNEL_TEX

View File

@@ -1452,7 +1452,7 @@ typedef struct KernelObject {
uint attribute_map_offset;
uint motion_offset;
uint pad;
} KernelObject;;
} KernelObject;
static_assert_align(KernelObject, 16);
typedef struct KernelSpotLight {

View File

@@ -349,7 +349,7 @@ template<typename T> struct TextureInterpolator {
* Only happens for AVX2 kernel and global __KERNEL_SSE__ vectorization
* enabled.
*/
#ifdef __GNUC__
#if defined(__GNUC__) || defined(__clang__)
static ccl_always_inline
#else
static ccl_never_inline

View File

@@ -956,9 +956,15 @@ bool OSLRenderServices::texture(ustring filename,
status = true;
}
}
else if(filename[1] == 'l') {
/* IES light. */
int slot = atoi(filename.c_str() + 2);
result[0] = kernel_ies_interp(kg, slot, s, t);
status = true;
}
else {
/* Packed texture. */
int slot = atoi(filename.c_str() + 1);
int slot = atoi(filename.c_str() + 2);
float4 rgba = kernel_tex_image_interp(kg, slot, s, 1.0f - t);
result[0] = rgba[0];

View File

@@ -39,6 +39,7 @@ set(SRC_OSL
node_principled_volume.osl
node_holdout.osl
node_hsv.osl
node_ies_light.osl
node_image_texture.osl
node_invert.osl
node_layer_weight.osl

View File

@@ -0,0 +1,42 @@
/*
* Copyright 2011-2015 Blender Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "stdosl.h"
#include "node_texture.h"
/* IES Light */
shader node_ies_light(
int use_mapping = 0,
matrix mapping = matrix(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
int slot = 0,
float Strength = 1.0,
point Vector = I,
output float Fac = 0.0)
{
point p = Vector;
if (use_mapping) {
p = transform(mapping, p);
}
p = normalize(p);
float v_angle = acos(-p[2]);
float h_angle = atan2(p[0], p[1]) + M_PI;
Fac = Strength * texture(format("@l%d", slot), h_angle, v_angle);
}

View File

@@ -95,6 +95,8 @@ shader node_math(
Value = safe_modulo(Value1, Value2);
else if (type == "absolute")
Value = fabs(Value1);
else if (type == "arctan2")
Value = atan2(Value1, Value2);
if (use_clamp)
Value = clamp(Value, 0.0, 1.0);

View File

@@ -157,6 +157,7 @@ CCL_NAMESPACE_END
#include "kernel/svm/svm_camera.h"
#include "kernel/svm/svm_geometry.h"
#include "kernel/svm/svm_hsv.h"
#include "kernel/svm/svm_ies.h"
#include "kernel/svm/svm_image.h"
#include "kernel/svm/svm_gamma.h"
#include "kernel/svm/svm_brightness.h"
@@ -421,6 +422,9 @@ ccl_device_noinline void svm_eval_nodes(KernelGlobals *kg, ShaderData *sd, ccl_a
case NODE_LIGHT_FALLOFF:
svm_node_light_falloff(sd, stack, node);
break;
case NODE_IES:
svm_node_ies(kg, sd, stack, node, &offset);
break;
# endif /* __EXTRA_NODES__ */
#endif /* NODES_GROUP(NODE_GROUP_LEVEL_2) */

View File

@@ -216,7 +216,7 @@ ccl_device void svm_node_bevel(
if(stack_valid(normal_offset)) {
/* Preserve input normal. */
float3 ref_N = stack_load_float3(stack, normal_offset);
bevel_N = normalize(ref_N + (bevel_N - sd->N));;
bevel_N = normalize(ref_N + (bevel_N - sd->N));
}
stack_store_float3(stack, out_offset, bevel_N);

View File

@@ -141,7 +141,7 @@ ccl_device void svm_node_vector_displacement(KernelGlobals *kg, ShaderData *sd,
tangent = normalize(sd->dPdu);
}
float3 bitangent = normalize(cross(normal, tangent));;
float3 bitangent = normalize(cross(normal, tangent));
const AttributeDescriptor attr_sign = find_attribute(kg, sd, node.w);
if(attr_sign.offset != ATTR_STD_NOT_FOUND) {
float sign = primitive_attribute_float(kg, sd, attr_sign, NULL, NULL);

View File

@@ -0,0 +1,110 @@
/*
* Copyright 2011-2013 Blender Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
CCL_NAMESPACE_BEGIN
/* IES Light */
ccl_device_inline float interpolate_ies_vertical(KernelGlobals *kg, int ofs, int v, int v_num, float v_frac, int h)
{
/* Since lookups are performed in spherical coordinates, clamping the coordinates at the low end of v
* (corresponding to the north pole) would result in artifacts.
* The proper way of dealing with this would be to lookup the corresponding value on the other side of the pole,
* but since the horizontal coordinates might be nonuniform, this would require yet another interpolation.
* Therefore, the assumtion is made that the light is going to be symmetrical, which means that we can just take
* the corresponding value at the current horizontal coordinate. */
#define IES_LOOKUP(v) kernel_tex_fetch(__ies, ofs+h*v_num+(v))
/* If v is zero, assume symmetry and read at v=1 instead of v=-1. */
float a = IES_LOOKUP((v == 0)? 1 : v-1);
float b = IES_LOOKUP(v);
float c = IES_LOOKUP(v+1);
float d = IES_LOOKUP(min(v+2, v_num-1));
#undef IES_LOOKUP
return cubic_interp(a, b, c, d, v_frac);
}
ccl_device_inline float kernel_ies_interp(KernelGlobals *kg, int slot, float h_angle, float v_angle)
{
/* Find offset of the IES data in the table. */
int ofs = __float_as_int(kernel_tex_fetch(__ies, slot));
if(ofs == -1) {
return 100.0f;
}
int h_num = __float_as_int(kernel_tex_fetch(__ies, ofs++));
int v_num = __float_as_int(kernel_tex_fetch(__ies, ofs++));
#define IES_LOOKUP_ANGLE_H(h) kernel_tex_fetch(__ies, ofs+(h))
#define IES_LOOKUP_ANGLE_V(v) kernel_tex_fetch(__ies, ofs+h_num+(v))
/* Check whether the angle is within the bounds of the IES texture. */
if(v_angle >= IES_LOOKUP_ANGLE_V(v_num-1)) {
return 0.0f;
}
kernel_assert(v_angle >= IES_LOOKUP_ANGLE_V(0));
kernel_assert(h_angle >= IES_LOOKUP_ANGLE_H(0));
kernel_assert(h_angle <= IES_LOOKUP_ANGLE_H(h_num-1));
/* Lookup the angles to find the table position. */
int h_i, v_i;
/* TODO(lukas): Consider using bisection. Probably not worth it for the vast majority of IES files. */
for(h_i = 0; IES_LOOKUP_ANGLE_H(h_i+1) < h_angle; h_i++);
for(v_i = 0; IES_LOOKUP_ANGLE_V(v_i+1) < v_angle; v_i++);
float h_frac = inverse_lerp(IES_LOOKUP_ANGLE_H(h_i), IES_LOOKUP_ANGLE_H(h_i+1), h_angle);
float v_frac = inverse_lerp(IES_LOOKUP_ANGLE_V(v_i), IES_LOOKUP_ANGLE_V(v_i+1), v_angle);
#undef IES_LOOKUP_ANGLE_H
#undef IES_LOOKUP_ANGLE_V
/* Skip forward to the actual intensity data. */
ofs += h_num+v_num;
/* Perform cubic interpolation along the horizontal coordinate to get the intensity value.
* If h_i is zero, just wrap around since the horizontal angles always go over the full circle.
* However, the last entry (360°) equals the first one, so we need to wrap around to the one before that. */
float a = interpolate_ies_vertical(kg, ofs, v_i, v_num, v_frac, (h_i == 0)? h_num-2 : h_i-1);
float b = interpolate_ies_vertical(kg, ofs, v_i, v_num, v_frac, h_i);
float c = interpolate_ies_vertical(kg, ofs, v_i, v_num, v_frac, h_i+1);
/* Same logic here, wrap around to the second element if necessary. */
float d = interpolate_ies_vertical(kg, ofs, v_i, v_num, v_frac, (h_i+2 == h_num)? 1 : h_i+2);
/* Cubic interpolation can result in negative values, so get rid of them. */
return max(cubic_interp(a, b, c, d, h_frac), 0.0f);
}
ccl_device void svm_node_ies(KernelGlobals *kg, ShaderData *sd, float *stack, uint4 node, int *offset)
{
uint vector_offset, strength_offset, fac_offset, dummy, slot = node.z;
decode_node_uchar4(node.y, &strength_offset, &vector_offset, &fac_offset, &dummy);
float3 vector = stack_load_float3(stack, vector_offset);
float strength = stack_load_float_default(stack, strength_offset, node.w);
vector = normalize(vector);
float v_angle = safe_acosf(-vector.z);
float h_angle = atan2f(vector.x, vector.y) + M_PI_F;
float fac = strength * kernel_ies_interp(kg, slot, h_angle, v_angle);
if(stack_valid(fac_offset)) {
stack_store_float(stack, fac_offset, fac);
}
}
CCL_NAMESPACE_END

View File

@@ -92,6 +92,8 @@ ccl_device float svm_math(NodeMath type, float Fac1, float Fac2)
Fac = safe_modulo(Fac1, Fac2);
else if(type == NODE_MATH_ABSOLUTE)
Fac = fabsf(Fac1);
else if(type == NODE_MATH_ARCTAN2)
Fac = atan2f(Fac1, Fac2);
else if(type == NODE_MATH_CLAMP)
Fac = saturate(Fac1);
else

View File

@@ -136,6 +136,7 @@ typedef enum ShaderNodeType {
NODE_DISPLACEMENT,
NODE_VECTOR_DISPLACEMENT,
NODE_PRINCIPLED_VOLUME,
NODE_IES,
} ShaderNodeType;
typedef enum NodeAttributeType {
@@ -259,6 +260,7 @@ typedef enum NodeMath {
NODE_MATH_GREATER_THAN,
NODE_MATH_MODULO,
NODE_MATH_ABSOLUTE,
NODE_MATH_ARCTAN2,
NODE_MATH_CLAMP /* used for the clamp UI option */
} NodeMath;

View File

@@ -774,6 +774,12 @@ void ShaderGraph::default_inputs(bool do_osl)
connect(texco->output("Generated"), input);
}
if(input->flags() & SocketType::LINK_TEXTURE_NORMAL) {
if(!texco)
texco = new TextureCoordinateNode();
connect(texco->output("Normal"), input);
}
else if(input->flags() & SocketType::LINK_TEXTURE_UV) {
if(!texco)
texco = new TextureCoordinateNode();

View File

@@ -25,6 +25,8 @@
#include "render/shader.h"
#include "util/util_foreach.h"
#include "util/util_hash.h"
#include "util/util_path.h"
#include "util/util_progress.h"
#include "util/util_logging.h"
@@ -117,6 +119,7 @@ NODE_DEFINE(Light)
SOCKET_FLOAT(sizeu, "Size U", 1.0f);
SOCKET_VECTOR(axisv, "Axis V", make_float3(0.0f, 0.0f, 0.0f));
SOCKET_FLOAT(sizev, "Size V", 1.0f);
SOCKET_BOOLEAN(round, "Round", false);
SOCKET_INT(map_resolution, "Map Resolution", 512);
@@ -175,6 +178,9 @@ LightManager::LightManager()
LightManager::~LightManager()
{
foreach(IESSlot *slot, ies_slots) {
delete slot;
}
}
bool LightManager::has_background_light(Scene *scene)
@@ -730,12 +736,15 @@ void LightManager::device_update_points(Device *,
float3 axisu = light->axisu*(light->sizeu*light->size);
float3 axisv = light->axisv*(light->sizev*light->size);
float area = len(axisu)*len(axisv);
float invarea = (area > 0.0f)? 1.0f/area: 1.0f;
if(light->round) {
area *= -M_PI_4_F;
}
float invarea = (area != 0.0f)? 1.0f/area: 1.0f;
float3 dir = light->dir;
dir = safe_normalize(dir);
if(light->use_mis && area > 0.0f)
if(light->use_mis && area != 0.0f)
shader_id |= SHADER_USE_MIS;
klights[light_index].co[0] = co.x;
@@ -803,7 +812,10 @@ void LightManager::device_update_points(Device *,
float3 axisu = light->axisu*(light->sizeu*light->size);
float3 axisv = light->axisv*(light->sizev*light->size);
float area = len(axisu)*len(axisv);
float invarea = (area > 0.0f)? 1.0f/area: 1.0f;
if(light->round) {
area *= -M_PI_4_F;
}
float invarea = (area != 0.0f)? 1.0f/area: 1.0f;
float3 dir = light->dir;
dir = safe_normalize(dir);
@@ -858,6 +870,9 @@ void LightManager::device_update(Device *device, DeviceScene *dscene, Scene *sce
device_update_background(device, dscene, scene, progress);
if(progress.get_cancel()) return;
device_update_ies(dscene);
if(progress.get_cancel()) return;
if(use_light_visibility != scene->film->use_light_visibility) {
scene->film->use_light_visibility = use_light_visibility;
scene->film->tag_update(scene);
@@ -872,6 +887,7 @@ void LightManager::device_free(Device *, DeviceScene *dscene)
dscene->lights.free();
dscene->light_background_marginal_cdf.free();
dscene->light_background_conditional_cdf.free();
dscene->ies_lights.free();
}
void LightManager::tag_update(Scene * /*scene*/)
@@ -879,5 +895,121 @@ void LightManager::tag_update(Scene * /*scene*/)
need_update = true;
}
int LightManager::add_ies_from_file(ustring filename)
{
string content;
/* If the file can't be opened, call with an empty line */
if(filename.empty() || !path_read_text(filename.c_str(), content)) {
content = "\n";
}
return add_ies(ustring(content));
}
int LightManager::add_ies(ustring content)
{
uint hash = hash_string(content.c_str());
thread_scoped_lock ies_lock(ies_mutex);
/* Check whether this IES already has a slot. */
size_t slot;
for(slot = 0; slot < ies_slots.size(); slot++) {
if(ies_slots[slot]->hash == hash) {
ies_slots[slot]->users++;
return slot;
}
}
/* Try to find an empty slot for the new IES. */
for(slot = 0; slot < ies_slots.size(); slot++) {
if(ies_slots[slot]->users == 0 && ies_slots[slot]->hash == 0) {
break;
}
}
/* If there's no free slot, add one. */
if(slot == ies_slots.size()) {
ies_slots.push_back(new IESSlot());
}
ies_slots[slot]->ies.load(content);
ies_slots[slot]->users = 1;
ies_slots[slot]->hash = hash;
need_update = true;
return slot;
}
void LightManager::remove_ies(int slot)
{
thread_scoped_lock ies_lock(ies_mutex);
if(slot < 0 || slot >= ies_slots.size()) {
assert(false);
return;
}
assert(ies_slots[slot]->users > 0);
ies_slots[slot]->users--;
/* If the slot has no more users, update the device to remove it. */
need_update |= (ies_slots[slot]->users == 0);
}
void LightManager::device_update_ies(DeviceScene *dscene)
{
/* Clear empty slots. */
foreach(IESSlot *slot, ies_slots) {
if(slot->users == 0) {
slot->hash = 0;
slot->ies.clear();
}
}
/* Shrink the slot table by removing empty slots at the end. */
int slot_end;
for(slot_end = ies_slots.size(); slot_end; slot_end--) {
if(ies_slots[slot_end-1]->users > 0) {
/* If the preceding slot has users, we found the new end of the table. */
break;
}
else {
/* The slot will be past the new end of the table, so free it. */
delete ies_slots[slot_end-1];
}
}
ies_slots.resize(slot_end);
if(ies_slots.size() > 0) {
int packed_size = 0;
foreach(IESSlot *slot, ies_slots) {
packed_size += slot->ies.packed_size();
}
/* ies_lights starts with an offset table that contains the offset of every slot,
* or -1 if the slot is invalid.
* Following that table, the packed valid IES lights are stored. */
float *data = dscene->ies_lights.alloc(ies_slots.size() + packed_size);
int offset = ies_slots.size();
for(int i = 0; i < ies_slots.size(); i++) {
int size = ies_slots[i]->ies.packed_size();
if(size > 0) {
data[i] = __int_as_float(offset);
ies_slots[i]->ies.pack(data + offset);
offset += size;
}
else {
data[i] = __int_as_float(-1);
}
}
dscene->ies_lights.copy_to_device();
}
}
CCL_NAMESPACE_END

View File

@@ -21,6 +21,8 @@
#include "graph/node.h"
#include "util/util_ies.h"
#include "util/util_thread.h"
#include "util/util_types.h"
#include "util/util_vector.h"
@@ -49,6 +51,7 @@ public:
float sizeu;
float3 axisv;
float sizev;
bool round;
Transform tfm;
@@ -86,6 +89,11 @@ public:
LightManager();
~LightManager();
/* IES texture management */
int add_ies(ustring ies);
int add_ies_from_file(ustring filename);
void remove_ies(int slot);
void device_update(Device *device,
DeviceScene *dscene,
Scene *scene,
@@ -115,9 +123,19 @@ protected:
DeviceScene *dscene,
Scene *scene,
Progress& progress);
void device_update_ies(DeviceScene *dscene);
/* Check whether light manager can use the object as a light-emissive. */
bool object_usable_as_light(Object *object);
struct IESSlot {
IESFile ies;
uint hash;
int users;
};
vector<IESSlot*> ies_slots;
thread_mutex ies_mutex;
};
CCL_NAMESPACE_END

View File

@@ -1307,7 +1307,7 @@ void MeshManager::update_svm_attributes(Device *, DeviceScene *dscene, Scene *sc
return;
/* create attribute map */
uint4 *attr_map = dscene->attributes_map.alloc(attr_map_size*scene->meshes.size());
uint4 *attr_map = dscene->attributes_map.alloc(attr_map_size);
memset(attr_map, 0, dscene->attributes_map.size()*sizeof(uint));
for(size_t i = 0; i < scene->meshes.size(); i++) {

View File

@@ -16,6 +16,7 @@
#include "render/image.h"
#include "render/integrator.h"
#include "render/light.h"
#include "render/nodes.h"
#include "render/scene.h"
#include "render/svm.h"
@@ -384,10 +385,10 @@ void ImageTextureNode::compile(OSLCompiler& compiler)
/* TODO(sergey): It's not so simple to pass custom attribute
* to the texture() function in order to make builtin images
* support more clear. So we use special file name which is
* "@<slot_number>" and check whether file name matches this
* "@i<slot_number>" and check whether file name matches this
* mask in the OSLRenderServices::texture().
*/
compiler.parameter("filename", string_printf("@%d", slot).c_str());
compiler.parameter("filename", string_printf("@i%d", slot).c_str());
}
if(is_linear || color_space != NODE_COLOR_SPACE_COLOR)
compiler.parameter("color_space", "linear");
@@ -567,7 +568,7 @@ void EnvironmentTextureNode::compile(OSLCompiler& compiler)
compiler.parameter(this, "filename");
}
else {
compiler.parameter("filename", string_printf("@%d", slot).c_str());
compiler.parameter("filename", string_printf("@i%d", slot).c_str());
}
compiler.parameter(this, "projection");
if(is_linear || color_space != NODE_COLOR_SPACE_COLOR)
@@ -954,6 +955,97 @@ void VoronoiTextureNode::compile(OSLCompiler& compiler)
compiler.add(this, "node_voronoi_texture");
}
/* IES Light */
NODE_DEFINE(IESLightNode)
{
NodeType* type = NodeType::add("ies_light", create, NodeType::SHADER);
TEXTURE_MAPPING_DEFINE(IESLightNode);
SOCKET_STRING(ies, "IES", ustring());
SOCKET_STRING(filename, "File Name", ustring());
SOCKET_IN_FLOAT(strength, "Strength", 1.0f);
SOCKET_IN_POINT(vector, "Vector", make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_TEXTURE_NORMAL);
SOCKET_OUT_FLOAT(fac, "Fac");
return type;
}
IESLightNode::IESLightNode()
: TextureNode(node_type)
{
light_manager = NULL;
slot = -1;
}
ShaderNode *IESLightNode::clone() const
{
IESLightNode *node = new IESLightNode(*this);
node->light_manager = NULL;
node->slot = -1;
return node;
}
IESLightNode::~IESLightNode()
{
if(light_manager) {
light_manager->remove_ies(slot);
}
}
void IESLightNode::get_slot()
{
assert(light_manager);
if(slot == -1) {
if(ies.empty()) {
slot = light_manager->add_ies_from_file(filename);
}
else {
slot = light_manager->add_ies(ies);
}
}
}
void IESLightNode::compile(SVMCompiler& compiler)
{
light_manager = compiler.light_manager;
get_slot();
ShaderInput *strength_in = input("Strength");
ShaderInput *vector_in = input("Vector");
ShaderOutput *fac_out = output("Fac");
int vector_offset = tex_mapping.compile_begin(compiler, vector_in);
compiler.add_node(NODE_IES,
compiler.encode_uchar4(
compiler.stack_assign_if_linked(strength_in),
vector_offset,
compiler.stack_assign(fac_out),
0),
slot,
__float_as_int(strength));
tex_mapping.compile_end(compiler, vector_in, vector_offset);
}
void IESLightNode::compile(OSLCompiler& compiler)
{
light_manager = compiler.light_manager;
get_slot();
tex_mapping.compile(compiler);
compiler.parameter("slot", slot);
compiler.add(this, "node_ies_light");
}
/* Musgrave Texture */
NODE_DEFINE(MusgraveTextureNode)
@@ -1470,7 +1562,7 @@ void PointDensityTextureNode::compile(OSLCompiler& compiler)
}
if(slot != -1) {
compiler.parameter("filename", string_printf("@%d", slot).c_str());
compiler.parameter("filename", string_printf("@i%d", slot).c_str());
}
if(space == NODE_TEX_VOXEL_SPACE_WORLD) {
compiler.parameter("mapping", tfm);
@@ -4601,7 +4693,7 @@ void AttributeNode::compile(SVMCompiler& compiler)
ShaderOutput *vector_out = output("Vector");
ShaderOutput *fac_out = output("Fac");
ShaderNodeType attr_node = NODE_ATTR;
int attr = compiler.attribute_standard(attribute);;
int attr = compiler.attribute_standard(attribute);
if(bump == SHADER_BUMP_DX)
attr_node = NODE_ATTR_BUMP_DX;
@@ -4953,6 +5045,7 @@ NODE_DEFINE(MathNode)
type_enum.insert("greater_than", NODE_MATH_GREATER_THAN);
type_enum.insert("modulo", NODE_MATH_MODULO);
type_enum.insert("absolute", NODE_MATH_ABSOLUTE);
type_enum.insert("arctan2", NODE_MATH_ARCTAN2);
SOCKET_ENUM(type, "Type", type_enum, NODE_MATH_ADD);
SOCKET_BOOLEAN(use_clamp, "Use Clamp", false);

View File

@@ -25,6 +25,7 @@
CCL_NAMESPACE_BEGIN
class ImageManager;
class LightManager;
class Scene;
class Shader;
@@ -281,6 +282,27 @@ public:
}
};
class IESLightNode : public TextureNode {
public:
SHADER_NODE_NO_CLONE_CLASS(IESLightNode)
~IESLightNode();
ShaderNode *clone() const;
virtual int get_group() { return NODE_GROUP_LEVEL_2; }
ustring filename;
ustring ies;
float strength;
float3 vector;
private:
LightManager *light_manager;
int slot;
void get_slot();
};
class MappingNode : public ShaderNode {
public:
SHADER_NODE_CLASS(MappingNode)

View File

@@ -480,7 +480,7 @@ void ObjectManager::device_update_object_transform(UpdateObjectTransformState *s
kobject.dupli_uv[1] = ob->dupli_uv[1];
int totalsteps = mesh->motion_steps;
kobject.numsteps = (totalsteps - 1)/2;
kobject.numverts = mesh->verts.size();;
kobject.numverts = mesh->verts.size();
kobject.patch_map_offset = 0;
kobject.attribute_map_offset = 0;

View File

@@ -99,7 +99,9 @@ void OSLShaderManager::device_update(Device *device, DeviceScene *dscene, Scene
* compile shaders alternating */
thread_scoped_lock lock(ss_mutex);
OSLCompiler compiler((void*)this, (void*)ss, scene->image_manager);
OSLCompiler compiler((void*)this, (void*)ss,
scene->image_manager,
scene->light_manager);
compiler.background = (shader == scene->default_background);
compiler.compile(scene, og, shader);
@@ -546,11 +548,14 @@ OSLNode *OSLShaderManager::osl_node(const std::string& filepath,
/* Graph Compiler */
OSLCompiler::OSLCompiler(void *manager_, void *shadingsys_, ImageManager *image_manager_)
OSLCompiler::OSLCompiler(void *manager_, void *shadingsys_,
ImageManager *image_manager_,
LightManager *light_manager_)
{
manager = manager_;
shadingsys = shadingsys_;
image_manager = image_manager_;
light_manager = light_manager_;
current_type = SHADER_TYPE_SURFACE;
current_shader = NULL;
background = false;

View File

@@ -120,7 +120,9 @@ protected:
class OSLCompiler {
public:
OSLCompiler(void *manager, void *shadingsys, ImageManager *image_manager);
OSLCompiler(void *manager, void *shadingsys,
ImageManager *image_manager,
LightManager *light_manager);
void compile(Scene *scene, OSLGlobals *og, Shader *shader);
void add(ShaderNode *node, const char *name, bool isfilepath = false);
@@ -146,6 +148,7 @@ public:
bool background;
ImageManager *image_manager;
LightManager *light_manager;
private:
#ifdef WITH_OSL

View File

@@ -76,7 +76,8 @@ DeviceScene::DeviceScene(Device *device)
svm_nodes(device, "__svm_nodes", MEM_TEXTURE),
shaders(device, "__shaders", MEM_TEXTURE),
lookup_table(device, "__lookup_table", MEM_TEXTURE),
sobol_directions(device, "__sobol_directions", MEM_TEXTURE)
sobol_directions(device, "__sobol_directions", MEM_TEXTURE),
ies_lights(device, "__ies", MEM_TEXTURE)
{
memset(&data, 0, sizeof(data));
}

View File

@@ -119,6 +119,9 @@ public:
/* integrator */
device_vector<uint> sobol_directions;
/* ies lights */
device_vector<float> ies_lights;
KernelData data;
DeviceScene(Device *device);

View File

@@ -58,7 +58,7 @@ void SVMShaderManager::device_update_shader(Scene *scene,
svm_nodes.push_back_slow(make_int4(NODE_SHADER_JUMP, 0, 0, 0));
SVMCompiler::Summary summary;
SVMCompiler compiler(scene->shader_manager, scene->image_manager);
SVMCompiler compiler(scene->shader_manager, scene->image_manager, scene->light_manager);
compiler.background = (shader == scene->default_background);
compiler.compile(scene, shader, svm_nodes, 0, &summary);
@@ -154,10 +154,13 @@ void SVMShaderManager::device_free(Device *device, DeviceScene *dscene, Scene *s
/* Graph Compiler */
SVMCompiler::SVMCompiler(ShaderManager *shader_manager_, ImageManager *image_manager_)
SVMCompiler::SVMCompiler(ShaderManager *shader_manager_,
ImageManager *image_manager_,
LightManager *light_manager_)
{
shader_manager = shader_manager_;
image_manager = image_manager_;
light_manager = light_manager_;
max_stack_use = 0;
current_type = SHADER_TYPE_SURFACE;
current_shader = NULL;

View File

@@ -95,7 +95,9 @@ public:
string full_report() const;
};
SVMCompiler(ShaderManager *shader_manager, ImageManager *image_manager);
SVMCompiler(ShaderManager *shader_manager,
ImageManager *image_manager,
LightManager *light_manager);
void compile(Scene *scene,
Shader *shader,
array<int4>& svm_nodes,
@@ -125,6 +127,7 @@ public:
ImageManager *image_manager;
ShaderManager *shader_manager;
LightManager *light_manager;
bool background;
protected:

View File

@@ -11,6 +11,7 @@ set(INC_SYS
set(SRC
util_aligned_malloc.cpp
util_debug.cpp
util_ies.cpp
util_logging.cpp
util_math_cdf.cpp
util_md5.cpp
@@ -45,6 +46,7 @@ set(SRC_HEADERS
util_guarded_allocator.h
util_half.h
util_hash.h
util_ies.h
util_image.h
util_image_impl.h
util_list.h

View File

@@ -0,0 +1,396 @@
/*
* Copyright 2011-2018 Blender Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "util/util_foreach.h"
#include "util/util_ies.h"
#include "util/util_math.h"
#include "util/util_string.h"
CCL_NAMESPACE_BEGIN
bool IESFile::load(ustring ies)
{
clear();
if(!parse(ies) || !process()) {
clear();
return false;
}
return true;
}
void IESFile::clear()
{
intensity.clear();
v_angles.clear();
h_angles.clear();
}
int IESFile::packed_size()
{
if(v_angles.size() && h_angles.size() > 0) {
return 2 + h_angles.size() + v_angles.size() + h_angles.size()*v_angles.size();
}
return 0;
}
void IESFile::pack(float *data)
{
if(v_angles.size() && h_angles.size()) {
*(data++) = __int_as_float(h_angles.size());
*(data++) = __int_as_float(v_angles.size());
memcpy(data, &h_angles[0], h_angles.size()*sizeof(float));
data += h_angles.size();
memcpy(data, &v_angles[0], v_angles.size()*sizeof(float));
data += v_angles.size();
for(int h = 0; h < intensity.size(); h++) {
memcpy(data, &intensity[h][0], v_angles.size()*sizeof(float));
data += v_angles.size();
}
}
}
class IESTextParser {
public:
vector<char> text;
char *data;
IESTextParser(ustring str)
: text(str.begin(), str.end())
{
std::replace(text.begin(), text.end(), ',', ' ');
data = strstr(&text[0], "\nTILT=");
}
bool eof() {
return (data == NULL) || (data[0] == '\0');
}
double get_double() {
if(eof()) {
return 0.0;
}
char *old_data = data;
double val = strtod(data, &data);
if(data == old_data) {
data = NULL;
return 0.0;
}
return val;
}
long get_long() {
if(eof()) {
return 0;
}
char *old_data = data;
long val = strtol(data, &data, 10);
if(data == old_data) {
data = NULL;
return 0;
}
return val;
}
};
bool IESFile::parse(ustring ies)
{
if(ies.empty()) {
return false;
}
IESTextParser parser(ies);
if(parser.eof()) {
return false;
}
/* Handle the tilt data block. */
if(strncmp(parser.data, "\nTILT=INCLUDE", 13) == 0) {
parser.data += 13;
parser.get_double(); /* Lamp to Luminaire geometry */
int num_tilt = parser.get_long(); /* Amount of tilt angles and factors */
/* Skip over angles and factors. */
for(int i = 0; i < 2*num_tilt; i++) {
parser.get_double();
}
}
else {
/* Skip to next line. */
parser.data = strstr(parser.data+1, "\n");
}
if(parser.eof()) {
return false;
}
parser.data++;
parser.get_long(); /* Number of lamps */
parser.get_double(); /* Lumens per lamp */
double factor = parser.get_double(); /* Candela multiplier */
int v_angles_num = parser.get_long(); /* Number of vertical angles */
int h_angles_num = parser.get_long(); /* Number of horizontal angles */
type = (IESType) parser.get_long(); /* Photometric type */
/* TODO(lukas): Test whether the current type B processing can also deal with type A files.
* In theory the only difference should be orientation which we ignore anyways, but with IES you never know...
*/
if(type != TYPE_B && type != TYPE_C) {
return false;
}
parser.get_long(); /* Unit of the geometry data */
parser.get_double(); /* Width */
parser.get_double(); /* Length */
parser.get_double(); /* Height */
factor *= parser.get_double(); /* Ballast factor */
factor *= parser.get_double(); /* Ballast-Lamp Photometric factor */
parser.get_double(); /* Input Watts */
/* Intensity values in IES files are specified in candela (lumen/sr), a photometric quantity.
* Cycles expects radiometric quantities, though, which requires a conversion.
* However, the Luminous efficacy (ratio of lumens per Watt) depends on the spectral distribution
* of the light source since lumens take human perception into account.
* Since this spectral distribution is not known from the IES file, a typical one must be assumed.
* The D65 standard illuminant has a Luminous efficacy of 177.83, which is used here to convert to Watt/sr.
* A more advanced approach would be to add a Blackbody Temperature input to the node and numerically
* integrate the Luminous efficacy from the resulting spectral distribution.
* Also, the Watt/sr value must be multiplied by 4*pi to get the Watt value that Cycles expects
* for lamp strength. Therefore, the conversion here uses 4*pi/177.83 as a Candela to Watt factor.
*/
factor *= 0.0706650768394;
v_angles.reserve(v_angles_num);
for(int i = 0; i < v_angles_num; i++) {
v_angles.push_back((float) parser.get_double());
}
h_angles.reserve(h_angles_num);
for(int i = 0; i < h_angles_num; i++) {
h_angles.push_back((float) parser.get_double());
}
intensity.resize(h_angles_num);
for(int i = 0; i < h_angles_num; i++) {
intensity[i].reserve(v_angles_num);
for(int j = 0; j < v_angles_num; j++) {
intensity[i].push_back((float) (factor * parser.get_double()));
}
}
return !parser.eof();
}
bool IESFile::process_type_b()
{
vector<vector<float> > newintensity;
newintensity.resize(v_angles.size());
for(int i = 0; i < v_angles.size(); i++) {
newintensity[i].reserve(h_angles.size());
for(int j = 0; j < h_angles.size(); j++) {
newintensity[i].push_back(intensity[j][i]);
}
}
intensity.swap(newintensity);
h_angles.swap(v_angles);
float h_first = h_angles[0], h_last = h_angles[h_angles.size()-1];
if(h_last != 90.0f) {
return false;
}
if(h_first == 0.0f) {
/* The range in the file corresponds to 90°-180°, we need to mirror that to get the
* full 180° range. */
vector<float> new_h_angles;
vector<vector<float> > new_intensity;
int hnum = h_angles.size();
new_h_angles.reserve(2*hnum-1);
new_intensity.reserve(2*hnum-1);
for(int i = hnum-1; i > 0; i--) {
new_h_angles.push_back(90.0f - h_angles[i]);
new_intensity.push_back(intensity[i]);
}
for(int i = 0; i < hnum; i++) {
new_h_angles.push_back(90.0f + h_angles[i]);
new_intensity.push_back(intensity[i]);
}
h_angles.swap(new_h_angles);
intensity.swap(new_intensity);
}
else if(h_first == -90.0f) {
/* We have full 180° coverage, so just shift to match the angle range convention. */
for(int i = 0; i < h_angles.size(); i++) {
h_angles[i] += 90.0f;
}
}
/* To get correct results with the cubic interpolation in the kernel, the horizontal range
* has to cover all 360°. Therefore, we copy the 0° entry to 360° to ensure full coverage
* and seamless interpolation. */
h_angles.push_back(360.0f);
intensity.push_back(intensity[0]);
float v_first = v_angles[0], v_last = v_angles[v_angles.size()-1];
if(v_last != 90.0f) {
return false;
}
if(v_first == 0.0f) {
/* The range in the file corresponds to 90°-180°, we need to mirror that to get the
* full 180° range. */
vector<float> new_v_angles;
int hnum = h_angles.size();
int vnum = v_angles.size();
new_v_angles.reserve(2*vnum-1);
for(int i = vnum-1; i > 0; i--) {
new_v_angles.push_back(90.0f - v_angles[i]);
}
for(int i = 0; i < vnum; i++) {
new_v_angles.push_back(90.0f + v_angles[i]);
}
for(int i = 0; i < hnum; i++) {
vector<float> new_intensity;
new_intensity.reserve(2*vnum-1);
for(int j = vnum-2; j >= 0; j--) {
new_intensity.push_back(intensity[i][j]);
}
new_intensity.insert(new_intensity.end(), intensity[i].begin(), intensity[i].end());
intensity[i].swap(new_intensity);
}
v_angles.swap(new_v_angles);
}
else if(v_first == -90.0f) {
/* We have full 180° coverage, so just shift to match the angle range convention. */
for(int i = 0; i < v_angles.size(); i++) {
v_angles[i] += 90.0f;
}
}
return true;
}
bool IESFile::process_type_c()
{
if(h_angles[0] == 90.0f) {
/* Some files are stored from 90° to 270°, so we just rotate them to the regular 0°-180° range here. */
for(int i = 0; i < v_angles.size(); i++) {
h_angles[i] -= 90.0f;
}
}
if(h_angles[0] != 0.0f) {
return false;
}
if(h_angles.size() == 1) {
h_angles.push_back(360.0f);
intensity.push_back(intensity[0]);
}
if(h_angles[h_angles.size()-1] == 90.0f) {
/* Only one quadrant is defined, so we need to mirror twice (from one to two, then to four).
* Since the two->four mirroring step might also be required if we get an input of two quadrants,
* we only do the first mirror here and later do the second mirror in either case. */
int hnum = h_angles.size();
for(int i = hnum-2; i >= 0; i--) {
h_angles.push_back(180.0f - h_angles[i]);
intensity.push_back(intensity[i]);
}
}
if(h_angles[h_angles.size()-1] == 180.0f) {
/* Mirror half to the full range. */
int hnum = h_angles.size();
for(int i = hnum-2; i >= 0; i--) {
h_angles.push_back(360.0f - h_angles[i]);
intensity.push_back(intensity[i]);
}
}
/* Some files skip the 360° entry (contrary to standard) because it's supposed to be identical to the 0° entry.
* If the file has a discernible order in its spacing, just fix this. */
if(h_angles[h_angles.size()-1] != 360.0f) {
int hnum = h_angles.size();
float last_step = h_angles[hnum-1]-h_angles[hnum-2];
float first_step = h_angles[1]-h_angles[0];
float difference = 360.0f - h_angles[hnum-1];
if(last_step == difference || first_step == difference) {
h_angles.push_back(360.0f);
intensity.push_back(intensity[0]);
}
else {
return false;
}
}
float v_first = v_angles[0], v_last = v_angles[v_angles.size()-1];
if(v_first == 90.0f) {
if(v_last == 180.0f) {
/* Flip to ensure that vertical angles always start at 0°. */
for(int i = 0; i < v_angles.size(); i++) {
v_angles[i] = 180.0f - v_angles[i];
}
}
else {
return false;
}
}
else if(v_first != 0.0f) {
return false;
}
return true;
}
bool IESFile::process()
{
if(h_angles.size() == 0 || v_angles.size() == 0) {
return false;
}
if(type == TYPE_B) {
if(!process_type_b()) {
return false;
}
}
else {
assert(type == TYPE_C);
if(!process_type_c()) {
return false;
}
}
assert(v_angles[0] == 0.0f);
assert(h_angles[0] == 0.0f);
assert(h_angles[h_angles.size()-1] == 360.0f);
/* Convert from deg to rad. */
for(int i = 0; i < v_angles.size(); i++) {
v_angles[i] *= M_PI_F / 180.f;
}
for(int i = 0; i < h_angles.size(); i++) {
h_angles[i] *= M_PI_F / 180.f;
}
return true;
}
IESFile::~IESFile()
{
clear();
}
CCL_NAMESPACE_END

View File

@@ -0,0 +1,61 @@
/*
* Copyright 2011-2018 Blender Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef __UTIL_IES_H__
#define __UTIL_IES_H__
#include "util/util_param.h"
#include "util/util_vector.h"
CCL_NAMESPACE_BEGIN
class IESFile {
public:
IESFile() {}
~IESFile();
int packed_size();
void pack(float *data);
bool load(ustring ies);
void clear();
protected:
bool parse(ustring ies);
bool process();
bool process_type_b();
bool process_type_c();
/* The brightness distribution is stored in spherical coordinates.
* The horizontal angles correspond to to theta in the regular notation
* and always span the full range from 0° to 360°.
* The vertical angles correspond to phi and always start at 0°. */
vector<float> v_angles, h_angles;
/* The actual values are stored here, with every entry storing the values
* of one horizontal segment. */
vector<vector<float> > intensity;
/* Types of angle representation in IES files. Currently, only B and C are supported. */
enum IESType {
TYPE_A = 3,
TYPE_B = 2,
TYPE_C = 1
} type;
};
CCL_NAMESPACE_END
#endif /* __UTIL_IES_H__ */

View File

@@ -310,6 +310,17 @@ ccl_device_inline float4 float3_to_float4(const float3 a)
return make_float4(a.x, a.y, a.z, 1.0f);
}
ccl_device_inline float inverse_lerp(float a, float b, float x)
{
return (x - a) / (b - a);
}
/* Cubic interpolation between b and c, a and d are the previous and next point. */
ccl_device_inline float cubic_interp(float a, float b, float c, float d, float x)
{
return 0.5f*(((d + 3.0f*(b-c) - a)*x + (2.0f*a - 5.0f*b + 4.0f*c - d))*x + (c - a))*x + b;
}
CCL_NAMESPACE_END
#include "util/util_math_int2.h"

View File

@@ -67,7 +67,7 @@ ccl_device_inline float len_squared(const float3 a);
ccl_device_inline float3 saturate3(float3 a);
ccl_device_inline float3 safe_normalize(const float3 a);
ccl_device_inline float3 normalize_len(const float3 a, float *t);;
ccl_device_inline float3 normalize_len(const float3 a, float *t);
ccl_device_inline float3 safe_normalize_len(const float3 a, float *t);
ccl_device_inline float3 interp(float3 a, float3 b, float t);

View File

@@ -186,12 +186,17 @@ ccl_device_forceinline bool ray_triangle_intersect(
#undef dot3
}
/* Tests for an intersection between a ray and a quad defined by
* its midpoint, normal and sides.
* If ellipse is true, hits outside the ellipse that's enclosed by the
* quad are rejected.
*/
ccl_device bool ray_quad_intersect(float3 ray_P, float3 ray_D,
float ray_mint, float ray_maxt,
float3 quad_P,
float3 quad_u, float3 quad_v, float3 quad_n,
float3 *isect_P, float *isect_t,
float *isect_u, float *isect_v)
float *isect_u, float *isect_v, bool ellipse)
{
/* Perform intersection test. */
float t = -(dot(ray_P, quad_n) - dot(quad_P, quad_n)) / dot(ray_D, quad_n);
@@ -200,20 +205,23 @@ ccl_device bool ray_quad_intersect(float3 ray_P, float3 ray_D,
}
const float3 hit = ray_P + t*ray_D;
const float3 inplane = hit - quad_P;
const float u = dot(inplane, quad_u) / dot(quad_u, quad_u) + 0.5f;
if(u < 0.0f || u > 1.0f) {
const float u = dot(inplane, quad_u) / dot(quad_u, quad_u);
if(u < -0.5f || u > 0.5f) {
return false;
}
const float v = dot(inplane, quad_v) / dot(quad_v, quad_v) + 0.5f;
if(v < 0.0f || v > 1.0f) {
const float v = dot(inplane, quad_v) / dot(quad_v, quad_v);
if(v < -0.5f || v > 0.5f) {
return false;
}
if(ellipse && (u*u + v*v > 0.25f)) {
return false;
}
/* Store the result. */
/* TODO(sergey): Check whether we can avoid some checks here. */
if(isect_P != NULL) *isect_P = hit;
if(isect_t != NULL) *isect_t = t;
if(isect_u != NULL) *isect_u = u;
if(isect_v != NULL) *isect_v = v;
if(isect_u != NULL) *isect_u = u + 0.5f;
if(isect_v != NULL) *isect_v = v + 0.5f;
return true;
}

View File

@@ -144,6 +144,18 @@ ccl_device_inline void math_trimatrix_add_gramian_strided(ccl_global float *A,
}
}
ccl_device_inline void math_trimatrix_add_gramian(ccl_global float *A,
int n,
const float *ccl_restrict v,
float weight)
{
for(int row = 0; row < n; row++) {
for(int col = 0; col <= row; col++) {
MATHS(A, row, col, 1) += v[row]*v[col]*weight;
}
}
}
/* Transpose matrix A inplace. */
ccl_device_inline void math_matrix_transpose(ccl_global float *A, int n, int stride)
{

Some files were not shown because too many files have changed in this diff Show More