1
1

Compare commits

...

748 Commits

Author SHA1 Message Date
bf4b31468e Merge branch 'geometry-nodes' into geometry-nodes-transform-node 2020-10-24 12:42:24 -05:00
f5de32562e Cleanup: Remove unused variable 2020-10-24 12:42:04 -05:00
bc4e31afb6 Merge branch 'master' into geometry-nodes 2020-10-24 14:38:00 +02:00
594f47ecd2 Cleanup: Return early in some curve functions
This commit uses continue in loops and returning early to reduce
indentation in long functions, only where this results in a significant
improvement. Also includes a few LISTBASE_FOREACH macros.
2020-10-23 23:29:52 -05:00
f32ab724eb Fix for T80679: Incorrect Translation of File Manager System List
Changing language could sometimes leave File Browser System list showing incorrect text until restart.

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

Reviewed by Brecht Van Lommel
2020-10-23 19:07:14 -07:00
065dfdc529 Geometry Nodes: Add transform geometry node 2020-10-23 15:25:38 -05:00
3c42892610 GPencil: Minor changes in parameter order
This is related to D9330
2020-10-23 19:44:38 +02:00
69a22afdb6 GPencil: Remove unneeded python for calling Bake Animation
The operator was using a secondary python operator to ask parameters before running, but this can be done in invoke.

Differential Revision: https://developer.blender.org/D9330
2020-10-23 19:39:55 +02:00
390b28e338 Merge branch 'blender-v2.91-release' 2020-10-23 18:37:22 +02:00
6d8e03ddd9 Fix T81102: Cycles crashes in interactive 3D viewport rendering after Embree
Don't allocate a new buffer for refitting meshes, but update the existing one.
It's not clear from the API docs if this is required, but it appears to solve
the issue and should be more efficient.
2020-10-23 18:32:22 +02:00
83ddd658a6 Fix T81890: Active keyframe changes on deselect of keyframe
Activate an FCurve only on selecting, and not on deselecting a keyframe
or a handle.

Reviewed By: HooglyBoogly, Severin, looch, #animation_rigging

Differential Revision: https://developer.blender.org/D9328
2020-10-23 17:47:54 +02:00
Olivier Maury
559e87ad08 Fix T81976: Cycles crash after recent geometry sync multithreading change
Avoid accessing mesh emitter and hair at the same time. This is not ideal for
performance, but once we have a dedicated hair object this will resolve itself.

Differential Revision: https://developer.blender.org/D9322
2020-10-23 17:45:11 +02:00
0d1b1c341f Fix: Animation, Draw active keyframe handles only when Bézier
Draw the handles for the active keyframe only when the interpolation type
is set to Bézier. This now matches the behaviour of handles of regular
(non-active) keyframes.
2020-10-23 16:46:19 +02:00
87681f9b5f Cleanup: remove redundant assignment in previous bugfix 2020-10-23 16:32:29 +02:00
50c475e534 Multires: Cleanup, better function naming
Hopefully it makes it more clear, and also allows to introduce
initialization from pre-created Subdiv descriptor.
2020-10-23 16:30:13 +02:00
8186b96753 Fix use of uninitialized line/polygon smooth variables in GPU state
Found by valgrind, unclear if this caused an actual bug.
2020-10-23 15:27:47 +02:00
9d7672be71 Merge branch 'master' into geometry-nodes 2020-10-23 15:18:20 +02:00
994e7178bb Geometry Nodes: make some function nodes available
We might not want to have all those nodes in a final version.
Some of them have been added with particle nodes in mind.
However, to test the evaluation system it is useful to have a
couple of nodes available.

Those nodes should "just" work, because their implementation
is reused from the particle nodes project.
2020-10-23 15:13:19 +02:00
1719743066 Geometry Nodes: improve node group evaluation
This adds support for nodes that have a multi-function implementation.
That includes various function nodes like Math, Combine Vector, ...

Furthermore, there is support for implicit conversions now. So it should
work when one connects e.g. a float to an integer and vice versa.
2020-10-23 15:09:55 +02:00
8910033f57 Nodes: add utility methods 2020-10-23 15:05:01 +02:00
2a4c6c612a Functions: add utility method 2020-10-23 15:01:07 +02:00
e4728d0a16 Fluid: Possible fix for T79799
This issue is specific to Windows and should be resolved with the extra checks (untested).
2020-10-23 13:34:02 +02:00
56a3566e64 Merge branch 'blender-v2.91-release' 2020-10-23 09:53:50 +02:00
9441c640c8 Fix T81934: Painting/Sculpting in ortho fails to let strokes pass through clipped geometry
Caused by rB7878adf49cff.

When getting the stroke location via raycast in ortho view, the above
commit flipped the condition of the check to perform adjustments on the
rays start/end. This would thus happen (even though it shouldnt),
resulting in wrong depth and stroke location.

Now just flip the condition back, so adjustments only happen when
clipping is OFF.

Maniphest Tasks: T81934

Differential Revision: https://developer.blender.org/D9318
2020-10-23 09:44:38 +02:00
af661ad75b RNA Manual Map: Update mappings for latest manual 2020-10-23 00:48:24 -04:00
b062b922f9 Geometry Nodes: Resolve some missing 3D viewport updates
These two functions "snode_notify" and "ED_node_tag_update_id" appear to
be mostly duplicates. However, there is already a case for each type of
built-in node tree, so it makes sense to add one for the geometry node
tree as well. This doesn't solve the update issues for changing number
in buttons, that must be handled somewhere else.
2020-10-22 22:59:40 -05:00
0b4991f5a7 Fix unreported: unmatching shortcut between gp modes
GPencil: Change Interpolate shortcut to Ctrl+E

Before the shortcut was Ctrl+Alt+E, but it's more logic remove the Alt.

This was missed in rBee49ce482a797a5937829de497abd69bcd1edb48
2020-10-22 23:15:46 -04:00
895f4620a0 Merge branch 'master' into geometry-nodes 2020-10-22 22:03:28 -05:00
06e6068902 Merge branch 'blender-v2.91-release' 2020-10-23 14:00:28 +11:00
67c7fe6ad6 Fix T80165: Separate by loose parts breaks custom normals
- Add NULL check for BKE_lnor_spacearr_clear
- Remove unnecessary 'use_toolflags' with BMesh creation.
2020-10-23 13:56:55 +11:00
3f12f02bea Merge branch 'blender-v2.91-release' 2020-10-22 22:32:09 -04:00
14a4961490 Fix unreported: unmatching shortcut between gp modes
GPencil: Change Interpolate shortcut to Ctrl+E

Before the shortcut was Ctrl+Alt+E, but it's more logic remove the Alt.

This was missed in rBee49ce482a797a5937829de497abd69bcd1edb48
2020-10-22 22:31:20 -04:00
36e8561298 Fix T81969 VSE: Wrong UI colorspace after scene strip update
This regression was caused by rB57de5686048f which disabled srgb
transform after the python callback.

The right thing to do is to only rebind the framebuffer once to
reset the no-srgb override.
2020-10-23 03:32:51 +02:00
3cc2dc40b3 Fix T81942 EEVEE: Reflection Plane glitch with low clip distances
This was happening because the raytrace was not even being performed
due to the tracing line being too small after frustum clipping.
2020-10-23 02:02:41 +02:00
e58285dc1d Fix T73793 Walk navigation crosshair gets hidden behind objects
This was reintroduced by the wide line emulation workaround.
2020-10-23 02:02:41 +02:00
c6281d5dc7 Cleanup: Use DNA deprecated guards around old flags
These flags shouldn't be used except in versioning code.
2020-10-22 18:37:52 -05:00
165b4f85ec Merge branch 'blender-v2.91-release' 2020-10-22 18:14:14 -05:00
8e060b44da Fix T81818: Outliner mode column crashes with shared object data
For objects with shared data, it makes sense to show the mode icon for
every object sharing the same data if one of them is in edit mode.

This also disables the "extend" functionality in this case, because
being in edit mode for multiple objects with the same data isn't
supported.

Differential Revision: https://developer.blender.org/D9273
2020-10-22 18:13:30 -05:00
ff8ecf105c Merge branch 'blender-v2.91-release' 2020-10-22 17:34:48 -04:00
Aaron Carlisle
baa24f1c91 Pydoc: Fix sphinx compile warnings about freestyle
Sphinx expects functions and methods with the same name and different
parameters to be written using one directive. See:
https://www.sphinx-doc.org/en/master/usage/restructuredtext/domains.html#basic-markup

Unfortunately this makes giving different descriptions for each harder.
This was already a request for better support for this in sphinx, see:
https://github.com/sphinx-doc/sphinx/issues/7787

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D9170
2020-10-22 17:22:05 -04:00
a3f5154448 Cleanup: make format 2020-10-22 17:08:37 -04:00
956af16189 Fix Unreported: Missing box mask in sculpt
There was a weird bug in the API where a value of 0 gave a mask value of 
1. I am not sure why this is but the current code works as desirable.

This was missed in rB6faa765af8954948de3cec75a2261a5aa139b4e5
2020-10-22 16:57:56 -04:00
9b46d3cc80 Merge branch 'blender-v2.91-release' 2020-10-22 16:52:28 -04:00
2261da2897 Fix Unreported: Missing box mask in sculpt
There was a weird bug in the API where a value of 0 gave a mask value of 
1. I am not sure why this is but the current code works as desirable.

This was missed in rB6faa765af8954948de3cec75a2261a5aa139b4e5
2020-10-22 16:51:07 -04:00
7863ded680 Merge branch 'blender-v2.91-release' 2020-10-22 15:47:03 -05:00
3d916c0a96 Cleanup: Simplify outliner mode column drawing function
Move the checks for whether to draw the button to the beginning of the
function and return early. Also use a shorthand variable for ob_active.

Committing to 2.91 as a patch for an upcoming bug fix depends on these
changes.

Differential Revision: https://developer.blender.org/D9272
2020-10-22 15:46:35 -05:00
fafed6234b Geometry Nodes: Add edge split node functionality 2020-10-22 13:48:56 -05:00
d453bbbd26 Merge branch 'blender-v2.91-release' 2020-10-22 20:02:09 +02:00
8432452f6f GPencil: Fix unreported crash using layer solo mode and masked layers
The solo mode was skipping the layer creation data and the loop of masks expect to have all layers in the array or the loop crash.

The solution is just create the layer array data for the layer, but don't draw any stroke.
2020-10-22 20:01:39 +02:00
3953833b60 Fix T81967: Crash when using extrude on a text object
Caused by rBa308607a5334, which mistakenly removed these lines.
2020-10-22 12:20:34 -05:00
Pablo Dobarro
383c20a6ab Sculpt: Grab silhouette option
This adds a property to the grab that masks vertices based on its
original normal and grab delta. When used on thin meshes, it allows to
grab the silhouette from one side of the object without affecting the
shape of the other side.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9205
2020-10-22 19:17:07 +02:00
7ff8094a8b Geometry Nodes: expose minimum vertices input of Triangulate node 2020-10-22 18:24:05 +02:00
5aabf67a9c Fix error in previous commit
That should not have happened -.-
2020-10-22 18:23:39 +02:00
b5169cd230 Fix T81932: Dyntopo crashing with sculpt vertex colors brush tools
Paint and smear tools are only implemented for regular mesh PBVH,
meaning they are not supported by the dynamic topology and multires
sculpting.

These tools are to be ignored for an unsupported sculpt modes, regardless
of state of user preferences.

Reviewed By: sergey

Maniphest Tasks: T81932

Differential Revision: https://developer.blender.org/D9308
2020-10-22 18:22:15 +02:00
ab8c7fe946 Fix previous comment 2020-10-22 18:20:17 +02:00
a05012d500 Geometry Nodes: simplify and deduplicate callbacks on sockets
This adds a layer of abstraction between the code calling callbacks
on sockets and the implementation of those callbacks.
This abstraction layer allows some sockets to not implement all
callbacks when those can be derived from some other callback.
2020-10-22 18:08:27 +02:00
e79154de73 Fix build error Python module build and Embree on macOS
Setting the stack size only works for executables, for shared libraries
the host application controls it.
2020-10-22 18:03:18 +02:00
2985a745bb GPencil: Add new parameter to set caps in Cutter
The new parameter allows to define if after cutting the stroke the cap of the cut side will be set as flat. 

Before, the cap shape of the cut side always was equal to the original stroke, and in some situations, the rounded cap was visible.

Note: If the angle of the join is very extreme,  it's still possible to view some sections of the cut stroke.,
2020-10-22 17:44:17 +02:00
90eab4a25d Merge branch 'blender-v2.91-release' 2020-10-22 10:25:44 -05:00
6180ecaea5 Fix T81909: Translation missing for some labels in modifier panels
Every label string in uiItem* calls needs an IFACE_ call.
2020-10-22 10:25:08 -05:00
a8837c6cb0 Merge branch 'blender-v2.91-release' 2020-10-22 17:05:47 +02:00
5b35f1ed2b GPencil: Fix unreported mistake in material index for trace imagens
The material index was not used and only worked with new objects.
2020-10-22 17:05:10 +02:00
cd7354f9f5 Merge branch 'blender-v2.91-release' 2020-10-22 17:02:59 +02:00
73ba3e2a9e Sculpt: Remove tools with missing icons experimental option
All tools planned for 2.91 now have icons, so this option can be
removed.

Reviewed By: dfelinto, Severin

Differential Revision: https://developer.blender.org/D9299
2020-10-22 17:01:16 +02:00
97a93566e9 Geometry Nodes: change "Node Tree" to "Node Group" 2020-10-22 15:52:15 +02:00
f73dad211b Potential fix for T81963: Random crashes in liboverride code.
From the backtrace it looks like in some cases file save (which triggers
a general override updates) is done before other code has a chance to
re-generate pose data, leading to rna accessing freed memory.

I was never able to reproduce that here, so this is a tentative fix in
master, if it proves to be working for the studio it will be
cherry-picked into 2.91 release branch later.
2020-10-22 15:22:56 +02:00
992a88b38b Pose: Add a 'pose_ensure' new utils that only rebuilds if needed.
Avoids having to spread the check logic everywhere in the code.
2020-10-22 15:22:56 +02:00
658370e9e1 Merge branch 'blender-v2.91-release' 2020-10-22 15:12:30 +02:00
c9550cb120 Fix T81953: Python error in UV Editor Overlay popup
Leftover from rBe05ce1ea2029, 'use_image_editor_legacy_drawing' was
removed.

Maniphest Tasks: T81953

Differential Revision: https://developer.blender.org/D9310
2020-10-22 15:09:32 +02:00
da4d697772 Geometry Nodes: initial support for evaluating geometry node groups
This is still very basic and does quite a few unnecessary computations.
Also the error handling is quite weak currently, so when invalid things are
connected, it will probably just crash.

Also the interface that individual nodes have to implement will have to change,
but the current solution is a good starting point.

Only the triangulate node is implemented for now.
2020-10-22 15:05:41 +02:00
87218899be Geometry Nodes: add an initial geometry class 2020-10-22 15:02:27 +02:00
ffa0a6df9d Functions: add generic pointer class
This class represents a pointer whose type is only known at runtime.
2020-10-22 15:01:31 +02:00
706fa5ad76 Functions: add move operations to CPPType 2020-10-22 15:00:07 +02:00
dea3b8d984 Multires: Remove legacy subdivision code
Is no longer used, fully replaced with more powerful algorithm.
2020-10-22 12:41:18 +02:00
107199426c Multires: Cleanup, unused code 2020-10-22 12:28:31 +02:00
d11e357824 Multires: Remove legacy compatibility code
It was rather a huge chunk of code, which started to become
more harder to maintain with the transition to OpenSubdiv based
implementation. Because of this transition, the compatibility was
also rather on a poor side.

Remove compatibility support for pre-2.50.9 multires.

Ref T77107

Reviewed By: brecht, mont29

Differential Revision: https://developer.blender.org/D9238
2020-10-22 12:15:57 +02:00
f68c3d557a Compositor: Ensure keying node result is pre-multiplied
Historically the result of the keying node was violating alpha
pre-multiplication rules in Blender: it was simply overriding
the alpha channel of input.

This change makes it so keying node mixes alpha into the input,
which solves the following issues:

- The result is properly pre-multiplied, no need in separate
  alpha-convert node anymore.

- Allows to more easily stack keying nodes.
  This usecase was never really investigated, but since previously
  alpha is always overwritten it was never possible to easily stack
  nodes. Now it is at something to be tried.

Unfortunately, this breaks compatibility with existing files, where
alpha-convert node is to be manually removed.

From implementation side this is done as a dedicated operation since
there was no ready-to-use operation. Maybe in the future it might
be replaced with some sort of vector math node.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D9211
2020-10-22 11:57:01 +02:00
92571abf56 GPU: Memory leak when scaling buffers
`imb_gpu_get_data` could reuse `data_rect` when it was already in used (double alloc).
making the first use leak. This was detected after enabling OpenGL Texture
Limit.

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D9280
2020-10-22 10:30:04 +02:00
6c178bf439 Merge branch 'blender-v2.91-release' 2020-10-22 18:48:00 +11:00
cf8642d9fa Fix T81949: Child Of Constraint can't assign inverse matrix
Caused by ad70d4b095, assigning the matrix now
clears the flag that would reset it.
2020-10-22 18:46:31 +11:00
36653a92fa Cleanup: centralize BLF default functions in the header 2020-10-22 17:30:52 +11:00
cf5ae6718c Cleanup: split BLF default into own file
This avoids accidents using user-preferences in the main BLF API,
which could cause preferences to be used unintentionally
(such as stamping into renders or creating generated images).

As well as uses of BLF when preferences aren't loaded
such as animation playback.
2020-10-22 17:24:19 +11:00
fe963b5a41 Merge branch 'blender-v2.91-release' 2020-10-22 17:13:04 +11:00
9ea345d1cf Fix animation player initialization
Updates from 9d30fade3e weren't applied to the animation player
causing an assert and missing call to IMB_init.
2020-10-22 17:07:56 +11:00
d00b1f6313 Merge branch 'blender-v2.91-release' 2020-10-22 16:00:52 +11:00
0c36255c48 Merge branch 'blender-v2.91-release' 2020-10-22 16:00:48 +11:00
ef969fb85f Cleanup: remove '_' prefix from used argument 2020-10-22 15:58:25 +11:00
7ddc49ad34 Fix T81905: Active keyframe unavailable when handle selected
Selecting an F-Curve handle caused an assertion as well as treating
the key-frame as inactive.

Allow active the keyframe to be active when it's handle is selected,
as is done with bezier curves.
2020-10-22 15:55:30 +11:00
a308607a53 Cleanup: Use LISTBASE_FOREACH macro in curve code
These changes should result in more readable and undestandable code,
especially where while loops were use instead of for loops. They are
not comprehensive, and I skipped wherever the change was not obvious.
2020-10-21 23:52:29 -05:00
6ebb2e5e2b Merge branch 'blender-v2.91-release' 2020-10-22 15:28:27 +11:00
c53ac5e1c4 Fix T81939: crash calling bmesh.utils.vert_separate()
Missing NULL check in bmesh_kernel_vert_separate.
2020-10-22 15:26:22 +11:00
608243c79c Merge branch 'blender-v2.91-release' 2020-10-22 14:08:07 +11:00
c70650785b Fix out of bounds array access in mathutils.noise
Regression in 0b2d1badec.
2020-10-22 14:03:00 +11:00
f5080c82dd Keymap: disable 'repeat' by default for keymap items
In practice, there are only a limited number of operations we need to
use repeat such as navigation, stepping operations that cycle states
and text input.

Now we don't need to disable repeat explicitly when a modal operator
uses checks for a key being held as was needed for 17cb2a6da0.

Repeat is now included in exported keymaps.

Use versioning so existing exported keymaps are loaded properly.
2020-10-22 12:29:45 +11:00
358a584985 Keymap: add support for versioning keymaps
Write the Blender version into the keymap
so we can change defaults without breaking existing keymaps.

Based on patch by @erik85 with own additions.
2020-10-22 12:29:42 +11:00
b9c8eb3b0c PyAPI: expose the file version via bpy.app.version_file
This exposes the version saved to the file,
compatible with `bpy.data.version`.

This is needed to write out version information into key-maps.
2020-10-22 12:29:38 +11:00
e9ae8148ae Merge branch 'blender-v2.91-release' 2020-10-22 12:03:53 +11:00
899d6d4db9 Merge branch 'blender-v2.91-release' 2020-10-22 12:03:50 +11:00
37df2ebaa9 Merge branch 'blender-v2.91-release' 2020-10-22 12:03:46 +11:00
cee35b2ca5 Merge branch 'blender-v2.91-release' 2020-10-22 12:03:41 +11:00
d6a43abc3a Merge branch 'blender-v2.91-release' 2020-10-22 12:03:36 +11:00
b632c1e90d Merge branch 'blender-v2.91-release' 2020-10-22 12:03:33 +11:00
ca87f4c45d Merge branch 'blender-v2.91-release' 2020-10-22 12:03:29 +11:00
8da5599003 WM: warn when event's have repeat set for non keyboard events
Also add docs to event and keymap item flag.
2020-10-22 11:59:37 +11:00
88660d67a4 WM: ensure is_repeat isn't set for mouse-move events
Follow up to d782bad62d

Also clear this for simulated events.
2020-10-22 11:59:37 +11:00
cc3fdffbbe DRW: Fix custom engine not being BGL safe
This was caused by unprotected drawing callbacks.
As of 2.91, we require that all python callbacks used for
drawing needs to be safeguarded by `GPU_bgl_end()` to end the
state tracking override.
2020-10-22 01:19:10 +02:00
5a65305f89 Fix T81784 BGL: Gizmo glitch when using glEnable/glDisable
This was caused by unprotected drawing callbacks.
From 2.91, we now require that all python callbacks used for
drawing needs to be safeguarded by `GPU_bgl_end()` to end the
state tracking override.
2020-10-22 01:10:46 +02:00
b0f34eee30 EEVEE: Principle BSDF: Use multi-scatter switch for the glass variant
This avoid strange discrepency between the general purpose variant and
the specialized glass variant which did not have a way to turn
multi-scatter off.
2020-10-22 00:57:29 +02:00
091b433677 Fix T77658 EEVEE: Reflection Plane partially missing reflections
The degenerate line workaround was ill defined.
2020-10-22 00:57:29 +02:00
Robert Guetzkow
e1eaf9e2b4 Fix T81925: incorrectly skipped string copy in test_env_path
Regression in 6f3a9031f7

Ref D9306
2020-10-22 09:54:35 +11:00
Robert Guetzkow
ef5d6e9c45 Fix T81925: incorrectly skipped string copy in test_env_path
Regression in 6f3a9031f7
2020-10-22 09:51:51 +11:00
b7f6de490d Geometry Nodes: Add initial node definition for edge split
This is just based on rBa7dba81aab22, and contains no funcionality at all.
2020-10-21 16:11:09 -05:00
8a22b76988 Merge branch 'blender-v2.91-release' into master 2020-10-21 22:57:15 +02:00
27137c479c EEVEE: Screen Space Reflection: Improve contact reflections
This patch helps the case of intricate reflections where the
ray does not travel far before intersecting the geometry.

In these cases there could be false negative exclusion of the ray
caused by the backface rejection threshold.
2020-10-21 22:56:06 +02:00
0cbe6387e9 EEVEE: Screen Space Raytrace: Fix unreported banding artifacts
The artifact manifested as lines of different values caused by faillure to
trace the depth buffer correctly.

Adding a ad-hoc value to the step size to mitigate the issue.
2020-10-21 22:55:56 +02:00
d7e3b3aed0 Merge branch 'blender-v2.91-release' 2020-10-21 21:21:32 +02:00
23ec1f90e7 Fix T81896: Outliner missing redraw after "Set Parent (Without Inverse)"
Outliners listener (outliner_main_region_listener) needs ND_PARENT
notifier to redraw, the parenting operator only spawned ND_TRANSFORM
(which doesnt do a redraw).

Maniphest Tasks: T81896

Differential Revision: https://developer.blender.org/D9295
2020-10-21 21:15:32 +02:00
0b3cb54887 Merge branch 'blender-v2.91-release' 2020-10-21 21:05:53 +02:00
9daf668991 Fix T81926: Sculpt: Box Mask operator (from menu and shortcut) does
nothing

Caused by rB6faa765af895.

Since above commit, we have to use paint.mask_box_gesture instead now.

Maniphest Tasks: T81926

Differential Revision: https://developer.blender.org/D9300
2020-10-21 20:51:54 +02:00
0da8eb7bd0 Merge branch 'blender-v2.91-release' 2020-10-21 20:43:01 +02:00
d2f52dccd3 Fix T81929: Sculpt: Mask operators missing drawing update on meshes with
shapekeys/modifiers

This was failing for all mask filters (sharpen, grow, invert, clear,
shrink, contrast, smooth) and mask gestures (box, lasso).
Also have to recalc shading, use SCULPT_tag_update_overlays for this.

ref D8956

Maniphest Tasks: T81929

Differential Revision: https://developer.blender.org/D9302
2020-10-21 20:37:18 +02:00
e296d58cf2 GPencil: Subdivide Cyclic section of strokes in modifier
When use subdivision modifier, the close section of the stroke must be subdivided too.
2020-10-21 19:24:12 +02:00
657e344351 GPencil: Bake mesh animation for selected keyframes only
This new option allows to bake the animation of the selected frames and not the full range of keyframes.
2020-10-21 19:15:26 +02:00
Jagannadhan Ravi
bb49aa0d69 Cycles: multithreaded export of geometry
This improves performance in scene synchronization when there are many
mesh, hair and volume objects. Sync time speedups in benchmarks:

barbershop   5.2x
bmw          1.3x
fishycat     1.5x
koro         1.0x
sponza       3.0x
victor       1.4x
wdas_cloud   0.9x

Implementation by Nicolas Lelong, and Jagannadhan Ravi (AMD).

Differential Revision: https://developer.blender.org/D9258
2020-10-21 18:54:12 +02:00
b5803c0a24 Revert "2.91 splashscreen"
In master Blender still uses the dev fund splashscreen
This reverts commit 1b577d0d6d.
2020-10-21 18:18:12 +02:00
7ff6bfd1e0 UI: Allow changing the active side of line gestures
Line gesture use always the right side of the line as active (the area
of the mesh that is going to be modified) by default.
This adds the ability to change the active side when the line gesture is
active by pressing the F key.
This allows more freedom to position the line after starting the
gestures, as it won't be required to cancel the operation or undo if the
line was used in the wrong direction.

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D9301
2020-10-21 18:17:36 +02:00
ce76f2db94 Merge branch 'blender-v2.91-release' 2020-10-21 18:16:46 +02:00
1b577d0d6d 2.91 splashscreen
To bring more attention for beta we now change the splashscreen during
bcon3.

Credit: Robin Tran - artstation.com/robin_tran
2020-10-21 18:14:26 +02:00
b6e0661e9e Merge branch 'blender-v2.91-release' 2020-10-21 18:12:50 +02:00
fd96b29dcc Bump subversion to 2.91.9 for bcon3 BETA 2020-10-21 18:11:30 +02:00
f2d454c829 Bump version to 2.92 alpha 2020-10-21 18:09:44 +02:00
9216b8d6cb UI: Allow changing the active side of line gestures
Line gesture use always the right side of the line as active (the area
of the mesh that is going to be modified) by default.
This adds the ability to change the active side when the line gesture is
active by pressing the F key.
This allows more freedom to position the line after starting the
gestures, as it won't be required to cancel the operation or undo if the
line was used in the wrong direction.

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D9301
2020-10-21 17:55:17 +02:00
15cebd8565 Fix T81901: Use the 2.90 scrape brush preset as default
The new preset I made for 2.91 is way more controllable with lower
strength values and does not have the accumulate bug, but until the
brush management is in place to ship multiple versions of the brush,
probably most people expect something closer to the old version to be
the default.

Reviewed By: sergey

Maniphest Tasks: T81901

Differential Revision: https://developer.blender.org/D9289
2020-10-21 17:51:23 +02:00
3601cdd27b UI: Swap order of increment and decrement file name icon in File Browser
Swaps the order of the '+' and '-' button in the File Browser file name field,
so that '-' comes first.

For increasing or decreasing a value it makes more sense to have decreasing
first, increasing last. Consistent to how you press on the left side of a
number button for decrease, and right to increase.

However this is inconsistent in another way: Usually we have a '+' button
before a '-' button, but that refers to adding and removing items, not
increasing or decreasing. The icons are also placed in their own buttons then,
making them look more separate.
So the UI Team agreed on accepting that trade-off, see today's meeting notes:
https://devtalk.blender.org/t/2020-10-21-ui-team-upcoming/15849
2020-10-21 17:34:53 +02:00
876f78cbbb UI: Better center-align Properties search button in header
For some reason the layout code doesn't center the search button properly. Add
a blank icon button to add some padding, dynamically resized as the region size
changes. This is quite finicky and not at all perfect. But it makes the search
button look far less off-place.
2020-10-21 17:25:37 +02:00
187cc5e26d UI: Move Properties path pin button next to the data-path
The pin button should be next to the data-path, which is what it belongs to.

Note that this makes the placement of the search button in the header look
quite off. That is because it's centered to the absolute header width, not the
width of the main region (which is smaller because of the tab region on the
left).
Technically it's correct that way, visually it looks wrong. This will be
addressed in a followup commit.
2020-10-21 17:25:37 +02:00
dd82a0d623 GPencil: Fix unreported problem with strokes bounding box that makes impossible sculpt
When the stroke was not flat, the bounding box projected could not be right and the strokes could not be painted or sculpted.

Now, the 2D bounding box is calculated using the extremes of the 2D bounding box and not the original 3D min and max values.
2020-10-21 17:23:55 +02:00
62528677bf Fix 'Make Local' operation to support liboverrides.
One can now use 'make local' from the Outliner or the 3DView to also
fully localize overrides of linked data.
2020-10-21 16:59:11 +02:00
959a06b8ff UI: Fix typo in sculpt trim tool description 2020-10-21 09:54:22 -05:00
7e485b4620 Merge branch 'master' into geometry-nodes 2020-10-21 08:54:39 -05:00
47a84bb338 Fix (studio-reported) Armature: bug in handling of custom bone transform.
This specific pose channel pointer was not handled at all during
rebuilding of poses, meaning that it could end up pointing at some freed
pchan.
2020-10-21 15:52:41 +02:00
ba718c1513 Cleanup: Improve function and variable name
"pt" is unecessarily cryptic, and the funciton name wasn't very clear.
2020-10-21 08:38:26 -05:00
810f5b82ce GPencil: Sculpt 'Inverse Cursor Color' Label to "Inverse Color"
This changes is related to commit c0a0789af5
2020-10-21 15:28:09 +02:00
35e50c170c Fix panel type use after free when reloading scripts
In order to prevent the panel code from using the type after it is freed,
the field needs to be set to NULL. This needs to be done recursively
for subpanels as well as top-level panels.
2020-10-21 08:25:46 -05:00
d782bad62d WM: ensure is_repeat isn't copied from the last event
This means if a keymap item is set to ignore repeat events,
it may do so accidentally from this setting being copied.
2020-10-21 23:35:46 +11:00
b4017ccb64 Cleanup: keep comment block at bottom of versioning
The intention of this block is to have all logic that will
be wrapped in a version check next subversion bump.
2020-10-21 23:33:50 +11:00
a7dba81aab Nodes: add initial UI for Triangulate node 2020-10-21 14:14:09 +02:00
4606e83a75 Merge branch 'master' into geometry-nodes 2020-10-21 14:00:32 +02:00
8738a668d8 Preferences: separate feature flags for geometry nodes and point cloud type
Those two features are not directly related and one might be activated
in master earlier than the other.

WITH_PARTICLE_NODES was removed, because we continue the project
under the name "Geometry Nodes".
2020-10-21 13:47:50 +02:00
1d28de57a4 Nodes: improve dependency between modifier and node group 2020-10-21 13:16:19 +02:00
3cfcfb938d Nodes: support creating geometry node groups 2020-10-21 12:32:02 +02:00
bcdc6910a0 Nodes: show header in geometry node editor 2020-10-21 12:16:57 +02:00
7793e8c884 Modifiers: add node_tree to NodesModifierData 2020-10-21 12:13:13 +02:00
05d9bd7c4a Modifiers: rename Simulation to Nodes modifier 2020-10-21 12:03:06 +02:00
9255ce9247 Nodes: rename Simulation to Geometry node tree 2020-10-21 11:39:42 +02:00
819b1a7f9d Cleanup: Move scenes' foreach_id handling of toolsettings into own func. 2020-10-21 11:38:32 +02:00
a0ce0154e7 Merge branch 'master' into geometry-nodes 2020-10-21 11:11:16 +02:00
22ceb4a752 Fluid: Fix in addition to new obstacle distance parameter
The obstacle distance value should only be used when using second order boundaries.
2020-10-21 10:52:30 +02:00
fc2a83d95b Cleanup: rename some functions with more relevant prefix. 2020-10-21 10:23:48 +02:00
afd13710b8 Cleanup: Clang-tidy readability-named-parameter
No functional change.
2020-10-21 13:21:00 +05:30
7ac6f4d26c Cleanup: Clang-tidy readability-redundant-string-init
No functional change.
2020-10-21 13:15:17 +05:30
Ankit Meel
ee90effd3a Clang-tidy: disable new warnings.
Until it is decided whether to work on, or ignore these
warning, disable them. See T78535 

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9281
2020-10-21 12:58:39 +05:30
a8f44a4799 Cleanup: early return from animation step, reduce indentation level 2020-10-21 18:07:24 +11:00
Jeroen Bakker
e60bc528f0 DrawManager: Adding Custom Render Passes
Currently render passes in the draw manager (eevee) must be predefined
in the render result. This patch would ask the render engine for the
render passes it needs, and create these as a preparation step during
rendering. This allows any draw engine to define more complex render
passes setup.

Render passes can only be added before the call to `RE_engine_begin_result`.
`RE_engine_begin_result` makes a full copy of the render passes. During
rendering the render engines renders to the duplicated passes.
`RE_engine_end_result` syncs the data back to the original render passes,
but only if the passes existed in the original render result.
Currently we work-around this issue by registering the passes in
`render_result_new`. This is legacy blender internal structure and should
be avoided.

With upcoming projects (AOV/Cryptomatte) it becomes a bit of a mess as we
are extending legacy code to support new features. This patch allows us to
let each draw engine register their own render passes at render time
(similar to cycles and other render engines). In the future we could get
rid of legacy render passes registration in render_result_new.

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D9088
2020-10-21 08:14:21 +02:00
1ad100d556 Fix T81079: Switch object ignoring visibility settings
Replace ED_transform_snap_object_context_create with
ED_view3d_give_base_under_cursor & ED_view3d_autodist_simple so object
visibility is respected and non-geometry objects can be supported.

Ref D9255
2020-10-21 13:53:03 +11:00
4bf6ffc022 Fix for T81757: Incorrect Overlay Line Height
Fixes error in determining 3DView Overlay Line Height. Do not base on current default font height.

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

Reviewed by Campbell Barton
2020-10-20 19:11:36 -07:00
a80c1fc011 Cleanup: simplify lasso transform from 17cb2a6da0
Access as 2D array, loop forwards over the pointer since it's
more common and simpler to read.
2020-10-21 13:03:53 +11:00
4e90dff60f Cleanup: avoid error prone nested switch statements (missing break)
17cb2a6da0 missed a break statement after a nested switch,
while it didn't cause a bug nesting switch doesn't read well
and is prone to errors like this.

Split modal-keymap checks into their own branch to avoid this happening,
also use matching event checks for all gesture operators.
2020-10-21 12:54:35 +11:00
7167a57197 Fluid: Added obstacle fluid distance parameter
Being able to adjust the distance between fluid and obstacles comes in handy when trying to achieve a fluid motion over inclined obstacles.

Depending on the slope of such obstacles, already small adjustments of this value can help when particles stick to obstacle surfaces (i.e. make particles not stick to obstacles).
2020-10-20 23:07:53 +02:00
14d56b4217 UI: Add angle snapping to line gesture tools
This adds support for snapping for line gesture tool. It is implemented
in the modal keymap as Snap, which is a toggle (similar to how snapping
in the transform operator works).

Right now it snaps the angle of the line to 15 degree increments, which
is defined in code. This should be easy to expose in the UI in the future
if we need to.

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D9115
2020-10-20 22:52:12 +02:00
cf8aa20967 Fix error in the last commit
I accidentally commited a file without saving it
2020-10-20 22:33:26 +02:00
17cb2a6da0 UI: Move gesture selection with spacebar
This patch adds a modal key to move the selection box/lasso/line while
drawing it. It also sets "repeat": False on the animation playback key
to prevent accidental playback if the spacebar is released after the
mouse button.

Reviewed By: #user_interface, pablovazquez, Severin

Differential Revision: https://developer.blender.org/D9227
2020-10-20 22:18:01 +02:00
b55c44e3ed EEVEE: Screen Space Reflection: Improve self intersection cases.
This patch fix most self intersection comming from reflection rays.
We regenerate the ray if it goes below the shading normal (should be the
geometric normal but we have no access to it here).

Also add the same precision based bias we use for contact shadows.

This fix T81105 Eevee SSR quality regression in 2.91 alpha
2020-10-20 22:06:43 +02:00
65a3195781 EEVEE: Screen Space Reflection: Fix undefined behavior with invalid LOD
Some issues happened because the lod can become negative in some cases.
Also avoid sampling LOD with interpolation (floor).
2020-10-20 22:06:43 +02:00
3e5a354333 Fix sculpt pen tilt support changing the brush strength
SCULPT_tilt_apply_to_normal expects a normal, and offset was already
scaled by radius. The funcion returns a normalized vector, so the
strength of the brush was changed.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9275
2020-10-20 21:41:32 +02:00
98540511b1 Cleanup: Clang-tidy -readability-inconsistent-declaration-parameter-name
Changes in source/blender/makesrna only.

No functional change.
2020-10-21 01:09:31 +05:30
f76d9de7ed Cleanup: Clang-tidy bugprone-redundant-branch-condition
No functional change.
2020-10-21 01:08:26 +05:30
10e2b77121 Cleanup: makesrna, Clang-tidy else-after-return-fixes.
It got left out of {rBc04088fed1b8faea6b2928bb5e09ab3}.

No functional change.
2020-10-21 01:08:26 +05:30
6c2bea6492 Cleanup: Clang-tidy silence readability-non-const-parameter
This is a false alarm, `getFileSystemRepresentation` changes the
return value argument.
So used `NOLINTNEXTLINE`.
2020-10-21 01:02:16 +05:30
43e4d6e5b1 CMake/Windows: Compile GMP library as fat library 2020-10-20 13:04:53 -06:00
Rahul Chaudhary
0c1c6e7ecf UI:Add icon for Displacement Eraser brush
This patch adds icons for the multires displacement
eraser tool in sculpt mode

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D9286
2020-10-20 20:59:29 +02:00
Rahul Chaudhary
e74b7e1615 UI: Add icons for line genture tools
This patch adds icons for line gesture tools
Line mask and line project

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D9285
2020-10-20 20:55:48 +02:00
Rahul Chaudhary
a264b1f710 UI: Add icon for boundary brush
This patch adds icon for the boundary brush in sculpt mode

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D9284
2020-10-20 20:52:36 +02:00
3d78e98d52 Ocean Modifier: allow spray maps to be baked
In comments made by a tester on rB17b89f6dacba007bf, it seems that baking
of the spray maps would be useful. This commit adds that capability. Both
the spray map and its inverse are baked out in this change, for maximum
convenience and to avoid assuming what the user wants.

Differential Revision: https://developer.blender.org/D8470
2020-10-20 12:47:58 -05:00
de77aa337c Cleanup: warning on windows 2020-10-20 17:50:22 +02:00
c0a0789af5 UI: Sculpt 'Inverse Cursor Color' Label
Shorten name of 'Inverse Cursor Color' to 'Inverse Color' so that it does not overflow its popover.

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

Reviewed by Brecht Van Lommel
2020-10-20 08:25:28 -07:00
Jeroen Bakker
e05ce1ea20 UV/Image: Remove Legacy Drawing
With D8234 a new drawing method for UV/Image editor was introduced. For debugging
reasons we left the old drawing method in the code base. This patch will remove
the old drawing method.

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D9011
2020-10-20 17:06:13 +02:00
239eb95ef8 Fix T81865, T81860: CustomData Correction can fail on non standard names
Caused by rBaafd71a8a160.

In the process of CustomData Correction, we need to make sure we also
have matching layer names [as was done before above commit], otherwise
this will create layers with default names, applying
(mesh_customdatacorrect_apply and friends) will fail then.

Maniphest Tasks: T81865

Differential Revision: https://developer.blender.org/D9278
2020-10-20 16:22:36 +02:00
1c08ab4535 CMake: Compile GMP library as fat library
The idea behind this is to compile all versions of functions,
and let the library to pick the best at runtime.

Attempting to fix T81835
2020-10-20 16:18:59 +02:00
0cd7f7ddd1 Nodes: add geometry socket type
We still have to pick a color for this socket.

Ref T81848.
2020-10-20 15:31:59 +02:00
8319279fdb Cleanup: remove dead code 2020-10-20 15:23:15 +02:00
Jeroen Bakker
7320ecee9b EEVEE: ShaderToRGB alpha inversed
The alpha out socket output the average transmittance, not the alpha.
This patch will convert the transmittance to alpha.

Found during research of T80919; Issue introduced when `Closure.opacity` was migrated to `Closure.transmittance`.

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D9010
2020-10-20 15:17:03 +02:00
257fe5a6e7 Volumes: Fix compilation when building without openVDB
And remove a warning.
2020-10-20 15:08:25 +02:00
360282cf1f Libmv: Refactor camera intrinsics parameter block
Use the newly introduced packed intrinsics, which allows to remove
code which was initializing parameters block based on distortion
model type.

Now such initialization is done by a particular implementation of
a distortion model.

Differential Revision: https://developer.blender.org/D9192
2020-10-20 15:02:50 +02:00
549841bbc0 Libmv: Add generic class for packed intrinsics
This is a common class which can be used in all sort of minimization
problems which needs camera intrinsics as a parameter block.

Currently unused, but will replace a lot of hard-coded logic in the
bundle adjustment code.
2020-10-20 15:02:50 +02:00
151173fefe Libmv: Add array<type, size> to libmv namespace 2020-10-20 15:02:50 +02:00
abc017ae0b GLTexture: Fix Anisotropic filtering affecting the standard mipmap samplers
Everything's in the title...
2020-10-20 14:55:18 +02:00
45400b32d0 DRW: Disable anisotropic filtering on utility textures
Anisotropic filter may result in incorrect algorithm. This only
affects util textures (not Image datablocks gpu textures).
2020-10-20 14:55:18 +02:00
711b55b527 Fix libmv test on windows
There is no point in testing std::vector capacity as it can differ
between std implementations.
2020-10-20 14:46:48 +02:00
b3d469e78d Fix compile error
Haven't tested on windows, hope that works.
2020-10-20 14:16:42 +02:00
5bd7eda093 Fluid: Add missing versioning for new options in 'Viewport Display' panel
Files created before D8705 was merged need to get initial values for the new viewport display fields.
2020-10-20 14:06:43 +02:00
14c0897671 Fix T81076: Crash on switch object operator undo
This fixes the crash and the assert, but undo is done in multiple steps

Reviewed By: campbellbarton

Maniphest Tasks: T81076

Differential Revision: https://developer.blender.org/D9256
2020-10-20 13:22:43 +02:00
0105f146bb Cleanup: General comment style clean up of graph_edit.c and fcurve.c
No functional changes.

Reviewed By: Sybren A. Stüvel

Differential Revision: http://developer.blender.org/D7850
2020-10-20 13:04:02 +02:00
580fe9f5f8 Fix (unreported) install_deps: wrong version number for llvm in some cases.
Version reported by package manager is not always satisfying (on Debian
testing currently e.g. `llvm-dev` is reported as `9.0`, when exact one
is actually `9.0.1`, this break CMake build of Blender then).

Just use version reported by `llvm-config` instead, when using
distribution packages.
2020-10-20 12:52:17 +02:00
89eef19171 Fix T81776: Sculpt line gestures not working with transformed objects
The line gesture plane should be in object space, not in world space.
2020-10-20 12:14:28 +02:00
6ced026ae1 Simulation: remove particle nodes with outdated design
The design for how we approach the "Everything Nodes" project
has changed. We will focus on a different part of the project initially.

While future me will likely refer back to some of the code I remove here,
there is no point in keeping this code around in master currently.
It would just confuse other developers working on the project.

This does not remove the simulation modifier and data block. Those are
just cleaned up, so that the boilerplate code can be reused in the future.
2020-10-20 12:07:42 +02:00
63a9f24b55 Volumes: simplify volumes in modifiers or on load
This changes how the simplify volumes setting works. Before, it only
affeted viewport rendering. This was an issue, because all internal
computations would still have to happen on the high resolution volumes.
With this patch, the simplify setting already affects file loading and
procedural generation of volumes.

Rendering does not have to care about the simplify option anymore,
it just gets the correct simplified version from the depsgraph.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D9176
2020-10-20 11:00:16 +02:00
f3ecb4c91e Fix T81684: node location not handled correctly
Reviewers: ISS

Differential Revision: https://developer.blender.org/D9236
2020-10-20 10:51:19 +02:00
efc2edc47f Fix T81190: Merge by Distance marks edges sharp
Make calculating edges sharp optional since it marks nearly all edges
sharp when the normals have been manually rotated.
2020-10-20 14:39:15 +11:00
c4668b72e0 Cleanup: use BLI_listbase_is_single instead of counting 2020-10-20 14:16:47 +11:00
74d1fba1de Fix Boundary brush not working when the whole mesh is inside the brush radius
When creating the boundary edit data, the loop can stop because a new
vertex was found further from the boundary than the brush radius or
because all vertices of the mesh were already processed. In this second
case, the max_propagation_step was not set, so the code that laters
calculates the falloff was not working, preventing the mesh from
deforming.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9215
2020-10-20 01:59:53 +02:00
2b2f3da721 Sculpt: Smooth deform type for Boundary Brush
This adds a smooth deformation type to the boundary brush, which smooths
the boundary and has a regular falloff towards the inside of the mesh.
For smoothing, only vertices parallel to the boundary are taken into
account, creating this effect.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9204
2020-10-20 01:52:53 +02:00
f780bfafcf Fix missing Sculpt Overlays updates when using modifiers
Now that sculpt mask and face sets can also be drawn without using the
PBVH, these operators need these extra updates when the data changes.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D8956
2020-10-20 01:32:02 +02:00
48fd10a77d Sculpt: Reduce the displacement step in the cloth solver
Previously the base displacement for solving the constraints was always
using 0.5, which may introduce artifacts when multiple constraints of
different types are computed for the same vertex. This introduces a
factor that reduces the base displacement of the solver, reducing the
artifacts.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9202
2020-10-20 01:27:44 +02:00
ea4d28aea0 UI: In-line layout for Empty Image Transparency
No need for a sub-panel with a single property (same as mesh
normals auto-smooth, camera passepartout, etc).
2020-10-20 00:48:11 +02:00
31108f9359 UI: Sort "Volume to Mesh" and "Mesh to Volume" in alphabetical order 2020-10-20 00:12:45 +02:00
c6c4925771 Fluid: Added domain check for new OpenVDB precision 'Mini' type
Precision 'Mini' should only be available for liquids domains.
2020-10-19 21:40:17 +02:00
aa244a7a68 UI: Simplified Categorized Menus
Menus with categories gain a dividing line and omit the title.

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

Reviewed by Brecht Van Lommel
2020-10-19 11:28:38 -07:00
1e3742749e UI: 3DView Popover Adjustments
Slight adjustments to widths, and adds gaps below titles, of 'Viewport Gizmos' and 'Object Types Visibility' popovers.

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

Reviewed by Pablo Vazquez
2020-10-19 10:55:05 -07:00
3d26cd01b9 Spelling: Apart Versus A Part
Corrects incorrect usages of the fragment 'apart of' when 'a part of' was required.

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

Reviewed by Campbell Barton
2020-10-19 09:47:19 -07:00
4fb67ae809 CMake/macOS: use system OpenAL for the time being.
Revert part of {rB83124856d05ee4da605ab247e6}
2020-10-19 22:05:56 +05:30
c0a6bc1979 Spelling: Loose Versus Lose
Corrects incorrect usages of the word 'loose' when 'lose' was required.

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

Reviewed by Campbell Barton
2020-10-19 09:15:34 -07:00
84ef3b80de Spelling: Miscellaneous
Corrects 34 miscellaneous misspelled words.

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

Reviewed by Campbell Barton
2020-10-19 09:11:00 -07:00
a9f2641cb6 Fix build error with WITH_CYCLES_NATIVE_ONLY and AVX tests on macOS
Only build avx/avx2 unit tests if supported by the compiler and
WITH_CYCLES_NATIVE_ONLY is off, otherwise the appropriate compiler flags
are not available.
2020-10-19 17:55:00 +02:00
d1eefc4215 Spelling: Then Versus Than
Corrects incorrect usages of the words 'then' and 'than'.

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

Reviewed by Campbell Barton
2020-10-19 08:43:08 -07:00
3a7fd309fc Spelling: It's Versus Its
Corrects incorrect usage of contraction for 'it is', when possessive 'its' was required.

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

Reviewed by Campbell Barton
2020-10-19 08:12:33 -07:00
d2bf71b412 Fix use of uninitialized variable 2020-10-19 09:19:13 -05:00
7ef3a63480 Cleanup: Use BLI string functions
It's better not to assume that strings passed as arguments
will have the proper size.
2020-10-19 09:17:41 -05:00
9bf1bf599b Cleanup: Missing parentheses around macro in versioning
Although the `ELEM` macro wraps logic into parentheses, it's not intended to be
used that way. Unexpanded macros should still follow regular coding style for
readability and for tools parsing the code (it confused clang-format for
example).
2020-10-19 15:38:55 +02:00
Ankit Meel
83124856d0 Cmake/macOS: strictly disallow searching in frameworks
This is a stricter version of the change made in
{rBbb872b25f219d1a9bc2446228b6dc}

Cmake must never look into Frameworks when the system
library guards (`without_system_libs_begin`/`without_system_libs_end`)
are present.

OpenAL didn't follow this and OpenAL.framework in Xcode would be used.
The Cmake's `FindOpenAL.cmake` looks for both library (in this case,
the .framework file), and include dir.
Precompiled libraries don't contain the former. So `find_package`
cannot be used, or it becomes the hack that {rBb2c707747da9} removed.
So hardcode the include dir path, and other variables.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D9267
2020-10-19 18:47:35 +05:30
4d9f357bf6 Fix T81806: Cycles error when GPU device_type is NONE
Own regression in 4bea4702d5
2020-10-20 00:09:51 +11:00
29dbe00719 Fix T81484: Weight/Vertex paint with mirror and viewport clipping does not update stroke on initial side
Issue introduced in rB4f616c93f7cb.

Issue here is that the the `StrokeCache` `mirror_symmetry_pass` is still
in its previous state when entering
`wpaint_do_symmetrical_brush_actions`.
For the initial stroke this means that the (wrong) cache
`mirror_symmetry_pass` ends up in SculptBrushTest `mirror_symmetry_pass`
as well and thus the clipping test in `sculpt_brush_test_clipping` will
fail.
[ This one flips the coords to test against clipping according to (now
wrong) `mirror_symmetry_pass` ]

Solution seems simple: just ensure we start of with a
`mirror_symmetry_pass` of zero in `wpaint_do_symmetrical_brush_actions`
for the initial stroke.
Same thing is done for vertex paint as well.

Maniphest Tasks: T81484

Differential Revision: https://developer.blender.org/D9268
2020-10-19 15:01:38 +02:00
477d983c2e Animation: Improve labels on Snap menu in graph editor
Add "Selection to" as prefix for those menu items that move the selected
keyframes to something, for both the Key → Snap menu and the Shift+S pie
menu.

No functional changes.
2020-10-19 14:02:53 +02:00
e3c76f7937 Fix libmv eigen alignment issues when compiling with AVX support
There would be eigen alignment issues with the custom libmv vector
class when compiling with AVX optimizations. This would lead to
segfaults.

Simply use the std::vector base class as suggested by the old TODO in
the class header.

Reviewed By: Sergey

Differential Revision: http://developer.blender.org/D8968
2020-10-19 13:06:38 +02:00
b17ad27adc Silence an unused variable warning in bmesh_bevel.c. 2020-10-19 06:54:24 -04:00
e49ee5a808 Fix (unreported) crash when unlinking a brush from a tool.
Cursor drawing code was not checking for potential NULL pointers.
2020-10-19 12:50:01 +02:00
93887d1096 Fix: skip drawing input sockets that do not have a draw method
Contributed by @povmaniaco with minor changes by me.

Differential Revision: https://developer.blender.org/D9263
2020-10-19 12:28:44 +02:00
f7832b1583 Volumes: new Volume to Mesh modifier
This modifier is the opposite of the recently added Mesh to Volume modifier.
It converts the "surface" of a volume into a mesh. The "surface" is defined
by a threshold value. All voxels with a density higher than the threshold
are considered to be inside the volume, while all others will be outside.

By default, the resolution of the generated mesh depends on the voxel
size of the volume grid. The resolution can be customized. It should be
noted that a lower resolution might not make this modifier faster. This
is because we have to downsample the openvdb grid, which isn't a cheap
operation.

Converting a mesh to a volume and then back to a mesh is possible,
but it does require two separate mesh objects for now.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D9141
2020-10-19 12:12:44 +02:00
bd15efefd2 Cleanup: clang tidy 2020-10-19 11:35:23 +02:00
850944e6cd Image: Export emissive colors in 3 channel PNG images
Related to T81199. When saving a rendered image with transparency (RGBA)
to a 3 channel PNG image the emissive colors were not exported. This
change adds the emissive colors to the written file.

NOTE: this does not fix the limitation of writing emissive colors to a 4
channel PNG file as the file format does not support this.
2020-10-19 11:29:47 +02:00
Alistair Sealy
f52f51aef2 Cleanup: spelling in comments
Fixed a couple of typos in comments in CMakeLists.txt and GNUmakefile

Reviewed By: #platforms_builds_tests, mont29

Differential Revision: https://developer.blender.org/D9261
2020-10-19 09:27:32 +02:00
Jeroen Bakker
1ceb91d1b3 Fix T81167: Texture Painting with Paint mask enabled, (de)selecting faces causes a mess with texture slots
Issue caused by {9582797d4b50} in b2.90. The surface per material used
an index buffer owned by the batch. These index buffers are created at
the same time the surface tris index buffer was created. When a material
per batch buffer was invalidated it used the surface tris index buffer
rendering all materials on all surfaces making the last draw command
render succeed.

This patch stores the surface tris per material in the cache so they can
be reused. There is also no need to use the `saved_elem_ranges` anymore as they are
now part of the cache.

The ugly bit of the implementation is that in `extract_tris_finish` the
MeshBufferCache is retrieved. But as this part was already documented as
a hack and it is something that is only used for final meshes. Other
solutions would impact performance or made the fix not condensed
(passing parameters that shouldn't be used).

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D9136
2020-10-19 08:14:07 +02:00
b2e067d98c Fix T68343: Rendered video plays at 600fps
Field time_base of video stream must be set for some containers,
otherwise avformat_write_header() will set it to default values.
Rendered file in such case won't be played at desired frame rate.

See init_muxer() in mux.c in ffpmeg sources.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9213
2020-10-19 07:17:13 +02:00
94364be80a Fix ASAN warning after recent cleanup
rB78a5895c96 introduced a "use after scope" warning, where a buffer
from a lower scope was used later. The solution is to only use one
variable and store whether to use it more explicitely with a bool.
2020-10-18 22:18:31 -05:00
48c484a22e Fix Bevel percent mode, and clamping for it too (T79898).
The code for Bevel's percent (and absolute) modes were pretty bogus.
It assumed, like the rest of the modes, that the offset lines are
parallel to the beveled edge. Which is not true for these modes,
though it accidentally works sometimes if the legs are equilength.
Also the clamping code for those modes was completey wrong.
It is too hard to really fix the clamping code for absolute mode,
but it is a little better now. Percent mode clamping is fixed.
2020-10-18 16:27:07 -04:00
663e047102 Fluid: Fix for issues with external forces
A general refactor / fix commit that should clear out the issues that have been reported on external forces and moving effectors (e.g. T79537, T81660, T80088).
2020-10-18 20:35:02 +02:00
1f046e05b6 Fluid: Add versioning for fluid particle physics type
Setting this type is required to prevent fluid particles from being treated like physics particles. The actual fix for this was made in rB11a8a6d0e6b5.
2020-10-18 20:35:02 +02:00
bdad412fa7 Fix for T81400: Block Width Corrections
Scale widths of popovers and dialogs with Text Style font point changes.

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

Reviewed by Hans Goudey
2020-10-18 10:31:55 -07:00
78a5895c96 Fix T81800: Datablock pin not working for bones in pose mode
The "active_pose_bone" context variable isn't accessed from
`buttons_context`, it uses `screen_context` instead. This means
it can't account for pinning in the property editor.

Using "pose_bone" context variable first means the property
editor context will be used and the pinning will work.

Differential Revision: https://developer.blender.org/D9242
2020-10-18 10:57:14 -05:00
806a561e23 Sculpt: Fix (unreported) assert getting trimming cursor depth option
It is a boolean, not an enum.
2020-10-18 15:06:27 +02:00
e1cd6fae34 Avoid Assert in BKE_mesh_calc_loop_tangent_ex
Code could call CustomData_get_layer_index_n with a negative index (if
no active and/or render UV layers are found). This would assert since
rBe86785c51445.

Spotted while looking into T81398.

Differential Revision: https://developer.blender.org/D9212
2020-10-18 10:56:39 +02:00
9c7fda6de3 Fix T81729: Cycles object color not updating for instancers
Caused by rBe65c78cd43aa.

Since above commit, only geometry and lights received the update,
previous to this check an instancer would receive that is well (in case
of 'is_updated_shading').

Now check for an instancer (checking OB_DUPLI via ob.is_instancer()) and
do an update then as well.

Reviewers: brecht

Maniphest Tasks: T81729

Differential Revision: https://developer.blender.org/D9222
2020-10-18 10:42:17 +02:00
f425f40c4e Cleanup: More miscellaneous code quality changes in wm directory
- Declare variables where initialized.
  - Use LISTBASE_FOREACH macro.
  - Reduce variable scope.
  - Return early or reduce indentation in some cases.
2020-10-17 16:36:02 -05:00
85e78fa17c Cleanup: Declare variables where initialized in context.c 2020-10-17 16:30:56 -05:00
d48d8b3456 Fix T81761: EEVEE enabled AO pass affects render result
This was a regression introduced on 68651534c2.
2020-10-17 13:10:13 +02:00
7447eb7e74 Cleanup: Miscellaneous improvements in wm directory
- Reduce variable scope.
  - Use LISTBASE_FOREACH macros.
  - Return early in some cases to reduce to reduce indentation.
2020-10-17 01:28:34 -05:00
2c14a950a7 Fix T81594: Unable to reassign effect inputs
This was caused by canceling operator if strip has more than 0 inputs.
Logic should be reversed - cancel only if strip has 0 inputs.

BKE_sequencer_render_loop_check() arguments had to be sanitized because
seq_effect_find_selected() can set seq1,2,3 to NULL

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9197
2020-10-17 07:01:12 +02:00
e2c5439cb4 Cleanup: Reduce variable scope in screen directory
Also return early and use LISTBASE_FOREACH in a few places
2020-10-16 21:56:58 -05:00
20276e4b00 Cleanup: Reduce variable scope in area.c 2020-10-16 20:49:47 -05:00
3bc808ebcb UI: Tweak decimate modifier layout
- Expand the "Type" toggle at the top. This is consistent with other
  modifiers where there is a "Type" option at the top. It conveys the
  property's importance and makes it faster to switch it.
- Expand the "Delimit" option vertically so the text isn't squashed.
  There isn't enough space on one line for this, and is has to be
  expanded because more than one option can be selected. This is also
  consistent with how "multi-select" enums are often displayed, like
  the 3D view snapping settings.

|   Before   |   After    |
| {F9000996} | {F9000985} |
2020-10-16 16:03:45 -05:00
c275a00a72 UI: Align related properties
The start and end frame properties are generally aligned in one block.
2020-10-16 15:50:15 -05:00
54da72d3cd Property Search: Reset panel expansion when exiting search
This patch implements panel expansion saving and resetting for property
search. While search is active, the panel expansion is based on whether
or not it has a search result. When the search finishes, the panel
expansion returns to its state before the search started. However, any
panels interacted with during the search won't reset their expansion.

This requires adding a new runtime flag for panels to store whether to
use search result status as expansion. It also requires better handling
for animation when panel expansion changes with another new runtime flag.
`UI_panel_is_closed` gets the search-dependent expansion, but it is
intentionally not used to access expansion in every case-- sometimes it's
necessary to use `PNL_CLOSED` directly.

Differential Revision: https://developer.blender.org/D8984
2020-10-16 15:16:44 -05:00
77aef03d8a Cleanup: reduce variable scopes 2020-10-16 18:06:30 +02:00
00ee3960e0 Cleanup: reduce variable scopes 2020-10-16 17:30:12 +02:00
89ffdad0f3 Fix misuse of alloc inside a loop
Alloc will only free its memory when the function is returned.

Issue introduced in c866075dfb. Thanks Sergey for spotting this.
2020-10-16 17:18:23 +02:00
5ebdbcafcb Animation: Snap Cursor Value operator
Add operator to snap the 2D Cursor value to selected keyframes. This is
doing almost the same as the "Cursor to Selected" operator, except that
it doesn't affect the current frame, just the Y-coordinate (the value)
of the 2D cursor.

The "snap cursor" operators are added to the Key → Snap menu and to the
Snap pie menu. This means that these menus are now extended in meaning,
to not only mean "snap the selected keyframes to the cursor", but also
for some options "snap the cursor to selected keyframes".

This fixes T76596.
2020-10-16 16:44:06 +02:00
df4a93aca0 Cleanup: Animation, split up frame jump operator
Split up `GRAPH_OT_frame_jump` exec function and added some local variables
to give names to the cryptic `ked.f1`, `ked.f2`, and `ked.i1`.

No functional changes.
2020-10-16 16:09:20 +02:00
342be27daa Cleanup: clang-tidy 2020-10-16 15:33:00 +02:00
5b9296f0d6 Fix (reported by studio team) crash in relocate lib code.
We do not always find a matching ID in new library.
2020-10-16 15:22:20 +02:00
6430849366 Fix T81027: Multires objects in sculpt mode can't be linked via collections.
Just clear all non-object mode flags from linked objects at read time.

Reviewers: brecht

Subscribers:
2020-10-16 14:04:17 +02:00
4475c49e2f Fix T81591: Align view to active is not working in sculpt mode
Remove sculpt/paint checks in getTransformOrientation_ex
This code goes back a long time (early 2.5x). I couldn't find any
reason why sculpt/paint checks were being made.

This makes the following changes:

- When in object mode, the object must be selected.
  Since this function typically operates on the selected items.

- When in paint/particle modes, the objects matrix is always
  used regardless of selection, since object selection can't be
  controlled in these modes.

- When there is no active object, the first selected object is no
  longer used as it's quite an arbitrary decision & not something
  done elsewhere with objects in Blender.
2020-10-16 22:16:53 +11:00
3b84dce969 Fix T54526: Data Transfer modifier's Max Distance field working strangely.
Based on investigation by Philipp Oeser (@lichtwerk) and solution by
Alexander Gavrilov (@angavrilov) in D5206, thanks!
2020-10-16 13:00:40 +02:00
14f490b932 EEVEE: SSR: Fix unreported smoothstep instability when border factor is 0
From the GLSL documentation: `Results are undefined if edge0 ≥ edge1.`
This is the case without this patch.
2020-10-16 12:56:57 +02:00
eb55ca72f4 UI: Make node theme settings to conform to UI rules
Basically first letter of (most) words is to be capitalized.

These settings (Noodle curving and Grid levels) had this wrong since
their first commit (2011 and 2020 respectively).
2020-10-16 12:10:18 +02:00
5d92fd8a90 Correct last commit 2020-10-16 20:51:58 +11:00
b002fdc4bf PyDoc: update to account for new context member 2020-10-16 20:29:55 +11:00
491d777efc Cleanup: remove debug printf()
No functional changes.
2020-10-16 10:59:43 +02:00
c5bdbc340a Fix T62463: unable to select anim channel for unselected node
Remove the code that synchronises selection state of shader node animation
channels. This code is only used in a few cases where selection of these
animation channels is changed, and then potentially does the wrong thing
and disallows selection of animation channels altogether.

This removal is meant to be a temporary situation, to unblock animation
channel selection. See T74159 for the overall effort to improve selection
sync.
2020-10-16 10:21:36 +02:00
5722de6098 Cleanup: Animation, remove unused parameters
No functional changes.
2020-10-16 10:17:10 +02:00
bb872b25f2 CMake/macOS: Search for headers in Frameworks last.
https://devtalk.blender.org/t/libpng-version-mismatch/15799/

By default, `CMAKE_FIND_FRAMEWORK` is `FIRST`.

CMake searches headers and libraries separately. So library is found
in LIBDIR, and headers like those in Mono are detected before the
headers in LIBDIR, and we get a version mismatch.

So set the priority of Frameworks to `LAST`.

https://gitlab.kitware.com/cmake/cmake/-/issues/18921
https://gitlab.kitware.com/cmake/cmake/-/issues/16427

{rBbac91956ae97} tried to fix the same issue, but it didn't work.
It's fine to keep the changes made there, just removing the comment
that may give false sense of security.
2020-10-16 13:41:29 +05:30
3ffe65a7fb CMake/macOS: Restore TIFF's optional status.
{rB1f6b7387ad01}
2020-10-16 13:41:26 +05:30
fa566157a5 PyAPI: unregister add-ons when exiting
This lets add-on authors avoid false positive leaks when exiting.
In particular GPUShaders's although it applies to any PyObject that
stores memory allocated by guarded-alloc.

While this does add overhead on exit, on my system it's
under 1/100th of a second with all addons enabled.

See: T71362
2020-10-16 16:34:29 +11:00
f40294b2d6 Fix syntax error in IC-Keymap
Regression in e936f04258
2020-10-16 16:20:44 +11:00
0a2ae7f220 RNA: support building WITH_PYTHON=OFF 2020-10-16 15:56:26 +11:00
9fb2ce70d6 Cleanup: remove f-string use 2020-10-16 14:06:47 +11:00
507e7bcbdb Cleanup: assign variables for re-used context members 2020-10-16 14:00:15 +11:00
fa0ceb4959 Cleanup: spelling 2020-10-16 11:46:48 +11:00
00f7b572d9 Windows: Fix build issue on windows
TBB includes Windows.h which defines a min/max macro
leading to issues when you want to use std::min and
std::max.

This change prevents Windows.h from defining them
sidestepping the issue.
2020-10-15 17:14:57 -06:00
ba8233174c Fix build error with clean builds
Needed after d1b3439b80. Think the error only happened with fresh builds,
where dna_type_offsets.h didn't already exist.

We have to do the same in other places too, see 8594cdb456.
2020-10-15 23:02:16 +02:00
e936f04258 Outliner: Use operator option to decide which item to rename
The `outliner.item_rename` operator needs to decide if it should rename the
active or the hovered item. Previously it checked if the event is a press
event, which is a hacky way of doing this and limit how the operator can be
used in the keymap.
Now use a operator option to let this be controlled on the keymap level.

Doesn't change any default behavior.
2020-10-15 21:31:43 +02:00
0a66436fe5 Fix T76597: Support Keyframe: Copy To Selected
Reviewed By: Sybren, Luciano Muñoz Sessarego

Differential Revision: https://developer.blender.org/D7783
2020-10-15 14:55:09 -04:00
a88076e948 Fix error in previous commit
Missing null-check, could lead to null-pointer dereference.
2020-10-15 20:40:03 +02:00
d4f94d8a31 Cleanup: Refactor lookup for hovered Outliner element for renaming
* Use existing and optimized lookup function, rather than own duplicated logic.
* Move low-level coordinate check into general function, alongside similar
  ones.
2020-10-15 20:31:36 +02:00
5129e2e042 Fix T81675: Renaming collapsed collection in Outliner renames nested items
* `do_outliner_item_rename()` enables the rename mode for the item under the
  cursor. Issue is, collapsed children end up having stored the same coordinate
  as their parent, so they too would get the rename mode enabled (there is no
  early-exit that would hide this).
* The items displayed as inline icons do get the proper coordinates of the
  icons, so they are not mistaken as being under the cursor.

After rBb077de086e14, the Outliner tree is rebuilt less often, so the
coordinates are cleared less often too.

As far as I can see we can always clear coordinates of invisible items now. No
code seems to depend on keeping the old coordinates anymore.
2020-10-15 20:31:36 +02:00
5efb104003 Silence warning 2020-10-15 20:03:26 +02:00
c866075dfb Fix T81580: No doversion for Emission Strength
The new parameter made so that previously keyed Alpha values were lost
and instead the new "Emission Strength" was keyed.

Issue introduced with the original commit of Emission Strength: b248ec9776

Note: Files created since the issue (September 17) that keyframed the
Emission Strength will have to fix their files manually.

Differential Revision: https://developer.blender.org/D9221
2020-10-15 19:59:58 +02:00
ca55a1b564 Fix Cloth brush grab artifacts in the affected area
The cloth brush grab mode was creating constraints at 1.0 strength in
the area of the brush where the fade was evaluated to 1. This was causing
stability issues in the simulation and not producing ideal results.
Now the constraint strength is scaled with an empirically found factor.

The values in this patch may require further tweaking after experimenting
a little bit more with them.

Reviewed By: sergey, zeddb

Differential Revision: https://developer.blender.org/D9201
2020-10-15 19:54:41 +02:00
91af828e8b Fix T81743: Changed behaviour in RGB Curves node interpolation
Restore the old `correct_bezpart()` (pre-rBda95d1d851b4) function as
`BKE_curve_correct_bezpart()`, and use that where the old behaviour was
desired (that is, curve maps like used by the RGB Curves shader node).

The new (post-rBda95d1d851b4) function is also renamed to
`BKE_fcurve_correct_bezpart()` to avoid confusion.
2020-10-15 19:48:14 +02:00
229b9f1299 Fix brush tip delta orientation with anchored strokes
When using anchored stroke, the stroke operator was modifying the
coordinates on the "mouse" rna property by setting them to the original
position. Because of this, all the sculpt delta calculation was failing
and the delta for these brushes was set randomly (with a 0 vector) at
the beginning of the stroke.
There is now an extra property that uses the unmodified coordinates of
the mouse to calculate the delta. Now delta orientation works as expected
in all brushes and features that require brush tip orientation.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9183
2020-10-15 19:45:43 +02:00
6991b13e41 Fix T81649: Cloth simulation dynamic area mode tearing the mesh
Dynamic area should use the radius instead of the initial radius to get
the nodes as the radius can now change during the stroke. In case of
anchored strokes, the current radius can be bigger than the initial
radius, simulating vertices outside the falloff area and breaking the
mesh.

Reviewed By: sergey

Maniphest Tasks: T81649

Differential Revision: https://developer.blender.org/D9181
2020-10-15 19:40:27 +02:00
ef5f307031 Sculpt: Use mpoly flags to sync Face Sets visibility
Previously, all Face Set visibility logic was using mvert flags directly
to store the visibility state on the vertices while sculpting. As Face
Sets are a poly attribute, it is much simpler to use mpoly flags and let
BKE_mesh_flush_hidden_from_polys handle the vertex visibility, even for
Multires.

Now all operators that update the Face Set visibility state will always
copy the visibility to the mesh (using poly flags) and the grids, all
using the same code.

This should fix a lot of visibility glitches and bugs like the following:
 - Sculpt visibility reset when changing multires levels.
 - Multires visibility not updating in edit mode.
 - Single face visibible when surrounded by visibile face set, even when
the face set was hidden.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9175
2020-10-15 19:39:11 +02:00
750e4e1158 Fix Multires edge adjacency info returning wrong vertex indices
ME_POLY_LOOP_NEXT and ME_POLY_LOOP_PREV expect the offset of
the loop in the poly as an argument, in other words, corner index of the poly.
This was violated in some places. It didn't cause issues when base mesh consists
of only quads due to the way how modulus worked inside of the macro. However,
if mesh had non-quad faces adjacency information was returning wrong vertex
 indices. This was causing multiple brushes to work erratically, including brushes
like Face Set, Boundary automasking, mesh relax, and others.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9173
2020-10-15 19:37:56 +02:00
6fe3521481 Sculpt: Add global automasking settings support in filters
When using the sculpt filters, global automasking settings that affect
all brushes were ignored because the automasking system was not
implemented for filters, making filters and brushes react differently
to the global sculpt settings which creates confusion.

This makes all filter tools (mesh, cloth, color) use the same general
automasking settings and features as the brush tools. Filters will now
use the settings in the options panel to limit their effect.

This also removes the "use Face Sets" option from the Mesh filter code,
as it was duplicated from the automasking code just to have that
funcitonality. This is now handled by the regular automasking system.

The "Use Face Sets" option is still available in the cloth filter as that
option limits the action of the forces, not the displacement.

After this, it is possible to initialize the automasking system
independently from the StrokeCache and Brush settings, so it can also be
added to more tools and features in the future.

Fixes T81619

Reviewed By: dbystedt, sergey

Maniphest Tasks: T81619

Differential Revision: https://developer.blender.org/D9171
2020-10-15 19:35:37 +02:00
da7ace00d5 Sculpt: Use cursor depth in trimming gestures
This adds an operator property to use the paint cursor radius and
position for the depth of the trimming shape created by the trimming
tools.
When enabled, the shape is located in the surface point when the gesture
started and it will have the depth of the cursor radius. When the cursor
is not over the mesh, the shape will be positioned at the center of the
depth of the whole object from the viewport camera.

Reviewed By: dbystedt, sergey

Differential Revision: https://developer.blender.org/D9129
2020-10-15 19:15:04 +02:00
b9e4696641 Sculpt: Show paint brush cursor in all tools
This patch enables the paint brush cursor with all tools in sculpt mode,
even with the ones that are not brushes. The motivations for this change
are:
- The filters are using the position of the active vertex for certain
features without any visualization of what the active vertex is.

- You can call operators like mask expand (which depends on the brush
cursor position and active vertex) with a non brush tool enabled.

- Having the cursor in the rest of the tools allows to have a scene
scale representation of the radius and a direct control of radius and
strength (using the current brush shortcuts), which will allow to make
features more intuitive without relying on modifying values in the
topbar. For example, the brush radius can be used to control the depth
of the cut in the trimming tools or the size of the sphere in the
sphere mesh filter

Reviewed By: #user_interface, dbystedt, pablovazquez

Differential Revision: https://developer.blender.org/D9071
2020-10-15 19:03:35 +02:00
4b99ea17fb Fix mask expand creating wrong masks when the cursor is not over the mesh
This forces the mask expand modal operator to use the maximum
iteration when the cursor is not over the mesh, masking the entire
connected component.

This fixes the issue for both expanding masks and face sets.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9105
2020-10-15 19:02:02 +02:00
Pablo Dobarro
0d5ec990a9 Sculpt: Experimental Pen Tilt Support
This adds support for pen tilt in sculpt mode. For now, pen tilt is used
by tweaking the tilt strength property, which controls how much the pen
angle affects the sculpt normal. This is available in Draw, Draw Sharp,
Flatten, Fill, Scrape and Clay Strips brushes, but it can be enabled in
more tools later.

The purpose of this patch is to have a usable implementation of pen tilt
in a painting mode, so users can test and see in which hardware and
platforms this feature is supported and how well it works. If it works
ok, more tools and features that rely on pen tilt can be implemented,
like brushes that blend between two deformations depending on the angle.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D8893
2020-10-15 19:00:51 +02:00
6dda0779fc Fix T80625: Trimming tools not working with transformed objects
The code to handle object transforms was wrong. Now the trimming mesh
and depts is calculated in world space, using the real view origin and
normal and then stored in object space in the mesh and in the original
coordinates array. As now both meshes for the boolean operation are in
the same object space, the space conversion code can also be removed
from the boolean function.

Reviewed By: sergey

Maniphest Tasks: T80625

Differential Revision: https://developer.blender.org/D8852
2020-10-15 18:55:26 +02:00
Leha
0fed1bea65 Improve Voxel Remesher volume projection artifacts on sharp edges
The voxel remesher was using the voxel size to limit the shrink-wrap
projection distance. Now that distance is increased to help preserving
more detail on hard surface edges.

Reviewed By: pablodp606

Differential Revision: https://developer.blender.org/D6204
2020-10-15 18:51:26 +02:00
e7ab802ab0 Fix T81697: Property search crash with python handlers
Previously I used `CTX_copy` to create a mutable copy of the context in
order to set its area and region fields to temporary variables. This was
a tradeoff to avoid casting away `const` for `bContext`.

However, `bpy.context` is set to this new temporary value, which is fine
for a single `wm_draw_update` pass, but in the next main loop,
`bpy.context` is still set to this value, which was freed at the
end of `property_search_all_tabs`. It would be possible to reset the
`bpy.context` variable ath the end of the function, but this patch
contains an alternate solution: just don't copy the context. It looks
like this was the only use of `CTX_copy` anyway, maybe for good reason.

Differential Revision: https://developer.blender.org/D9216
2020-10-15 10:08:39 -05:00
15d78ea85b UI: Add reset to default value to keymap
With all the work on DNA defaults for 2.91, it's nice to expose this
convenient operator. This was already hardcoded in the UI code to the
backspace key, adding it to the keymap instead will make the shortcut
automatically show in the button right click menu.

Differential Revision: https://developer.blender.org/D9219
2020-10-15 10:02:44 -05:00
d1b3439b80 Cleanup: Use DNA defaults for grease pencil modifiers
This will make "Reset to Default Value" work properly for grease
pencil modifiers. See T80164 for more information.
2020-10-15 09:44:39 -05:00
bac91956ae CMake/macOS: set package_ROOT for PNG, JPEG, TIFF
https://devtalk.blender.org/t/libpng-version-mismatch/15799/

In this case, CMake finds libraries in `LIBDIR`, but picks headers from
`/Library/Frameworks/` (Mono framework).

CMP0074 is already enabled, so use it.
2020-10-15 18:49:45 +05:30
78d1aa4d52 Cleanup: Animation, simplify channel selection code
Split up `ANIM_deselect_anim_channels()` into
`ANIM_anim_channels_select_set()` and
`ANIM_anim_channels_select_toggle()`.

`ANIM_anim_channels_select_set()` is equivalent to the old
`ANIM_deselect_anim_channels(..., false, ACHANNEL_SETFLAG_xxx)`.

`ANIM_anim_channels_select_toggle()` is equivalent to the old
`ANIM_deselect_anim_channels(..., true, ACHANNEL_SETFLAG_ADD)`.

`ANIM_deselect_anim_channels(..., true, ACHANNEL_SETFLAG_CLEAR)` was
also called once. The `true` parameter suggested the "toggle" behaviour
was intended, but the `ACHANNEL_SETFLAG_CLEAR` argument prevented any
toggling. This is now replaced with `ANIM_anim_channels_select_set(ac,
ACHANNEL_SETFLAG_CLEAR)` to make this explicit.

No functional changes, just a cleanup in order to better understand how
the selection works.
2020-10-15 14:04:14 +02:00
1ec1e36ac1 Cleanup: Animation, rename function to match operator
Rename `animchannels_deselectall_exec` → `animchannels_selectall_exec` so
that it matches the operator `ANIM_OT_channels_select_all`.

No functional changes.
2020-10-15 14:04:14 +02:00
d6fd03616e Fix part of T74918: 3D Viewport: Jump, when mouse crosses a window corner.
We need a separate time stamp for each axis, and we have to add a few
milliseconds of padding to those, to ensure wrapping on both axes get
properly performed when it happens almost simultaneously, and avoid
extra wrapping caused by very close events sometimes.

This only addresses the Linux (X11 backend) case.

Differential Revision: https://developer.blender.org/D9209
2020-10-15 13:55:09 +02:00
f1aa55b6e9 Cleanup: rename BPy_GetContext -> BPY_context_get
Matching BPY_context_set.
2020-10-15 19:00:17 +11:00
5531697f6d Cleanup: remove duplicate context variable (__py_context)
The context was stored both in __py_context & bpy_context_module.

This avoids duplicate functions to update them too.
2020-10-15 19:00:16 +11:00
Janusch Patas
1cc3abca70 Fix T80768: Subdivision Surface modifier uses viewport subdivision settings when rendering in edit mode
Being in render 'context'was not taken into account in code evaluating
modifiers for meshes in Edit mode.

Reviewed By: #modeling, mont29

Differential Revision: https://developer.blender.org/D9217
2020-10-15 09:46:22 +02:00
7b951ba5c3 Cleanup: Do not compare bool value to 0. 2020-10-15 09:31:40 +02:00
1001adb500 Fix T81520: Crash setting the Cycles device from Python 2020-10-15 16:53:38 +11:00
4bea4702d5 PyAPI: throw exception when cycles is given an invalid device name 2020-10-15 16:35:41 +11:00
c0dde8be84 Cleanup: defer importing '_cycles' in properties.py
This was imported already in nearly all usage.

Also use static-set for string comparison.
2020-10-15 16:25:26 +11:00
aca8640b12 Cleanup: use defined sizes when accessing file date/time
Also add static assert for struct size assumption.
2020-10-15 10:54:06 +11:00
a509e79a4c Cleanup: Comment formatting, grammar 2020-10-14 15:04:49 -05:00
11a8a6d0e6 Fluid: Add phystype to fluid particle settings
When creating a particle system to display simulated particles, the phystype needs to be set to 'no physics' so that particle positions are just copied and not integrated.
2020-10-14 21:58:58 +02:00
Juanfran Matheu
53792e32e7 UI: Show more information in open file tooltip
This shows the file's full path, its modification date, and its size in
the tooltips for the open recent fiels menu. When no file path is set,
the original operator description is used.

Differential Revision: https://developer.blender.org/D9028
2020-10-14 13:57:31 -05:00
adc0291061 Fix T81633 Workbench: TAA never resolve when enabling both X-Ray and cavity
This was caused by a wrong flag equality check when in xray mode because
the xray mode was masking the effect option flags that are not supported
in this mode. This means the never passed and the TAA was reset before
every redraw, leading to infinite rendering.
2020-10-14 19:26:44 +02:00
57de568604 Fix T81004 Python: Images drawn in the Sequence Editor have wrong colors
This was caused by the sequencer using a sRGB buffer without using
the sRGB transform.

This patch make it so that the framebuffer is rebound using the
sRGB transform before the python draw callbacks.
2020-10-14 18:53:41 +02:00
3271074120 GL: FrameBuffer: Set GL_FRAMEBUFFER_SRGB if needed
This makes possible to rebind the same GPUFrameBuffer to enable or
disable sRGB encoding transform.
2020-10-14 18:53:41 +02:00
4fa4245464 PyDocs: GPU Module: Examples: convert all gl_FragColor variables to FragColor
Based on D6425 by @robbott

Differential Revision: https://developer.blender.org/D6425
2020-10-14 11:18:36 -04:00
50d78116cd Fix warning for duplicate field in DNA defaults
Caused by a typo in rBd3b59d1358424371. Thanks to @ankitm for reporting.
2020-10-14 10:09:28 -05:00
1cf8a4e5ea Fix Asan warning in property editor texture tab
When there is no active texture, a NULL pointer was dereferenced.
It didn't crash because the dereference was for the first item at the
pointer, the ID. To fix this, return with no data when `texture is NULL.
2020-10-14 10:00:24 -05:00
fecb276ef7 UI: New option to invert search filter in Dopesheet
A lot of animator request an option to invert the filter of the dopesheet channels. This patch adds that invert filter option. This is not for Grease Pencil only, affect to all modes.

{F8983328}

Note: I have seen the new button has a rounded borders on the left. It would be better get rectangle shape, but not sure how to do it.

Reviewed By: campbellbarton, pepeland

Maniphest Tasks: T81676

Differential Revision: https://developer.blender.org/D9182
c68a2a
2020-10-14 15:24:52 +02:00
459618d860 UI: Change Invert Filter icon for UIList
This makes the icon equals to the invert icon used in all modifiers.

{F8986444}

Reviewed By: #user_interface, Severin, Blendify

Differential Revision: https://developer.blender.org/D9194
3bb3b2
2020-10-14 15:24:52 +02:00
9d2222b7d1 Cleanup: Use enum for return type
This just follows up rB90a27d5aa91a1 with a few changes where
changes were missed.
2020-10-14 07:42:42 -05:00
3e25f70ddd Fix compile error in lite build after recent commit
Mistake in my own commit rBd3b59d1358.
2020-10-14 07:39:59 -05:00
0d52504dff BLI_ghash_performance_test: Fix memory leaks
Reviewed By: mont29

Differential Revision: https://developer.blender.org/D9210
2020-10-14 18:05:47 +05:30
d3b59d1358 Cleanup: Use DNA defaults for fluid modifier
This will make the "Reset to Default Value" operator in button right
click menus work for the fluid modifier. Before they always reset
the values to 0.

Differential Revision: https://developer.blender.org/D9206
2020-10-14 07:14:51 -05:00
a181b15639 Tests: use environment variable for leak sanitizer
Don't override other `LSAN_OPTIONS` like suppression file set in
the environment variable.

Old code added in {rB38ff5064b33ccb8} and {rB5f4e99b7a2b8376}

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D9207
2020-10-14 16:53:49 +05:30
5edba9b42f Fix T81688: BPY_thread_save crashes with Python 3.9
Calling PyEval_ReleaseLock() was crashing with Python 3.9
because it accessed the NULL pointer set by PyThreadState_Swap().

This happened when calling ViewLayer.update() for example.

While the existing logic could be fixed by swapping the thread-state
back before calling PyEval_ReleaseLock(), this depends on functions
which are tagged to be removed by v4.0.

Replace use of deprecated functions by calling PyEval_SaveThread(),
instead of inlining the logic, using _PyThreadState_UncheckedGet()
to prevent Python aborting.

The call to PyEval_ThreadsInitialized has been removed
as threads are now initialized with Python.
This could be replaced with Py_IsInitialized() however it doesn't look
like this is necessary.

This is compatible with Python 3.7 & 3.9.
2020-10-14 18:52:02 +11:00
2d4f1afece Cleanup: reduce indentation level in bpy_class_validate_recursive 2020-10-14 16:21:13 +11:00
0133bcaf38 Fix crash starting Blender with Python 3.9
In 3.8 and older the class held a reference to methods,
this is no longer the case in 3.9.
2020-10-14 16:15:44 +11:00
cb40edf63a Fix T81686: Confusing add menu in pose mode 2020-10-14 15:39:56 +11:00
c7cd74fac3 Cleanup: multi-line comment blocks 2020-10-14 15:24:42 +11:00
863b38d708 Cleanup: commented includes 2020-10-14 15:12:40 +11:00
862b5b1842 Fix T81511: Loop-cut overlay doesn't follow deformed cage
With constructive + deform modifiers, loop-cut visualization
wasn't following the displayed mesh.

This now gets the coordinates from the cage when available.
2020-10-14 14:49:22 +11:00
deca7c7954 Cleanup: spelling 2020-10-14 14:43:54 +11:00
2cc7be3e49 Fluid: Removed fluid levelset argument from pressure solve
It seems that this was causing the instabilities at slanted obstacles (with secondary boundary (fractional) collisions enabled) ...
2020-10-14 00:29:43 +02:00
3d1b5e35bd Fluid: Enabled OpenVDB precision argument
This way particles can be saved with the custom OpenVDB precision options that were introduced in the latest Mantaflow update.
2020-10-14 00:29:43 +02:00
2ec07dfa18 Fluid: Update Mantaflow source files
Updated files includes:
- Fix for smoke / fire emission from particles
- Custom precision for liquid particles when saving in OpenVDB format
2020-10-14 00:29:43 +02:00
5f49f818d6 Fixes T81670: Sculpt paint vertex colors brush does not switch to secondary color using CTRL
This was just not implemented. Now make this consistent with
vertexpainting / texturepainting.

Maniphest Tasks: T81670

Differential Revision: https://developer.blender.org/D9195
2020-10-13 22:01:58 +02:00
ec9edd36ca Sculpt: Use plasticity for softbody influence
Previously the softbody strength property was controlling the strength
of the constraints that pin all vertices to the original location. This
was causing problems when the forces were trying to deform the vertices
too much, like when using gravity or grab brushes.

Now softbody is implemented with plasticity, which creates constraints to
a separate coordinates array. These coordinates are deformed with the
simulation, and the plasticity parameter controls how much the
simulation moves the coordinates (plasticity 0), or the coordinates move
the simulation back to its previous position (plasticity 1).

This creates much better and predictable results and adding softbody
plasticity to the brushes can increase its control and the stability of
the simulation.

Reviewed By: sergey, zeddb

Differential Revision: https://developer.blender.org/D9187
2020-10-13 21:53:07 +02:00
9722e369cd UI: Motion Tracking: Make Lens a subpanel of Camera
The camera presets control lens settings too so these setting should be 
part of the camera panel.
2020-10-13 15:47:36 -04:00
a36f02f9ba Fix (unreported) LibOverride: possible uninitialized return variable. 2020-10-13 20:38:04 +02:00
72cfeb2c4e Fix T81674: LibOverride: 'Define Override' UI operation can crash.
Case where RNA is not able to generate a proper path for a property was
not taken into account properly.
2020-10-13 20:38:04 +02:00
be3841b1bf Cleanup: Use doxygen sections in space_buttons.c 2020-10-13 13:23:57 -05:00
7c633686e9 Property Search: Find results in all tabs
This patch enables property search for all tabs in the property editor.
To make interaction faster, if the editor's current tab doesn't have a
result, the current tab changes to the next tab that has a match.

This patch implements basic code that only searches panels.
While we could run the existing "single tab" property search for every
tab, that would also do everything else related to the layout pass,
which would be less efficient, and maybe more complicated to maintain.

The search match status for every current tab of the property editor is
stored in a runtime bitfield and them displayed later by dimming icons
in the tab selector panel to the left. Using `BLI_bitmap` properly in
the runtime struct required moving it to `buttons_intern.h` and
adding a small API to access the search filter instead.

To make sure the editor isn't influenced by anything that happens while
building the layout for other tabs, most of the context is duplicated
and the new search is run in the duplicated editor.

Note that the tool settings tab works slightly different than the other
tabs, so I've disabled searching it for this commit. That would be a
relatively simple improvement, but would just require a bit of
refactoring of existing code.

Differential Revision: https://developer.blender.org/D8859
2020-10-13 13:10:41 -05:00
96dd299055 UI: Add highlight arguments to tab buttons
This adds arguments to `uiLayout.prop_tabs_enum` and the C equivalent
(`uiItemTabsEnumR_prop`) to gray out tabs based on a boolean array.

For property search in multiple tabs, we need a way to show which tabs
have a search result, but we still need to show which tab is active.

Differential Revision: https://developer.blender.org/D8858
2020-10-13 12:43:28 -05:00
9fe5817588 UI: Monochrome Alert Icons not changing color until theme refresh
Changing the color of monochrome alert icons would not change until the theme was reloaded.

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

Reviewed by Harley Acheson
2020-10-13 09:35:46 -07:00
b7afcdff7b EEVEE: Motion Blur: Add shutter position option
This makes it easier to generate motion trail effect with EEVEE.

This just mimics the cycles option as described here:
https://docs.blender.org/manual/en/latest/render/cycles/render_settings/motion_blur.html

This fix T80070
2020-10-13 18:09:07 +02:00
ed96c59c20 Fix T80086 EEVEE: Motion Blur: Subframe not taken into account
This is a simple fix that just make it work like cycles. The initial time
was missing the subframe offset.
2020-10-13 18:09:07 +02:00
Eric Cosky
dd3b047f8b Windows/CMake:Support BLENDER_USER_SCRIPTS in IDE
This diff adds support for respecting the `BLENDER_USER_SCRIPTS`
environment variable when setting up the IDE environment.

Previously the scripts from the users profile folder were always
used even when this variable was set, leading to the possibility
of the wrong scripts being visible in the IDE.

Differential Revision: https://developer.blender.org/D9189
Reviewed By: Ray Molenkamp
2020-10-13 08:45:22 -06:00
48b52e06b0 Cleanup: Remove unused properties from node Viewer Region operator
The operator would define the `deselect` and `extend` properties,
without actually using them. It's confusing to have them in the keymap
item UI.
2020-10-13 15:53:27 +02:00
c82d167d81 Cycles: fix missing ShaderNode ownership in render_graph_finalize_test 2020-10-13 15:38:57 +02:00
3bb3b26c8f Cycles: Add CUDA 11 build support
With this patch the build system checks whether the "CUDA10_NVCC_EXECUTABLE" CMake
variable is set and if so will use that to build sm_30 kernels. Similarily for sm_8x kernels it
checks "CUDA11_NVCC_EXECUTABLE". All other kernels are built using the default CUDA
toolkit. This makes it possible to use either the CUDA 10 or CUDA 11 toolkit by default and
only selectively use the other for the kernels where its a hard requirement.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D9179
2020-10-13 15:15:44 +02:00
ae609346ee Fix T81672: Array modifier default merge distance is 0.1m (typo)
Seems to be an oversight/typo in rB83980506957c.
Now set back to 0.01m (as it was before).

Maniphest Tasks: T81672

Differential Revision: https://developer.blender.org/D9193
2020-10-13 14:46:39 +02:00
16289274ed Fix T81656: Crash relocating a linked library into the current .blend
A .blend file cannot use itself as a library.
This is prevented when linking manually, but was still possible when
relocating, which is now prevented.

Maniphest Tasks: T81656

Differential Revision: https://developer.blender.org/D9191
2020-10-13 14:37:17 +02:00
79875e37fe Cleanup: remove redundant assignment in SCULPT_brush_test_init
As discussed in D9120, this was an oversight in rBe0c792135adf, the same
assignment already happens a couple of lines above.
2020-10-13 13:17:01 +02:00
c11ae5cd21 Fix sculpting/painting with viewport clipping and radial symmetry
This was reported for sculpting, the same is true for weightpaint or
vertexpaint though.

When viewport clipping and radial symmetry are enabled, the
'sculpt_brush_test_clipping()' function was not considering radial
symmetry at all, so if the coordinate was outside the clipping planes,
no action would take place. Now the coordinte is brought back to where
the stroke actually happens and that is checked against clipping.

Since other mirroring options while painting/sculpting (as well as
editmode operations with mirroring) usually still take place even if the
mirrored coord is outside the clipping planes, this should also be the
case for radial symmetry.

This grows the 'SculptBrushTest' struct a bit, but should be acceptable?

Fixes T81466

Maniphest Tasks: T81466

Differential Revision: https://developer.blender.org/D9120
2020-10-13 13:17:01 +02:00
3f78569c3e Fix (unreported) liboverride of an object hiding its dependencies.
When we override a whole collection, we want to add non-instantiated
objects to a hidden sub-collection at the end of the process.

However, this makes no sense when instantiating an object, if other
dependencies objects get also overridden on the process, we should just
add them to the same collection owning the root object.
2020-10-13 13:08:41 +02:00
666485f38c CMake/macOS: find ZLib before setting CMAKE_PREFIX_PATH
https://devtalk.blender.org/t/building-blender-on-macos-fails/15756/

In some cases, CMake finds the Zlib supplied with OpenCollada
pre-compiled libraries, and not the system one.
2020-10-13 16:34:43 +05:30
6b21b82704 Fix (unreported) broken 'make override' of objects in master collection.
Master collections are not in Main list of collections, so we also need
to check the scenes.
2020-10-13 12:26:44 +02:00
7d5d567dba Cleanup: Fix typo in function name. 2020-10-13 12:17:50 +02:00
344c001eae Fix T81669: Vertex size in UV Editor changes using Face Dot Size in themes
Probably copy-paste error in rBd6525e8d133b.

Maniphest Tasks: T81669

Differential Revision: https://developer.blender.org/D9190
2020-10-13 11:51:18 +02:00
211d7ff3cf Fix T81288:Select Linked fails with multi-object edit mode
Changing options after using select-linked didn't work
when the object being selected wasn't the active object.
2020-10-13 16:59:38 +11:00
65965a892f Cleanup: use BKE_fcurve_ prefix for keyframing bezier functions
- BKE_bezt_subdivide_handles -> BKE_fcurve_bezt_subdivide_handles
- binarysearch_bezt_index -> BKE_fcurve_bezt_binarysearch_index

These functions are specific to F-Curves and don't make sense for other
uses of BezTriple (curve-object data for e.g.)

Also:

- Move detailed doxygen comment above code, following code-style.
- Mark bezt_add_to_cfra_elem unused.
2020-10-13 16:46:41 +11:00
8335c26119 Fix T81467: Crash with KD-Tree Weld Modifier
The problem is related to the `use_index_order` option of `BLI_kdtree_3d_calc_duplicates_fast`.
With this option, the higher index is expected to be less than `tree->nodes_len`.
2020-10-12 20:29:15 -03:00
8427e02abc Fix T81589: Correct drag type handling in outliner
Blender crashed when dragging and dropping color into the outliner.
This issue was cause by a missing check for the correct drag type
in `datastack_drop_poll`. The check is added in this commit.
Additionally, a new drag type is introduced for the "data stack"
drag option, that was introduced in commit 1572da858d, to
differentiate it from the existing WM_DRAG_ID type.

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D9169
2020-10-13 01:17:36 +02:00
Yevgeny Makarov
dc71ad0624 UI: Monochrome Alert Icons and use the Question icon in the Quit dialog
Change to monochrome version of the large alert icons and use 'Question' for the the Quit Confirm dialog box.

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

Reviewed by Pablo Vazquez
2020-10-12 15:51:00 -07:00
1d84881ac1 Cleanup: remove duplicate code
This code segment is exactly the same as above.
Looks like it was copied accidentally.
2020-10-12 21:14:14 +02:00
19dcd32ee5 UI: Remove Hard-coded Default Font Size
Default text output routines (which do not specify a size) will now use Text Style point size.

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

Reviewed by Brecht Van Lommel
2020-10-12 09:53:00 -07:00
1b7458f85a Cleanup: Rename outliner helper function
This name makes more sense and is consistent with related functions
(e.g. `outliner_requires_rebuild_on_select_or_active_change()`).
2020-10-12 18:21:12 +02:00
c1cee363cd Fix T81555: Outliner object state filter not updating correctly
When changing the selected, active or visible object(s), the Outliner
has to be rebuilt while using the corresponding object state filters.

The object hiding operators also have to send the proper notifiers (they
changed visibility without notifying about that).
2020-10-12 18:21:12 +02:00
6f0b082378 Animation: fix assertion failure on unsetting active keyframe
Avoid NULL pointer dereference when checking keyframe selection state in
`BLI_assert()` call.
2020-10-12 17:27:27 +02:00
058a69974a Cleanup: split animchan_sync_fcurve() into smaller functions
Split `animchan_sync_fcurve()` into functions for handling Scenes and
Node Trees.

No functional changes.
2020-10-12 17:00:11 +02:00
5e6c7de3e9 Animation: enforce that the active keyframe is always selected
Check selection state in `BKE_fcurve_active_keyframe_index()`, and only
return the active keyframe index when that keyframe is actually selected.
This is now also asserted in the `BKE_fcurve_active_keyframe_set()` function,
which is now also used when inserting a keyframe.
2020-10-12 17:00:11 +02:00
0d3e192660 Fix T81551: Cycles crash updating volume with modifiers
The volume bounds mesh was being rebuilt too often, it should only be done
when rebuilding the BVH as well, otherwise they can go out of sync.
2020-10-12 16:56:41 +02:00
c68a2a722d Fix T80599 Blender Cloud folder text on the screen very small
This was caused by BLF conflicting with BGL api change.
2020-10-12 15:33:01 +02:00
f56c5245d2 Cleanup: CMake: Remove arguments from endif(..)
No functional change. Added in {rB1f6b7387ad01}
2020-10-12 18:51:48 +05:30
370ed6025f File Browser/macOS: Don't treat .app as directory
While there are other bundles which show up as directories,
`.app` are the most common ones.

*Users should not be saving anything inside .app bundles, nor using
Blender to edit any of the files.
*This declutters the File Browser for say ~/Applications folder
or recursive search on a path with apps.
*Matches Finder's behavior of showing apps as files. (We don't have a
"right click > show package contents" button like Finder though)

This change shows `.app` files like incompatible files, or `.exe`s
on Windows.
{F8970986}

Reviewed By: #platform_macos, brecht, mont29

Differential Revision: https://developer.blender.org/D9162
2020-10-12 18:45:39 +05:30
c4c8d855c6 Libmv: Remove array access from camera intrinsics
That was a suboptimal decision from back in the days, which ended up
being problematic. It is no longer used, so remove it from API making
it so new code does not depend on this weak concept.
2020-10-12 15:12:17 +02:00
ff5e3d6834 Libmv: Fix wrong packing order of intrinsics for BA step
The order got broken when Brown distortion model has been added.
Made it so the indexing of parameters is strictly defined in the
parameter block, matching how parameters are used in the cost
function.

There is some duplication going on accessing parameters. This can
be refactored in the future, by either moving common parts packing
and cost function to an utility function in bundle.cc.
Alternatively, can introduce a public PackedIntrinsics class which
will contain a continuous block of parameters, and each of the
camera models will have API to be initialized from packed form and
to create this packed form.

The benefit of this approach over alternative solutions previously
made in the master branch or suggested in D9116 is that the specific
implementation of BA does not dictate the way how public classes need
to be organized. It is API which needs to define how implementation
goes, not the other way around.

Thanks Bastien and Ivan for the investigation!
2020-10-12 15:12:17 +02:00
86138d88f6 Revert "Fix critical lens distortion bug in libmv after rB3a7d62cd1f5e."
This reverts commit 7e836bde11.

Reverting the incomplete workaround, due to the following reasoning:

- There should be no dependency between CameraIntrinsics and the bundler
  code. This violates intended abstraction of the intrinsics class.

- The fix was not complete, or wrong. Even in the world where there is
  a requirement to the parameters storage size this should have applied
  to all distortion models, including Divisions, Nuke.

Proper fix will be committed next.
2020-10-12 15:12:17 +02:00
df5b65811e Libmv: Fix memory leak in modal solver
The leak was happening when problem did not have any parameters blocks
defined. This happens, for example, if there are no 3D points at all,
or when all markers are set to 0 weight.

Was noticeable in libmv_modal_solver_test when building with LSAN
enabled.
2020-10-12 15:12:17 +02:00
590220e451 Libmv: Cleanup, spelling in function name
Is a local function, not affecting API.
2020-10-12 15:12:17 +02:00
db8a856a74 BLI: support looking up a key from a set or adding it when not existant 2020-10-12 15:10:08 +02:00
662c0ac970 Overlay: Fix Line antialiasing broken for some objects
Fix regression introduced in rBe12767a0352a9e113892b4a07c6c8446d3ff361f

The volumes are not a line type and should not be render into the line
framebuffer nor it should change the framebuffer.
2020-10-12 15:04:28 +02:00
60ba69ffb5 Cleanup: use openvdb matrices properly
Before I was double confused about how openvdb stores its
transformation matrices. Now, I know they have the same layout
physically in memory, but are logically transposed (i.e. the translation
is in the last row instead of in the last column).
2020-10-12 14:24:30 +02:00
e3ad392b98 Animation: always try to match the existing curve when inserting keys
Previously Blender would only match the existing curve slope when the
to-be-inserted key value was already very close to the curve. This check
is now removed, allowing for sliders in the graph editor to subtly
change the curve, and for keyframes added with ctrl+click to follow the
curve better.
2020-10-12 14:02:18 +02:00
aafd71a8a1 Fix T81060: CustomData Correction sometimes breaks UVs and Vertex Colors
`CustomData_bmesh_interp` use the same CustomData decryptor (in this case, `bm->ldata`) in both blocks.

So make sure that all CustomData layers match.

This commit also removes redundant `BM_elem_attrs_copy_ex` calls.

Maniphest Tasks: T81060

Differential Revision: https://developer.blender.org/D9159
2020-10-12 08:57:43 -03:00
ab65fe5a2d Fluid: Use hidden symbol visibility
This resolves a long list of linker warnings that is currently only showing up on macOS arm builds.
The warnings themselves are of this shape (one example):

```
ld: warning: direct access in function 'Manta::MeshDataImpl<Manta::Vector3D<float> >::_W_39(_object, object, object*)' from file '../../lib/libextern_mantaflow.a(mesh.h.reg.cpp.o)' to global weak symbol 'typeinfo for Manta::MeshDataImpl<Manta::Vector3D<float> >' from file '../../lib/libextern_mantaflow.a(mesh.cpp.o)' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
```

Just would like to get your opinion to make sure this is an acceptable way to handle this on all platforms.

Reviewed By: LazyDodo

Differential Revision: https://developer.blender.org/D9002
2020-10-12 12:45:11 +02:00
e8d02359cf Volumes: reduce step and default of strength in Volume Displace modifier
The strength has a high impact on performance. With the previous
step and default one could easily and accidentally make Blender unusably
slow, because of a too high displacement strength.
2020-10-12 12:38:03 +02:00
fc5c5f0636 Animation: avoid WM notification when nothing changed
Avoid WM notification when a dummy channel is clicked in the animation
channel list (dopesheet, graph editor) if that channel has no animation
data.
2020-10-12 12:36:46 +02:00
1db26e1698 Cleanup: Animation, small cleanups on anim channel selection code
Clean up some code by using early returns.

No functional changes.
2020-10-12 12:36:46 +02:00
bfd7840358 Cleanup: Animation, split mouse_anim_channels() into separate functions
Clean up the code that handles mouse clicks on animation channels in the
non-NLA animation editors, by splitting into separate functions.

No functional changes.
2020-10-12 12:36:46 +02:00
7ae78733ef Volumes: use bounding box diagonal to compute adaptive voxel size
Using the diagonal has the benefit, that the adaptive voxel size changes
when the bounding box changes its shape in any way. Having a changing
voxel size looks bad when rendering an animation, therefore one should
usually use a fixed voxel size when rendering an animated volume.
This becomes apparent earlier, when the adaptive voxel size changes
when the bounding box changes in any way.
Otherwise this can easily go unnoticed when rendering only a few frames
of an animated volume.
2020-10-12 12:13:09 +02:00
cf778a9e42 Pydoc: BGL: update links 2020-10-11 20:14:16 -04:00
df3d124e91 Pydoc: Fix bpy.utils submodule showing in main toctree 2020-10-11 18:38:55 -04:00
72335d5e89 Pydoc: Move builtin GPU shader information to code
This fixes a compile warning for sphinx.
This commit includes some reformating of the information.
2020-10-11 18:21:28 -04:00
1b575cbb75 Cleanup: Pydoc strings 2020-10-11 18:19:42 -04:00
e8a2931299 Pydoc: Cleanup: Rename function
The new name makes more sense as the file is called index and we are not 
writing the contents of all rst files
2020-10-11 17:02:41 -04:00
a38c2dcfe6 Pydoc: Add index and genindex to main index 2020-10-11 16:54:52 -04:00
c95ab2c6f0 Pydoc: Remove old note about new module in 2.65 2020-10-11 16:46:21 -04:00
fbcb26fb33 Pydoc: Add submodule heading to submodule lists 2020-10-11 16:09:42 -04:00
c9a9b03204 Pydoc: Fix duplicate totree for freestyle 2020-10-11 15:50:24 -04:00
a0886d1b6e Cleanup: make format 2020-10-11 13:00:49 -04:00
1b04eb6c44 Exact Boolean: let Collection be empty.
With an empty collection, Exact Boolean performs the useful function
of removing self-intersections.
2020-10-10 12:05:09 -04:00
c68338ee89 CMake/macOS/OpenMP: copy the library near tests.
For multi-config generators, tests are in `bin/tests/<config>` folder.
and OpenMP cannot be found at `@executable_path/../Resources/lib`.
So create that folder and put the library there to be used by tests.

It is not ideal to copy the library around. When minimum CMake version
is changed to 3.12, FindOpenMP by CMake can be used for this whole
block of code. Then a nice rpath based solution can be used.
2020-10-10 19:31:03 +05:30
4427a67c86 Cleanup: use macro for comparing file versions
Already done in most of the versioning code.
2020-10-10 22:43:11 +11:00
5336555c31 Cleanup: spelling 2020-10-10 22:04:51 +11:00
d9a43a107f Cleanup: remove unused Modifier stackindex struct member 2020-10-10 22:04:51 +11:00
3fe98a473c Cleanup: remove unnecessary comments 2020-10-10 22:04:51 +11:00
2abfcebb0e Cleanup: use C comments for descriptive text
Follow our code style guide by using C-comments for text descriptions.
2020-10-10 22:04:51 +11:00
c735aca42e CMake/macOS/OpenMP: allow use of LLVM-Clang with OpenMP.
The "Apple" part is guaranteed by the platform file.
"Clang" is enough to differentiate it from other compilers.

Came across this due to the custom built LLVM toolchain I'm using.
2020-10-10 16:28:42 +05:30
7ab8d7c939 Cleanup: Declare variables where initialized 2020-10-09 16:39:39 -05:00
c1394c89a7 UI: Fix incorrect inactive status for curve properties
The "Geometry start & End" panel was grayed when using an object
to create the curve bevel. It should only be grayed out in this case
when no object is chosen in the "Bevel" subpanel.
2020-10-09 16:26:28 -05:00
89491d67d9 Fix T81545: Moving nested collections changes view layer flags
The code that restored collection flags after they are rebuilt when
moving a collection didn't take into account collection children. The
flag for the active collection was properly restored, but all of its
children would take on the exclude flag of the collection the active
collection was dragged into.

This commit builds a temporary tree structure to store the flags for
the moving collection and its children. Then it reapplies these flags
after `BKE_main_collection_sync`.

Differential Revision: https://developer.blender.org/D9158
2020-10-09 16:00:12 -05:00
4173877e87 Cleanup: Declare variables where initialized
Also use LISTBASE_FOREACH macro in a few places.
2020-10-09 15:08:01 -05:00
e6d1c8272e Cleanup: Use LISTBASE_FOREACH macro 2020-10-09 13:51:13 -05:00
32d4623f44 Cleanup: alias: use const, remove unused variable.
`targetIsDirectory` slipped through the code review of
{D6679}/{rBafb1a64ccb81}.
`BLI_is_dir` exists to check for directory status of a file.

Remove some `else-after-return`s.

Use `r_` prefix for return value arguments, and move it to the end
in the list of arguments.
2020-10-09 22:46:39 +05:30
62f5232f37 Fix T81573: Users refcount not incremented when creating a proxy.
Proxies are refcounting usages of objects, historical code was
apparently missing that.
2020-10-09 17:52:49 +02:00
50ffcf12b2 Cleanup: CMake/macOS: remove boost from OIIO libs.
Introduced by me in {rB1f6b7387ad0177c1dec9bb83b7}.
2020-10-09 20:39:58 +05:30
e340f943f5 Fix (unreported) install_deps: broken compilation of OIDN.
When OIDN version was bumped recently the required dependency to build
it (ISPC) was not updated accordingly.
2020-10-09 17:07:16 +02:00
Andreas Bergmeier
9aef0283a0 install_deps: Do not request elevated rights when creating directory in owned directory.
This only creates elevated directory when necessary.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D1596
2020-10-09 17:05:03 +02:00
2d94b0d6b0 GPU: Add more safeguard for BGL calls
This makes sure no BGL call before window drawing locks the GPUState.
2020-10-09 17:00:10 +02:00
16ca295278 Fix New Boolean bug that left some stray vertices.
The routine to find dissolvable vertices had a check to ensure
that the vertex was exactly in line with the two neighbors.
I have convinced myself that this check is unneccesary (it was
failing with only a 1e-9 difference from 0 on a cross check),
so have removed it.
2020-10-09 10:43:07 -04:00
14c53c5018 BGL: fix issues with addons using BGL at startup
This was an issue for Cycles.

This also makes the `GPU_bgl*` functions less fragile by checking for
null pointers.
2020-10-09 16:33:59 +02:00
d39043b5ae Revert "Revert "BGL: Workaround broken bgl usage caused by GPU refactor""
This reverts commit f23bf4cb10.
2020-10-09 16:33:59 +02:00
1f6b7387ad CMake/macOS: Remove _LIBPATH, avoid link_directories.
After tests were bundled in a single executable and cycles and libmv
created their own tests, the warnings on macOS have gone over 800.
The reason is setting `*_LIBRARIES` to names of the libraries
and later using `link_directories` to link them properly.

https://cmake.org/cmake/help/latest/command/link_directories.html

> Note This command is rarely necessary and should be avoided where
> there are other choices. Prefer to pass full absolute paths to
> libraries where possible, since this ensures the correct library
> will always be linked. The find_library() command provides the
> full path, which can generally be used directly in calls to
> target_link_libraries().

Warnings like the following popup for every target/executable,
for every library it links to.
```
ld: warning: directory not found for option
'-L/Users/me/blender-build/blender/../lib/darwin/jpeg/lib/Debug'
```

The patch completes a step towards removing `link_directories` as
mentioned in TODO at several places.
The patch uses absolute paths to link libraries and removes
all `*_LIBPATH`s except `PYTHON_LIBPATH` from
`platform_apple.cmake` file. (The corner case where it's used seems
like dead code. Python is no longer shipped with that file structure.)

Also, unused code for LLVM-3.4 has been removed.
Also, guards to avoid searching libraries in system directories have
been added.

`APPLE` platform now no longer needs `setup_libdirs`,
`cycles_link_directories`, and `link_directories`.
The number of warnings now is less than 100, most of them being
deprecation ones in dependencies.

This patch depended on {rBb746179d0add}, {rB2fdbe4d05011},
{rB402a4cadba49} and {rBd7f482f88ecb}.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D8855
2020-10-09 19:41:58 +05:30
83e91485d0 GPU: Fix NOT ~ operator for eGPUSamplerState
The real maximum was `GPU_SAMPLER_ICON`, not `GPU_SAMPLER_REPEAT`, my
bad. {rBa31a87f8943aa40}

Move `GPU_SAMPLER_MAX` out of the enum since it's used as an `int`
at many places.
Also, the macro `ENUM_OPERATORS` needs a maximum, and this enumerator
cannot be used as the argument of that macro. It creates wrong values
in the `~` NOT operator.

Thanks @deadpin for catching this.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D9157
2020-10-09 17:35:23 +05:30
701fc52cc6 Volumes: lower minimal voxel size in Mesh to Volume modifier
The 0.1 limit was too large. The issue with making it smaller is that
one can easily crash blender by making it to small. To counteract this,
the step has been reduced as well.

A voxel size/amount of 0 disables the modifier.
2020-10-09 12:55:13 +02:00
2f339eb745 BKE: improve calculating edges
This is a follow up commit for rB309c919ee9.
Clearing hash tables is now parallelized as well. Surprisingly, most of
the time is actually spent in `free` (a couple of milliseconds per call
in my test).

Benchmark of individual functions:
reserve_hash_maps: 17%
add_polygon_edges_to_hash_maps: 49%
serialize_and_initialize_deduplicated_edges: 12%
update_edge_indices_in_poly_loops: 14%
clear_hash_tables: 5%
2020-10-09 12:37:42 +02:00
309c919ee9 BKE: parallelize BKE_mesh_calc_edges
`BKE_mesh_calc_edges` was the main performance bottleneck in D9141.
While openvdb only needed ~115ms, calculating the edges afterwards
took ~960ms. Now with some parallelization this is reduced to ~210ms.

Parallelizing `BKE_mesh_calc_edges` is not entirely trivial, because it
has to perform deduplication and some other things that have to happen
in a certain order. Even though the multithreading improves performance
with more threads, there are diminishing returns when too many threads
are used in this function.

The speedup is mainly achieved by having multiple hash tables that are
filled in parallel. The distribution of the edges to hash tables is based on
a hash (that is different from the hash used in the actual hash tables).

I moved the function to C++, because that made it easier for me to
optimize it. Furthermore, I added `BLI_task.hh` which contains some
light tbb wrappers for parallelization.

Reviewers: campbellbarton

Differential Revision: https://developer.blender.org/D9151
2020-10-09 11:56:12 +02:00
963b45f574 Fix T81468: Missing NULL check for F-curve rna_path in versionning code. 2020-10-09 09:47:40 +02:00
Yevgeny Makarov
07bd16de5b UI: Fix node label overflow on high-DPI
Ref D9099
2020-10-09 18:20:50 +11:00
Andreas Bergmeier
2a39b6d4d1 Cleanup: spelling
Ref D9138
2020-10-09 18:08:38 +11:00
774905f7e8 CleanUp: Introduce eMeshBatchDirtyMode enum
It used to be an int mode.
2020-10-09 07:27:18 +02:00
048c5580c2 Revert "CleanUp: Introduce eMeshBatchDirtyMode enum"
This reverts commit 0796807720.
2020-10-09 07:25:43 +02:00
Yevgeny Makarov
b96f1f8091 UI: use Ctrl-TrackPad to cycle values
Minor change missing from 9bfea67751

Ref D8530
2020-10-09 14:04:34 +11:00
f735491b9f PyDoc: Set max width to 1000px
While not full width this gives a nice trade off between improved screen 
use space and readibility.
The old value was 80 so this gives 25% more screen space.

See T73223
2020-10-08 21:37:28 -04:00
decb3b10aa Cleanup: operator execution types didn't read well on one line 2020-10-09 12:14:22 +11:00
afc090f339 Cleanup: spelling 2020-10-09 12:12:29 +11:00
05710171cb PyDoc: resolve duplicate module warnings
Remove submodule listings from the module docstring,
as this information already exists in the generator.
2020-10-09 12:11:00 +11:00
c69df6728a Cleanup: use real-module for 'bmesh.ops'
Replace module-like object with Python module,
this simplifies checks for generating API docs and is more correct.
2020-10-09 12:11:00 +11:00
2d5e38d4ec Cycles: fix incorrect default value for node array socket type 2020-10-09 00:15:24 +02:00
70634ba438 Cycles: fix incorrect asserts in node socket set functions 2020-10-09 00:15:24 +02:00
3fae33b22c Fix broken compilation after adding particles DNA defaults.
Was failing because of a mismatch between RNA and DNA defaults on
`courant_target` property, removed RNA one (DNA came from initial value
defined in BKE's particle creation code, think it's best to keep that
one).
2020-10-08 23:10:36 +02:00
Yevgeny Makarov
3d4231babf UI: Fix opacity of the popover arrow outline
Due to the old AA method, it was necessary to add transparency to the
outline of the popover arrow to match the box outline opacity. This is
no longer required after rB15dda0115c78.

See the differential for before and after screenshots.

Differential Revision: https://developer.blender.org/D9026
2020-10-08 14:25:22 -05:00
e90638b911 Fix T80974 GPU: Wide Line emulation shader does not always works
This was caused by points well behind the near clip making the
computation of the width wrong.

The fix is to clip the line to the near clip plane.
2020-10-08 21:12:29 +02:00
a31a87f894 T81340: UBSan: load of value .. not valid for GPU enum type
The underlying type of the enum cannot be fixed here due to its usage
in C code.

All the values possible in the width of the underlying type are not
valid for an enum.
Only 0 to (2*max - 1) if all enumerators are unsigned.
So the macro asks for the biggest value among the //listed// ones.
If any enumerator C is set to say `A|B`, then C would be the maximum.
(2*max-1) is used as the mask.

The warnings (for each enum modified in this commit):
GPU_vertex_buffer.h:43:1: runtime error: load of value 4294967291
which is not a valid value for type 'GPUVertBufStatus'

https://github.com/llvm/llvm-project/commit/1c2c9867

Ref T81340

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D9067
2020-10-08 23:14:25 +05:30
569510d704 Fix T81529: Can't move with constraint to a zero-size local axis
To fix the problem, it was necessary to create a fallback for the
zero-sized axis in local orientation.

This also affects the gizmos.
2020-10-08 13:39:41 -03:00
ea5f2f88b3 Cleanup: Move transform_orientations functions to separate header
Improves the organization and identification of the API.
2020-10-08 13:39:41 -03:00
dba0b84359 Cleanup: Simplify transform_orientation_matrix_get
This simplifies obtaining the parameters for internal functions.
(switch was complicating a little)

Also removes ureachable code.
2020-10-08 13:39:41 -03:00
043ddcf3ad Cleanup: Simplify use of 'Snapping Gears'
This commit removes `t->snap[0]` and `t->snap_spatial[0]`.

They were not actually being used, and could add overhead for
transformation without snap.
2020-10-08 13:39:41 -03:00
196d6166e5 Refactor CustomData interpolation code.
- Move some security checks outside of `interp` callbacks.
  Namely, that we do get interpolation weights, and have something to
  interpolate.
  Some callbacks where not checking on those anyway, safer to move that
  up into calling code.

- Cleanup usage of sub-weights, lots of interpolation callbacks wher
  actually using those completely wrong.

- Change default behavior when no weights are given to higher-level API
  functions: prevriously, each callback was responsible to handle that
  case (and one did not even do it!), they were switching to purely
  additive behavior then.
  Instead, we now default to expected simple average of source values.

Note that the only real important change here is defaulting to actual
average of source value when no inertpolation weights are given (afaik,
this only happens in Weld modifier code).

Differential Revision: https://developer.blender.org/D9114
2020-10-08 18:19:24 +02:00
cac0e78aff Cleanup/refactor: move init of ParticleSettings to proper place. 2020-10-08 18:19:09 +02:00
d6f409b862 Add DNA defaults for ParticleSettings. 2020-10-08 18:19:09 +02:00
51e43f27fa DNA: cleanup endian switching when loading file
This patch "modernizes" `DNA_struct_switch_endian` similar to
how I updated `DNA_struct_reconstruct` recently. Furthermore,
some special case handling have been moved to another place.

Reviewers: campbellbarton

Differential Revision: https://developer.blender.org/D9089
2020-10-08 18:17:12 +02:00
f23bf4cb10 Revert "BGL: Workaround broken bgl usage caused by GPU refactor"
This reverts commit f12b0373f3.
2020-10-08 17:58:38 +02:00
Rahul Chaudhary
479dc766b5 UI: Add icons for new sculpt trim tools
This patch adds missing icons for the new trim tools in sculpt mode.
Although these tools recently got "add geometry" modes, it's more
essential to highlight the most important feature of the tool,
trimming, than to try to portray everything they can do.

Differential Revision: https://developer.blender.org/D8963
2020-10-08 10:37:46 -05:00
8f798afbdd Cleanup/refactor: move init of MovieClip to proper place. 2020-10-08 17:19:05 +02:00
d3ba60b132 Add DNA defaults for MovieClip. 2020-10-08 17:19:05 +02:00
Rahul Chaudhary
0eb9027987 UI: Add icons for new face set tools
This patch adds missing icons for the new sculpt face set tools, and
updates the mask icons to be more consistent with the changes.

Currently draw face sets and draw mask icons are inconsistent and don't
relate to drawing/painting masks or face sets. This commit makes the
icons consistent and reusable for future tools like sculpt vertex
colors.

Differential Revision: https://developer.blender.org/D8875
2020-10-08 09:50:03 -05:00
f12b0373f3 BGL: Workaround broken bgl usage caused by GPU refactor
This directly adress the issues caused by rB536c2e0ec916.

Since the state tracking is done at a lower level, using the bgl
functions needs to be safegarded by the state manager.
The current workaround is to bypass `apply_state` when inside a
callback that used a `bgl` function.

Related to T80730.

This fix T81003.

Also this fix the default blend equation for callbacks.
Fixes T80169 T81289.
2020-10-08 16:36:17 +02:00
5f364216ac Cleanup/Refactor: Shapekey: Get rid of BKE_key_copy_nolib()
Once again, no behavioral change expected here.
2020-10-08 16:25:34 +02:00
d7f482f88e CMake/macOS: Avoid passing compiler flags to try_compile.
`APPLE` platform handles ASan compiler and linker flags using
`add_compile_options` and `add_link_options`. {rB74bcb32c9f02}

Arguments in `CMAKE_{LANG}_FLAGS{_CONFIG}` are also passed to
`try_compile` which will fail due to linker errors, since link flags
are not set. `try_compile` is used by `find_package(Boost)` for
`thread` library.

See CMP0066 [1] also.

[1] https://cmake.org/cmake/help/latest/policy/CMP0066.html

Ref D8855
2020-10-08 19:50:43 +05:30
4ee1332bdf Fix T79615: UI: icons and widget emboss look different from earlier versions
Both the default theme and Blender Light have been updated.

Blender Light also includes automatically generated colors based on the
default theme that were not set previously.
2020-10-08 16:17:31 +02:00
70a8498cec Cleanup/refactor: move init of Collection to proper place. 2020-10-08 16:11:56 +02:00
e900f6ed14 Add DNA defaults for Collection. 2020-10-08 16:11:38 +02:00
ef0ef8bcff Hair: Remove warning about undo when Delete Edit
Deleting the particle editmode is fully supported by undo now.
No need to warn the user about that anymore.
2020-10-08 15:00:35 +02:00
b46e828b0c Cleanup/refactor: move default init of armature to proper place. 2020-10-08 13:23:30 +02:00
cbbdfe24af Armature: Add minimal DNA defaults for bArmature.
Using mainly values used in `BKE_armature_add()`.
2020-10-08 13:23:30 +02:00
Andreas Bergmeier
c290e4cbe6 Cleanup: remove unnecessary includes
Differential Revision: https://developer.blender.org/D9148
2020-10-08 12:55:52 +02:00
1cf5ce5e25 Cleanup/refactor: BKE_libblock_alloc -> BKE_id_new in ID creation code.
Better use higher-level code from common ID management when possible.
Helps to de-duplicate logic, and reduces outside usages of more
'dangerous' functions.

Note that we could get rid of many of those `BKE_<id_type>_add`
functions now, but on the other hand several of those take extra
parameters and perform additional actions, so think we can keep them all
for now as 'non-standard ID specific creation functions'.
2020-10-08 12:50:04 +02:00
df5fe9718b Cleanup: Remove BKE_mask_copy_nolib() and BKE_mask_free().
Generic ID management code can now do those local temp copy handling, so
no need for duplicated own code for that.

No behavioral changes expected here.
2020-10-08 11:40:55 +02:00
fdb2240e4d Fluid: Fix particle helper grid export
Only export helper levelset and velocity (belonging to previous state) at the beginning of an (adaptive) frame.
2020-10-08 10:25:32 +02:00
e1900ddcfa Cleanup: use '_' prefix for internal bpy.ops variables
Even though these weren't included in __dir__, they are still accessible
from `vars(bpy.ops)`, use '_' to hint they are private.
2020-10-08 17:55:17 +11:00
79840abf6d PyAPI: use real modules for bpy.ops
Python 3.7x added support for module `__getattr__` & `__dir__`.

Make use of this for operator access,
previously these were module like classes.

No functional changes, this is mostly to use a type which is expected,
rather than faking the type with a class instance.
2020-10-08 17:45:50 +11:00
fb20efae59 PyDoc: fix most of the sphinx-build warnings
Use `.. currentmodule::` instead of `.. module::` for `bpy.types` and
`bpy.ops`. This change fixes most of the errors.

Ref D9139
2020-10-08 16:27:42 +11:00
d37fccab26 Cycles: fix UpdateTimeStats::clear() not resetting total times to zero 2020-10-08 06:41:33 +02:00
0b4aeffda9 PyDoc: support building without sphinx_rtd_theme
This is no longer bundled with sphinx, support building without it.
2020-10-08 12:32:50 +11:00
9c8334acc1 UI: Fix alignment in object type visibility popover
After rBeb911610d05 there are some differences in how the layout code
decides whether to add decorators (aka animation buttons). Whether or
not that logic is correct, it's nice to specify that we don't want them
turned on in this popover.
2020-10-07 19:48:45 -05:00
05d637280c Fix recent update to sphinx_doc_gen.sh
2f1a0f6f0e copied Makefile syntax into a
shell script. Use sphinx-builds 'auto' command to set the number of
jobs to run.
2020-10-08 11:08:36 +11:00
168ab643a5 Cleanup: use doxy sections for fmodifier.c 2020-10-08 10:53:05 +11:00
d8fcd8a316 Fix sculpt raycast function returning wrong value
When sampled normals were disabled SCULPT_cursor_geometry_info_update
was returning false instead of the value from the raycast data.
2020-10-07 23:43:40 +02:00
c4a281e801 PyDoc: Use explicit class names to refence class
This fixes the link and makes it more clear which class the note is 
talking about
2020-10-07 17:25:19 -04:00
d88da4db67 PyDoc: Render in text class name using class link syntax 2020-10-07 17:00:57 -04:00
b8f25dd698 PyDoc: Fix typo in extern audaspace documentation
A PR has also been sent upstream:
https://github.com/neXyon/audaspace/pull/33
2020-10-07 16:17:22 -04:00
021b94f27c PyDoc: Fix sphinx warnign from missing newline 2020-10-07 15:51:29 -04:00
3c045923a2 Cleanup: Remove redundant if-condition 2020-10-07 15:38:20 -03:00
833066088e Fix T81480: Input 0 to scale in redo panel resets to 1
Checking if `t->values[i] != 0.0f;` is not the best solution for all
transform cases.
2020-10-07 14:31:25 -03:00
fec5c12ac8 Cleanup: inconsistent parameter name
Found by clang-tidy.
2020-10-07 18:13:14 +02:00
253dbe71dc Refactor: remove BKE_<id_type>_copy functions.
Those were only shallow wrappers around `BKE_id_copy`, barely used (even
fully unused in some cases), and we want to get rid of those ID-specific
helpers for the common ID management tasks. Also prevents weird custom
behaviors (like `BKE_object_copy`, who was the only basic ID copy
function to reset user count of the new copy to zero).

Part of 71219.
2020-10-07 18:05:06 +02:00
03ef0cfe3c Refactor BKE_id_copy to return the new ID pointer.
No reasons to keep the new ID pointer as parameter here.

Part of T71219.
2020-10-07 18:05:06 +02:00
7c9131d11e Refactor BKE_id_copy_ex to return the new ID pointer.
Note that possibility to pass the new ID pointer as parameter was kept,
as this is needed for some rather specific cases (like in depsgraph/COW,
when copying into already allocated memory).

Part of T71219.
2020-10-07 18:05:06 +02:00
1f50beb9f2 Volumes: new Volume Displace modifier
This modifier uses a 3D texture to displace a volume.
For now, this can only use the previously existing texture system,
because we do not have a better alternative yet. Still, the results
can be quite good and interesting. See D9075 for some examples.

Reviewers: brecht, simonthommes

Differential Revision: https://developer.blender.org/D9075
2020-10-07 18:04:19 +02:00
b8638b6491 UI: Fix Incorrect Workspace Tab Sizing
Changes Workspace tabs so that the text size and tab width are both set by style.widget.points.

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

Reviewed by Julian Eisel
2020-10-07 08:59:13 -07:00
5e2a60a003 Fix T81171: Show Alerts at Center in Statusbar
Move position of Alerts and Progress bar back to the center of the Statusbar.

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

Reviewed by Brecht Van Lommel
2020-10-07 08:41:44 -07:00
Jeroen Bakker
7c373555fd Fix T81254: Incorrect calculation of EEVEE Transmittance Volumetrics
Regular rendering uses a custom blend mode, but render passes renders to
2 separate textures. This wasn't configured correctly inside the
fragment shaders. This patch adds a switch to configure the fragment
shader with the correct attachments.

Backport to Blender 2.83.

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D9038
2020-10-07 17:26:37 +02:00
Jeroen Bakker
afab33e0b9 UV/Image Editor: Overlay Popover
The overlay options in the image/uv editor is hidden in side panels and menus. Sometimes this panel is even hidden, while still useful.
The goal of this task is to introduce an overlay pop-over just like the overlay-popover of the 3d viewport.

Popover has
* UV Stretching (only available in the UV mode, when active object mode is a mesh and in OB_EDIT mode)
* Display As (only available in the UV mode, when active object mode is a mesh and in OB_EDIT mode)
* Show Modified (only available in the UV mode, when active object mode is a mesh and in OB_EDIT mode)
* Show UV Edges (including opacity slider; available UV, View, Paint, when active object mode is a mesh and in OB_EDIT mode)
* Udim tiles when no image is available.

Like the 3d viewport, there will be a editor toggle to enable/disable the overlays

For compatibility reasons the RNA properties are added to both the `SpaceImage.uv_editor` amd `SpaceImage.overlay`. On DNA level they are still stored in the SpaceImage. only new properties are added to the SpaceImageOverlay struct. During the next major release we could remove these options from `SpaceImage.uv_editor`. This should be noted in the Python section of release notes.

Reviewed By: Julian Eisel, Pablo Vazquez

Differential Revision: https://developer.blender.org/D8890
2020-10-07 17:15:17 +02:00
fc767502dc Python API: add volume.grids.save(filepath) to save grids and metadata to disk
Particularly useful now that we can dynamically generate volume using
modifiers. Not exposed in the user interface currently, but it can be used
by add-ons that need to export an entire scene including volumes.
2020-10-07 17:11:09 +02:00
0ea4aab55e Fix T81490: GPencil merge layer duplicated all strokes
There was a wrong duplication of all strokes and this accumulated all previous data for each frame.

Also a cleanup has been done in order to clarify what means each variable.
2020-10-07 17:09:53 +02:00
2f1a0f6f0e PyDoc: Multithread sphinx-build
Compile times went from over 5min to under 2 on my laptop.
2020-10-07 10:25:46 -04:00
e748abda92 PyDoc: Remove workaround for slow sphinx builds
Tesing with newer versions of sphinx to directory `sphinx-build` is 
executed has no affect on the build time. Testing even gave a 2-3% speed 
boost.
2020-10-07 10:25:46 -04:00
e3a0e57542 CleanUp: DrawManager Balanced alloc/free of surface_per_mat cache
The alloc was done in the init, but the free was done in the discard.
As discarding can happen more often there were some unneeded if
statements to work around use after free.

This patch moves the free to the `mesh_batch_cache_clear` and removes
the if statements to check for use after free.
2020-10-07 16:18:12 +02:00
0796807720 CleanUp: Introduce eMeshBatchDirtyMode enum
It used to be an `int mode`.
2020-10-07 16:18:12 +02:00
Yevgeny Makarov
13391038a5 Fix / cleanup panel category tab drawing
The panel category tabs (In the 3D view N-panel) did not look great
when zoomed in or with high DPI screens, with multiple overlapping
outlines, and roundness that didn't match elsewhere in Blender. In
addition, there was some unecessarily low-level drawing code in the
panel code.

This commit uses an existing function `UI_draw_roundbox_4fv`to draw
the tabs instead. There are some slight visual differences, though
these are easily adjusted with theme colors.

Differential Revision: https://developer.blender.org/D9045
2020-10-07 08:53:59 -05:00
983ad4210b Fix T76595: Indicate the Active Keyframe in Graph Editor
In the graph editor there is a panel that says "Active Keyframe" for
numerically editing a keyframe's values, but in the code there is no
concept of the "active keyframe." Since this is a useful concept to
have for some other features anyway, this commit adds an active
keyframe index value to FCurves. It also displays it with a theme
color for the active vertex (which didn't exist before) if the
FCurve is active.

The active keyframe in the graph editor is treated similarly to the
active vertex in the 3D view. It is the keyframe most recently selected
with a single click, and it is always selected.

For now, the only real functional change is that the active keyframe
appears in white and it should be more predictable which keyframe is
being edited in the sidebar panel.

Differential Revision: https://developer.blender.org/D7737
2020-10-07 08:27:58 -05:00
ef235b0f17 Cleanup: improve integer types
Reviewers: mont29, brecht

Differential Revision: https://developer.blender.org/D9135
2020-10-07 15:24:12 +02:00
Yevgeny Makarov
1780f64dc3 UI: Improve labels in "Convert To" menu
Move the information about the type of the source objects to the item
descriptions instead of the names. The extra information in the names
made the labels cluttered, and it's less important information.

Differential Revision: https://developer.blender.org/D8352
2020-10-07 08:17:16 -05:00
Yevgeny Makarov
494ffd2f95 UI: Fix capitalization in various places
Follow the MLA style, agreed upon in T79589. This means "from" within UI
labels should be lowercase.

Differential Revision: https://developer.blender.org/D8345
2020-10-07 08:04:53 -05:00
Yevgeny Makarov
0fd06b535c UI: Use property split in various pop-up dialogs
The settings in these popups are not animateable, so also turn off
property decorate. And also use better widths in order to fit the
full text.

Differential Revision: https://developer.blender.org/D9060
2020-10-07 07:49:12 -05:00
Yevgeny Makarov
f948459f12 UI: Reduce item padding in the gpencil edit context menus
Aligning the columns removes unecessary white space.
The same as in the D8480 / rBb2e0c8f902fa.

Differential Revision: https://developer.blender.org/D9111
2020-10-07 07:40:34 -05:00
a81b059f1d Fix T79184: Specular highlight turns object black on some studio lights
This case was leaving some data uninitialized, producing some NaNs in the
fragment shader.
2020-10-07 14:09:08 +02:00
4ea3f3b316 GPU: Fix assert when using gpu workaround and SSS + light renderpass
This path makes use of more framebuffers when using the gpu workarounds.
Increase the MAX FBO attachments per texture. Maybe we could use a growing
vector in the future.
2020-10-07 14:09:08 +02:00
76b15e338a GPU: Avoid blit operation modifying the wrong framebuffer during restore
At the end of `GPU_framebuffer_blit` when `prev_fb->bind(true);` is called,
the `context_->active_fb` was not in sync and lead to the wrong framebuffer
being modified by bind function.

This fix T81055 SSS light is missing from the diffuse light render pass
2020-10-07 14:09:08 +02:00
724a4f4676 Fix T81226: Crash opening 64bit files with endian switching
Endian switching when loading 64bit blend files on a 64bit system was
crashing as the endian switching is only applicable when loading
on 32 bit systems.

This crash goes back to 2.7x, it looks like this never worked
all the way back to the first commit.
2020-10-07 21:56:10 +11:00
763cd94b6c Cleanup: Alembic, fix compiler warning about missing declaration
Mark the `has_animated_geom_params()` function as `static`, as it's only
used in that particular compilation unit.

No functional changes.
2020-10-07 12:41:55 +02:00
Christoph Lendenfeld
4a633fae8a Fix T67776: Animation/value keyframe slider doesn't appear in dope sheet
Avoid overwriting user-chosen `SACTION_SLIDERS` flag when switching the
Dope Sheet editor to Shape Key mode. The Shape Key mode now ignores the
flag, and always shows the sliders.

The obvious limitation is that you can't hide the sliders in the Shape
Key editor anymore

Reviewed By: looch, sybren

Differential Revision: https://developer.blender.org/D9121
2020-10-07 12:41:55 +02:00
65a6caafce IDTypeInfo: add flag to indicate that ID has no animation data
This is part of T75724.

Reviewers: mont29

Differential Revision: https://developer.blender.org/D9134
2020-10-07 12:35:58 +02:00
e2526e338f Cleanup: add comment 2020-10-07 11:14:38 +02:00
874cf52c10 Refactor: Remove BKE_XXX_localize(), in favor of using regular ID copying code.
Besides the NodeTree case (which remains unchanged), the localize code
is only used in one place (to generate previews of shading data-blocks).

This commit introduces a new `LIB_ID_CREATE_LOCAL` option for ID
creation/copying, which essentially implements the behavior of the
removed `BKE_XXX_localize()` functions into regular mainstream ID copy
code. When this option is set:
- new ID is tagged with `LIB_TAG_LOCALIZED`;
- Some ID copying callbacks have specific behaviors, mainly the root
  nodetree of shading IDs gets duplicated with specialized
  `ntreeLocalize()` function.

Note that I would not consider getting rid of `ntreeLocalize` for now,
this function is recursive, which should ideally never happen within ID
management copying code (this introduces all kind of complications).

No behavioral change expected from this commit.
2020-10-07 11:09:36 +02:00
94f91827f8 Cleanup: IDManagement: Localize: tweak to flags.
Add a specific flag for nodetree deep-copy special localization code.

And add a new `LIB_ID_CREATE_LOCALIZE` flag, similar to
`LIB_ID_COPY_LOCALIZE`, for creation purposes.

No behavioral changes expected here.
2020-10-07 11:09:36 +02:00
449e6124b5 Fix T81330: Alembic Import ignores constant meshes with animated vertex
colors

If the mesh was constant, no check was done if there were animated
vertex colors and thus creation of a MeshSequenceCache modifier was
skipped.

Thx @sybren for feedback!

Maniphest Tasks: T81330

Differential Revision: https://developer.blender.org/D9057
2020-10-07 10:56:48 +02:00
b7ca2365cf UI: Hide fade inactive geometry overlay settings for unsupported modes
If this doesnt work in a particular mode, it would be better to indicate
that in the Overlay popup.

Differential Revision: https://developer.blender.org/D8981
2020-10-07 10:26:32 +02:00
7f7efe78ce Silence CLOG error about usercount of deprecated IPO IDs. 2020-10-07 10:18:45 +02:00
5b97e50976 Fix T81272: Crash on opening old files where nodetrees had no name.
This code gets called before do_version can fix that, so we have to work
around it for now.
2020-10-07 10:18:45 +02:00
084d911010 Fix T81461: Weight paint crash with "Vertex Groups X Symmetry" option
In that case, weightpainting would still be done threaded, but current
mirroring code cannot be run in parallel.

Caused by rB5502517c3c12 [which was checking mesh 'flag', needs to be
'editflag' -- thus test was always true].

Reviewers: pablodp606

Maniphest Tasks: T81461

Differential Revision: https://developer.blender.org/D9126
2020-10-07 10:15:10 +02:00
099ce95ef3 UI: Add auto keyframing popover
For other areas in Blender that have a toggle and related settings,
we put a popover with the settings right next to the toggle. This
combination is nice because it organizes the settings without making
interaction slower. It also makes the settings more discoverable since
they're right next to the toggle.

Differential Revision: https://developer.blender.org/D8537
2020-10-06 15:17:36 -05:00
eb68cd713b Fix T81465: Snapping to edge center doesn't work as expected when using axis locking
The result was being affected by the view alignment correction.

Regression introduced in rB4eda60c2d82d
2020-10-06 16:20:01 -03:00
43ceea30f1 Fix T81488: Deleting an Object Constraint crashes Blender
The edit_constraint_property_get function was using bone constraints
in pose mode even for object constraints. This change mirrors the code
in `uiTemplateConstraints` as well.

Differential Revision: https://developer.blender.org/D9128
2020-10-06 13:07:36 -05:00
55fd7f55bd Fluid: Enable new flood-fill helper function
The flood-fill helper serves as a sanity check for scenes with complex obstacles. Similarly to the holes filler function it ensures that there are no holes in obstacles.

In addition, it ensures that there will be no holes resulting from multiple intersecting obstacles.

In general, this commit should improve stability.
2020-10-06 18:35:13 +02:00
a0ebfab4f3 Fluid: Updated Mantaflow source files
Among code cleanups, this update includes a new flood-fill helper function for levelsets.
2020-10-06 18:35:12 +02:00
2b72860ff4 Sculpt: Union and Join mode for trim tools
This enables a union boolean mode for the trimming gestures tools which
adds geometry to the mesh instead of cutting it.
It also adds a Join mode, which adds the geometry directly without
using a boolean operation.
Depending if you plan to use dyntopo or not, it is useful to have both
options available.

This is using the full depth of the object from the camera view for the
depth of the geometry, but options for controlling the trimming depth in
all modes are going to be added in later patches

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D9066
2020-10-06 18:08:25 +02:00
d43e3f34d2 Fix T81218: Crash in pose mode using a driver on bendy bone Segment
The example file in T81218 has a driver that maps a bone's X-location to
the number of BBone segments. This caused a dependency cycle, which
resulted in bad thread serialisation, which caused the crash.

This patch breaks the dependency cycle `BONE_LOCAL` →
`DRIVER(bones["Bone"].bbone_segments)` → `BONE_LOCAL`. The 'Driver Data'
relation now points to `BONE_SEGMENTS` when the driven property starts
with `bbone_`.

Differential Revision: https://developer.blender.org/D9122
2020-10-06 17:49:57 +02:00
a2b1842358 Batch previews: improve speed of preview generation.
Force multi-threading of preview renders by setting appropriate tile
sizes (by default it would typically render on one or two threads only).
2020-10-06 16:52:09 +02:00
4bb15c8eec VSE: Fix audio strips
When sequencer was moved from kernel, the DEFINES based on audaspace
were not moved along.

That means users had no way of creating new audio strips since
BKE_sequencer_add_sound_strip was ifdef'out
2020-10-06 14:09:47 +02:00
f3fce877b3 Cleanup: Depsgraph, reduce nesting of driver relations code
Reduce nesting of `DepsgraphRelationBuilder::build_driver_data()` by
flipping conditions and `return`/`continue` early.

No functional changes.
2020-10-06 13:47:57 +02:00
1b9de4fa33 BLI: escape double quotes in dot export 2020-10-06 13:35:12 +02:00
6e7617211b UI messages fixes... 2020-10-06 10:38:21 +02:00
7d0139f417 Fix T81459: Memory Leak Cycles Rendered Viewport
The external engine in the draw manager wasn't registered correctly.
This did not free the resources after the external engine was used.
2020-10-06 08:33:42 +02:00
3178dc25f6 Fix T81470: Buttons in closed panel visible during search
The buttons hide when the search finishes based on whether they are in
the "panel header" group. These buttons were not protected with a new
group. This adds a new group for operator button calls, and also makes
it so a new group is always created after the header buttons.
2020-10-05 16:23:21 -05:00
7951312d4b API Doc Gen: Do not ignore objects file
This is used by the Blender manual or other sphinx website that would 
like to link to Blender's API documentation.
2020-10-05 16:26:40 -04:00
ff89d101e7 UI: Changes to Viewport Display UI of Volume Object and Fluid
- Density, interpolation and slicing options in Volume Object's
  Viewport Display are now not aligned to each other as they are not
  closely related.
- Changed the enum property for slicing ('Method') to a boolean
  property 'Slice' and added a sub-panel for slicing options under
  the 'Viewport Display' panel in Volume Object and Fluid for better
  clarity.
- Renamed `axis_slice_method` to `use_slice` in the python API for
  Volume Object and Fluid.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D9097
2020-10-05 23:12:48 +05:30
ffd4601447 Sculpt: Remove mask datalayer after extracting the object
When extracting a mask, the new object is going to have the same mask on
the same vertices, so it can't be sculpted without clearing the mask
first. It makes more sense to delete the mask datalayer from the new
object.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D9070
2020-10-05 19:38:08 +02:00
e1e061384b Fix T81343: Smooth shading normals not updating with line project tool
Just a missing update flag

Reviewed By: mont29

Maniphest Tasks: T81343

Differential Revision: https://developer.blender.org/D9077
2020-10-05 19:37:05 +02:00
a2b517cb11 Sculpt: Modify damping using the simulation factor of the cloth brush
This helps blending artifacts with dynamic simulation areas as the
damping increases when the vertex.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D9084
2020-10-05 19:36:14 +02:00
628dc91c48 Sculpt: Preview the active side of the line gestures
This adds a small gradient to the right side of the line to preview
which side of the mesh is going to be affected by the gesture operation.

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D9106
2020-10-05 19:35:11 +02:00
ca38bce46a Fix T81380: Playback set start/endframe operators can set negative
rendering range

The Allow Negative Frames option, introduced in rB21a2350248fd, allows
for negative frames, but this should only apply for playback and
animations, the rendering range should still be clamped to MINFRAME /
MAXFRAME, because rendering does not allow for negative frames. Preview
range should not be affected afaict (I am not aware of operators that
allow for rendering this range).

Maniphest Tasks: T81380

Differential Revision: https://developer.blender.org/D9112
2020-10-05 18:37:59 +02:00
8bce181b71 Outliner: Move collection exclude button to restrict columns
Move the collection exclude checkbox to be with the other restrict
buttons. This makes the button consistent with the other restrict
buttons, and it makes the visual hierarchy more clear with the contents
of a collection properly indented under the collection name, rather than
the collection icon.

Differential Revision: https://developer.blender.org/D8928
2020-10-05 08:50:33 -06:00
Piotr Ostrowski
eedd7b27f9 Fix T81392: subdivision surface poor shading without limit surface
When the limit surface is disabled OpenSubdiv generates a set of linear
patches which are only C0 continuous, not C1. This makes it impossible to
evaluate derivatives at vertices which, in this mode, are by definition put
at boundaries of patches. Normals are calculated from those derivatives.

Solution is to disable normal calculation and let it be done downstream, as
for other modifiers. This limitation is also the reason that non feature
adaptive subdivision is badly suited for GPU evaluation.

Differential Revision: https://developer.blender.org/D9103
2020-10-05 16:41:43 +02:00
0a0e88b645 Cleanup: Use short for properties editor tab list
Because the active context is stored as a short in DNA it's better
to use short in the code surrounding it. Also adjusted a comment
that reflected an incorrect assumption.
2020-10-05 09:31:32 -05:00
7f3fe5b45c GPencil: Fix unreported Layer SOLO mode broken
During the refactor, this feature was removed by error.

When this option is enabled, only the frames with a keyframe are displayed in Draw mode. This is used when fill an animation to paint only in the frames with real drawing.
2020-10-05 16:02:32 +02:00
54f248fa87 Transform: Use orientation of active object with Auto Constraint
Fix T81429.

This was an intentional change in rBc75a665c442e as it maintains the
same behavior as the constraint with or without modifier.

But from the user's PoV, it is better to keep the old behavior.

This makes drawing and behavior more intuitive.
2020-10-05 10:05:06 -03:00
3df90de6c2 Cycles: Add NanoVDB support for rendering volumes
NanoVDB is a platform-independent sparse volume data structure that makes it possible to
use OpenVDB volumes on the GPU. This patch uses it for volume rendering in Cycles,
replacing the previous usage of dense 3D textures.

Since it has a big impact on memory usage and performance and changes the OpenVDB
branch used for the rest of Blender as well, this is not enabled by default yet, which will
happen only after 2.82 was branched off. To enable it, build both dependencies and Blender
itself with the "WITH_NANOVDB" CMake option.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D8794
2020-10-05 15:03:30 +02:00
Henrik Dick
72e741ee62 Fix T80897: Complex solidify crash when special ngons are merged
This has serious performance implications as the additional check makes
it O(N^2) when there are a lot of merged vertices.
The goal is to move the merging to the weld modifier where it would
be much easier to optimize.

Ref D8946
2020-10-05 23:57:55 +11:00
Henrik Dick
a9dc3fbef8 Fix T80893: Complex solidify special case with singularity
Ref D8929
2020-10-05 23:56:44 +11:00
Henrik Dick
ad16b2c515 Fix T80895: Complex solidify compare edges by content
Even if the index of the edge is not equal the content can be equal
if it has been merged. So compare the content.

Ref D8931
2020-10-05 23:56:12 +11:00
Henrik Dick
35708db5d2 Modifiers: Use vertex group options for complex solidify flat faces
Ref D8945
2020-10-05 23:56:08 +11:00
Henrik Dick
1454865ebb Fix T80269: Match material offset in solidify modes
This commit to complex solidify swaps the side of the geometry which
is affected by the material offset when the normal flip option is
enabled. This matches simple solidify and is considered correct/useful.

Ref D8948
2020-10-05 23:56:02 +11:00
8b72d9cc15 Insert keyframes while preserving shape of curve
Apply the De Casteljau algorithm to split the Bèzier curve at the X
coordinate where the new key is inserted, and uses the result to update
both the newly inserted and surrounding handles.

For curves that use Auto keyframes this has been largely addressed by
the new algorithm from D2884. This commit extends this to non-auto
handles.

This code is heavily based on D3172 by Alexander Gavrilov (@angavrilov).

Manifest Task: https://developer.blender.org/T81353
2020-10-05 14:26:51 +02:00
dfbf868298 Initialize CLOG to fix crashing unit tests
Initialize CLOG in the blendfile-loading unit test superclass. Since
rB8683d4e88f2e CLOG is used by more areas in Blender, and without
initialisation it crashes.
2020-10-05 14:25:46 +02:00
Matt McClellan
1d985159ad Fix Cycles OpenCL failing when extension string is long
This can happen for Intel OpenCL, now support arbitrary string length.

Differential Revision: https://developer.blender.org/D9020
2020-10-05 14:04:06 +02:00
2bbaa8df59 CMake: include DNA_modifier_defaults.h 2020-10-05 23:01:56 +11:00
c129d78039 Fix building without OPENVDB 2020-10-05 23:01:56 +11:00
7e836bde11 Fix critical lens distortion bug in libmv after rB3a7d62cd1f5e.
Current libmv_modal_solver_test fails since rB3a7d62cd1f5e.

It appears that the issue is caused by the insertion of the new OFFSET_K4 parameter,
as, if camera intrinsics are not required to implement/use all of those deform
parameters, they absolutely have to keep order (values) matching those defined
in bundle.cc, otherwise `PackIntrinisicsIntoArray` and `UnpackIntrinsicsFromArray`
will mangle them around.
2020-10-05 11:47:32 +02:00
0026ca09de Revert "Volumes: make Mesh to Volume modifier independent of object transforms"
This reverts commit 66cd82a8d. This was based on a misunderstanding. We do want
to take into account transforms similar to other modifiers like booleans, to
support taking into account animated transforms, combining multiple meshes into
one volume, etc.
2020-10-05 11:20:59 +02:00
a4f8b2ad76 Volumes: more generic way to handle different openvdb types
Reviewers: brecht

Differential Revision: https://developer.blender.org/D9093
2020-10-05 10:29:34 +02:00
3e101759b1 Cleanup: remove arguments to ENDIF in CMake files
This is an old convention that hasn't been used
by Blender or CMake distributed Find* files for a long time.
2020-10-05 16:26:06 +11:00
6d630219ce Cleanup: Declare variables where initialized
Declaring variables where they are initialized and used makes their
scope much more explicit and it aids readility since types are visible.
This commit doesn't touch the ID template code since there is an
active patch in that area.
2020-10-04 22:44:19 -05:00
18d7aeacf2 Move sequencer sources from blenkernel
This is first step of refactoring task T77580.
Next step will be breaking up files into smaller ones.

Reviewed By: sergey, brecht

Differential Revision: https://developer.blender.org/D8492
2020-10-05 02:58:56 +02:00
c514357358 Fix T80397: Select Side not working correctly
Test for side on which strip is was incorrect.
2020-10-05 02:29:47 +02:00
d12ff69320 Rename eSpaceSeq_Proxy_RenderSize members
Remove word proxy from eSpaceSeq_Proxy_RenderSize members if proxy is
not used with that item. Otherwise this can be a bit confusing.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D8861
2020-10-05 02:24:51 +02:00
f375ec4986 Fix T80282: Playback start delayed with AV sync
If current frame is set to before start frame, with AV sync there is
delay when playback is started.

Tag scene with ID_RECALC_AUDIO_SEEK, so audio playback starts from
correct position.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D8809
2020-10-05 02:17:19 +02:00
f4f6fdc268 Cleanup: simplify tempdir_session_create
Remove the need for a temporary allocated path.
2020-10-05 10:07:59 +11:00
659f81f1cb Correct last commit (where_is_temp refactor)
Changes didn't account the case when mkdtemp failed.
Previously the copying the string wasn't needed in this case.
2020-10-05 09:43:57 +11:00
ffa7152626 Cleanup: refactor where_is_temp
Functionality was hard to follow as the meaning of fullname
depended on basename being NULL or not.

- where_is_temp is now only responsible for finding the temp directory.
- Split out tempdir_session_create into it's own function
  that wraps mkdtemp.
- Rename basename to tempdir, fullname to tempdir_session.
2020-10-05 03:04:43 +11:00
1fa6881037 Cleanup: remove outdated comment
Should have been removed in b36a05bb7e,
when Python was started after reading the preferences.
2020-10-05 01:56:29 +11:00
270fb4d82b Preferences: use the users temp directory in background mode
This choice was made when preferences were not read in background mode,
so the temp dir needed to be initialized with something.
See bc9848f7e6.

Now preferences are always read there is no reason to ignore this
particular preference in background mode.

Anyone wanting to do background renders that ignore their preferences
can run with factory startup.
2020-10-05 01:29:08 +11:00
af76063949 Cleanup: BKE_appdir store static values in a struct, clarify names
Avoid multiple static variables with odd names,
instead keep them all in one struct, expand their names for clarity.
2020-10-05 00:55:39 +11:00
16c4db122f Fix error in last commit printing NULL strings
While this works with GCC, printing NULL strings is undefined behavior.
2020-10-04 22:23:48 +11:00
8683d4e88f BKE_appdir: log details about path lookups
These were printf's, disabled by a define that could be uncommented.

Use logging since this can be useful when investigating any issue
with paths not being found at the expected location.

Without this any problem finding app-templates, Python's installation,
icons ... etc are quite difficult to troubleshoot especially on systems
without access to system-call tracing.

To use this run:
  blender --log "bke.appdir" --log-level 3
2020-10-04 22:15:18 +11:00
9d30fade3e Fix color-management ignoring the data-path command line value
Initialize ImBuf (and color-management) after passing arguments
that set environment variables such as `--env-system-datapath`

This also fixes a bug where BKE_appdir logging failed since it was
called before the `--log` argument was passed.

Add asserts so this doesn't happen again.
2020-10-04 22:15:07 +11:00
7456ac6e4b Cleanup: clarify names in appdir
- ver -> version.
- env -> env_path.
2020-10-04 22:12:26 +11:00
6f3a9031f7 Cleanup: BKE_appdir left paths set even when not found
Internally appdir functions would test if a path exists,
returning false if it doesn't, leaving the string set instead
of clearing it.

This is error prone as invalid paths could be used accidentally.

Since BKE_appdir_folder_id_user_notest & BKE_appdir_folder_id_version
depend on this, add a 'check_is_dir' argument so the path can be used
even when the directory can't be found.
2020-10-04 09:33:14 +11:00
d8c3ad6f98 Cleanup: Remove duplicated View2D pan polling logic
Same as 21fc4ae206, but for view panning this time. Also had to set the poll
callbacks still in this case.
2020-10-03 22:15:15 +02:00
806edf11ba Revert part of previous commit
The change to the `poll()` callback was actually incorrect. But also
reduandant, since the function is actually already executed in the operator.
2020-10-03 21:51:50 +02:00
9668fc582c Fix compile error when compiling with WITH_INPUT_NDOF after View2D changes
Actually, fixes compile error and an incorrect poll.

Caused by 21fc4ae206 and 3a1cf838ca.
The poll has to perfrom the `view_zoom_poll()` logic to ensure correct context.
2020-10-03 21:30:38 +02:00
05bf109b52 Fix error in previous commit... 2020-10-03 19:01:12 +02:00
27bcbf19ed Fix possible un-initialized variable use in UI code
Uncovered by a4aa94c41c. Before that, it would actually be a possible `NULL`
pointer dereference.

It would happen if a `UILayout.prop()` was placed with the `full_event` option
set to `True` (or the C equivalent) for a non keymap-item property.
Now this the `full_event` option is ignored then with a warning print.
2020-10-03 18:56:19 +02:00
3a1cf838ca Fix issues with calling View2D zoom operators in an EXEC context
Multiple related issues:
* `view_zoomdrag_exec()` required `view_zoomdrag_init()` to be called first to
  set up data. Can now easily be done in the `_exec()` function as well though.
* Because of that the operators could not be called in an `EXEC_` context (e.g.
  `EXEC_REGION_WIN`).
* With "Zoom to Mouse Position" enabled, zooming from a menu or script would
  zoom to the mouse position. That should only happen if the operators are
  called directly in the editor.
2020-10-03 18:34:23 +02:00
eacaebea83 Cleanup: Remove redundant View2D operator poll check
The poll would already be executed as operator callback, this check was
redundant. Also see previous commit.
2020-10-03 18:34:23 +02:00
21fc4ae206 Cleanup: Remove duplicated View2D zoom polling logic
`view_zoomdrag_init()` would perform a number of sanity checks that
`view_zoom_poll()` already executed. The design of operators forsees that
(non-expensive) context sanity checks are done by the `poll()` callbacks, and
the execution callbacks can then just assume that happened. No reason to be
overly pedantic, we don't do that elsewhere either.

Note that this code is from the earliest days of an operator design. So it's
not surprising that it wasn't using the design "properly".
2020-10-03 18:34:23 +02:00
cb6234fccf Property Search: Set panel expansion when tab changes
This commit makes the panel expansion set based on the search results
when the active tab in the properties editor changes. The multi-tab
search patch (D8859) actually doesn't handle this because it uses a
different code path.

This feature uncovered a subtle but fairly significant issue with the
implementation of property search (More details in T81113). Basically,
the search needed multiple redraws to properly display the expansion of
panels based on the search results. Because there is no animation of
panel expansion when switching tabs, the problem was exposed only now.

With this commit, hiding of "search only" buttons and panel size
calculation happens in a single final step of the panel layout pass.
The "search only" layout root flag is removed. Instead every button
inside a panel header is in a single "uiButtonGroup" marked with a
specific "in header" flag, an idea which could be generalized in the
future.

Differential Revision: https://developer.blender.org/D9006
2020-10-03 11:25:13 -05:00
724370b2f9 Cleanup: use BLI_path_join in appdir.c to simplify logic
Change `test_path` function so:

- Joining paths calls a function instead of being performed inline.
- Optional NULL paths must always be ordered last (easier to follow).

Other minor changes:

- Remove FIXME comment is it's handled properly by BLI_path_join.
- The wrong size was being used copying into `targetpath`.
2020-10-04 00:45:35 +10:00
0bae2662f4 Cleanup: Remove/replace C standard library assert() and header usages
We have our own assert implementation, `BLI_assert()` that is prefered over the
C standard library one. Its output is more consistent across compilers and
makes termination on assert failure optional (through `WITH_ASSERT_ABORT`).

In many places we'd include the C library header without ever accessing it.
2020-10-03 16:10:15 +02:00
e839179b01 Cleanup: Remove dead code in panel logic
The region types checked here were removed from the editors in 9e2abbc9ba and
eb7485389b. So the if-conditions would never be true.
2020-10-03 14:44:31 +02:00
0bf12cb025 Fix error in recent change "run UserDef versioning from readfile.c"
Missed moving the defines in CMake for e255040c77
causing cycles not to be enabled.
2020-10-03 21:55:25 +10:00
44397a683c Cleanup: use doxy sections for appdir.c
Keep related functionality grouped.
2020-10-03 21:12:52 +10:00
f29e9e0d3c Cleanup: comments for appdir
Use doxy syntax & minor improvements.
2020-10-03 21:09:44 +10:00
6b7cbd6493 GPencil: Fix unreported wrong name for RNA setter
The Vertex Group setter function name was wrong for Tint modifier.
2020-10-03 10:59:09 +02:00
0863ae0a58 Cleanup: move temp directory environment checks into a loop
Minimizes ifdef'd code for WIN32.
2020-10-03 18:50:42 +10:00
cacd84a318 Fix invalid temp-dir for image-project on unsaved files
The preferences tempdir being used instead of bpy.app.tempdir.
2020-10-03 18:50:42 +10:00
9b602a8020 Preferences: remove temp directory initialization for WIN32
Revert 76b1a27f96 since there is no
reason windows should behave differently to other platforms.

This was added so Windows users wouldn't see "/tmp/" in the UI.

Since then the default temporary directory is a blank string,
leave blank on all systems as Python script authors may accidentally
use this instead of `bpy.app.tempdir`.
2020-10-03 18:50:35 +10:00
10ae2ea4ae Cleanup: remove unused temp directory initialization
This last worked in v2.27 (2003) where all paths were initialized to "/"
which was still checked to initialize the temp directory.

This hasn't been the case since 932e9e8316
where it changed to "/tmp/", then an empty string (current default).
2020-10-03 18:49:15 +10:00
29a85682a0 Fix stack use after scope error after recent cleanup
An error adding search to an existing button,
caused by my own error in rBa4aa94c41cb79e9.
2020-10-02 21:24:09 -05:00
743eca0f31 UI: Create button group if none exists
This makes it unecessary to create a button group when the block
is created, giving more flexibility when creating the first group-- for
example, creating the first button group with special parameters.
2020-10-02 17:11:44 -05:00
3eab2248c3 UI: Move button groups from layout to block level
For a future patch (D9006) we need these groups for longer than just the
the layout process, in order to differentiate buttons in panel headers.
It may also be helpful in the future to have a way to access related
buttons added in the same uiLayout.prop call. With this commit, the
groups are stored in and destructed with the uiBlock.
2020-10-02 17:00:56 -05:00
28a2c84948 Cleanup: remove unused code in blend file loading
v2.4x could cancel loading files that warned of being a newer,
unsupported version.

Remove this logic since it's no longer in use.
2020-10-03 07:25:36 +10:00
8cd8b3e9bd readfile: always run setup_app_data after updating defaults
When blend files were loaded with app-templates,
setup_app_data was running before defaults were updated.

This is likely to cause problems with order of initialization
so always update the startup file beforehand.
2020-10-03 07:25:36 +10:00
b13459f9e5 Cleanup: rename main preferences versioning function
BLO_version_defaults_userpref_blend -> blo_do_versions_userdef

The name was misleading as it was declared along with
BLO_update_defaults_startup_blend making it seem these functions were
related.

In fact preference defaults don't need to be updated as is done for
startup.blend since an in-memory blend file isn't used.

Rename the function to match other versioning functions
called from readfile.c. Also add/update comments on these differences.
2020-10-03 07:25:36 +10:00
e255040c77 Cleanup: run UserDef versioning from readfile.c
Now versioning UserDef is run in readfile.c,
as is done for other Blender data.

Previously versioning was mixed with other run-time initialization,
so it needed to be called later by the window manager.
2020-10-03 07:25:36 +10:00
15a9579a03 Cleanup: centralize versioning
readfile.c's versioning function was only used for 2 variables.
Move versioning into versioning_userdef.c so everything
is done in one function.

Note: DNA_struct_elem_find checks have been replaced with checks for
the next released version.
This is harmless, as only old preferences saved between releases can
have their values overwritten.

Note: userdef versioning should be called from `do_versions_userdef`,
this will be done separately.
2020-10-03 07:25:36 +10:00
a03bd6460c Property Search: Don't use search color for subpanel titles
This replaces the blue theme color for subpanel titles with the the same
fade as for parent panels.

The search color doesn't work well for subpanel title colors. And actually,
because there are often buttons with checkboxes in the panel headers, we
don't have to treat this indicator any differently than regular buttons.

Differential Revision: https://developer.blender.org/D8976
2020-10-02 13:14:33 -05:00
933bf62a61 Property Search: Differentiate search filtered and inactive buttons
Currently there's no way to know if a button is inactive when it doesn't
match the search results, because they use the same 50% gray level.

This isn't a huge problem, but it could lead to confusion. This commit
uses a subtle solution, a 25% opacity when the button is inactive and
 also filtered by search.

This requires flipping the meaning of the UI_SEARCH_FILTER_MATCHES
flag in the code, and also adding a widget_alpha_factor utility in
the widget code.

Differential Revision: https://developer.blender.org/D8975
2020-10-02 13:10:21 -05:00
6f96dd8576 Fix T78503: Disabled layout portion passes mouse through
3D Viewport -> Sidebar -> View -> Local Camera is disabled. When you
click on it, box select starts. This behavior isn't intended, and fixing
it is quite simple. The only case where this would continuing would
still be desired is if a disabled button overlapped with a non-disabled
button, but this shouldn't be the case anywhere.

Differential Revision: https://developer.blender.org/D8832
2020-10-02 13:06:58 -05:00
a4aa94c41c Cleanup: Declare variables where initialized
Also reduce the scope of some variable declarations.
This also allows making some variables constant.
2020-10-02 13:02:30 -05:00
6b32de4d9f Cleanup: Fix build error on windows
int and eContextResult are different types to MSVC
leading to a function signature mismatch.
2020-10-02 11:47:44 -06:00
38cdc7bcc1 Fix non-thread safe code in view layer object hash
Found as part of D8324, multithreaded Cycles object sync, where it caused
a crash on concurrent access to object holdout state.
2020-10-02 19:42:20 +02:00
350ed861f1 Cleanup: clang-format 2020-10-02 19:31:55 +02:00
cfa101c228 Cycles: Add command line option for overriding the compute device
The current way of setting the compute device makes sense for local
use, but for headless rendering it it a massive pain to get Cycles
to use the correct device, usually involving entire Python scripts.

Therefore, this patch adds a simple command-line option to Blender
for specifying the type of device that should be used. If the option
is present, the settings in the user preferences and the scene are
ignored, and instead all devices matching the specified type are used.

Differential Revision: https://developer.blender.org/D9086
2020-10-02 19:26:35 +02:00
90a27d5aa9 Cleanup: Use enum for return values in context callbacks
Define enum `eContextResult` and use its values for returns, instead of
just returning 1, 0, or -1 (and always having some comment that explains
what -1 means).

This also cleans up the mixup between returning `0` and `false`, and `1`
and `true`. An inconsistency was discovered during this cleanup, and
marked with `TODO(sybren)`. It's not fixed here, as it would consititute
a functional change.

The enum isn't used everywhere, as enums in C and C++ can have different
storage sizes. To prevent issues, callback functions are still declared
as returning`int`. To at least make things easier to understand for
humans, I marked those with `int /*eContextResult*/`.

This is a followup of D9090, and is intended to unify how context
callbacks return values. This will make it easier to extend the approach
in D9090 to those functions.

No functional changes.

Differential Revision: https://developer.blender.org/D9095
2020-10-02 18:56:25 +02:00
0db98b214d Fix T81345: part four, fix handling of IDProperties in edit armature undo.
Specific armature editing undo code would duplicate and store a list of
editbones. However, those are not linked to main data storage and should
therefore never affect ID usercounting.
2020-10-02 17:40:51 +02:00
4b36552967 Fix T81345: part three, armature free_data was not handling editbones properly.
Armature freeing would not correctly free its editbone IDProperties.

Add a utils to free the whole list of edit bones, and properly handle
their potential IDProperties.
2020-10-02 17:40:51 +02:00
f393452394 Fix T81345, part two: crash in depsgraph when freeing COW armature.
Freeing of bones' IDproerties from Armature `free_data` callback would always
attempt to do user refcounting, which should never be done from that code.

This would generate crashes in depsgraph/COW context e.g.
2020-10-02 17:40:51 +02:00
619e52eb82 Fix T81345: Part one: Missing handling of ID pointers from EditBone IDProperties.
So far data management code would simply fully ignore potential ID
pointers in custom properties of edit bones (which are a copy of those
from regular `Bone`). This would lead to all kind of issues, among which
refcounting inconsistencies, missing clearing of data uppon deletion,
etc.
2020-10-02 17:40:51 +02:00
5fc992e76a Cleanup: Move EditBone structure definition from ED to BKE area.
Access to this structure will be needed in BKE's armature code.
2020-10-02 17:40:51 +02:00
e3b49bb850 Fix T81200: Crash on certain armature select operators when OpenGL Depth
Picking is disabled

Affected were (at least)
- Select Linked pick
- Select Shortest Path

Was originally caused by rB8b347fc2cdc6 [which got improved in
rBfc8a7a44b200 - but only partially].

After removal of BONESEL_NOSEL we have to filter out -1 from the hits for
any bone picking it seems (since armature drawing uses this).
In rBfc8a7a44b200, this was done for 'ED_armature_edit_select_pick' (or
'get_nearest_editbonepoint' precisely), now do this for
'ed_armature_pick_bone_impl' as well.

Reviewers: campbellbarton

Maniphest Tasks: T81200

Differential Revision: https://developer.blender.org/D9080
2020-10-02 17:05:03 +02:00
8157305869 UI: Improve UV sticky select mode description
The sticky_select_mode property is an enum where each item has a
different behavior, but currently the description is for a single one
of the items. It should be more general, especially because one of the
items is "Disabled."

A couple more problems:
 - "Automatically" is not so helpful. Many things any program does are
   "automatic", it doesn't really help to say it.
 - "Also" is bad grammar.
 - Overly complex wording

This also adjusts the SHARED_VERTEX tooltip, because "irrespective"
should have "of" after, but it's also unecessarily complex.

Differential Revision: https://developer.blender.org/D9049
2020-10-02 09:17:40 -05:00
c65c4149c9 Cleanup: Refactor ed_screen_context() to use hash lookups
Refactor `ed_screen_context()` to use `GHash` lookups instead of a
sequence of string comparisons. This should provide a nice speedup,
given that the hash for `member` only has to be computed once instead of
matching it to each possible string.

Reviwed by: brecht

Differential Revision: https://developer.blender.org/D9090
2020-10-02 15:42:04 +02:00
ab72406dc3 Cleanup: split up ed_screen_context() into separate functions
Refactor `ed_screen_context()` to call separate functions, instead of
having the entire functionality in one function. Each function now only
retrieves the data it needs from the context. Furthermore, some string
comparisons are removed.

No functional changes.

Reviwed by: brecht

Differential Revision: https://developer.blender.org/D9090
2020-10-02 15:42:04 +02:00
66cd82a8d2 Volumes: make Mesh to Volume modifier independent of object transforms 2020-10-02 15:14:20 +02:00
74ea369830 Experimental Features: More robust way of sanitizing options 2020-10-02 14:05:13 +02:00
cb363953f0 Experimental Features: Sanitize missing (latest) options
There was an oversight when adding new experimental user preferences.
I can try to overengineer this later to make it more fail-proof. But for now
it should be clear what to update when adding a new variable.
2020-10-02 14:05:13 +02:00
92a0ec87a2 Experimental Features: Rename Image editor option
This prevents having multiple UI strings starting exactly the same:
* Legacy A...
* Legacy B ...
2020-10-02 14:05:13 +02:00
5476017d07 CleanUp: Remove header only definition
node_draw_link_straight existed in header files without a body
2020-10-02 13:23:40 +02:00
b5ad69832e Cleanup: reduce variable scopes 2020-10-02 13:05:08 +02:00
dd95a2e1d5 Cleanup: remove redundant theme versioning
All themes older than 2.8x are initialized from the defaults,
there is no need to version them.
2020-10-02 21:00:11 +10:00
d858859402 Cleanup: spelling
Also correct own correction from 58b8724a48
thanks @mont29 for raising this.
2020-10-02 20:41:03 +10:00
d1f6c2e7bb Fix userpref.blend using version from startup.blend
Version patching userpref.blend wasn't using the correct version,
causing settings not to be properly updated.

This seems the likely cause of T70196 and similar bugs.
2020-10-02 20:21:27 +10:00
34228d138b License: Rename GPL2 license to match the name specified in copyright.txt
The license was renamed GPL-license.txt => license/GPL-2.0txt in 0434efa09d.

Although the renaming made all the license files consistent, we are better off
not updating the copyright file in Blender. Instead we can live with some mild
inconsistency in the license names.
2020-10-02 12:18:02 +02:00
2b90dd1ac5 Fix (unreported) assert in texture code when loading some old 2.74 blend file.
Trying to open the 2.74 Fishy Cat file would generate endless asserts in
customdata code. This commit refactors and cleans up the code of
`psys_get_dupli_texture` to avoid useless calls and data access, and
validate data before trying to further access it.

No behavioral changes expected here (besides getting rid of the assert).
2020-10-02 11:47:35 +02:00
062dfab159 Cleanup: readfile for workspaces: NULLify non-owned data pointers.
`workspace_hook` of wmWindows store pointers for runtime data and to
data belonging to other IDs (workspace's layouts). That kind of pointers
should always be cleaned up on read, it allows for cleaner segfault
crash in case of mistakes in code updating/re-setting them, and avoids
potential security issue of accessing random memory address.

No behavioral change expected here.
2020-10-02 11:47:34 +02:00
6219d0d145 Fix (unreported) design flow in how workspace's relation data are read from .blend file.
Relying on pointer addresses across different data-blocks is extremely
not recommended (and should be strictly forbidden ideally), in
particular in direct_link step of blend file reading.
- It assumes a specific order in reading of data, which is not ensured
  in future, and is in any case a very bad, non explicit, hidden
  dependency on behaviors of other parts of the codebase.
- It is intrinsically unsafe (as in, it makes writing bad code and making
  mistakes easy, see e.g. fix in rB84b3f6e049b35f9).
- It makes advanced handling of data-blocks harder (thinking about
  partial undo code e.g., even though in this specific case it was not
  an issue as we do not re-read neither windowmanagers nor worspaces
  during undo).

New code uses windows' `winid` instead as 'anchor' to find again proper
workspace hook in windows at read time.

As a bonus, it will also cleanup the list of relations from any invalid
ones (afaict it was never done previously).

Differential Revision: https://developer.blender.org/D9073
2020-10-02 11:47:34 +02:00
d74d35e39e CleanUp: snode_group_offset -> space_node_group_offset 2020-10-02 11:46:01 +02:00
01698caa66 CleanUp: Renamed drawnodespace -> node_draw_space 2020-10-02 11:41:13 +02:00
63f525bae3 Fix text editor auto-complete refinement feature
Left/right arrow keys can refine the completion,
this wasn't redrawing and there was an off-by-one error checking
the next character.
2020-10-02 17:43:31 +10:00
09082e15d0 Fix text editor auto-complete mouse interaction
- Remove MMB for activating an auto-complete item (use LMB instead).
- Update on cursor motion.
2020-10-02 17:07:35 +10:00
4053fa9fcb Fix invalid version check in 'project_source_info'
Own error in 870fcb3857
2020-10-02 13:46:41 +10:00
6b1bbcd3b0 Cleanup: use raw-strings for regex in console completion 2020-10-02 11:59:16 +10:00
41d2d6da0c Cleanup: pep8 (indentation, spacing, long lines) 2020-10-02 11:59:16 +10:00
bab9de2a52 Cleanup: pep8, blank lines 2020-10-02 11:59:16 +10:00
28ebe827e6 Cleanup: trailing space 2020-10-02 11:59:16 +10:00
e2e31b9bac Cleanup: compiler warnings 2020-10-02 11:58:33 +10:00
edd1164575 Cycles: add time statistics to scene update
Gathers information for time spent in the various managers or object (Film, Camera, etc.) being updated in Scene::device_update.

The stats include the total time spent in the device_update methods as well as time spent in subroutines (e.g. bvh build, displacement, etc.).

This does not qualify as a full blown profiler, but is useful to identify potential bottleneck areas.

The stats can be enabled and printed by passing `--cycles-print-stats` on the command line to Cycles, or `-- --cycles-print-stats` to Blender.

Reviewed By: brecht

Maniphest Tasks: T79174

Differential Revision: https://developer.blender.org/D8596
2020-10-01 23:21:11 +02:00
342bdbc176 Fix warnings in cloth brush int casts
Use POINTER_AS_INT instead

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D9083
2020-10-01 20:47:22 +02:00
c3238bd500 Cleanup: Use DNA defaults for cloth modifier
Followup for rB8398050695
This requires moving a few enum definitions to DNA instead of BKE, and
adding default definitions for the two structs the cloth modifier where
the cloth modifier stores its settings. The defaults are also reordered
to be consistent with the order of each item in the struct.
2020-10-01 12:56:34 -05:00
4c0ef4f788 Cleanup: Clang tidy fixes
Fix a redundant return statement at the end of void function and
an inconsistent declaration parameter names.
2020-10-01 12:45:21 -05:00
Pablo Dobarro
b6f15d5d47 Fix T80873: Grab active vertex preview not working with shape keys
When a Shape Key is active, use the PBVH deformed coordinates for the
preview.

Reviewed By: sergey

Maniphest Tasks: T80873

Differential Revision: https://developer.blender.org/D8921
2020-10-01 19:24:12 +02:00
e41437b16e Fix T81268: Crash when undo from Sculpt Mode to Edit Mode
This was introduced in 6c9ec1c893. The overlays can now be drawn when
PBVH drawing is not enabled, but the PBVH should still exist in the
SculptSession in order to draw them. Before, it was avoiding the crash
by checking use_pbvh as BKE_sculptsession_use_pbvh_draw also checks if
the PBVH exists.

Reviewed By: sergey

Maniphest Tasks: T81268

Differential Revision: https://developer.blender.org/D9044
2020-10-01 19:18:22 +02:00
8fbb6aa4ec Paint: Ignore inbetween events for anchored strokes
When using anchored strokes, inbetween events are not needed since there
is no stroke path to be reconstructed. Handling the inbewteen events are
only producing unnecessary updates, creating performance issues.

Reviewed By: sergey, brecht

Differential Revision: https://developer.blender.org/D9053
2020-10-01 19:13:19 +02:00
Pablo Dobarro
8ef353fa50 Sculpt: Cloth Simulation Dynamic area mode
This simulation area mode moves the active area with the brush. When
enabled, the cloth brush has no restrictions on stroke length, area or
mesh vertex count.

In order to work, this enables PBVH nodes dynamically for simulation as
the stroke location moves and builds the constraints for new nodes
during the stroke. When a node is not inside the simulated area, all the
constraints that were created for it and vertex collisions are not
computed. The simulation limits falloff areas and constraints tweaking
control how the simulated and no simulated nodes blend.

Reviewed By: sergey, zeddb

Differential Revision: https://developer.blender.org/D8726
2020-10-01 19:11:45 +02:00
cd81c38688 Cleanup: typo in comment 2020-10-01 18:38:31 +02:00
84e122e38a Cycles: Fix broken 32 bit shift.
1ul << n will still be a 32 bit integer regardless
of the value of n, given the target here is 64 bits
the upper 32 bits will always be zero. Using 1ull
will yield the expected result.
2020-10-01 10:19:50 -06:00
ec723ad25c remove foreachObjectLink callback
This removes `foreachObjectLink` from `ModifierTypeInfo`, `GpencilModifierTypeInfo`
and `ShaderFxTypeInfo`. There is no need to have both, `foreachObjectLink` and `foreachIDLink`.
There is not code that actually depends on `foreachObjectLink`.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D9078
2020-10-01 18:05:23 +02:00
cbbd5283a3 Cleanup: remove trailing whitespace 2020-10-01 17:59:04 +02:00
365bf103d1 Volumes: support lower resolution in viewport
The adds a new option to simplify volumes in the viewport.
The setting can be found in the Simplify panel in the render properties.

Volume objects use OpenVDB grids, which are sparse. For rendering,
we have to convert sparse grids to dense grids (for now). Those require
significantly more memory. Therefore, it's often a good idea to reduce
the resolution of volumes in the viewport.

Reviewers: brecht

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

Ref T73201.
2020-10-01 17:59:04 +02:00
5b8503425a Fix subdivision surface wrong for non-limit surface and subdivision level 1
Remove the workaround for T59395 that increases the minimal refinement to 2
to work around an OpenSubdiv bug. This bug appears to be fixed in the latest
OpenSubdiv version we are using.

Problem found by Piotr Ostrowski.

Ref D9076
2020-10-01 17:43:41 +02:00
958fc6944f Cleanup: make texture coordinates const 2020-10-01 16:57:00 +02:00
8398050695 Use DNA defaults system for modifiers
As noted in T80164, there are quite a few area of Blender where the
"Reset to Default Value" operator in button context menus doesn't work.
Modifiers are one of them, because the DNA defaults system was never
set up for them.

Additionally, this should make modifier versioning easier. Whenever a
new field is added it should be automatically initialized to the
default value.

I had to make some ordering changes in the following modifiers to work
around an error with `-Wsign-conversion` in the macros:
 - Solidify Modifier
 - Corrective Smooth Modifier
 - Screw Modifier

Some modifiers are special cases and are skipped in this commit:
 - Data Transfer Modifier
 - Cloth Modifier
 - Fluid Modifier
 - Softbody Modifier

Differential Revision: https://developer.blender.org/D8747
2020-10-01 09:38:00 -05:00
551204a17f Cleanup: Remove unused variable 2020-10-01 09:05:29 -05:00
d7af1c7bd9 Fix: Mesh to Volume modifier crashes when object is in edit mode
Bug and fix has been found by dfelinto, thanks.
2020-10-01 15:54:01 +02:00
5e6459ac1c Volumes: copy display settings in BKE_volume_new_for_eval 2020-10-01 15:54:01 +02:00
f79b4850fb Fix T81248: World nodetree action is linked after duplication
This was already changed for Material nodetrees on duplication in
rBa75ac18638f4.
Since it is not obvious from the UI how change World actions - and to be
consistent with Material actions, it is best to copy the action as the
default behavior.
So use generic BKE_id_copy functions with LIB_ID_COPY_ACTIONS flag [which
also enables us to get rid of `BKE_world_copy`]

Note: taking the User Preference `USER_DUP_ACT` into account here (for
both material and world actions) could be a followup step.

Maniphest Tasks: T81248

Differential Revision: https://developer.blender.org/D9046
2020-10-01 15:42:51 +02:00
91f061003c Fix T81267: bad handling of usercount for actions duplicated with some animdata.
Those actions are full proper IDs and should therefore not be affected
by flags used to duplicate 'owner' ID own data.
2020-10-01 15:03:31 +02:00
Martijn Versteegh
f117966c4e Fix T80395: Cycles baking crash when Surfaces are disabled in the view layer
Always enable surfaces for baking, otherwise there is nothing to bake to.

Differential Revision: https://developer.blender.org/D9015
2020-10-01 14:37:59 +02:00
2caa6dd7f8 Cleanup: clang-format 2020-10-01 14:29:45 +02:00
Ivan Perevala
5d824c4212 Fix missing UI elements for the new Brown-Conrady distortion model
Differential Revision: https://developer.blender.org/D9072
2020-10-01 14:25:20 +02:00
fd698782b9 Fx several issues with Outliner's collection editing re linked/override.
Most collection operations should not be allowed when either the scene
or the parent collection are linked or liboverrides.

This commit adds more stricter checks in both polling and execution
aspects of several related operators.

Fix T81282: Crash on instance to scene of a collection of a linked scene.
2020-10-01 14:11:55 +02:00
9f9dbaf22b Fix some inactive modifier properties not being editable
The convention is to keep inactive settings editable even if they are grayed
out for having no effect due to other settings.
2020-10-01 12:13:38 +02:00
Nicholas Rishel
f187256624 Windows: workaround to make Windows Ink tablet API work
Now Wintab is not initialized when starting Blender with the tablet API
preference set to native, since that disables Windows Ink.

Note that changing the tablet API requires restarting Blender for changes
to take effect. This serves as a stopgap to allow use of Windows Ink until
runtime API switching is merged.

Differential Revision: https://developer.blender.org/D9051
2020-10-01 12:05:36 +02:00
Yevgeny Makarov
bcc6baec24 macOS: support for key repeat events in keymaps
Differential Revision: https://developer.blender.org/D8882
2020-10-01 11:53:22 +02:00
63c906e0a7 Fix T81340: UBSan: addition of unsigned offset causes overflow
The warning:
runtime error: addition of unsigned offset to 0x61a0000b22d8
overflowed to 0x61a0000b22b8

Fix T81340 (partially)

Reviewed By: campbellbarton

Maniphest Tasks: T81340

Differential Revision: https://developer.blender.org/D9063
2020-10-01 14:26:45 +05:30
a4e14c3bfd Cleanup: avoid applying offset to null pointer
Based on D9069 by @ankitm.
2020-10-01 15:03:14 +10:00
Ankit Meel
99fb853734 Cleanup: avoid member access within null pointer
While harmless, UBSan warns about this.
Prefer offsetof where possible since it's more readable.
2020-10-01 14:49:44 +10:00
c1ae12bf5e Cleanup: dna_genfile API for accessing struct member offsets
- Rename `find_elem` to `elem_offset` (matching `elem_exists`).

- Remove unused `SDNA_StructMember` return argument.

- Return an offset instead of a pointer which was being converted
  back into an offset by one caller,
  in this case there was no way to tell the difference between
  and element that doesn't exist and a struct member
  at the start of the array.

Resolves UBSan warning raised in T81340.
2020-10-01 14:32:43 +10:00
2c317457cb Fix File Browser filtering showing workspaces for "Environment" category
This is not an appropriate category for workspaces.
Mistake in 7f564d74f9. My intention was probably to add it to the
"Miscellaneous" category.
2020-09-30 20:50:04 +02:00
2cc913d7d9 Fix implicit conversion from pointer to bool
Error in 9b6c5268bc. Also move variable declaration to where it's
used to reduce confusion.
2020-09-30 12:31:53 -05:00
8cbd09672d Cleanup: Remove unused View2D variables and function
It looks like this code was left over from tabbed panels in the
properties editor. It wasn't used anywhere except for in one line of
the horizontally-aligned panel code that was recently removed.

Differential Revision: https://developer.blender.org/D8651
2020-09-30 12:21:35 -05:00
65e4bfe2f0 Cleanup: Reduce indentation
Instead of indenting the entire functional block, check for the error
case and the supported case early to make the code more readable.
2020-09-30 12:16:46 -05:00
60e5ebdd62 Fix Cycles CUDA kernels for Ampere not building with CUDA 11
Running Blender on Ampere cards was already possible with ptx, this fix is
needed to support building CUDA binaries.

Note the CUDA version used for official Blender builds is still 10, this is
merely the change to make it possible for those using CUDA 11 and specifying
the sm_8x kernels to be compiled.

Found by Milan Jaros.
2020-09-30 18:29:42 +02:00
443e42d47c Subdivision Surfaces: make uv smooth items consistent with new boundary smooth
This adds an option to smooth UV boundaries including corners, and renames the
available options to None / Keep Corners / All.

Ref D8413
2020-09-30 17:20:29 +02:00
Piotr Ostrowski
6070f92ab9 Subdivision Surfaces: add boundary smooth option to modifiers
This adds the option to either smooth the entire boundary, or to keep
corners sharp, for the Subdivision Surface and Multiresolution modifiers.

This mainly helps with compatibility with other software. The default
behavior remains to smooth the entire boundary.

Differential Revision: https://developer.blender.org/D8485
2020-09-30 17:20:29 +02:00
Piotr Ostrowski
53f20b940a Subdivision Surfaces: add option disable using the limit surface
This makes subdivision surfaces compatible with the old subdivision
surface modifier and other applications that do not use the limit surface.

This option is available on the Subdivision Surface modifier.

Differential Revision: https://developer.blender.org/D8413
2020-09-30 16:39:02 +02:00
ecdfb465cc Cycles: Fix usage of memory barriers in split kernel
On user level this fixes dead-lock of OpenCL render on Intel Iris GPUs.
Note that this patch does not include change in the logic which allows
or disallows OpenCL platforms to be used, that will happen after the
kernel fix is known to be fine for the currently officially supported
platforms.

The dead-lock was caused by wrong usage of memory barriers: as per the
OpenCL specification the barrier is to be executed by the entire work
group. This means, that the following code is invalid:

  void foo() {
    if (some_condition) {
      return;
    }
    barrier(CLK_LOCAL_MEM_FENCE);
  }

  void bar() {
    foo();
  }

The Cycles code was mentioning this as an invalid code on CPU, while in
fact this is invalid as per specification. From the implementation side
this change removes the ifdefs around the CPU-only barrier logic, and
is implementing similar logic in the shader setup kernel.

Tested on NUC8i7HVK NUC.

The root cause of the dead-lock was identified by Max Dmitrichenko.

There is no measurable difference in performance of currently supported
OpenCL platforms.

Differential Revision: https://developer.blender.org/D9039
2020-09-30 16:10:35 +02:00
Ivan Perevala
3a7d62cd1f Tracking: Implement Brown-Conrady distortion model
Implemented Brown-Conrady lens distortion model with 4 radial and
2 tangential coefficients to improve compatibility with other software,
such as Agisoft Photoscan/Metashapes, 3DF Zephir, RealityCapture,
Bentley ContextCapture, Alisevision Meshroom(opensource).

Also older programs: Bundler, CPMVS.
In general terms, most photogrammetric software.

The new model is available under the distortion model menu in Lens
settings.

For tests and demos check the original patch.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9037
2020-09-30 15:54:24 +02:00
Valentin
5ac4778056 Cleanup: convert gforge task ID's to phabricator format
Cleanup old tracker task format to the new. e.g: [#34039] to T34039

Ref D8718
2020-09-30 20:11:06 +10:00
c0a563ffe8 Cleanup: use 'use_' prefix for RNA booleans
Some of the naming was quite misleading.
2020-09-30 15:09:00 +10:00
Ivan Perevala
e9a6638654 UI: Motion Tracking: Fix description of K2 coefficient
Fixed description of K2 coefficient. It is second coefficient

Reviewed By: Blendify

Differential Revision: https://developer.blender.org/D9050
2020-09-29 23:01:16 -04:00
dbaa9291f2 Cleanup: spelling 2020-09-30 12:25:58 +10:00
e200e44c4e Cleanup: remove full-stop from description 2020-09-30 12:25:09 +10:00
0863316745 Cleanup: use angle-brackets for email addresses
This is already the most widely used convention.

Use this so `make check_spelling_c` will ignore all email addresses.
2020-09-30 12:05:56 +10:00
714f5078da Cleanup: sort cmake file lists 2020-09-30 11:51:42 +10:00
38a66903e5 Cleanup: sort struct declarations 2020-09-30 11:51:13 +10:00
e5aa9decb2 Cleanup: Make function private
The "UI_panel_set_expand_from_list_data" doesn't need to be in the
public API since it's just called every time an instanced panel is added.
This commit just sets the expansion automatically and adjusts some
naming to account for the moved function.
2020-09-29 17:41:00 -05:00
e1e9b5e661 Fix use after free deleting object with modifier panels visible
It's necessary to check if the panels are active before accessing their
data. Thanks to @ankitm for reporting this.
2020-09-29 17:19:57 -05:00
23363ca084 Cleanup: Use LISTBASE_FOREACH macro in outliner code 2020-09-29 17:08:32 -05:00
1b6480ebb7 UI: Remove second person in warning message
This phrasing can feel like an accusation, and a simpler phrase
gets across the idea just as well.
2020-09-29 16:21:58 -05:00
Pablo Dobarro
53804b333a Sculpt: Preserve Mesh visibility from edit mode using the Face Sets
Before this change, when users switch from edit mode to sculpt mode, the
entire mesh would be visible. Even if in the edit mesh mode part of it was
set to invisible.

With this change the visibility is preserved, by creating a separate face set
for the visible and invisible parts of the mesh and setting their initial visibility.

Implementation details: This adds a function to initialize a new Face Set
 datalayer taking the current mesh visibility into account which is stored
in the ME_HIDE flag of the vertices.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D8901
2020-09-29 22:54:36 +02:00
e0bfd3968c Sculpt: Line Project Gesture tool
This tool projects all vertices to the right of the plane defined by the
line gesture towards the plane. By doing this, this tool can create cuts
and plane surfaces in the mesh without modifying the geometry or using
boolean operations, so it is much faster than bisecting the mesh for
cases where the geometry was going to be remeshed afterwards.

Added as experimental as it does not have icon.

Reviewed By: sergey, Severin

Differential Revision: https://developer.blender.org/D9021
2020-09-29 22:48:05 +02:00
f855dc8ce9 API Docs: Correct syntax for bpy.utils.register_class 2020-09-29 16:45:29 -04:00
nutti
db346ac2cd API Docs: Fix corrupted document of gpu.select.load_id
The Python API document of gpu.select.load_id does not follow rst format.
c.f. https://docs.blender.org/api/current/gpu.select.html

This patch fixes it.

Reviewed By: Blendify

Differential Revision: https://developer.blender.org/D8547
2020-09-29 15:50:49 -04:00
7322b83cf2 API docs: Fix sytax error for delaunay_2d_cd
Alternative solution to https://developer.blender.org/D8546
2020-09-29 15:50:49 -04:00
Ankit Meel
c1cdde04e2 Fix T81100: ccl::Node: ASan SEGV due to bad pointer
`SOCKET_OFFSETOF` was added in the initial commit {rBec51175f1fd6c91d5}
when `offsetof` [1] was not supported well enough. GCC and LLVM
support it since C++17.

Other two changes: type and size check can be done without creating
an invalid address too.

[1] https://cppreference.com/w/cpp/types/offsetof

Reviewed By: campbellbarton, brecht

Maniphest Tasks: T81100

Differential Revision: https://developer.blender.org/D9042
2020-09-30 01:16:02 +05:30
4c3047a9cd API Docs: Use raises field list syntax
See 
https://www.sphinx-doc.org/en/master/usage/restructuredtext/domains.html#info-field-lists
2020-09-29 15:07:41 -04:00
ebf752625e Fix unreported Eisenbug leading to a crash when reading a blend file.
This took more than a day to fully investigate and understand, one of
the reasons being that the probability of the issue to show up was
extremely low, and subjected to very specific random factors.

Root of the issue is that, in some very rare cases, a newly read ID
might get the exact same memory address as the one it had when the blend
file was saved.

In that case, `BKE_workspace_active_set` would return immediately, since
the pointer to the active workspace would remain unchanged. But that
lead to having an unset NULL active layout pointer, which would crash
when attempting to get e.g. the active screen.

For the record, I ran into this when running a specific build (master
with one flag added to the `LIB_ID_CREATE` ones, with value `1 << 3`),
using a specific set of options (`--background --factory-startup -noaudio`),
and passing the .blend file from T80090 as argument.
2020-09-29 17:08:44 +02:00
84b3f6e049 Fix (unrepported) utterly broken logic in readfile for Workspaces.
Remove the attempt to update the active layout pointers of each window
from whithin `direct_link_workspace`.

This piece of code was a nonsense for at least to critical reasons:
* Do not, never, ever, access data from another datablock within the
  direct_link_... functions. Just don't. Don't try to be smart.
* Since it was trying (and failing) to update the active layout of every
  window for every workspace, it was effectively setting those
  `act_layout` pointers to NULL (remapping can only ever happen once,
  trying to remap and already remapped new pointer is bound to fail in
  any case).

Luckily (and funnily), this piece of code was actually harmless, since
setting the active layout would be overridden/redone later, in
`lib_link_windowmanager`, when updating their `workspace_hook` in
`lib_link_workspace_instance_hook`.

Note that the similar horror with `WorkSpaceDataRelation->parent` (which
points at a window) is kept for now, because that one is needed. Hope to
refactor it soon though.
2020-09-29 17:08:44 +02:00
ece8f69f85 Property Search: Set expansion properly for child panels
Although I haven't seen this cause any visible errors, there is some
incorrect handling for setting panel expansion during search:
 - Properly check if child panel is active first
 - Don't stop traversal at headerless panels that could theoretically
   have children
2020-09-29 09:33:48 -05:00
Sybren A. Stüvel
bab2260b59 Fix T71981: Alembic vertex interpolation can jumble mesh
Add an option to disable Alembic vertex interpolation.
Bump subversion from 5 to 6.

Alembic stores mesh samples at specific time keys; when a frame in
Blender maps to a timecode between two samples, Blender will interpolate
the mesh vertex positions. This interpolation only happens when the mesh
has a constant topology, but sometimes this was not detected properly
when the vertices change order, but the number of mesh elements remains
the same. This would result in a mesh with jumbled up vertices (T71981).
With this patch, users have the ability to disable vertex interpolation.

An alternative would be to have better detection of topology changes,
but that that'll cause a considerable slowdown.

Maniphest Tasks: T71981

Differential Revision: https://developer.blender.org/D9041
2020-09-29 16:10:16 +02:00
5845c06a63 Volumes: new Mesh to Volume modifier
This modifier can only be added to Volume objects. It takes a mesh
as input and generates a "density" grid near the surface or in
the enclosed volume.

Ref T73201.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D9032
2020-09-29 16:03:30 +02:00
e12767a035 Volumes: support selection and outlines in viewport
Previously, one could only select a volume object in the outliner
or by clicking on the object origin. This patch allows you to click
on the actual volume.

Furthermore, the generated (invisible) mesh that is used for
selection is also used to draw an outline for the volume object now.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D9022
2020-09-29 12:39:41 +02:00
6374644fd1 DNA: optimize struct reconstruction by doing some preprocessing
When loading large files that are more than a couple weeks old
(such that DNA has changed in that time), a significant amount of
time is spent in `DNA_struct_reconstruct`. This function takes a struct
in the old layout and creates a struct in the new layout from it.

This was slow because it was computing the diff between the struct
layouts every time a struct is updated. Now the steps for the struct
reconstruction is computed only once per struct. This information is
then used to actually reconstruct all structs that changed.

I measured about 10-20% speedup when loading Spring files.
E.g. `10.6s -> 8.7s` for `06_055_A.anim.blend` in BKE_blendfile_read`.

This percentage varies a lot based on the number of blocks that have
to be reconstructed and how much DNA has changed since they have
been written. In none of my tests was the new code slower than the
old code.

Reviewers: campbellbarton

Differential Revision: https://developer.blender.org/D8959
2020-09-29 12:29:01 +02:00
b41fb5542a Quiet unused variable warning 2020-09-29 12:15:00 +02:00
762d93a26b DNA: use better type for SDNA->structs
The data layout remains exactly the same..
This change just gives all the elements in `SDNA->structs` names,
making it more comfortable to work with the data.

Reviewers: campbellbarton

Differential Revision: https://developer.blender.org/D8926
2020-09-29 12:12:09 +02:00
32d4a67017 Revert "Fix T81002: Images drawn with the Python gpu module no longer draw on top in the Image Editor"
This reverts commit 085329f114.

It didn't render rendered viewport overlays correctly.
2020-09-29 09:53:55 +02:00
58b8724a48 Cleanup: spelling 2020-09-29 13:58:16 +10:00
b150071ece Cleanup: Python API Docs: Text formating 2020-09-28 20:11:06 -04:00
4d7b664e1a API Docs: Minor text improvements 2020-09-28 20:11:06 -04:00
d5353eea5b Cleanup: CMake/FFmpeg: Fix typo in message/comment
Code added in the last commit {rB2fdbe4d0501114c716fd12bc}.
2020-09-29 00:40:31 +05:30
2fdbe4d050 CMake/Find packages: add FindFFmpeg.cmake module.
The behaviour is a bit different from other find modules:
`FFMPEG_FIND_COMPONENTS` should contain the
list of required libraries before calling `find_package(FFmpeg)`.
If not set, a default set of most common libraries is searched for:
`avcodec avdevice avfilter avformat avutil`
http://ffmpeg.org/download.html

Ref D8855

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D8918
2020-09-29 00:33:13 +05:30
48a0c931ee Fix T80121: Forcefield F-curve modifier changes don't reset cache
Add a dependency graph relation Force Object Animation → Scene Rigid
Body World Rebuild. This ensures that the rigid body world is rebuilt
when a force object is re-tagged for animation updates.

The extra relation doesn't add any new calculations when the animation
is running, as the Time Source node already had a relation to the
scene's `RIGIDBODY_REBUILD` node.

The relation is created directly to the `RIGIDBODY_REBUILD` Operation. I
would have liked to target the containing Component instead. However,
that has the `RIGIDBODY_SIM` operation as entry node, which isn't enough
to actually fix T80121.

Reviewers: Sergey

Differential Revision: https://developer.blender.org/T80121
2020-09-28 17:13:40 +02:00
ddba5e0be3 Outliner: Draw hierarchy lines dashed for object children
Draw dashed lines for object child hierarchies in the outliner. This
makes the difference between collection and object hierarchies more
clear. Dashes are also consistent with viewport relationship lines.

Differential Revision: https://developer.blender.org/D8997
2020-09-28 07:54:32 -06:00
c6b904e972 Fix T80657: Not freed memory blocks with Batch-Generate Previews.
`ED_preview_icon_render()` owns the `id_copy` localized ID, so it has to
free it itself.
2020-09-28 14:56:17 +02:00
3158fc2593 Fix T80967: Alembic, crash when the imported sim from Houdini starts
Compare mesh loop count with number of loop normals before reading the
loop normals.

Houdini doesn't always write the correct loop normals to Alembic. When a
mesh is animated and then replaced by a fluid simulation, Houdini will
still write the original mesh's loop normals, but the mesh
verts/loops/polys are from the simulation. In such cases the normals
cannot be mapped to the mesh, so it's better to ignore them.
2020-09-28 14:12:42 +02:00
b88a9cf171 Cleanup: Animation, fix comments
Remove one outdated comment, and make the other into a proper sentence.

No functional changes
2020-09-28 14:12:42 +02:00
f7655dd322 UI Code Quality: Clear layout pointer on layout destruction
The layout pointer is quite ugly, but currently needed to work around
design issues. At least it should be cleared to avoid use-after-free.
2020-09-28 12:06:59 +02:00
825a32439a Cleanup: Animation, remove unused parameter from anim tagging function
Remove `bool flush` parameter from `rna_tag_animation_update()`, as every
call uses `true` anyway.

No functional changes.
2020-09-28 12:03:04 +02:00
1616 changed files with 31142 additions and 27309 deletions

View File

@@ -18,6 +18,8 @@ Checks: >
-readability-redundant-member-init, -readability-redundant-member-init,
-readability-use-anyofallof, -readability-use-anyofallof,
-readability-function-cognitive-complexity,
bugprone-*, bugprone-*,
-bugprone-narrowing-conversions, -bugprone-narrowing-conversions,
-bugprone-unhandled-self-assignment, -bugprone-unhandled-self-assignment,
@@ -28,4 +30,7 @@ Checks: >
-bugprone-sizeof-expression, -bugprone-sizeof-expression,
-bugprone-integer-division, -bugprone-integer-division,
-bugprone-exception-escape,
-bugprone-redundant-branch-condition,
WarningsAsErrors: '*' WarningsAsErrors: '*'

View File

@@ -43,8 +43,8 @@ endif()
cmake_minimum_required(VERSION 3.10) cmake_minimum_required(VERSION 3.10)
# Prever LEGACY OpenGL to eb compatible with all the existing releases and # Prefer LEGACY OpenGL to be compatible with all the existing releases and
# platforms which don't hare GLVND yet. Only do it if preference was not set # platforms which don't have GLVND yet. Only do it if preference was not set
# externally. # externally.
if(NOT DEFINED OpenGL_GL_PREFERENCE) if(NOT DEFINED OpenGL_GL_PREFERENCE)
set(OpenGL_GL_PREFERENCE "LEGACY") set(OpenGL_GL_PREFERENCE "LEGACY")
@@ -203,6 +203,7 @@ option(WITH_OPENVDB "Enable features relying on OpenVDB" ON)
option(WITH_OPENVDB_BLOSC "Enable blosc compression for OpenVDB, only enable if OpenVDB was built with blosc support" ON) option(WITH_OPENVDB_BLOSC "Enable blosc compression for OpenVDB, only enable if OpenVDB was built with blosc support" ON)
option(WITH_OPENVDB_3_ABI_COMPATIBLE "Assume OpenVDB library has been compiled with version 3 ABI compatibility" OFF) option(WITH_OPENVDB_3_ABI_COMPATIBLE "Assume OpenVDB library has been compiled with version 3 ABI compatibility" OFF)
mark_as_advanced(WITH_OPENVDB_3_ABI_COMPATIBLE) mark_as_advanced(WITH_OPENVDB_3_ABI_COMPATIBLE)
option(WITH_NANOVDB "Enable usage of NanoVDB data structure for accelerated rendering on the GPU" OFF)
# GHOST Windowing Library Options # GHOST Windowing Library Options
option(WITH_GHOST_DEBUG "Enable debugging output for the GHOST library" OFF) option(WITH_GHOST_DEBUG "Enable debugging output for the GHOST library" OFF)
@@ -376,7 +377,7 @@ option(WITH_CYCLES_CUDA_BINARIES "Build Cycles CUDA binaries" OFF)
option(WITH_CYCLES_CUBIN_COMPILER "Build cubins with nvrtc based compiler instead of nvcc" OFF) option(WITH_CYCLES_CUBIN_COMPILER "Build cubins with nvrtc based compiler instead of nvcc" OFF)
option(WITH_CYCLES_CUDA_BUILD_SERIAL "Build cubins one after another (useful on machines with limited RAM)" OFF) option(WITH_CYCLES_CUDA_BUILD_SERIAL "Build cubins one after another (useful on machines with limited RAM)" OFF)
mark_as_advanced(WITH_CYCLES_CUDA_BUILD_SERIAL) mark_as_advanced(WITH_CYCLES_CUDA_BUILD_SERIAL)
set(CYCLES_CUDA_BINARIES_ARCH sm_30 sm_35 sm_37 sm_50 sm_52 sm_60 sm_61 sm_70 sm_75 compute_75 CACHE STRING "CUDA architectures to build binaries for") set(CYCLES_CUDA_BINARIES_ARCH sm_30 sm_35 sm_37 sm_50 sm_52 sm_60 sm_61 sm_70 sm_75 sm_86 compute_75 CACHE STRING "CUDA architectures to build binaries for")
mark_as_advanced(CYCLES_CUDA_BINARIES_ARCH) mark_as_advanced(CYCLES_CUDA_BINARIES_ARCH)
unset(PLATFORM_DEFAULT) unset(PLATFORM_DEFAULT)
option(WITH_CYCLES_LOGGING "Build Cycles with logging support" ON) option(WITH_CYCLES_LOGGING "Build Cycles with logging support" ON)
@@ -704,6 +705,9 @@ set_and_warn_dependency(WITH_TBB WITH_OPENIMAGEDENOISE OFF)
set_and_warn_dependency(WITH_TBB WITH_OPENVDB OFF) set_and_warn_dependency(WITH_TBB WITH_OPENVDB OFF)
set_and_warn_dependency(WITH_TBB WITH_MOD_FLUID OFF) set_and_warn_dependency(WITH_TBB WITH_MOD_FLUID OFF)
# NanoVDB requires OpenVDB to convert the data structure
set_and_warn_dependency(WITH_OPENVDB WITH_NANOVDB OFF)
# OpenVDB uses 'half' type from OpenEXR & fails to link without OpenEXR enabled. # OpenVDB uses 'half' type from OpenEXR & fails to link without OpenEXR enabled.
set_and_warn_dependency(WITH_IMAGE_OPENEXR WITH_OPENVDB OFF) set_and_warn_dependency(WITH_IMAGE_OPENEXR WITH_OPENVDB OFF)
@@ -849,11 +853,17 @@ set(PLATFORM_LINKFLAGS_DEBUG "")
if(NOT CMAKE_BUILD_TYPE MATCHES "Release") if(NOT CMAKE_BUILD_TYPE MATCHES "Release")
if(WITH_COMPILER_ASAN) if(WITH_COMPILER_ASAN)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${COMPILER_ASAN_CFLAGS}") if(NOT APPLE)
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} ${COMPILER_ASAN_CFLAGS}") # Avoid passing address sanitizer compiler flags to `try_compile`.
# Since linker flags are not set, all compiler checks and `find_package`
# calls that rely on `try_compile` will fail.
# See CMP0066 also.
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_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${COMPILER_ASAN_CXXFLAGS}")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${COMPILER_ASAN_CXXFLAGS}") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${COMPILER_ASAN_CXXFLAGS}")
endif()
if(MSVC) if(MSVC)
set(COMPILER_ASAN_LINKER_FLAGS "/FUNCTIONPADMIN:6") set(COMPILER_ASAN_LINKER_FLAGS "/FUNCTIONPADMIN:6")
endif() endif()

View File

@@ -89,7 +89,7 @@ Spell Checkers
* check_spelling_osl: Check for spelling errors (OSL only). * check_spelling_osl: Check for spelling errors (OSL only).
* check_spelling_py: Check for spelling errors (Python only). * check_spelling_py: Check for spelling errors (Python only).
Note that spell checkers can tak a 'CHECK_SPELLING_CACHE' filepath argument, Note that spell checkers can take a 'CHECK_SPELLING_CACHE' filepath argument,
so re-running does not need to re-check unchanged files. so re-running does not need to re-check unchanged files.
Example: Example:
@@ -517,7 +517,7 @@ doc_py: .FORCE
ASAN_OPTIONS=halt_on_error=0 \ ASAN_OPTIONS=halt_on_error=0 \
$(BLENDER_BIN) --background -noaudio --factory-startup \ $(BLENDER_BIN) --background -noaudio --factory-startup \
--python doc/python_api/sphinx_doc_gen.py --python doc/python_api/sphinx_doc_gen.py
cd doc/python_api ; sphinx-build -b html sphinx-in sphinx-out sphinx-build -b html -j $(NPROCS) doc/python_api/sphinx-in doc/python_api/sphinx-out
@echo "docs written into: '$(BLENDER_DIR)/doc/python_api/sphinx-out/index.html'" @echo "docs written into: '$(BLENDER_DIR)/doc/python_api/sphinx-out/index.html'"
doc_doxy: .FORCE doc_doxy: .FORCE

View File

@@ -117,7 +117,6 @@ if(WIN32)
include(cmake/yamlcpp.cmake) include(cmake/yamlcpp.cmake)
# LCMS is an OCIO dep, but only if you build the apps, leaving it here for convenience # LCMS is an OCIO dep, but only if you build the apps, leaving it here for convenience
# include(cmake/lcms.cmake) # include(cmake/lcms.cmake)
endif() endif()
if(NOT WIN32 OR ENABLE_MINGW64) if(NOT WIN32 OR ENABLE_MINGW64)

View File

@@ -20,7 +20,7 @@ set(GMP_EXTRA_ARGS -enable-cxx)
if(WIN32) if(WIN32)
# Shared for windows because static libs will drag in a libgcc dependency. # Shared for windows because static libs will drag in a libgcc dependency.
set(GMP_OPTIONS --disable-static --enable-shared --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32) set(GMP_OPTIONS --disable-static --enable-shared --enable-fat --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32)
else() else()
set(GMP_OPTIONS --enable-static --disable-shared ) set(GMP_OPTIONS --enable-static --disable-shared )
endif() endif()
@@ -41,6 +41,7 @@ elseif(UNIX)
set(GMP_OPTIONS set(GMP_OPTIONS
${GMP_OPTIONS} ${GMP_OPTIONS}
--with-pic --with-pic
--enable-fat
) )
endif() endif()

View File

@@ -26,6 +26,7 @@ endif()
message("HARVEST_TARGET = ${HARVEST_TARGET}") message("HARVEST_TARGET = ${HARVEST_TARGET}")
if(WIN32) if(WIN32)
if(BUILD_MODE STREQUAL Release) if(BUILD_MODE STREQUAL Release)
add_custom_target(Harvest_Release_Results add_custom_target(Harvest_Release_Results
COMMAND # jpeg rename libfile + copy include COMMAND # jpeg rename libfile + copy include
@@ -145,6 +146,9 @@ harvest(openjpeg/lib openjpeg/lib "*.a")
harvest(opensubdiv/include opensubdiv/include "*.h") harvest(opensubdiv/include opensubdiv/include "*.h")
harvest(opensubdiv/lib opensubdiv/lib "*.a") harvest(opensubdiv/lib opensubdiv/lib "*.a")
harvest(openvdb/include/openvdb openvdb/include/openvdb "*.h") harvest(openvdb/include/openvdb openvdb/include/openvdb "*.h")
if(WITH_NANOVDB)
harvest(openvdb/nanovdb nanovdb/include/nanovdb "*.h")
endif()
harvest(openvdb/lib openvdb/lib "*.a") harvest(openvdb/lib openvdb/lib "*.a")
harvest(xr_openxr_sdk/include/openxr xr_openxr_sdk/include/openxr "*.h") harvest(xr_openxr_sdk/include/openxr xr_openxr_sdk/include/openxr "*.h")
harvest(xr_openxr_sdk/lib xr_openxr_sdk/lib "*.a") harvest(xr_openxr_sdk/lib xr_openxr_sdk/lib "*.a")

View File

@@ -59,4 +59,4 @@ else(WIN32)
) )
set(JPEG_LIBRARY libjpeg${LIBEXT}) set(JPEG_LIBRARY libjpeg${LIBEXT})
endif(WIN32) endif()

View File

@@ -54,6 +54,20 @@ set(OPENVDB_EXTRA_ARGS
-DOPENVDB_CORE_STATIC=${OPENVDB_STATIC} -DOPENVDB_CORE_STATIC=${OPENVDB_STATIC}
-DOPENVDB_BUILD_BINARIES=Off -DOPENVDB_BUILD_BINARIES=Off
-DCMAKE_DEBUG_POSTFIX=_d -DCMAKE_DEBUG_POSTFIX=_d
# NanoVDB is header-only, so only need the install target
-DNANOVDB_BUILD_UNITTESTS=OFF
-DNANOVDB_BUILD_EXAMPLES=OFF
-DNANOVDB_BUILD_BENCHMARK=OFF
-DNANOVDB_BUILD_DOCS=OFF
-DNANOVDB_BUILD_TOOLS=OFF
-DNANOVDB_CUDA_KEEP_PTX=OFF
-DNANOVDB_USE_OPENGL=OFF
-DNANOVDB_USE_OPENGL=OFF
-DNANOVDB_USE_CUDA=OFF
-DNANOVDB_USE_TBB=OFF
-DNANOVDB_USE_OPTIX=OFF
-DNANOVDB_USE_OPENVDB=OFF
-DNANOVDB_ALLOW_FETCHCONTENT=OFF
) )
if(WIN32) if(WIN32)
@@ -74,12 +88,18 @@ else()
) )
endif() endif()
if(WITH_NANOVDB)
set(OPENVDB_PATCH_FILE openvdb_nanovdb.diff)
else()
set(OPENVDB_PATCH_FILE openvdb.diff)
endif()
ExternalProject_Add(openvdb ExternalProject_Add(openvdb
URL ${OPENVDB_URI} URL ${OPENVDB_URI}
DOWNLOAD_DIR ${DOWNLOAD_DIR} DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH MD5=${OPENVDB_HASH} URL_HASH MD5=${OPENVDB_HASH}
PREFIX ${BUILD_DIR}/openvdb PREFIX ${BUILD_DIR}/openvdb
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/openvdb/src/openvdb < ${PATCH_DIR}/openvdb.diff PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/openvdb/src/openvdb < ${PATCH_DIR}/${OPENVDB_PATCH_FILE}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openvdb ${DEFAULT_CMAKE_FLAGS} ${OPENVDB_EXTRA_ARGS} CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openvdb ${DEFAULT_CMAKE_FLAGS} ${OPENVDB_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/openvdb INSTALL_DIR ${LIBDIR}/openvdb
) )
@@ -96,11 +116,17 @@ add_dependencies(
if(WIN32) if(WIN32)
if(BUILD_MODE STREQUAL Release) if(BUILD_MODE STREQUAL Release)
ExternalProject_Add_Step(openvdb after_install ExternalProject_Add_Step(openvdb after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/openvdb/include ${HARVEST_TARGET}/openvdb/include COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/openvdb/include/openvdb ${HARVEST_TARGET}/openvdb/include/openvdb
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openvdb/lib/openvdb.lib ${HARVEST_TARGET}/openvdb/lib/openvdb.lib COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openvdb/lib/openvdb.lib ${HARVEST_TARGET}/openvdb/lib/openvdb.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openvdb/bin/openvdb.dll ${HARVEST_TARGET}/openvdb/bin/openvdb.dll COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openvdb/bin/openvdb.dll ${HARVEST_TARGET}/openvdb/bin/openvdb.dll
DEPENDEES install DEPENDEES install
) )
if(WITH_NANOVDB)
ExternalProject_Add_Step(openvdb nanovdb_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/openvdb/nanovdb ${HARVEST_TARGET}/nanovdb/include/nanovdb
DEPENDEES after_install
)
endif()
endif() endif()
if(BUILD_MODE STREQUAL Debug) if(BUILD_MODE STREQUAL Debug)
ExternalProject_Add_Step(openvdb after_install ExternalProject_Add_Step(openvdb after_install

View File

@@ -21,6 +21,7 @@ if(WIN32)
endif() endif()
option(WITH_WEBP "Enable building of oiio with webp support" OFF) option(WITH_WEBP "Enable building of oiio with webp support" OFF)
option(WITH_BOOST_PYTHON "Enable building of boost with python support" OFF) option(WITH_BOOST_PYTHON "Enable building of boost with python support" OFF)
option(WITH_NANOVDB "Enable building of OpenVDB with NanoVDB included" OFF)
set(MAKE_THREADS 1 CACHE STRING "Number of threads to run make with") set(MAKE_THREADS 1 CACHE STRING "Number of threads to run make with")
if(NOT BUILD_MODE) if(NOT BUILD_MODE)

View File

@@ -145,9 +145,15 @@ set(TBB_VERSION 2019_U9)
set(TBB_URI https://github.com/oneapi-src/oneTBB/archive/${TBB_VERSION}.tar.gz) set(TBB_URI https://github.com/oneapi-src/oneTBB/archive/${TBB_VERSION}.tar.gz)
set(TBB_HASH 26263622e9187212ec240dcf01b66207) set(TBB_HASH 26263622e9187212ec240dcf01b66207)
set(OPENVDB_VERSION 7.0.0) if(WITH_NANOVDB)
set(OPENVDB_URI https://github.com/dreamworksanimation/openvdb/archive/v${OPENVDB_VERSION}.tar.gz) set(OPENVDB_GIT_UID e62f7a0bf1e27397223c61ddeaaf57edf111b77f)
set(OPENVDB_HASH fd6c4f168282f7e0e494d290cd531fa8) set(OPENVDB_URI https://github.com/AcademySoftwareFoundation/openvdb/archive/${OPENVDB_GIT_UID}.tar.gz)
set(OPENVDB_HASH 90919510bc6ccd630fedc56f748cb199)
else()
set(OPENVDB_VERSION 7.0.0)
set(OPENVDB_URI https://github.com/AcademySoftwareFoundation/openvdb/archive/v${OPENVDB_VERSION}.tar.gz)
set(OPENVDB_HASH fd6c4f168282f7e0e494d290cd531fa8)
endif()
set(IDNA_VERSION 2.9) set(IDNA_VERSION 2.9)
set(CHARDET_VERSION 3.0.4) set(CHARDET_VERSION 3.0.4)

View File

@@ -520,7 +520,7 @@ OIDN_FORCE_BUILD=false
OIDN_FORCE_REBUILD=false OIDN_FORCE_REBUILD=false
OIDN_SKIP=false OIDN_SKIP=false
ISPC_VERSION="1.14.0" ISPC_VERSION="1.14.1"
FFMPEG_VERSION="4.2.3" FFMPEG_VERSION="4.2.3"
FFMPEG_VERSION_SHORT="4.2" FFMPEG_VERSION_SHORT="4.2"
@@ -1259,13 +1259,16 @@ version_match() {
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# Generic compile helpers # Generic compile helpers
prepare_opt() { prepare_inst() {
INFO "Ensuring $INST exists and is writable by us" INFO "Ensuring $INST exists and is writable by us"
if [ ! $SUDO ]; then if [ ! $SUDO ]; then
WARNING "--no-sudo enabled, might be impossible to create install dir..." WARNING "--no-sudo enabled, might be impossible to create install dir..."
fi fi
if [ ! -d $INST ]; then if [ ! -d $INST ]; then
$SUDO mkdir -p $INST # Try to create normal user directory first to possibly avoid excessive
# system operations
mkdir -p $INST || $SUDO mkdir -p $INST
fi fi
if [ ! -w $INST ]; then if [ ! -w $INST ]; then
@@ -1366,7 +1369,7 @@ compile_Python() {
# Rebuild dependencies as well! # Rebuild dependencies as well!
_update_deps_python _update_deps_python
prepare_opt prepare_inst
if [ ! -d $_src ]; then if [ ! -d $_src ]; then
mkdir -p $SRC mkdir -p $SRC
@@ -1452,7 +1455,7 @@ compile_Numpy() {
# Rebuild dependencies as well! # Rebuild dependencies as well!
_update_deps_numpy _update_deps_numpy
prepare_opt prepare_inst
if [ ! -d $_src ]; then if [ ! -d $_src ]; then
mkdir -p $SRC mkdir -p $SRC
@@ -1541,7 +1544,7 @@ compile_Boost() {
# Rebuild dependencies as well! # Rebuild dependencies as well!
_update_deps_boost _update_deps_boost
prepare_opt prepare_inst
if [ ! -d $_src ]; then if [ ! -d $_src ]; then
INFO "Downloading Boost-$BOOST_VERSION" INFO "Downloading Boost-$BOOST_VERSION"
@@ -1635,7 +1638,7 @@ compile_TBB() {
# Rebuild dependencies as well! # Rebuild dependencies as well!
_update_deps_tbb _update_deps_tbb
prepare_opt prepare_inst
if [ ! -d $_src ]; then if [ ! -d $_src ]; then
INFO "Downloading TBB-$TBB_VERSION$TBB_VERSION_UPDATE" INFO "Downloading TBB-$TBB_VERSION$TBB_VERSION_UPDATE"
@@ -1752,7 +1755,7 @@ compile_OCIO() {
# Rebuild dependencies as well! # Rebuild dependencies as well!
_update_deps_ocio _update_deps_ocio
prepare_opt prepare_inst
if [ ! -d $_src ]; then if [ ! -d $_src ]; then
INFO "Downloading OpenColorIO-$OCIO_VERSION" INFO "Downloading OpenColorIO-$OCIO_VERSION"
@@ -1884,7 +1887,7 @@ compile_OPENEXR() {
# Rebuild dependencies as well! # Rebuild dependencies as well!
_update_deps_openexr _update_deps_openexr
prepare_opt prepare_inst
if [ ! -d $_src ]; then if [ ! -d $_src ]; then
INFO "Downloading OpenEXR-$OPENEXR_VERSION" INFO "Downloading OpenEXR-$OPENEXR_VERSION"
@@ -2010,7 +2013,7 @@ compile_OIIO() {
# Rebuild dependencies as well! # Rebuild dependencies as well!
_update_deps_oiio _update_deps_oiio
prepare_opt prepare_inst
if [ ! -d $_src ]; then if [ ! -d $_src ]; then
mkdir -p $SRC mkdir -p $SRC
@@ -2165,7 +2168,7 @@ compile_LLVM() {
# Rebuild dependencies as well! # Rebuild dependencies as well!
_update_deps_llvm _update_deps_llvm
prepare_opt prepare_inst
if [ ! -d $_src -o true ]; then if [ ! -d $_src -o true ]; then
mkdir -p $SRC mkdir -p $SRC
@@ -2275,7 +2278,7 @@ compile_OSL() {
# Rebuild dependencies as well! # Rebuild dependencies as well!
_update_deps_osl _update_deps_osl
prepare_opt prepare_inst
if [ ! -d $_src ]; then if [ ! -d $_src ]; then
mkdir -p $SRC mkdir -p $SRC
@@ -2419,7 +2422,7 @@ compile_OSD() {
# Rebuild dependencies as well! # Rebuild dependencies as well!
_update_deps_osd _update_deps_osd
prepare_opt prepare_inst
if [ ! -d $_src ]; then if [ ! -d $_src ]; then
mkdir -p $SRC mkdir -p $SRC
@@ -2537,7 +2540,7 @@ compile_BLOSC() {
# Rebuild dependencies as well! # Rebuild dependencies as well!
_update_deps_blosc _update_deps_blosc
prepare_opt prepare_inst
if [ ! -d $_src ]; then if [ ! -d $_src ]; then
INFO "Downloading Blosc-$OPENVDB_BLOSC_VERSION" INFO "Downloading Blosc-$OPENVDB_BLOSC_VERSION"
@@ -2636,7 +2639,7 @@ compile_OPENVDB() {
# Rebuild dependencies as well! # Rebuild dependencies as well!
_update_deps_openvdb _update_deps_openvdb
prepare_opt prepare_inst
if [ ! -d $_src -o true ]; then if [ ! -d $_src -o true ]; then
mkdir -p $SRC mkdir -p $SRC
@@ -2751,7 +2754,7 @@ compile_ALEMBIC() {
# Rebuild dependencies as well! # Rebuild dependencies as well!
_update_deps_alembic _update_deps_alembic
prepare_opt prepare_inst
if [ ! -d $_src ]; then if [ ! -d $_src ]; then
mkdir -p $SRC mkdir -p $SRC
@@ -2856,7 +2859,7 @@ compile_USD() {
# Rebuild dependencies as well! # Rebuild dependencies as well!
_update_deps_usd _update_deps_usd
prepare_opt prepare_inst
if [ ! -d $_src ]; then if [ ! -d $_src ]; then
mkdir -p $SRC mkdir -p $SRC
@@ -2955,7 +2958,7 @@ compile_OpenCOLLADA() {
# Rebuild dependencies as well! # Rebuild dependencies as well!
_update_deps_collada _update_deps_collada
prepare_opt prepare_inst
if [ ! -d $_src ]; then if [ ! -d $_src ]; then
mkdir -p $SRC mkdir -p $SRC
@@ -3061,7 +3064,7 @@ compile_Embree() {
# Rebuild dependencies as well! # Rebuild dependencies as well!
_update_deps_embree _update_deps_embree
prepare_opt prepare_inst
if [ ! -d $_src ]; then if [ ! -d $_src ]; then
mkdir -p $SRC mkdir -p $SRC
@@ -3171,7 +3174,7 @@ install_ISPC() {
# Rebuild dependencies as well! # Rebuild dependencies as well!
_update_deps_ispc _update_deps_ispc
prepare_opt prepare_inst
if [ ! -d $_src ]; then if [ ! -d $_src ]; then
mkdir -p $SRC mkdir -p $SRC
@@ -3250,7 +3253,7 @@ compile_OIDN() {
# Rebuild dependencies as well! # Rebuild dependencies as well!
_update_deps_oidn _update_deps_oidn
prepare_opt prepare_inst
if [ ! -d $_src ]; then if [ ! -d $_src ]; then
mkdir -p $SRC mkdir -p $SRC
@@ -3360,7 +3363,7 @@ compile_FFmpeg() {
# Rebuild dependencies as well! # Rebuild dependencies as well!
_update_deps_ffmpeg _update_deps_ffmpeg
prepare_opt prepare_inst
if [ ! -d $_src ]; then if [ ! -d $_src ]; then
INFO "Downloading ffmpeg-$FFMPEG_VERSION" INFO "Downloading ffmpeg-$FFMPEG_VERSION"
@@ -3489,7 +3492,7 @@ compile_XR_OpenXR_SDK() {
# Rebuild dependencies as well! # Rebuild dependencies as well!
_update_deps_xr_openxr_sdk _update_deps_xr_openxr_sdk
prepare_opt prepare_inst
if [ ! -d $_src ]; then if [ ! -d $_src ]; then
mkdir -p $SRC mkdir -p $SRC
@@ -3955,7 +3958,7 @@ install_DEB() {
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
install_packages_DEB llvm-dev clang install_packages_DEB llvm-dev clang
have_llvm=true have_llvm=true
LLVM_VERSION=`get_package_version_DEB llvm-dev` LLVM_VERSION=`llvm-config --version`
LLVM_VERSION_FOUND=$LLVM_VERSION LLVM_VERSION_FOUND=$LLVM_VERSION
clean_LLVM clean_LLVM
else else
@@ -4604,7 +4607,7 @@ install_RPM() {
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
install_packages_RPM llvm-devel $CLANG_DEV install_packages_RPM llvm-devel $CLANG_DEV
have_llvm=true have_llvm=true
LLVM_VERSION=`get_package_version_RPM llvm-devel` LLVM_VERSION=`llvm-config --version`
LLVM_VERSION_FOUND=$LLVM_VERSION LLVM_VERSION_FOUND=$LLVM_VERSION
clean_LLVM clean_LLVM
else else
@@ -5126,7 +5129,7 @@ install_ARCH() {
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
install_packages_ARCH llvm clang install_packages_ARCH llvm clang
have_llvm=true have_llvm=true
LLVM_VERSION=`get_package_version_ARCH llvm` LLVM_VERSION=`llvm-config --version`
LLVM_VERSION_FOUND=$LLVM_VERSION LLVM_VERSION_FOUND=$LLVM_VERSION
clean_LLVM clean_LLVM
else else

View File

@@ -0,0 +1,135 @@
diff -Naur orig/cmake/FindIlmBase.cmake openvdb/cmake/FindIlmBase.cmake
--- orig/cmake/FindIlmBase.cmake 2019-12-06 12:11:33 -0700
+++ openvdb/cmake/FindIlmBase.cmake 2020-08-12 12:48:44 -0600
@@ -217,6 +217,8 @@
set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib")
endif()
list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES "${_IlmBase_Version_Suffix}.lib")
+ list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES "_s.lib")
+ list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES "_s_d.lib")
else()
if(ILMBASE_USE_STATIC_LIBS)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
diff -Naur orig/cmake/FindOpenEXR.cmake openvdb/cmake/FindOpenEXR.cmake
--- orig/cmake/FindOpenEXR.cmake 2019-12-06 12:11:33 -0700
+++ openvdb/cmake/FindOpenEXR.cmake 2020-08-12 12:48:44 -0600
@@ -210,6 +210,8 @@
set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib")
endif()
list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES "${_OpenEXR_Version_Suffix}.lib")
+ list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES "_s.lib")
+ list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES "_s_d.lib")
else()
if(OPENEXR_USE_STATIC_LIBS)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
diff -Naur orig/openvdb/openvdb/CMakeLists.txt openvdb/openvdb/openvdb/CMakeLists.txt
--- orig/openvdb/openvdb/CMakeLists.txt 2019-12-06 12:11:33 -0700
+++ openvdb/openvdb/openvdb/CMakeLists.txt 2020-08-12 14:12:26 -0600
@@ -105,7 +105,9 @@
# http://boost.2283326.n4.nabble.com/CMake-config-scripts-broken-in-1-70-td4708957.html
# https://github.com/boostorg/boost_install/commit/160c7cb2b2c720e74463865ef0454d4c4cd9ae7c
set(BUILD_SHARED_LIBS ON)
- set(Boost_USE_STATIC_LIBS OFF)
+ if(NOT WIN32) # blender links boost statically on windows
+ set(Boost_USE_STATIC_LIBS OFF)
+ endif()
endif()
find_package(Boost ${MINIMUM_BOOST_VERSION} REQUIRED COMPONENTS iostreams system)
@@ -193,6 +195,7 @@
if(OPENVDB_DISABLE_BOOST_IMPLICIT_LINKING)
add_definitions(-DBOOST_ALL_NO_LIB)
endif()
+ add_definitions(-D__TBB_NO_IMPLICIT_LINKAGE -DOPENVDB_OPENEXR_STATICLIB)
endif()
# @todo Should be target definitions
@@ -383,7 +386,12 @@
# imported targets.
if(OPENVDB_CORE_SHARED)
- add_library(openvdb_shared SHARED ${OPENVDB_LIBRARY_SOURCE_FILES})
+ if(WIN32)
+ configure_file(version.rc.in ${CMAKE_CURRENT_BINARY_DIR}/version.rc @ONLY)
+ add_library(openvdb_shared SHARED ${OPENVDB_LIBRARY_SOURCE_FILES} ${CMAKE_CURRENT_BINARY_DIR}/version.rc)
+ else()
+ add_library(openvdb_shared SHARED ${OPENVDB_LIBRARY_SOURCE_FILES})
+ endif()
endif()
if(OPENVDB_CORE_STATIC)
diff -Naur orig/openvdb/openvdb/version.rc.in openvdb/openvdb/openvdb/version.rc.in
--- orig/openvdb/openvdb/version.rc.in 1969-12-31 17:00:00 -0700
+++ openvdb/openvdb/openvdb/version.rc.in 2020-08-12 14:15:01 -0600
@@ -0,0 +1,48 @@
+#include <winver.h>
+
+#define VER_FILEVERSION @OpenVDB_MAJOR_VERSION@,@OpenVDB_MINOR_VERSION@,@OpenVDB_PATCH_VERSION@,0
+#define VER_FILEVERSION_STR "@OpenVDB_MAJOR_VERSION@.@OpenVDB_MINOR_VERSION@.@OpenVDB_PATCH_VERSION@.0\0"
+
+#define VER_PRODUCTVERSION @OpenVDB_MAJOR_VERSION@,@OpenVDB_MINOR_VERSION@,@OpenVDB_PATCH_VERSION@,0
+#define VER_PRODUCTVERSION_STR "@OpenVDB_MAJOR_VERSION@.@OpenVDB_MINOR_VERSION@\0"
+
+#ifndef DEBUG
+#define VER_DEBUG 0
+#else
+#define VER_DEBUG VS_FF_DEBUG
+#endif
+
+VS_VERSION_INFO VERSIONINFO
+FILEVERSION VER_FILEVERSION
+PRODUCTVERSION VER_PRODUCTVERSION
+FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
+FILEFLAGS (VER_DEBUG)
+FILEOS VOS__WINDOWS32
+FILETYPE VFT_DLL
+FILESUBTYPE VFT2_UNKNOWN
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904E4"
+ BEGIN
+ VALUE "FileDescription", "OpenVDB"
+ VALUE "FileVersion", VER_FILEVERSION_STR
+ VALUE "InternalName", "OpenVDB"
+ VALUE "ProductName", "OpenVDB"
+ VALUE "ProductVersion", VER_PRODUCTVERSION_STR
+ END
+ END
+
+ BLOCK "VarFileInfo"
+ BEGIN
+ /* The following line should only be modified for localized versions. */
+ /* It consists of any number of WORD,WORD pairs, with each pair */
+ /* describing a language,codepage combination supported by the file. */
+ /* */
+ /* For example, a file might have values "0x409,1252" indicating that it */
+ /* supports English language (0x409) in the Windows ANSI codepage (1252). */
+
+ VALUE "Translation", 0x409, 1252
+
+ END
+END
diff -Naur openvdb-original/CMakeLists.txt openvdb/CMakeLists.txt
--- openvdb-original/CMakeLists.txt 2020-08-27 03:34:02.000000000 +0200
+++ openvdb/CMakeLists.txt 2020-09-02 10:56:21.665735244 +0200
@@ -68,6 +68,7 @@
option(OPENVDB_INSTALL_HOUDINI_PYTHONRC [=[Install a Houdini startup script that sets
the visibilty of OpenVDB nodes and their native equivalents.]=] OFF)
option(OPENVDB_BUILD_MAYA_PLUGIN "Build the Maya plugin" OFF)
+option(OPENVDB_BUILD_NANOVDB "Build nanovdb" ON)
option(OPENVDB_ENABLE_RPATH "Build with RPATH information" ON)
option(OPENVDB_CXX_STRICT "Enable or disable pre-defined compiler warnings" OFF)
option(OPENVDB_CODE_COVERAGE "Enable code coverage. This also overrides CMAKE_BUILD_TYPE to Debug" OFF)
@@ -740,6 +741,10 @@
add_subdirectory(openvdb_maya)
endif()
+if(OPENVDB_BUILD_NANOVDB)
+ add_subdirectory(nanovdb)
+endif()
+
##########################################################################
add_custom_target(uninstall

View File

@@ -24,6 +24,7 @@ import re
import subprocess import subprocess
import sys import sys
def is_tool(name): def is_tool(name):
"""Check whether `name` is on PATH and marked as executable.""" """Check whether `name` is on PATH and marked as executable."""
@@ -32,6 +33,7 @@ def is_tool(name):
return which(name) is not None return which(name) is not None
class Builder: class Builder:
def __init__(self, name, branch, codesign): def __init__(self, name, branch, codesign):
self.name = name self.name = name
@@ -48,22 +50,23 @@ class Builder:
# Detect platform # Detect platform
if name.startswith('mac'): if name.startswith('mac'):
self.platform = 'mac' self.platform = 'mac'
self.command_prefix = [] self.command_prefix = []
elif name.startswith('linux'): elif name.startswith('linux'):
self.platform = 'linux' self.platform = 'linux'
if is_tool('scl'): if is_tool('scl'):
self.command_prefix = ['scl', 'enable', 'devtoolset-9', '--'] self.command_prefix = ['scl', 'enable', 'devtoolset-9', '--']
else: else:
self.command_prefix = [] self.command_prefix = []
elif name.startswith('win'): elif name.startswith('win'):
self.platform = 'win' self.platform = 'win'
self.command_prefix = [] self.command_prefix = []
else: else:
raise ValueError('Unkonw platform for builder ' + self.platform) raise ValueError('Unkonw platform for builder ' + self.platform)
# Always 64 bit now # Always 64 bit now
self.bits = 64 self.bits = 64
def create_builder_from_arguments(): def create_builder_from_arguments():
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('builder_name') parser.add_argument('builder_name')
@@ -104,7 +107,7 @@ class VersionInfo:
def _parse_header_file(self, filename, define): def _parse_header_file(self, filename, define):
import re import re
regex = re.compile("^#\s*define\s+%s\s+(.*)" % define) regex = re.compile(r"^#\s*define\s+%s\s+(.*)" % define)
with open(filename, "r") as file: with open(filename, "r") as file:
for l in file: for l in file:
match = regex.match(l) match = regex.match(l)

View File

@@ -102,7 +102,7 @@ class ArchiveWithIndicator:
# Wait for until archive is fully stored. # Wait for until archive is fully stored.
actual_archive_size = self.archive_filepath.stat().st_size actual_archive_size = self.archive_filepath.stat().st_size
if actual_archive_size != expected_archive_size: if actual_archive_size != expected_archive_size:
print('Partial/invalid archive size (expected ' print('Partial/invalid archive size (expected '
f'{expected_archive_size} got {actual_archive_size})') f'{expected_archive_size} got {actual_archive_size})')
return False return False

View File

@@ -23,6 +23,7 @@ import shutil
import buildbot_utils import buildbot_utils
def get_cmake_options(builder): def get_cmake_options(builder):
codesign_script = os.path.join( codesign_script = os.path.join(
builder.blender_dir, 'build_files', 'buildbot', 'worker_codesign.cmake') builder.blender_dir, 'build_files', 'buildbot', 'worker_codesign.cmake')
@@ -44,11 +45,24 @@ def get_cmake_options(builder):
optix_sdk_dir = os.path.join(builder.blender_dir, '..', '..', 'NVIDIA-Optix-SDK') optix_sdk_dir = os.path.join(builder.blender_dir, '..', '..', 'NVIDIA-Optix-SDK')
options.append('-DOPTIX_ROOT_DIR:PATH=' + optix_sdk_dir) options.append('-DOPTIX_ROOT_DIR:PATH=' + optix_sdk_dir)
# Workaround to build sm_30 kernels with CUDA 10, since CUDA 11 no longer supports that architecture
if builder.platform == 'win':
options.append('-DCUDA10_TOOLKIT_ROOT_DIR:PATH=C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.1')
options.append('-DCUDA10_NVCC_EXECUTABLE:FILEPATH=C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.1/bin/nvcc.exe')
options.append('-DCUDA11_TOOLKIT_ROOT_DIR:PATH=C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.1')
options.append('-DCUDA11_NVCC_EXECUTABLE:FILEPATH=C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.1/bin/nvcc.exe')
elif builder.platform == 'linux':
options.append('-DCUDA10_TOOLKIT_ROOT_DIR:PATH=/usr/local/cuda-10.1')
options.append('-DCUDA10_NVCC_EXECUTABLE:FILEPATH=/usr/local/cuda-10.1/bin/nvcc')
options.append('-DCUDA11_TOOLKIT_ROOT_DIR:PATH=/usr/local/cuda-11.1')
options.append('-DCUDA11_NVCC_EXECUTABLE:FILEPATH=/usr/local/cuda-11.1/bin/nvcc')
options.append("-C" + os.path.join(builder.blender_dir, config_file)) options.append("-C" + os.path.join(builder.blender_dir, config_file))
options.append("-DCMAKE_INSTALL_PREFIX=%s" % (builder.install_dir)) options.append("-DCMAKE_INSTALL_PREFIX=%s" % (builder.install_dir))
return options return options
def update_git(builder): def update_git(builder):
# Do extra git fetch because not all platform/git/buildbot combinations # Do extra git fetch because not all platform/git/buildbot combinations
# update the origin remote, causing buildinfo to detect local changes. # update the origin remote, causing buildinfo to detect local changes.
@@ -58,6 +72,7 @@ def update_git(builder):
command = ['git', 'fetch', '--all'] command = ['git', 'fetch', '--all']
buildbot_utils.call(builder.command_prefix + command) buildbot_utils.call(builder.command_prefix + command)
def clean_directories(builder): def clean_directories(builder):
# Make sure no garbage remained from the previous run # Make sure no garbage remained from the previous run
if os.path.isdir(builder.install_dir): if os.path.isdir(builder.install_dir):
@@ -73,6 +88,7 @@ def clean_directories(builder):
print("Removing {}" . format(buildinfo)) print("Removing {}" . format(buildinfo))
os.remove(full_path) os.remove(full_path)
def cmake_configure(builder): def cmake_configure(builder):
# CMake configuration # CMake configuration
os.chdir(builder.build_dir) os.chdir(builder.build_dir)
@@ -87,6 +103,7 @@ def cmake_configure(builder):
command = ['cmake', builder.blender_dir] + cmake_options command = ['cmake', builder.blender_dir] + cmake_options
buildbot_utils.call(builder.command_prefix + command) buildbot_utils.call(builder.command_prefix + command)
def cmake_build(builder): def cmake_build(builder):
# CMake build # CMake build
os.chdir(builder.build_dir) os.chdir(builder.build_dir)
@@ -109,6 +126,7 @@ def cmake_build(builder):
print("CMake build:") print("CMake build:")
buildbot_utils.call(builder.command_prefix + command) buildbot_utils.call(builder.command_prefix + command)
if __name__ == "__main__": if __name__ == "__main__":
builder = buildbot_utils.create_builder_from_arguments() builder = buildbot_utils.create_builder_from_arguments()
update_git(builder) update_git(builder)

View File

@@ -29,18 +29,20 @@ from pathlib import Path
import buildbot_utils import buildbot_utils
def get_package_name(builder, platform=None): def get_package_name(builder, platform=None):
info = buildbot_utils.VersionInfo(builder) info = buildbot_utils.VersionInfo(builder)
package_name = 'blender-' + info.full_version package_name = 'blender-' + info.full_version
if platform: if platform:
package_name += '-' + platform package_name += '-' + platform
if not (builder.branch == 'master' or builder.is_release_branch): if not (builder.branch == 'master' or builder.is_release_branch):
if info.is_development_build: if info.is_development_build:
package_name = builder.branch + "-" + package_name package_name = builder.branch + "-" + package_name
return package_name return package_name
def sign_file_or_directory(path): def sign_file_or_directory(path):
from codesign.simple_code_signer import SimpleCodeSigner from codesign.simple_code_signer import SimpleCodeSigner
code_signer = SimpleCodeSigner() code_signer = SimpleCodeSigner()
@@ -64,6 +66,7 @@ def create_buildbot_upload_zip(builder, package_files):
sys.stderr.write('Create buildbot_upload.zip failed: ' + str(ex) + '\n') sys.stderr.write('Create buildbot_upload.zip failed: ' + str(ex) + '\n')
sys.exit(1) sys.exit(1)
def create_tar_xz(src, dest, package_name): def create_tar_xz(src, dest, package_name):
# One extra to remove leading os.sep when cleaning root for package_root # One extra to remove leading os.sep when cleaning root for package_root
ln = len(src) + 1 ln = len(src) + 1
@@ -91,6 +94,7 @@ def create_tar_xz(src, dest, package_name):
package.add(entry[0], entry[1], recursive=False, filter=_fakeroot) package.add(entry[0], entry[1], recursive=False, filter=_fakeroot)
package.close() package.close()
def cleanup_files(dirpath, extension): def cleanup_files(dirpath, extension):
for f in os.listdir(dirpath): for f in os.listdir(dirpath):
filepath = os.path.join(dirpath, f) filepath = os.path.join(dirpath, f)
@@ -171,7 +175,11 @@ def pack_linux(builder):
print("Stripping python...") print("Stripping python...")
py_target = os.path.join(builder.install_dir, info.short_version) py_target = os.path.join(builder.install_dir, info.short_version)
buildbot_utils.call(builder.command_prefix + ['find', py_target, '-iname', '*.so', '-exec', 'strip', '-s', '{}', ';']) buildbot_utils.call(
builder.command_prefix + [
'find', py_target, '-iname', '*.so', '-exec', 'strip', '-s', '{}', ';',
],
)
# Construct package name # Construct package name
platform_name = 'linux64' platform_name = 'linux64'

View File

@@ -22,18 +22,21 @@ import buildbot_utils
import os import os
import sys import sys
def get_ctest_arguments(builder): def get_ctest_arguments(builder):
args = ['--output-on-failure'] args = ['--output-on-failure']
if builder.platform == 'win': if builder.platform == 'win':
args += ['-C', 'Release'] args += ['-C', 'Release']
return args return args
def test(builder): def test(builder):
os.chdir(builder.build_dir) os.chdir(builder.build_dir)
command = builder.command_prefix + ['ctest'] + get_ctest_arguments(builder) command = builder.command_prefix + ['ctest'] + get_ctest_arguments(builder)
buildbot_utils.call(command) buildbot_utils.call(command)
if __name__ == "__main__": if __name__ == "__main__":
builder = buildbot_utils.create_builder_from_arguments() builder = buildbot_utils.create_builder_from_arguments()
test(builder) test(builder)

View File

@@ -52,7 +52,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(Alembic DEFAULT_MSG ALEMBIC_LIBRARY ALEMBIC_IN
IF(ALEMBIC_FOUND) IF(ALEMBIC_FOUND)
SET(ALEMBIC_LIBRARIES ${ALEMBIC_LIBRARY}) SET(ALEMBIC_LIBRARIES ${ALEMBIC_LIBRARY})
SET(ALEMBIC_INCLUDE_DIRS ${ALEMBIC_INCLUDE_DIR}) SET(ALEMBIC_INCLUDE_DIRS ${ALEMBIC_INCLUDE_DIR})
ENDIF(ALEMBIC_FOUND) ENDIF()
MARK_AS_ADVANCED( MARK_AS_ADVANCED(
ALEMBIC_INCLUDE_DIR ALEMBIC_INCLUDE_DIR

View File

@@ -30,7 +30,7 @@ SET(_audaspace_SEARCH_DIRS
FIND_PACKAGE(PkgConfig) FIND_PACKAGE(PkgConfig)
IF(PKG_CONFIG_FOUND) IF(PKG_CONFIG_FOUND)
PKG_CHECK_MODULES(AUDASPACE_PKGCONF audaspace) PKG_CHECK_MODULES(AUDASPACE_PKGCONF audaspace)
ENDIF(PKG_CONFIG_FOUND) ENDIF()
# Include dir # Include dir
FIND_PATH(AUDASPACE_INCLUDE_DIR FIND_PATH(AUDASPACE_INCLUDE_DIR
@@ -88,17 +88,17 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(Audaspace_Py DEFAULT_MSG AUDASPACE_PY_LIBRAR
IF(AUDASPACE_FOUND) IF(AUDASPACE_FOUND)
SET(AUDASPACE_LIBRARIES ${AUDASPACE_LIBRARY}) SET(AUDASPACE_LIBRARIES ${AUDASPACE_LIBRARY})
SET(AUDASPACE_INCLUDE_DIRS ${AUDASPACE_INCLUDE_DIR}) SET(AUDASPACE_INCLUDE_DIRS ${AUDASPACE_INCLUDE_DIR})
ENDIF(AUDASPACE_FOUND) ENDIF()
IF(AUDASPACE_C_FOUND) IF(AUDASPACE_C_FOUND)
SET(AUDASPACE_C_LIBRARIES ${AUDASPACE_C_LIBRARY}) SET(AUDASPACE_C_LIBRARIES ${AUDASPACE_C_LIBRARY})
SET(AUDASPACE_C_INCLUDE_DIRS ${AUDASPACE_C_INCLUDE_DIR}) SET(AUDASPACE_C_INCLUDE_DIRS ${AUDASPACE_C_INCLUDE_DIR})
ENDIF(AUDASPACE_C_FOUND) ENDIF()
IF(AUDASPACE_PY_FOUND) IF(AUDASPACE_PY_FOUND)
SET(AUDASPACE_PY_LIBRARIES ${AUDASPACE_PY_LIBRARY}) SET(AUDASPACE_PY_LIBRARIES ${AUDASPACE_PY_LIBRARY})
SET(AUDASPACE_PY_INCLUDE_DIRS ${AUDASPACE_PY_INCLUDE_DIR}) SET(AUDASPACE_PY_INCLUDE_DIRS ${AUDASPACE_PY_INCLUDE_DIR})
ENDIF(AUDASPACE_PY_FOUND) ENDIF()
MARK_AS_ADVANCED( MARK_AS_ADVANCED(
AUDASPACE_LIBRARY AUDASPACE_LIBRARY

View File

@@ -41,7 +41,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(Eigen3 DEFAULT_MSG
IF(EIGEN3_FOUND) IF(EIGEN3_FOUND)
SET(EIGEN3_INCLUDE_DIRS ${EIGEN3_INCLUDE_DIR}) SET(EIGEN3_INCLUDE_DIRS ${EIGEN3_INCLUDE_DIR})
ENDIF(EIGEN3_FOUND) ENDIF()
MARK_AS_ADVANCED( MARK_AS_ADVANCED(
EIGEN3_INCLUDE_DIR EIGEN3_INCLUDE_DIR

View File

@@ -80,7 +80,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(Embree DEFAULT_MSG
IF(EMBREE_FOUND) IF(EMBREE_FOUND)
SET(EMBREE_LIBRARIES ${_embree_LIBRARIES}) SET(EMBREE_LIBRARIES ${_embree_LIBRARIES})
SET(EMBREE_INCLUDE_DIRS ${EMBREE_INCLUDE_DIR}) SET(EMBREE_INCLUDE_DIRS ${EMBREE_INCLUDE_DIR})
ENDIF(EMBREE_FOUND) ENDIF()
MARK_AS_ADVANCED( MARK_AS_ADVANCED(
EMBREE_INCLUDE_DIR EMBREE_INCLUDE_DIR

View File

@@ -0,0 +1,83 @@
# - Find FFmpeg library and includes.
# Set FFMPEG_FIND_COMPONENTS to the canonical names of the libraries
# before using the module.
# This module defines
# FFMPEG_INCLUDE_DIRS, where to find libavcodec/ac3_parser.h.
# FFMPEG_LIBRARIES, libraries to link against to use FFmpeg.
# FFMPEG_ROOT_DIR, The base directory to search for FFmpeg.
# This can also be an environment variable.
# FFMPEG_FOUND, If false, do not try to use FFmpeg.
# FFMPEG_<COMPONENT>_LIBRARY, the given individual component libraries.
#=============================================================================
# Copyright 2020 Blender Foundation.
#
# Distributed under the OSI-approved BSD 3-Clause License,
# see accompanying file BSD-3-Clause-license.txt for details.
#=============================================================================
# If FFMPEG_ROOT_DIR was defined in the environment, use it.
if(NOT FFMPEG_ROOT_DIR AND NOT $ENV{FFMPEG_ROOT_DIR} STREQUAL "")
set(FFMPEG_ROOT_DIR $ENV{FFMPEG_ROOT_DIR})
endif()
set(_ffmpeg_SEARCH_DIRS
${FFMPEG_ROOT_DIR}
/opt/lib/ffmpeg
)
if(NOT FFMPEG_FIND_COMPONENTS)
set(FFMPEG_FIND_COMPONENTS
# List taken from http://ffmpeg.org/download.html#build-mac
avcodec
avdevice
avfilter
avformat
avutil
)
endif()
find_path(_ffmpeg_INCLUDE_DIR
NAMES
libavcodec/ac3_parser.h
HINTS
${_ffmpeg_SEARCH_DIRS}
PATH_SUFFIXES
include
)
set(_ffmpeg_LIBRARIES)
foreach(_component ${FFMPEG_FIND_COMPONENTS})
string(TOUPPER ${_component} _upper_COMPONENT)
find_library(FFMPEG_${_upper_COMPONENT}_LIBRARY
NAMES
${_upper_COMPONENT}
HINTS
${LIBDIR}/ffmpeg
PATH_SUFFIXES
lib64 lib
)
if(NOT FFMPEG_${_upper_COMPONENT}_LIBRARY)
message(WARNING "Could NOT find FFmpeg ${_upper_COMPONENT}.")
endif()
list(APPEND _ffmpeg_LIBRARIES ${FFMPEG_${_upper_COMPONENT}_LIBRARY})
mark_as_advanced(FFMPEG_${_upper_COMPONENT}_LIBRARY)
endforeach()
# handle the QUIETLY and REQUIRED arguments and set FFMPEG_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(FFmpeg DEFAULT_MSG
_ffmpeg_LIBRARIES _ffmpeg_INCLUDE_DIR)
IF(FFMPEG_FOUND)
set(FFMPEG_LIBRARIES ${_ffmpeg_LIBRARIES})
set(FFMPEG_INCLUDE_DIRS ${_ffmpeg_INCLUDE_DIR})
ENDIF()
mark_as_advanced(
FFMPEG_INCLUDE_DIR
)
unset(_ffmpeg_SEARCH_DIRS)
unset(_ffmpeg_LIBRARIES)
unset(_ffmpeg_INCLUDE_DIR)

View File

@@ -54,7 +54,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(Fftw3 DEFAULT_MSG
IF(FFTW3_FOUND) IF(FFTW3_FOUND)
SET(FFTW3_LIBRARIES ${FFTW3_LIBRARY}) SET(FFTW3_LIBRARIES ${FFTW3_LIBRARY})
SET(FFTW3_INCLUDE_DIRS ${FFTW3_INCLUDE_DIR}) SET(FFTW3_INCLUDE_DIRS ${FFTW3_INCLUDE_DIR})
ENDIF(FFTW3_FOUND) ENDIF()
MARK_AS_ADVANCED( MARK_AS_ADVANCED(
FFTW3_INCLUDE_DIR FFTW3_INCLUDE_DIR

View File

@@ -52,7 +52,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLEW DEFAULT_MSG
IF(GLEW_FOUND) IF(GLEW_FOUND)
SET(GLEW_INCLUDE_DIRS ${GLEW_INCLUDE_DIR}) SET(GLEW_INCLUDE_DIRS ${GLEW_INCLUDE_DIR})
ENDIF(GLEW_FOUND) ENDIF()
MARK_AS_ADVANCED( MARK_AS_ADVANCED(
GLEW_INCLUDE_DIR GLEW_INCLUDE_DIR

View File

@@ -82,7 +82,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(GMP DEFAULT_MSG
IF(GMP_FOUND) IF(GMP_FOUND)
SET(GMP_LIBRARIES ${GMPXX_LIBRARY} ${GMP_LIBRARY}) SET(GMP_LIBRARIES ${GMPXX_LIBRARY} ${GMP_LIBRARY})
SET(GMP_INCLUDE_DIRS ${GMP_INCLUDE_DIR} ${GMPXX_INCLUDE_DIR}) SET(GMP_INCLUDE_DIRS ${GMP_INCLUDE_DIR} ${GMPXX_INCLUDE_DIR})
ENDIF(GMP_FOUND) ENDIF()
MARK_AS_ADVANCED( MARK_AS_ADVANCED(
GMP_INCLUDE_DIR GMP_INCLUDE_DIR

View File

@@ -124,7 +124,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(Icu DEFAULT_MSG
IF(ICU_FOUND) IF(ICU_FOUND)
SET(ICU_LIBRARIES ${ICU_LIBRARY_DATA} ${ICU_LIBRARY_I18N} ${ICU_LIBRARY_IO} ${ICU_LIBRARY_LE} ${ICU_LIBRARY_LX} ${ICU_LIBRARY_TU} ${ICU_LIBRARY_UC}) SET(ICU_LIBRARIES ${ICU_LIBRARY_DATA} ${ICU_LIBRARY_I18N} ${ICU_LIBRARY_IO} ${ICU_LIBRARY_LE} ${ICU_LIBRARY_LX} ${ICU_LIBRARY_TU} ${ICU_LIBRARY_UC})
SET(ICU_INCLUDE_DIRS ${ICU_INCLUDE_DIR}) SET(ICU_INCLUDE_DIRS ${ICU_INCLUDE_DIR})
ENDIF(ICU_FOUND) ENDIF()
MARK_AS_ADVANCED( MARK_AS_ADVANCED(
ICU_INCLUDE_DIR ICU_INCLUDE_DIR

View File

@@ -54,7 +54,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(Jack DEFAULT_MSG
IF(JACK_FOUND) IF(JACK_FOUND)
SET(JACK_LIBRARIES ${JACK_LIBRARY}) SET(JACK_LIBRARIES ${JACK_LIBRARY})
SET(JACK_INCLUDE_DIRS ${JACK_INCLUDE_DIR}) SET(JACK_INCLUDE_DIRS ${JACK_INCLUDE_DIR})
ENDIF(JACK_FOUND) ENDIF()
MARK_AS_ADVANCED( MARK_AS_ADVANCED(
JACK_INCLUDE_DIR JACK_INCLUDE_DIR

View File

@@ -64,7 +64,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(JeMalloc DEFAULT_MSG
IF(JEMALLOC_FOUND) IF(JEMALLOC_FOUND)
SET(JEMALLOC_LIBRARIES ${JEMALLOC_LIBRARY}) SET(JEMALLOC_LIBRARIES ${JEMALLOC_LIBRARY})
SET(JEMALLOC_INCLUDE_DIRS ${JEMALLOC_INCLUDE_DIR}) SET(JEMALLOC_INCLUDE_DIRS ${JEMALLOC_INCLUDE_DIR})
ENDIF(JEMALLOC_FOUND) ENDIF()
MARK_AS_ADVANCED( MARK_AS_ADVANCED(
JEMALLOC_INCLUDE_DIR JEMALLOC_INCLUDE_DIR

View File

@@ -52,7 +52,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(LZO DEFAULT_MSG
IF(LZO_FOUND) IF(LZO_FOUND)
SET(LZO_LIBRARIES ${LZO_LIBRARY}) SET(LZO_LIBRARIES ${LZO_LIBRARY})
SET(LZO_INCLUDE_DIRS ${LZO_INCLUDE_DIR}) SET(LZO_INCLUDE_DIRS ${LZO_INCLUDE_DIR})
ENDIF(LZO_FOUND) ENDIF()
MARK_AS_ADVANCED( MARK_AS_ADVANCED(
LZO_INCLUDE_DIR LZO_INCLUDE_DIR

View File

@@ -0,0 +1,49 @@
# - Find NanoVDB library
# Find the native NanoVDB includes and library
# This module defines
# NANOVDB_INCLUDE_DIRS, where to find nanovdb.h, Set when
# NANOVDB_INCLUDE_DIR is found.
# NANOVDB_ROOT_DIR, The base directory to search for NanoVDB.
# This can also be an environment variable.
# NANOVDB_FOUND, If false, do not try to use NanoVDB.
#=============================================================================
# Copyright 2020 Blender Foundation.
#
# Distributed under the OSI-approved BSD 3-Clause License,
# see accompanying file BSD-3-Clause-license.txt for details.
#=============================================================================
# If NANOVDB_ROOT_DIR was defined in the environment, use it.
IF(NOT NANOVDB_ROOT_DIR AND NOT $ENV{NANOVDB_ROOT_DIR} STREQUAL "")
SET(NANOVDB_ROOT_DIR $ENV{NANOVDB_ROOT_DIR})
ENDIF()
SET(_nanovdb_SEARCH_DIRS
${NANOVDB_ROOT_DIR}
)
FIND_PATH(NANOVDB_INCLUDE_DIR
NAMES
nanovdb/NanoVDB.h
HINTS
${_nanovdb_SEARCH_DIRS}
PATH_SUFFIXES
include
)
# handle the QUIETLY and REQUIRED arguments and set NANOVDB_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(NanoVDB DEFAULT_MSG
NANOVDB_INCLUDE_DIR)
IF(NANOVDB_FOUND)
SET(NANOVDB_INCLUDE_DIRS ${NANOVDB_INCLUDE_DIR})
ENDIF(NANOVDB_FOUND)
MARK_AS_ADVANCED(
NANOVDB_INCLUDE_DIR
)
UNSET(_nanovdb_SEARCH_DIRS)

View File

@@ -95,7 +95,7 @@ IF(OSL_FOUND)
"\\1" OSL_LIBRARY_VERSION_MAJOR ${OSL_LIBRARY_VERSION_MAJOR}) "\\1" OSL_LIBRARY_VERSION_MAJOR ${OSL_LIBRARY_VERSION_MAJOR})
STRING(REGEX REPLACE ".*#define[ \t]+OSL_LIBRARY_VERSION_MINOR[ \t]+([.0-9]+).*" STRING(REGEX REPLACE ".*#define[ \t]+OSL_LIBRARY_VERSION_MINOR[ \t]+([.0-9]+).*"
"\\1" OSL_LIBRARY_VERSION_MINOR ${OSL_LIBRARY_VERSION_MINOR}) "\\1" OSL_LIBRARY_VERSION_MINOR ${OSL_LIBRARY_VERSION_MINOR})
ENDIF(OSL_FOUND) ENDIF()
MARK_AS_ADVANCED( MARK_AS_ADVANCED(
OSL_INCLUDE_DIR OSL_INCLUDE_DIR

View File

@@ -129,7 +129,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenCOLLADA DEFAULT_MSG
IF(OPENCOLLADA_FOUND) IF(OPENCOLLADA_FOUND)
SET(OPENCOLLADA_LIBRARIES ${_opencollada_LIBRARIES}) SET(OPENCOLLADA_LIBRARIES ${_opencollada_LIBRARIES})
SET(OPENCOLLADA_INCLUDE_DIRS ${_opencollada_INCLUDES}) SET(OPENCOLLADA_INCLUDE_DIRS ${_opencollada_INCLUDES})
ENDIF(OPENCOLLADA_FOUND) ENDIF()
UNSET(COMPONENT) UNSET(COMPONENT)
UNSET(UPPERCOMPONENT) UNSET(UPPERCOMPONENT)

View File

@@ -70,7 +70,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenColorIO DEFAULT_MSG
IF(OPENCOLORIO_FOUND) IF(OPENCOLORIO_FOUND)
SET(OPENCOLORIO_LIBRARIES ${_opencolorio_LIBRARIES}) SET(OPENCOLORIO_LIBRARIES ${_opencolorio_LIBRARIES})
SET(OPENCOLORIO_INCLUDE_DIRS ${OPENCOLORIO_INCLUDE_DIR}) SET(OPENCOLORIO_INCLUDE_DIRS ${OPENCOLORIO_INCLUDE_DIR})
ENDIF(OPENCOLORIO_FOUND) ENDIF()
MARK_AS_ADVANCED( MARK_AS_ADVANCED(
OPENCOLORIO_INCLUDE_DIR OPENCOLORIO_INCLUDE_DIR

View File

@@ -65,7 +65,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenJPEG DEFAULT_MSG
IF(OPENJPEG_FOUND) IF(OPENJPEG_FOUND)
SET(OPENJPEG_LIBRARIES ${OPENJPEG_LIBRARY}) SET(OPENJPEG_LIBRARIES ${OPENJPEG_LIBRARY})
SET(OPENJPEG_INCLUDE_DIRS ${OPENJPEG_INCLUDE_DIR}) SET(OPENJPEG_INCLUDE_DIRS ${OPENJPEG_INCLUDE_DIR})
ENDIF(OPENJPEG_FOUND) ENDIF()
MARK_AS_ADVANCED( MARK_AS_ADVANCED(
OPENJPEG_INCLUDE_DIR OPENJPEG_INCLUDE_DIR

View File

@@ -90,7 +90,7 @@ IF(OPENSUBDIV_FOUND)
OPENSUBDIV_CHECK_CONTROLLER("cudaEvaluator.h" OPENSUBDIV_HAS_CUDA) OPENSUBDIV_CHECK_CONTROLLER("cudaEvaluator.h" OPENSUBDIV_HAS_CUDA)
OPENSUBDIV_CHECK_CONTROLLER("glXFBEvaluator.h" OPENSUBDIV_HAS_GLSL_TRANSFORM_FEEDBACK) OPENSUBDIV_CHECK_CONTROLLER("glXFBEvaluator.h" OPENSUBDIV_HAS_GLSL_TRANSFORM_FEEDBACK)
OPENSUBDIV_CHECK_CONTROLLER("glComputeEvaluator.h" OPENSUBDIV_HAS_GLSL_COMPUTE) OPENSUBDIV_CHECK_CONTROLLER("glComputeEvaluator.h" OPENSUBDIV_HAS_GLSL_COMPUTE)
ENDIF(OPENSUBDIV_FOUND) ENDIF()
MARK_AS_ADVANCED( MARK_AS_ADVANCED(
OPENSUBDIV_INCLUDE_DIR OPENSUBDIV_INCLUDE_DIR

View File

@@ -55,7 +55,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenVDB DEFAULT_MSG
IF(OPENVDB_FOUND) IF(OPENVDB_FOUND)
SET(OPENVDB_LIBRARIES ${OPENVDB_LIBRARY}) SET(OPENVDB_LIBRARIES ${OPENVDB_LIBRARY})
SET(OPENVDB_INCLUDE_DIRS ${OPENVDB_INCLUDE_DIR}) SET(OPENVDB_INCLUDE_DIRS ${OPENVDB_INCLUDE_DIR})
ENDIF(OPENVDB_FOUND) ENDIF()
MARK_AS_ADVANCED( MARK_AS_ADVANCED(
OPENVDB_INCLUDE_DIR OPENVDB_INCLUDE_DIR

View File

@@ -41,7 +41,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(OptiX DEFAULT_MSG
IF(OPTIX_FOUND) IF(OPTIX_FOUND)
SET(OPTIX_INCLUDE_DIRS ${OPTIX_INCLUDE_DIR}) SET(OPTIX_INCLUDE_DIRS ${OPTIX_INCLUDE_DIR})
ENDIF(OPTIX_FOUND) ENDIF()
MARK_AS_ADVANCED( MARK_AS_ADVANCED(
OPTIX_INCLUDE_DIR OPTIX_INCLUDE_DIR

View File

@@ -57,7 +57,7 @@ SET(PCRE_LIBRARIES ${PCRE_LIBRARY})
IF(PCRE_FOUND) IF(PCRE_FOUND)
SET(PCRE_INCLUDE_DIRS ${PCRE_INCLUDE_DIR}) SET(PCRE_INCLUDE_DIRS ${PCRE_INCLUDE_DIR})
ENDIF(PCRE_FOUND) ENDIF()
MARK_AS_ADVANCED( MARK_AS_ADVANCED(
PCRE_INCLUDE_DIR PCRE_INCLUDE_DIR

View File

@@ -53,7 +53,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2 DEFAULT_MSG
IF(SDL2_FOUND) IF(SDL2_FOUND)
SET(SDL2_LIBRARIES ${SDL2_LIBRARY}) SET(SDL2_LIBRARIES ${SDL2_LIBRARY})
SET(SDL2_INCLUDE_DIRS ${SDL2_INCLUDE_DIR}) SET(SDL2_INCLUDE_DIRS ${SDL2_INCLUDE_DIR})
ENDIF(SDL2_FOUND) ENDIF()
MARK_AS_ADVANCED( MARK_AS_ADVANCED(
SDL2_INCLUDE_DIR SDL2_INCLUDE_DIR

View File

@@ -52,7 +52,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(SndFile DEFAULT_MSG
IF(SNDFILE_FOUND) IF(SNDFILE_FOUND)
SET(LIBSNDFILE_LIBRARIES ${LIBSNDFILE_LIBRARY}) SET(LIBSNDFILE_LIBRARIES ${LIBSNDFILE_LIBRARY})
SET(LIBSNDFILE_INCLUDE_DIRS ${LIBSNDFILE_INCLUDE_DIR}) SET(LIBSNDFILE_INCLUDE_DIRS ${LIBSNDFILE_INCLUDE_DIR})
ENDIF(SNDFILE_FOUND) ENDIF()
MARK_AS_ADVANCED( MARK_AS_ADVANCED(
LIBSNDFILE_INCLUDE_DIR LIBSNDFILE_INCLUDE_DIR

View File

@@ -54,7 +54,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(Spacenav DEFAULT_MSG
IF(SPACENAV_FOUND) IF(SPACENAV_FOUND)
SET(SPACENAV_LIBRARIES ${SPACENAV_LIBRARY}) SET(SPACENAV_LIBRARIES ${SPACENAV_LIBRARY})
SET(SPACENAV_INCLUDE_DIRS ${SPACENAV_INCLUDE_DIR}) SET(SPACENAV_INCLUDE_DIRS ${SPACENAV_INCLUDE_DIR})
ENDIF(SPACENAV_FOUND) ENDIF()
MARK_AS_ADVANCED( MARK_AS_ADVANCED(
SPACENAV_INCLUDE_DIR SPACENAV_INCLUDE_DIR

View File

@@ -59,7 +59,7 @@ ELSE()
get_filename_component(USD_LIBRARY_DIR ${USD_LIBRARY} DIRECTORY) get_filename_component(USD_LIBRARY_DIR ${USD_LIBRARY} DIRECTORY)
SET(USD_INCLUDE_DIRS ${USD_INCLUDE_DIR}) SET(USD_INCLUDE_DIRS ${USD_INCLUDE_DIR})
set(USD_LIBRARIES ${USD_LIBRARY}) set(USD_LIBRARIES ${USD_LIBRARY})
ENDIF(USD_FOUND) ENDIF()
ENDIF() ENDIF()
MARK_AS_ADVANCED( MARK_AS_ADVANCED(

View File

@@ -52,7 +52,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(XML2 DEFAULT_MSG
IF(XML2_FOUND) IF(XML2_FOUND)
SET(XML2_LIBRARIES ${XML2_LIBRARY}) SET(XML2_LIBRARIES ${XML2_LIBRARY})
SET(XML2_INCLUDE_DIRS ${XML2_INCLUDE_DIR}) SET(XML2_INCLUDE_DIRS ${XML2_INCLUDE_DIR})
ENDIF(XML2_FOUND) ENDIF()
MARK_AS_ADVANCED( MARK_AS_ADVANCED(
XML2_INCLUDE_DIR XML2_INCLUDE_DIR

View File

@@ -61,7 +61,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(XR_OpenXR_SDK DEFAULT_MSG
IF(XR_OPENXR_SDK_FOUND) IF(XR_OPENXR_SDK_FOUND)
SET(XR_OPENXR_SDK_LIBRARIES ${XR_OPENXR_SDK_LOADER_LIBRARY}) SET(XR_OPENXR_SDK_LIBRARIES ${XR_OPENXR_SDK_LOADER_LIBRARY})
SET(XR_OPENXR_SDK_INCLUDE_DIRS ${XR_OPENXR_SDK_INCLUDE_DIR}) SET(XR_OPENXR_SDK_INCLUDE_DIRS ${XR_OPENXR_SDK_INCLUDE_DIR})
ENDIF(XR_OPENXR_SDK_FOUND) ENDIF()
MARK_AS_ADVANCED( MARK_AS_ADVANCED(
XR_OPENXR_SDK_INCLUDE_DIR XR_OPENXR_SDK_INCLUDE_DIR

View File

@@ -355,6 +355,8 @@ def recursive_arg_sizes(node, ):
# print("adding", node.spelling) # print("adding", node.spelling)
for c in node.get_children(): for c in node.get_children():
recursive_arg_sizes(c) recursive_arg_sizes(c)
# cache function sizes # cache function sizes
recursive_arg_sizes(tu.cursor) recursive_arg_sizes(tu.cursor)
_defs.update(defs_precalc) _defs.update(defs_precalc)

View File

@@ -182,7 +182,7 @@ def create_nb_project_main():
f.write(' </logicalFolder>\n') f.write(' </logicalFolder>\n')
# default, but this dir is infact not in blender dir so we can ignore it # default, but this dir is infact not in blender dir so we can ignore it
# f.write(' <sourceFolderFilter>^(nbproject)$</sourceFolderFilter>\n') # f.write(' <sourceFolderFilter>^(nbproject)$</sourceFolderFilter>\n')
f.write(' <sourceFolderFilter>^(nbproject|__pycache__|.*\.py|.*\.html|.*\.blend)$</sourceFolderFilter>\n') f.write(r' <sourceFolderFilter>^(nbproject|__pycache__|.*\.py|.*\.html|.*\.blend)$</sourceFolderFilter>\n')
f.write(' <sourceRootList>\n') f.write(' <sourceRootList>\n')
f.write(' <Elem>%s</Elem>\n' % SOURCE_DIR) # base_root_rel f.write(' <Elem>%s</Elem>\n' % SOURCE_DIR) # base_root_rel

View File

@@ -8,6 +8,7 @@ import sys
cmakelists_file = sys.argv[-1] cmakelists_file = sys.argv[-1]
def main(): def main():
options = [] options = []
for l in open(cmakelists_file, 'r').readlines(): for l in open(cmakelists_file, 'r').readlines():

View File

@@ -49,8 +49,8 @@ def main():
check_commands = [] check_commands = []
for c, inc_dirs, defs in source_info: for c, inc_dirs, defs in source_info:
#~if "source/blender" not in c: # ~if "source/blender" not in c:
#~ continue # ~ continue
cmd = ([CHECKER_BIN] + cmd = ([CHECKER_BIN] +
CHECKER_ARGS + CHECKER_ARGS +

View File

@@ -55,7 +55,7 @@ set(WITH_USD ON CACHE BOOL "" FORCE)
set(WITH_MEM_JEMALLOC ON CACHE BOOL "" FORCE) set(WITH_MEM_JEMALLOC ON CACHE BOOL "" FORCE)
set(WITH_CYCLES_CUDA_BINARIES ON CACHE BOOL "" FORCE) set(WITH_CYCLES_CUDA_BINARIES ON CACHE BOOL "" FORCE)
set(WITH_CYCLES_CUBIN_COMPILER OFF CACHE BOOL "" FORCE) set(WITH_CYCLES_CUBIN_COMPILER OFF CACHE BOOL "" FORCE)
set(CYCLES_CUDA_BINARIES_ARCH sm_30;sm_35;sm_37;sm_50;sm_52;sm_60;sm_61;sm_70;sm_75;compute_75 CACHE STRING "" FORCE) set(CYCLES_CUDA_BINARIES_ARCH sm_30;sm_35;sm_37;sm_50;sm_52;sm_60;sm_61;sm_70;sm_75;sm_86;compute_75 CACHE STRING "" FORCE)
set(WITH_CYCLES_DEVICE_OPTIX ON CACHE BOOL "" FORCE) set(WITH_CYCLES_DEVICE_OPTIX ON CACHE BOOL "" FORCE)
# platform dependent options # platform dependent options

View File

@@ -114,5 +114,6 @@ def main():
import subprocess import subprocess
subprocess.call(cmd) subprocess.call(cmd)
if __name__ == "__main__": if __name__ == "__main__":
main() main()

View File

@@ -302,14 +302,14 @@ function(blender_add_lib__impl
# #
# What this code does it traverses library_deps and extracts information about whether # What this code does it traverses library_deps and extracts information about whether
# library is to provided as general, debug or optimized. This is a little state machine which # library is to provided as general, debug or optimized. This is a little state machine which
# keeps track of whiuch build type library is to provided for: # keeps track of which build type library is to provided for:
# #
# - If "debug" or "optimized" word is found, the next element in the list is expected to be # - If "debug" or "optimized" word is found, the next element in the list is expected to be
# a library which will be passed to target_link_libraries() under corresponding build type. # a library which will be passed to target_link_libraries() under corresponding build type.
# #
# - If there is no "debug" or "optimized" used library is specified for all build types. # - If there is no "debug" or "optimized" used library is specified for all build types.
# #
# NOTE: If separated libraries for debug and release ar eneeded every library is the list are # NOTE: If separated libraries for debug and release are needed every library is the list are
# to be prefixed explicitly. # to be prefixed explicitly.
# #
# Use: "optimized libfoo optimized libbar debug libfoo_d debug libbar_d" # Use: "optimized libfoo optimized libbar debug libfoo_d debug libbar_d"
@@ -477,8 +477,8 @@ function(SETUP_LIBDIRS)
# NOTE: For all new libraries, use absolute library paths. # NOTE: For all new libraries, use absolute library paths.
# This should eventually be phased out. # This should eventually be phased out.
# APPLE plaform uses full paths for linking libraries, and avoids link_directories.
if(NOT MSVC) if(NOT MSVC AND NOT APPLE)
link_directories(${JPEG_LIBPATH} ${PNG_LIBPATH} ${ZLIB_LIBPATH} ${FREETYPE_LIBPATH}) link_directories(${JPEG_LIBPATH} ${PNG_LIBPATH} ${ZLIB_LIBPATH} ${FREETYPE_LIBPATH})
if(WITH_PYTHON) # AND NOT WITH_PYTHON_MODULE # WIN32 needs if(WITH_PYTHON) # AND NOT WITH_PYTHON_MODULE # WIN32 needs
@@ -1241,8 +1241,16 @@ endmacro()
macro(without_system_libs_begin) macro(without_system_libs_begin)
set(CMAKE_IGNORE_PATH "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES};${CMAKE_SYSTEM_INCLUDE_PATH};${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES};${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}") set(CMAKE_IGNORE_PATH "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES};${CMAKE_SYSTEM_INCLUDE_PATH};${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES};${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}")
if(APPLE)
# Avoid searching for headers in frameworks (like Mono), and libraries in LIBDIR.
set(CMAKE_FIND_FRAMEWORK NEVER)
endif()
endmacro() endmacro()
macro(without_system_libs_end) macro(without_system_libs_end)
unset(CMAKE_IGNORE_PATH) unset(CMAKE_IGNORE_PATH)
if(APPLE)
# FIRST is the default.
set(CMAKE_FIND_FRAMEWORK FIRST)
endif()
endmacro() endmacro()

View File

@@ -30,6 +30,36 @@ macro(find_package_wrapper)
# do nothing, just satisfy the macro # do nothing, just satisfy the macro
endmacro() endmacro()
function(print_found_status
lib_name
lib_path
)
if(FIRST_RUN)
if(lib_path)
message(STATUS "Found ${lib_name}: ${lib_path}")
else()
message(WARNING "Could NOT find ${lib_name}")
endif()
endif()
endfunction()
# ------------------------------------------------------------------------
# Find system provided libraries.
# Find system ZLIB, not the pre-compiled one supplied with OpenCollada.
set(ZLIB_ROOT /usr)
find_package(ZLIB REQUIRED)
find_package(BZip2 REQUIRED)
list(APPEND ZLIB_LIBRARIES ${BZIP2_LIBRARIES})
if(WITH_OPENAL)
find_package(OpenAL)
if(NOT OPENAL_FOUND)
set(WITH_OPENAL OFF)
endif()
endif()
if(NOT DEFINED LIBDIR) if(NOT DEFINED LIBDIR)
set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin) set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin)
# Prefer lib directory paths # Prefer lib directory paths
@@ -42,22 +72,15 @@ if(NOT EXISTS "${LIBDIR}/")
message(FATAL_ERROR "Mac OSX requires pre-compiled libs at: '${LIBDIR}'") message(FATAL_ERROR "Mac OSX requires pre-compiled libs at: '${LIBDIR}'")
endif() endif()
if(WITH_OPENAL) # -------------------------------------------------------------------------
find_package(OpenAL) # Find precompiled libraries, and avoid system or user-installed ones.
if(OPENAL_FOUND)
set(WITH_OPENAL ON) if(EXISTS ${LIBDIR})
else() without_system_libs_begin()
set(WITH_OPENAL OFF)
endif()
endif() endif()
if(WITH_ALEMBIC) if(WITH_ALEMBIC)
set(ALEMBIC ${LIBDIR}/alembic) find_package(Alembic)
set(ALEMBIC_INCLUDE_DIR ${ALEMBIC}/include)
set(ALEMBIC_INCLUDE_DIRS ${ALEMBIC_INCLUDE_DIR})
set(ALEMBIC_LIBPATH ${ALEMBIC}/lib)
set(ALEMBIC_LIBRARIES Alembic)
set(ALEMBIC_FOUND ON)
endif() endif()
if(WITH_USD) if(WITH_USD)
@@ -68,30 +91,38 @@ if(WITH_USD)
endif() endif()
if(WITH_OPENSUBDIV) if(WITH_OPENSUBDIV)
set(OPENSUBDIV ${LIBDIR}/opensubdiv) find_package(OpenSubdiv)
set(OPENSUBDIV_LIBPATH ${OPENSUBDIV}/lib)
find_library(OSD_LIB_CPU NAMES osdCPU PATHS ${OPENSUBDIV_LIBPATH})
find_library(OSD_LIB_GPU NAMES osdGPU PATHS ${OPENSUBDIV_LIBPATH})
set(OPENSUBDIV_INCLUDE_DIR ${OPENSUBDIV}/include)
set(OPENSUBDIV_INCLUDE_DIRS ${OPENSUBDIV_INCLUDE_DIR})
list(APPEND OPENSUBDIV_LIBRARIES ${OSD_LIB_CPU} ${OSD_LIB_GPU})
endif() endif()
if(WITH_JACK) if(WITH_JACK)
find_library(JACK_FRAMEWORK find_library(JACK_FRAMEWORK
NAMES jackmp NAMES jackmp
) )
set(JACK_INCLUDE_DIRS ${JACK_FRAMEWORK}/headers)
if(NOT JACK_FRAMEWORK) if(NOT JACK_FRAMEWORK)
set(WITH_JACK OFF) set(WITH_JACK OFF)
else()
set(JACK_INCLUDE_DIRS ${JACK_FRAMEWORK}/headers)
endif() endif()
endif() endif()
if(WITH_CODEC_SNDFILE) if(WITH_CODEC_SNDFILE)
set(LIBSNDFILE ${LIBDIR}/sndfile) find_package(SndFile)
set(LIBSNDFILE_INCLUDE_DIRS ${LIBSNDFILE}/include) find_library(_sndfile_FLAC_LIBRARY NAMES flac HINTS ${LIBDIR}/sndfile/lib)
set(LIBSNDFILE_LIBRARIES sndfile FLAC ogg vorbis vorbisenc) find_library(_sndfile_OGG_LIBRARY NAMES ogg HINTS ${LIBDIR}/ffmpeg/lib)
set(LIBSNDFILE_LIBPATH ${LIBSNDFILE}/lib ${LIBDIR}/ffmpeg/lib) # TODO, deprecate find_library(_sndfile_VORBIS_LIBRARY NAMES vorbis HINTS ${LIBDIR}/ffmpeg/lib)
find_library(_sndfile_VORBISENC_LIBRARY NAMES vorbisenc HINTS ${LIBDIR}/ffmpeg/lib)
list(APPEND LIBSNDFILE_LIBRARIES
${_sndfile_FLAC_LIBRARY}
${_sndfile_OGG_LIBRARY}
${_sndfile_VORBIS_LIBRARY}
${_sndfile_VORBISENC_LIBRARY}
)
print_found_status("SndFile libraries" "${LIBSNDFILE_LIBRARIES}")
unset(_sndfile_FLAC_LIBRARY)
unset(_sndfile_OGG_LIBRARY)
unset(_sndfile_VORBIS_LIBRARY)
unset(_sndfile_VORBISENC_LIBRARY)
endif() endif()
if(WITH_PYTHON) if(WITH_PYTHON)
@@ -130,54 +161,27 @@ if(WITH_PYTHON)
endif() endif()
if(WITH_FFTW3) if(WITH_FFTW3)
set(FFTW3 ${LIBDIR}/fftw3) find_package(Fftw3)
set(FFTW3_INCLUDE_DIRS ${FFTW3}/include)
set(FFTW3_LIBRARIES fftw3)
set(FFTW3_LIBPATH ${FFTW3}/lib)
endif() endif()
set(ZLIB /usr) find_package(Freetype REQUIRED)
set(ZLIB_INCLUDE_DIRS "${ZLIB}/include")
set(ZLIB_LIBRARIES z bz2)
set(PNG_LIBRARIES png ${ZLIB_LIBRARIES})
set(JPEG_LIBRARIES jpeg)
set(FREETYPE ${LIBDIR}/freetype)
set(FREETYPE_INCLUDE_DIRS ${FREETYPE}/include ${FREETYPE}/include/freetype2)
set(FREETYPE_LIBPATH ${FREETYPE}/lib)
set(FREETYPE_LIBRARY freetype)
if(WITH_IMAGE_OPENEXR) if(WITH_IMAGE_OPENEXR)
set(OPENEXR ${LIBDIR}/openexr) find_package(OpenEXR)
set(OPENEXR_INCLUDE_DIR ${OPENEXR}/include)
set(OPENEXR_INCLUDE_DIRS ${OPENEXR_INCLUDE_DIR} ${OPENEXR}/include/OpenEXR)
set(OPENEXR_LIBRARIES
Iex
Half
IlmImf
Imath
IlmThread)
set(OPENEXR_LIBPATH ${OPENEXR}/lib)
endif() endif()
if(WITH_CODEC_FFMPEG) if(WITH_CODEC_FFMPEG)
set(FFMPEG ${LIBDIR}/ffmpeg) set(FFMPEG_FIND_COMPONENTS
set(FFMPEG_INCLUDE_DIRS ${FFMPEG}/include)
set(FFMPEG_LIBRARIES
avcodec avdevice avformat avutil avcodec avdevice avformat avutil
mp3lame swscale x264 xvidcore mp3lame ogg opus swresample swscale
theora theoradec theoraenc theora theoradec theoraenc vorbis vorbisenc
vorbis vorbisenc vorbisfile ogg opus vorbisfile vpx x264 xvidcore)
vpx swresample) find_package(FFmpeg)
set(FFMPEG_LIBPATH ${FFMPEG}/lib)
endif() endif()
if(WITH_IMAGE_OPENJPEG OR WITH_CODEC_FFMPEG) if(WITH_IMAGE_OPENJPEG OR WITH_CODEC_FFMPEG)
# use openjpeg from libdir that is linked into ffmpeg # use openjpeg from libdir that is linked into ffmpeg
set(OPENJPEG ${LIBDIR}/openjpeg) find_package(OpenJPEG)
set(OPENJPEG_INCLUDE_DIRS ${OPENJPEG}/include)
set(OPENJPEG_LIBRARIES ${OPENJPEG}/lib/libopenjp2.a)
endif() endif()
find_library(SYSTEMSTUBS_LIBRARY find_library(SYSTEMSTUBS_LIBRARY
@@ -207,77 +211,58 @@ if(WITH_PYTHON_MODULE OR WITH_PYTHON_FRAMEWORK)
endif() endif()
if(WITH_OPENCOLLADA) if(WITH_OPENCOLLADA)
set(OPENCOLLADA ${LIBDIR}/opencollada) find_package(OpenCOLLADA)
find_library(PCRE_LIBRARIES NAMES pcre HINTS ${LIBDIR}/opencollada/lib)
set(OPENCOLLADA_INCLUDE_DIRS find_library(XML2_LIBRARIES NAMES xml2 HINTS ${LIBDIR}/opencollada/lib)
${LIBDIR}/opencollada/include/COLLADAStreamWriter print_found_status("PCRE" "${PCRE_LIBRARIES}")
${LIBDIR}/opencollada/include/COLLADABaseUtils print_found_status("XML2" "${XML2_LIBRARIES}")
${LIBDIR}/opencollada/include/COLLADAFramework
${LIBDIR}/opencollada/include/COLLADASaxFrameworkLoader
${LIBDIR}/opencollada/include/GeneratedSaxParser
)
set(OPENCOLLADA_LIBPATH ${OPENCOLLADA}/lib)
set(OPENCOLLADA_LIBRARIES
OpenCOLLADASaxFrameworkLoader
-lOpenCOLLADAFramework
-lOpenCOLLADABaseUtils
-lOpenCOLLADAStreamWriter
-lMathMLSolver
-lGeneratedSaxParser
-lbuffer -lftoa -lUTF
)
# PCRE and XML2 are bundled with OpenCollada.
set(PCRE_LIBRARIES pcre)
set(XML2_LIBRARIES xml2)
endif() endif()
if(WITH_SDL) if(WITH_SDL)
set(SDL ${LIBDIR}/sdl) find_package(SDL2)
set(SDL_INCLUDE_DIR ${SDL}/include) set(SDL_INCLUDE_DIR ${SDL2_INCLUDE_DIRS})
set(SDL_LIBRARY SDL2) set(SDL_LIBRARY ${SDL2_LIBRARIES})
set(SDL_LIBPATH ${SDL}/lib)
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -framework ForceFeedback") set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -framework ForceFeedback")
endif() endif()
set(PNG "${LIBDIR}/png") set(PNG_ROOT ${LIBDIR}/png)
set(PNG_INCLUDE_DIRS "${PNG}/include") find_package(PNG REQUIRED)
set(PNG_LIBPATH ${PNG}/lib)
set(JPEG "${LIBDIR}/jpeg") set(JPEG_ROOT ${LIBDIR}/jpeg)
set(JPEG_INCLUDE_DIR "${JPEG}/include") find_package(JPEG REQUIRED)
set(JPEG_LIBPATH ${JPEG}/lib)
if(WITH_IMAGE_TIFF) if(WITH_IMAGE_TIFF)
set(TIFF ${LIBDIR}/tiff) set(TIFF_ROOT ${LIBDIR}/tiff)
set(TIFF_INCLUDE_DIR ${TIFF}/include) find_package(TIFF)
set(TIFF_LIBRARY tiff) if(NOT TIFF_FOUND)
set(TIFF_LIBPATH ${TIFF}/lib) message(WARNING "TIFF not found, disabling WITH_IMAGE_TIFF")
set(WITH_IMAGE_TIFF OFF)
endif()
endif() endif()
if(WITH_BOOST) if(WITH_BOOST)
set(BOOST ${LIBDIR}/boost) set(Boost_NO_BOOST_CMAKE ON)
set(BOOST_INCLUDE_DIR ${BOOST}/include) set(BOOST_ROOT ${LIBDIR}/boost)
set(BOOST_POSTFIX) set(Boost_NO_SYSTEM_PATHS ON)
set(BOOST_LIBRARIES set(_boost_FIND_COMPONENTS date_time filesystem regex system thread wave)
boost_date_time${BOOST_POSTFIX}
boost_filesystem${BOOST_POSTFIX}
boost_regex${BOOST_POSTFIX}
boost_system${BOOST_POSTFIX}
boost_thread${BOOST_POSTFIX}
boost_wave${BOOST_POSTFIX}
)
if(WITH_INTERNATIONAL) if(WITH_INTERNATIONAL)
list(APPEND BOOST_LIBRARIES boost_locale${BOOST_POSTFIX}) list(APPEND _boost_FIND_COMPONENTS locale)
endif() endif()
if(WITH_CYCLES_NETWORK) if(WITH_CYCLES_NETWORK)
list(APPEND BOOST_LIBRARIES boost_serialization${BOOST_POSTFIX}) list(APPEND _boost_FIND_COMPONENTS serialization)
endif() endif()
if(WITH_OPENVDB) if(WITH_OPENVDB)
list(APPEND BOOST_LIBRARIES boost_iostreams${BOOST_POSTFIX}) list(APPEND _boost_FIND_COMPONENTS iostreams)
endif() endif()
set(BOOST_LIBPATH ${BOOST}/lib) find_package(Boost COMPONENTS ${_boost_FIND_COMPONENTS})
set(BOOST_LIBRARIES ${Boost_LIBRARIES})
set(BOOST_INCLUDE_DIR ${Boost_INCLUDE_DIRS})
set(BOOST_DEFINITIONS) set(BOOST_DEFINITIONS)
mark_as_advanced(Boost_LIBRARIES)
mark_as_advanced(Boost_INCLUDE_DIRS)
unset(_boost_FIND_COMPONENTS)
endif() endif()
if(WITH_INTERNATIONAL OR WITH_CODEC_FFMPEG) if(WITH_INTERNATIONAL OR WITH_CODEC_FFMPEG)
@@ -285,10 +270,8 @@ if(WITH_INTERNATIONAL OR WITH_CODEC_FFMPEG)
endif() endif()
if(WITH_OPENIMAGEIO) if(WITH_OPENIMAGEIO)
set(OPENIMAGEIO ${LIBDIR}/openimageio) find_package(OpenImageIO)
set(OPENIMAGEIO_INCLUDE_DIRS ${OPENIMAGEIO}/include) list(APPEND OPENIMAGEIO_LIBRARIES
set(OPENIMAGEIO_LIBRARIES
${OPENIMAGEIO}/lib/libOpenImageIO.a
${PNG_LIBRARIES} ${PNG_LIBRARIES}
${JPEG_LIBRARIES} ${JPEG_LIBRARIES}
${TIFF_LIBRARY} ${TIFF_LIBRARY}
@@ -296,69 +279,30 @@ if(WITH_OPENIMAGEIO)
${OPENJPEG_LIBRARIES} ${OPENJPEG_LIBRARIES}
${ZLIB_LIBRARIES} ${ZLIB_LIBRARIES}
) )
set(OPENIMAGEIO_LIBPATH
${OPENIMAGEIO}/lib
${JPEG_LIBPATH}
${PNG_LIBPATH}
${TIFF_LIBPATH}
${OPENEXR_LIBPATH}
${ZLIB_LIBPATH}
)
set(OPENIMAGEIO_DEFINITIONS "-DOIIO_STATIC_BUILD") set(OPENIMAGEIO_DEFINITIONS "-DOIIO_STATIC_BUILD")
set(OPENIMAGEIO_IDIFF "${LIBDIR}/openimageio/bin/idiff") set(OPENIMAGEIO_IDIFF "${LIBDIR}/openimageio/bin/idiff")
endif() endif()
if(WITH_OPENCOLORIO) if(WITH_OPENCOLORIO)
set(OPENCOLORIO ${LIBDIR}/opencolorio) find_package(OpenColorIO)
set(OPENCOLORIO_INCLUDE_DIRS ${OPENCOLORIO}/include)
set(OPENCOLORIO_LIBRARIES OpenColorIO tinyxml yaml-cpp)
set(OPENCOLORIO_LIBPATH ${OPENCOLORIO}/lib)
endif() endif()
if(WITH_OPENVDB) if(WITH_OPENVDB)
set(OPENVDB ${LIBDIR}/openvdb) find_package(OpenVDB)
set(OPENVDB_INCLUDE_DIRS ${OPENVDB}/include) find_library(BLOSC_LIBRARIES NAMES blosc HINTS ${LIBDIR}/openvdb/lib)
set(OPENVDB_LIBRARIES openvdb blosc) print_found_status("Blosc" "${BLOSC_LIBRARIES}")
set(OPENVDB_LIBPATH ${LIBDIR}/openvdb/lib) list(APPEND OPENVDB_LIBRARIES ${BLOSC_LIBRARIES})
set(OPENVDB_DEFINITIONS) set(OPENVDB_DEFINITIONS)
endif() endif()
if(WITH_LLVM) if(WITH_NANOVDB)
set(LLVM_ROOT_DIR ${LIBDIR}/llvm) set(NANOVDB ${LIBDIR}/nanovdb)
if(EXISTS "${LLVM_ROOT_DIR}/bin/llvm-config") set(NANOVDB_INCLUDE_DIR ${NANOVDB}/include)
set(LLVM_CONFIG "${LLVM_ROOT_DIR}/bin/llvm-config") endif()
else()
set(LLVM_CONFIG llvm-config)
endif()
execute_process(COMMAND ${LLVM_CONFIG} --version
OUTPUT_VARIABLE LLVM_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ${LLVM_CONFIG} --prefix
OUTPUT_VARIABLE LLVM_ROOT_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ${LLVM_CONFIG} --includedir
OUTPUT_VARIABLE LLVM_INCLUDE_DIRS
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ${LLVM_CONFIG} --libdir
OUTPUT_VARIABLE LLVM_LIBPATH
OUTPUT_STRIP_TRAILING_WHITESPACE)
find_library(LLVM_LIBRARY
NAMES LLVMAnalysis # first of a whole bunch of libs to get
PATHS ${LLVM_LIBPATH})
if(LLVM_LIBRARY AND LLVM_ROOT_DIR AND LLVM_LIBPATH) if(WITH_LLVM)
if(LLVM_STATIC) find_package(LLVM)
# if static LLVM libraries were requested, use llvm-config to generate if(NOT LLVM_FOUND)
# the list of what libraries we need, and substitute that in the right
# way for LLVM_LIBRARY.
execute_process(COMMAND ${LLVM_CONFIG} --libfiles
OUTPUT_VARIABLE LLVM_LIBRARY
OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REPLACE ".a /" ".a;/" LLVM_LIBRARY ${LLVM_LIBRARY})
else()
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -lLLVM-3.4")
endif()
else()
message(FATAL_ERROR "LLVM not found.") message(FATAL_ERROR "LLVM not found.")
endif() endif()
endif() endif()
@@ -391,7 +335,10 @@ endif()
if(WITH_CYCLES_EMBREE) if(WITH_CYCLES_EMBREE)
find_package(Embree 3.8.0 REQUIRED) find_package(Embree 3.8.0 REQUIRED)
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Xlinker -stack_size -Xlinker 0x100000") # Increase stack size for Embree, only works for executables.
if(NOT WITH_PYTHON_MODULE)
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Xlinker -stack_size -Xlinker 0x100000")
endif()
# Embree static library linking can mix up SSE and AVX symbols, causing # Embree static library linking can mix up SSE and AVX symbols, causing
# crashes on macOS systems with older CPUs that don't have AVX. Using # crashes on macOS systems with older CPUs that don't have AVX. Using
@@ -427,7 +374,7 @@ endif()
# CMake FindOpenMP doesn't know about AppleClang before 3.12, so provide custom flags. # CMake FindOpenMP doesn't know about AppleClang before 3.12, so provide custom flags.
if(WITH_OPENMP) if(WITH_OPENMP)
if(CMAKE_C_COMPILER_ID MATCHES "AppleClang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "7.0") if(CMAKE_C_COMPILER_ID MATCHES "Clang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "7.0")
# Use OpenMP from our precompiled libraries. # Use OpenMP from our precompiled libraries.
message(STATUS "Using ${LIBDIR}/openmp for OpenMP") message(STATUS "Using ${LIBDIR}/openmp for OpenMP")
set(OPENMP_CUSTOM ON) set(OPENMP_CUSTOM ON)
@@ -437,14 +384,22 @@ if(WITH_OPENMP)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L'${LIBDIR}/openmp/lib' -lomp") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L'${LIBDIR}/openmp/lib' -lomp")
# Copy libomp.dylib to allow executables like datatoc and tests to work. # Copy libomp.dylib to allow executables like datatoc and tests to work.
# `@executable_path/../Resources/lib/` is a default dylib search path.
# For single config generator datatoc, tests etc.
execute_process( execute_process(
COMMAND mkdir -p ${CMAKE_BINARY_DIR}/Resources/lib COMMAND mkdir -p ${CMAKE_BINARY_DIR}/Resources/lib
COMMAND cp -p ${LIBDIR}/openmp/lib/libomp.dylib ${CMAKE_BINARY_DIR}/Resources/lib/libomp.dylib COMMAND cp -p ${LIBDIR}/openmp/lib/libomp.dylib ${CMAKE_BINARY_DIR}/Resources/lib/libomp.dylib
) )
# For multi-config generator datatoc, etc.
execute_process( execute_process(
COMMAND mkdir -p ${CMAKE_BINARY_DIR}/bin/Resources/lib COMMAND mkdir -p ${CMAKE_BINARY_DIR}/bin/Resources/lib
COMMAND cp -p ${LIBDIR}/openmp/lib/libomp.dylib ${CMAKE_BINARY_DIR}/bin/Resources/lib/libomp.dylib COMMAND cp -p ${LIBDIR}/openmp/lib/libomp.dylib ${CMAKE_BINARY_DIR}/bin/Resources/lib/libomp.dylib
) )
# For multi-config generator tests.
execute_process(
COMMAND mkdir -p ${CMAKE_BINARY_DIR}/bin/tests/Resources/lib
COMMAND cp -p ${LIBDIR}/openmp/lib/libomp.dylib ${CMAKE_BINARY_DIR}/bin/tests/Resources/lib/libomp.dylib
)
endif() endif()
endif() endif()
@@ -464,6 +419,13 @@ if(WITH_GMP)
endif() endif()
endif() endif()
if(EXISTS ${LIBDIR})
without_system_libs_end()
endif()
# ---------------------------------------------------------------------
# Set compiler and linker flags.
set(EXETYPE MACOSX_BUNDLE) set(EXETYPE MACOSX_BUNDLE)
set(CMAKE_C_FLAGS_DEBUG "-fno-strict-aliasing -g") set(CMAKE_C_FLAGS_DEBUG "-fno-strict-aliasing -g")

View File

@@ -264,6 +264,7 @@ endif()
if(WITH_OPENVDB) if(WITH_OPENVDB)
find_package_wrapper(OpenVDB) find_package_wrapper(OpenVDB)
find_package_wrapper(Blosc) find_package_wrapper(Blosc)
if(NOT OPENVDB_FOUND) if(NOT OPENVDB_FOUND)
set(WITH_OPENVDB OFF) set(WITH_OPENVDB OFF)
set(WITH_OPENVDB_BLOSC OFF) set(WITH_OPENVDB_BLOSC OFF)
@@ -274,6 +275,15 @@ if(WITH_OPENVDB)
endif() endif()
endif() endif()
if(WITH_NANOVDB)
find_package_wrapper(NanoVDB)
if(NOT NANOVDB_FOUND)
set(WITH_NANOVDB OFF)
message(STATUS "NanoVDB not found, disabling it")
endif()
endif()
if(WITH_ALEMBIC) if(WITH_ALEMBIC)
find_package_wrapper(Alembic) find_package_wrapper(Alembic)

View File

@@ -535,6 +535,11 @@ if(WITH_OPENVDB)
set(OPENVDB_DEFINITIONS -DNOMINMAX -D_USE_MATH_DEFINES) set(OPENVDB_DEFINITIONS -DNOMINMAX -D_USE_MATH_DEFINES)
endif() endif()
if(WITH_NANOVDB)
set(NANOVDB ${LIBDIR}/nanoVDB)
set(NANOVDB_INCLUDE_DIR ${NANOVDB}/include)
endif()
if(WITH_OPENIMAGEDENOISE) if(WITH_OPENIMAGEDENOISE)
set(OPENIMAGEDENOISE ${LIBDIR}/OpenImageDenoise) set(OPENIMAGEDENOISE ${LIBDIR}/OpenImageDenoise)
set(OPENIMAGEDENOISE_LIBPATH ${LIBDIR}/OpenImageDenoise/lib) set(OPENIMAGEDENOISE_LIBPATH ${LIBDIR}/OpenImageDenoise/lib)
@@ -715,14 +720,24 @@ if(WINDOWS_PYTHON_DEBUG)
string(REPLACE "/" "\\" _group_path "${_source_path}") string(REPLACE "/" "\\" _group_path "${_source_path}")
source_group("${_group_path}" FILES "${_source}") source_group("${_group_path}" FILES "${_source}")
endforeach() endforeach()
# Include the user scripts from the profile folder in the blender_python_user_scripts project.
set(USER_SCRIPTS_ROOT "$ENV{appdata}/blender foundation/blender/${BLENDER_VERSION}") # If the user scripts env var is set, include scripts from there otherwise
# include user scripts in the profile folder.
if(DEFINED ENV{BLENDER_USER_SCRIPTS})
message(STATUS "Including user scripts from environment BLENDER_USER_SCRIPTS=$ENV{BLENDER_USER_SCRIPTS}")
set(USER_SCRIPTS_ROOT "$ENV{BLENDER_USER_SCRIPTS}")
else()
message(STATUS "Including user scripts from the profile folder")
# Include the user scripts from the profile folder in the blender_python_user_scripts project.
set(USER_SCRIPTS_ROOT "$ENV{appdata}/blender foundation/blender/${BLENDER_VERSION}/scripts")
endif()
file(TO_CMAKE_PATH ${USER_SCRIPTS_ROOT} USER_SCRIPTS_ROOT) file(TO_CMAKE_PATH ${USER_SCRIPTS_ROOT} USER_SCRIPTS_ROOT)
FILE(GLOB_RECURSE inFiles "${USER_SCRIPTS_ROOT}/scripts/*.*" ) FILE(GLOB_RECURSE inFiles "${USER_SCRIPTS_ROOT}/*.*" )
ADD_CUSTOM_TARGET(blender_python_user_scripts SOURCES ${inFiles}) ADD_CUSTOM_TARGET(blender_python_user_scripts SOURCES ${inFiles})
foreach(_source IN ITEMS ${inFiles}) foreach(_source IN ITEMS ${inFiles})
get_filename_component(_source_path "${_source}" PATH) get_filename_component(_source_path "${_source}" PATH)
string(REPLACE "${USER_SCRIPTS_ROOT}/scripts" "" _source_path "${_source_path}") string(REPLACE "${USER_SCRIPTS_ROOT}" "" _source_path "${_source_path}")
string(REPLACE "/" "\\" _group_path "${_source_path}") string(REPLACE "/" "\\" _group_path "${_source_path}")
source_group("${_group_path}" FILES "${_source}") source_group("${_group_path}" FILES "${_source}")
endforeach() endforeach()
@@ -766,4 +781,3 @@ if(WITH_POTRACE)
set(POTRACE_LIBRARIES ${LIBDIR}/potrace/lib/potrace.lib) set(POTRACE_LIBRARIES ${LIBDIR}/potrace/lib/potrace.lib)
set(POTRACE_FOUND On) set(POTRACE_FOUND On)
endif() endif()

View File

@@ -25,7 +25,7 @@ __all__ = (
import sys import sys
if not sys.version_info.major < 3: if sys.version_info.major < 3:
print("\nPython3.x or newer needed, found %s.\nAborting!\n" % print("\nPython3.x or newer needed, found %s.\nAborting!\n" %
sys.version.partition(" ")[0]) sys.version.partition(" ")[0])
sys.exit(1) sys.exit(1)
@@ -242,5 +242,6 @@ def main():
for s in build_info(): for s in build_info():
print(s) print(s)
if __name__ == "__main__": if __name__ == "__main__":
main() main()

View File

@@ -12,6 +12,7 @@ from make_utils import call
# Parse arguments # Parse arguments
def parse_arguments(): def parse_arguments():
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument("--ctest-command", default="ctest") parser.add_argument("--ctest-command", default="ctest")
@@ -22,6 +23,7 @@ def parse_arguments():
parser.add_argument("build_directory") parser.add_argument("build_directory")
return parser.parse_args() return parser.parse_args()
args = parse_arguments() args = parse_arguments()
git_command = args.git_command git_command = args.git_command
svn_command = args.svn_command svn_command = args.svn_command

View File

@@ -14,12 +14,15 @@ import sys
import make_utils import make_utils
from make_utils import call, check_output from make_utils import call, check_output
def print_stage(text): def print_stage(text):
print("") print("")
print(text) print(text)
print("") print("")
# Parse arguments # Parse arguments
def parse_arguments(): def parse_arguments():
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument("--no-libraries", action="store_true") parser.add_argument("--no-libraries", action="store_true")
@@ -31,10 +34,13 @@ def parse_arguments():
parser.add_argument("--use-centos-libraries", action="store_true") parser.add_argument("--use-centos-libraries", action="store_true")
return parser.parse_args() return parser.parse_args()
def get_blender_git_root(): def get_blender_git_root():
return check_output([args.git_command, "rev-parse", "--show-toplevel"]) return check_output([args.git_command, "rev-parse", "--show-toplevel"])
# Setup for precompiled libraries and tests from svn. # Setup for precompiled libraries and tests from svn.
def svn_update(args, release_version): def svn_update(args, release_version):
svn_non_interactive = [args.svn_command, '--non-interactive'] svn_non_interactive = [args.svn_command, '--non-interactive']
@@ -86,30 +92,32 @@ def svn_update(args, release_version):
print_stage("Updating Precompiled Libraries and Tests") print_stage("Updating Precompiled Libraries and Tests")
if os.path.isdir(lib_dirpath): if os.path.isdir(lib_dirpath):
for dirname in os.listdir(lib_dirpath): for dirname in os.listdir(lib_dirpath):
dirpath = os.path.join(lib_dirpath, dirname) dirpath = os.path.join(lib_dirpath, dirname)
if dirname == ".svn": if dirname == ".svn":
# Cleanup must be run from svn root directory if it exists. # Cleanup must be run from svn root directory if it exists.
if not make_utils.command_missing(args.svn_command): if not make_utils.command_missing(args.svn_command):
call(svn_non_interactive + ["cleanup", lib_dirpath]) call(svn_non_interactive + ["cleanup", lib_dirpath])
continue continue
svn_dirpath = os.path.join(dirpath, ".svn") svn_dirpath = os.path.join(dirpath, ".svn")
svn_root_dirpath = os.path.join(lib_dirpath, ".svn") svn_root_dirpath = os.path.join(lib_dirpath, ".svn")
if os.path.isdir(dirpath) and \ if (
(os.path.exists(svn_dirpath) or os.path.exists(svn_root_dirpath)): os.path.isdir(dirpath) and
if make_utils.command_missing(args.svn_command): (os.path.exists(svn_dirpath) or os.path.exists(svn_root_dirpath))
sys.stderr.write("svn not found, can't update libraries\n") ):
sys.exit(1) if make_utils.command_missing(args.svn_command):
sys.stderr.write("svn not found, can't update libraries\n")
sys.exit(1)
# Cleanup to continue with interrupted downloads. # Cleanup to continue with interrupted downloads.
if os.path.exists(svn_dirpath): if os.path.exists(svn_dirpath):
call(svn_non_interactive + ["cleanup", dirpath]) call(svn_non_interactive + ["cleanup", dirpath])
# Switch to appropriate branch and update. # Switch to appropriate branch and update.
call(svn_non_interactive + ["switch", svn_url + dirname, dirpath], exit_on_error=False) call(svn_non_interactive + ["switch", svn_url + dirname, dirpath], exit_on_error=False)
call(svn_non_interactive + ["update", dirpath]) call(svn_non_interactive + ["update", dirpath])
# Test if git repo can be updated. # Test if git repo can be updated.
def git_update_skip(args, check_remote_exists=True): def git_update_skip(args, check_remote_exists=True):
@@ -121,9 +129,11 @@ def git_update_skip(args, check_remote_exists=True):
rebase_merge = check_output([args.git_command, 'rev-parse', '--git-path', 'rebase-merge'], exit_on_error=False) rebase_merge = check_output([args.git_command, 'rev-parse', '--git-path', 'rebase-merge'], exit_on_error=False)
rebase_apply = check_output([args.git_command, 'rev-parse', '--git-path', 'rebase-apply'], exit_on_error=False) rebase_apply = check_output([args.git_command, 'rev-parse', '--git-path', 'rebase-apply'], exit_on_error=False)
merge_head = check_output([args.git_command, 'rev-parse', '--git-path', 'MERGE_HEAD'], exit_on_error=False) merge_head = check_output([args.git_command, 'rev-parse', '--git-path', 'MERGE_HEAD'], exit_on_error=False)
if os.path.exists(rebase_merge) or \ if (
os.path.exists(rebase_apply) or \ os.path.exists(rebase_merge) or
os.path.exists(merge_head): os.path.exists(rebase_apply) or
os.path.exists(merge_head)
):
return "rebase or merge in progress, complete it first" return "rebase or merge in progress, complete it first"
# Abort if uncommitted changes. # Abort if uncommitted changes.
@@ -133,13 +143,14 @@ def git_update_skip(args, check_remote_exists=True):
# Test if there is an upstream branch configured # Test if there is an upstream branch configured
if check_remote_exists: if check_remote_exists:
branch = check_output([args.git_command, "rev-parse", "--abbrev-ref", "HEAD"]) branch = check_output([args.git_command, "rev-parse", "--abbrev-ref", "HEAD"])
remote = check_output([args.git_command, "config", "branch." + branch + ".remote"], exit_on_error=False) remote = check_output([args.git_command, "config", "branch." + branch + ".remote"], exit_on_error=False)
if len(remote) == 0: if len(remote) == 0:
return "no remote branch to pull from" return "no remote branch to pull from"
return "" return ""
# Update blender repository. # Update blender repository.
def blender_update(args): def blender_update(args):
print_stage("Updating Blender Git Repository") print_stage("Updating Blender Git Repository")
@@ -178,7 +189,7 @@ def submodules_update(args, release_version, branch):
os.chdir(submodule_path) os.chdir(submodule_path)
msg = git_update_skip(args, check_remote_exists=False) msg = git_update_skip(args, check_remote_exists=False)
if msg: if msg:
skip_msg += submodule_path + " skipped: " + msg + "\n" skip_msg += submodule_path + " skipped: " + msg + "\n"
else: else:
if make_utils.git_branch(args.git_command) != submodule_branch: if make_utils.git_branch(args.git_command) != submodule_branch:
call([args.git_command, "fetch", "origin"]) call([args.git_command, "fetch", "origin"])

View File

@@ -7,6 +7,7 @@ import shutil
import subprocess import subprocess
import sys import sys
def call(cmd, exit_on_error=True): def call(cmd, exit_on_error=True):
print(" ".join(cmd)) print(" ".join(cmd))
@@ -19,6 +20,7 @@ def call(cmd, exit_on_error=True):
sys.exit(retcode) sys.exit(retcode)
return retcode return retcode
def check_output(cmd, exit_on_error=True): def check_output(cmd, exit_on_error=True):
# Flush to ensure correct order output on Windows. # Flush to ensure correct order output on Windows.
sys.stdout.flush() sys.stdout.flush()
@@ -35,6 +37,7 @@ def check_output(cmd, exit_on_error=True):
return output.strip() return output.strip()
def git_branch(git_command): def git_branch(git_command):
# Get current branch name. # Get current branch name.
try: try:
@@ -45,6 +48,7 @@ def git_branch(git_command):
return branch.strip().decode('utf8') return branch.strip().decode('utf8')
def git_tag(git_command): def git_tag(git_command):
# Get current tag name. # Get current tag name.
try: try:
@@ -54,16 +58,18 @@ def git_tag(git_command):
return tag.strip().decode('utf8') return tag.strip().decode('utf8')
def git_branch_release_version(branch, tag): def git_branch_release_version(branch, tag):
release_version = re.search("^blender-v(.*)-release$", branch) release_version = re.search("^blender-v(.*)-release$", branch)
if release_version: if release_version:
release_version = release_version.group(1) release_version = release_version.group(1)
elif tag: elif tag:
release_version = re.search("^v([0-9]*\.[0-9]*).*", tag) release_version = re.search(r"^v([0-9]*\.[0-9]*).*", tag)
if release_version: if release_version:
release_version = release_version.group(1) release_version = release_version.group(1)
return release_version return release_version
def svn_libraries_base_url(release_version): def svn_libraries_base_url(release_version):
if release_version: if release_version:
svn_branch = "tags/blender-" + release_version + "-release" svn_branch = "tags/blender-" + release_version + "-release"
@@ -71,6 +77,7 @@ def svn_libraries_base_url(release_version):
svn_branch = "trunk" svn_branch = "trunk"
return "https://svn.blender.org/svnroot/bf-blender/" + svn_branch + "/lib/" return "https://svn.blender.org/svnroot/bf-blender/" + svn_branch + "/lib/"
def command_missing(command): def command_missing(command):
# Support running with Python 2 for macOS # Support running with Python 2 for macOS
if sys.version_info >= (3, 0): if sys.version_info >= (3, 0):

View File

@@ -38,7 +38,7 @@ PROJECT_NAME = Blender
# could be handy for archiving the generated documentation or if some version # could be handy for archiving the generated documentation or if some version
# control system is used. # control system is used.
PROJECT_NUMBER = "V2.91" PROJECT_NUMBER = "V2.92"
# Using the PROJECT_BRIEF tag one can provide an optional one line description # Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a # for a project that appears at the top of each page and should give viewer a

View File

@@ -1,6 +1,6 @@
""" """
Intro Introduction
----- ------------
.. warning:: .. warning::
@@ -9,9 +9,8 @@ Intro
and the :func:`register`/:func:`unregister` functions! The :func:`pgettext` family of functions and the :func:`register`/:func:`unregister` functions! The :func:`pgettext` family of functions
should only be used in rare, specific cases (like e.g. complex "composited" UI strings...). should only be used in rare, specific cases (like e.g. complex "composited" UI strings...).
| To add translations to your python script, you must define a dictionary formatted like that: To add translations to your python script, you must define a dictionary formatted like that:
| ``{locale: {msg_key: msg_translation, ...}, ...}`` ``{locale: {msg_key: msg_translation, ...}, ...}`` where:
| where:
- locale is either a lang iso code (e.g. ``fr``), a lang+country code (e.g. ``pt_BR``), - locale is either a lang iso code (e.g. ``fr``), a lang+country code (e.g. ``pt_BR``),
a lang+variant code (e.g. ``sr@latin``), or a full code (e.g. ``uz_UZ@cyrilic``). a lang+variant code (e.g. ``sr@latin``), or a full code (e.g. ``uz_UZ@cyrilic``).

View File

@@ -9,15 +9,24 @@ When calling an operator you may want to pass the execution context.
This determines the context that is given for the operator to run in, and whether This determines the context that is given for the operator to run in, and whether
invoke() is called or only execute(). invoke() is called or only execute().
'EXEC_DEFAULT' is used by default, running only the execute() method, but you may ``EXEC_DEFAULT`` is used by default, running only the ``execute()`` method, but you may
want the operator to take user interaction with 'INVOKE_DEFAULT' which will also want the operator to take user interaction with ``INVOKE_DEFAULT`` which will also
call invoke() if existing. call invoke() if existing.
The execution context is one of: The execution context is one of:
('INVOKE_DEFAULT', 'INVOKE_REGION_WIN', 'INVOKE_REGION_CHANNELS',
'INVOKE_REGION_PREVIEW', 'INVOKE_AREA', 'INVOKE_SCREEN', 'EXEC_DEFAULT', - ``INVOKE_DEFAULT``
'EXEC_REGION_WIN', 'EXEC_REGION_CHANNELS', 'EXEC_REGION_PREVIEW', 'EXEC_AREA', - ``INVOKE_REGION_WIN``
'EXEC_SCREEN') - ``INVOKE_REGION_CHANNELS``
- ``INVOKE_REGION_PREVIEW``
- ``INVOKE_AREA``
- ``INVOKE_SCREEN``
- ``EXEC_DEFAULT``
- ``EXEC_REGION_WIN``
- ``EXEC_REGION_CHANNELS``
- ``EXEC_REGION_PREVIEW``
- ``EXEC_AREA``
- ``EXEC_SCREEN``
""" """
# collection add popup # collection add popup

View File

@@ -33,11 +33,12 @@ fragment_shader = '''
uniform float u_Scale; uniform float u_Scale;
in float v_ArcLength; in float v_ArcLength;
out vec4 FragColor;
void main() void main()
{ {
if (step(sin(v_ArcLength * u_Scale), 0.5) == 1) discard; if (step(sin(v_ArcLength * u_Scale), 0.5) == 1) discard;
gl_FragColor = vec4(1.0); FragColor = vec4(1.0);
} }
''' '''

View File

@@ -23,10 +23,11 @@ fragment_shader = '''
uniform float brightness; uniform float brightness;
in vec3 pos; in vec3 pos;
out vec4 FragColor;
void main() void main()
{ {
gl_FragColor = vec4(pos * brightness, 1.0); FragColor = vec4(pos * brightness, 1.0);
} }
''' '''

View File

@@ -56,10 +56,11 @@ fragment_shader = '''
uniform sampler2D image; uniform sampler2D image;
in vec2 uvInterp; in vec2 uvInterp;
out vec4 FragColor;
void main() void main()
{ {
gl_FragColor = texture(image, uvInterp); FragColor = texture(image, uvInterp);
} }
''' '''

View File

@@ -1,36 +0,0 @@
"""
Built-in shaders
++++++++++++++++
All built-in shaders have the ``mat4 ModelViewProjectionMatrix`` uniform.
The value of it can only be modified using the :class:`gpu.matrix` module.
2D_UNIFORM_COLOR:
attributes: vec3 pos
uniforms: vec4 color
2D_FLAT_COLOR:
attributes: vec3 pos, vec4 color
uniforms: -
2D_SMOOTH_COLOR:
attributes: vec3 pos, vec4 color
uniforms: -
2D_IMAGE:
attributes: vec3 pos, vec2 texCoord
uniforms: sampler2D image
3D_UNIFORM_COLOR:
attributes: vec3 pos
uniforms: vec4 color
3D_FLAT_COLOR:
attributes: vec3 pos, vec4 color
uniforms: -
3D_SMOOTH_COLOR:
attributes: vec3 pos, vec4 color
uniforms: -
"""

View File

@@ -13,16 +13,15 @@ than enough material to teach OpenGL programming, from books to many
collections of tutorials. collections of tutorials.
Here is a comprehensive `list of books <https://www.khronos.org/developers/books/>`__ (non free). Here is a comprehensive `list of books <https://www.khronos.org/developers/books/>`__ (non free).
The `arcsynthesis tutorials <https://web.archive.org/web/20150225192611/http://www.arcsynthesis.org/gltut/index.html>`__ `Learn OpenGL <https://learnopengl.com/>`__ is one of the best resources to learn modern OpenGL and
is one of the best resources to learn modern OpenGL and `opengl-tutorial.org <http://www.opengl-tutorial.org/>`__ offers a set of extensive examples,
`g-truc <http://www.g-truc.net/post-opengl-samples.html#menu>`__ including advanced features.
offers a set of extensive examples, including advanced features.
.. note:: .. note::
You can use the :class:`Image` type to load and set textures. You can use the :class:`bpy.types.Image` type to load and set textures.
See :class:`Image.gl_load` and :class:`Image.gl_free`, See :class:`bpy.types.Image.gl_load` and :class:`bpy.types.Image.gl_free`,
for example. for example.
@@ -30,7 +29,7 @@ offers a set of extensive examples, including advanced features.
Bind a named texture to a texturing target Bind a named texture to a texturing target
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glBindTexture.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glBindTexture.xhtml>`__
:type target: Enumerated constant :type target: Enumerated constant
:arg target: Specifies the target to which the texture is bound. :arg target: Specifies the target to which the texture is bound.
@@ -42,7 +41,7 @@ offers a set of extensive examples, including advanced features.
Specify pixel arithmetic Specify pixel arithmetic
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glBlendFunc.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glBlendFunc.xhtml>`__
:type sfactor: Enumerated constant :type sfactor: Enumerated constant
:arg sfactor: Specifies how the red, green, blue, and alpha source blending factors are :arg sfactor: Specifies how the red, green, blue, and alpha source blending factors are
@@ -56,7 +55,7 @@ offers a set of extensive examples, including advanced features.
Clear buffers to preset values Clear buffers to preset values
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glClear.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glClear.xhtml>`__
:type mask: Enumerated constant(s) :type mask: Enumerated constant(s)
:arg mask: Bitwise OR of masks that indicate the buffers to be cleared. :arg mask: Bitwise OR of masks that indicate the buffers to be cleared.
@@ -66,7 +65,7 @@ offers a set of extensive examples, including advanced features.
Specify clear values for the color buffers Specify clear values for the color buffers
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glClearColor.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glClearColor.xhtml>`__
:type red, green, blue, alpha: float :type red, green, blue, alpha: float
:arg red, green, blue, alpha: Specify the red, green, blue, and alpha values used when the :arg red, green, blue, alpha: Specify the red, green, blue, and alpha values used when the
@@ -77,7 +76,7 @@ offers a set of extensive examples, including advanced features.
Specify the clear value for the depth buffer Specify the clear value for the depth buffer
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glClearDepth.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glClearDepth.xhtml>`__
:type depth: int :type depth: int
:arg depth: Specifies the depth value used when the depth buffer is cleared. :arg depth: Specifies the depth value used when the depth buffer is cleared.
@@ -88,7 +87,7 @@ offers a set of extensive examples, including advanced features.
Specify the clear value for the stencil buffer Specify the clear value for the stencil buffer
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glClearStencil.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glClearStencil.xhtml>`__
:type s: int :type s: int
:arg s: Specifies the index used when the stencil buffer is cleared. The initial value is 0. :arg s: Specifies the index used when the stencil buffer is cleared. The initial value is 0.
@@ -98,7 +97,7 @@ offers a set of extensive examples, including advanced features.
Specify a plane against which all geometry is clipped Specify a plane against which all geometry is clipped
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glClipPlane.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glClipPlane.xhtml>`__
:type plane: Enumerated constant :type plane: Enumerated constant
:arg plane: Specifies which clipping plane is being positioned. :arg plane: Specifies which clipping plane is being positioned.
@@ -117,7 +116,7 @@ offers a set of extensive examples, including advanced features.
Set a new color. Set a new color.
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glColor.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glColor.xhtml>`__
:type red, green, blue, alpha: Depends on function prototype. :type red, green, blue, alpha: Depends on function prototype.
:arg red, green, blue: Specify new red, green, and blue values for the current color. :arg red, green, blue: Specify new red, green, and blue values for the current color.
@@ -129,7 +128,7 @@ offers a set of extensive examples, including advanced features.
Enable and disable writing of frame buffer color components Enable and disable writing of frame buffer color components
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glColorMask.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glColorMask.xhtml>`__
:type red, green, blue, alpha: int (boolean) :type red, green, blue, alpha: int (boolean)
:arg red, green, blue, alpha: Specify whether red, green, blue, and alpha can or cannot be :arg red, green, blue, alpha: Specify whether red, green, blue, and alpha can or cannot be
@@ -141,7 +140,7 @@ offers a set of extensive examples, including advanced features.
Copy pixels into a 2D texture image Copy pixels into a 2D texture image
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glCopyTexImage2D.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glCopyTexImage2D.xhtml>`__
:type target: Enumerated constant :type target: Enumerated constant
:arg target: Specifies the target texture. :arg target: Specifies the target texture.
@@ -170,7 +169,7 @@ offers a set of extensive examples, including advanced features.
Specify whether front- or back-facing facets can be culled Specify whether front- or back-facing facets can be culled
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glCullFace.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glCullFace.xhtml>`__
:type mode: Enumerated constant :type mode: Enumerated constant
:arg mode: Specifies whether front- or back-facing facets are candidates for culling. :arg mode: Specifies whether front- or back-facing facets are candidates for culling.
@@ -180,7 +179,7 @@ offers a set of extensive examples, including advanced features.
Delete named textures Delete named textures
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glDeleteTextures.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glDeleteTextures.xhtml>`__
:type n: int :type n: int
:arg n: Specifies the number of textures to be deleted :arg n: Specifies the number of textures to be deleted
@@ -192,7 +191,7 @@ offers a set of extensive examples, including advanced features.
Specify the value used for depth buffer comparisons Specify the value used for depth buffer comparisons
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glDepthFunc.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glDepthFunc.xhtml>`__
:type func: Enumerated constant :type func: Enumerated constant
:arg func: Specifies the depth comparison function. :arg func: Specifies the depth comparison function.
@@ -202,7 +201,7 @@ offers a set of extensive examples, including advanced features.
Enable or disable writing into the depth buffer Enable or disable writing into the depth buffer
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glDepthMask.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glDepthMask.xhtml>`__
:type flag: int (boolean) :type flag: int (boolean)
:arg flag: Specifies whether the depth buffer is enabled for writing. If flag is GL_FALSE, :arg flag: Specifies whether the depth buffer is enabled for writing. If flag is GL_FALSE,
@@ -214,7 +213,7 @@ offers a set of extensive examples, including advanced features.
Specify mapping of depth values from normalized device coordinates to window coordinates Specify mapping of depth values from normalized device coordinates to window coordinates
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glDepthRange.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glDepthRange.xhtml>`__
:type zNear: int :type zNear: int
:arg zNear: Specifies the mapping of the near clipping plane to window coordinates. :arg zNear: Specifies the mapping of the near clipping plane to window coordinates.
@@ -228,7 +227,7 @@ offers a set of extensive examples, including advanced features.
Disable server-side GL capabilities Disable server-side GL capabilities
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glEnable.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glEnable.xhtml>`__
:type cap: Enumerated constant :type cap: Enumerated constant
:arg cap: Specifies a symbolic constant indicating a GL capability. :arg cap: Specifies a symbolic constant indicating a GL capability.
@@ -238,7 +237,7 @@ offers a set of extensive examples, including advanced features.
Specify which color buffers are to be drawn into Specify which color buffers are to be drawn into
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glDrawBuffer.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glDrawBuffer.xhtml>`__
:type mode: Enumerated constant :type mode: Enumerated constant
:arg mode: Specifies up to four color buffers to be drawn into. :arg mode: Specifies up to four color buffers to be drawn into.
@@ -250,7 +249,7 @@ offers a set of extensive examples, including advanced features.
Flag edges as either boundary or non-boundary Flag edges as either boundary or non-boundary
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glEdgeFlag.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glEdgeFlag.xhtml>`__
:type flag: Depends of function prototype :type flag: Depends of function prototype
:arg flag: Specifies the current edge flag value.The initial value is GL_TRUE. :arg flag: Specifies the current edge flag value.The initial value is GL_TRUE.
@@ -260,7 +259,7 @@ offers a set of extensive examples, including advanced features.
Enable server-side GL capabilities Enable server-side GL capabilities
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glEnable.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glEnable.xhtml>`__
:type cap: Enumerated constant :type cap: Enumerated constant
:arg cap: Specifies a symbolic constant indicating a GL capability. :arg cap: Specifies a symbolic constant indicating a GL capability.
@@ -273,7 +272,7 @@ offers a set of extensive examples, including advanced features.
Evaluate enabled one- and two-dimensional maps Evaluate enabled one- and two-dimensional maps
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glEvalCoord.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glEvalCoord.xhtml>`__
:type u: Depends on function prototype. :type u: Depends on function prototype.
:arg u: Specifies a value that is the domain coordinate u to the basis function defined :arg u: Specifies a value that is the domain coordinate u to the basis function defined
@@ -291,7 +290,7 @@ offers a set of extensive examples, including advanced features.
Compute a one- or two-dimensional grid of points or lines Compute a one- or two-dimensional grid of points or lines
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glEvalMesh.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glEvalMesh.xhtml>`__
:type mode: Enumerated constant :type mode: Enumerated constant
:arg mode: In glEvalMesh1, specifies whether to compute a one-dimensional :arg mode: In glEvalMesh1, specifies whether to compute a one-dimensional
@@ -306,7 +305,7 @@ offers a set of extensive examples, including advanced features.
Generate and evaluate a single point in a mesh Generate and evaluate a single point in a mesh
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glEvalPoint.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glEvalPoint.xhtml>`__
:type i: int :type i: int
:arg i: Specifies the integer value for grid domain variable i. :arg i: Specifies the integer value for grid domain variable i.
@@ -318,7 +317,7 @@ offers a set of extensive examples, including advanced features.
Controls feedback mode Controls feedback mode
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glFeedbackBuffer.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glFeedbackBuffer.xhtml>`__
:type size: int :type size: int
:arg size: Specifies the maximum number of values that can be written into buffer. :arg size: Specifies the maximum number of values that can be written into buffer.
@@ -333,14 +332,14 @@ offers a set of extensive examples, including advanced features.
Block until all GL execution is complete Block until all GL execution is complete
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glFinish.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glFinish.xhtml>`__
.. function:: glFlush(): .. function:: glFlush():
Force Execution of GL commands in finite time Force Execution of GL commands in finite time
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glFlush.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glFlush.xhtml>`__
.. function:: glFog (pname, param): .. function:: glFog (pname, param):
@@ -349,7 +348,7 @@ offers a set of extensive examples, including advanced features.
Specify fog parameters Specify fog parameters
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glFog.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glFog.xhtml>`__
:type pname: Enumerated constant :type pname: Enumerated constant
:arg pname: Specifies a single-valued fog parameter. If the function prototype :arg pname: Specifies a single-valued fog parameter. If the function prototype
@@ -364,7 +363,7 @@ offers a set of extensive examples, including advanced features.
Define front- and back-facing polygons Define front- and back-facing polygons
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glFrontFace.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glFrontFace.xhtml>`__
:type mode: Enumerated constant :type mode: Enumerated constant
:arg mode: Specifies the orientation of front-facing polygons. :arg mode: Specifies the orientation of front-facing polygons.
@@ -374,7 +373,7 @@ offers a set of extensive examples, including advanced features.
Generate texture names Generate texture names
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glGenTextures.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glGenTextures.xhtml>`__
:type n: int :type n: int
:arg n: Specifies the number of textures name to be generated. :arg n: Specifies the number of textures name to be generated.
@@ -388,7 +387,7 @@ offers a set of extensive examples, including advanced features.
Return the value or values of a selected parameter Return the value or values of a selected parameter
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glGet.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glGet.xhtml>`__
:type pname: Enumerated constant :type pname: Enumerated constant
:arg pname: Specifies the parameter value to be returned. :arg pname: Specifies the parameter value to be returned.
@@ -400,7 +399,7 @@ offers a set of extensive examples, including advanced features.
Return error information Return error information
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glGetError.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glGetError.xhtml>`__
.. function:: glGetLight (light, pname, params): .. function:: glGetLight (light, pname, params):
@@ -409,7 +408,7 @@ offers a set of extensive examples, including advanced features.
Return light source parameter values Return light source parameter values
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glGetLight.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glGetLight.xhtml>`__
:type light: Enumerated constant :type light: Enumerated constant
:arg light: Specifies a light source. The number of possible lights depends on the :arg light: Specifies a light source. The number of possible lights depends on the
@@ -427,7 +426,7 @@ offers a set of extensive examples, including advanced features.
Return evaluator parameters Return evaluator parameters
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glGetMap.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glGetMap.xhtml>`__
:type target: Enumerated constant :type target: Enumerated constant
:arg target: Specifies the symbolic name of a map. :arg target: Specifies the symbolic name of a map.
@@ -443,7 +442,7 @@ offers a set of extensive examples, including advanced features.
Return material parameters Return material parameters
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glGetMaterial.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glGetMaterial.xhtml>`__
:type face: Enumerated constant :type face: Enumerated constant
:arg face: Specifies which of the two materials is being queried. :arg face: Specifies which of the two materials is being queried.
@@ -460,7 +459,7 @@ offers a set of extensive examples, including advanced features.
Return the specified pixel map Return the specified pixel map
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glGetPixelMap.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glGetPixelMap.xhtml>`__
:type map: Enumerated constant :type map: Enumerated constant
:arg map: Specifies the name of the pixel map to return. :arg map: Specifies the name of the pixel map to return.
@@ -472,7 +471,7 @@ offers a set of extensive examples, including advanced features.
Return a string describing the current GL connection Return a string describing the current GL connection
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glGetString.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glGetString.xhtml>`__
:type name: Enumerated constant :type name: Enumerated constant
:arg name: Specifies a symbolic constant. :arg name: Specifies a symbolic constant.
@@ -485,7 +484,7 @@ offers a set of extensive examples, including advanced features.
Return texture environment parameters Return texture environment parameters
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glGetTexEnv.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glGetTexEnv.xhtml>`__
:type target: Enumerated constant :type target: Enumerated constant
:arg target: Specifies a texture environment. Must be GL_TEXTURE_ENV. :arg target: Specifies a texture environment. Must be GL_TEXTURE_ENV.
@@ -501,7 +500,7 @@ offers a set of extensive examples, including advanced features.
Return texture coordinate generation parameters Return texture coordinate generation parameters
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glGetTexGen.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glGetTexGen.xhtml>`__
:type coord: Enumerated constant :type coord: Enumerated constant
:arg coord: Specifies a texture coordinate. :arg coord: Specifies a texture coordinate.
@@ -515,7 +514,7 @@ offers a set of extensive examples, including advanced features.
Return a texture image Return a texture image
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glGetTexImage.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glGetTexImage.xhtml>`__
:type target: Enumerated constant :type target: Enumerated constant
:arg target: Specifies which texture is to be obtained. :arg target: Specifies which texture is to be obtained.
@@ -537,7 +536,7 @@ offers a set of extensive examples, including advanced features.
return texture parameter values for a specific level of detail return texture parameter values for a specific level of detail
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glGetTexLevelParameter.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glGetTexLevelParameter.xhtml>`__
:type target: Enumerated constant :type target: Enumerated constant
:arg target: Specifies the symbolic name of the target texture. :arg target: Specifies the symbolic name of the target texture.
@@ -556,7 +555,7 @@ offers a set of extensive examples, including advanced features.
Return texture parameter values Return texture parameter values
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glGetTexParameter.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glGetTexParameter.xhtml>`__
:type target: Enumerated constant :type target: Enumerated constant
:arg target: Specifies the symbolic name of the target texture. :arg target: Specifies the symbolic name of the target texture.
@@ -570,7 +569,7 @@ offers a set of extensive examples, including advanced features.
Specify implementation-specific hints Specify implementation-specific hints
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glHint.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glHint.xhtml>`__
:type target: Enumerated constant :type target: Enumerated constant
:arg target: Specifies a symbolic constant indicating the behavior to be :arg target: Specifies a symbolic constant indicating the behavior to be
@@ -583,7 +582,7 @@ offers a set of extensive examples, including advanced features.
Test whether a capability is enabled Test whether a capability is enabled
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glIsEnabled.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glIsEnabled.xhtml>`__
:type cap: Enumerated constant :type cap: Enumerated constant
:arg cap: Specifies a constant representing a GL capability. :arg cap: Specifies a constant representing a GL capability.
@@ -593,7 +592,7 @@ offers a set of extensive examples, including advanced features.
Determine if a name corresponds to a texture Determine if a name corresponds to a texture
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glIsTexture.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glIsTexture.xhtml>`__
:type texture: unsigned int :type texture: unsigned int
:arg texture: Specifies a value that may be the name of a texture. :arg texture: Specifies a value that may be the name of a texture.
@@ -605,7 +604,7 @@ offers a set of extensive examples, including advanced features.
Set the light source parameters Set the light source parameters
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glLight.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glLight.xhtml>`__
:type light: Enumerated constant :type light: Enumerated constant
:arg light: Specifies a light. The number of lights depends on the implementation, :arg light: Specifies a light. The number of lights depends on the implementation,
@@ -625,7 +624,7 @@ offers a set of extensive examples, including advanced features.
Set the lighting model parameters Set the lighting model parameters
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glLightModel.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glLightModel.xhtml>`__
:type pname: Enumerated constant :type pname: Enumerated constant
:arg pname: Specifies a single-value light model parameter. :arg pname: Specifies a single-value light model parameter.
@@ -638,7 +637,7 @@ offers a set of extensive examples, including advanced features.
Specify the width of rasterized lines. Specify the width of rasterized lines.
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glLineWidth.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glLineWidth.xhtml>`__
:type width: float :type width: float
:arg width: Specifies the width of rasterized lines. The initial value is 1. :arg width: Specifies the width of rasterized lines. The initial value is 1.
@@ -650,7 +649,7 @@ offers a set of extensive examples, including advanced features.
Replace the current matrix with the specified matrix Replace the current matrix with the specified matrix
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glLoadMatrix.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glLoadMatrix.xhtml>`__
:type m: :class:`bgl.Buffer` object. Depends on function prototype. :type m: :class:`bgl.Buffer` object. Depends on function prototype.
:arg m: Specifies a pointer to 16 consecutive values, which are used as the elements :arg m: Specifies a pointer to 16 consecutive values, which are used as the elements
@@ -661,7 +660,7 @@ offers a set of extensive examples, including advanced features.
Specify a logical pixel operation for color index rendering Specify a logical pixel operation for color index rendering
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glLogicOp.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glLogicOp.xhtml>`__
:type opcode: Enumerated constant :type opcode: Enumerated constant
:arg opcode: Specifies a symbolic constant that selects a logical operation. :arg opcode: Specifies a symbolic constant that selects a logical operation.
@@ -673,7 +672,7 @@ offers a set of extensive examples, including advanced features.
Define a one-dimensional evaluator Define a one-dimensional evaluator
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glMap1.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glMap1.xhtml>`__
:type target: Enumerated constant :type target: Enumerated constant
:arg target: Specifies the kind of values that are generated by the evaluator. :arg target: Specifies the kind of values that are generated by the evaluator.
@@ -698,7 +697,7 @@ offers a set of extensive examples, including advanced features.
Define a two-dimensional evaluator Define a two-dimensional evaluator
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glMap2.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glMap2.xhtml>`__
:type target: Enumerated constant :type target: Enumerated constant
:arg target: Specifies the kind of values that are generated by the evaluator. :arg target: Specifies the kind of values that are generated by the evaluator.
@@ -739,7 +738,7 @@ offers a set of extensive examples, including advanced features.
Define a one- or two-dimensional mesh Define a one- or two-dimensional mesh
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glMapGrid.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glMapGrid.xhtml>`__
:type un: int :type un: int
:arg un: Specifies the number of partitions in the grid range interval :arg un: Specifies the number of partitions in the grid range interval
@@ -758,7 +757,7 @@ offers a set of extensive examples, including advanced features.
Specify material parameters for the lighting model. Specify material parameters for the lighting model.
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glMaterial.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glMaterial.xhtml>`__
:type face: Enumerated constant :type face: Enumerated constant
:arg face: Specifies which face or faces are being updated. Must be one of: :arg face: Specifies which face or faces are being updated. Must be one of:
@@ -777,7 +776,7 @@ offers a set of extensive examples, including advanced features.
Multiply the current matrix with the specified matrix Multiply the current matrix with the specified matrix
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glMultMatrix.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glMultMatrix.xhtml>`__
:type m: :class:`bgl.Buffer` object. Depends on function prototype. :type m: :class:`bgl.Buffer` object. Depends on function prototype.
:arg m: Points to 16 consecutive values that are used as the elements of a 4x4 column :arg m: Points to 16 consecutive values that are used as the elements of a 4x4 column
@@ -791,7 +790,7 @@ offers a set of extensive examples, including advanced features.
Set the current normal vector Set the current normal vector
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glNormal.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glNormal.xhtml>`__
:type nx, ny, nz: Depends on function prototype. (non - 'v' prototypes only) :type nx, ny, nz: Depends on function prototype. (non - 'v' prototypes only)
:arg nx, ny, nz: Specify the x, y, and z coordinates of the new current normal. :arg nx, ny, nz: Specify the x, y, and z coordinates of the new current normal.
@@ -807,7 +806,7 @@ offers a set of extensive examples, including advanced features.
Set up pixel transfer maps Set up pixel transfer maps
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glPixelMap.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glPixelMap.xhtml>`__
:type map: Enumerated constant :type map: Enumerated constant
:arg map: Specifies a symbolic map name. :arg map: Specifies a symbolic map name.
@@ -823,7 +822,7 @@ offers a set of extensive examples, including advanced features.
Set pixel storage modes Set pixel storage modes
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glPixelStore.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glPixelStore.xhtml>`__
:type pname: Enumerated constant :type pname: Enumerated constant
:arg pname: Specifies the symbolic name of the parameter to be set. :arg pname: Specifies the symbolic name of the parameter to be set.
@@ -839,7 +838,7 @@ offers a set of extensive examples, including advanced features.
Set pixel transfer modes Set pixel transfer modes
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glPixelTransfer.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glPixelTransfer.xhtml>`__
:type pname: Enumerated constant :type pname: Enumerated constant
:arg pname: Specifies the symbolic name of the pixel transfer parameter to be set. :arg pname: Specifies the symbolic name of the pixel transfer parameter to be set.
@@ -851,7 +850,7 @@ offers a set of extensive examples, including advanced features.
Specify the diameter of rasterized points Specify the diameter of rasterized points
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glPointSize.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glPointSize.xhtml>`__
:type size: float :type size: float
:arg size: Specifies the diameter of rasterized points. The initial value is 1. :arg size: Specifies the diameter of rasterized points. The initial value is 1.
@@ -861,7 +860,7 @@ offers a set of extensive examples, including advanced features.
Select a polygon rasterization mode Select a polygon rasterization mode
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glPolygonMode.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glPolygonMode.xhtml>`__
:type face: Enumerated constant :type face: Enumerated constant
:arg face: Specifies the polygons that mode applies to. :arg face: Specifies the polygons that mode applies to.
@@ -876,7 +875,7 @@ offers a set of extensive examples, including advanced features.
Set the scale and units used to calculate depth values Set the scale and units used to calculate depth values
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glPolygonOffset.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glPolygonOffset.xhtml>`__
:type factor: float :type factor: float
:arg factor: Specifies a scale factor that is used to create a variable depth :arg factor: Specifies a scale factor that is used to create a variable depth
@@ -896,7 +895,7 @@ offers a set of extensive examples, including advanced features.
Specify the raster position for pixel operations Specify the raster position for pixel operations
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glRasterPos.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glRasterPos.xhtml>`__
:type x, y, z, w: Depends on function prototype. (z and w for '3' and '4' prototypes only) :type x, y, z, w: Depends on function prototype. (z and w for '3' and '4' prototypes only)
:arg x, y, z, w: Specify the x,y,z, and w object coordinates (if present) for the :arg x, y, z, w: Specify the x,y,z, and w object coordinates (if present) for the
@@ -928,7 +927,7 @@ offers a set of extensive examples, including advanced features.
Select a color buffer source for pixels. Select a color buffer source for pixels.
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glReadBuffer.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glReadBuffer.xhtml>`__
:type mode: Enumerated constant :type mode: Enumerated constant
:arg mode: Specifies a color buffer. :arg mode: Specifies a color buffer.
@@ -938,7 +937,7 @@ offers a set of extensive examples, including advanced features.
Read a block of pixels from the frame buffer Read a block of pixels from the frame buffer
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glReadPixels.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glReadPixels.xhtml>`__
:type x, y: int :type x, y: int
:arg x, y: Specify the window coordinates of the first pixel that is read :arg x, y: Specify the window coordinates of the first pixel that is read
@@ -961,7 +960,7 @@ offers a set of extensive examples, including advanced features.
Draw a rectangle Draw a rectangle
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glRect.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glRect.xhtml>`__
:type x1, y1: Depends on function prototype. (for non 'v' prototypes only) :type x1, y1: Depends on function prototype. (for non 'v' prototypes only)
:arg x1, y1: Specify one vertex of a rectangle :arg x1, y1: Specify one vertex of a rectangle
@@ -978,7 +977,7 @@ offers a set of extensive examples, including advanced features.
Multiply the current matrix by a rotation matrix Multiply the current matrix by a rotation matrix
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glRotate.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glRotate.xhtml>`__
:type angle: Depends on function prototype. :type angle: Depends on function prototype.
:arg angle: Specifies the angle of rotation in degrees. :arg angle: Specifies the angle of rotation in degrees.
@@ -992,7 +991,7 @@ offers a set of extensive examples, including advanced features.
Multiply the current matrix by a general scaling matrix Multiply the current matrix by a general scaling matrix
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glScale.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glScale.xhtml>`__
:type x, y, z: Depends on function prototype. :type x, y, z: Depends on function prototype.
:arg x, y, z: Specify scale factors along the x, y, and z axes, respectively. :arg x, y, z: Specify scale factors along the x, y, and z axes, respectively.
@@ -1002,7 +1001,7 @@ offers a set of extensive examples, including advanced features.
Define the scissor box Define the scissor box
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glScissor.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glScissor.xhtml>`__
:type x, y: int :type x, y: int
:arg x, y: Specify the lower left corner of the scissor box. Initially (0, 0). :arg x, y: Specify the lower left corner of the scissor box. Initially (0, 0).
@@ -1016,7 +1015,7 @@ offers a set of extensive examples, including advanced features.
Set function and reference value for stencil testing Set function and reference value for stencil testing
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man/docbook4/xhtml/glStencilFunc.xml>`__ .. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man/docbook4/xhtml/glStencilFunc.xhtml>`__
:type func: Enumerated constant :type func: Enumerated constant
:arg func: Specifies the test function. :arg func: Specifies the test function.
@@ -1033,7 +1032,7 @@ offers a set of extensive examples, including advanced features.
Control the writing of individual bits in the stencil planes Control the writing of individual bits in the stencil planes
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glStencilMask.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glStencilMask.xhtml>`__
:type mask: unsigned int :type mask: unsigned int
:arg mask: Specifies a bit mask to enable and disable writing of individual bits :arg mask: Specifies a bit mask to enable and disable writing of individual bits
@@ -1044,7 +1043,7 @@ offers a set of extensive examples, including advanced features.
Set stencil test actions Set stencil test actions
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glStencilOp.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glStencilOp.xhtml>`__
:type fail: Enumerated constant :type fail: Enumerated constant
:arg fail: Specifies the action to take when the stencil test fails. :arg fail: Specifies the action to take when the stencil test fails.
@@ -1072,7 +1071,7 @@ offers a set of extensive examples, including advanced features.
Set the current texture coordinates Set the current texture coordinates
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glTexCoord.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glTexCoord.xhtml>`__
:type s, t, r, q: Depends on function prototype. (r and q for '3' and '4' prototypes only) :type s, t, r, q: Depends on function prototype. (r and q for '3' and '4' prototypes only)
:arg s, t, r, q: Specify s, t, r, and q texture coordinates. Not all parameters are :arg s, t, r, q: Specify s, t, r, and q texture coordinates. Not all parameters are
@@ -1088,7 +1087,7 @@ offers a set of extensive examples, including advanced features.
Set texture environment parameters Set texture environment parameters
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glTexEnv.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glTexEnv.xhtml>`__
:type target: Enumerated constant :type target: Enumerated constant
:arg target: Specifies a texture environment. Must be GL_TEXTURE_ENV. :arg target: Specifies a texture environment. Must be GL_TEXTURE_ENV.
@@ -1107,7 +1106,7 @@ offers a set of extensive examples, including advanced features.
Control the generation of texture coordinates Control the generation of texture coordinates
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glTexGen.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glTexGen.xhtml>`__
:type coord: Enumerated constant :type coord: Enumerated constant
:arg coord: Specifies a texture coordinate. :arg coord: Specifies a texture coordinate.
@@ -1125,7 +1124,7 @@ offers a set of extensive examples, including advanced features.
Specify a one-dimensional texture image Specify a one-dimensional texture image
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glTexImage1D.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glTexImage1D.xhtml>`__
:type target: Enumerated constant :type target: Enumerated constant
:arg target: Specifies the target texture. :arg target: Specifies the target texture.
@@ -1152,7 +1151,7 @@ offers a set of extensive examples, including advanced features.
Specify a two-dimensional texture image Specify a two-dimensional texture image
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glTexImage2D.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glTexImage2D.xhtml>`__
:type target: Enumerated constant :type target: Enumerated constant
:arg target: Specifies the target texture. :arg target: Specifies the target texture.
@@ -1185,7 +1184,7 @@ offers a set of extensive examples, including advanced features.
Set texture parameters Set texture parameters
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glTexParameter.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glTexParameter.xhtml>`__
:type target: Enumerated constant :type target: Enumerated constant
:arg target: Specifies the target texture. :arg target: Specifies the target texture.
@@ -1202,7 +1201,7 @@ offers a set of extensive examples, including advanced features.
Multiply the current matrix by a translation matrix Multiply the current matrix by a translation matrix
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glTranslate.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glTranslate.xhtml>`__
:type x, y, z: Depends on function prototype. :type x, y, z: Depends on function prototype.
:arg x, y, z: Specify the x, y, and z coordinates of a translation vector. :arg x, y, z: Specify the x, y, and z coordinates of a translation vector.
@@ -1212,7 +1211,7 @@ offers a set of extensive examples, including advanced features.
Set the viewport Set the viewport
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glViewport.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glViewport.xhtml>`__
:type x, y: int :type x, y: int
:arg x, y: Specify the lower left corner of the viewport rectangle, :arg x, y: Specify the lower left corner of the viewport rectangle,
@@ -1227,7 +1226,7 @@ offers a set of extensive examples, including advanced features.
Installs a program object as part of current rendering state Installs a program object as part of current rendering state
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glUseProgram.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glUseProgram.xhtml>`__
:type program: int :type program: int
:arg program: Specifies the handle of the program object whose executables are to be used as part of current rendering state. :arg program: Specifies the handle of the program object whose executables are to be used as part of current rendering state.
@@ -1237,7 +1236,7 @@ offers a set of extensive examples, including advanced features.
Validates a program object Validates a program object
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glValidateProgram.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glValidateProgram.xhtml>`__
:type program: int :type program: int
:arg program: Specifies the handle of the program object to be validated. :arg program: Specifies the handle of the program object to be validated.
@@ -1247,7 +1246,7 @@ offers a set of extensive examples, including advanced features.
Links a program object. Links a program object.
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glLinkProgram.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glLinkProgram.xhtml>`__
:type program: int :type program: int
:arg program: Specifies the handle of the program object to be linked. :arg program: Specifies the handle of the program object to be linked.
@@ -1257,7 +1256,7 @@ offers a set of extensive examples, including advanced features.
Select active texture unit. Select active texture unit.
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glActiveTexture.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glActiveTexture.xhtml>`__
:type texture: int :type texture: int
:arg texture: Constant in ``GL_TEXTURE0`` 0 - 8 :arg texture: Constant in ``GL_TEXTURE0`` 0 - 8
@@ -1267,7 +1266,7 @@ offers a set of extensive examples, including advanced features.
Attaches a shader object to a program object. Attaches a shader object to a program object.
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glAttachShader.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glAttachShader.xhtml>`__
:type program: int :type program: int
:arg program: Specifies the program object to which a shader object will be attached. :arg program: Specifies the program object to which a shader object will be attached.
@@ -1279,7 +1278,7 @@ offers a set of extensive examples, including advanced features.
Compiles a shader object. Compiles a shader object.
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glCompileShader.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glCompileShader.xhtml>`__
:type shader: int :type shader: int
:arg shader: Specifies the shader object to be compiled. :arg shader: Specifies the shader object to be compiled.
@@ -1289,7 +1288,7 @@ offers a set of extensive examples, including advanced features.
Creates a program object Creates a program object
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glCreateProgram.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glCreateProgram.xhtml>`__
:rtype: int :rtype: int
:return: The new program or zero if an error occurs. :return: The new program or zero if an error occurs.
@@ -1299,7 +1298,7 @@ offers a set of extensive examples, including advanced features.
Creates a shader object. Creates a shader object.
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glCreateShader.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glCreateShader.xhtml>`__
:type shaderType: Specifies the type of shader to be created. :type shaderType: Specifies the type of shader to be created.
Must be one of ``GL_VERTEX_SHADER``, Must be one of ``GL_VERTEX_SHADER``,
@@ -1316,7 +1315,7 @@ offers a set of extensive examples, including advanced features.
Deletes a program object. Deletes a program object.
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glDeleteProgram.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glDeleteProgram.xhtml>`__
:type program: int :type program: int
:arg program: Specifies the program object to be deleted. :arg program: Specifies the program object to be deleted.
@@ -1326,7 +1325,7 @@ offers a set of extensive examples, including advanced features.
Deletes a shader object. Deletes a shader object.
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glDeleteShader.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glDeleteShader.xhtml>`__
:type shader: int :type shader: int
:arg shader: Specifies the shader object to be deleted. :arg shader: Specifies the shader object to be deleted.
@@ -1336,7 +1335,7 @@ offers a set of extensive examples, including advanced features.
Detaches a shader object from a program object to which it is attached. Detaches a shader object from a program object to which it is attached.
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glDetachShader.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glDetachShader.xhtml>`__
:type program: int :type program: int
:arg program: Specifies the program object from which to detach the shader object. :arg program: Specifies the program object from which to detach the shader object.
@@ -1348,7 +1347,7 @@ offers a set of extensive examples, including advanced features.
Returns the handles of the shader objects attached to a program object. Returns the handles of the shader objects attached to a program object.
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glGetAttachedShaders.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glGetAttachedShaders.xhtml>`__
:type program: int :type program: int
:arg program: Specifies the program object to be queried. :arg program: Specifies the program object to be queried.
@@ -1364,7 +1363,7 @@ offers a set of extensive examples, including advanced features.
Returns the information log for a program object. Returns the information log for a program object.
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glGetProgramInfoLog.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glGetProgramInfoLog.xhtml>`__
:type program: int :type program: int
:arg program: Specifies the program object whose information log is to be queried. :arg program: Specifies the program object whose information log is to be queried.
@@ -1380,7 +1379,7 @@ offers a set of extensive examples, including advanced features.
Returns the information log for a shader object. Returns the information log for a shader object.
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glGetShaderInfoLog.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glGetShaderInfoLog.xhtml>`__
:type shader: int :type shader: int
:arg shader: Specifies the shader object whose information log is to be queried. :arg shader: Specifies the shader object whose information log is to be queried.
@@ -1396,7 +1395,7 @@ offers a set of extensive examples, including advanced features.
Returns a parameter from a program object. Returns a parameter from a program object.
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glGetProgram.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glGetProgram.xhtml>`__
:type program: int :type program: int
:arg program: Specifies the program object to be queried. :arg program: Specifies the program object to be queried.
@@ -1410,7 +1409,7 @@ offers a set of extensive examples, including advanced features.
Determines if a name corresponds to a shader object. Determines if a name corresponds to a shader object.
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glIsShader.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glIsShader.xhtml>`__
:type shader: int :type shader: int
:arg shader: Specifies a potential shader object. :arg shader: Specifies a potential shader object.
@@ -1420,7 +1419,7 @@ offers a set of extensive examples, including advanced features.
Determines if a name corresponds to a program object Determines if a name corresponds to a program object
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glIsProgram.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glIsProgram.xhtml>`__
:type program: int :type program: int
:arg program: Specifies a potential program object. :arg program: Specifies a potential program object.
@@ -1430,7 +1429,7 @@ offers a set of extensive examples, including advanced features.
Returns the source code string from a shader object Returns the source code string from a shader object
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glGetShaderSource.xml>`__ .. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glGetShaderSource.xhtml>`__
:type shader: int :type shader: int
:arg shader: Specifies the shader object to be queried. :arg shader: Specifies the shader object to be queried.

View File

@@ -5,17 +5,6 @@
--partial bmesh* ; cd doc/python_api ; sphinx-build sphinx-in sphinx-out ; cd ../../ --partial bmesh* ; cd doc/python_api ; sphinx-build sphinx-in sphinx-out ; cd ../../
Submodules:
.. toctree::
:maxdepth: 1
bmesh.ops.rst
bmesh.types.rst
bmesh.utils.rst
bmesh.geometry.rst
Introduction Introduction
------------ ------------

View File

@@ -677,7 +677,7 @@ Here are some general hints to avoid running into these problems:
Undo/Redo Undo/Redo
--------- ---------
For safety, you should assume that undo and redo always invalidates all :class:`bpy.types.ID` For safety, you should assume that undo and redo always invalidates all :class:`bpy.types.ID`
instances (Object, Scene, Mesh, Light, etc.), as weel obviously as all of their sub-data. instances (Object, Scene, Mesh, Light, etc.), as weel obviously as all of their sub-data.
This example shows how you can tell undo changes the memory locations: This example shows how you can tell undo changes the memory locations:
@@ -701,7 +701,7 @@ interactively by the user is the only way to make sure that the script doesn't b
Modern undo/redo system does not systematically invalidate all pointers anymore. Modern undo/redo system does not systematically invalidate all pointers anymore.
Some data (in fact, most data, in typical cases), which were detected as unchanged for a Some data (in fact, most data, in typical cases), which were detected as unchanged for a
particular history step, may remain unchanged and hence their pointers may remain valid. particular history step, may remain unchanged and hence their pointers may remain valid.
Be aware that if you want to take advantage of this behavior for some reason, there is no Be aware that if you want to take advantage of this behavior for some reason, there is no
guarantee of any kind that it will be safe and consistent. Use it at your own risk. guarantee of any kind that it will be safe and consistent. Use it at your own risk.

View File

@@ -49,10 +49,6 @@ This module gives access to low level bmesh operations.
Most operators take input and return output, they can be chained together Most operators take input and return output, they can be chained together
to perform useful operations. to perform useful operations.
.. note::
This API us new in 2.65 and not yet well tested.
Operator Example Operator Example
++++++++++++++++ ++++++++++++++++

View File

@@ -41,8 +41,7 @@ Sphinx: HTML generation
After you have built doc/python_api/sphinx-in (see above), After you have built doc/python_api/sphinx-in (see above),
generate html docs by running: generate html docs by running:
cd doc/python_api sphinx-build doc/python_api/sphinx-in doc/python_api/sphinx-out
sphinx-build sphinx-in sphinx-out
Sphinx: PDF generation Sphinx: PDF generation
@@ -93,12 +92,13 @@ SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__))
# For now, ignore add-ons and internal subclasses of 'bpy.types.PropertyGroup'. # For now, ignore add-ons and internal subclasses of 'bpy.types.PropertyGroup'.
# #
# Besides disabling this line, the main change will be to add a # Besides disabling this line, the main change will be to add a
# 'toctree' to 'write_rst_contents' which contains the generated rst files. # 'toctree' to 'write_rst_index' which contains the generated rst files.
# This 'toctree' can be generated automatically. # This 'toctree' can be generated automatically.
# #
# See: D6261 for reference. # See: D6261 for reference.
USE_ONLY_BUILTIN_RNA_TYPES = True USE_ONLY_BUILTIN_RNA_TYPES = True
def handle_args(): def handle_args():
''' '''
Parse the args passed to Blender after "--", ignored by Blender Parse the args passed to Blender after "--", ignored by Blender
@@ -173,7 +173,7 @@ def handle_args():
dest="log", dest="log",
default=False, default=False,
action='store_true', action='store_true',
help="Log the output of the api dump and sphinx|latex " help="Log the output of the API dump and sphinx|latex "
"warnings and errors (default=False).\n" "warnings and errors (default=False).\n"
"If given, save logs in:\n" "If given, save logs in:\n"
"* OUTPUT_DIR/.bpy.log\n" "* OUTPUT_DIR/.bpy.log\n"
@@ -244,6 +244,7 @@ else:
"bpy.types", # supports filtering "bpy.types", # supports filtering
"bpy.utils", "bpy.utils",
"bpy.utils.previews", "bpy.utils.previews",
"bpy.utils.units",
"bpy_extras", "bpy_extras",
"gpu", "gpu",
"gpu.types", "gpu.types",
@@ -350,9 +351,9 @@ RST_DIR = os.path.abspath(os.path.join(SCRIPT_DIR, "rst"))
# stored in ./rst/info_* # stored in ./rst/info_*
INFO_DOCS = ( INFO_DOCS = (
("info_quickstart.rst", ("info_quickstart.rst",
"Quickstart: new to Blender or scripting and want to get your feet wet?"), "Quickstart: New to Blender or scripting and want to get your feet wet?"),
("info_overview.rst", ("info_overview.rst",
"API Overview: a more complete explanation of Python integration"), "API Overview: A more complete explanation of Python integration"),
("info_api_reference.rst", ("info_api_reference.rst",
"API Reference Usage: examples of how to use the API reference docs"), "API Reference Usage: examples of how to use the API reference docs"),
("info_best_practice.rst", ("info_best_practice.rst",
@@ -360,8 +361,8 @@ INFO_DOCS = (
("info_tips_and_tricks.rst", ("info_tips_and_tricks.rst",
"Tips and Tricks: Hints to help you while writing scripts for Blender"), "Tips and Tricks: Hints to help you while writing scripts for Blender"),
("info_gotcha.rst", ("info_gotcha.rst",
"Gotcha's: some of the problems you may encounter when writing scripts"), "Gotcha's: Some of the problems you may encounter when writing scripts"),
("change_log.rst", "List of changes since last Blender release"), ("change_log.rst", "Change Log: List of changes since last Blender release"),
) )
# only support for properties atm. # only support for properties atm.
@@ -495,6 +496,13 @@ else:
bpy_struct = None bpy_struct = None
def import_value_from_module(module_name, import_name):
ns = {}
exec_str = "from %s import %s as value" % (module_name, import_name)
exec(exec_str, ns, ns)
return ns["value"]
def escape_rst(text): def escape_rst(text):
""" Escape plain text which may contain characters used by RST. """ Escape plain text which may contain characters used by RST.
""" """
@@ -744,13 +752,12 @@ def pyprop2sphinx(ident, fw, identifier, py_prop):
else: else:
fw(ident + ".. attribute:: %s\n\n" % identifier) fw(ident + ".. attribute:: %s\n\n" % identifier)
write_indented_lines(ident + " ", fw, py_prop.__doc__) write_indented_lines(ident + " ", fw, py_prop.__doc__)
fw("\n")
if py_prop.fset is None: if py_prop.fset is None:
fw(ident + " (readonly)\n\n") fw(ident + " (readonly)\n\n")
else:
fw("\n")
def pymodule2sphinx(basepath, module_name, module, title): def pymodule2sphinx(basepath, module_name, module, title, module_all_extra):
import types import types
attribute_set = set() attribute_set = set()
filepath = os.path.join(basepath, module_name + ".rst") filepath = os.path.join(basepath, module_name + ".rst")
@@ -797,42 +804,51 @@ def pymodule2sphinx(basepath, module_name, module, title):
fw(module.__doc__.strip()) fw(module.__doc__.strip())
fw("\n\n") fw("\n\n")
write_example_ref("", fw, module_name)
# write submodules # write submodules
# we could also scan files but this ensures __all__ is used correctly # we could also scan files but this ensures __all__ is used correctly
if module_all is not None: if module_all or module_all_extra:
submod_name = None submod_name = None
submod = None submod = None
submod_ls = [] submod_ls = []
for submod_name in module_all: for submod_name in (module_all or ()):
ns = {} submod = import_value_from_module(module_name, submod_name)
exec_str = "from %s import %s as submod" % (module.__name__, submod_name)
exec(exec_str, ns, ns)
submod = ns["submod"]
if type(submod) == types.ModuleType: if type(submod) == types.ModuleType:
submod_ls.append((submod_name, submod)) submod_ls.append((submod_name, submod))
for submod_name in module_all_extra:
if submod_name in attribute_set:
continue
submod = import_value_from_module(module_name, submod_name)
# No type checks, since there are non-module types we treat as modules
# such as `bpy.app.translations` & `bpy.app.handlers`.
submod_ls.append((submod_name, submod))
del submod_name del submod_name
del submod del submod
if submod_ls: if submod_ls:
fw(".. toctree::\n") fw(".. toctree::\n")
fw(" :maxdepth: 1\n\n") fw(" :maxdepth: 1\n")
fw(" :caption: Submodules\n\n")
for submod_name, submod in submod_ls: for submod_name, submod in submod_ls:
submod_name_full = "%s.%s" % (module_name, submod_name) submod_name_full = "%s.%s" % (module_name, submod_name)
fw(" %s.rst\n\n" % submod_name_full) fw(" %s.rst\n" % submod_name_full)
pymodule2sphinx(basepath, submod_name_full, submod, "%s submodule" % module_name) pymodule2sphinx(basepath, submod_name_full, submod, "%s submodule" % module_name, ())
fw("\n")
del submod_ls del submod_ls
# done writing submodules! # done writing submodules!
write_example_ref("", fw, module_name)
# write members of the module # write members of the module
# only tested with PyStructs which are not exactly modules # only tested with PyStructs which are not exactly modules
for key, descr in sorted(type(module).__dict__.items()): for key, descr in sorted(type(module).__dict__.items()):
if key.startswith("__"): if key.startswith("__"):
continue continue
if key in module_all_extra:
continue
# naughty, we also add getset's into PyStructs, this is not typical py but also not incorrect. # naughty, we also add getset's into PyStructs, this is not typical py but also not incorrect.
# type_name is only used for examples and messages # type_name is only used for examples and messages
@@ -855,6 +871,8 @@ def pymodule2sphinx(basepath, module_name, module, title):
# sort by the valye type # sort by the valye type
descr_sorted.sort(key=lambda descr_data: str(descr_data[3])) descr_sorted.sort(key=lambda descr_data: str(descr_data[3]))
for key, descr, value, value_type in descr_sorted: for key, descr, value, value_type in descr_sorted:
if key in module_all_extra:
continue
# must be documented as a submodule # must be documented as a submodule
if is_struct_seq(value): if is_struct_seq(value):
@@ -896,6 +914,9 @@ def pymodule2sphinx(basepath, module_name, module, title):
module_dir_value_type.sort(key=lambda triple: str(triple[2])) module_dir_value_type.sort(key=lambda triple: str(triple[2]))
for attribute, value, value_type in module_dir_value_type: for attribute, value, value_type in module_dir_value_type:
if attribute in module_all_extra:
continue
if value_type == FunctionType: if value_type == FunctionType:
pyfunc2sphinx("", fw, module_name, None, attribute, value, is_class=False) pyfunc2sphinx("", fw, module_name, None, attribute, value, is_class=False)
# both the same at the moment but to be future proof # both the same at the moment but to be future proof
@@ -1054,6 +1075,7 @@ context_type_map = {
"selected_bones": ("EditBone", True), "selected_bones": ("EditBone", True),
"selected_editable_bones": ("EditBone", True), "selected_editable_bones": ("EditBone", True),
"selected_editable_fcurves": ("FCurve", True), "selected_editable_fcurves": ("FCurve", True),
"selected_editable_keyframes": ("Keyframe", True),
"selected_editable_objects": ("Object", True), "selected_editable_objects": ("Object", True),
"selected_editable_sequences": ("Sequence", True), "selected_editable_sequences": ("Sequence", True),
"selected_nla_strips": ("NlaStrip", True), "selected_nla_strips": ("NlaStrip", True),
@@ -1095,7 +1117,7 @@ def pycontext2sphinx(basepath):
fw("The context members available depend on the area of Blender which is currently being accessed.\n") fw("The context members available depend on the area of Blender which is currently being accessed.\n")
fw("\n") fw("\n")
fw("Note that all context values are readonly,\n") fw("Note that all context values are readonly,\n")
fw("but may be modified through the data api or by running operators\n\n") fw("but may be modified through the data API or by running operators\n\n")
def write_contex_cls(): def write_contex_cls():
@@ -1204,7 +1226,7 @@ def pyrna_enum2sphinx(prop, use_empty_descriptions=False):
identifier, identifier,
# Account for multi-line enum descriptions, allowing this to be a block of text. # Account for multi-line enum descriptions, allowing this to be a block of text.
indent(", ".join(escape_rst(val) for val in (name, description) if val) or "Undocumented", " "), indent(", ".join(escape_rst(val) for val in (name, description) if val) or "Undocumented", " "),
) )
for identifier, name, description in prop.enum_items for identifier, name, description in prop.enum_items
]) ])
else: else:
@@ -1312,7 +1334,7 @@ def pyrna2sphinx(basepath):
fw(title_string(title, "=")) fw(title_string(title, "="))
fw(".. module:: %s\n\n" % struct_module_name) fw(".. currentmodule:: %s\n\n" % struct_module_name)
# docs first?, ok # docs first?, ok
write_example_ref("", fw, "%s.%s" % (struct_module_name, struct_id)) write_example_ref("", fw, "%s.%s" % (struct_module_name, struct_id))
@@ -1543,8 +1565,7 @@ def pyrna2sphinx(basepath):
fw(title_string(class_name, "=")) fw(title_string(class_name, "="))
fw(".. module:: %s\n" % class_module_name) fw(".. currentmodule:: %s\n\n" % class_module_name)
fw("\n")
if use_subclasses: if use_subclasses:
subclass_ids = [ subclass_ids = [
@@ -1558,7 +1579,7 @@ def pyrna2sphinx(basepath):
fw(".. class:: %s\n\n" % class_name) fw(".. class:: %s\n\n" % class_name)
fw(" %s\n\n" % descr_str) fw(" %s\n\n" % descr_str)
fw(" .. note::\n\n") fw(" .. note::\n\n")
fw(" Note that %s.%s is not actually available from within Blender,\n" fw(" Note that :class:`%s.%s` is not actually available from within Blender,\n"
" it only exists for the purpose of documentation.\n\n" % (class_module_name, class_name)) " it only exists for the purpose of documentation.\n\n" % (class_module_name, class_name))
descr_items = [ descr_items = [
@@ -1673,15 +1694,26 @@ def write_sphinx_conf_py(basepath):
fw("]\n\n") fw("]\n\n")
fw("html_title = 'Blender Python API'\n") fw("html_title = 'Blender Python API'\n")
fw("html_theme = 'sphinx_rtd_theme'\n")
fw("html_theme_options = {\n") fw("html_theme = 'default'\n")
fw(" 'canonical_url': 'https://docs.blender.org/api/current/',\n") # The theme 'sphinx_rtd_theme' is no longer distributed with sphinx by default, only use when available.
# fw(" 'analytics_id': '',\n") fw(r"""
# fw(" 'collapse_navigation': True,\n") try:
fw(" 'sticky_navigation': False,\n") __import__('sphinx_rtd_theme')
fw(" 'navigation_depth': 1,\n") html_theme = 'sphinx_rtd_theme'
# fw(" 'includehidden': True,\n") except ModuleNotFoundError:
# fw(" 'titles_only': False\n") pass
""")
fw("if html_theme == 'sphinx_rtd_theme':\n")
fw(" html_theme_options = {\n")
fw(" 'canonical_url': 'https://docs.blender.org/api/current/',\n")
# fw(" 'analytics_id': '',\n")
# fw(" 'collapse_navigation': True,\n")
fw(" 'sticky_navigation': False,\n")
fw(" 'navigation_depth': 1,\n")
# fw(" 'includehidden': True,\n")
# fw(" 'titles_only': False\n")
fw(" }\n\n") fw(" }\n\n")
# not helpful since the source is generated, adds to upload size. # not helpful since the source is generated, adds to upload size.
@@ -1730,7 +1762,7 @@ def execfile(filepath):
file_handle.close() file_handle.close()
def write_rst_contents(basepath): def write_rst_index(basepath):
''' '''
Write the rst file of the main page, needed for sphinx (index.html) Write the rst file of the main page, needed for sphinx (index.html)
''' '''
@@ -1770,7 +1802,6 @@ def write_rst_contents(basepath):
# py modules # py modules
"bpy.utils", "bpy.utils",
"bpy.utils.previews",
"bpy.path", "bpy.path",
"bpy.app", "bpy.app",
@@ -1808,6 +1839,10 @@ def write_rst_contents(basepath):
fw(" %s\n" % mod) fw(" %s\n" % mod)
fw("\n") fw("\n")
fw(title_string("Indices", "="))
fw("* :ref:`genindex`\n")
fw("* :ref:`modindex`\n\n")
# special case, this 'bmesh.ops.rst' is extracted from C source # special case, this 'bmesh.ops.rst' is extracted from C source
if "bmesh.ops" not in EXCLUDE_MODULES: if "bmesh.ops" not in EXCLUDE_MODULES:
execfile(os.path.join(SCRIPT_DIR, "rst_from_bmesh_opdefines.py")) execfile(os.path.join(SCRIPT_DIR, "rst_from_bmesh_opdefines.py"))
@@ -1843,6 +1878,7 @@ def write_rst_types_index(basepath):
file = open(filepath, "w", encoding="utf-8") file = open(filepath, "w", encoding="utf-8")
fw = file.write fw = file.write
fw(title_string("Types (bpy.types)", "=")) fw(title_string("Types (bpy.types)", "="))
fw(".. module:: bpy.types\n\n")
fw(".. toctree::\n") fw(".. toctree::\n")
fw(" :glob:\n\n") fw(" :glob:\n\n")
fw(" bpy.types.*\n\n") fw(" bpy.types.*\n\n")
@@ -1858,8 +1894,10 @@ def write_rst_ops_index(basepath):
file = open(filepath, "w", encoding="utf-8") file = open(filepath, "w", encoding="utf-8")
fw = file.write fw = file.write
fw(title_string("Operators (bpy.ops)", "=")) fw(title_string("Operators (bpy.ops)", "="))
fw(".. module:: bpy.ops\n\n")
write_example_ref("", fw, "bpy.ops") write_example_ref("", fw, "bpy.ops")
fw(".. toctree::\n") fw(".. toctree::\n")
fw(" :caption: Submodules\n")
fw(" :glob:\n\n") fw(" :glob:\n\n")
fw(" bpy.ops.*\n\n") fw(" bpy.ops.*\n\n")
file.close() file.close()
@@ -1884,7 +1922,7 @@ def write_rst_msgbus(basepath):
file.close() file.close()
# Write the contents. # Write the contents.
pymodule2sphinx(basepath, 'bpy.msgbus', bpy.msgbus, 'Message Bus') pymodule2sphinx(basepath, 'bpy.msgbus', bpy.msgbus, 'Message Bus', ())
EXAMPLE_SET_USED.add("bpy.msgbus") EXAMPLE_SET_USED.add("bpy.msgbus")
@@ -1899,7 +1937,7 @@ def write_rst_data(basepath):
file = open(filepath, "w", encoding="utf-8") file = open(filepath, "w", encoding="utf-8")
fw = file.write fw = file.write
fw(title_string("Data Access (bpy.data)", "=")) fw(title_string("Data Access (bpy.data)", "="))
fw(".. module:: bpy\n") fw(".. module:: bpy.data\n")
fw("\n") fw("\n")
fw("This module is used for all Blender/Python access.\n") fw("This module is used for all Blender/Python access.\n")
fw("\n") fw("\n")
@@ -1936,6 +1974,7 @@ def write_rst_importable_modules(basepath):
"gpu.select": "GPU Select", "gpu.select": "GPU Select",
"gpu.shader": "GPU Shader", "gpu.shader": "GPU Shader",
"bmesh": "BMesh Module", "bmesh": "BMesh Module",
"bmesh.ops": "BMesh Operators",
"bmesh.types": "BMesh Types", "bmesh.types": "BMesh Types",
"bmesh.utils": "BMesh Utilities", "bmesh.utils": "BMesh Utilities",
"bmesh.geometry": "BMesh Geometry Utilities", "bmesh.geometry": "BMesh Geometry Utilities",
@@ -1961,11 +2000,32 @@ def write_rst_importable_modules(basepath):
"freestyle.shaders": "Freestyle Shaders", "freestyle.shaders": "Freestyle Shaders",
"freestyle.utils": "Freestyle Utilities", "freestyle.utils": "Freestyle Utilities",
} }
# This is needed since some of the sub-modules listed above are not actual modules.
# Examples include `bpy.app.translations` & `bpy.app.handlers`.
#
# Most of these are `PyStructSequence` internally,
# however we don't want to document all of these as modules since some only contain
# a few values (version number for e.g).
#
# If we remove this logic and document all `PyStructSequence` as sub-modules it means
# `bpy.app.timers` for example would be presented on the same level as library information
# access such as `bpy.app.sdl` which doesn't seem useful since it hides more useful
# module-like objects among library data access.
importable_modules_parent_map = {}
for mod_name in importable_modules.keys():
if mod_name in EXCLUDE_MODULES:
continue
if "." in mod_name:
mod_name, submod_name = mod_name.rsplit(".", 1)
importable_modules_parent_map.setdefault(mod_name, []).append(submod_name)
for mod_name, mod_descr in importable_modules.items(): for mod_name, mod_descr in importable_modules.items():
if mod_name not in EXCLUDE_MODULES: if mod_name in EXCLUDE_MODULES:
module = __import__(mod_name, continue
fromlist=[mod_name.rsplit(".", 1)[-1]]) module_all_extra = importable_modules_parent_map.get(mod_name, ())
pymodule2sphinx(basepath, mod_name, module, mod_descr) module = __import__(mod_name, fromlist=[mod_name.rsplit(".", 1)[-1]])
pymodule2sphinx(basepath, mod_name, module, mod_descr, module_all_extra)
def copy_handwritten_rsts(basepath): def copy_handwritten_rsts(basepath):
@@ -2030,7 +2090,7 @@ def rna2sphinx(basepath):
write_sphinx_conf_py(basepath) write_sphinx_conf_py(basepath)
# main page # main page
write_rst_contents(basepath) write_rst_index(basepath)
# context # context
if "bpy.context" not in EXCLUDE_MODULES: if "bpy.context" not in EXCLUDE_MODULES:
@@ -2227,7 +2287,7 @@ def main():
shutil.rmtree(REFERENCE_PATH, True) shutil.rmtree(REFERENCE_PATH, True)
# copy SPHINX_OUT to the REFERENCE_PATH # copy SPHINX_OUT to the REFERENCE_PATH
ignores = ('.doctrees', 'objects.inv', '.buildinfo') ignores = ('.doctrees', '.buildinfo')
shutil.copytree(SPHINX_OUT, shutil.copytree(SPHINX_OUT,
REFERENCE_PATH, REFERENCE_PATH,
ignore=shutil.ignore_patterns(*ignores)) ignore=shutil.ignore_patterns(*ignores))

View File

@@ -76,11 +76,7 @@ fi
# Generate HTML (sphinx) # Generate HTML (sphinx)
if $DO_OUT_HTML ; then if $DO_OUT_HTML ; then
# sphinx-build -n -b html $SPHINX_WORKDIR/sphinx-in $SPHINX_WORKDIR/sphinx-out sphinx-build -b html -j auto $SPHINX_WORKDIR/sphinx-in $SPHINX_WORKDIR/sphinx-out
# annoying bug in sphinx makes it very slow unless we do this. should report.
cd $SPHINX_WORKDIR
sphinx-build -b html sphinx-in sphinx-out
# XXX, saves space on upload and zip, should move HTML outside # XXX, saves space on upload and zip, should move HTML outside
# and zip up there, for now this is OK # and zip up there, for now this is OK
@@ -107,8 +103,7 @@ fi
# Generate PDF (sphinx/laytex) # Generate PDF (sphinx/laytex)
if $DO_OUT_PDF ; then if $DO_OUT_PDF ; then
cd $SPHINX_WORKDIR sphinx-build -n -b latex -j auto $SPHINX_WORKDIR/sphinx-in $SPHINX_WORKDIR/sphinx-out
sphinx-build -n -b latex $SPHINX_WORKDIR/sphinx-in $SPHINX_WORKDIR/sphinx-out
make -C $SPHINX_WORKDIR/sphinx-out make -C $SPHINX_WORKDIR/sphinx-out
mv $SPHINX_WORKDIR/sphinx-out/contents.pdf \ mv $SPHINX_WORKDIR/sphinx-out/contents.pdf \
$SPHINX_WORKDIR/sphinx-out/blender_python_reference_$BLENDER_VERSION.pdf $SPHINX_WORKDIR/sphinx-out/blender_python_reference_$BLENDER_VERSION.pdf

View File

@@ -9,3 +9,7 @@
/* Hide home icon in search area */ /* Hide home icon in search area */
.wy-side-nav-search > a:hover {background: none; opacity: 0.9} .wy-side-nav-search > a:hover {background: none; opacity: 0.9}
.wy-side-nav-search > a.icon::before {content: none} .wy-side-nav-search > a.icon::before {content: none}
.wy-nav-content {
max-width: 1000px !important;
}

View File

@@ -60,7 +60,7 @@ PlaybackManager_dealloc(PlaybackManagerP* self)
} }
PyDoc_STRVAR(M_aud_PlaybackManager_play_doc, PyDoc_STRVAR(M_aud_PlaybackManager_play_doc,
".. classmethod:: setVolume(sound, catKey)\n\n" ".. classmethod:: play(sound, catKey)\n\n"
" Plays a sound through the playback manager and assigns it to a category.\n\n" " Plays a sound through the playback manager and assigns it to a category.\n\n"
" :arg sound: The sound to play.\n" " :arg sound: The sound to play.\n"
" :type sound: :class:`Sound`\n" " :type sound: :class:`Sound`\n"

View File

@@ -31,6 +31,17 @@ if(MSVC_CLANG AND WITH_OPENMP AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "9.0.1
remove_cc_flag("-fopenmp") remove_cc_flag("-fopenmp")
endif() endif()
# Exporting functions from the blender binary gives linker warnings on Apple arm64 systems.
# For now and until Apple arm64 is officially supported, these will just be silenced here.
# TODO (sebbas): Check if official arm64 devices give linker warnings without this block.
if(APPLE AND ("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64"))
if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
endif()
endif()
set(MANTAVERSION "0.13") set(MANTAVERSION "0.13")
add_definitions(-DWITH_FLUID=1) add_definitions(-DWITH_FLUID=1)

View File

@@ -377,19 +377,6 @@ class RandomStream {
} }
/*! get a random number from the stream */ /*! get a random number from the stream */
inline double getDouble(void)
{
return mtr.rand();
};
inline float getFloat(void)
{
return (float)mtr.rand();
};
inline float getFloat(float min, float max)
{
return mtr.rand(max - min) + min;
};
inline float getRandNorm(float mean, float var) inline float getRandNorm(float mean, float var)
{ {
return mtr.randNorm(mean, var); return mtr.randNorm(mean, var);
@@ -400,12 +387,20 @@ class RandomStream {
{ {
return getFloat(); return getFloat();
} }
inline Real getReal(float min, float max)
{
return getFloat(min, max);
}
#else #else
inline Real getReal() inline Real getReal()
{ {
return getDouble(); return getDouble();
} }
inline Real getReal(double min, double max)
{
return getDouble(min, max);
}
#endif #endif
inline Vec3 getVec3() inline Vec3 getVec3()
@@ -422,6 +417,24 @@ class RandomStream {
private: private:
MTRand mtr; MTRand mtr;
inline double getDouble(void)
{
return mtr.rand();
};
inline float getFloat(void)
{
return (float)mtr.rand();
};
inline double getDouble(double min, double max)
{
return mtr.rand(max - min) + min;
};
inline float getFloat(float min, float max)
{
return (float)(mtr.rand(max - min) + min);
};
}; };
} // namespace Manta } // namespace Manta

View File

@@ -60,7 +60,7 @@ template<class GridType, class T> void importVDB(typename GridType::Ptr from, Gr
template<class VDBType, class T> template<class VDBType, class T>
void importVDB(VDBType vdbValue, ParticleDataImpl<T> *to, int index, float voxelSize) void importVDB(VDBType vdbValue, ParticleDataImpl<T> *to, int index, float voxelSize)
{ {
(void)voxelSize; // Unused unusedParameter(voxelSize); // Unused for now
T toMantaValue; T toMantaValue;
convertFrom(vdbValue, &toMantaValue); convertFrom(vdbValue, &toMantaValue);
to->set(index, toMantaValue); to->set(index, toMantaValue);
@@ -165,12 +165,12 @@ static void setGridOptions(typename GridType::Ptr grid,
string name, string name,
openvdb::GridClass cls, openvdb::GridClass cls,
float voxelSize, float voxelSize,
bool precisionHalf) int precision)
{ {
grid->setTransform(openvdb::math::Transform::createLinearTransform(voxelSize)); grid->setTransform(openvdb::math::Transform::createLinearTransform(voxelSize));
grid->setGridClass(cls); grid->setGridClass(cls);
grid->setName(name); grid->setName(name);
grid->setSaveFloatAsHalf(precisionHalf); grid->setSaveFloatAsHalf(precision == PRECISION_MINI || precision == PRECISION_HALF);
} }
template<class T, class GridType> typename GridType::Ptr exportVDB(Grid<T> *from) template<class T, class GridType> typename GridType::Ptr exportVDB(Grid<T> *from)
@@ -194,7 +194,8 @@ template<class MantaType, class VDBType>
void exportVDB(ParticleDataImpl<MantaType> *from, void exportVDB(ParticleDataImpl<MantaType> *from,
openvdb::points::PointDataGrid::Ptr to, openvdb::points::PointDataGrid::Ptr to,
openvdb::tools::PointIndexGrid::Ptr pIndex, openvdb::tools::PointIndexGrid::Ptr pIndex,
bool skipDeletedParts) bool skipDeletedParts,
int precision)
{ {
std::vector<VDBType> vdbValues; std::vector<VDBType> vdbValues;
std::string name = from->getName(); std::string name = from->getName();
@@ -212,8 +213,21 @@ void exportVDB(ParticleDataImpl<MantaType> *from,
vdbValues.push_back(vdbValue); vdbValues.push_back(vdbValue);
} }
openvdb::NamePair attribute = // Use custom codec for precision of the attribute
openvdb::points::TypedAttributeArray<VDBType, openvdb::points::NullCodec>::attributeType(); openvdb::NamePair attribute;
if (precision == PRECISION_FULL) {
attribute =
openvdb::points::TypedAttributeArray<VDBType, openvdb::points::NullCodec>::attributeType();
}
else if (precision == PRECISION_HALF ||
precision == PRECISION_MINI) { // Mini uses same precision as half for now
attribute =
openvdb::points::TypedAttributeArray<VDBType,
openvdb::points::TruncateCodec>::attributeType();
}
else {
errMsg("exportVDB: invalid precision level");
}
openvdb::points::appendAttribute(to->tree(), name, attribute); openvdb::points::appendAttribute(to->tree(), name, attribute);
// Create a wrapper around the vdb values vector. // Create a wrapper around the vdb values vector.
@@ -229,7 +243,8 @@ void exportVDB(ParticleDataImpl<MantaType> *from,
openvdb::points::PointDataGrid::Ptr exportVDB(BasicParticleSystem *from, openvdb::points::PointDataGrid::Ptr exportVDB(BasicParticleSystem *from,
std::vector<ParticleDataBase *> &fromPData, std::vector<ParticleDataBase *> &fromPData,
bool skipDeletedParts, bool skipDeletedParts,
float voxelSize) float voxelSize,
int precision)
{ {
std::vector<openvdb::Vec3s> positions; std::vector<openvdb::Vec3s> positions;
std::vector<int> flags; std::vector<int> flags;
@@ -257,16 +272,34 @@ openvdb::points::PointDataGrid::Ptr exportVDB(BasicParticleSystem *from,
openvdb::tools::createPointIndexGrid<openvdb::tools::PointIndexGrid>(positionsWrapper, openvdb::tools::createPointIndexGrid<openvdb::tools::PointIndexGrid>(positionsWrapper,
*transform); *transform);
// TODO (sebbas): Use custom codec for attributes? openvdb::points::PointDataGrid::Ptr to;
// using Codec = openvdb::points::FixedPointCodec</*1-byte=*/false, openvdb::points::UnitRange>; openvdb::NamePair flagAttribute;
openvdb::points::PointDataGrid::Ptr to =
openvdb::points::createPointDataGrid<openvdb::points::NullCodec /*Codec*/, using CodecNull = openvdb::points::NullCodec;
openvdb::points::PointDataGrid>( using CodecTrunc = openvdb::points::TruncateCodec;
*pointIndexGrid, positionsWrapper, *transform); using CodecFixPoint = openvdb::points::FixedPointCodec<true, openvdb::points::PositionRange>;
// Use custom codec for precision of the particle position and the flag attribute
if (precision == PRECISION_FULL) {
to = openvdb::points::createPointDataGrid<CodecNull, openvdb::points::PointDataGrid>(
*pointIndexGrid, positionsWrapper, *transform);
flagAttribute = openvdb::points::TypedAttributeArray<int, CodecNull>::attributeType();
}
else if (precision == PRECISION_HALF) {
to = openvdb::points::createPointDataGrid<CodecTrunc, openvdb::points::PointDataGrid>(
*pointIndexGrid, positionsWrapper, *transform);
flagAttribute = openvdb::points::TypedAttributeArray<int, CodecTrunc>::attributeType();
}
else if (precision == PRECISION_MINI) {
to = openvdb::points::createPointDataGrid<CodecFixPoint, openvdb::points::PointDataGrid>(
*pointIndexGrid, positionsWrapper, *transform);
flagAttribute = openvdb::points::TypedAttributeArray<int, CodecTrunc>::
attributeType(); // Use 16 bit trunc for flag for now
}
else {
errMsg("exportVDB: invalid precision level");
}
openvdb::NamePair flagAttribute =
openvdb::points::TypedAttributeArray<int,
openvdb::points::NullCodec /*Codec*/>::attributeType();
openvdb::points::appendAttribute(to->tree(), FLAG_NAME, flagAttribute); openvdb::points::appendAttribute(to->tree(), FLAG_NAME, flagAttribute);
// Create a wrapper around the flag vector. // Create a wrapper around the flag vector.
openvdb::points::PointAttributeVector<int> flagWrapper(flags); openvdb::points::PointAttributeVector<int> flagWrapper(flags);
@@ -281,17 +314,17 @@ openvdb::points::PointDataGrid::Ptr exportVDB(BasicParticleSystem *from,
if (pdb->getType() == ParticleDataBase::TypeInt) { if (pdb->getType() == ParticleDataBase::TypeInt) {
debMsg("Writing int particle data '" << pdb->getName() << "'", 1); debMsg("Writing int particle data '" << pdb->getName() << "'", 1);
ParticleDataImpl<int> *pdi = dynamic_cast<ParticleDataImpl<int> *>(pdb); ParticleDataImpl<int> *pdi = dynamic_cast<ParticleDataImpl<int> *>(pdb);
exportVDB<int, int>(pdi, to, pointIndexGrid, skipDeletedParts); exportVDB<int, int>(pdi, to, pointIndexGrid, skipDeletedParts, precision);
} }
else if (pdb->getType() == ParticleDataBase::TypeReal) { else if (pdb->getType() == ParticleDataBase::TypeReal) {
debMsg("Writing real particle data '" << pdb->getName() << "'", 1); debMsg("Writing real particle data '" << pdb->getName() << "'", 1);
ParticleDataImpl<Real> *pdi = dynamic_cast<ParticleDataImpl<Real> *>(pdb); ParticleDataImpl<Real> *pdi = dynamic_cast<ParticleDataImpl<Real> *>(pdb);
exportVDB<Real, float>(pdi, to, pointIndexGrid, skipDeletedParts); exportVDB<Real, float>(pdi, to, pointIndexGrid, skipDeletedParts, precision);
} }
else if (pdb->getType() == ParticleDataBase::TypeVec3) { else if (pdb->getType() == ParticleDataBase::TypeVec3) {
debMsg("Writing Vec3 particle data '" << pdb->getName() << "'", 1); debMsg("Writing Vec3 particle data '" << pdb->getName() << "'", 1);
ParticleDataImpl<Vec3> *pdi = dynamic_cast<ParticleDataImpl<Vec3> *>(pdb); ParticleDataImpl<Vec3> *pdi = dynamic_cast<ParticleDataImpl<Vec3> *>(pdb);
exportVDB<Vec3, openvdb::Vec3s>(pdi, to, pointIndexGrid, skipDeletedParts); exportVDB<Vec3, openvdb::Vec3s>(pdi, to, pointIndexGrid, skipDeletedParts, precision);
} }
else { else {
errMsg("exportVDB: unknown ParticleDataBase type"); errMsg("exportVDB: unknown ParticleDataBase type");
@@ -302,8 +335,10 @@ openvdb::points::PointDataGrid::Ptr exportVDB(BasicParticleSystem *from,
static void registerCustomCodecs() static void registerCustomCodecs()
{ {
using Codec = openvdb::points::FixedPointCodec</*1-byte=*/false, openvdb::points::UnitRange>; openvdb::points::TypedAttributeArray<int, openvdb::points::TruncateCodec>::registerType();
openvdb::points::TypedAttributeArray<int, Codec>::registerType(); openvdb::points::TypedAttributeArray<float, openvdb::points::TruncateCodec>::registerType();
openvdb::points::TypedAttributeArray<openvdb::Vec3s,
openvdb::points::TruncateCodec>::registerType();
} }
int writeObjectsVDB(const string &filename, int writeObjectsVDB(const string &filename,
@@ -311,15 +346,14 @@ int writeObjectsVDB(const string &filename,
float worldSize, float worldSize,
bool skipDeletedParts, bool skipDeletedParts,
int compression, int compression,
bool precisionHalf) int precision)
{ {
openvdb::initialize(); openvdb::initialize();
openvdb::io::File file(filename); openvdb::io::File file(filename);
openvdb::GridPtrVec gridsVDB; openvdb::GridPtrVec gridsVDB;
// TODO (sebbas): Use custom codec for flag attribute? // Register custom codecs, this makes sure custom attributes can be read
// Register codecs one, this makes sure custom attributes can be read registerCustomCodecs();
// registerCustomCodecs();
std::vector<ParticleDataBase *> pdbBuffer; std::vector<ParticleDataBase *> pdbBuffer;
@@ -365,7 +399,7 @@ int writeObjectsVDB(const string &filename,
debMsg("Writing particle system '" << mantaPP->getName() debMsg("Writing particle system '" << mantaPP->getName()
<< "' (and buffered pData) to vdb file " << filename, << "' (and buffered pData) to vdb file " << filename,
1); 1);
vdbGrid = exportVDB(mantaPP, pdbBuffer, skipDeletedParts, voxelSize); vdbGrid = exportVDB(mantaPP, pdbBuffer, skipDeletedParts, voxelSize, precision);
gridsVDB.push_back(vdbGrid); gridsVDB.push_back(vdbGrid);
pdbBuffer.clear(); pdbBuffer.clear();
} }
@@ -382,7 +416,7 @@ int writeObjectsVDB(const string &filename,
// Set additional grid attributes, e.g. name, grid class, compression level, etc. // Set additional grid attributes, e.g. name, grid class, compression level, etc.
if (vdbGrid) { if (vdbGrid) {
setGridOptions<openvdb::GridBase>(vdbGrid, objectName, gClass, voxelSize, precisionHalf); setGridOptions<openvdb::GridBase>(vdbGrid, objectName, gClass, voxelSize, precision);
} }
} }
@@ -405,6 +439,7 @@ int writeObjectsVDB(const string &filename,
vdb_flags = openvdb::io::COMPRESS_NONE; vdb_flags = openvdb::io::COMPRESS_NONE;
break; break;
} }
default:
case COMPRESSION_ZIP: { case COMPRESSION_ZIP: {
vdb_flags |= openvdb::io::COMPRESS_ZIP; vdb_flags |= openvdb::io::COMPRESS_ZIP;
break; break;
@@ -433,18 +468,18 @@ int readObjectsVDB(const string &filename, std::vector<PbClass *> *objects, floa
openvdb::io::File file(filename); openvdb::io::File file(filename);
openvdb::GridPtrVec gridsVDB; openvdb::GridPtrVec gridsVDB;
// TODO (sebbas): Use custom codec for flag attribute? // Register custom codecs, this makes sure custom attributes can be read
// Register codecs one, this makes sure custom attributes can be read registerCustomCodecs();
// registerCustomCodecs();
try { try {
file.setCopyMaxBytes(0); file.setCopyMaxBytes(0);
file.open(); file.open();
gridsVDB = *(file.getGrids()); gridsVDB = *(file.getGrids());
openvdb::MetaMap::Ptr metadata = file.getMetadata(); openvdb::MetaMap::Ptr metadata = file.getMetadata();
(void)metadata; // Unused for now unusedParameter(metadata); // Unused for now
} }
catch (const openvdb::IoError &e) { catch (const openvdb::IoError &e) {
unusedParameter(e); // Unused for now
debMsg("readObjectsVDB: Could not open vdb file " << filename, 1); debMsg("readObjectsVDB: Could not open vdb file " << filename, 1);
file.close(); file.close();
return 0; return 0;
@@ -492,27 +527,36 @@ int readObjectsVDB(const string &filename, std::vector<PbClass *> *objects, floa
if (GridBase *mantaGrid = dynamic_cast<GridBase *>(*iter)) { if (GridBase *mantaGrid = dynamic_cast<GridBase *>(*iter)) {
if (mantaGrid->getType() & GridBase::TypeInt) { if (mantaGrid->getType() & GridBase::TypeInt) {
openvdb::Int32Grid::Ptr vdbIntGrid = openvdb::gridPtrCast<openvdb::Int32Grid>(vdbGrid);
if (!vdbIntGrid)
continue; // Sanity check: Cast can fail if onlyGrid is true but object count > 1
Grid<int> *mantaIntGrid = (Grid<int> *)mantaGrid;
debMsg("Reading into grid '" << mantaGrid->getName() << "' from int grid '" debMsg("Reading into grid '" << mantaGrid->getName() << "' from int grid '"
<< vdbGrid->getName() << "' in vdb file " << filename, << vdbGrid->getName() << "' in vdb file " << filename,
1); 1);
openvdb::Int32Grid::Ptr vdbIntGrid = openvdb::gridPtrCast<openvdb::Int32Grid>(vdbGrid);
Grid<int> *mantaIntGrid = (Grid<int> *)mantaGrid;
importVDB<openvdb::Int32Grid, int>(vdbIntGrid, mantaIntGrid); importVDB<openvdb::Int32Grid, int>(vdbIntGrid, mantaIntGrid);
} }
else if (mantaGrid->getType() & GridBase::TypeReal) { else if (mantaGrid->getType() & GridBase::TypeReal) {
openvdb::FloatGrid::Ptr vdbFloatGrid = openvdb::gridPtrCast<openvdb::FloatGrid>(vdbGrid);
if (!vdbFloatGrid)
continue; // Sanity check: Cast can fail if onlyGrid is true but object count > 1
Grid<Real> *mantaRealGrid = (Grid<Real> *)mantaGrid;
debMsg("Reading into grid '" << mantaGrid->getName() << "' from real grid '" debMsg("Reading into grid '" << mantaGrid->getName() << "' from real grid '"
<< vdbGrid->getName() << "' in vdb file " << filename, << vdbGrid->getName() << "' in vdb file " << filename,
1); 1);
openvdb::FloatGrid::Ptr vdbFloatGrid = openvdb::gridPtrCast<openvdb::FloatGrid>(vdbGrid);
Grid<Real> *mantaRealGrid = (Grid<Real> *)mantaGrid;
importVDB<openvdb::FloatGrid, Real>(vdbFloatGrid, mantaRealGrid); importVDB<openvdb::FloatGrid, Real>(vdbFloatGrid, mantaRealGrid);
} }
else if (mantaGrid->getType() & GridBase::TypeVec3) { else if (mantaGrid->getType() & GridBase::TypeVec3) {
openvdb::Vec3SGrid::Ptr vdbVec3Grid = openvdb::gridPtrCast<openvdb::Vec3SGrid>(vdbGrid);
if (!vdbVec3Grid)
continue; // Sanity check: Cast can fail if onlyGrid is true but object count > 1
Grid<Vec3> *mantaVec3Grid = (Grid<Vec3> *)mantaGrid;
debMsg("Reading into grid '" << mantaGrid->getName() << "' from vec3 grid '" debMsg("Reading into grid '" << mantaGrid->getName() << "' from vec3 grid '"
<< vdbGrid->getName() << "' in vdb file " << filename, << vdbGrid->getName() << "' in vdb file " << filename,
1); 1);
openvdb::Vec3SGrid::Ptr vdbVec3Grid = openvdb::gridPtrCast<openvdb::Vec3SGrid>(vdbGrid);
Grid<Vec3> *mantaVec3Grid = (Grid<Vec3> *)mantaGrid;
importVDB<openvdb::Vec3SGrid, Vec3>(vdbVec3Grid, mantaVec3Grid); importVDB<openvdb::Vec3SGrid, Vec3>(vdbVec3Grid, mantaVec3Grid);
} }
else { else {
@@ -521,12 +565,15 @@ int readObjectsVDB(const string &filename, std::vector<PbClass *> *objects, floa
} }
} }
else if (BasicParticleSystem *mantaPP = dynamic_cast<BasicParticleSystem *>(*iter)) { else if (BasicParticleSystem *mantaPP = dynamic_cast<BasicParticleSystem *>(*iter)) {
openvdb::points::PointDataGrid::Ptr vdbPointGrid =
openvdb::gridPtrCast<openvdb::points::PointDataGrid>(vdbGrid);
if (!vdbPointGrid)
continue; // Sanity check: Cast can fail if onlyGrid is true but objects > 1
debMsg("Reading into particle system '" << mantaPP->getName() << "' from particle system '" debMsg("Reading into particle system '" << mantaPP->getName() << "' from particle system '"
<< vdbGrid->getName() << "' in vdb file " << vdbGrid->getName() << "' in vdb file "
<< filename, << filename,
1); 1);
openvdb::points::PointDataGrid::Ptr vdbPointGrid =
openvdb::gridPtrCast<openvdb::points::PointDataGrid>(vdbGrid);
importVDB(vdbPointGrid, mantaPP, pdbBuffer, voxelSize); importVDB(vdbPointGrid, mantaPP, pdbBuffer, voxelSize);
pdbBuffer.clear(); pdbBuffer.clear();
} }
@@ -580,19 +627,23 @@ template openvdb::Vec3SGrid::Ptr exportVDB<Vec3, openvdb::Vec3SGrid>(Grid<Vec3>
openvdb::points::PointDataGrid::Ptr exportVDB(BasicParticleSystem *from, openvdb::points::PointDataGrid::Ptr exportVDB(BasicParticleSystem *from,
std::vector<ParticleDataBase *> &fromPData, std::vector<ParticleDataBase *> &fromPData,
bool skipDeletedParts = false, bool skipDeletedParts = false,
float voxelSize = 1.0); float voxelSize = 1.0,
int precision = PRECISION_HALF);
template void exportVDB<int, int>(ParticleDataImpl<int> *from, template void exportVDB<int, int>(ParticleDataImpl<int> *from,
openvdb::points::PointDataGrid::Ptr to, openvdb::points::PointDataGrid::Ptr to,
openvdb::tools::PointIndexGrid::Ptr pIndex, openvdb::tools::PointIndexGrid::Ptr pIndex,
bool skipDeletedParts = false); bool skipDeletedParts = false,
int precision = PRECISION_HALF);
template void exportVDB<Real, float>(ParticleDataImpl<Real> *from, template void exportVDB<Real, float>(ParticleDataImpl<Real> *from,
openvdb::points::PointDataGrid::Ptr to, openvdb::points::PointDataGrid::Ptr to,
openvdb::tools::PointIndexGrid::Ptr pIndex, openvdb::tools::PointIndexGrid::Ptr pIndex,
bool skipDeletedParts = false); bool skipDeletedParts = false,
int precision = PRECISION_HALF);
template void exportVDB<Vec3, openvdb::Vec3s>(ParticleDataImpl<Vec3> *from, template void exportVDB<Vec3, openvdb::Vec3s>(ParticleDataImpl<Vec3> *from,
openvdb::points::PointDataGrid::Ptr to, openvdb::points::PointDataGrid::Ptr to,
openvdb::tools::PointIndexGrid::Ptr pIndex, openvdb::tools::PointIndexGrid::Ptr pIndex,
bool skipDeletedParts = false); bool skipDeletedParts = false,
int precision = PRECISION_HALF);
#else #else
@@ -601,7 +652,7 @@ int writeObjectsVDB(const string &filename,
float worldSize, float worldSize,
bool skipDeletedParts, bool skipDeletedParts,
int compression, int compression,
bool precisionHalf) int precision)
{ {
errMsg("Cannot save to .vdb file. Mantaflow has not been built with OpenVDB support."); errMsg("Cannot save to .vdb file. Mantaflow has not been built with OpenVDB support.");
return 0; return 0;

View File

@@ -82,8 +82,15 @@ int save(const string &name,
float worldSize = 1.0, float worldSize = 1.0,
bool skipDeletedParts = false, bool skipDeletedParts = false,
int compression = COMPRESSION_ZIP, int compression = COMPRESSION_ZIP,
bool precisionHalf = true) bool precisionHalf = true,
int precision = PRECISION_HALF)
{ {
if (!precisionHalf) {
debMsg("Warning: precisionHalf argument is deprecated. Please use precision level instead", 0);
precision = PRECISION_HALF; // for backwards compatibility
}
if (name.find_last_of('.') == string::npos) if (name.find_last_of('.') == string::npos)
errMsg("file '" + name + "' does not have an extension"); errMsg("file '" + name + "' does not have an extension");
string ext = name.substr(name.find_last_of('.')); string ext = name.substr(name.find_last_of('.'));
@@ -95,8 +102,7 @@ int save(const string &name,
else if (ext == ".vol") else if (ext == ".vol")
return writeGridsVol(name, &objects); return writeGridsVol(name, &objects);
if (ext == ".vdb") if (ext == ".vdb")
return writeObjectsVDB( return writeObjectsVDB(name, &objects, worldSize, skipDeletedParts, compression, precision);
name, &objects, worldSize, skipDeletedParts, compression, precisionHalf);
else if (ext == ".npz") else if (ext == ".npz")
return writeGridsNumpy(name, &objects); return writeGridsNumpy(name, &objects);
else if (ext == ".txt") else if (ext == ".txt")
@@ -122,7 +128,9 @@ static PyObject *_W_1(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
bool skipDeletedParts = _args.getOpt<bool>("skipDeletedParts", 3, false, &_lock); bool skipDeletedParts = _args.getOpt<bool>("skipDeletedParts", 3, false, &_lock);
int compression = _args.getOpt<int>("compression", 4, COMPRESSION_ZIP, &_lock); int compression = _args.getOpt<int>("compression", 4, COMPRESSION_ZIP, &_lock);
bool precisionHalf = _args.getOpt<bool>("precisionHalf", 5, true, &_lock); bool precisionHalf = _args.getOpt<bool>("precisionHalf", 5, true, &_lock);
_retval = toPy(save(name, objects, worldSize, skipDeletedParts, compression, precisionHalf)); int precision = _args.getOpt<int>("precision", 6, PRECISION_HALF, &_lock);
_retval = toPy(
save(name, objects, worldSize, skipDeletedParts, compression, precisionHalf, precision));
_args.check(); _args.check();
} }
pbFinalizePlugin(parent, "save", !noTiming); pbFinalizePlugin(parent, "save", !noTiming);

View File

@@ -28,6 +28,11 @@
#define COMPRESSION_ZIP 1 #define COMPRESSION_ZIP 1
#define COMPRESSION_BLOSC 2 #define COMPRESSION_BLOSC 2
// OpenVDB precision flags
#define PRECISION_FULL 0
#define PRECISION_HALF 1
#define PRECISION_MINI 2
namespace Manta { namespace Manta {
// Forward declations // Forward declations
@@ -70,7 +75,7 @@ int writeObjectsVDB(const std::string &filename,
float scale = 1.0, float scale = 1.0,
bool skipDeletedParts = false, bool skipDeletedParts = false,
int compression = COMPRESSION_ZIP, int compression = COMPRESSION_ZIP,
bool precisionHalf = true); int precision = PRECISION_HALF);
int readObjectsVDB(const std::string &filename, int readObjectsVDB(const std::string &filename,
std::vector<PbClass *> *objects, std::vector<PbClass *> *objects,
float scale = 1.0); float scale = 1.0);

View File

@@ -1,3 +1,3 @@
#define MANTA_GIT_VERSION "commit e2f6e59e3679f88e5100ae2145410cca4971b9df" #define MANTA_GIT_VERSION "commit dffc3481b835dfa048effcbb8a9e613294ecae14"

View File

@@ -355,7 +355,6 @@ class GridBase : public PbClass {
return isInBounds(Vec3i(i, j, k), bnd); return isInBounds(Vec3i(i, j, k), bnd);
} }
#ifdef BLENDER
//! expose name field to Python for Blender //! expose name field to Python for Blender
void setName(const std::string &name) void setName(const std::string &name)
{ {
@@ -386,7 +385,6 @@ class GridBase : public PbClass {
} }
} }
#endif
protected: protected:
GridType mType; GridType mType;
Vec3i mSize; Vec3i mSize;

View File

@@ -639,8 +639,207 @@ void LevelsetGrid::initFromFlags(const FlagGrid &flags, bool ignoreWalls)
} }
} }
/* Helper variables that are used in flood-fill functions. */
static const int ID_UNKNOWN = 0;
static const int ID_VISITED = 1;
/* Fills all cells in the target grid that have not been marked during a flood-fill. */
struct KnFillApply : public KernelBase {
KnFillApply(Grid<Real> &target,
Grid<int> &visited,
const Real value,
const int boundaryWidth,
const bool outside)
: KernelBase(&target, boundaryWidth),
target(target),
visited(visited),
value(value),
boundaryWidth(boundaryWidth),
outside(outside)
{
runMessage();
run();
}
inline void op(int i,
int j,
int k,
Grid<Real> &target,
Grid<int> &visited,
const Real value,
const int boundaryWidth,
const bool outside) const
{
if (visited(i, j, k) == ID_VISITED)
return;
if (outside && target(i, j, k) < 0)
return;
if (!outside && target(i, j, k) >= 0)
return;
/* Actual flood-fill override. */
target(i, j, k) = value;
}
inline Grid<Real> &getArg0()
{
return target;
}
typedef Grid<Real> type0;
inline Grid<int> &getArg1()
{
return visited;
}
typedef Grid<int> type1;
inline const Real &getArg2()
{
return value;
}
typedef Real type2;
inline const int &getArg3()
{
return boundaryWidth;
}
typedef int type3;
inline const bool &getArg4()
{
return outside;
}
typedef bool type4;
void runMessage()
{
debMsg("Executing kernel KnFillApply ", 3);
debMsg("Kernel range"
<< " x " << maxX << " y " << maxY << " z " << minZ << " - " << maxZ << " ",
4);
};
void operator()(const tbb::blocked_range<IndexInt> &__r) const
{
const int _maxX = maxX;
const int _maxY = maxY;
if (maxZ > 1) {
for (int k = __r.begin(); k != (int)__r.end(); k++)
for (int j = boundaryWidth; j < _maxY; j++)
for (int i = boundaryWidth; i < _maxX; i++)
op(i, j, k, target, visited, value, boundaryWidth, outside);
}
else {
const int k = 0;
for (int j = __r.begin(); j != (int)__r.end(); j++)
for (int i = boundaryWidth; i < _maxX; i++)
op(i, j, k, target, visited, value, boundaryWidth, outside);
}
}
void run()
{
if (maxZ > 1)
tbb::parallel_for(tbb::blocked_range<IndexInt>(minZ, maxZ), *this);
else
tbb::parallel_for(tbb::blocked_range<IndexInt>(boundaryWidth, maxY), *this);
}
Grid<Real> &target;
Grid<int> &visited;
const Real value;
const int boundaryWidth;
const bool outside;
};
/* Basic flood fill implementation used to fill inside / outside areas of levelset.
* Calling this function will ensure that there are no fluid cells inside obstacles.
* I.e. starting from walls, cells will be tagged in flood-fill fashion, stopping at 0 borders.
* All remaining cells will be filled with the fill value. Outside mode inverts search behavior. */
void LevelsetGrid::floodFill(const Real value, const bool outside, const int boundaryWidth)
{
/* Sanity check: Filling mode and filling value need to "match". */
if (outside) {
assertMsg(value < 0, "Cannot fill outside with (positive) value " << value);
}
else {
assertMsg(value >= 0, "Cannot fill inside with (negative) value " << value);
}
Grid<Real> levelsetCopy(this->getParent());
Grid<int> visited(this->getParent());
std::stack<Vec3i> todoPos;
const int maxNeighbors = this->is3D() ? 6 : 4;
const Vec3i maxSize(this->getSize() - 1);
Vec3i bnd(2 * boundaryWidth);
if (!this->is3D())
bnd.z = 0;
const int cellCntNoBnd = (this->getSizeX() - bnd.x) * (this->getSizeY() - bnd.y) *
(this->getSizeZ() - bnd.z);
/* Initialize temporary helper grids. */
levelsetCopy.copyFrom(*this);
visited.setConst(ID_UNKNOWN);
FOR_IJK_BND(visited, boundaryWidth)
{
/* Skip inside / outside cells depending on search mode. */
if (outside && levelsetCopy(i, j, k) < 0)
continue;
if (!outside && levelsetCopy(i, j, k) >= 0)
continue;
/* Skip cell if it already has been visited. */
if (visited(i, j, k) == ID_VISITED)
continue;
Vec3i c(i, j, k);
bool isWallCell = (c.x - boundaryWidth == 0 || c.x == maxSize.x - boundaryWidth);
isWallCell |= (c.y - boundaryWidth == 0 || c.y == maxSize.y - boundaryWidth);
if (this->is3D())
isWallCell |= (c.z - boundaryWidth == 0 || c.z == maxSize.z - boundaryWidth);
/* Only start searching from borders. */
if (!isWallCell)
continue;
/* Start flood-fill loop by initializing todo stack with current cell. */
todoPos.push(c);
visited(c) = ID_VISITED;
while (!todoPos.empty()) {
c = todoPos.top();
todoPos.pop();
/* Add all neighbor cells to search stack. */
for (int nb = 0; nb < maxNeighbors; nb++) {
const Vec3i neigh(c + neighbors[nb]);
if (!visited.isInBounds(neigh, boundaryWidth))
continue;
/* Skip inside / outside area depening on what we search for. */
if (outside && levelsetCopy(neigh) < 0)
continue;
if (!outside && levelsetCopy(neigh) >= 0)
continue;
/* Skip neighbor if it already has been visited. */
if (visited(neigh) == ID_VISITED)
continue;
assertMsg(visited(neigh) == ID_UNKNOWN,
"Cell must be of type 'unknown' at this point in the loop");
todoPos.push(neigh);
visited(neigh) = ID_VISITED;
}
assertMsg(todoPos.size() <= cellCntNoBnd,
"Flood-fill todo stack cannot be greater than domain cell count - "
<< todoPos.size() << " vs " << cellCntNoBnd);
}
}
KnFillApply(*this, visited, value, boundaryWidth, outside);
}
/* Deprecated: Use floodFill() function instead. */
void LevelsetGrid::fillHoles(int maxDepth, int boundaryWidth) void LevelsetGrid::fillHoles(int maxDepth, int boundaryWidth)
{ {
debMsg("Deprecated - do not use fillHoles() ... use floodFill() instead", 1);
Real curVal, i1, i2, j1, j2, k1, k2; Real curVal, i1, i2, j1, j2, k1, k2;
Vec3i c, cTmp; Vec3i c, cTmp;
std::stack<Vec3i> undoPos; std::stack<Vec3i> undoPos;

View File

@@ -234,6 +234,35 @@ class LevelsetGrid : public Grid<Real> {
} }
} }
//! flood-fill the levelset to ensure that closed obstacles are filled inside
void floodFill(const Real value = -0.5, const bool outside = true, const int boundaryWidth = 1);
static PyObject *_W_7(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
try {
PbArgs _args(_linargs, _kwds);
LevelsetGrid *pbo = dynamic_cast<LevelsetGrid *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "LevelsetGrid::floodFill", !noTiming);
PyObject *_retval = 0;
{
ArgLocker _lock;
const Real value = _args.getOpt<Real>("value", 0, -0.5, &_lock);
const bool outside = _args.getOpt<bool>("outside", 1, true, &_lock);
const int boundaryWidth = _args.getOpt<int>("boundaryWidth", 2, 1, &_lock);
pbo->_args.copy(_args);
_retval = getPyNone();
pbo->floodFill(value, outside, boundaryWidth);
pbo->_args.check();
}
pbFinalizePlugin(pbo->getParent(), "LevelsetGrid::floodFill", !noTiming);
return _retval;
}
catch (std::exception &e) {
pbSetError("LevelsetGrid::floodFill", e.what());
return 0;
}
}
static Real invalidTimeValue(); static Real invalidTimeValue();
public: public:
PbArgs _args; PbArgs _args;

View File

@@ -15,6 +15,7 @@ static const Pb::Register _R_15("LevelsetGrid", "join", LevelsetGrid::_W_3);
static const Pb::Register _R_16("LevelsetGrid", "subtract", LevelsetGrid::_W_4); static const Pb::Register _R_16("LevelsetGrid", "subtract", LevelsetGrid::_W_4);
static const Pb::Register _R_17("LevelsetGrid", "initFromFlags", LevelsetGrid::_W_5); static const Pb::Register _R_17("LevelsetGrid", "initFromFlags", LevelsetGrid::_W_5);
static const Pb::Register _R_18("LevelsetGrid", "fillHoles", LevelsetGrid::_W_6); static const Pb::Register _R_18("LevelsetGrid", "fillHoles", LevelsetGrid::_W_6);
static const Pb::Register _R_19("LevelsetGrid", "floodFill", LevelsetGrid::_W_7);
#endif #endif
extern "C" { extern "C" {
void PbRegister_file_11() void PbRegister_file_11()
@@ -27,6 +28,7 @@ void PbRegister_file_11()
KEEP_UNUSED(_R_16); KEEP_UNUSED(_R_16);
KEEP_UNUSED(_R_17); KEEP_UNUSED(_R_17);
KEEP_UNUSED(_R_18); KEEP_UNUSED(_R_18);
KEEP_UNUSED(_R_19);
} }
} }
} // namespace Manta } // namespace Manta

View File

@@ -16,7 +16,8 @@ static const Pb::Register _reg(
"integration mode\nIntEuler = 0\nIntRK2 = 1\nIntRK4 = 2\n\n# CG preconditioner\nPcNone " "integration mode\nIntEuler = 0\nIntRK2 = 1\nIntRK4 = 2\n\n# CG preconditioner\nPcNone "
" = 0\nPcMIC = 1\nPcMGDynamic = 2\nPcMGStatic = 3\n\n# particles\nPtypeSpray = " " = 0\nPcMIC = 1\nPcMGDynamic = 2\nPcMGStatic = 3\n\n# particles\nPtypeSpray = "
"2\nPtypeBubble = 4\nPtypeFoam = 8\nPtypeTracer = 16\n\n# OpenVDB export " "2\nPtypeBubble = 4\nPtypeFoam = 8\nPtypeTracer = 16\n\n# OpenVDB export "
"flags\nCompression_None = 0\nCompression_Zip = 1\nCompression_Blosc = 2\n\n\n\n\n"); "flags\nCompression_None = 0\nCompression_Zip = 1\nCompression_Blosc = 2\n\n# OpenVDB "
"precision flags\nPrecision_Full = 0\nPrecision_Half = 1\nPrecision_Mini = 2\n\n\n\n");
extern "C" { extern "C" {
void PbRegister_file_0() void PbRegister_file_0()
{ {

View File

@@ -57,7 +57,7 @@
#if defined(__arm__) #if defined(__arm__)
/* Attempt to fix compilation error on Debian armel kernel. /* Attempt to fix compilation error on Debian armel kernel.
* arm7 architecture does have both 32 and 64bit atomics, however * arm7 architecture does have both 32 and 64bit atomics, however
* it's gcc doesn't have __GCC_HAVE_SYNC_COMPARE_AND_SWAP_n defined. * its gcc doesn't have __GCC_HAVE_SYNC_COMPARE_AND_SWAP_n defined.
*/ */
# define JE_FORCE_SYNC_COMPARE_AND_SWAP_1 # define JE_FORCE_SYNC_COMPARE_AND_SWAP_1
# define JE_FORCE_SYNC_COMPARE_AND_SWAP_4 # define JE_FORCE_SYNC_COMPARE_AND_SWAP_4

View File

@@ -270,6 +270,14 @@ if(WITH_CYCLES_EMBREE)
) )
endif() endif()
if(WITH_NANOVDB)
add_definitions(-DWITH_NANOVDB)
include_directories(
SYSTEM
${NANOVDB_INCLUDE_DIR}
)
endif()
if(WITH_OPENSUBDIV) if(WITH_OPENSUBDIV)
add_definitions(-DWITH_OPENSUBDIV) add_definitions(-DWITH_OPENSUBDIV)
include_directories( include_directories(
@@ -344,7 +352,7 @@ if(WITH_CYCLES_CUDA_BINARIES AND (NOT WITH_CYCLES_CUBIN_COMPILER))
set(MAX_MSVC 1910) set(MAX_MSVC 1910)
elseif(${CUDA_VERSION} EQUAL "9.1") elseif(${CUDA_VERSION} EQUAL "9.1")
set(MAX_MSVC 1911) set(MAX_MSVC 1911)
elseif(${CUDA_VERSION} LESS "11.0") elseif(${CUDA_VERSION} VERSION_GREATER_EQUAL 10.0)
set(MAX_MSVC 1999) set(MAX_MSVC 1999)
endif() endif()
if(NOT MSVC_VERSION LESS ${MAX_MSVC} OR CMAKE_C_COMPILER_ID MATCHES "Clang") if(NOT MSVC_VERSION LESS ${MAX_MSVC} OR CMAKE_C_COMPILER_ID MATCHES "Clang")

View File

@@ -70,6 +70,11 @@ def _configure_argument_parser():
parser.add_argument("--cycles-print-stats", parser.add_argument("--cycles-print-stats",
help="Print rendering statistics to stderr", help="Print rendering statistics to stderr",
action='store_true') action='store_true')
parser.add_argument("--cycles-device",
help="Set the device to use for Cycles, overriding user preferences and the scene setting."
"Valid options are 'CPU', 'CUDA', 'OPTIX' or 'OPENCL'."
"Additionally, you can append '+CPU' to any GPU type for hybrid rendering.",
default=None)
return parser return parser
@@ -102,6 +107,10 @@ def _parse_command_line():
import _cycles import _cycles
_cycles.enable_print_stats() _cycles.enable_print_stats()
if args.cycles_device:
import _cycles
_cycles.set_device_override(args.cycles_device)
def init(): def init():
import bpy import bpy
@@ -150,8 +159,7 @@ def create(engine, data, region=None, v3d=None, rv3d=None, preview_osl=False):
screen = screen or rv3d.id_data.as_pointer() screen = screen or rv3d.id_data.as_pointer()
rv3d = rv3d.as_pointer() rv3d = rv3d.as_pointer()
engine.session = _cycles.create( engine.session = _cycles.create(engine.as_pointer(), prefs, data, screen, region, v3d, rv3d, preview_osl)
engine.as_pointer(), prefs, data, screen, region, v3d, rv3d, preview_osl)
def free(engine): def free(engine):
@@ -224,6 +232,7 @@ def system_info():
import _cycles import _cycles
return _cycles.system_info() return _cycles.system_info()
def list_render_passes(scene, srl): def list_render_passes(scene, srl):
# Builtin Blender passes. # Builtin Blender passes.
yield ("Combined", "RGBA", 'COLOR') yield ("Combined", "RGBA", 'COLOR')
@@ -298,6 +307,7 @@ def list_render_passes(scene, srl):
else: else:
yield (aov.name, "RGBA", 'COLOR') yield (aov.name, "RGBA", 'COLOR')
def register_passes(engine, scene, view_layer): def register_passes(engine, scene, view_layer):
# Detect duplicate render pass names, first one wins. # Detect duplicate render pass names, first one wins.
listed = set() listed = set()
@@ -306,6 +316,7 @@ def register_passes(engine, scene, view_layer):
engine.register_pass(scene, view_layer, name, len(channelids), channelids, channeltype) engine.register_pass(scene, view_layer, name, len(channelids), channelids, channeltype)
listed.add(name) listed.add(name)
def detect_conflicting_passes(scene, view_layer): def detect_conflicting_passes(scene, view_layer):
# Detect conflicting render pass names for UI. # Detect conflicting render pass names for UI.
counter = {} counter = {}

View File

@@ -46,8 +46,8 @@ class CYCLES_OT_use_shading_nodes(Operator):
class CYCLES_OT_add_aov(bpy.types.Operator): class CYCLES_OT_add_aov(bpy.types.Operator):
"""Add an AOV pass""" """Add an AOV pass"""
bl_idname="cycles.add_aov" bl_idname = "cycles.add_aov"
bl_label="Add AOV" bl_label = "Add AOV"
def execute(self, context): def execute(self, context):
view_layer = context.view_layer view_layer = context.view_layer
@@ -61,8 +61,8 @@ class CYCLES_OT_add_aov(bpy.types.Operator):
class CYCLES_OT_remove_aov(bpy.types.Operator): class CYCLES_OT_remove_aov(bpy.types.Operator):
"""Remove an AOV pass""" """Remove an AOV pass"""
bl_idname="cycles.remove_aov" bl_idname = "cycles.remove_aov"
bl_label="Remove AOV" bl_label = "Remove AOV"
def execute(self, context): def execute(self, context):
view_layer = context.view_layer view_layer = context.view_layer
@@ -203,6 +203,7 @@ classes = (
CYCLES_OT_merge_images CYCLES_OT_merge_images
) )
def register(): def register():
from bpy.utils import register_class from bpy.utils import register_class
for cls in classes: for cls in classes:

View File

@@ -31,7 +31,6 @@ from math import pi
# enums # enums
import _cycles
from . import engine from . import engine
enum_devices = ( enum_devices = (
@@ -39,8 +38,10 @@ enum_devices = (
('GPU', "GPU Compute", "Use GPU compute device for rendering, configured in the system tab in the user preferences"), ('GPU', "GPU Compute", "Use GPU compute device for rendering, configured in the system tab in the user preferences"),
) )
if _cycles.with_network: from _cycles import with_network
if with_network:
enum_devices += (('NETWORK', "Networked Device", "Use networked device for rendering"),) enum_devices += (('NETWORK', "Networked Device", "Use networked device for rendering"),)
del with_network
enum_feature_set = ( enum_feature_set = (
('SUPPORTED', "Supported", "Only use finished and supported features"), ('SUPPORTED', "Supported", "Only use finished and supported features"),
@@ -143,7 +144,7 @@ enum_texture_limit = (
('8192', "8192", "Limit texture size to 8192 pixels", 7), ('8192', "8192", "Limit texture size to 8192 pixels", 7),
) )
enum_view3d_shading_render_pass= ( enum_view3d_shading_render_pass = (
('', "General", ""), ('', "General", ""),
('COMBINED', "Combined", "Show the Combined Render pass", 1), ('COMBINED', "Combined", "Show the Combined Render pass", 1),
@@ -184,15 +185,18 @@ enum_aov_types = (
def enum_openimagedenoise_denoiser(self, context): def enum_openimagedenoise_denoiser(self, context):
import _cycles
if _cycles.with_openimagedenoise: if _cycles.with_openimagedenoise:
return [('OPENIMAGEDENOISE', "OpenImageDenoise", "Use Intel OpenImageDenoise AI denoiser running on the CPU", 4)] return [('OPENIMAGEDENOISE', "OpenImageDenoise", "Use Intel OpenImageDenoise AI denoiser running on the CPU", 4)]
return [] return []
def enum_optix_denoiser(self, context): def enum_optix_denoiser(self, context):
if not context or bool(context.preferences.addons[__package__].preferences.get_devices_for_type('OPTIX')): if not context or bool(context.preferences.addons[__package__].preferences.get_devices_for_type('OPTIX')):
return [('OPTIX', "OptiX", "Use the OptiX AI denoiser with GPU acceleration, only available on NVIDIA GPUs", 2)] return [('OPTIX', "OptiX", "Use the OptiX AI denoiser with GPU acceleration, only available on NVIDIA GPUs", 2)]
return [] return []
def enum_preview_denoiser(self, context): def enum_preview_denoiser(self, context):
optix_items = enum_optix_denoiser(self, context) optix_items = enum_optix_denoiser(self, context)
oidn_items = enum_openimagedenoise_denoiser(self, context) oidn_items = enum_openimagedenoise_denoiser(self, context)
@@ -206,12 +210,14 @@ def enum_preview_denoiser(self, context):
items += oidn_items items += oidn_items
return items return items
def enum_denoiser(self, context): def enum_denoiser(self, context):
items = [('NLM', "NLM", "Cycles native non-local means denoiser, running on any compute device", 1)] items = [('NLM', "NLM", "Cycles native non-local means denoiser, running on any compute device", 1)]
items += enum_optix_denoiser(self, context) items += enum_optix_denoiser(self, context)
items += enum_openimagedenoise_denoiser(self, context) items += enum_openimagedenoise_denoiser(self, context)
return items return items
enum_denoising_input_passes = ( enum_denoising_input_passes = (
('RGB', "Color", "Use only color as input", 1), ('RGB', "Color", "Use only color as input", 1),
('RGB_ALBEDO', "Color + Albedo", "Use color and albedo data as input", 2), ('RGB_ALBEDO', "Color + Albedo", "Use color and albedo data as input", 2),
@@ -413,18 +419,18 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
) )
min_light_bounces: IntProperty( min_light_bounces: IntProperty(
name="Min Light Bounces", name="Min Light Bounces",
description="Minimum number of light bounces. Setting this higher reduces noise in the first bounces, " description="Minimum number of light bounces. Setting this higher reduces noise in the first bounces, "
"but can also be less efficient for more complex geometry like hair and volumes", "but can also be less efficient for more complex geometry like hair and volumes",
min=0, max=1024, min=0, max=1024,
default=0, default=0,
) )
min_transparent_bounces: IntProperty( min_transparent_bounces: IntProperty(
name="Min Transparent Bounces", name="Min Transparent Bounces",
description="Minimum number of transparent bounces. Setting this higher reduces noise in the first bounces, " description="Minimum number of transparent bounces. Setting this higher reduces noise in the first bounces, "
"but can also be less efficient for more complex geometry like hair and volumes", "but can also be less efficient for more complex geometry like hair and volumes",
min=0, max=1024, min=0, max=1024,
default=0, default=0,
) )
caustics_reflective: BoolProperty( caustics_reflective: BoolProperty(
@@ -1325,6 +1331,7 @@ class CyclesAOVPass(bpy.types.PropertyGroup):
default="" default=""
) )
class CyclesRenderLayerSettings(bpy.types.PropertyGroup): class CyclesRenderLayerSettings(bpy.types.PropertyGroup):
pass_debug_bvh_traversed_nodes: BoolProperty( pass_debug_bvh_traversed_nodes: BoolProperty(
@@ -1468,31 +1475,31 @@ class CyclesRenderLayerSettings(bpy.types.PropertyGroup):
description="Render cryptomatte object pass, for isolating objects in compositing", description="Render cryptomatte object pass, for isolating objects in compositing",
default=False, default=False,
update=update_render_passes, update=update_render_passes,
) )
use_pass_crypto_material: BoolProperty( use_pass_crypto_material: BoolProperty(
name="Cryptomatte Material", name="Cryptomatte Material",
description="Render cryptomatte material pass, for isolating materials in compositing", description="Render cryptomatte material pass, for isolating materials in compositing",
default=False, default=False,
update=update_render_passes, update=update_render_passes,
) )
use_pass_crypto_asset: BoolProperty( use_pass_crypto_asset: BoolProperty(
name="Cryptomatte Asset", name="Cryptomatte Asset",
description="Render cryptomatte asset pass, for isolating groups of objects with the same parent", description="Render cryptomatte asset pass, for isolating groups of objects with the same parent",
default=False, default=False,
update=update_render_passes, update=update_render_passes,
) )
pass_crypto_depth: IntProperty( pass_crypto_depth: IntProperty(
name="Cryptomatte Levels", name="Cryptomatte Levels",
description="Sets how many unique objects can be distinguished per pixel", description="Sets how many unique objects can be distinguished per pixel",
default=6, min=2, max=16, step=2, default=6, min=2, max=16, step=2,
update=update_render_passes, update=update_render_passes,
) )
pass_crypto_accurate: BoolProperty( pass_crypto_accurate: BoolProperty(
name="Cryptomatte Accurate", name="Cryptomatte Accurate",
description="Generate a more accurate Cryptomatte pass. CPU only, may render slower and use more memory", description="Generate a more accurate Cryptomatte pass. CPU only, may render slower and use more memory",
default=True, default=True,
update=update_render_passes, update=update_render_passes,
) )
aovs: CollectionProperty( aovs: CollectionProperty(
type=CyclesAOVPass, type=CyclesAOVPass,
@@ -1594,15 +1601,20 @@ class CyclesPreferences(bpy.types.AddonPreferences):
elif entry.type == 'CPU': elif entry.type == 'CPU':
cpu_devices.append(entry) cpu_devices.append(entry)
# Extend all GPU devices with CPU. # Extend all GPU devices with CPU.
if compute_device_type in ('CUDA', 'OPENCL'): if compute_device_type in {'CUDA', 'OPENCL'}:
devices.extend(cpu_devices) devices.extend(cpu_devices)
return devices return devices
# For backwards compatibility, only returns CUDA and OpenCL but still # For backwards compatibility, only returns CUDA and OpenCL but still
# refreshes all devices. # refreshes all devices.
def get_devices(self, compute_device_type=''): def get_devices(self, compute_device_type=''):
import _cycles
# Ensure `self.devices` is not re-allocated when the second call to
# get_devices_for_type is made, freeing items from the first list.
for device_type in ('CUDA', 'OPTIX', 'OPENCL'):
self.update_device_entries(_cycles.available_devices(device_type))
cuda_devices = self.get_devices_for_type('CUDA') cuda_devices = self.get_devices_for_type('CUDA')
self.get_devices_for_type('OPTIX')
opencl_devices = self.get_devices_for_type('OPENCL') opencl_devices = self.get_devices_for_type('OPENCL')
return cuda_devices, opencl_devices return cuda_devices, opencl_devices
@@ -1644,7 +1656,6 @@ class CyclesPreferences(bpy.types.AddonPreferences):
col.label(text="OptiX support is experimental", icon='INFO') col.label(text="OptiX support is experimental", icon='INFO')
col.label(text="Not all Cycles features are supported yet", icon='BLANK1') col.label(text="Not all Cycles features are supported yet", icon='BLANK1')
def draw_impl(self, layout, context): def draw_impl(self, layout, context):
row = layout.row() row = layout.row()
row.prop(self, "compute_device_type", expand=True) row.prop(self, "compute_device_type", expand=True)

View File

@@ -711,9 +711,9 @@ class CYCLES_RENDER_PT_performance_acceleration_structure(CyclesButtonsPanel, Pa
if use_cpu(context): if use_cpu(context):
use_embree = _cycles.with_embree use_embree = _cycles.with_embree
if not use_embree: if not use_embree:
sub = col.column(align=True) sub = col.column(align=True)
sub.label(text="Cycles built without Embree support") sub.label(text="Cycles built without Embree support")
sub.label(text="CPU raytracing performance will be poor") sub.label(text="CPU raytracing performance will be poor")
col.prop(cscene, "debug_use_spatial_splits") col.prop(cscene, "debug_use_spatial_splits")
sub = col.column() sub = col.column()
@@ -843,8 +843,6 @@ class CYCLES_RENDER_PT_passes_data(CyclesButtonsPanel, Panel):
col.prop(cycles_view_layer, "pass_debug_render_time", text="Render Time") col.prop(cycles_view_layer, "pass_debug_render_time", text="Render Time")
col.prop(cycles_view_layer, "pass_debug_sample_count", text="Sample Count") col.prop(cycles_view_layer, "pass_debug_sample_count", text="Sample Count")
layout.prop(view_layer, "pass_alpha_threshold") layout.prop(view_layer, "pass_alpha_threshold")
@@ -959,7 +957,15 @@ class CYCLES_RENDER_PT_passes_aov(CyclesButtonsPanel, Panel):
row = layout.row() row = layout.row()
col = row.column() col = row.column()
col.template_list("CYCLES_RENDER_UL_aov", "aovs", cycles_view_layer, "aovs", cycles_view_layer, "active_aov", rows=2) col.template_list(
"CYCLES_RENDER_UL_aov",
"aovs",
cycles_view_layer,
"aovs",
cycles_view_layer,
"active_aov",
rows=2,
)
col = row.column() col = row.column()
sub = col.column(align=True) sub = col.column(align=True)
@@ -967,9 +973,9 @@ class CYCLES_RENDER_PT_passes_aov(CyclesButtonsPanel, Panel):
sub.operator("cycles.remove_aov", icon='REMOVE', text="") sub.operator("cycles.remove_aov", icon='REMOVE', text="")
if cycles_view_layer.active_aov < len(cycles_view_layer.aovs): if cycles_view_layer.active_aov < len(cycles_view_layer.aovs):
active_aov = cycles_view_layer.aovs[cycles_view_layer.active_aov] active_aov = cycles_view_layer.aovs[cycles_view_layer.active_aov]
if active_aov.conflict: if active_aov.conflict:
layout.label(text=active_aov.conflict, icon='ERROR') layout.label(text=active_aov.conflict, icon='ERROR')
class CYCLES_RENDER_PT_denoising(CyclesButtonsPanel, Panel): class CYCLES_RENDER_PT_denoising(CyclesButtonsPanel, Panel):
@@ -1222,7 +1228,7 @@ class CYCLES_OBJECT_PT_motion_blur(CyclesButtonsPanel, Panel):
def has_geometry_visibility(ob): def has_geometry_visibility(ob):
return ob and ((ob.type in {'MESH', 'CURVE', 'SURFACE', 'FONT', 'META', 'LIGHT'}) or return ob and ((ob.type in {'MESH', 'CURVE', 'SURFACE', 'FONT', 'META', 'LIGHT'}) or
(ob.instance_type == 'COLLECTION' and ob.instance_collection)) (ob.instance_type == 'COLLECTION' and ob.instance_collection))
class CYCLES_OBJECT_PT_shading(CyclesButtonsPanel, Panel): class CYCLES_OBJECT_PT_shading(CyclesButtonsPanel, Panel):
@@ -1232,7 +1238,7 @@ class CYCLES_OBJECT_PT_shading(CyclesButtonsPanel, Panel):
@classmethod @classmethod
def poll(cls, context): def poll(cls, context):
return CyclesButtonsPanel.poll(context) and (context.object) return CyclesButtonsPanel.poll(context) and (context.object)
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
@@ -1255,7 +1261,7 @@ class CYCLES_OBJECT_PT_visibility(CyclesButtonsPanel, Panel):
@classmethod @classmethod
def poll(cls, context): def poll(cls, context):
return CyclesButtonsPanel.poll(context) and (context.object) return CyclesButtonsPanel.poll(context) and (context.object)
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
@@ -1865,6 +1871,7 @@ class CYCLES_RENDER_PT_bake_influence(CyclesButtonsPanel, Panel):
bl_context = "render" bl_context = "render"
bl_parent_id = "CYCLES_RENDER_PT_bake" bl_parent_id = "CYCLES_RENDER_PT_bake"
COMPAT_ENGINES = {'CYCLES'} COMPAT_ENGINES = {'CYCLES'}
@classmethod @classmethod
def poll(cls, context): def poll(cls, context):
scene = context.scene scene = context.scene
@@ -2082,6 +2089,7 @@ class CYCLES_RENDER_PT_simplify_viewport(CyclesButtonsPanel, Panel):
col.prop(rd, "simplify_child_particles", text="Child Particles") col.prop(rd, "simplify_child_particles", text="Child Particles")
col.prop(cscene, "texture_limit", text="Texture Limit") col.prop(cscene, "texture_limit", text="Texture Limit")
col.prop(cscene, "ao_bounces", text="AO Bounces") col.prop(cscene, "ao_bounces", text="AO Bounces")
col.prop(rd, "simplify_volumes", text="Volume Resolution")
class CYCLES_RENDER_PT_simplify_render(CyclesButtonsPanel, Panel): class CYCLES_RENDER_PT_simplify_render(CyclesButtonsPanel, Panel):
@@ -2149,8 +2157,10 @@ class CYCLES_VIEW3D_PT_shading_render_pass(Panel):
@classmethod @classmethod
def poll(cls, context): def poll(cls, context):
return (context.engine in cls.COMPAT_ENGINES return (
and context.space_data.shading.type == 'RENDERED') context.engine in cls.COMPAT_ENGINES and
context.space_data.shading.type == 'RENDERED'
)
def draw(self, context): def draw(self, context):
shading = context.space_data.shading shading = context.space_data.shading
@@ -2168,8 +2178,10 @@ class CYCLES_VIEW3D_PT_shading_lighting(Panel):
@classmethod @classmethod
def poll(cls, context): def poll(cls, context):
return (context.engine in cls.COMPAT_ENGINES return (
and context.space_data.shading.type == 'RENDERED') context.engine in cls.COMPAT_ENGINES and
context.space_data.shading.type == 'RENDERED'
)
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
@@ -2198,12 +2210,14 @@ class CYCLES_VIEW3D_PT_shading_lighting(Panel):
col.prop(shading, "studiolight_intensity") col.prop(shading, "studiolight_intensity")
col.prop(shading, "studiolight_background_alpha") col.prop(shading, "studiolight_background_alpha")
class CYCLES_VIEW3D_PT_simplify_greasepencil(CyclesButtonsPanel, Panel, GreasePencilSimplifyPanel): class CYCLES_VIEW3D_PT_simplify_greasepencil(CyclesButtonsPanel, Panel, GreasePencilSimplifyPanel):
bl_label = "Grease Pencil" bl_label = "Grease Pencil"
bl_parent_id = "CYCLES_RENDER_PT_simplify" bl_parent_id = "CYCLES_RENDER_PT_simplify"
COMPAT_ENGINES = {'CYCLES'} COMPAT_ENGINES = {'CYCLES'}
bl_options = {'DEFAULT_CLOSED'} bl_options = {'DEFAULT_CLOSED'}
def draw_device(self, context): def draw_device(self, context):
scene = context.scene scene = context.scene
layout = self.layout layout = self.layout

View File

@@ -137,9 +137,11 @@ def do_versions(self):
# Caustics Reflective/Refractive separation in 272 # Caustics Reflective/Refractive separation in 272
if version <= (2, 72, 0): if version <= (2, 72, 0):
cscene = scene.cycles cscene = scene.cycles
if (cscene.get("no_caustics", False) and if (
not cscene.is_property_set("caustics_reflective") and cscene.get("no_caustics", False) and
not cscene.is_property_set("caustics_refractive")): not cscene.is_property_set("caustics_reflective") and
not cscene.is_property_set("caustics_refractive")
):
cscene.caustics_reflective = False cscene.caustics_reflective = False
cscene.caustics_refractive = False cscene.caustics_refractive = False

View File

@@ -15,6 +15,7 @@
*/ */
#include "blender/blender_device.h" #include "blender/blender_device.h"
#include "blender/blender_session.h"
#include "blender/blender_util.h" #include "blender/blender_util.h"
#include "util/util_foreach.h" #include "util/util_foreach.h"
@@ -42,6 +43,18 @@ int blender_device_threads(BL::Scene &b_scene)
DeviceInfo blender_device_info(BL::Preferences &b_preferences, BL::Scene &b_scene, bool background) DeviceInfo blender_device_info(BL::Preferences &b_preferences, BL::Scene &b_scene, bool background)
{ {
if (BlenderSession::device_override != DEVICE_MASK_ALL) {
vector<DeviceInfo> devices = Device::available_devices(BlenderSession::device_override);
if (devices.empty()) {
printf("Found no Cycles device of the specified type, falling back to CPU...\n");
return Device::available_devices(DEVICE_MASK_CPU).front();
}
int threads = blender_device_threads(b_scene);
return Device::get_multi_device(devices, threads, background);
}
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles"); PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
/* Default to CPU device. */ /* Default to CPU device. */

View File

@@ -25,6 +25,7 @@
#include "blender/blender_util.h" #include "blender/blender_util.h"
#include "util/util_foreach.h" #include "util/util_foreach.h"
#include "util/util_task.h"
CCL_NAMESPACE_BEGIN CCL_NAMESPACE_BEGIN
@@ -45,7 +46,8 @@ Geometry *BlenderSync::sync_geometry(BL::Depsgraph &b_depsgraph,
BL::Object &b_ob, BL::Object &b_ob,
BL::Object &b_ob_instance, BL::Object &b_ob_instance,
bool object_updated, bool object_updated,
bool use_particle_hair) bool use_particle_hair,
TaskPool *task_pool)
{ {
/* Test if we can instance or if the object is modified. */ /* Test if we can instance or if the object is modified. */
BL::ID b_ob_data = b_ob.data(); BL::ID b_ob_data = b_ob.data();
@@ -77,8 +79,15 @@ Geometry *BlenderSync::sync_geometry(BL::Depsgraph &b_depsgraph,
used_shaders.push_back(default_shader); used_shaders.push_back(default_shader);
} }
/* Test if we need to sync. */ /* Ensure we only sync instanced geometry once. */
Geometry *geom = geometry_map.find(key); Geometry *geom = geometry_map.find(key);
if (geom) {
if (geometry_synced.find(geom) != geometry_synced.end()) {
return geom;
}
}
/* Test if we need to sync. */
bool sync = true; bool sync = true;
if (geom == NULL) { if (geom == NULL) {
/* Add new geometry if it did not exist yet. */ /* Add new geometry if it did not exist yet. */
@@ -125,28 +134,36 @@ Geometry *BlenderSync::sync_geometry(BL::Depsgraph &b_depsgraph,
} }
} }
/* Ensure we only sync instanced geometry once. */
if (geometry_synced.find(geom) != geometry_synced.end()) {
return geom;
}
progress.set_sync_status("Synchronizing object", b_ob.name());
geometry_synced.insert(geom); geometry_synced.insert(geom);
geom->name = ustring(b_ob_data.name().c_str()); geom->name = ustring(b_ob_data.name().c_str());
if (geom_type == Geometry::HAIR) { auto sync_func = [=]() mutable {
Hair *hair = static_cast<Hair *>(geom); if (progress.get_cancel())
sync_hair(b_depsgraph, b_ob, hair, used_shaders); return;
}
else if (geom_type == Geometry::VOLUME) { progress.set_sync_status("Synchronizing object", b_ob.name());
Volume *volume = static_cast<Volume *>(geom);
sync_volume(b_ob, volume, used_shaders); if (geom_type == Geometry::HAIR) {
Hair *hair = static_cast<Hair *>(geom);
sync_hair(b_depsgraph, b_ob, hair, used_shaders);
}
else if (geom_type == Geometry::VOLUME) {
Volume *volume = static_cast<Volume *>(geom);
sync_volume(b_ob, volume, used_shaders);
}
else {
Mesh *mesh = static_cast<Mesh *>(geom);
sync_mesh(b_depsgraph, b_ob, mesh, used_shaders);
}
};
/* Defer the actual geometry sync to the task_pool for multithreading */
if (task_pool) {
task_pool->push(sync_func);
} }
else { else {
Mesh *mesh = static_cast<Mesh *>(geom); sync_func();
sync_mesh(b_depsgraph, b_ob, mesh, used_shaders);
} }
return geom; return geom;
@@ -156,7 +173,8 @@ void BlenderSync::sync_geometry_motion(BL::Depsgraph &b_depsgraph,
BL::Object &b_ob, BL::Object &b_ob,
Object *object, Object *object,
float motion_time, float motion_time,
bool use_particle_hair) bool use_particle_hair,
TaskPool *task_pool)
{ {
/* Ensure we only sync instanced geometry once. */ /* Ensure we only sync instanced geometry once. */
Geometry *geom = object->geometry; Geometry *geom = object->geometry;
@@ -177,16 +195,29 @@ void BlenderSync::sync_geometry_motion(BL::Depsgraph &b_depsgraph,
return; return;
} }
if (b_ob.type() == BL::Object::type_HAIR || use_particle_hair) { auto sync_func = [=]() mutable {
Hair *hair = static_cast<Hair *>(geom); if (progress.get_cancel())
sync_hair_motion(b_depsgraph, b_ob, hair, motion_step); return;
}
else if (b_ob.type() == BL::Object::type_VOLUME || object_fluid_gas_domain_find(b_ob)) { if (b_ob.type() == BL::Object::type_HAIR || use_particle_hair) {
/* No volume motion blur support yet. */ Hair *hair = static_cast<Hair *>(geom);
sync_hair_motion(b_depsgraph, b_ob, hair, motion_step);
}
else if (b_ob.type() == BL::Object::type_VOLUME || object_fluid_gas_domain_find(b_ob)) {
/* No volume motion blur support yet. */
}
else {
Mesh *mesh = static_cast<Mesh *>(geom);
sync_mesh_motion(b_depsgraph, b_ob, mesh, motion_step);
}
};
/* Defer the actual geometry sync to the task_pool for multithreading */
if (task_pool) {
task_pool->push(sync_func);
} }
else { else {
Mesh *mesh = static_cast<Mesh *>(geom); sync_func();
sync_mesh_motion(b_depsgraph, b_ob, mesh, motion_step);
} }
} }

View File

@@ -32,6 +32,7 @@
#include "util/util_foreach.h" #include "util/util_foreach.h"
#include "util/util_hash.h" #include "util/util_hash.h"
#include "util/util_logging.h" #include "util/util_logging.h"
#include "util/util_task.h"
CCL_NAMESPACE_BEGIN CCL_NAMESPACE_BEGIN
@@ -103,7 +104,8 @@ Object *BlenderSync::sync_object(BL::Depsgraph &b_depsgraph,
bool use_particle_hair, bool use_particle_hair,
bool show_lights, bool show_lights,
BlenderObjectCulling &culling, BlenderObjectCulling &culling,
bool *use_portal) bool *use_portal,
TaskPool *geom_task_pool)
{ {
const bool is_instance = b_instance.is_instance(); const bool is_instance = b_instance.is_instance();
BL::Object b_ob = b_instance.object(); BL::Object b_ob = b_instance.object();
@@ -181,6 +183,10 @@ Object *BlenderSync::sync_object(BL::Depsgraph &b_depsgraph,
return NULL; return NULL;
} }
/* Use task pool only for non-instances, since sync_dupli_particle accesses
* geometry. This restriction should be removed for better performance. */
TaskPool *object_geom_task_pool = (is_instance) ? NULL : geom_task_pool;
/* key to lookup object */ /* key to lookup object */
ObjectKey key(b_parent, persistent_id, b_ob_instance, use_particle_hair); ObjectKey key(b_parent, persistent_id, b_ob_instance, use_particle_hair);
Object *object; Object *object;
@@ -198,7 +204,12 @@ Object *BlenderSync::sync_object(BL::Depsgraph &b_depsgraph,
/* mesh deformation */ /* mesh deformation */
if (object->geometry) if (object->geometry)
sync_geometry_motion(b_depsgraph, b_ob, object, motion_time, use_particle_hair); sync_geometry_motion(b_depsgraph,
b_ob_instance,
object,
motion_time,
use_particle_hair,
object_geom_task_pool);
} }
return object; return object;
@@ -211,8 +222,15 @@ Object *BlenderSync::sync_object(BL::Depsgraph &b_depsgraph,
object_updated = true; object_updated = true;
/* mesh sync */ /* mesh sync */
object->geometry = sync_geometry( /* b_ob is owned by the iterator and will go out of scope at the end of the block.
b_depsgraph, b_ob, b_ob_instance, object_updated, use_particle_hair); * b_ob_instance is the original object and will remain valid for deferred geometry
* sync. */
object->geometry = sync_geometry(b_depsgraph,
b_ob_instance,
b_ob_instance,
object_updated,
use_particle_hair,
object_geom_task_pool);
/* special case not tracked by object update flags */ /* special case not tracked by object update flags */
@@ -331,6 +349,9 @@ void BlenderSync::sync_objects(BL::Depsgraph &b_depsgraph,
BL::SpaceView3D &b_v3d, BL::SpaceView3D &b_v3d,
float motion_time) float motion_time)
{ {
/* Task pool for multithreaded geometry sync. */
TaskPool geom_task_pool;
/* layer data */ /* layer data */
bool motion = motion_time != 0.0f; bool motion = motion_time != 0.0f;
@@ -355,8 +376,8 @@ void BlenderSync::sync_objects(BL::Depsgraph &b_depsgraph,
const bool show_lights = BlenderViewportParameters(b_v3d).use_scene_lights; const bool show_lights = BlenderViewportParameters(b_v3d).use_scene_lights;
BL::ViewLayer b_view_layer = b_depsgraph.view_layer_eval(); BL::ViewLayer b_view_layer = b_depsgraph.view_layer_eval();
BL::Depsgraph::object_instances_iterator b_instance_iter; BL::Depsgraph::object_instances_iterator b_instance_iter;
for (b_depsgraph.object_instances.begin(b_instance_iter); for (b_depsgraph.object_instances.begin(b_instance_iter);
b_instance_iter != b_depsgraph.object_instances.end() && !cancel; b_instance_iter != b_depsgraph.object_instances.end() && !cancel;
++b_instance_iter) { ++b_instance_iter) {
@@ -372,6 +393,11 @@ void BlenderSync::sync_objects(BL::Depsgraph &b_depsgraph,
/* Load per-object culling data. */ /* Load per-object culling data. */
culling.init_object(scene, b_ob); culling.init_object(scene, b_ob);
/* Ensure the object geom supporting the hair is processed before adding
* the hair processing task to the task pool, calling .to_mesh() on the
* same object in parallel does not work. */
const bool sync_hair = b_instance.show_particles() && object_has_particle_hair(b_ob);
/* Object itself. */ /* Object itself. */
if (b_instance.show_self()) { if (b_instance.show_self()) {
sync_object(b_depsgraph, sync_object(b_depsgraph,
@@ -381,11 +407,12 @@ void BlenderSync::sync_objects(BL::Depsgraph &b_depsgraph,
false, false,
show_lights, show_lights,
culling, culling,
&use_portal); &use_portal,
sync_hair ? NULL : &geom_task_pool);
} }
/* Particle hair as separate object. */ /* Particle hair as separate object. */
if (b_instance.show_particles() && object_has_particle_hair(b_ob)) { if (sync_hair) {
sync_object(b_depsgraph, sync_object(b_depsgraph,
b_view_layer, b_view_layer,
b_instance, b_instance,
@@ -393,12 +420,15 @@ void BlenderSync::sync_objects(BL::Depsgraph &b_depsgraph,
true, true,
show_lights, show_lights,
culling, culling,
&use_portal); &use_portal,
&geom_task_pool);
} }
cancel = progress.get_cancel(); cancel = progress.get_cancel();
} }
geom_task_pool.wait_work();
progress.set_sync_status(""); progress.set_sync_status("");
if (!cancel && !motion) { if (!cancel && !motion) {

View File

@@ -410,6 +410,12 @@ static PyObject *available_devices_func(PyObject * /*self*/, PyObject *args)
} }
DeviceType type = Device::type_from_string(type_name); DeviceType type = Device::type_from_string(type_name);
/* "NONE" is defined by the add-on, see: `CyclesPreferences.get_device_types`. */
if ((type == DEVICE_NONE) && (strcmp(type_name, "NONE") != 0)) {
PyErr_Format(PyExc_ValueError, "Device \"%s\" not known.", type_name);
return NULL;
}
uint mask = (type == DEVICE_NONE) ? DEVICE_MASK_ALL : DEVICE_MASK(type); uint mask = (type == DEVICE_NONE) ? DEVICE_MASK_ALL : DEVICE_MASK(type);
mask |= DEVICE_MASK_CPU; mask |= DEVICE_MASK_CPU;
@@ -968,6 +974,44 @@ static PyObject *get_device_types_func(PyObject * /*self*/, PyObject * /*args*/)
return list; return list;
} }
static PyObject *set_device_override_func(PyObject * /*self*/, PyObject *arg)
{
PyObject *override_string = PyObject_Str(arg);
string override = PyUnicode_AsUTF8(override_string);
Py_DECREF(override_string);
bool include_cpu = false;
const string cpu_suffix = "+CPU";
if (string_endswith(override, cpu_suffix)) {
include_cpu = true;
override = override.substr(0, override.length() - cpu_suffix.length());
}
if (override == "CPU") {
BlenderSession::device_override = DEVICE_MASK_CPU;
}
else if (override == "OPENCL") {
BlenderSession::device_override = DEVICE_MASK_OPENCL;
}
else if (override == "CUDA") {
BlenderSession::device_override = DEVICE_MASK_CUDA;
}
else if (override == "OPTIX") {
BlenderSession::device_override = DEVICE_MASK_OPTIX;
}
else {
printf("\nError: %s is not a valid Cycles device.\n", override.c_str());
Py_RETURN_FALSE;
}
if (include_cpu) {
BlenderSession::device_override = (DeviceTypeMask)(BlenderSession::device_override |
DEVICE_MASK_CPU);
}
Py_RETURN_TRUE;
}
static PyMethodDef methods[] = { static PyMethodDef methods[] = {
{"init", init_func, METH_VARARGS, ""}, {"init", init_func, METH_VARARGS, ""},
{"exit", exit_func, METH_VARARGS, ""}, {"exit", exit_func, METH_VARARGS, ""},
@@ -1007,6 +1051,7 @@ static PyMethodDef methods[] = {
/* Compute Device selection */ /* Compute Device selection */
{"get_device_types", get_device_types_func, METH_VARARGS, ""}, {"get_device_types", get_device_types_func, METH_VARARGS, ""},
{"set_device_override", set_device_override_func, METH_O, ""},
{NULL, NULL, 0, NULL}, {NULL, NULL, 0, NULL},
}; };

View File

@@ -47,6 +47,7 @@
CCL_NAMESPACE_BEGIN CCL_NAMESPACE_BEGIN
DeviceTypeMask BlenderSession::device_override = DEVICE_MASK_ALL;
bool BlenderSession::headless = false; bool BlenderSession::headless = false;
int BlenderSession::num_resumable_chunks = 0; int BlenderSession::num_resumable_chunks = 0;
int BlenderSession::current_resumable_chunk = 0; int BlenderSession::current_resumable_chunk = 0;
@@ -562,6 +563,10 @@ void BlenderSession::render(BL::Depsgraph &b_depsgraph_)
session->reset(buffer_params, effective_layer_samples); session->reset(buffer_params, effective_layer_samples);
/* render */ /* render */
if (!b_engine.is_preview() && background && print_render_stats) {
scene->enable_update_stats();
}
session->start(); session->start();
session->wait(); session->wait();

View File

@@ -126,6 +126,7 @@ class BlenderSession {
/* Global state which is common for all render sessions created from Blender. /* Global state which is common for all render sessions created from Blender.
* Usually denotes command line arguments. * Usually denotes command line arguments.
*/ */
static DeviceTypeMask device_override;
/* Blender is running from the command line, no windows are shown and some /* Blender is running from the command line, no windows are shown and some
* extra render optimization is possible (possible to free draw-only data and * extra render optimization is possible (possible to free draw-only data and

View File

@@ -151,6 +151,11 @@ void BlenderSync::sync_recalc(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d
const bool is_geometry = object_is_geometry(b_ob); const bool is_geometry = object_is_geometry(b_ob);
const bool is_light = !is_geometry && object_is_light(b_ob); const bool is_light = !is_geometry && object_is_light(b_ob);
if (b_ob.is_instancer() && b_update->is_updated_shading()) {
/* Needed for e.g. object color updates on instancer. */
object_map.set_recalc(b_ob);
}
if (is_geometry || is_light) { if (is_geometry || is_light) {
const bool updated_geometry = b_update->is_updated_geometry(); const bool updated_geometry = b_update->is_updated_geometry();
@@ -422,11 +427,13 @@ void BlenderSync::sync_film(BL::SpaceView3D &b_v3d)
void BlenderSync::sync_view_layer(BL::SpaceView3D & /*b_v3d*/, BL::ViewLayer &b_view_layer) void BlenderSync::sync_view_layer(BL::SpaceView3D & /*b_v3d*/, BL::ViewLayer &b_view_layer)
{ {
/* render layer */
view_layer.name = b_view_layer.name(); view_layer.name = b_view_layer.name();
/* Filter. */
view_layer.use_background_shader = b_view_layer.use_sky(); view_layer.use_background_shader = b_view_layer.use_sky();
view_layer.use_background_ao = b_view_layer.use_ao(); view_layer.use_background_ao = b_view_layer.use_ao();
view_layer.use_surfaces = b_view_layer.use_solid(); /* Always enable surfaces for baking, otherwise there is nothing to bake to. */
view_layer.use_surfaces = b_view_layer.use_solid() || scene->bake_manager->get_baking();
view_layer.use_hair = b_view_layer.use_strand(); view_layer.use_hair = b_view_layer.use_strand();
view_layer.use_volumes = b_view_layer.use_volumes(); view_layer.use_volumes = b_view_layer.use_volumes();

View File

@@ -50,6 +50,7 @@ class ViewLayer;
class Shader; class Shader;
class ShaderGraph; class ShaderGraph;
class ShaderNode; class ShaderNode;
class TaskPool;
class BlenderSync { class BlenderSync {
public: public:
@@ -145,7 +146,8 @@ class BlenderSync {
bool use_particle_hair, bool use_particle_hair,
bool show_lights, bool show_lights,
BlenderObjectCulling &culling, BlenderObjectCulling &culling,
bool *use_portal); bool *use_portal,
TaskPool *geom_task_pool);
/* Volume */ /* Volume */
void sync_volume(BL::Object &b_ob, Volume *volume, const vector<Shader *> &used_shaders); void sync_volume(BL::Object &b_ob, Volume *volume, const vector<Shader *> &used_shaders);
@@ -177,12 +179,15 @@ class BlenderSync {
BL::Object &b_ob, BL::Object &b_ob,
BL::Object &b_ob_instance, BL::Object &b_ob_instance,
bool object_updated, bool object_updated,
bool use_particle_hair); bool use_particle_hair,
TaskPool *task_pool);
void sync_geometry_motion(BL::Depsgraph &b_depsgraph, void sync_geometry_motion(BL::Depsgraph &b_depsgraph,
BL::Object &b_ob, BL::Object &b_ob,
Object *object, Object *object,
float motion_time, float motion_time,
bool use_particle_hair); bool use_particle_hair,
TaskPool *task_pool);
/* Light */ /* Light */
void sync_light(BL::Object &b_parent, void sync_light(BL::Object &b_parent,

View File

@@ -585,7 +585,7 @@ void BVHEmbree::add_triangles(const Object *ob, const Mesh *mesh, int i)
rtc_indices[j * 3 + 2] = t.v[2]; rtc_indices[j * 3 + 2] = t.v[2];
} }
update_tri_vertex_buffer(geom_id, mesh); set_tri_vertex_buffer(geom_id, mesh, false);
size_t prim_object_size = pack.prim_object.size(); size_t prim_object_size = pack.prim_object.size();
pack.prim_object.resize(prim_object_size + num_triangles); pack.prim_object.resize(prim_object_size + num_triangles);
@@ -612,7 +612,7 @@ void BVHEmbree::add_triangles(const Object *ob, const Mesh *mesh, int i)
rtcReleaseGeometry(geom_id); rtcReleaseGeometry(geom_id);
} }
void BVHEmbree::update_tri_vertex_buffer(RTCGeometry geom_id, const Mesh *mesh) void BVHEmbree::set_tri_vertex_buffer(RTCGeometry geom_id, const Mesh *mesh, const bool update)
{ {
const Attribute *attr_mP = NULL; const Attribute *attr_mP = NULL;
size_t num_motion_steps = 1; size_t num_motion_steps = 1;
@@ -640,8 +640,15 @@ void BVHEmbree::update_tri_vertex_buffer(RTCGeometry geom_id, const Mesh *mesh)
verts = &attr_mP->data_float3()[t_ * num_verts]; verts = &attr_mP->data_float3()[t_ * num_verts];
} }
float *rtc_verts = (float *)rtcSetNewGeometryBuffer( float *rtc_verts = (update) ?
geom_id, RTC_BUFFER_TYPE_VERTEX, t, RTC_FORMAT_FLOAT3, sizeof(float) * 3, num_verts + 1); (float *)rtcGetGeometryBufferData(geom_id, RTC_BUFFER_TYPE_VERTEX, t) :
(float *)rtcSetNewGeometryBuffer(geom_id,
RTC_BUFFER_TYPE_VERTEX,
t,
RTC_FORMAT_FLOAT3,
sizeof(float) * 3,
num_verts + 1);
assert(rtc_verts); assert(rtc_verts);
if (rtc_verts) { if (rtc_verts) {
for (size_t j = 0; j < num_verts; ++j) { for (size_t j = 0; j < num_verts; ++j) {
@@ -651,10 +658,14 @@ void BVHEmbree::update_tri_vertex_buffer(RTCGeometry geom_id, const Mesh *mesh)
rtc_verts += 3; rtc_verts += 3;
} }
} }
if (update) {
rtcUpdateGeometryBuffer(geom_id, RTC_BUFFER_TYPE_VERTEX, t);
}
} }
} }
void BVHEmbree::update_curve_vertex_buffer(RTCGeometry geom_id, const Hair *hair) void BVHEmbree::set_curve_vertex_buffer(RTCGeometry geom_id, const Hair *hair, const bool update)
{ {
const Attribute *attr_mP = NULL; const Attribute *attr_mP = NULL;
size_t num_motion_steps = 1; size_t num_motion_steps = 1;
@@ -689,8 +700,14 @@ void BVHEmbree::update_curve_vertex_buffer(RTCGeometry geom_id, const Hair *hair
verts = &attr_mP->data_float3()[t_ * num_keys]; verts = &attr_mP->data_float3()[t_ * num_keys];
} }
float4 *rtc_verts = (float4 *)rtcSetNewGeometryBuffer( float4 *rtc_verts = (update) ? (float4 *)rtcGetGeometryBufferData(
geom_id, RTC_BUFFER_TYPE_VERTEX, t, RTC_FORMAT_FLOAT4, sizeof(float) * 4, num_keys_embree); geom_id, RTC_BUFFER_TYPE_VERTEX, t) :
(float4 *)rtcSetNewGeometryBuffer(geom_id,
RTC_BUFFER_TYPE_VERTEX,
t,
RTC_FORMAT_FLOAT4,
sizeof(float) * 4,
num_keys_embree);
assert(rtc_verts); assert(rtc_verts);
if (rtc_verts) { if (rtc_verts) {
@@ -709,6 +726,10 @@ void BVHEmbree::update_curve_vertex_buffer(RTCGeometry geom_id, const Hair *hair
rtc_verts += c.num_keys + 2; rtc_verts += c.num_keys + 2;
} }
} }
if (update) {
rtcUpdateGeometryBuffer(geom_id, RTC_BUFFER_TYPE_VERTEX, t);
}
} }
} }
@@ -779,7 +800,7 @@ void BVHEmbree::add_curves(const Object *ob, const Hair *hair, int i)
rtcSetGeometryBuildQuality(geom_id, build_quality); rtcSetGeometryBuildQuality(geom_id, build_quality);
rtcSetGeometryTimeStepCount(geom_id, num_motion_steps); rtcSetGeometryTimeStepCount(geom_id, num_motion_steps);
update_curve_vertex_buffer(geom_id, hair); set_curve_vertex_buffer(geom_id, hair, false);
rtcSetGeometryUserData(geom_id, (void *)prim_offset); rtcSetGeometryUserData(geom_id, (void *)prim_offset);
if (hair->curve_shape == CURVE_RIBBON) { if (hair->curve_shape == CURVE_RIBBON) {
@@ -933,15 +954,17 @@ void BVHEmbree::refit_nodes()
if (geom->type == Geometry::MESH || geom->type == Geometry::VOLUME) { if (geom->type == Geometry::MESH || geom->type == Geometry::VOLUME) {
Mesh *mesh = static_cast<Mesh *>(geom); Mesh *mesh = static_cast<Mesh *>(geom);
if (mesh->num_triangles() > 0) { if (mesh->num_triangles() > 0) {
update_tri_vertex_buffer(rtcGetGeometry(scene, geom_id), mesh); RTCGeometry geom = rtcGetGeometry(scene, geom_id);
rtcCommitGeometry(rtcGetGeometry(scene, geom_id)); set_tri_vertex_buffer(geom, mesh, true);
rtcCommitGeometry(geom);
} }
} }
else if (geom->type == Geometry::HAIR) { else if (geom->type == Geometry::HAIR) {
Hair *hair = static_cast<Hair *>(geom); Hair *hair = static_cast<Hair *>(geom);
if (hair->num_curves() > 0) { if (hair->num_curves() > 0) {
update_curve_vertex_buffer(rtcGetGeometry(scene, geom_id + 1), hair); RTCGeometry geom = rtcGetGeometry(scene, geom_id + 1);
rtcCommitGeometry(rtcGetGeometry(scene, geom_id + 1)); set_curve_vertex_buffer(geom, hair, true);
rtcCommitGeometry(geom);
} }
} }
} }

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