1
1

Compare commits

..

946 Commits

Author SHA1 Message Date
c5e2a8fbbd add runtime field to Simulation 2020-04-16 13:04:33 +02:00
401ddff410 get current scene time 2020-04-16 12:44:34 +02:00
5f47593f50 separate simulation eval function 2020-04-16 12:23:52 +02:00
89880e891c initial testing for integration in depsgraph 2020-04-15 18:26:07 +02:00
fd6d8ac791 Add Boolean Math, Switch and Float Compare function nodes
Since those nodes did not exist for shader node trees before,
I implemented them directly as "function nodes". Those could later
be used in shader node trees as well.

Differential Revision: https://developer.blender.org/D7424
2020-04-14 13:47:38 +02:00
ff3d82d7ef Use some shader nodes in the simulation nodes
This makes a subset of the shader nodes available in simulation node trees.
More can be made available in the future, but we might not be able to actually
implement all the nodes before the release.

For now, their name remains `ShaderNode...`. We should rename them to
e.g. `FunctionNode...` and move them to a separate folder in the future.

Differential Revision: https://developer.blender.org/D7422
2020-04-14 12:31:27 +02:00
d26c3e9e75 Core particle nodes (ui only)
Differential Revision: https://developer.blender.org/D7384
2020-04-09 15:00:55 +02:00
b9e1e769fb show name in particle simulation node 2020-04-09 13:04:34 +02:00
26e114efb8 add missing cases for new types in switch statement 2020-04-09 12:38:25 +02:00
c9bdeef488 core particle simulation nodes 2020-04-09 12:34:12 +02:00
827861cfdf Merge branch 'image-and-object-socket-type' into influence-and-control-flow-socket-types 2020-04-09 11:39:05 +02:00
82db1198a5 Merge branch 'embedded_simulation_node_tree' into image-and-object-socket-type 2020-04-09 11:35:24 +02:00
c8bcb7cc2b Merge branch 'simulation-tree-arc' into embedded_simulation_node_tree 2020-04-09 11:32:38 +02:00
9eb90548c5 Merge branch 'simulation-data-block' into simulation-tree-arc 2020-04-09 11:28:42 +02:00
40b269f50b Merge branch 'master' into simulation-data-block 2020-04-09 11:24:11 +02:00
9b3bdce6a6 add missing enum item 2020-04-09 11:23:26 +02:00
b392632b8d add simulation node trees to node tree iterator 2020-04-09 11:23:06 +02:00
80255e67e3 Silence assert on ID usercount for deprecated IPO.
We do not really care about those, so just avoid the noise when loading
very old files...

Re T75389.
2020-04-09 11:21:02 +02:00
ebd8f94050 fix user counting when freeing interface sockets 2020-04-09 11:19:56 +02:00
5c15a74d63 copy object/image pointer in node_socket_copy_default_value 2020-04-09 11:12:16 +02:00
36746474fd Tracking: Forward compatibility code for distortion models
Allows to open newer files in older Blender after new distortion model
has been added.

It will behave as if this is a polynomial model with all 0 coefficients
which are then being refined and assigned explicitly after solving the
motion.
2020-04-09 10:59:31 +02:00
b5e277ed05 Cleanup: Fix typo error 2020-04-09 10:58:42 +02:00
ee5cec4a50 Fix T75122: Annotations: Only visible scene annotations in dopesheet
The loop of datablocks was using the scene datablock (3D View) only, but all others datablocks were ignored.

Now the loop consider any annotation datablock.
2020-04-09 10:56:59 +02:00
bd59781c66 Fix T75425: Bone selection cycling not working
Edit-mode bone selection now cycles on successive clicks.
This now cycles through multiple edit-objects & bones.
2020-04-09 18:46:47 +10:00
4dc3831a2a bring back a break 2020-04-06 15:22:22 +02:00
5bb1a05d9e handle node tree in lib_query.c 2020-04-06 15:20:25 +02:00
6a447a32fe Add emitters, events, forces and control flow socket types
This is part of T73324.

The shapes and colors of the sockets will most likely change later on.

This script can be used to create a node with the new socket types:
```
import bpy

class MyCustomNode(bpy.types.Node):
    bl_idname = 'CustomNodeType'
    bl_label = "Custom Node"

    def init(self, context):
        self.inputs.new('NodeSocketEmitters', "Emitters")
        self.inputs.new('NodeSocketEvents', "Events")
        self.inputs.new('NodeSocketForces', "Forces")
        self.inputs.new('NodeSocketControlFlow', "Control Flow")

        self.outputs.new('NodeSocketEmitters', "Emitters")
        self.outputs.new('NodeSocketEvents', "Events")
        self.outputs.new('NodeSocketForces', "Forces")
        self.outputs.new('NodeSocketControlFlow', "Control Flow")

bpy.utils.register_class(MyCustomNode)

if len(bpy.data.simulations) == 0:
    bpy.data.simulations.new("Simulation")

sim = bpy.data.simulations[0]
sim.node_tree.nodes.new("CustomNodeType")
```

Differential Revision: https://developer.blender.org/D7349
2020-04-06 13:52:50 +02:00
7dfdb1a8a0 New Object and Image socket types
The main difficulty with adding these types is that they are the first sockets types
that reference ID data in their `default_value`. That means that I had to add some
new logic in a few places to deal with reference counting. I hope I found all the places...
It seems to work fine in my tests.

For now these socket types can only be created using a script like the one below:
```
import bpy

class MyCustomNode(bpy.types.Node):
    bl_idname = 'CustomNodeType'
    bl_label = "Custom Node"

    def init(self, context):
        self.inputs.new('NodeSocketObject', "Object")
        self.inputs.new('NodeSocketImage', "Image")

bpy.utils.register_class(MyCustomNode)

if len(bpy.data.simulations) == 0:
    bpy.data.simulations.new("Simulation")

sim = bpy.data.simulations[0]
sim.node_tree.nodes.new("CustomNodeType")
```

After running the script, go to the simulation editor and select the newly created simulation.

---

We might want to change `readfile.c` so that linked objects/images are only loaded,
when the socket is not connected. Otherwise it can be tricky to figure out why certain
id data blocks are still referenced by the node tree later on.

Differential Revision: https://developer.blender.org/D7347
2020-04-06 13:23:20 +02:00
2b1e84c0de Merge branch 'simulation-tree-arc' into embedded_simulation_node_tree 2020-04-06 12:04:40 +02:00
2cc55bcdc2 fix after merge 2020-04-06 12:01:13 +02:00
ffb3285672 Merge branch 'simulation-data-block' into simulation-tree-arc 2020-04-06 11:55:43 +02:00
69aecad547 Merge branch 'master' into simulation-data-block 2020-04-06 11:51:57 +02:00
480ff89bf7 Fix T75311, T75310: Edit Weight Paint Overlay Render Artifacts
During recent refactoring of the edit weight overlay we moved a
assignment before it was valid. Making everything one frame off what
resulted in a flashing frame during TAA, not drawing the overlay until a
second action happened, making overlays too bright.

The reason whas that the painting overlay wasn't initialized in the
first sample, but the draw passes and groups were filled. Resulting in
rendering the overlay twice or not at all.

This change moves the assignment to where it is valid.
2020-04-06 10:28:31 +02:00
999134b7ca Cleanup: Add some comments removed in rB0d0036cb53f8 2020-04-06 09:58:57 +02:00
f1bf7bfa1b Cleanup: spelling 2020-04-06 16:02:29 +10:00
6526c3ced8 Fix displaying edit-mesh measurements with deform modifiers
Resolves regression from 2.7x
2020-04-06 15:26:27 +10:00
0ca5b7b69b Fix T74602: Sequencer slip operator ignores offset constraints
Limit offsets, so each strip contains at least 1 frame of content.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D7288
2020-04-06 02:09:20 +02:00
d0d20de183 VSE: Draw f-curves for opacity and volume values on the strips
Feature can be enabled or disabled in timeline view menu item "Show F-Curves".

Author a.monti

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D7205
2020-04-06 00:52:29 +02:00
0e7599bc15 VSE: don't allow strip preview when clicking on the scrubbing region
Don't set 'special preview' or Solo mode if scrubbing in scrubbing region.

Author: a.monti

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D7234
2020-04-06 00:11:55 +02:00
0d0036cb53 Cleanup: Fix comment style and check if they are valid or make sense. 2020-04-05 23:55:51 +02:00
43cc2f3195 Cleanup: Use _fn as a suffix for callbacks in VSE code 2020-04-05 23:39:20 +02:00
9d4300b0c6 Volumes: add volume.grids.frame_filepath to get the current frame filepath
This can be used by external renderers that can load OpenVDB files.
2020-04-05 21:27:30 +02:00
bae1c243ce Build: hide USD symbols, make Blender symbols visible again
Following up to b555b8d.

Building Blender with hidden symbols but using libraries with visible symbols
was giving linker warnings, specifically for USD. So revert that for now, as
it was not needed for the bugfix.

Hide USD symbols (some of which are not in the USD namespace) to avoid potential
conflicts. May potentially help with AMD OpenCL issues in T74262.
2020-04-05 21:04:10 +02:00
f1573731bc UI: Support split property layout for pointer search buttons
Pointer search buttons created with `uiItemPointerR()` (which allows
also passing a collection property to search in) did not work with the
split property layout (i.e. `uiLayout.use_property_split`).
For example vertex group search buttons typically use this.

Note that decorators (`uiLayout.use_property_decorate`) are not
supported yet. Although if they are enabled, the decorator column is
still created to keep the layout alignment visually intact. Also re-uses
the existing hack to allow placing multiple items in the row before the
decorator column.

Needed for some in-progress changes to the modifier stack UI.
2020-04-05 14:49:28 +02:00
19352bca16 Cleanup: spelling 2020-04-05 22:22:21 +10:00
7df787b2c1 UI: English as Default Language
Set language setting for new profiles to English.

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

Reviewed by Brecht Van Lommel
2020-04-08 16:10:48 -07:00
1239cab11f Fix T75203: Crash when changing active keying set
When updating the active button, the search data wasn't updated, so it
kept using the old pointers. A check in `ui_rna_collection_search_cb()`
relied on this incorrect behavior so I had to fix that too. Note that
the previous commit was also needed for the second fix to work.

Caused by c46dcdf887.
2020-04-08 23:23:44 +02:00
74fa8787d8 Fix error in UI_butstore_ API
If the `uiButStore` data was freed after the buttons/blocks were updated
from previous instances (see `UI_block_update_from_old()`), e.g. by
delaying that to the "afterfuncs" (`ui_apply_but_funcs_after()`), the
data would get lost. As result, the button pointers that the API is
supposed to keep valid would point to freed memory.

This wasn't an issue so far since the API didn't happen to be used this
way. That changes with the next commit.
2020-04-08 23:22:33 +02:00
c13aa95eda Fix T75288: crash in Cycles image loading with multithreaded shader compilation 2020-04-08 22:01:04 +02:00
cc53c9e476 Fix T75290: Cycles crash with out of bounds memory access in volume mesh build 2020-04-08 21:58:17 +02:00
8360bfb75c Cleanup: clang-format 2020-04-08 21:58:17 +02:00
f405934fe3 Fix T75445: Filmic transform not working when using Turkish locale
This is a bug in OpenColorIO that we work around (see "Turkish I" problem),
a proper fix will be submitted upstream.
2020-04-08 20:50:50 +02:00
d41d4d0593 GPencil: Small changes to brush defaults 2020-04-08 19:03:17 +02:00
4a6f715421 Fix T73552: Mantaflow - liquid particles show up in organized unrealistic structure
Issue was being caused by a particle offset which was random but the same for every particle.
2020-04-08 18:29:26 +02:00
2328599e97 NewUndo: Fix (studio-reported) discrepency in proxies when undoing.
Took me an unreasonable amount of time to understand what was happening
here... Our beloved proxies, as usual, need some specific careful
handling.
2020-04-08 17:43:40 +02:00
b0f229dd27 Tracking: Fix missing distortion update on focal length change 2020-04-08 17:19:21 +02:00
020d1e23ae Fluid: Fix issue with mesh not being loaded
Fixed an issue that was likely introduced in a past cleanup.
2020-04-08 16:26:20 +02:00
34b28850bf Fix wrong material indicated in the error message when baking
The material displayed in the error message due to the lack of active
texture was that of the previous slot.
2020-04-08 09:44:43 -03:00
91d7f5d246 Fix T74572: adaptive sampling still not working correct with shader AOVs 2020-04-08 14:09:10 +02:00
fd487b1f4e Fix build error with WITH_X11_XINPUT=OFF after recent changes 2020-04-08 14:03:54 +02:00
ff2c67d7e8 Fluid: Disable subframes when using adaptive time-steps in the first frame
First frame should only produce inflow once and not compute the emission for the frame before the first frame. Problem became evident in T74062.
2020-04-08 13:42:40 +02:00
c2cb87f897 Fluid: Fix problem with inconsistent noise when using multiple adaptive time-steps
Problem was mentioned in T74062.
2020-04-08 13:27:12 +02:00
a1ddb63329 Fluid: Update Mantaflow source files
Update includes new grid helper functions and some cleanups.
2020-04-08 13:25:16 +02:00
7cafdc57e0 Fluid: Manta clang-format update
Do not use sort-includes in Manta source files for now when applying clang-format. Too many conflicts.
2020-04-08 13:20:18 +02:00
ea5a2efb57 Fix manual reference error after removal of use_international_fonts 2020-04-08 12:43:49 +02:00
Nicholas Rishel
ea3e0b3e8c Windows: support high resolution tablet pen events for Wintab
Together with Windows Ink support, this should fully resolve T70765.

Differential Revision: https://developer.blender.org/D6675
2020-04-08 12:25:40 +02:00
Nicholas Rishel
d571d615a5 Windows: support high resolution tablet pen events for Windows Ink
Rather than using the last state of the tablet, we now query the history of
pointer events so strokes can follow the pen even if Blender does not handle
events at the same rate.

Differential Revision: https://developer.blender.org/D6675
2020-04-08 12:25:40 +02:00
Nicholas Rishel
3d8c57f4da Cleanup: minor refactoring of pointer event handling
Ref D6675
2020-04-08 12:25:40 +02:00
Nicholas Rishel
4e4bf241c8 Cleanup: add utility functions for milliseconds conversion
Ref D6675
2020-04-08 12:25:40 +02:00
c43473e884 Cleanup: remove GHOST API to query tablet state from Window
It's not used by Blender anymore and it's unreliable since this state really
only makes sense associated with events in a particular order.

Ref D6675
2020-04-08 12:25:40 +02:00
Miguel Pozo
d478cc71dd Fix Windows Tablet API preference not being used
It was sometimes set before reading preferences, now it's passed to GHOST every
time preferences are read.

Differential Revision: https://developer.blender.org/D5641
2020-04-08 12:25:40 +02:00
a3c1605581 Cleanup: rename to BLI_path_cwd to BLI_path_abs_from_cwd
This is now more clearly a function that makes the path absolute
using the current working directory.
2020-04-08 16:46:16 +10:00
57468ae37e Cleanup: missed renaming BLI_cleanup_unc_16 in recent refactor
Missed from d14e768069
2020-04-08 16:29:46 +10:00
b0d565e5b6 Cleanup: reduce scope of variables in custom data copying 2020-04-08 16:27:59 +10:00
35861a49ee Fix T67098: Inset causes shape keys to reset exiting edit-mode
Edit-mesh interactive redo reset the meshes shape-key index.

Also copy the selection mode when copying meshes.
2020-04-08 16:26:54 +10:00
bd45ec0b06 Cleanup: disable clang-format for character table 2020-04-08 13:29:51 +10:00
1c58311440 Fix status bar message showing saved when saving failed
Resolves the following issues:

- For the first time you save a .blend file, there was no feedback.
- If the file fails to save (eg "No space left on device") the status
  bar message replaces the error with an invalid "Saved" message.

  While there is a popup, the user may cancel it with mouse motion
  and be left with the status bar message saying the file saved.

D7371 by @XDroid with edits.
2020-04-08 13:22:00 +10:00
056ebb56b1 Cleanup: clang-format 2020-04-08 10:34:39 +10:00
1ec2f8d1f2 Cleanup: spelling 2020-04-08 10:33:56 +10:00
161c13e12b Fix building without translations enabled 2020-04-08 10:24:33 +10:00
1ee3def5d3 UI: Splash Screen Language Selection
Quick Setup splash now includes language selection.

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

Reviewed by Brecht Van Lommel
2020-04-07 16:33:52 -07:00
9d0f452076 Fix missed depsgraph update after undo in some cases
Forgot to take into account legacy DEG_id_tag_update with zero flag.
2020-04-07 23:56:07 +02:00
a2243f1b51 Debugging: change Undo/Redo redraw timer to include dependency graph update
This is often the slowest part and was not counted before.
2020-04-07 23:43:55 +02:00
968619d036 UI: Language Selection Changes
Removal of 'Translation' checkbox. Enable translation options when selecting non-English languages.

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

Reviewed by Brecht Van Lommel
2020-04-07 13:25:49 -07:00
53981c7fb6 Cleanup: refactor adaptive sampling to more easily change some parameters
No functional changes yet, this is work towards making CPU and GPU results
match more closely.
2020-04-07 20:29:48 +02:00
7b4b07a7dd GPencil: Fix unreported problems with Chisel brush
With the new sampling, the arc points were not using the angle of the brush and the line was with the same thickness in all orientations.
2020-04-07 20:07:58 +02:00
6b58571813 UI: Don't collapse all panels for subpanels
The behavior for subpanels was incorrect, and the ideal behavior isn't even clear.

This disables the "collapse all" ctrl click feature for panels that have parents.

Differential Revision: https://developer.blender.org/D7355
2020-04-07 11:51:08 -05:00
c5ed2eb95e Undo: change depsgraph recalc flags handling to improve performance
These changes only have an effect when the experimental Undo Speedup preference
is enabled.

* For DEG_id_tag_update, accumulate recalc flags immediately before the undo
  push happens instead of afterwards. Otherwise the undo state does not
  contain enough flags, and the current state may contain too many flags.

  This also means we call DEG_id_tag_update after undo with the accumulated
  flags to ensure they are flushed to other datablocks.

* For undo, accumulate recalc flags in id->recalc and clear accumulated flags
  immediately. Not clearing would cause circular behavior where accumulated
  flags may never end up being cleared.

  This matches what happens after an undo push where these are also cleared,
  indicating that the undo state and current in-memory state match exactly.

* Don't change id->recalc of identical datablocks, it should not be needed.
  There is one exception for armatures where pointers across datablocks
  exist which otherwise would cause problems. There may be a better solution
  to this but it seems to work in agent 327 production files.

* This contains a change in undofile.c to avoid detecting all datablocks as
  changed for the first of the two undo steps, where we restore to the state
  of the last undo push before going to the one before.

  Without this the whole system is much less efficient. However this is unsafe
  in the sense that if an app handler or operators edits a datablock after an
  undo push, that change will not be undone.

  It can be argued that this is acceptable behavior, since a following undo push
  will include that change and this may already have unexpected side effects.

Ref T60695

Differential Revision: https://developer.blender.org/D7339
2020-04-07 17:14:19 +02:00
02598e629e Fix T73566: Mesh analysis, error showing intersecting faces 2020-04-08 00:43:47 +10:00
3a5c16f1c9 Fix T74720: bmesh.ops.delete default context argument does nothing 2020-04-07 23:23:17 +10:00
1de5cb6a31 Cleanup: use doxy sections 2020-04-07 23:23:17 +10:00
3a65397473 Fix T75471: Outliner: crash selecting modifier objects/targets that are in a excluded collection
There is no garuantee 'outliner_find_id()' can find those corresponding
TreeElements, safeguard against failure now.

note: not sure why this was no problem in Release builds? (could only
reproduce crashes in Debug builds...)

Maniphest Tasks: T75471

Differential Revision: https://developer.blender.org/D7365
2020-04-07 15:08:50 +02:00
5e0465e4ec Fix T75343: Wireframe overylay is not working properly with multiple modifiers
Since rBcf258b02f449, only wires and edges that are mapped to the
original mesh were drawn if the mesh was modified by modifiers.
Above commit was only meant for showing orig wires for paint mask
overlays [where final wireframe is not desired], so now only use
MR_EXTRACT_MAPPED when we are in a paint mode.

Maniphest Tasks: T75343

Differential Revision: https://developer.blender.org/D7333
2020-04-07 14:47:06 +02:00
4a83832120 Fix T74828: Fluid: Crash with Fire/Smoke Noise
Issue was that the noise simulation was trying to bake with a minimized domain size (adaptive domain initializes domain with size (1,1,1)). Similarly to the base resolution bake, there should be no noise baking happening at those domain sizes - a domain at this size is considered empty.
2020-04-07 14:31:33 +02:00
ea78f9922e Fluid: Fixed assertion error
Fix for new assertion statements that were introduced in bfdc42d990.
2020-04-07 14:31:33 +02:00
5892622d68 Revert "Fix memory leak in recent panel drag widget cache"
This reverts commit 58e20b432a.

Was calling discard twice, tsk.
Although for some reason it did quiet the leak.

Reverting because this is causing a crash.
2020-04-07 22:09:37 +10:00
ee43cf5722 Fix T66751: Symmetrizing armature does not symmetrize constraints.
The symmetrize operator now tries to make sure that the armature
constraints are correctly mirrored.

Before it would only mirror the subtargets for the constraints (and that
failed too in some cases).

Reviewed By: Sybren

Differential Revision: http://developer.blender.org/D6009
2020-04-07 13:54:22 +02:00
6feeede47f Fix Blender not rebuilding when changing linker script 2020-04-07 13:44:18 +02:00
58e20b432a Fix memory leak in recent panel drag widget cache
Memory leak from 60d873bd22.
2020-04-07 21:34:25 +10:00
aaaa0a43af Build: use -no-pie for portable builds on Linux
Otherwise file browsers do not recognize the Blender executable. This is
already done for official releases.

We leave it off for non-portable builds, since that's how Linux distribution
packages will typically build Blender and we can continue to follow the OS
default there. Using a file browser to launch executables from e.g. /usr/bin
would be rare as wel.

Differential Revision: https://developer.blender.org/D7363
2020-04-07 13:32:42 +02:00
e953ada0bb Cleanup: avoid memory allocation for unchanged datablocks in undo
Differential Revision: https://developer.blender.org/D7336
2020-04-07 13:19:52 +02:00
c786f95871 Cleanup: split partial undo code off into functions, tweak debug prints
Differential Revision: https://developer.blender.org/D7331
2020-04-07 13:19:52 +02:00
7bc99fdb32 Cleanup: simplify logic for partial undo in ID read
Differential Revision: https://developer.blender.org/D7330
2020-04-07 13:19:52 +02:00
826e4ba99c Cleanup: skip reading UI datablocks entirely for undo
Other types of datablocks pointing to UI datablocks is unsupported, so
there is no need to store them in fd->libmap. With the experimental undo
speedup enabled preserving such pointers was done. But it didn't work in
2.82 and such pointers are easily lost in cases other than undo.

Differential Revision: https://developer.blender.org/D7329
2020-04-07 13:19:52 +02:00
d2a07c7b78 Cleanup: delay creating datamap until it's actually needed
Differential Revision: https://developer.blender.org/D7328
2020-04-07 13:19:52 +02:00
44e5f7a8cf Cleanup: don't use global variable for test if IDs are identical
Differential Revision: https://developer.blender.org/D7327
2020-04-07 13:19:52 +02:00
c75aaf5329 Cleanup: split off library and linked datablock undo restore
Differential Revision: https://developer.blender.org/D7326
2020-04-07 13:19:52 +02:00
624b231ec4 Cleanup: early out on invalid ID data to simplify control flow
Differential Revision: https://developer.blender.org/D7325
2020-04-07 13:19:52 +02:00
0aac74f18f Cleanup: split off direct_link_id() function
Differential Revision: https://developer.blender.org/D7324
2020-04-07 13:19:52 +02:00
c4def7992b Fix T73598: Pose options - Auto IK. Bones move on release
The issue was that the code tried to use the bones transformation matrix
as a rotation matrix. This works fine as long as the scale is 1.

Now we simply make sure that we only get a pure rotation matrix when
extracting it for the bone's transformation matrix.
2020-04-07 13:15:43 +02:00
9fca9b9953 Fix crash using object.to_mesh() when in edit mode
The root of the issue was caused by mesh which was a result of to_mesh()
had the same edit_mesh pointer as the input object, causing double-free
error.

This fix makes it so result mesh does not have edit mesh pointer.
Motivation part behind this is to make the result of to_mesh() to be
somewhat independent from the input.

Differential Revision: https://developer.blender.org/D7361
2020-04-07 12:50:45 +02:00
49deda4ca2 GPUBatch: Correctly Free Panel Widget Batch
The GPU Batch for the panel drag widget wasn't freed anywhere. This
patch will free the GPUBatch.
2020-04-07 10:46:44 +02:00
cdbb61704d Fix T75128: Select Linked fails when the selection is a delimiter
Starting select linked failed when the selected vertex or edge
was it's self delimiting.

Support using these elements for linked select
as long as they're part of an isolated selection.
2020-04-07 17:43:27 +10:00
ffe599b4bd Fix T68159: Normals point target crashes when exiting edit-mode
When the modal operator passes events, free the internal state of
the operator as we can't be sure those events don't cause the mesh data
to be re-allocated or removed.

Longer term it might be best to make this into a tool since
the main purpose of this operator is to run other actions.
2020-04-07 16:28:29 +10:00
284d28acbc Cleanup: remove unused BM_total_loop_select function 2020-04-07 15:32:09 +10:00
17193f6c76 UI: rename 'smoothen' to 'smooth'
Other smooth operators use term 'smooth'.
2020-04-07 15:12:18 +10:00
a1eb5ec81c Cleanup: doxy sections, move utility function to editmesh_utils.c 2020-04-07 14:46:13 +10:00
7c4391e6aa Fix T60069: repeated extrusion uses wrong axis 2020-04-07 13:42:50 +10:00
d14e768069 Cleanup: BLI_path.h function renaming
Use BLI_path_ prefix, more consistent names:

  BLI_parent_dir              -> BLI_path_parent_dir
  BLI_parent_dir_until_exists -> BLI_path_parent_dir_until_exists
  BLI_ensure_filename         -> BLI_path_filename_ensure
  BLI_first_slash             -> BLI_path_slash_find
  BLI_last_slash              -> BLI_path_slash_rfind
  BLI_add_slash               -> BLI_path_slash_ensure
  BLI_del_slash               -> BLI_path_slash_rstrip
  BLI_path_native_slash       -> BLI_path_slash_native

Rename 'cleanup' to 'normalize', similar to Python's `os.path.normpath`.

  BLI_cleanup_path  -> BLI_path_normalize
  BLI_cleanup_dir   -> BLI_path_normalize_dir
  BLI_cleanup_unc   -> BLI_path_normalize_unc
  BLI_cleanup_unc16 -> BLI_path_normalize_unc16

Clarify naming for extracting, creating numbered paths:

  BLI_stringenc -> BLI_path_sequence_encode
  BLI_stringdec -> BLI_path_sequence_decode

Part of T74506 proposal.
2020-04-07 12:10:36 +10:00
d54757e389 Cleanup: clang-format 2020-04-07 11:57:36 +10:00
4e7c65035b UI: Use Consitent Menu Layout for Bone Names 2020-04-06 21:45:41 -04:00
e9b4d2ca68 UI: Use Consistent Operator Name
Was called "Subdivide Multi" in Bone Edit and "Subdivide" in Mesh Edit
2020-04-06 21:05:53 -04:00
10f0e003a9 Fix T74572: adaptive sampling not scaling AOVs correctly 2020-04-06 23:23:48 +02:00
e05552f7c4 Revert "Fix T74572: adaptive sampling not scaling render passes correctly"
This reverts commit 82a8da0ec3. It was completely
wrong. Fixes T75388.
2020-04-06 23:23:48 +02:00
29b87b5615 Fix T75357: USD export broken on windows
Path to the jsons was wrong so they were not copied
2020-04-06 14:38:52 -06:00
71a52bbe2a Fluid: Ensure correct velocities for noise bake
Make sure that noise uses the unaltered velocity grid. This is particularly important once external velocities get added to the velocity grid.
2020-04-06 17:48:32 +02:00
60d873bd22 GPU: Panel Drag Widget Drawing Performance
The 10g Intel/Win driver doesn't work well with our emulated
intermediate mode. This patch alters the drawing of the drag widget of
the panels to reduce unneeded drawing.

The previous method would draw 16 boxes per widget. This new way would
cache this drawing in a GPU batch and just move the matrix around.

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D7345
2020-04-06 16:51:48 +02:00
71b1ee940b Don't take into account time remapping when scrubbing with AV sync.
It would cause the playhead to be remapped to an other frame than the
one you clicked on.
2020-04-06 16:34:15 +02:00
Maxim Vasiliev
c544df997e Fix user counting when ungrouping a node group.
Existing code for ungrouping did not correctly handle user counters:

- counter for the group was not decremented
- counters for containing nodes were not incremented

The latter resulted in losing some nodes after orphan cleaning or several save/reload cycles.

The bug did not have destructive consequences until recently,
because it was compensated by another bug (fixed in rBe993667a46c2).

Maniphest Tasks: T74665, T74682

Differential Revision: https://developer.blender.org/D7332
2020-04-06 16:27:52 +02:00
Roman Kornev
95f51bb01d Keymap: sort exported key-maps
This makes the resulting key-maps easier to compare.
2020-04-06 23:37:54 +10:00
3d439aa29b Cleanup: keep parameter docs above the function body 2020-04-06 23:22:11 +10:00
5dde5dd44e Libmv: Use static scheduler for threading
For a real-world distortion the payload is quite uniformly
distributed across scanlines. Surely, in the corners more
iterations of minimizer is needed, but that happens in threads
without scheduling overhead.
2020-04-06 15:18:32 +02:00
7e93d4eea3 Tracking: Fix (un)distortion happen in single thread
Need to communicate available number of threads to the camera
intrinsics implementation, otherwise default value of 1 is used.

Must have been single-threaded for a very long time.
2020-04-06 15:18:32 +02:00
2903fb6929 Fix T75444: typo in tooltip 2020-04-06 15:13:16 +02:00
9ddbb03861 Fix T74111: Animation Playback Delayed With Time Remapping And AV-Sync
When setting the current playback time in BKE_sound_play_scene we didn't
account for the frame length. So the current frame/time would be wrong
when we asked the audio playback what time it was.

This would lead to playback being offset when using time remapping and
AV sync.

Reviewed By: Richard Antalik and Sybren A. Stüvel

Differential Revision: http://developer.blender.org/D7248
2020-04-06 13:57:03 +02:00
ded7af53b4 Fix T74889 Baking to current action doesn't work properly
Before this commit, baking an action would only insert keys that are
necessary (i.e. using `INSERTKEY_NEEDED`). When baking to the current
Action, if there are no constraints that influence the final animation,
there are no additional keys necessary. This makes it appear as if
nothing happened. However, when baking to a new Action every additional
frame is necessary and thus a key is added for every frame.

@mont29 and I agreed that this behaviour is confusing, so this commit
changes the behaviour such that baking to the current action and to a
new action result in the same baked animation (that is, keyed on every
frame).
2020-04-06 13:39:46 +02:00
c03e5e7830 Fix T75418: Outliner Blender File view has UNKNOWN category for armatures
Typo in rB57daecc2cf88.

Maniphest Tasks: T75418

Differential Revision: https://developer.blender.org/D7346
2020-04-06 13:27:23 +02:00
cc0819aee1 Fix (unreported) wrong hair vertex colors
This was already fixed in rB985f33719ce9 once.
But resurfaced after rB7070e4c15e6c [which just reverted a bit too much
;)].

Spotted while looking into T75263.

Differential Revision: https://developer.blender.org/D7308
2020-04-06 12:19:02 +02:00
ccaf6c7404 Tracking: Fix slow undistored display
TH distortion model was not cached properly, making it so frame is
undistorted on every redraw.
2020-04-06 12:16:28 +02:00
5d3c7d1218 usual PY API doc gen fix after adding a new member to Context... 2020-04-06 12:16:07 +02:00
f9c05f3fc0 Fix f-curve sequencer versioning logic
Screen loop was inside an existing screen loop,
in the body of a function used to initialize the toolbar region.
2020-04-06 20:07:05 +10:00
2fc30978bc Fix T75297: Apply base inflates meshes with Simple subdivision 2020-04-06 11:47:17 +02:00
2a2d0d463a i18n: Disable es_ES locale.
We already have generic `es` one, having more only makes sense if poeple
actually maintain them and they have different contents...
2020-04-06 11:23:29 +02:00
3e8a818419 Cleanup: use const for 'clnors' argument where possible 2020-04-05 17:12:10 +10:00
9fe0505db0 Cleanup: macro hygiene, parenthesize arguments 2020-04-05 13:53:32 +10:00
93806ba82b Cleanup: differentiate the evaluation mesh 2020-04-05 12:48:38 +10:00
505a19ed75 Cleanup: Split up Window-Manager VR file (and related changes)
Splits up wm_xr.c into multiple files in their own folder:
source/blender/windowmanager/xr. So this matches how the message bus and
gizmo code have their own folder and files.

This allows better structuring and should make the code scale better.
I rather do this early on than to wait until we end up with a single,
huge file.

Also improves a bit how data is prepared and updated for drawing.
2020-04-04 18:55:24 +02:00
e455536943 UI: 3D Viewport text edit menus
- Adds select menu
- Removes undo/redo controls
- Adds delete menu
- Refactor
- Combines font and text menu

The goal is to match other edit menus better and match the text editor.
2020-04-04 12:41:58 -04:00
a702b095a1 UI: Remove 'Simulation' from 'Fluid Simulation' modifier
This is conistent with other modifiers and is reduntent
with the 'Simulate' menu header.
2020-04-04 12:32:28 -04:00
fe98d8c0ea Cleanup: remove unused method 2020-04-04 14:13:53 +02:00
6fa904765a Cleanup: Rename Panel * variables from pa to panel 2020-04-03 22:20:25 -05:00
7c0e285948 Cleanup: Move Detail Operators and Dyntopo to their own files 2020-04-03 23:41:54 +02:00
17931f3b51 Cleanup: Move Mask Filter and Mask Expand to their own files 2020-04-03 21:46:08 +02:00
f2f30db98d Cleanup: Move Mesh Filter, Smooth and Automasking to their own files 2020-04-03 21:05:54 +02:00
d38023f2f3 fix (unreported): Weld Modifier: possible use of uninitialized variable 2020-04-03 15:09:05 -03:00
82774a9d24 Cleanup: Move all sculpt transform functionality to its own file 2020-04-03 19:42:55 +02:00
d138cbfb47 Code Quality: Replace for loops with LISTBASE_FOREACH
Note this only changes cases where the variable was declared inside
the for loop. To handle it outside as well is a different challenge.

Differential Revision: https://developer.blender.org/D7320
2020-04-03 19:27:46 +02:00
b0c1184875 Cleanup: Including "BLI_listbase.h" for LISTBASE_FOREACH macro
These headers are not needed right away, but will be in the upcoming
commit.
2020-04-03 19:27:42 +02:00
200cc531bd Cleanup: Missing clang format in previous commit 2020-04-03 19:23:05 +02:00
cfc8d73546 Cleanup: Move all Face Set functionality to its own file 2020-04-03 19:17:28 +02:00
63922c5056 Cleanup: Rename ExtensionRNA variables from ext to rna_ext
Makes it more clear that code using this is related to the RNA
integration of a type.
Part of T74432.

Also ran clang-format on affected files.
2020-04-03 18:25:52 +02:00
70b061b4fd Fluid: Refactored caching in main Mantaflow class
This refactor cleans up code for the Manta file IO. It also improves the cache 'Replay' option.
2020-04-03 17:37:37 +02:00
bfdc42d990 Fluid: Refactored MANTA class
Refactored the caching system so that return values are no longer ignored. The aim of this refactor was to make the caching more robust.
2020-04-03 17:37:25 +02:00
d1011c9e64 Cleanup: clarification of 'name' in BKE_idtype functions
The 'name' parameter of `BKE_idtype_idcode_from_name()`, and the `str`
parameter of `idtype_get_info_from_name()`, are expected to be the
'user visible name' of an `IDTypeInfo` struct. This is made clearer in
the code by renaming those parameters to `idtype_name` and mentioning
it in the documentation of the `BKE_idtype_idcode_from_name()`
function.

Differential Revision: https://developer.blender.org/D7317
2020-04-03 16:54:31 +02:00
3208454aa8 Cleanup: Animation, move AnimData API to anim_data.c/BKE_anim_data.h
The `BKE_animsys.h` and `anim_sys.c` files already had a an "AnimData
API" section. The code in that section has now been split off, and
placed into `BKE_anim_data.h` and `anim_data.c`.

All files that used to include `BKE_animsys.h` have been adjusted to
only include the animation headers they need (sometimes none).

No functional changes.
2020-04-03 16:46:48 +02:00
33ab613655 Cleanup: Fix build warning with MSVC
SubdivCCG was unknown when compiling gpuinit_exit.c
2020-04-03 08:29:09 -06:00
49289f31ff Fix T74495: Shrink/Fatten gives strange results with Individual Origins
The island `axismtx` is only necessary in some transform modes.

In the case of `Shrink/Fatten`, the calculated `axismtx` brings an
undesirable result.

This commit rearrange the struct `TransIslandData` in order to
calculate and reference only the arrays that will be used for each
transform mode.

Differential Revision: https://developer.blender.org/D7305
2020-04-03 11:13:42 -03:00
d8b0b8d3db New Undo: Fix crash in some complex production files.
There is no guarantee that depsgraph is ran between two undo steps, so
when re-using an existing data-block we should never wipe completly its
recalc flags, but instead complement them with new ones from accumulated
'storage' as needed.
2020-04-03 16:07:27 +02:00
ad85989a3f Cleanup: Rename bScreen variables from sc/scr to screen
Part of T74432.

Mostly a careful batch rename but had to do few smaller fixes.

Also ran clang-format on affected files.
2020-04-03 14:42:24 +02:00
cff49e625f Cleanup: add missing #includes to some headers
It should be possible to `#include` any header without having to worry
about its dependencies.

I didn't go and check all include files for this, just the ones that caused
me errors while I was refactoring the `anim_sys.c` file.

No functional changes.
2020-04-03 14:28:22 +02:00
905c0269f3 Cleanup: Rename ScrArea variables from sa to area
Follow up of b2ee1770d4 and 10c2254d41, part of T74432.
Now the area and region naming conventions should be less confusing.

Mostly a careful batch rename but had to do few smaller fixes.

Also ran clang-format on affected files.
2020-04-03 13:34:50 +02:00
Asad-ullah Khan
1a69384e76 Fix T74205: crash cancelling transfrom operation in sculpt mode
Differential Revision: https://developer.blender.org/D7018
2020-04-03 13:13:26 +02:00
80513d8574 Fix T75287: other Cycles render passes wrong when using Cryptomatte 2020-04-03 13:13:26 +02:00
82a8da0ec3 Fix T74572: adaptive sampling not scaling render passes correctly 2020-04-03 13:13:26 +02:00
10c2254d41 Cleanup: Continue renaming ARegion variables from ar to region
Continuation of b2ee1770d4, now non-single word variables are also
renamed.
Part of T74432.

Also ran clang-format on affected files.
2020-04-03 12:54:28 +02:00
7ec59cc7b7 Cleanup: split ED_mesh_mirror_*_table into multiple functions
Spatial & topology mirror table each used a single function
taking a char as an identifier.

Split these into begin/end/lookup functions.
2020-04-03 21:52:13 +11:00
b5253159b6 Cleanup: split BKE_anim.h and anim.c into smaller pieces
The files are now split up into the following sections:
- `BKE_anim_path.h` and `anim_path.c` for path/curve functions.
- `BKE_anim_visualization.h` and `anim_visualizationanim_path.c` for
  animation visualization (mostly motion paths).
- `BKE_duplilist.h` for DupliList function declarations. These were
  already implemented in `object_dupli.c`, so they were rather out of
  place being declared in `BKE_anim.h` in the first place.

No functional changes.
2020-04-03 12:13:51 +02:00
736f9f5a69 Fix accidentally reverted changes in VR merge due to merge error
dc2df8307f unintentionally reverted part of 07bdbeda84.
2020-04-03 11:42:27 +02:00
cecb25273e Cleanup: Font, added initialisation for two variables
My compiler (GCC 7.5.0) was warning about these variables potentially not
being initialised. Since the function is highly complex, instead of
analysing it I just trust my compiler and added initial values.

This should be no functional change.
2020-04-03 11:34:25 +02:00
fe7ea8a24c Fix T75250: setting greasepencil active layer not refreshing the dopesheet
This was only reported for the 'Change Active Layer' operator [which was
not setting the channel as selected in the dopesheet], but this is also
the case elsewhere [where BKE_gpencil_layer_active_set is used], namely:
- gp_layer_remove_exec
- gp_layer_copy_exec
- gp_merge_layer_exec
- gp_layer_change_exec
- gp_layer_active_exec
- gp_stroke_separate_exec

We could set GP_LAYER_SELECT "by hand" in
BKE_gpencil_layer_active_set(), but there is already
animchan_sync_gplayer() that does that. For this, we need the
NA_SELECTED notifier though.

Maniphest Tasks: T75250

Differential Revision: https://developer.blender.org/D7311
2020-04-03 10:37:21 +02:00
a2a70cfc41 Cleanup: typo in comment 2020-04-03 10:34:18 +02:00
9aad06db88 Fix T75315: typo in automasking UI text 2020-04-03 10:19:45 +02:00
973e1f9d9a Cleanup: use term 'attr' instead of 'attrib'
This was already the case in most parts of the GPU API.
Use full name for descriptive-comments.
2020-04-03 17:25:58 +11:00
05dcb007e1 Cleanup: use tern 'sync' instead of 'synchronization' for function names
This is a common, unambiguous abbreviation
already used throughout the code-base.
2020-04-03 16:46:34 +11:00
600a627f6e Cleanup: use abbreviated names for unsigned types in editors 2020-04-03 16:21:24 +11:00
04fe37f931 Cleanup: quiet shadow warnings with ghost & mantaflow 2020-04-03 16:15:57 +11:00
71e543c68b Cleanup: replace static list with argument for curve merging 2020-04-03 16:04:02 +11:00
b18608f3e9 Cleanup: bone cursor picking API
There was one function to access both pose/edit bones,
which returned a void pointer type.

Split these into 3 functions which return EditBone, bPoseChannel or Bone
types.

Internally the logic is still shared, this just makes it clearer to
callers which type is expected.

Also use more conventional prefix for picking API:

  - ED_armature_pick_(ebone/pchan/bone)
  - ED_armature_pick_(ebone/pchan/bone)_from_selectbuffer
2020-04-03 15:52:26 +11:00
09071e2799 Fix T75330: Select linked crashes without a bone near the cursor
Own error with recent improvements to select link.
2020-04-03 13:43:03 +11:00
eae40c6c76 Cleanup: improve & use doxy sections for armature_naming.c 2020-04-03 13:16:38 +11:00
d52326bab3 Cleanup: spelling 2020-04-03 12:38:04 +11:00
c154f265de Cleanup: move curve picking functions into 'editcurve_query.c' 2020-04-03 12:32:04 +11:00
6f4dbb661f Revert "Writefile: Cleanup Scene runtime data."
This reverts commit ee0d91df5d. This is
modifying scene data on write, which causes crashes. It can only do that
on a copy of the data.
2020-04-03 02:24:33 +02:00
c4ba0d1508 Fix Linux link error with pcre after recent changes, must use absolute path 2020-04-02 22:05:03 +02:00
75f6e6b39e Fix link error on Linux buildbot with libxml2
On macOS this is part of the collada folder, but for Linux xml2 is in its own
folder for precompiled libraries.
2020-04-02 18:54:58 +02:00
6eb409bb9c Fix warnings caused by own earlier commit
Caused by 34465a7fb0.
2020-04-02 18:46:12 +02:00
12628e0794 Fix Cycles AVX unit test still failing to build with old GCC 2020-04-02 18:19:49 +02:00
Pablo Dobarro
b8d9b5e331 Sculpt: Delay Viewport Updates
In Blender 2.81 we update and draw all nodes inside the view planes.
When navigating with a pen tablet after an operation that tags the whole
mesh to update (like undo or inverting the mask), this introduces some
lag as nodes are updating when they enter the view. The viewport is not
fully responsive again until all nodes have entered the view after the
operation.

This commit delays nodes updates until the view navigation stops, so the
viewport navigation is always fully responsive. This introduces some
artifacts while navigating,  so it can be disabled if you don't want to
see them.

I'm storing the update planes in the PBVH. This way I can add support
for some tools to update in real-time only the nodes inside this plane
while running the operator, like the mesh filter.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D6269
2020-04-02 18:00:51 +02:00
34465a7fb0 VR: Refactor DirectX context management
All DirectX management happens on Ghost level now, higher level code can
just assume everything is OpenGL (except of the upside-down drawing that
still needs to be done for DirectX). This is similar to how the
metal-layer is hidden outside of Ghost.

The Ghost-XR graphics binding for DirectX is responsible for managing
the DirectX compatibility now.
2020-04-02 17:43:45 +02:00
868d4526a8 Fix more build errors/warnings after recent AVX changes
Thanks to Sergey and Ray for the help identifying the problem.
2020-04-02 17:30:56 +02:00
343a874831 add memory address to undo steps print.
Helps identifying who is what in debugger...
2020-04-02 17:22:44 +02:00
9672605938 Fix build error on Windows/Linux after recent AVX changes 2020-04-02 17:09:01 +02:00
5159ba6b33 Fix (harmless) PCRE not found warning when configuring CMake on Linux
Differential Revision: https://developer.blender.org/D7309
2020-04-02 17:09:01 +02:00
2aa938b0ae Cleanup: simplify Linux buildbot config, where default values already match
Ref D7309
2020-04-02 17:09:01 +02:00
1f745e2c72 Sculpt: Add global automasking options for all brushes
This adds the automasking options to the Sculpt Tool options in a way
that they affect all brushes. This is more convenient when working with
some of these options while switching brushes as they don't need to be
enabled/disabled per brush.
An automasking option is enabled if it is enabled in the brush or in the
sculpt options.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D7304
2020-04-02 16:56:44 +02:00
e276558a50 Fix T74983: Material preview icons don't refresh
The root cause of the issue reported in T74983 is that an `IDNode` would
not be marked as user-modified. This marking happened while looping over
outgoing relations of one of its operation nodes. Since rBff60dd8b18ed
unused relations are removed, and as a result the `IDNode` would not be
marked.

The solution was to move the responsible code outside the loop; this is
probably a good idea anyway, as the code did not actually use the
looped-over relations at all, and was thus repeated unnecessarily.
2020-04-02 16:54:17 +02:00
b75a7c2f8f Fix T75302: GPencil fill does not work on python generated strokes 2020-04-02 16:48:00 +02:00
e6c732e0cb GPencil: Cleanup typo error for hardness
The variable cannot be names because it was already renamed.
2020-04-02 16:48:00 +02:00
7c88968c89 Scultp: Face Set boundary automasking
With this brush option it is possible to mask the boundary vertices of
all face sets. This is especially useful in the cloth brush, where face
sets can be used to simulate seams between different patches of cloth
and produce different patterns and effects.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D7230
2020-04-02 16:42:20 +02:00
3dad6294da Sculpt: Store explicit value for multires sculpt level
Allows to know what level sculpting has been done after the value has
been changed in the MultiresModifierData.

No functional changes, just preparing code to have everything needed
for propagation undo.

Differential Revision: https://developer.blender.org/D7307
2020-04-02 16:32:33 +02:00
f868d51bdd Sculpt Undo: Allow Geometry undo step to be non-exclusive
Before this change it was not possible to have base geometry
and grid coordinates to be stored in the same undo step.

Differential Revision: https://developer.blender.org/D7298
2020-04-02 16:29:51 +02:00
009dde69cd Fix Face Sets painting and selection precision
This fixes the following issues:
- Previously, the face set from the active vertex was used directly. Vertices always return the most recently created face set, so in some cases there may be some face sets that were not possible to select as active. Now the active face set is set in the ray intersection, so it always matches the face under the cursor.
- When drawing face sets they were set per vertex, so it was not possible to paint one face at a time. Now face sets are painted per poly when using the brush on meshes, testing the distance to the center of each poly.
- The code for the active vertex on PBVH_GRIDS was not correct, so I also fixed that to test if everything was working correctly.
{F8441699}

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D7303
2020-04-02 15:43:37 +02:00
6cc4c68dad Fix T75121: Memory leak in Surface Smooth
The brush was allocating new memory for storing the displacemnets at the
beginning of each stroke step and not freeing them.

Reviewed By: jbakker

Maniphest Tasks: T75121

Differential Revision: https://developer.blender.org/D7254
2020-04-02 15:36:10 +02:00
43f748a32f Fix mesh boundary automask curve falloff
As the main use case of this feature is to work with cloth, using this
curve makes more sense than a smoothstep to simulate cloth tension near
the edges.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D7262
2020-04-02 15:35:12 +02:00
b26bebd59f Missed file in previous commit 2020-04-02 15:32:17 +02:00
88362565f6 Fix T72688: Vertex Group Weights in Edit Mode Occludes In Front Armatures
Due to legacy this overlay was implemented twice (Edit Mesh and Weight
Painting) with different results. This patch consolidates both drawing
and uses only the Weight Painting drawing.
2020-04-02 15:12:32 +02:00
f5e4f20dc1 Fix: Build error when building with python off 2020-04-02 07:08:51 -06:00
fa8a3c8f26 Revert "Fix T72688: Vertex Group Weights in Edit Mode Occludes In Front Armatures"
This reverts commit 782e6ea4ed.

Said fix introduced a crash the moment one goes to edit mode.
2020-04-02 15:07:56 +02:00
7bffdab93c CMake: Add alembic boost dependency
When building lite + alembic + boost cmake would turn
boost off because it deemed it not needed leading to
build errors.
2020-04-02 07:03:36 -06:00
53d029d6da Cleanup: Avoid complex template type for XR-Swapchain
I rather avoid types like
`std::vector<std::unique_ptr<GHOST_XrSwapchain>>`, which is easy to do
in this case.
2020-04-02 13:50:27 +02:00
782e6ea4ed Fix T72688: Vertex Group Weights in Edit Mode Occludes In Front Armatures
Due to legacy this overlay was implemented twice (Edit Mesh and Weight
Painting) with different results. This patch consolidates both drawing
and uses only the Weight Painting drawing.

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D7289
2020-04-02 11:49:39 +02:00
1c3ded12f4 Fluids: improve subframe handling
Reviewers: sebbas

Differential Revision: https://developer.blender.org/D7256
2020-04-02 10:34:05 +02:00
06cb321f33 Sculpt: Give a brief explanation of undo stack
Should make it a bit more clear overview of what is going on in this
module. While some of the details might still be missing, having some
sort of top-level overview is better than nothing.

Differential Revision: https://developer.blender.org/D7300
2020-04-02 09:39:38 +02:00
3ebebe62d7 Sculpt Undo: Fix multires undo for interleaved nodes
Made it so grids array is properly allocated when first node in the
undo list does not contain grid data.

Differential Revision: https://developer.blender.org/D7299
2020-04-02 09:38:26 +02:00
a9963669f9 Fix T75283: GPencil Stroke created by Merge points can't have fill material 2020-04-01 19:35:35 +02:00
c4374bc919 Fix T75271: GPencil Segment select mode doesn't work
The selection was workring with the evaluated data, but need work with the original data.
2020-04-01 18:00:49 +02:00
25b2b6724d Fix T74224: Add missing depsgraph relations for boid particles
Reviewers: brecht

Differential Revision: https://developer.blender.org/D7302
2020-04-01 16:21:34 +02:00
f047d47e24 Cycles: AVX implantation of Perlin noise.
This patch adds an AVX implementation of Perlin noise in Cycles.
An avxi type was also added as a utility based on the respective
type in Intel Embree.

Only 3D and 4D noise were implemented, there is no benefit for
utilizing AVX in 1D and 2D noise. The SSE trilinear interpolation
function was used in the AVX implementation because there is no
benefit from using AVX in interpolating the last three dimensions.

Differential Revision: https://developer.blender.org/D6680
2020-04-01 14:48:01 +02:00
5e176d67e1 Writefile: Cleanup Volume runtime data. 2020-04-01 12:39:06 +02:00
d66519f197 Writefile: Cleanup CacheFile runtime data. 2020-04-01 12:39:06 +02:00
d31f79a9bc Writefile: Cleanup MovieClip runtime data. 2020-04-01 12:39:06 +02:00
1f065df03e Writefile: Cleanup GPencil data.
Note: Not clearing the whole runtime data here, as this is not done in
matching read code, not sure why, needs further investigation...
2020-04-01 12:39:06 +02:00
ec351c7a65 Writefile: Cleanup Nodetree runtime data.
Note: As with collections, this does not affect embedded nodetrees from
material etc. We prpbably need to tackle those as well at some point...
2020-04-01 12:39:06 +02:00
e0dc4130fd Writefile: Cleanup Armature runtime data. 2020-04-01 12:39:06 +02:00
358f8b484f Writefile: Cleanup Collection runtime data. 2020-04-01 12:39:06 +02:00
e24553ca0f Writefile: Cleanup Soung runtime data. 2020-04-01 12:39:06 +02:00
8d63135da3 Writefile: Cleanup World runtime data. 2020-04-01 12:39:06 +02:00
254748c3e7 Writefile: Cleanup Lattice runtime data. 2020-04-01 12:39:06 +02:00
4f509db181 Writefile: Cleanup Text runtime data. 2020-04-01 12:39:06 +02:00
33a622cbf4 Writefile: Cleanup VFont runtime data. 2020-04-01 12:39:06 +02:00
e790aa1f19 Writefile: Cleanup material runtime data. 2020-04-01 12:39:06 +02:00
27b9f1f626 Writefile: Cleanup MBall runtime data. 2020-04-01 12:39:06 +02:00
ee0d91df5d Writefile: Cleanup Scene runtime data. 2020-04-01 12:39:06 +02:00
9532ce4605 Writefile: Cleanup Object runtime data. 2020-04-01 12:39:06 +02:00
80280acc93 Writefile: Cleanup Curve runtime data. 2020-04-01 12:39:06 +02:00
3fab8acfd8 Embed simulation node tree in simulation data block
This also shows the node tree in the Simulation Editor.
There is a new operator to add a simulation.

One debatable aspect of this patch is how I integrated the `SpaceNodeEditor.simulation`
property in RNA. I decided to wrap the existing `id` property, because the description
says `Data-block whose nodes are being edited`, which is exactly what is happening here.

Differential Revision: https://developer.blender.org/D7301
2020-04-01 12:17:03 +02:00
ca0dcd830c Fix T75222: Crash activating menu search 2020-04-01 20:59:50 +11:00
186ac84210 Cleanup: clang-format 2020-04-01 20:47:02 +11:00
78b545f1fe better handling when id has wrong type 2020-04-01 11:44:02 +02:00
cbf3f46ffd better support for building without simulation type 2020-04-01 11:34:13 +02:00
fcc4a68482 show some builtin nodes in menu 2020-04-01 11:31:06 +02:00
b344800177 support adding new simulation from header 2020-04-01 11:27:39 +02:00
bd690a4d57 cleanup simulation property of space 2020-04-01 11:16:24 +02:00
b11de611d0 Merge branch 'simulation-tree-arc' into embedded_simulation_node_tree 2020-04-01 10:56:24 +02:00
6fda1d007f add license headers 2020-04-01 10:52:39 +02:00
60ff3a7daf Fix T66494: Alt+ clicking (assign to all selected) does not work for NLA
strips

This uses the new "selected_nla_strips" context member in
UI_context_copy_to_selected_list().

bonus: this also makes the "Copy To Selected" button operator [in the
button context menu] work for anything NLA Strip related.

Maniphest Tasks: T66494

Differential Revision: https://developer.blender.org/D7281
2020-04-01 10:24:16 +02:00
f8c4f5e308 Add a "selected_nla_strips" context member
Needed for upcomming fix for T66494.

ref T66494 / D7281
2020-04-01 10:22:34 +02:00
029a714fc7 Fix T75234: Saving UDIM tiled texture as OpenEXR saves only the first
tile

This happened when the UDIM tiled image needed to be colormanaged, so
- when you set up the image as sRGB, then save as EXR/HDR/...
- other way around as well: when you set up the images as Linear then
save as PNG/JPG/...

Reason being that for UDIM tiled images, `image_save_single` is called
multiple times [once for each tile] and everytime `image_save_post` will
fire the `IMA_SIGNAL_COLORMANAGE` signal which clears the cache if any of
the above two is the case. Without the cache, the next tiles cannot be
saved.

Now determine if the colorspace changed from
`image_save_single`/'image_save_post' and only fire
IMA_SIGNAL_COLORMANAGE once from BKE_image_save in the end.
(thx @brecht for suggesting this alternative to the original fix)

Maniphest Tasks: T75234

Differential Revision: https://developer.blender.org/D7296
2020-04-01 10:11:54 +02:00
59e001cbf6 GPencil: Cleanup typo error 2020-04-01 10:02:04 +02:00
Bastien Montagne
2ad0ae8dad Tweak write code to allow cleaning up runtime data before write.
This basically generalizes what was being done in `write_mesh`,
since we need to clean up ID tags anyway, it's easier to do it for all IDs.

Then ID write funcs themsleves can do whatever they want on the passed
struct, without risking interferring with regular Blender operations.

Note that Text write function is doing a suspicious change on one of its
flags, but this seems to be by-passed anyway by read code currently, so
think it's OK to not do that on orig data-block.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D7294
2020-04-01 09:43:21 +02:00
7952274cf0 Sculpt Undo: Refactor Geometry undo nodes
Made it so there is a single UNDO node in the list which has
both original and modified mesh state.

Makes it easier to achieve "interleaved" undo nodes stored in
the undo step (as opposite of either storing geometry or other
data).

Should be no functional changes, just preparing for an upcoming
work to support undo of operation like Apply Base.

Differential Revision: https://developer.blender.org/D7290
2020-04-01 09:39:58 +02:00
60d3a801db Subdiv: Split evaluation begin+refine into separate steps
Actually, begin will do the entire initialization.

Refine will only refine if there is a topology refiner associated
with the Subdiv descriptor.

Allows to refine Subdiv to new coarse positions without touching
displacement evaluation. Will be needed to update SubdivCCG during
sculpt undo.
2020-04-01 09:32:46 +02:00
29eb891658 Fix curve shortest path picking with right-click select 2020-04-01 17:33:24 +11:00
9bcc83a5d6 Fix problem extruding curve segments with selected handles
Issue introduced in 38685b5a39
2020-04-01 17:08:41 +11:00
8d116e9956 Cleanup: use doxy sections 2020-04-01 16:19:32 +11:00
b157abebe5 UI: avoid term 'Region', use 'Edges & Faces' instead
Change to recent renaming of "Edge Collapse" as it has multiple uses,
as it collapses edge-rings, but isn't limited to collapsing single edges,
it can be used to collapse faces with arbitrary topology.

The name "Collapse Regions" is too vague, users might not think to use
this to collapse edge-rings.

Use a more verbose name "Collapse Edges & Faces", referencing edge-rings
in the tool-tip.
2020-04-01 14:18:21 +11:00
b7868c0b89 Grease Pencil: Fix typo in labels and comments.
Hardeness -> Hardness

Only changed the labels/tooltips, will leave the internal change to @antoniov.
2020-04-01 03:52:58 +02:00
6a1f0c1eaa Cleanup: use doxy sections for 'idprop' API 2020-04-01 11:30:08 +11:00
2d39e46f84 Cleanup: use doxy sections for wm_draw.c 2020-04-01 11:30:08 +11:00
9b0d72aa3d Cleanup: use sections for object_remesh.c
Add missing sections.
2020-04-01 11:29:45 +11:00
18fc4155fd Fix customdata interpolation being done multiple times in Weld Modifier 2020-03-31 20:57:33 -03:00
bcd3c3cb57 UI: rename "Edge Collapse" to "Collapse Regions"
This is useful for collapsing regions of faces & edges,
similar to a 'Merge -> Collapse' which can operate on multiple regions,
merging UV's so they don't need to be manually corrected.

The name & description didn't mention this.
2020-04-01 10:50:21 +11:00
91604279c9 Fix missing break statement in recent face-set support 2020-04-01 10:50:21 +11:00
f9f0f44be8 Cleanup: quiet discarded-qualifiers, unused warnings 2020-04-01 10:50:21 +11:00
e819f67500 Cleanup: Organize Weld Modifier in alphabetical order 2020-03-31 20:39:37 -03:00
74b5e5f6e1 Fix T74588: Weld Modifier: Vertex colors and UVs get incorrect values 2020-03-31 20:27:54 -03:00
da3cb514e5 Multires: Initial Face Sets support
This implements the Sculpt Mode API functions needed for Face Sets and
visibility management for PBVH_GRIDS. No major changes were needed in
the operators and the sculpt mode code. This implementation stores the
face sets in the base mesh, so faces created in higher subdivision
levels can't be modified individually. Also, we are not checking for
multiple face sets per vertex (that can be added in the future), so
relax tools don't work yet. The rest of the features (paint, undo,
visibility operators..) work as expected.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D7168
2020-04-01 01:07:47 +02:00
0062813c73 make.bat: Improve messaging when not detecting MSVC
Inspired by @mrwhite in D7295
2020-03-31 13:14:16 -06:00
5b88ab25bd Fix T75219: Move to New Layer not working
This was an old design problem.
2020-03-31 18:54:50 +02:00
6c036a65c9 Add Voxel Mode to the Remesh modifier
This adds the Voxel Mode to the current remesh modifier. It works
exactly the same way as the voxel remesh operator and uses the same
properties to control the remeshing. We can exand this with more options
in the future (fix poles, reprojection...)

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D7292
2020-03-31 18:27:37 +02:00
38685b5a39 Edit Curve: Improve Curve extrude
The original code has two logics, extrude the end points or duplicate points (making new splines).
Now all the logic has been redone by extruding contiguous selected segments.

Fix T47169

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D6982
2020-03-31 12:39:53 -03:00
1c1a14dcdf Voxel Remesh: Edit Voxel Size operator
This operator lets the user control the voxel/detail size of the voxel remesher directly from the 3D view in a similar way the Brush radius and strength are controlled.  The shorcut from sculpt mode is Shift + R (similar to Shift + F for brush strength).
It shows a grid that represents the real voxel size of the object. The grid and the text are automatically aligned to the view to avoid rendering all voxels with thousands of lines.

It also has a slow mode when pressing shift that works like the slow mode of the brush radius control.

This operator controls the value changes sensitivity automatically to avoid jumping to extremelly high resolutions and run out of memory.
This way, adjusments done in lower voxel sizes are more precise. Pressing Ctrl disables this functionality and allows changing the voxel size directly in a linear way.

Reviewed By: jbakker, #user_interface, billreynish

Differential Revision: https://developer.blender.org/D6449
2020-03-31 17:31:13 +02:00
f149d5e4b2 Fix VR session toggle not changing reliably on session start/end
The text and icon were supposed to change but didn't reliably, which was
a race condition I think. It depended on how fast the OpenXR runtime
would transition the session state.
This also makes sure the correct notifier is sent on session exit.
2020-03-31 16:49:38 +02:00
afe707cc3a Fix missing XR space destruction
I think destructing the XrSession would destruct this anyway, but rather
have this done explicitly, consistently and in a controlled manner.
2020-03-31 16:49:38 +02:00
b0bd9b4c70 Fix T75244: Screw Modifier Crash
Draw batch extraction wrongly assumed that when mapped extraction
happened that all original data could be found. This is not the case as
mapped extraction is also enabled when part of the data is present.

This fix does additional nullptr checks.
2020-03-31 16:05:19 +02:00
8b08366e32 initial node tree embedding and simulation editor 2020-03-31 14:05:58 +02:00
39684e4554 Cleanup: remove duplicate function 2020-03-31 22:37:25 +11:00
17a409e223 Cleanup: use '_recursive' suffix instead of '_rec'
This convention isn't very clear and wasn't used much.
Use the more verbose term instead.
2020-03-31 22:23:33 +11:00
456c7f2f90 Add simulation node tree type
This implements a new builtin node tree type called `SimulationNodeTree`.
It is not yet embedded in the `Simulation` data block.

This is part of T73324.

The `WITH_NEW_SIMULATION_TYPE` cmake option is used to control whether `Simulation Editor` is shown in the editors menu.
Disabling the rna code with this option was a bit tricky, because the node tree type stores a reference to the rna type.
I could do the `#ifdef WITH_NEW_SIMULATION_TYPE` everywhere, but I'm not sure if it is worth the effort.

Currently there is only the group node, which is unusable, because there are no other nodes.
I'll submit those for review separately.

Differential Revision: https://developer.blender.org/D7287
2020-03-31 12:27:41 +02:00
b74e388617 Fix T75210: Frame range does not go down to 0 in the physics tab for mantaflow when clicking the left arrow
Added nore flexibility to cache frame range and ensured validity of frame range.
2020-03-31 12:18:15 +02:00
155f917403 Fix T73513: Facing Overlay Intervene With Selection
Do not draw the facing overlay during selection.
2020-03-31 11:47:09 +02:00
d8217ec6d0 UI: improve names for mesh split operations 2020-03-31 19:45:26 +11:00
039d619c76 Fix T74898: Multiresolution Ghost After Orbiting
EEVEE and Workbench both had the same issue that they continue with the
last sample when leaving navigating. This is ok for regular meshes as
they are all the same. For multiresolution it ain't as a low res version
of the mesh is used during navigation.

This patch also resets the AA samples when the user leaves navigation.
2020-03-31 10:29:34 +02:00
ebecd0aae5 Merge branch 'master' into simulation-data-block 2020-03-31 09:40:01 +02:00
24f8c8491d UI: group edit-mesh Separate with Split & Merge
This was already the case for curve & armature.
2020-03-31 18:21:21 +11:00
c1722a3a8c Keymap: 'M' for edit-mesh merge menu, 'Alt-M' for split menu
As the 'M' key is free, it's convenient to use for the merge menu,
especially since this contains "Merge by Distance",
a frequently used action.

Use 'Alt-M' for a new split menu, following our convention of Alt being
used for opposite functionality.

Also move merge/split menu's into the "Mesh" menu as neither operate
solely on a single mesh element type.
2020-03-31 18:21:21 +11:00
61f9bbbdea Edit Mesh: support splitting vertices
The edge split operator can now split faces & edges
from selected vertices.

This has the same functionality as manually ripping all
faces and edges away from a vertex.
2020-03-31 18:20:06 +11:00
07add4b485 Cleanup: use sections for armature-select 2020-03-31 15:24:06 +11:00
0f5c94bbd1 Armature: add Select Linked (Ctrl-L)
This matches select linked for other modes (curve, mesh)
2020-03-31 15:11:11 +11:00
b555b8dedc Build: hide most symbols on macOS on Linux to avoid conflicts
This means symbols from Blender itself and most external libraries. We can't
just hide all because that breaks some libraries. The better solution would
be to rebuild all library dependencies with hidden visibility.

Fixes T75223: Luxrender add-on failing to load on macOS
2020-03-31 00:07:55 +02:00
899bfdc412 Audaspace: Update From Upstream (For API Docs)
No functional changes:

- Cleanup Spelling, Line Length
- Use proper class method styling for py docs
- Fix Broken Links

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

Fixes T75191
2020-03-30 17:47:40 -04:00
22677d8e1d Fix undo incorrectly detecting mesh as always changed after edits
Mesh writes a modified copy, which meant recalc_undo_accumulated was never
cleared on the actual datablock. Also clear mesh->runtime on write to avoid
detecting changes, since it's cleared on read anyway.

Differential Revision: https://developer.blender.org/D7274
2020-03-30 20:09:15 +02:00
f4982b555c Fix undo misdetecting identical future chunk in some cases
Clear is_identical_future before adding a next undo step, to avoid wrong
values for cases where we undo and then add a step with different changes
than what was previously the next step.

Ref D7274
2020-03-30 20:09:20 +02:00
2e60226f23 Fix undo debug logging not printing all types of undo pushes
Ref D7274
2020-03-30 20:09:15 +02:00
91b334b2f2 Fix T74547 EEVEE: Image texture crash with use after free
Same fix than for the other mapping types.
2020-03-30 19:57:24 +02:00
248873603f GPencil: Remove is_edit_mode from cache data
This value is not used by new engine.
2020-03-30 18:56:46 +02:00
4c40468856 GPencil: Remove GP_DATA_PYTHON_UPDATED used by old engine 2020-03-30 18:54:41 +02:00
2c9e27f209 Fix T75144 Grease Pencil: Python generated strokes flicker and crash
This was caused by a flag not being reset in time, causing discard of
batches already queued to be drawn.
2020-03-30 18:38:15 +02:00
100896e080 GPencil: Rename Overlay blend mode to Hard Light
Differential Revision: https://developer.blender.org/D7280
2020-03-30 18:23:36 +02:00
6428da84ed Fix T74663 GPencil: Fills are Flickering on Nvidia
This was caused by an unitialized variable.
2020-03-30 17:57:31 +02:00
af1e3b0270 GPencil: Fix overlay blend mode creating inverted colors 2020-03-30 17:57:31 +02:00
9371c051b1 EEVEE: Bloom: Fix inverted source and base buffer
This does not change the ouput much.
2020-03-30 17:57:31 +02:00
6f15bc3b52 Fluid: Removed Empty Space option for liquid domains
The option only makes sense for gas domains where there is some density.
2020-03-30 17:34:16 +02:00
1280f3c0ae Fluid: Optimization for mesh file loading
Improved loading times for mesh files by reading bigger chunks of data from the disk at once.
2020-03-30 17:32:38 +02:00
a2d19c1f78 NormalOverlay: Center Dot Normal Drawing With Modifiers
When using generative modifiers too many center dots were rendered in
the normal overlay. This patch only renders the normals of original
center dots.

Known issue: decoding the `norAndFlag` has issues on Intel GPU.
2020-03-30 14:39:16 +02:00
57d8bde088 Normal Overlay: Hide Normals Of Generated Loops
The loop normals were always drawn. We used to only draw the normals if
it was mapped to an original loop of the mesh. Due to recent changes we
can not find the correct loop and decide if we need to draw them.

Note still need to check the face dots normals. This is more complicated
as facedot normals needs to be encoded in a different way
2020-03-30 14:06:54 +02:00
a6a9a12e8f Fix T75142: No autokeying with pose mode X-Mirror
This was caused by the removal of some `BONE_TRANSFORM_MIRROR` flag
handling in rBde530a95dc7b482dc22c933b9b8b2a98c79b5663. I simply
restored those lines that caused this issue.
2020-03-30 13:26:26 +02:00
ef7229d69a Cleanup: reduce code indentation in autokeyframe_pose()
This makes the code a bit simpler to follow, by replacing
`if (x) { all the code here }` with `if (!x) { continue; }` and un-indenting
the remaining code, and by returning early.

No functional changes.
2020-03-30 13:26:26 +02:00
cf258b02f4 Fix T75053: Paint Overlay Show Modified Wires and Edges
The paint mask overlay showed the wires and edges of the final mesh.
This change will only draw wires and edges that are mapped to the
original mesh.

This change enables mapping data in regular Mesh extraction. This
can also be used for better drawing of the normal overlay.

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D7277
2020-03-30 13:13:42 +02:00
d6e0d27816 Fix help message misc argument grouping
Correct reference to non-existent argument.
2020-03-30 21:47:07 +11:00
3351a2655d Subdiv: Extend some comments 2020-03-30 12:26:45 +02:00
513885a991 Fix armature edit-mode selected linked
Selecting linked would only select a single arbitrary chain.

Now select linked follows all child-chains of the bone.

Also add support for following all links, similar to how this would work
if it were a mesh with connected edges instead of only child chains.

Leave this off by default to match pose mode.
2020-03-30 19:18:28 +11:00
15cb567c8e Armature: remove merge function, use dissolve instead
This was crashing, when looking into a fix I noticed that it gave
hap-hazard results dissolving past forks in the parent/child hierarchy
arbitrarily following one chain.

This functionality is almost identical to "dissolve" which delimits
forks in the chain predictably.

So remove this in favor of dissolve (available from the delete menu).
2020-03-30 19:18:09 +11:00
6462ea2a8d UI: center align icon-only pull-down menus
Resolve issue noted in D5482, texture slots '+' icon for example
was noticeably off-center.
2020-03-30 14:45:05 +11:00
7b347b225a Cleanup: remove print left in recent fix for T66655 2020-03-30 14:34:32 +11:00
ec3da20896 UI: use operator name for extrude repeat
Match names between the redo popup and the menu item.
2020-03-30 11:41:44 +11:00
9ccaf9899e Extrude Repeat: support storing the offset vector
Without this, adjusting properties always re-initialized
from the view-vector.
2020-03-30 11:41:35 +11:00
e252d2c990 Fix extrude repeat leaving selection history unselected 2020-03-30 10:39:10 +11:00
6b24f7d87c UI: move extrude repeat out of the vertex menu
This works for all selection modes,
include last below a separator since it's a specialized function.

Note that the previous commit was raising an exception as operator
properties don't support 'or'.
2020-03-30 10:29:32 +11:00
086bfffe74 Theme: adjust lamp alpha to visually match 2.82 2020-03-30 10:12:08 +11:00
6c48a36962 DRW: match edge opacity to 2.82
Edges were hard to see in some cases in edit-mesh vertex/face modes.

Since 804e90b42d alpha is handled differently,
update edge alpha to visually match 2.82.
2020-03-30 10:12:08 +11:00
a103d09df4 UI: Move Array Extrude Below Verticies 2020-03-29 17:36:34 -04:00
7d59f84708 Fluid: Optimization for liquid / secondary particle file loading
Improved loading times for particles files by reading bigger chunks of data from the disk at once.
2020-03-29 21:31:20 +02:00
b023c91118 Fluid: Use dynamic mode whenever active rigid bodies are in the scene
Required for collisions with moving rigid bodies. Otherwise the static optimization mode will be kept and the obstacles would be calculated only once at the beginning.
2020-03-29 21:31:20 +02:00
bf3b0db785 Overlay: Edit Mesh: Add offset for thicker edges
Edges with sharpness, seam and bevel are thicker and thus needs more offset
to not appear aliased.

Based on D5448 by @oficsu
2020-03-29 20:49:07 +02:00
0b57ecc665 Overlay: Edit Mesh: Make offset depth dependent (w.r.t depth precision)
The previous offset was done in view space. It is now done in NDC space
to avoid differences when adjusting the near/far plane distances.
2020-03-29 20:46:42 +02:00
a022cb8f62 UI: Add missing operators to menus in the 3D Viewport Mesh Edit mode
Differential Revision: https://developer.blender.org/D7263
2020-03-29 14:09:39 -04:00
bd74f5f7ab Fix T73945: Don't grey out "Calculate to Frames" in some cases
The button seems to behave more as I'd expect without these
additional checks. Previously, the button was often grayed out when
it was actually working.

Reviewers: ISS

Differential Revision: https://developer.blender.org/D7252
2020-03-29 15:09:42 +02:00
Wayde Moss
5b8b6b4c1e RNA: expose the pin flag for AnimData and ActionGroup 2020-03-29 23:05:30 +11:00
Henrik Dick
d8e2cc9f4d Fix missing Surface Deform strength versioning 2020-03-29 22:52:06 +11:00
Yevgeny Makarov
a3d5b949d2 UI: Fix text padding for labels without an icon 2020-03-29 22:47:59 +11:00
c6143da27c Cleanup: remove DNA_view2d_types.h from DNA_sound_types.h 2020-03-29 20:32:45 +11:00
Henrik Dick
fc37318fe7 Screw Modifier: support 1-2 steps
The Screw Modifier had a lower limit for the steps value, which not only
was inconsistent between render and viewport steps, but also was capped
to 2 in UI and also in the code internally.
2020-03-29 20:25:14 +11:00
Cody Winchester
e8dd6128b5 Fix warp modifier using pose matrix without object matrix applied
Error in recent patch D6820
2020-03-29 18:58:37 +11:00
b9faf53182 Fix T72075: Incorrect Grid Fill error message 2020-03-29 18:36:00 +11:00
424fed3cc7 Cleanup: remove unicode character printing
Was added when utf8 was originally introduced - for testing,
but is no longer needed.
2020-03-29 17:11:46 +11:00
aec9e0e1b6 Cleanup: spelling, comments 2020-03-29 17:11:41 +11:00
d5163e06c3 Cleanup: strict-prototypes warning 2020-03-29 16:37:57 +11:00
ac02c702e5 Fix T75156: Cast modifier crash in edit-mode
Add NULL checks to other deform modifiers too.
2020-03-29 16:09:09 +11:00
a24f52c51c Fix T75088: Add tooltips for custom properties 2020-03-28 16:40:49 -04:00
a882debee0 Fix T75161: Random UV doesn´t work with fats drawing
Also fixed T75162
2020-03-28 15:08:13 +01:00
7dbf7255c2 GPencil: Fix error when stroke has 0 points
It's possible create a stroke with 0 points using python
2020-03-28 12:33:32 +01:00
bdec24b40d Cleanup: Removing unused parameter. 2020-03-28 09:14:07 +01:00
10bd3fb4cb Fix T74604: A.N.T Landscape Erode function reports error
Although indicated, the `rna_Object_active_vertex_group_set`
function was missing.
2020-03-27 22:14:47 -03:00
79b391f3a0 Fix missing NULL terminator for new brush option 2020-03-28 02:08:06 +01:00
Asher
e0030d53bc Fix key detection issues introduced by D7229
Removing the GHOST_kKeyUnknown check from processKeyEvent() produces
epeated unknown key events whenever a modifier key is held down, due
to the way ghost uses GHOST_kKeyUnknown as a filter value for modifier
key events.

Differential Revision: https://developer.blender.org/D7257
2020-03-27 20:59:20 -03:00
1f949121cd Fix T74969: Crash in gpencil edit mode
Result of poor shader pre-processing on Intel HD 4000 drivers
2020-03-27 20:12:05 -03:00
90aa771b30 Cleanup: compiler warnings 2020-03-27 23:21:16 +01:00
d85026db15 Overlay: Outline: Fix unreported feedback loop when smooth wire is disabled 2020-03-27 20:11:43 +01:00
a7110618ff Cleanup: GPUShader: Remove unused shaders 2020-03-27 20:00:27 +01:00
Ankit
0c0170f77a Fix error in macOS system file detection in recent changes
Differential Revision: https://developer.blender.org/D7250
2020-03-27 18:56:58 +01:00
9120191fe2 Sculpt: Pose Brush Face Sets origin mode
This commit introduces a new mode for calculating the positions and
weights of the IK segments in the Pose Brush based on the Face Sets.

The first segment of the chain will always include all face sets inside
the brush radius and it will propagate until the boundary of the last
face sets added in the flood fill. Then consecutive connected face sets
are added to the chain until the chain length limit is reached or all
face sets of the mesh are already part of the chain.

This feature enables complete control over the pose brush origins in
case that is needed. Also, with this mode, the user can have a library
of base meshes with face sets already configured to get to the initial
pose as fast as possible.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D7235
2020-03-27 18:15:42 +01:00
4c0cca78eb Rename Edge Automasking to Mesh Boundary Automasking
This makes more clear what this automasking operation does and helps to differenciate it from the future face sets boundary automasking.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D7185
2020-03-27 18:05:10 +01:00
015c084bda Sculpt: Weight normal and area sampling towards the brush center
Previously, all vertices inside the brush radius were taken into account
equally when calculating the sculpt normal and area. This was causing
artifacts and unpredictable results with large brushes or meshes with
curvatures, as the strongest deformation point of all brushes is usually
in the center. By weighting the vertex normal and position towards the
center when sampling, all brushes should now behave in a more
predictable way in non-uniform surfaces.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D6989
2020-03-27 17:55:00 +01:00
7eacda5a2b Fix T74637: Reset face set data when disabling dyntopo
Last time I checked Face Sets were preserved in a more or less
predictable way when modifying the mesh with dyntopo. As it looks that
in some problems this may cause bugs and you can't see or use face sets
when modifying the topology of the mesh whith dyntopo active, it is
probably better to reset them when going from dyntopo to mesh. This way
you know that you are always going to get a predictable face sets state.

Reviewed By: jbakker

Maniphest Tasks: T74637

Differential Revision: https://developer.blender.org/D7099
2020-03-27 17:52:00 +01:00
0db055338a GPencil: Small tweaks to Fill material panel 2020-03-27 16:38:22 +01:00
671d811323 Install_deps: Do not wipe out WITH_PYTHON CMake options.
This is annoying when one want to use system python and hence disables
the `WITH_PYTHON_INSTALL` options...
2020-03-27 15:46:47 +01:00
Mateusz Grzeliński
0a02c288aa install_deps: Enable PIC in Python static library.
Update for D3078, I think it should be fixed

Benefits:
- after installing python 3.7 with `./build_files/build_environment/install_deps.sh`, user will be able to run `make bpy` without linking error:
  - https://blender.stackexchange.com/questions/102933/a-working-guidance-for-building-blender-as-bpy-python-module
  - https://stackoverflow.com/questions/36779834/compiling-blender-bpy-recompile-with-fpic

To prevent errors like `/opt/lib/python-3.7.4/bin/python3.7: error while loading shared libraries: libpython3.7m.so.1.0: cannot open shared object file: No such file or directory`, add python .so lib to ldconfig

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D7177
2020-03-27 15:23:58 +01:00
Daniel Santana
2632ba6703 Fix Optix build error after recent changes
Differential Revision: https://developer.blender.org/D7253
2020-03-27 14:26:26 +01:00
31bd8e6bf3 Fix T74642: Take gravity field weight into account
Reviewers: sebbas

Differential Revision: https://developer.blender.org/D7227
2020-03-27 12:41:14 +01:00
7fd71c1694 GPencil: More cleanups missing in previous commit 2020-03-27 12:39:18 +01:00
70f56167d0 UI: Add missing Annotation tool to Paint modes 2020-03-27 12:36:24 +01:00
8a62fa9855 GPencil: Cleanup of unused code a arguments 2020-03-27 12:36:24 +01:00
25e8550739 CPencil: Cleanup unused fill code
This is now replaced by draw engine and annotations don't use fill.
2020-03-27 12:36:24 +01:00
5ce41e6f57 Fix T75111: Crash when using subframes for animated fluid collider
This is not dependent on having an armature as mentioned in T75111.
The collider simply has to be animated.

Reviewers: sebbas

Differential Revision: https://developer.blender.org/D7251
2020-03-27 12:33:33 +01:00
Cody Winchester
6e505a45a1 Surface Deform modifier: add vertex group and strength control.
This commit aims to add functionality to the surface deform modifier that
gives more control and allows it to work better with the modifier stack.
* Maintains compatibility with older files. The default settings keep it
  so that the whole object is bound and vertex coordinates get overwritten
  as the modifier currently does.
* Turns the deformations from an absolute vertex coordinate overwrite into
  an additive offset from the vertex location before the modifier to the
  resulting bound deformation. This gives the ability to control the
  strength of the deformation and mix the deformation of the modifier
  with the modifier stack that comes before it.
* Also adds in a vertex group with the invert option. This is applied after
  the bind deformation is added. So the whole object is still bound to target,
  and the vertex group filters afterwards what parts get affected.
  I experimented with a version to only binds the geometry weighted to the
  vertex group, but that would break compatibility with old files.
  I may bring it in later as a separate option/mode for the surface deform.

With several fixes from @mont29.

Reviewed By: mont29

Differencial Revision: https://developer.blender.org/D6894
2020-03-27 12:25:37 +01:00
1bb7d42cf6 Cleanup: Silence uninitialized variable warning 2020-03-27 11:12:27 +00:00
da91329291 GPencil: Cleanup unused parameter 2020-03-27 11:43:36 +01:00
b498edb189 Fix T75118: Remove Texture Opacity parameter for Fill materials
This parameter was used in previous version and must be removed from UI panel.
2020-03-27 11:33:09 +01:00
e7af825ded Multires: Fix unwanted assignment of sculpt session pointers
Might have happened when Apply Base is used in sculpt mode.

In practice this probably was fine, since the operator tags object
for update, so the pointers will be restored back to what they should
be.
2020-03-27 11:29:41 +01:00
Cody Winchester
bd86edf116 Solidify modifier: add option to assign shell & rim geometry to selected vertex groups.
This commit gives the solidify modifier the ability to assign the newly created shell
and rim geometries to selected vertex groups. This expands the procedural control over
the modifier stack by letting users apply modifiers to the shell geometry without affecting
the original geometry.

This will be especially helpful for NPR users that use solidify to create backface
culling lines on their characters giving them the ability to add displace noise
and other effects.

Differential Revision: https://developer.blender.org/D6903
2020-03-27 11:12:57 +01:00
Cody Winchester
ba1f7acc3f Warp modifier: add bone from and bone to options when using armature objects
This commit adds the option to use armature bones for the From and To targets
when using armature objects.

The changes are based on the UV Warp modifier.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D6820
2020-03-27 10:42:40 +01:00
3441862c96 Cleanup: Silence warnings 2020-03-27 10:29:33 +01:00
96b3463e25 Cleanup: Remove debug print
Leftover from rB3b59c111821b.
2020-03-27 10:23:34 +01:00
ff62481f65 Fix T69060: File Output Node does not work with Time Remapping
Problem is that the RenderEngines will change the RenderData cfra when
rendering (when time remapping is used -- at least workbench/eevee/
gpencil do a combination of BKE_scene_frame_get() plus
RE_GetCameraWindow() which alters the RenderData cfra).

Later on in the pipeline, the Compositor will use this RenderData cfra
to determine the output file name for the FileOutput node. (In contrast
to this, the 'regular' Output will use the Scene's RenderData -- not the
Render's -- cfra [which hasnt been altered])

It is not entirely clear why RE_GetCameraWindow was setting the cfra on
the Render, but it appears to be legacy OGL rendering related and is not
needed anymore.
Removing this will keep the cfra as needed for the Compositor FileOutput
node.
2020-03-27 10:10:54 +01:00
d0b0a0a894 Fix T74927: Slow playback using Auto Normalization
Caused by rBedb3b7a323a1.

Using evaluate_fcurve_only_curve actually causes quite a bit of slowdown
[6x] compared to bezier forward differencing [which was used prior to
rBedb3b7a323a1]. But full fcurve evaluation is desired with Dynamic
Interpolation Effects [Back/Elastic] since their min/max will not be
captured with forward differencing.

So now gain back speed [using bezier forward differencing] and only do
the full fcurve evaluation for dynamic interpolation effects.

Maniphest Tasks: T74927

Differential Revision: https://developer.blender.org/D7196
2020-03-27 09:58:21 +01:00
6eb1004d50 Fix T58439: Info Editor does not show operator reports immediately when
operator cancelled.

Lots of operators return OPERATOR_CANCELLED when no data really changed.
Reports from those operators do not show immediately in the Info Editor
[they only do if the operator returns OPERATOR_FINISHED].

Now also notify the Info Editor in case of OPERATOR_CANCELLED.

Maniphest Tasks: T58439

Differential Revision: https://developer.blender.org/D7238
2020-03-27 09:41:33 +01:00
3b59c11182 Fix T66655: Add-on tool keymap not working after restart
- Use addon keyconfig for registered tools so reloading the keymap
  doesn't clear them.

- Ensure there is a default keymap, needed for addon keymaps
  to be available in the user keyconfig.
2020-03-27 17:38:13 +11:00
95247b4b14 UI: Use Title Case 2020-03-26 21:34:27 -04:00
03ac301102 UI: Spelling Inconsistencies 2020-03-26 21:20:31 -04:00
e1ee4dff8d Cleanup: redundant mask includes 2020-03-27 11:47:04 +11:00
c8b85d32c5 Cleanup: quiet unused function warning 2020-03-27 11:28:46 +11:00
ed86f3edb6 Cleanup: rename WM_modalkeymap API names, matching WM_keymap
Rename:
- WM_modalkeymap_add to WM_modalkeymap_ensure
- WM_modalkeymap_get to WM_modalkeymap_find
2020-03-27 11:28:46 +11:00
5c74b0964b Cleanup: add iterator macros to clang-format
Also rename START to BEGIN (matching BEGIN/END for most iterator macros).
2020-03-27 11:28:20 +11:00
2f149ebbe9 Cleanup: uppercase macros for sculpt iterators, add to clang-format
Also use sculpt prefix for SCULPT_CLAY_STABILIZER_LEN.
2020-03-27 11:27:10 +11:00
Adrian Newton
f1fb3eb975 UI: use pixel unit for generated image dimensions
Differential Revision: https://developer.blender.org/D7171
2020-03-27 00:49:15 +01:00
Adrian Newton
d663c9d8da UI: fix inconsistent modifier menu order for fluid and multiple strokes
Differential Revision: https://developer.blender.org/D7172
2020-03-27 00:45:49 +01:00
Robert Guetzkow
fcd6fac0a7 Fix T74996: material custom properties not displayed for Cycles
Differential Revision: https://developer.blender.org/D7223
2020-03-27 00:44:18 +01:00
Stephan Seitz
02518be634 Cleanup: suppress warning about float-to-int conversion
Differential Revision: https://developer.blender.org/D7212
2020-03-27 00:43:17 +01:00
5cf6689019 Fluid: Removed obstacle levelset optimization
Currently results in unstable particle behavior and incorrect meshing.
2020-03-27 00:16:34 +01:00
b7666f27d3 UI: Address Issues with recent fluid ui changes
See rB337e86148688aa608d007381ee9ca78879050754
2020-03-26 18:49:54 -04:00
Aaron Carlisle
a921a4daad Mantaflow: remove reminents of high res smoke
It appears this slipped through the code review

Reviewed By: sebbas

Differential Revision: https://developer.blender.org/D6760
2020-03-26 16:29:08 -04:00
56e0249489 GPU: Add workaround for faulty default attrib values on some drivers
On some drivers, the default values is not respected correctly.

To workaround this we create a small VBO that contains only 1 vec4 worth of
data and just bind it using glBindVertexBuffer to ensure 0 stride.

This fixes T75069 Instances not rendered correctly by workbench.
2020-03-26 21:10:44 +01:00
afb1a64ccb Fix T60682: adds macOS alias redirection for directories
This adds support for macOS aliases in addition to symlinks. It also adds
support for hidden, readonly and system file attributes.

Contributed by Ankit (ankitm) with modifications by me.

Differential Revision: https://developer.blender.org/D6679
2020-03-26 19:57:30 +01:00
Chris Clyne
d1972e50cb Add option to Copy the active view layer, and add an empty view layer
Modify the view layer add operator (and underlying `BKE_view_layer_add`)
to allow for copying the current view layer, as well as adding a new one
but with all LayerCollections disabled by default (this is important for
heavy scenes where currently adding view layers can take a long time due
to enabling every collection by default).

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D6862
2020-03-26 19:36:51 +01:00
839f0cfa41 Overlay: Fix crash caused by NULL passes 2020-03-26 19:16:57 +01:00
86c61ce64f Cycles: Restore cycles_cubin_cc to working order
Reviewed by: brecht pmoursnv
Differential Revision: https://developer.blender.org/D7136
2020-03-26 11:41:44 -06:00
58ea0d93f1 Cycles/Optix: Add CYCLES_OPTIX_TEST override
This works similarly to the CYCLES_OPENCL_TEST
environment variable to allow testing on unsupported
hardware.

Note: like the OPENCL test override, this is
for *testing* only and bug reports on unsupported
hardware will *not* be accepted at this point in
time.
2020-03-26 11:30:17 -06:00
48ea173a7d Sculpt: Create Face Set by Edit Mode Selection
This implements a new mode in the Face Sets Create operator to create a
new face sets from the faces selection in edit mode. This can be used
when the user considers that the edit mode tools are more convenient for
a more precise control or a certain type of selection, like creating a
face set from a face loop.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D7211
2020-03-26 16:24:21 +01:00
99530ef4ed Sculpt: Face Sets Init operator
This operator initializes all face sets in the sculpt at once using
different mesh properties. It can create face sets by mesh connectivity,
material slots, face normals, UV seams, creases, sharp edges, bevel
weights and face maps.

For properties that are already in the faces, this is implemented as a
loop. Properties that depend on edge attributes use a similar operation
to sculpt flood fill, but using face adjacency instead of edge vertex
connectivity.

As Multires also stores the face sets in the base mesh, this should work
in the face sets Multires implementation without any changes.

This is implemented as a separate operator as this resets the visibility
and creates all face sets at once, while the create face set operator
creates a single face sets, leaving the rest of the face sets in the
mesh as they are.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D7209
2020-03-26 16:20:24 +01:00
Pablo Dobarro
a218be3080 Sculpt: Surface Smooth Brush and Mesh Filter
This implements the Surface Smooth Brush as a mode inside the Smooth tool,
which uses the HC algorithm from "Improved Laplacian Smoothing of Noisy Surface Meshes".
Comparted to the regular smooth brush with laplacian smooth, this brush removes
the surface while preserving the volume of the object.
The smooth result can be controlled by tweaing the original shape preservation,
displacement and iteration count.
The same surface smooth operation is also available as a mesh filter.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D7057
2020-03-26 16:13:47 +01:00
a0437c3f73 Fix T75087 Workbench: DoF: Divide By Zero when antialiasing is disabled 2020-03-26 16:03:48 +01:00
f5ac118fb3 Sculpt: Use uchar to store the sculpt mask in the GPU
Using a float to store and render the mask seems like a waste of memory
without any noticeable difference in the viewport for its use case.
After this commit, the mask and the face sets combined should take the
same amount of GPU memory than only the mask in previous versions.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D7148
2020-03-26 16:02:30 +01:00
e000dcb849 Overlay: Wireframe: New method to avoid zfighting with geometry
This new method is only enabled if Overlay Smooth Wire is enabled.

This method gives really nice results but has some downside:
- Require a depth copy or loose the ability to write wire depth to the
  depth buffer and have correct depth ordering of wires. This patch use the former, with its associated cost.
- Require some depth sampling and prevent early depth test (i.e: has
  some performance impact).
- Has some relatively minor instability with geometry that are perpendicular
  to the view and intersecting with other geometry.

Pros:
- Compared to a fullpass approach this is surely going to have less
  performance impact and much higher quality.
- Removes the additional vertex offset. (see T74961)
- Fixes all half edges z-fighting.

{F8428014}

{F8428015}

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D7233
2020-03-26 15:55:16 +01:00
458f50ba73 Fix T74780: Face sets operators not aware of SCULPT_FACE_SET_NONE
SCULPT_FACE_SET_NONE default value is 0 and it is rendered hidden, so
the invert sign operation to show it was not working. Now the show all
function sets this face set to ID 1 before setting its sign.

I also refactored this check in gpu_buffers.

Not related to the reported issue, but the mesh in attached contains non
manifold geometry with hidden loose vertices, so the visibility state
was not syncing correctly to those vertices. Now the toggle operators
checks the current visibility only on the face sets, so no manifold
vertices are ignored (as they are in the rest of operations in sculpt
mode).

Reviewed By: jbakker

Maniphest Tasks: T74780

Differential Revision: https://developer.blender.org/D7188
2020-03-26 15:50:25 +01:00
83947ea253 Fix T74761: Reimplement vertex to face sets visibility sync
This fixes multiple issues:
- Adds tag to update shading when changing vertex visibiliyt. This makes the mesh visibility update when the operator ends.
- Sync vertex to face sets no longer requires the pmap, so it does not crash. (Maybe we can initialize the pmap on undo to avoid these problems in the future).
- Sync vertex to face sets now works in a coherent way with the rest of visibility operations. Hide Box and Hide mask now sync the visibility changes to the face sets, so the all the operations are now getting a correct visibility state.

Reviewed By: brecht

Maniphest Tasks: T74761

Differential Revision: https://developer.blender.org/D7187
2020-03-26 15:44:50 +01:00
c286fa309e Fix T74899: Add Draw Face Sets brush to versioning defaults
Brushes are created automatically when the tools is enabled, but this
way it gets correct defaults and it is accesible from scripts.

Reviewed By: jbakker

Maniphest Tasks: T74899

Differential Revision: https://developer.blender.org/D7199
2020-03-26 15:41:10 +01:00
32bb848838 Fix T74692: Do not draw nodes with the default face set
The default face set color is white, so we can skip drawing the default
face set. This allows to enable again the optimization of not drawing
overlays in nodes where the mask is empty.

This will still slow down the viewport when a new face set is created
for the whole mesh or when inverting the mask, like in previous
versions.

I also renamed the function to make more clear that now it is checking
for both mask and face sets.

Reviewed By: brecht

Maniphest Tasks: T74692

Differential Revision: https://developer.blender.org/D7207
2020-03-26 15:39:41 +01:00
c32cf06e42 Fix T74808: Division by 0 in Cloth brush solver with overlapping vertices
This checks that the distance of the current positions of two connected
vertices is not 0 before calculating the correction vectors for those
vertices.

Reviewed By: jbakker

Maniphest Tasks: T74808

Differential Revision: https://developer.blender.org/D7184
2020-03-26 15:38:17 +01:00
4ff3d5aded Fix T75089: Missing pmap when using Face Sets in the mesh filter
When using Face Sets to mask the mesh filter the pmap needs to be
initialized to check the face sets of each vertex, otherwise it will
crash because it is null.

Probably now we should just initalize the pmap when building the PBVH as
almost all tools need it, so we can avoid these crashes in the future.

Reviewed By: jbakker

Maniphest Tasks: T75089

Differential Revision: https://developer.blender.org/D7236
2020-03-26 15:36:35 +01:00
Jeroen Bakker
7ed3ebbc6e Fix T67888: Incorrect Wireframe After Applying SubSurf/MultiRes
Show control edges stores the control edges in the mesh which is
picked up by the draw manager. When applyng a subsurf (or multires) we
don't want that data present in the base mesh. Any rebuilding of the mesh
would overwrite the data anyway.

This patch introduces a new flag for applying modifiers
that can be checked to ignore storing display specific data in
the base mesh.

Reviewed By: Brecht van Lommel

Differential Revision: https://developer.blender.org/D7163
2020-03-26 15:34:53 +01:00
Jeroen Bakker
2e8fb95e7c SubDiv: Incorrect normals loose edges
The normals of loose edges can be non uniform as they aren't normalized.
Checked with what happens with edit loose edges and synchronized the
implementation.

Reviewed By: Brecht van Lommel

Differential Revision: https://developer.blender.org/D7127
2020-03-26 14:35:27 +01:00
0545a84729 Fix Crash In Paint Overlay
The previous implementation tested the normal behavior and ignored some
edge cases. This patch will also test for NULL in all cases
2020-03-26 14:16:17 +01:00
Jeroen Bakker
1ca1744c29 Fix T70807: Weight Paint Overlay XRay
Weight paint overlay was not working when XRay was turned on.

The Weight Paint overlay is rendered directly into the default
framebuffer with a depth equal test. This test fails as the depth won't match.
This patch will update the depth buffer in these cases.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D7176
2020-03-26 13:35:06 +01:00
1b1c683f74 Fix missing text input on Windows with certain keyboard layouts
Events for keys specific to certain keyboard layouts unknown to Blender
were ignored. Now pass them along as unknown key events for which we
can still handle text input, like we already do for Linux and macOS.

Differential Revision: https://developer.blender.org/D7229
2020-03-26 09:22:47 -03:00
622e1591da GPencil: Fix unreported fade object when no Gpencil object is selected
Only must fade if the active object is a GPencil.
2020-03-26 13:17:22 +01:00
a093112696 CMake: Fix compilation with Xcode generation on Xcode 11.4
Need to give correct SDKROOT.
2020-03-26 13:07:52 +01:00
bd2b1a67a7 Fix T74939: Random Walk subsurface appearance in OptiX does not match other engines
Random Walk subsurface scattering did look different with OptiX because transmittance is
calculated based on the hit distance, but the OptiX implementation of `scene_intersect_local`
would return the distance in world space, while the Cycles BVH version returns it in object
space. This fixes the problem by simply skipping the object->world transforms in all the
places using the result of `scene_intersect_local` with OptiX.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D7232
2020-03-26 13:00:09 +01:00
08b9b95147 Fix T75047: Number input advanced mode is not working in JP keyboard
Check for special ascii values for number input first so that we can
quickly decide if we should go into advanced mode.

Reviewed By: Bastien
2020-03-26 12:45:09 +01:00
90e8f94558 Fix T75094: Gpencil Selection mode crash in Vertex Paint when build modifier is used 2020-03-26 12:34:02 +01:00
671b6d41c4 CMake: Fix Blender.app creation/modification time
It was failing on first run of CMake since the Blender.app is not yet
created.
2020-03-26 11:35:51 +01:00
ef2bde11d2 CMake: Fix spelling for OpenImageDenoise package
The spelling should match exactly between how package is called in
find_package and in FIND_PACKAGE_HANDLE_STANDARD_ARGS.
2020-03-26 11:35:51 +01:00
a22471f1d1 CMake: Fix macOS SDK detection with latest Xcode and macOS
Happens on macOS 10.15.4 and Xcode 11.4.

The reason of failure is caused by following factors:

- xcodebuild reports full semantic macOS SDK version 10.15.4
- The actual SDK file path will only include major and minor part
  of the version (10.15, MacOSX10.15.sdk)
- Previous CMake code of ours expected direct match between SDK
  version and file path.

The solution is to make our detection code a bit more flexible and
additionally check for major.minor macOS SDK version in the path.
2020-03-26 11:35:51 +01:00
f9590c8eaa CMake: Remove support of Xcode prior to 8.2
The specific goal of this change is to get rid of separate code paths
for older and newer Xcode versions.

The version 8.2 is picked since it's the latest version which runs on
macOS 10.11 (which is our current deployment target). If that turns
out too new for some reason the alternative would be to require Xcode
version 5.
2020-03-26 11:35:51 +01:00
c547d431eb Fix T75093: GPencil eraser selection in draw mode erase previous selected points
The selection in Draw mode works as a quick eraser and must erase only the points selected in that operation and not any previous selected point.

Now, before erase, unselect any previous selected point.

Note: It's planned to split select & erase operators for Draw mode.
2020-03-26 10:19:16 +01:00
e8dd96516c Keymap: disallow modal key-maps in add-ons keyconfig
Disable functionality reported in T60766 & only partially worked.

This could be used if the key-map was added after Blender started
as a way to customize modal key-maps, however it didn't work with
the add-on enabled on startup.

Add-on key-maps are intended to extend existing key-maps
so they can call the add-on, not as a way to change modal key-maps
for Blender's built-in functionality.

Disable this since it's not needed as add-ons
can't yet define modal key-maps.
2020-03-26 19:11:50 +11:00
03b2fc1a61 CMake: Cleanup, remove unneeded version requirement
The main CMakeLists already requires CMake 3.5, so there is no point of
requiring "newer" CMake on macOS.

This was a code from a while back where CMake 3 was not required on all
platforms.
2020-03-26 09:02:10 +01:00
fd262d3196 CMake: Fix detection of Xcode version
Legacy code did not take into account the fact that major version can
be two digits. This was causing "Xcode 11.4" to be detected as "11.".
2020-03-26 08:59:08 +01:00
09b8cdb25e Subsurf: Enable Optimal Display by default
Affects both Subdivision Surface and Multires modifiers.
2020-03-26 08:42:29 +01:00
b2f04fce2d Fix T75062: Frame Flashes During 3D Viewport Animation Playback
This issue became visible after fixing other TAA issues recently.
The sample count of the first frame wasn't reset resulting that the
incorrect resolve took place. This issue was already there beforehand,
it is just much clearer during the recent changes.

Now the `taa_sample will be reset when performing an animation playback
in the 3d viewport.
2020-03-26 08:22:52 +01:00
bae9553848 Test: update bl_run_operators blacklist, add volume object 2020-03-26 15:42:52 +11:00
Matt Rossman
eca52402bc Fix T75081: RNA path For FFMPEGSettings missing 2020-03-26 15:38:46 +11:00
b2b6099666 Cleanup: redundant cast, unused arguments 2020-03-26 15:37:33 +11:00
e990e55eba Fix crash with missing NULL check accessing grease pencil paint 2020-03-26 15:32:40 +11:00
a9394aa48e Fix crashes accessing inactive screen properties 2020-03-26 15:32:40 +11:00
38b211b581 Fix crash accessing length unit settings 2020-03-26 15:32:40 +11:00
0a34e5b300 Fix crash accessing the tool with no active space 2020-03-26 15:32:40 +11:00
33da997193 Fix crashes from various missing checks in operator poll functions
Issues exposed by 'bl_run_operators.py' utility.
2020-03-26 15:32:40 +11:00
52cff88f72 Fix crash when make proxy failed to assign a proxy 2020-03-26 15:32:40 +11:00
a8e749f624 Fix crash setting the brush with the current brush was unset 2020-03-26 15:32:40 +11:00
ffd26b420c Fix crash closing a window in background mode 2020-03-26 15:32:40 +11:00
7354f07ead Cleanup: use doxy sections & add missing sections 2020-03-26 15:32:40 +11:00
ba8d819c9b Fix T74417: Freestyle render removes image texture users
This simplifies freestyle render pipeline integration so we don't have to do
much manual ID user management at all. The complexity here was legacy from
Blender Internal.

Based on fix provided by Sybren A. Stüvl.
2020-03-26 01:29:20 +01:00
366cb3a059 Fix T74711: tiling brush option in image editor not working anymore
This makes it work again at least for the non-UDIM case. For UDIM it's not
great still but I'll consider that a known limitation. A proper solution is
probably to find the closest tile at the start of the stroke and then only
paint in that one tile for the rest of the stroke.
2020-03-26 00:02:06 +01:00
99e693d126 UI: rename image source Tiled to UDIM Tiles for easier discovery 2020-03-25 23:29:46 +01:00
d554cf8dd9 Fix T75090: crash with old NVIDIA drivers after overlay refactor
Work around GLSL compiler bug with backslash in preprocessor macros.
2020-03-25 23:14:50 +01:00
6681a33a6f GPencil: Fix unreported Threshold parameter visible in wrong context
The threshold only must be vsisible in Segment mode.
2020-03-25 18:46:45 +01:00
acd84ab105 GPencil: Fix unreported missing parameter for Cutter tool 2020-03-25 18:46:45 +01:00
d751491489 Fix error after recent change when WITH_INTERNATIONAL=OFF
Always need to install font files now.
2020-03-25 18:44:35 +01:00
59aaba739d Cleanup: typo in print 2020-03-25 16:52:04 +01:00
68e341e9d5 UI: remove non-unicode font and simplify default font loading code
There is no need to have another font embedded in the Blender executable, we
can assume the bundled font exists. In the future we may provide a fallback
if the font specified by the user in the preferences is missing a character,
but that can use our bundled international font.

Differential Revision: https://developer.blender.org/D6854
2020-03-25 16:39:58 +01:00
9070999c21 UI: always use international font
This means Blender can display more text correctly without having to enable
user interface translation. Previously the quality of the font was lower,
but that has been fixed now.

The font files have now been ungzipped, which results in faster file loading
as Freetype can read only the parts of the file that it needs. Blender download
size should not increase since the release package is compressed.

This includes improvements for Cyrillic characters from the latest DejaVu
Sans fonts from D6960, contributed by Harley Acheson. Fixes T74097.

Differential Revision: https://developer.blender.org/D6854
2020-03-25 16:39:37 +01:00
f48d15a861 Cycles: limit number of processes compiling OpenCL kernel based on memory
The numbers here can probably be tweaked to be better, but it's hard to
predict and this should at least avoid excessive memory swapping.

Fixes T57064.
2020-03-25 16:39:37 +01:00
e5f7b31dd4 Fix VR viewer offset on session start with no positional tracking
The current viewer pose position as determined by the OpenXR runtime
would be applied as offset. This offset should however only be set when
toggling the positional tracking while the session already runs.
2020-03-25 16:09:39 +01:00
04ab677761 Fluid: Small fix for secondary particles
Small tweak to ensure index will not run out of bounds during secondary particle computation.
2020-03-25 16:08:05 +01:00
035a3760af Alpha hash support for hair in EEvee
This patch adds support for alpha hash for hair rendering in EEvee.  Here's a comparison of with alpha hashing:

{F7588610}

And no alpha hashing:

{F7588615}

Note that this needs "soft shadows" enabled, otherwise shadows will be noisy; here's a render with soft shadows disabled:

{F7588621}

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D5221
2020-03-25 15:45:24 +01:00
b4c05a9c89 Cleanup: use doxy sections 2020-03-25 21:24:59 +11:00
567212c343 Fix T74846: UV gizmo swaps X/Y 2020-03-25 19:42:41 +11:00
1587eb16d8 Cleanup: use const to for some mask arguments 2020-03-25 19:32:44 +11:00
4c57f07a0f Cleanup: move mask queries into own file
Similar functions to lookup nearest mask points were in mask_add.c
& mask_edit.c
2020-03-25 19:06:17 +11:00
2bc791437e Cleanup: use 'r_' prefix for output arguments
Also pass some args as 'const'.
2020-03-25 17:58:58 +11:00
c3764fe1e8 Cleanup: update doxy sections 2020-03-25 16:36:01 +11:00
188ccfb0dd Fix T74662: Prefetching causes random crashes
Caused by 18b693bdbd, due to lack of thread safety.
Beteween calling BKE_sequencer_cache_get_num_items and BKE_sequencer_cache_iterate
New items could be inserted in the cache.

BKE_sequencer_cache_iterate() now use 2 callbcack functions for initial setup
during which buffers with correct length can be initialized and finally iterating.

Additionally drawing of unselected items was fixed again introduced in 18b693bdbd.

T74662 is reporting quite different symptoms, than I get on my machine, so I am not
entirely sure this is complete fix.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D7220
2020-03-25 00:23:06 +01:00
e1c7549ac9 Fix T75019: Frame Offset does not apply to scopes
Don't check for `sseq->mainb == SEQ_DRAW_IMG_IMBUF`.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D7228
2020-03-25 00:09:14 +01:00
8e8fdf875d Windows/Cleanup: Remove VS2015 support from make.bat
VS2015 has not been supported for a while now but make.bat
still had some support for it.
2020-03-24 14:48:23 -06:00
Valentin
27f29cdfba Fix T74038 : Scrolling doesn't work in menu if there is no active item
Fix T74038, the logic didn't handle the case where there was not any button with focus.

Reviewed By: Julian Eisel

Maniphest Tasks: T74038

Differential Revision: https://developer.blender.org/D7208
2020-03-24 21:40:36 +01:00
394a1373a0 Cycles: use OpenCL C 2.0 if available, to improve performance for AMD
Tested with AMD Radeon Pro WX 9100, where it brings performance back to 2.80
level, and combined with recent changes is about 2-15% faster than 2.80 in
our benchmark scenes.

This somehow appears to specifically address the issue where adding more shader
nodes leads to slower runtime. I found no additional speedup by applying this
to change to 2.80 or removing the new shader node code.

Ref T71479

Patch by Jeroen Bakker.

Differential Revision: https://developer.blender.org/D6252
2020-03-24 20:09:36 +01:00
bb26c1359e Add invert mapping option to proximity weight edit modifier, and some cleanup. 2020-03-24 18:28:55 +01:00
Cody Winchester
26ef4fa85e Modifiers: Vertex Weight Edit add invert curve falloff option
This commit adds the option to invert the resulting weights of the
falloff curve.

There is a workflow used by some to convert a texture mask into
vertex weights by using a custom curve and inverting the points.
This allows the same effect with a single click, and gives the modifier
more procedural functionality.

With minor UI tweaks by @mont29.

Differential Revision: https://developer.blender.org/D6899
2020-03-24 18:28:55 +01:00
f3ea8cd608 Overlay: Wireframe: Make facing ratio offset depends on gl_Position.w
This makes the offset dependent of the actual near and far clip distances.
2020-03-24 17:54:30 +01:00
5801a016d4 Cycles: slightly improve OpenCL performance by reordering SVM enum values
Ref T71479
2020-03-24 16:49:46 +01:00
2bec6f1f06 Cycles: work around OpenCL performance regression after AOVs and vector rotate
We appear to be hitting some limit where adding any amount of code causes a
significant performance regression, no matter what it does. To work around
that a new node level was added.

Ref T71479
2020-03-24 16:49:46 +01:00
f8a4fb43fb Cleanup: remove unused Cycles kernel feature flags, replace by node levels 2020-03-24 16:49:46 +01:00
266d243d8d Cleanup: Silence warnings
```
...\gpu_texture.c(466,7): warning C4555: result of expression not used
...\gpu_texture.c(559,7): warning C4555: result of expression not used
...\gpu_texture.c:1205:72: warning: pointer targets in passing argument 4 of ‘glGetTexLevelParameteriv’ differ in signedness [-Wpointer-sign]
```
2020-03-24 12:33:31 -03:00
118a9f8589 Replace VO_DS_EXPAND with SIM_DS_EXPAND 2020-03-24 16:30:29 +01:00
fc751901d8 remove unnecessary case in lib_remap.c 2020-03-24 16:29:02 +01:00
bd0f203d39 rename WITH_SIMULATION_DATA_BLOCK_RNA to WITH_NEW_SIMULATION_TYPE 2020-03-24 16:28:16 +01:00
d5c177bc90 Cleanup: use switch statement instead of if/else on enum value... 2020-03-24 16:26:15 +01:00
a40f2c30ff GPencil: Cleanup previous commit 2020-03-24 16:19:11 +01:00
7ac5c5b08c GPencil: Add blank frame when add layer in Dopesheet
When use the dopesheet add layer operator a new blank frame is created. It's very strange to create a layer and don't see anything in dopesheet.

If the layer is added in properties, the frame is not created.

Reviewed by: @pepeland @mendio
2020-03-24 16:16:47 +01:00
d626ced6f1 GPU: Estimate a better value for the memory used
This commit adds a `mipmaps` member to the `GPUTexture` struct and also
computes to the memory used by these mipmaps and the memory used for
textures that are created from an external bindcode.

So it solves the following inconsistencies:
- The memory value for mipmaps was not being computed.
- As `GPU_texture_from_bindcode` didn't call
 `gpu_texture_memory_footprint_add`, it brought inconsistencies to the
 value of the used memory, especially when the texture is freed.

Differential Revision: https://developer.blender.org/D3554
2020-03-24 12:13:26 -03:00
28c3d952db Fix T74782: WorkBench TAA Artifacts During Painting/Drawing
When the TAA is finished the screen can still be redrawn by other
operations without the TAA resets.
If that happened the TAA did add a blank sample to the result as the
scene wasn't drawn, but the was processed.

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D7226
2020-03-24 16:04:09 +01:00
b67b414a85 GPencil: Replace Tint mode "Both" to "Stroke and Fill" 2020-03-24 16:01:59 +01:00
727ed66065 Add new simulation data block
This introduces a new id data block with type `ID_SIM`.

The RNA part of this change is disabled by default for now.
The corresponding cmake option is `WITH_SIMULATION_DATA_BLOCK_RNA`.

The new data block does not yet have an embedded node tree.
I want to add that separately.

This is part of T73324.

The set of files I changed is based on rBb0a1cf2c9ae696.
However, I had to change fewer files, because I did not add a new object type.

Differential Revision: https://developer.blender.org/D7225
2020-03-24 14:59:16 +01:00
7f95682ac6 remove unnecessary todo 2020-03-24 14:37:10 +01:00
0055db5838 cleanup 2020-03-24 14:29:13 +01:00
64854506d1 add back blank line 2020-03-24 14:28:37 +01:00
3e07f2e322 remove unnecessary todo 2020-03-24 14:28:08 +01:00
b58db00ddf remove unnecessary includes 2020-03-24 14:25:58 +01:00
3689b783b7 Merge branch 'master' into simulation-data-block 2020-03-24 14:17:27 +01:00
1f1f1b018e add cmake option for simulation data block 2020-03-24 14:16:10 +01:00
b759857825 Revert "Fix T74782: WorkBench TAA Artifacts During Painting/Drawing"
This reverts commit 58ac113b76.
2020-03-24 14:02:16 +01:00
Michael Soluyanov
88adfc7e54 Fix missing grid theme option for Movie Clip Editor
The theme color is used in code, but not exposed in RNA and therefore
there's no button in the theme editor for it.

Reviewed by: Julian Eisel
Differential Revision: https://developer.blender.org/D7219
2020-03-24 13:49:22 +01:00
78d0ec3586 initial new Simulation data block 2020-03-24 13:30:37 +01:00
28827b62f7 Fix T64573: RNA_path_from_ID_to_property fails for pointcaches
Give pointcaches a proper path function which e.g. also resolves
ALT+click (assign to all selected) not working for anything relating to
pointcaches.

This also cleans up the usage of the 'eModifierTypeFlag_UsesPointCache'
flag (removed from the boolean modifier, added to the softbody modifier).

Maniphest Tasks: T64573

Differential Revision: https://developer.blender.org/D7115
2020-03-24 10:52:38 +01:00
02f7a6b2bd Fix T74744: Studio Lights editor not updating in realtime when tweaking
the settings

Caused by rBc476c36e4008.

This hooks into the existing FIXME (workaround for a missing update
tagging), reactivates the NS_VIEW3D_GPU notifier (introduced in
rB2ad3d8f158d2 -- but not going anywhere atm.) to check changes to rv3d
rflag which indicated UserStudioLight has changed. To not have updates
all the time, the rflag also needs to be cleared again (see original
rB2ad3d8f158d2).

Maniphest Tasks: T74744

Differential Revision: https://developer.blender.org/D7194
2020-03-24 09:58:25 +01:00
ed44bb902d Fix T74872: Clipping Region not updating
Caused by rBc476c36e4008.

This hooks into the existing FIXME (workaround for a missing update
tagging), needs to also check the clip_state (to detect
changes in DRW_STATE_CLIP_PLANES).

Maniphest Tasks: T74872

Differential Revision: https://developer.blender.org/D7193
2020-03-24 09:54:28 +01:00
a6dd22d431 Fix T74957: Matcap flip not updating
Caused by rBc476c36e4008.

This hooks into the existing FIXME (workaround for a missing update
tagging from operators), needs to also check the shading.flag (to detect
changes in V3D_SHADING_MATCAP_FLIP_X).

Differential Revision: https://developer.blender.org/D7192
2020-03-24 09:50:09 +01:00
579447bd89 Fix T74096: Paint Masking overlay can`t be hidden
Caused by rB9516921c05bd.

Dont really see a reason to draw overlays here if overlays are disabled.
Looks like this only affects Face/Vertex mask selection drawing [which
should indeed be hidden when overlays are disabled] next to two
exceptions:

- OVERLAY_paint_vertex_cache_populate draws weights as well [D7176 /
T70807 might be related here, but to me it looks like drawing weights
here is actually not needed at all]

- OVERLAY_paint_texture_cache_populate calls
DRW_cache_mesh_surface_texpaint_get [not sure about this one, this is
also called from workbench_cache_texpaint_populate, looks like this is
not needed when overlays are hidden]

Maniphest Tasks: T74096

Differential Revision: https://developer.blender.org/D7179
2020-03-24 09:44:42 +01:00
Habib Gahbiche
6e4eb2be28 RNA: expose comparison tolerance for Mesh.unit_test_compare 2020-03-24 19:41:46 +11:00
cd02495479 Fix T75036: Assert when copying pose bones 2020-03-24 17:54:06 +11:00
3d3a91103b Doc: remove MeshTessFace reference 2020-03-24 16:26:07 +11:00
Henrik Dick
bb19d96bc5 Fix solidify complex degenerate cases with duplicate faces
The removal of duplicate faces that are created during the handling of
degenerate cases was implemented already but didn't work.
This patch should fix some crashes with the solidify complex mode
related to that.

See D7221 for details.
2020-03-24 16:17:22 +11:00
15b0c76480 UI: add Blender -> System menu
Include technical operators here so they're available
when using menu-search.
2020-03-24 14:11:31 +11:00
c46dcdf887 UI: add menu search functionality to operator search menu
This has some advantages over operator search:

- Some operators need options set to be usefully accessed.
- Shows key bindings to access menus
  (for actions that don't have key bindings themselves).
- Non operator actions such as check-boxes are also shown.
- Menu items can control execution context, using invoke or execute
  where appropriate so we can control how the operator runs.

Part of the design task T74157.

This can be tested using the 'Experimental' preferences section
or selected in the key-map editor.
2020-03-24 13:41:18 +11:00
94b8166a8b Cleanup: clang-format 2020-03-24 10:42:29 +11:00
d0d251b53b Cleanup: spelling 2020-03-24 10:36:42 +11:00
9c280630c9 Fix invalid comma use 2020-03-24 10:17:52 +11:00
cda81d5a4d Fluid: Enforce minimum thickness to planar flow / effector objects
Planar object now have a thickness by default. This should make it more intuitive for users as there is no need to specify an object thickness.
2020-03-23 23:50:39 +01:00
e9629e3cfd Fluid: Use different phi for levelset generation
Phi that is used for mesh should be the one that matches particles best.
2020-03-23 23:50:39 +01:00
1b5b6a5da8 Fix T73505 EEVEE: Group output node sockets default value not working
This just cleanup the code and apply the expand to group output nodes.
2020-03-23 23:50:32 +01:00
765c82e92d Fix possible endless loop in Auto Merge & Split 2020-03-23 17:40:08 -03:00
b701af328a Revert "COW: Edit Mesh: Do not copy the looptris pointer"
The looptri is repeated in the linked Meshes but the pointer
is only referenced in the evaluated ones.

This reverts commit 64982e213f.
2020-03-23 14:18:36 -03:00
ed386507e1 Fix T74984: Crash opening specific production files
More detailed symptoms: there was no curve cache created for an object
which was used by draw manager.

A bit tricky situation, which involves collection instances and their
proxies.

The root of the problem in the dependency graph was that instanced
collections visibility was not updated when object is requested with
different visibility. So what was happening is that one of the objects
was pulled as an indirect dependency of something invisible, so it
built instanced collections as if the instancer is invisible. After
that the same object was built as visible. Before this fix this was
only update object flags, the instanced collections still believed they
are invisible. Since there is no path via relations which would connect
visible object with instanced objects the visibility flush which is
happening during graph finalization did not "fix" the visibility flags.

This change makes it so instanced collections are updating their
visibility when their instancer's visibility is changing to truth.
This is similar to how collections will accumulate their visibility
when same collection is used from multiple ones with different
visibility.

However, this alone wasn't enough to get crash fixed. This marked
collections as visible, but the geometry component of the curve object
was still considering self as invisible.

This is something tricky, since the code which is responsible for this
issue was added as an optimization in afb4da6650. This looks like like
an oversight in that commit since it's rather weird that ID node's
flag would depend on construction order (in "normal" object builder the
ID node's directly_visible flag is initialized to object's visibility).
So it seems logical to get this part of code in sync between "regular"
and "accumulative" object builder.

And last but not least the naming is_directly_visible is old and does
not really represent what it actually mans now: a more correct name
would be "will be used by the draw manager".

Differential Revision: https://developer.blender.org/D7217
2020-03-23 17:19:44 +01:00
58ac113b76 Fix T74782: WorkBench TAA Artifacts During Painting/Drawing
When the TAA is finished the screen can still be redrawn by other
operations without the TAA needs to be reset.
If that happened the TAA did add a blank sample to the result.

This patch will add an early exit in the case TAA was finished. Note
that there are still some cases still not working. The overlay engine
can in certain circumstances draw directly into the default_fb what can
lead to render artifacts.
2020-03-23 17:10:01 +01:00
24b27ea231 Bump subversion for previous theme additions 2020-03-23 16:43:54 +01:00
Michael Soluyanov
c95b522856 UI: Theme options for checkerboard pattern colors and size
This patch adds ability to set up colors and size of background
(transparency) checkerboard pattern in viewport and 2d editors. No new
backgrounds, only changing colors in existing ones.

This is not the background of the viewport, it is a transparency
checkerboard that is turned on only in render mode, when the
transparency mode is on. And also in 2D-editors, (image, sequencer,
etc).

Reviewed By: Pablo Vazquez, Julian Eisel

Differential Revision: https://developer.blender.org/D6791
2020-03-23 16:35:29 +01:00
88a86c025c Deps: TBB changed their repository URL
As a result the MD5sum of the downloaded package also changed.
2020-03-23 16:04:52 +01:00
Henrik Dick
241248223a Change solidify's material offset in complex mode to conform with simple mode
this patch will change the behaviour of the material offset in complex mode to fit simple mode output.
Previously in complex mode this would offset the material of the enire shell,
because when you read the tooltip it says material for new generated geometry.
In complex mode everything is new generated geometry though.
In simple mode on the other hand, this would give you a way to only change the inside faces
material. There may be cases in large modifier stacks where material offset like it is implemented
currently in complex mode may be useful, but it is much more useful in the way it is implemented
by simple mode.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D7215
2020-03-23 15:39:48 +01:00
Henrik Dick
ee4645207f Fix T74195: Solidify Complex Dissolve Crash.
I also added a few more comments to the code as I gone along.

Maniphest Tasks: T74195

Differential Revision: https://developer.blender.org/D7214
2020-03-23 15:22:31 +01:00
f9855800e0 Depsgraph: Driver Relations, skip finding possible relation with one driver
The `build_driver_relations()` function in the depsgraph relations builder
adds relations between drivers that potentially write to the same memory
location. This of course is only useful when there are two or more drivers.
2020-03-23 14:54:07 +01:00
7192a1bca3 Fix T73593: Drivers on hide_viewport and hide_render are unreliable
My previous fix (rB4c30dc343165) worked, except for an off-by-one error.
2020-03-23 14:54:07 +01:00
0b116a84c9 Fix T74923: Weight Painting Overlay Invisible for In Front Objects
For In Front Objects we need to use the in front depth buffer.

This patch will use the in front depth buffer and also makes sure that
it is filled with the center pixel depth.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D7216
2020-03-23 14:03:39 +01:00
6a5bd812b5 Fix T74586: Image Editor Uses Invalid Display Channels
When using the image editor the display channels attribute can become
invalid when selecting another image/buffer. This patch will check what
display channels are valid and when an invalid channel is selected it
will fall back to the color channel.

To de-duplicate the code it also introduces a
`ED_space_image_get_display_channel_mask` function that will determine
the valid bitflags for the display channel of a given `ImBuf`.
2020-03-23 13:56:42 +01:00
64982e213f COW: Edit Mesh: Do not copy the looptris pointer
No functional changes.

Differential Revision: https://developer.blender.org/D7173
2020-03-23 09:30:26 -03:00
bceb91ffd2 Sound: Fix asymmetrical mutex lock/unlock logic
Started to happen after recent fix for T72632.

Was caused by runtime fields backup doing an early exit in the case the
given ID was never expanded by the Copy-on-Write mechanism, but it was
not done int the backup restore function (since it was not possible to
know "locally").

Now both init() and restore() will do an early exit when the ID had
nothing to be backed up.
2020-03-23 09:55:15 +01:00
0710fb724b Fix T72632: Blender crashes using Jack with AV Sync enabled (repeatable) 2020-03-23 09:34:26 +01:00
46c0da6e69 Fix T74964: Stereo Viewport Rendering Not Working
On some platforms the stereo viewport rendering was not working. The
issue was that the fragment shader and vertex shaded didn't match. Some
platforms will remove the non-matching in/out parameters and blender
needs to provide only the optimal set of parameters. Other platform
still want to receive data for the parameters that aren't used.

This fix uses the correct vertex shader that matches the fragment shader
making both platforms render the same result.
2020-03-23 09:10:37 +01:00
0c571db4ad Fix T73988: Mantaflow fluid simulation - Particles for Spray, Foam and Bubbles are one frame ahead of Mesh
Fixes an issue with secondary particles being out of sync with the main simulation. Cleaned up the secondary particle code in general too (making sure that all solver attributes - timestep, framelength, etc. - are set correctly).
2020-03-22 21:46:43 +01:00
95b6090afc Fix T75018: Dirty vertex colours missing tooltip 2020-03-22 21:40:31 +01:00
ad7bb8e42c Cleanup: spelling, correct Mesh.mface docs 2020-03-22 12:17:25 +11:00
1e4f6b231c Cleanup: use static declaration 2020-03-22 11:51:15 +11:00
9e8afa8817 Fix OpenXR SDK failing to compile with no JsonCpp installed
Force the SDK to use its own, bundled JsonCpp sources.
2020-03-21 21:58:17 +01:00
1e8dfe79c6 GPencil: Fade to Viewport color
Actually, the fade objects always fade to Black color, but this is not a good solution.

This patch fade the object to the viewport color.

Differential Revision: https://developer.blender.org/D7206
2020-03-21 20:29:17 +01:00
c589fdc8db Fix install_deps.sh ignoring --skip-xr-openxr 2020-03-21 19:03:56 +01:00
44c6b6615b OpenCL: Bring back CYCLES_OPENCL_TEST override
Back in 2.79 you could either use the debug panel or an
environment variable to override using OpenCL for unsupported
hardware. Which was rather useful for developers when testing
on NVidia just to be sure the CL kernels at-least build properly.

This broke in rB949ab753bb2

This diff restores testing though the CYCLES_OPENCL_TEST
environment variable.

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

Reviewers: brecht
2020-03-21 11:55:45 -06:00
3033b2a044 Fix T73372: cryptomatte not filling last pass for odd number of levels
Make logic consistent with the render pass creation in Python.
2020-03-21 15:04:12 +01:00
ada28d3c65 Fix T67712: cryptomatte sockets created in wrong order in some cases
Simplify the logic and always create node outputs in the order specified
by the render engine, I can't see a reason why built-in passes must be
first.
2020-03-21 15:04:02 +01:00
c0544eedc6 Fix crash with empty volume object and points drawing 2020-03-21 14:43:47 +01:00
0dbbb2eabf Cleanup: compiler warnings 2020-03-21 14:40:51 +01:00
d924e31b42 GPencil: New Hardeness mode for Opacity modifier
Add  new option to change the stroke hardeness. This option works at stroke level, not at point level.

Also replaced the "Both" name mode by "Stroke and Fill".

Differential Revision: https://developer.blender.org/D7195
2020-03-21 09:48:18 +01:00
a22cd6b6a9 UI: Weight Paint: add a menu for locking and unlocking vertex groups.
This is a follow up on rBa1e50cfe6b4dbc360b6118c63a0dc7445023c37b
2020-03-20 20:07:42 -04:00
9607e54985 Fix T74959: Need to be explicit about UTF8 encoding in py.
Because some OSs are still using old 8bits specific encodings... Angry
eye @windows...
2020-03-20 20:52:52 +01:00
3d9d132ccd GPencil: Fix unreported slow transform with proportional edition
Now a hash is used to avoid double update of the same stroke. The old method was not correct with proportional edition.
2020-03-20 20:03:23 +01:00
a696053545 Python API: add bl_use_stereo_viewport for RenderEngine
To indicate if the render engine supports rendering a stereo 3D viewport.
This is not currently supported for Cycles.

Fixes T62582
2020-03-20 16:09:49 +01:00
6777956005 Fix T68370, T74973: Cycles cryptomatte not working when other passes are enabled
Solution found by Blazej Floch.
2020-03-20 15:59:24 +01:00
db65a6e0fb Fix T74345: missing albedo for Cycles principled hair BSDF 2020-03-20 15:23:39 +01:00
0127e8522a Fix Python error in Cycles baking panel 2020-03-20 14:25:16 +01:00
36b55bee42 Fix T74649: Outliner: Cannot set/clear parent with 'Keep Transforms'
Parenting in the outliner via drang and drop would always happen without
the 'Keep Transforms' option. Since this is often desired, this adds the
ability to hold Alt for doing this to the drop action.

Adding the hint to hold Alt to the operator name is not nice, but since
the operator name is used for the UI, there doesnt seem to be a nicer
way of doing this.

If modifier keys are needed back for other actions, spawning a menu
instead could be an alternative for the future.

Maniphest Tasks: T74649

Differential Revision: https://developer.blender.org/D7120
2020-03-20 13:24:05 +01:00
27553a2e4e Multires: Fix assert when removing modifier in edit mode
It is not guaranteed that with Multires modifier existing there
will be CD_MDISPS and CD_GRID_PAINT_MASK custom data layers.

Fixes assert in the following scenario:

- With default cube, go to edit mode
- Add Multires modifier
- Remove the Multires modifier
2020-03-20 12:28:29 +01:00
d931aacef6 Cleanup: Use IDTypeInfo data for id_swap functions.
Part of T74960.
2020-03-20 11:55:34 +01:00
6cbf342cbb Cleanup: Move BKE_libblock_get_alloc_info to using IDTypeInfo.
Part of T74960.
2020-03-20 11:21:02 +01:00
db4d264e70 fix API doc generation after new volume entry in context... 2020-03-20 10:48:30 +01:00
3bab9b4868 Fix T74154: Mantaflow crash: Baking data for domain type fluid on a plane.
Added sanity check to prevent bakes from being triggered when there is no fluid object present.
2020-03-20 10:42:54 +01:00
b8574c7e56 Fix T74885: Stamped lens metadata is wrong when camera lens is animated
The Lens metadata stamped on rendered images was wrong when the camera lens
is animated. This was caused by the render pipeline passing the original
camera to the metadata system, and not the evaluated camera.
2020-03-20 10:15:59 +01:00
86cc29d0cf Multires: Disallow changing mode and quality after subdivision
Avoids possible final object shape destruction since those options
defines how displacement is applied and propagated.
2020-03-20 09:50:00 +01:00
Jeroen Bakker
8ba9efb7d8 Fix T74811: GreasePencil Stereo Rendering
When using grease pencil in a stereo rendering the grease pencil objects are
only visible in the left eye. In the viewport it renders both.

Issue is related that `DRW_render_gpencil` only renders a single view. But
`DRW_render_to_image` renders all views. This patch puts this in a loop to
render both eyes.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D7154
2020-03-20 07:47:04 +01:00
4fc45c7a2b Fix T74643: Outline Overlay Shows Hidden Faces
When in editmode faces can be hidden, but in object mode these faces are
still visible. The flag if a face was hidden in edit mode is stored in
object mode, but should not be used.

The edge detection gpu batch did detect hidden faces and didn't add them
to the draw batch. The edge detection gpu batch is used for workbench
shadows, custom bone shapes and object outlines.

This patch adds all faces to the edge detection batch.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D7157
2020-03-20 07:43:31 +01:00
cb560c01b6 Cleanup: clang-format, comment indentation 2020-03-20 12:23:04 +11:00
85dc8d7477 Cleanup: sort file, struct lists 2020-03-20 12:19:44 +11:00
35e3abb912 Cleanup: remove old header conventions recently re-introduced 2020-03-20 12:19:09 +11:00
d2c3544c5c Cleanup: remove debug print accidentally included in own previous commit.
Thanks to @brecht for the heads up!
2020-03-19 22:12:36 +01:00
Adrian Newton
45dbe0be69 UI: use consistent names in theme preferences and editors menu
Differential Revision: https://developer.blender.org/D7087
2020-03-19 21:55:18 +01:00
Luya Tshimbalanga
f974bf2cba Fix invalid Linux appdata.xml syntax
Differential Revision: https://developer.blender.org/D7149
2020-03-19 21:55:17 +01:00
a1322d7c95 Cleanup: fix typos in comments
Contributed by luzpaz.

Differential Revision: https://developer.blender.org/D7133
2020-03-19 21:55:17 +01:00
Adrian Newton
83f171b626 UI: remove unnecessary Shadow from Shadow Samples label in Eevee volumetrics
Differential Revision: https://developer.blender.org/D7161
2020-03-19 21:55:17 +01:00
Yevgeny Makarov
c8b611b67f Fix UI alignment in generator f-curve modifier.
Differential Revision: https://developer.blender.org/D7167
2020-03-19 21:55:17 +01:00
Stephan
da019efde9 Cleanup: silence warnign in volume grid code
Differential Revision: https://developer.blender.org/D7175
2020-03-19 21:55:17 +01:00
817c38f715 PyAPI Docs: Update aud example
Fixes T74641
2020-03-19 16:21:17 -04:00
4b74b35322 Fix Cycles crash in Windows debug mode with volumes 2020-03-19 20:02:33 +01:00
12b621059a Cleanup/refactor: remove BKE_idcode, in favour of BKE_idtype.
Mpving utils from idcode to idtype proved to be somewhat painful for
some reasons, but now all looks good.

Had to add a fake/empty shell for the special snowflake too,
`ID_LINK_PLACEHOLDER/INDEX_ID_NULL`...
2020-03-19 19:39:23 +01:00
0b7854323d Fix typos in names fo new mesh and texture IDTypeInfo. 2020-03-19 19:39:23 +01:00
e1b2ded7b2 Fix build WITH_CXX_GUARDEDALLOC 2020-03-19 14:42:04 -03:00
3be7d74cba Fix T70126: Can't snap between objects with Rigid Body
`DEG_FOREACH_COMPONENT_IGNORE_TRANSFORM_SOLVERS` was `0`
2020-03-19 13:19:15 -03:00
689606887f Cleanup: add extern C 2020-03-19 16:54:09 +01:00
89b0465136 Fix T74908: volume object step size can not be set back to zero 2020-03-19 16:00:40 +01:00
2be14e0ec4 Fix typo in make.bat help for build directory 2020-03-19 15:31:21 +01:00
2982c9ba0a ColorManagement: Incorrect Memory Read for RGB images
When RGB images or BW images are converted to a GPU texture and color
space conversion was needed the images were read incorrectly.

This patch checks the correct amount of channels in the image and uses
that as the correct pixel stride.
2020-03-19 15:26:53 +01:00
9ace7e2439 Fix T74925: Texture Paint Stencil Mask crash
Use first texture if we dont have an ImageUser.

Maniphest Tasks: T74925

Differential Revision: https://developer.blender.org/D7181
2020-03-19 15:18:09 +01:00
42012493a8 Fix T74916: Industry compat keymap: GP Tweak tool acts like the Cursor tool 2020-03-19 14:43:50 +01:00
91c1759956 Fluid: Cleaned up some parts of the fluid modifier UI
Especially when expanding the UI panel horizontally, there were some problems with empty space.
2020-03-19 13:15:39 +01:00
cc516b82ef Fix T74915: Gpencil Tweak tool does not add point to selection holding Shift 2020-03-19 12:11:48 +01:00
885caa4535 Multires: Support "Subdivide" for Simple subdivision type
Is done by considering all base edges infinitely sharp.

In the future can become a different operator option to allow to mix
Catmull-Clark and simple subdivisions. For now just sticking to what
old good Blender versions were doing.

Fixes T74869: Simple subdivision type is not working as it should
2020-03-19 11:59:45 +01:00
e793a47efb Multires: Optimize memory usage further
Avoid storing any loose edges for the propagation process.
Also avoid any edge which crease is zero.
2020-03-19 11:59:45 +01:00
ccb731f2dd Multires: Reduce memory footprint after previous fix
The idea is following: only store information about edges which are

1. Communicated to the OpenSubdiv topology.

   This rules out all loose edges, as they are not needed for the
   propagation process.

2. Correspond to edge from the base mesh.

   This avoids storing edges which are generated between inner face.
   Those are not to have any sharpness to allow smooth propagation.

There is still possible to have memory peak in some obscure case when
mesh contains a lot of loose edges. It can be optimized further by
utilizing knowledge of the non-loose tags.
2020-03-19 11:59:45 +01:00
317a9cf835 Multires: Subdiv, properly support base edge crease
The title says it all actually. The test case is to get default cube,
set some edges to non-zero crease, add multires modifier and hit the
"Subdivide" button few times.

The memory footprint might be optimized by not storing information
about inner generated edges.
2020-03-19 11:59:45 +01:00
6e39445f80 GPencil: Cleanup - Split BKE_gpencil.h geometry functions into BKE_gpencil_geom.h
This split prepare the code for future geometry functions.
2020-03-19 11:38:22 +01:00
e839a25651 RNA: add MetaElem.select & use_scale_stiffness 2020-03-19 21:16:57 +11:00
7e9575f7a1 Fix T74701: Text on Curve Scaling Issue
Both scaling the text itself, as well as scaling the curve wasnt
updating, now added relations for this.

Maniphest Tasks: T74701

Differential Revision: https://developer.blender.org/D7140
2020-03-19 10:43:10 +01:00
b49dbb635a Subdiv: Make Blender crease to OSD sharpness reusable
Makes it so conversion is centralized in a single place.

We might consider removing any conversion, passing value as-is which
will be easier for I/O scripts to match crease. The downside of that
would be loose of control range in certain qualities and values of
crease.

There shouldn't be any functional changes in this commit.
2020-03-19 10:33:51 +01:00
53674fb255 Multires: Add missing context initialization
Might have caused access to uninitialized memory when foreach()
would have failed for some reason.
2020-03-19 10:08:48 +01:00
9dfc480ad1 Multires: Cleanup, typo in type name 2020-03-19 10:01:56 +01:00
ffb95baebe Multires: Store modifier pointer for subdivide
Allows to access its settings during the subdivision process.
2020-03-19 10:01:56 +01:00
2d1cce8331 Cleanup: make format after SortedIncludes change 2020-03-19 09:33:58 +01:00
008aaaa378 Code quality: Enable SortedIncludes
Code quality: Enable SortedIncludes in .clang-format

This patch does not include a `make format`, which will follow suit.

Differential Revision: D6811
2020-03-19 09:33:43 +01:00
Dalai Felinto
473316e246 Cleanup: make format (and adding . to end of comment) 2020-03-19 09:29:47 +01:00
Jeroen Bakker
fd48ff1296 Fix T73931: Stereo Viewport Color Management
Stereoscopic viewport didn't support Color Manangement due recent
changes in the color management pipeline. In order to solve the issue we
will migrate the strereo rendering into the GPUViewport. This will share
some textures and reduce required GPU memory.

Reviewed By: fclem, dfelinto

Differential Revision: https://developer.blender.org/D6922
2020-03-19 08:26:48 +01:00
Jeroen Bakker
fe045b2b77 WindowManager: Remove Stereo Offscreen
Stereo offscreen rendering has been replaced with stereo viewport
rendering. When an offscreen buffer is used it is only used for mono
rendering.

This patch will remove the second offscreen buffer.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D7153
2020-03-19 08:03:40 +01:00
d68d1da1f3 UI: scale sequence handle by pixelsize 2020-03-19 12:28:59 +11:00
f4a60fd85c Cleanup: rename variables which aren't specific to macOS 2020-03-19 12:28:50 +11:00
326ce2d625 Cleanup: declare & assign variables on the same line
Use less vertical space.
2020-03-19 12:28:50 +11:00
07c4c86049 Theme: update blender light theme
Also correct gizmo_view_align color.
2020-03-19 12:18:41 +11:00
b62e1146e1 UI: add view aligned gizmo color
Was hard coded to white making white backgrounds impractical.

D7162 by @billreynish with edits.
2020-03-19 12:09:53 +11:00
014e569258 Cleanup: use '\' for doxygen commands 2020-03-19 12:09:07 +11:00
ed4c47632f Cleanup: spelling 2020-03-19 12:09:07 +11:00
5bf09bbcdf Cleanup: shadow warning 2020-03-19 12:09:02 +11:00
f3e7c1e8c8 Fix building on Linux as '__time64_t' isn't portable 2020-03-19 11:56:02 +11:00
Robert Guetzkow
f70241deba Fix (unreported): Crash on accessing active sequence in select groupped operator
This patch moves the NULL check of `actseq` to the correct position, which should happen
before the `channel` is assigned. Otherwise an attempt to call the `sequencer_select_grouped_exec`,
when there is no active sequence and `use_active_channel` set to true, results in a crash.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D7170
2020-03-19 00:49:46 +01:00
271231f58e VSE: Strip drawing improvements
This patch include changes:
- Thicker and clearer selection indication
- Slimmer handles
- More transparent muted strips
- Trim frame number is drawn inside the strip
- Strip text is drawn in upper part of strip
- Color strips now have specific color, with chosen color drawn under strip text
- Transition strip will use color of input strips showing direction of transition
- Selecting effect strip will highlight input strips
- Selecting multicam strips will highlight target channel
- Missing media state is now indicated by a red line drawn on the top part of the strip
- A checkerboard pattern is now drawn on the outsides of the meta range
- Hold still regions are now always drawn if existent, with a darker shade of the strip’s background color

Author: Alessio Monti di Sopra <a.monti>

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D6883
2020-03-19 00:24:09 +01:00
348d2fa09e VSE: Disk cache
This patch implements dumping images from cache to HDD.
The main goal of this system is to provide a means to achieve consistent playback speed mainly for strips that are not possible to preview in real time.

How to use:
Disk cache has own settings in user preferences for path to storage, size limit and compression level.
To use disk cache, you need to check `Use Disk Cache` box, set `Disk Cache Directory`, `Disk Cache Limit` and save or open existing .blend file.
By default sequencer output will be cached only. Manual setting is possible in cache panel.

Uses:
 - Replacement or alternative for proxies. Disk cache will work with any strip type, supports float images as well.
 - Storage for strip thumbnails.
 - Less RAM needs to be allocated for preview cache

How it works:
Disk cache is extension of RAM cache. Every image, that is stored or deleted in RAM will be stored or deleted on HDD as well. Images can be compressed to save space and for use on slower drives. Compressed images are slower to write and read though.
Images are stored in bulk of 100 rendered frames per one file. This is to overcome slow file access time for large amount of files. Drawback is, that if one frame needs to be redrawn, all 100 frames are deleted.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D5524
2020-03-19 00:07:30 +01:00
c8b4b4c0fa Fluid: Fixed issue with intial velocities in liquid domains
The fix for T74762 (bf9c4af9bb) introduced this issue. Initial velocities were not applied to liquids anymore.
2020-03-19 00:04:13 +01:00
99be00fdb1 Cleanup: Prepare XR code for sorted headers 2020-03-18 20:53:02 +01:00
1935cd4027 Fix T74837: GPencil: Mirror over first selected marker crashes
'mirror_gpf_marker()' needs a NULL bGPDframe for initialization [but
still requires a scene to get the marker].

Maniphest Tasks: T74837

Differential Revision: https://developer.blender.org/D7166
2020-03-18 20:46:22 +01:00
a12ae67cf7 UI: Update the Clay Thumb Sculpt icon
The previous icon was identical with the Thumb icon.

New icon designed by Damian Winnichenko
2020-03-18 20:38:28 +01:00
c102dfd43d Cleanup: Prepare for sorted headers on windows
To prepare for D6811 small changes were needed.
we can no longer undefine near/far since the windows
headers use those extensively.

some of the imbuf files need to include the windows
headers explicitly to make sure it builds.
2020-03-18 13:26:38 -06:00
6bfe7c7a02 Fix (harmless) use of uninitialized variables in Cycles 2020-03-18 19:51:54 +01:00
9a116c7c2d Cleanup: 64 bit file IO on windows.
Unlike Linux where fseek/tell will be either 32 or 64 bit
depending on the target platform, it will always be 32 bit
on windows.

We had some macro magic in BLI_winstuff.h that substituted
them for 64 bit versions, but that is upsetting the system
headers if they get included after BLI_winstuff.h which
is problematic for D6811.

This diff adds proper functions in blenlib and updates
all calls that were using the BLI_winstuff.h header to
gain 64 bit file IO.

note: Anything that was using the 32 bit versions (ie not
including BLI_winstuff.h) will still be using the 32 bit
versions, which is perhaps a good code quality Friday project.

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

Reviewers: brecht dfelinto
2020-03-18 12:13:03 -06:00
ac74a843d2 Fix NULL-pointer dereference after error during VR session start 2020-03-18 18:24:11 +01:00
1a502097c7 Cleanup: Fix build warnings on windows.
Two headers define the _USE_MATH_DEFINES symbol now, if both
are included warnings are generated.

Added some guards, all good again.
2020-03-18 11:23:56 -06:00
c9c08dc7c8 Fix compilation error after recent change 2020-03-18 18:16:18 +01:00
805c4ab6bc UI: Make sure theme UI names are correctly capitalized
Also removed redundant use of 'color' in some instances.
2020-03-18 18:02:35 +01:00
efb53f5181 Fix T74524: tooltip for smoke dissolve time is backwards 2020-03-18 17:54:17 +01:00
b88ca3e6d1 Cleanup: Resolve HKEY conflict
Both the MS headers and blender headers define the HKEY
which gives all kind of inclusion order issues.

This diff renames all *KEY constants to EVT_*KEY to resolve
this conflict.

Reviewed By: brecht , dfelinto

Differential Revision: http://developer.blender.org/D7164
2020-03-18 10:38:37 -06:00
9e382dd2a3 Fix T74542, T74386: schulpt changes not saving (dyntopo or mutires)
Caused by rB2d423479bdea.
Correct check for stroke being painted.

thx also to brecht checking.
2020-03-18 16:41:41 +01:00
237ef0dcc7 Fix T74842: Remove Vertex Paint hotkeys
There were some conflicts with these keys.
2020-03-18 15:49:58 +01:00
7bde3f63dd GPencil: Fix typo error 2020-03-18 15:33:03 +01:00
19df67cd75 Fix build errors with WITH_HEADLESS or WITH_GHOST_SDL
Disable WITH_XR_OPENXR entirely for these cases. For headless XR
features don't make much sense, for SDL support is not implemented.
2020-03-18 15:19:41 +01:00
82fc81816e Fix openXR building with install_deps in some compilers. 2020-03-18 15:11:03 +01:00
efdc93fcc6 Fix T74876: Crash when snapping to faces
The crash occurs after operators change the amount of editmesh looptris.
The looptris of the evaluated object's editmesh are not updated.
2020-03-18 09:58:24 -03:00
52c0742560 GPencil: Remove Panel Grease Pencil and move Use Lights to Visibility
It was too much to have a panel for that.
2020-03-18 13:48:30 +01:00
d8897bed99 Fix headless and Python module build after recent alert icon changes 2020-03-18 13:31:49 +01:00
0af739ae8a GPencil: Remove duplicated Mode parameter from Color Subpanel in Vertex Paint
This parameter is now at Brush level, so it was duplicated in the Color panel.
2020-03-18 13:16:40 +01:00
e843d4e438 Cleanup: Rename variables 2020-03-18 09:10:39 -03:00
b81b127928 GPencil: Remove background to Dopesheet buttons
This was missing in previous commit.
2020-03-18 13:06:09 +01:00
dd416681fb Fix BPY enum property definiton failing if items contain spaces
Mistake in 03a4d3c33f, turns out this actually is called from BPY
(which I didn't think it was). So only error out during makesrna, not at
runtime.
2020-03-18 12:53:36 +01:00
406026abba Cleanup: spelling 2020-03-18 22:28:54 +11:00
c3651adf89 Tests: add OpenVDB volume tests 2020-03-18 11:23:05 +01:00
7537cad576 Volumes: add render settings for volume datablock
* Space: volume density and step size in object or world space
* Step Size: override automatic step size
* Clipping: values below this are ignored for tighter volume bounds

The last two are Cycles only currently.

Ref T73201
2020-03-18 11:23:05 +01:00
Brecht Van Lommel
1162ba206d Cycles: change volume step size controls, auto adjust based on voxel size
By default it will now set the step size to the voxel size for smoke and
volume objects, and 1/10th the bounding box for procedural volume shaders.

New settings are:
* Scene render/preview step rate: to globally adjust detail and performance
* Material step rate: multiplied with auto detected per-object step size
* World step size: distance to steo for world shader

Differential Revision: https://developer.blender.org/D1777
2020-03-18 11:23:05 +01:00
9d20f170c7 Cycles: support for rendering of new Hair object prototype
Ref T68981
2020-03-18 11:23:05 +01:00
994eb1ec17 Cycles: support rendering new Volume object type
Voxels are loaded directly from the OpenVDB grid. Rendering still only supports
dense grid, so memory usage is not great for sparse volumes, this is to be
addressed in the future.

Ref T73201
2020-03-18 11:23:05 +01:00
006025ead0 Cycles: support for different 3D transform per volume grid
This is not yet fully supported by automatic volume bounds but works fine in
most cases that will have mostly matching bounds.

Ref T73201
2020-03-18 11:23:05 +01:00
fd53b72871 Objects: Eevee and workbench rendering of new Volume, Hair, PointCloud
Only the volume drawing part is really finished and exposed to the user. Hair
plugs into the existing hair rendering code and is fairly straightforward. The
pointcloud drawing is a hack using overlays rather than Eevee and workbench.

The most tricky part for volume rendering is the case where each volume grid
has a different transform, which requires an additional matrix in the shader
and non-trivial logic in Eevee volume drawing. In the common case were all the
transforms match we don't use the additional per-grid matrix in the shader.

Ref T73201, T68981

Differential Revision: https://developer.blender.org/D6955
2020-03-18 11:23:05 +01:00
b0a1cf2c9a Objects: add Volume object type, and prototypes for Hair and PointCloud
Only the volume object is exposed in the user interface. It is based on OpenVDB
internally. Drawing and rendering code will follow in another commit.
https://wiki.blender.org/wiki/Source/Objects/Volume
https://wiki.blender.org/wiki/Reference/Release_Notes/2.83/Volumes

Hair and PointCloud object types are hidden behind a WITH_NEW_OBJECT_TYPES
build option. These are unfinished, and included only to make it easier to
cooperate on development in the future and avoid tricky merges.
https://wiki.blender.org/wiki/Source/Objects/New_Object_Types

Ref T73201, T68981

Differential Revision: https://developer.blender.org/D6945
2020-03-18 11:23:05 +01:00
8dcfd392e4 UI: add new icons for Volume, Hair and PointCloud 2020-03-18 11:23:05 +01:00
12720d8b9b GPencil: Cleanup int comparisons 2020-03-18 11:12:11 +01:00
35019443c0 GPencil: Invert Dopesheet icons to same order than properties panel 2020-03-18 10:19:54 +01:00
084bf7daee Weight Paint: Implement a new Lock-Relative mode.
This check box alters how weights are displayed and painted,
similar to Multi Paint, but in a different way. Specifically,
weights are presented as if all locked vertex groups were
deleted, and the remaining deform groups normalized.

The new feature is intended for use when balancing weights within
a group of bones while all others are locked. Enabling the option
presents weight as if the locked bones didn't exist, and their
weight was proportionally redistributed to the editable bones.

Conversely, the Multi-Paint feature allows balancing a group of
bones as a whole against all unselected bones, while ignoring
weight distribution within the selected group.

This mode also allows temporarily viewing non-normalized weights
as if they were normalized, without actually changing the values.

Differential Revision: https://developer.blender.org/D3837
2020-03-18 11:55:44 +03:00
82c51d0edb Modifier: skip calling MOD_deform_mesh_eval_get
This is only needed in certain cases.

When testing performance improvements to the modifier stack
it's useful to bypass this function.
2020-03-18 14:21:40 +11:00
7ba403dc94 Fix typo causing compile error with WITH_XR_OPENXR disabled 2020-03-17 22:23:02 +01:00
dc2df8307f VR: Initial Virtual Reality support - Milestone 1, Scene Inspection
NOTE: While most of the milestone 1 goals are there, a few smaller features and
improvements are still to be done.

Big picture of this milestone: Initial, OpenXR-based virtual reality support
for users and foundation for advanced use cases.
Maniphest Task: https://developer.blender.org/T71347
The tasks contains more information about this milestone.

To be clear: This is not a feature rich VR implementation, it's focused on the
initial scene inspection use case. We intentionally focused on that, further
features like controller support are part of the next milestone.

- How to use?
Instructions on how to use this are here:
https://wiki.blender.org/wiki/User:Severin/GSoC-2019/How_to_Test
These will be updated and moved to a more official place (likely the manual) soon.

Currently Windows Mixed Reality and Oculus devices are usable. Valve/HTC
headsets don't support the OpenXR standard yet and hence, do not work with this
implementation.

---------------

This is the C-side implementation of the features added for initial VR
support as per milestone 1. A "VR Scene Inspection" Add-on will be
committed separately, to expose the VR functionality in the UI. It also
adds some further features for milestone 1, namely a landmarking system
(stored view locations in the VR space)

Main additions/features:
* Support for rendering viewports to an HMD, with good performance.
* Option to sync the VR view perspective with a fully interactive,
  regular 3D View (VR-Mirror).
* Option to disable positional tracking. Keeps the current position (calculated
  based on the VR eye center pose) when enabled while a VR session is running.
* Some regular viewport settings for the VR view
* RNA/Python-API to query and set VR session state information.
* WM-XR: Layer tying Ghost-XR to the Blender specific APIs/data
* wmSurface API: drawable, non-window container (manages Ghost-OpenGL and GPU
  context)
* DNA/RNA for management of VR session settings
* `--debug-xr` and `--debug-xr-time` commandline options
* Utility batch & config file for using the Oculus runtime on Windows.
* Most VR data is runtime only. The exception is user settings which are saved
  to files (`XrSessionSettings`).
* VR support can be disabled through the `WITH_XR_OPENXR` compiler flag.

For architecture and code documentation, see
https://wiki.blender.org/wiki/Source/Interface/XR.

---------------

A few thank you's:
* A huge shoutout to Ray Molenkamp for his help during the project - it would
  have not been that successful without him!
* Sebastian Koenig and Simeon Conzendorf for testing and feedback!
* The reviewers, especially Brecht Van Lommel!
* Dalai Felinto for pushing and managing me to get this done ;)
* The OpenXR working group for providing an open standard. I think we're the
  first bigger application to adopt OpenXR. Congratulations to them and
  ourselves :)

This project started as a Google Summer of Code 2019 project - "Core Support of
Virtual Reality Headsets through OpenXR" (see
https://wiki.blender.org/wiki/User:Severin/GSoC-2019/).
Some further information, including ideas for further improvements can be found
in the final GSoC report:
https://wiki.blender.org/wiki/User:Severin/GSoC-2019/Final_Report

Differential Revisions: D6193, D7098

Reviewed by: Brecht Van Lommel, Jeroen Bakker
2020-03-17 21:42:44 +01:00
406bfd4304 Ghost: Ghost-XR API to abstract away and access OpenXR functionality
Extends Ghost to include an abstraction for OpenXR, which I refer to as
Ghost-XR. Such an API is the base for the following commit, which introduces VR
support to Blender.

Main features:
* Simple and high-level interface for Blender specific code to call.
* Extensible for muliple graphics backends, currently OpenGL and a DirectX
  compatibility layer are supported.
* Carefully designed error handling strategy allowing Blender to handle errors
  gracefully and with useful error messages.
* OpenXR extension and API-layer management.
* OpenXR session management.
* Basic OpenXR event management.
* Debug utilities for Ghost-XR and OpenXR

For more information on this API, check
https://wiki.blender.org/wiki/Source/Interface/XR.

Reviewed by: Brecht Van Lommel

Differential Revision: https://developer.blender.org/D6188
2020-03-17 21:39:59 +01:00
c9a8de1d70 Fluid: Correct Tooltip 2020-03-17 16:32:56 -04:00
3af51cacbf Online Manual Reference: Update 2020-03-17 16:28:58 -04:00
a7c660fe61 Cleanup: Fix warnings about function signature of register pass
RE_engine_register_pass is sometimes in the headers with type
as an integer parameter, sometimes as eNodeSocketDatatype.

This caused warnings, the root cause was makesrna was not able
to generate the proper type for enums and defaulted to int.

makesrna has been extended with the RNA_def_property_enum_native_type
that allows telling makesrna the native type of an enum, if set it
will be used otherwise it will still fall back to int.

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

Reviewed By: brecht
2020-03-17 13:45:35 -06:00
e09f0caff3 GPencil: Fix crash joining objects
The weights array can be NULL.
2020-03-17 19:02:10 +01:00
blender
ba3d49225c make deps: Fixes to make OpenXR to work on CentOS Linux
- Harvest to a proper location.
- Disable STD's filesystem which is experimental and caused
  linking errors when OpenXR is usedi n Blender.
2020-03-17 18:35:29 +01:00
f1eb86c458 GPencil: Rename old color operators to material
The color was used in old version when palettes were used, but now all are materials
2020-03-17 18:29:34 +01:00
bf9c4af9bb Fix T74762: Mantaflow: Non emmiting flow source affects simulation 2020-03-17 18:21:01 +01:00
07d5b8b023 Fix T74322: Wrong object bundles with scaled camera
Camera scale was not handled correctly when drawing 3d bundles for
reconstructed objects (caused by normalization of the matrix).
2020-03-17 17:48:55 +01:00
6a0ddb4bb1 Cleanup: Remove unused function
Was introduced earlier today and did not turn out to be very useful
and clear.
2020-03-17 17:40:54 +01:00
f958560a99 Multires: Properly support virtual modifiers for Apply Base
The initial code from earlier from today didn't really work reliable
since it is not possible to apply virtual modifiers but not the real
multires one (in a situation like mesh with shapekeys and multires).

New code uses less memory and has better performance for the case
when there are actual modifiers leading the multires. The case when
there is only multires will not be as performant as possible at this
moment.
2020-03-17 17:40:54 +01:00
1504cb26b0 Cleanup: process colorspace conversion with a 1D pixel array
No need to assume it's 2D or 3D.
2020-03-17 17:33:08 +01:00
2518f60109 GPencil: Fix Parent layer not working
The parenting was using the old logic, but with new engine the draw is done using eval data.

Fixed the depsgraph relationship missing with bones to get an update when the bone is transformed.

Also fixed Snap cursor to Selected
2020-03-17 17:28:49 +01:00
964375e36a Cleanup: blenkernel proper header inclusion for BKE_ocean.h
BKE_ocean.h uses the bool type without including stdbool.h
counting on someone else including that before it.

With D6811 enabling automatic sorting of the includes
this can no longer be counted on. This changes includes
stdbool.h in BKE_ocean.h so it can build without being
depended on others including the right headers before it.
2020-03-17 10:12:47 -06:00
Robert Guetzkow
d374237d43 Fix T74838: fix dereferencing of NULL in sculpt_no_multires_poll when no active object exists
Fix crash when the operator search is used while no active object exists. The cause of the issue is an attempt to dereference `ob` when it is `NULL`. Therefore this patch checks the return value of `SCULPT_mode_poll()` first, to ensure that `ob` isn't `NULL`.

Reviewed By: pablodp606

Maniphest Tasks: T74838

Differential Revision: https://developer.blender.org/D7156
2020-03-17 16:46:55 +01:00
24e44143a1 Multires: Fix Apply Base when there are deform modifiers
Their effect was applied twice after hitting Apply Base since the
operator was also applying deformation caused by those modifiers.
2020-03-17 16:41:43 +01:00
628d799c85 Multires: Add utility to create deformed base mesh
The new function will use original object as a starting point
and apply all enabled deformation modifiers prior to the multires.
2020-03-17 16:41:43 +01:00
c76d390c92 Mesh: Fix applying deform modifier up to index
The code would have break the first (deform only) modifiers
once the index is reached, but it will not prevent second
loop (over remaining modifiers) from run.

This was applying deform modifier twice in some conditions:
having single deform modifier and calculating deformed mesh
up to the first modifier (index=0).
2020-03-17 16:41:43 +01:00
bf5151b2d2 Mesh: Add utility to calculate deform modifier up to index
Intention is to be used to create mesh at the state which is an input
to the multires modifier.
2020-03-17 16:41:43 +01:00
a45c34ae8e Multires: Cleanup, argument naming and order
Use full argument name.

Also order arguments in the generosity order: from depsgraph
(which has everything) to object (which contains multires)
specific multires modifier.
2020-03-17 16:41:43 +01:00
17abae45f1 Multires: Cleanup, remove redundant argument
Scene can be queried from the dependency graph.
2020-03-17 16:41:43 +01:00
20456b52b4 Fluid: Fixes for new abort bake faster feature
In addition to previous commit that made it possible to abort bakes faster.
2020-03-17 16:12:46 +01:00
b852db57ba Add experimental global undo speedup.
The feature is hidden behind an experimental option, you'll have to
enable it in the preferences to try it.

This feature is not yet considered fully stable, crashes may happen, as
well as .blend file corruptions (very unlikely, but still possible).

In a nutshell, the ideas behind this code are to:
* Detect unchanged IDs across an undo step.
* Reuse as much as possible existing IDs memory, even when its content
  did change.
* Re-use existing depsgraphs instead of building new ones from scratch.
* Store accumulated recalc flags, to avoid needless re-compute of things
  that did not change, when the ID itself is detected as modified.

See T60695 and D6580 for more technical details.
2020-03-17 15:02:05 +01:00
Mateusz Grzeliński
9ce3890950 Cleanup: rename function
This function was missed in rBec471a9b1c1.

Differential Revision: https://developer.blender.org/D7155
2020-03-17 14:46:50 +01:00
8cb463f4ff OverlayEngine: crash when using hidden faces
Unreported Crash. When hidden faces are active (retopology) the depth
test could fail as the default framebuffers aren't set. This patch will
check if we are rendering a depth only and skip the clearing of the
buffer.
2020-03-17 13:56:25 +01:00
3c1433b6f3 Revert "Cleanup: use doxy sections"
This reverts commit 626b2bd071.

Sergey prefers not to use doxy sections for this code.

Revert pending a decision on T74845
2020-03-17 23:53:36 +11:00
b2851dbe78 Fluid: Abort baking jobs faster
With this change baking jobs will be aborted faster. The user will not have to wait for the current frame to finish baking. The bake job will exit early and discard the incomplete frame.
2020-03-17 13:49:57 +01:00
54c8770692 Fix error using CUDA in plug-ins on Linux/macOS, hide our CUDA symbols
Better solution will be to hide all symbols by default, but this works for now.
2020-03-17 12:23:36 +01:00
0b7841679e Multires: Cleanup, naming, make it more consistent
The coarse mesh is an input to generic Subdiv, and exact meaning is
ambiguous.

The input to Multires is a base mesh, which owns CD_MDISPS.
2020-03-17 12:23:02 +01:00
b02a25b7e1 Add accumulated recalc flags to IDs.
Those accumulated flags get cleared every time an undo step is written
to memfile.

Preliminary work for undo-speedup.

Part of T60695/D6580.
2020-03-17 12:10:52 +01:00
055863d9c1 Cleanup: minor changes. 2020-03-17 12:10:52 +01:00
20d7c04305 Fluid: Re-dded Empty Space option in the UI
This option existed already and was just hidden in the UI. With the new fluids system though, it will only be used for rendering - and not to optimize the cache.
2020-03-17 11:57:04 +01:00
7f3e84deb5 Fluid: Updated manta pp files
Includes only a rename. The name PyInit_Main was a bit confusing as it just belongs to Manta.
2020-03-17 11:57:04 +01:00
2ba3e6a02e Depsgraph: Adds helpers to extract/restore despgraphs in a given Main.
Extract will steal all depsgraphs currently stored in given bmain, and
restore will put them back in place, using scene and viewlayers as keys.

Preliminary work for undo-speedup.

Part of T60695/D6580.
2020-03-17 11:24:37 +01:00
90ce708ef0 BKE_lib_id: Add helper to swap full ID content and use proper naming.
Preliminary work for undo-speedup.

Part of T60695/D6580.
2020-03-17 11:13:14 +01:00
b87997f59b Cleanup: rename 'centre' to 'center' in View3D 2020-03-17 11:34:11 +11:00
ab430cfdfe Cleanup: sort DNA renaming 2020-03-17 11:29:54 +11:00
67307e72ea Cleanup: use more descriptive variable name for the data-mask
Make it explicit this data mask is added to the default mask.
2020-03-17 11:04:50 +11:00
47af235ba9 Revert "UI: Add 7 new community themes"
This reverts commit d89e5fcaef.

This was meant to be committed to the add-ons repo.
2020-03-17 10:41:40 +11:00
120a38ccbe Nodes: Display bl_icon of custom nodes in node header
This is D1578 by Philipp Oeser with small modifications.
2020-03-16 18:25:23 +01:00
e42f61dda8 Fix incorrect Face Sets when using mask extract
Mask extract modifies the topology when adding the boundary loop, so
previous face sets may not be correct in the new mesh. Remove the face
sets datalayer and let sculpt mode rebuild it when entering sculpt mode
in the new object.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D7129
2020-03-16 17:53:03 +01:00
bab0fd1308 Fix visual artifacts with partially hidden meshes and mask extract
The previous behaivour didn't make sense as sculpt mode was still active
when switching to the new object, so it was rendering inconrrectly.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D7130
2020-03-16 17:45:22 +01:00
e4077ea69d Fix T74626: Wrong Face Sets overlay rendering in smooth shading
The face set color variable needs to be declared inside of the loop in
order to reset it per iteration.

Reviewed By: jbakker

Maniphest Tasks: T74626

Differential Revision: https://developer.blender.org/D7096
2020-03-16 17:43:54 +01:00
7941ea02f8 Update viewport rotation origin when changing Face Set visibility
Small UX fix. When hidding everything but the active face set with H,
the last stroke lotation center can be in a part of the model that is
hidden, so viewport navigation becomes confusing until you start a new
stroke on the visible face set. Now the viewport navigation rotation
center is updated to the active vertex when using a visibility operation
that uses it, so it always rotates using the visible face set as the
origin.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D7137
2020-03-16 17:42:52 +01:00
ba26adee0c Fix T61234 Mirroring Grease Pencil keyframes in the Dopesheet fails
`ANIM_animdata_update()` did not sort grease pencil frames. A
pre-existing comment stated this wouldn't be necessary as
`posttrans_gpd_clean()` already does this. However, this is only
applicable when the change is performed via the transform system. The
mirror operator doesn't call `posttrans_gpd_clean()`, invalidating the
assumption in the comment.

I moved the sorting code into `BKE_gpencil_layer_frames_sort()`, which
is now called from both `ANIM_animdata_update()` and
`posttrans_gpd_clean()`.
2020-03-16 16:23:12 +01:00
f0856b1fda Cycles: Fix bad escape character used for dot 2020-03-16 16:17:13 +01:00
215e474a99 Fix T74776: Cycles crash with missing image texture after recent changes 2020-03-16 16:02:06 +01:00
20f6700c88 UI: Show decorators for lights when using Cycles
This matches Eevee, and also the rest of Blender.
2020-03-16 14:32:09 +01:00
d89e5fcaef UI: Add 7 new community themes
This commit adds 7 themes submitted by the community on Devtalk. These themes both serve specific purposes, provide a greater variety in look & feel, and serve as welcoming homes for users coming on board from other packages. This is the initial commit, but these themes can be continuously updated over time to fix issues and keep them up to date with changes.

Thanks to all contributors, and in particular the makes of the picked themes: Pierre Schiller, Edward Agwi, Vojtěch Lacina, Michail Soluyanov, Jason van Gumster, Mr Wax Police & Jonathan Lampel.

An overview is here: https://developer.blender.org/T74360
2020-03-16 14:25:47 +01:00
37e7e1e77c Cleanup: Typo in comment 2020-03-16 12:43:05 +01:00
a69c364746 UI: fix backdrop and alignment in anim channels
This patch fixes various problems of alignment and element backdrops for
the animation channels drawing, mainly in the Graph editor but also for
grease pencil and mask layers in the Dope Sheet.

Reviewed By: billreynish, sybren

Differential Revision: https://developer.blender.org/D5204
2020-03-16 12:18:33 +01:00
5a664c6e98 Fix another implicit cast of boot to int
Use proper comparison to nullptr.

It is important to use nullptr since NULL is actually an integer,
which leads to another type of warnings.
2020-03-16 12:15:16 +01:00
35a29befb3 Fluid: Updated Manta pp files
Includes additional minmax check for Windows
2020-03-16 11:52:18 +01:00
7df435325b Fix implicit cast from bool to int in path tests 2020-03-16 10:53:46 +01:00
01377fd229 Workbench: Crash When Rendering With Stereo 2020-03-16 10:42:03 +01:00
868573451f Cleanup: use unsigned char for UI_view2d_text_cache_add
Avoids casts when used with other UI code
where the color is often unsigned.
2020-03-16 11:53:08 +11:00
f06a6e92bc Cleanup: misleading memset use
This call to memset relied on PassList having a single,
zero sized struct member.

Pass the passes array instead for readability.
2020-03-16 09:43:07 +11:00
Yevgeny Makarov
ac1dcdbf06 UI: Add an Outline to the Popover Arrows
Reviewed By: billreynish, fclem

Differential Revision: https://developer.blender.org/D5873
2020-03-15 23:19:01 +01:00
7a19a99675 Workbench: Fix default view not reset after drawing
This fix jitter of overlay and GPencil. But I'm not sure this should
be the responsibility of the subsequent draw engines or the responsibility
of the current engine to reset the view.
2020-03-15 22:50:07 +01:00
cebff2ff30 Fix a syntax error in test spec for BLI_delaunay_2d_test.
Test specs are read from strings, and there was a comma instead
of a decimal point, and then an extra decimal point in the Quad0 test.
This test has been flaky on Windows buildbot. Perhaps this is why.
2020-03-15 17:14:04 -04:00
7a7b392b54 GPencil: Reduce factor to 5 in previous commit
10 decimals is too high
2020-03-15 19:40:21 +01:00
22925d0dd3 GPencil: Remove Keep parameter from Select Vertex Color
Also changed range of threshold from 0 to 10
2020-03-15 19:22:33 +01:00
8022fc3220 Fix Blender building after recent 'cleanup'.
Caused by rB4be4c0667155. Please ensure at least affected code does
still build...
2020-03-15 16:11:35 +01:00
e53e17b8d6 Fix outliner edit-mode check 2020-03-15 22:04:08 +11:00
b435bd2f31 Fix potential draw manager assignment to negative index
While there is an assert here, the run-time code would perform the assignment.
2020-03-15 22:03:59 +11:00
59f5194265 Fix potential NULL pointer de-reference creating liquid geometry 2020-03-15 22:03:49 +11:00
b8feef59c8 Cleanup: add parens for clarity 2020-03-15 21:53:57 +11:00
5029b97d02 Cleanup: add NULL check for RNA filename argument
Currently some of the code supports a NULL filename,
add the NULL check so RNAProcessItem's with a NULL filename
don't crash in the future.
2020-03-15 21:53:20 +11:00
ecfb89280e Cleanup: use 'r_' prefix for return args 2020-03-15 21:51:22 +11:00
37419bb3f6 Cleanup: avoid setting float values by bit-pattern
Replace memset with copy_vn_fl, note that the exact values are slightly
different in this case. The value being set was close to FLT_MAX.
2020-03-15 21:51:02 +11:00
4be4c06671 Cleanup: redundant checks
In some cases moved the checks into asserts,
to ensure changes in the future don't cause
the checks to become necessary again.
2020-03-15 21:48:35 +11:00
80edc0e972 Cleanup: redundant assignments 2020-03-15 21:46:18 +11:00
aa60b9338a Cleanup: use 'const' style argument 2020-03-15 21:42:06 +11:00
b037816980 Cleanup: shadow warning, clang-format 2020-03-15 21:42:06 +11:00
4031d8bcb7 UI: Fix capitalization in the macOS app menu 2020-03-15 11:16:08 +01:00
a210b8297f UI: Larger Alert Icons
Adding a set of larger icons for use in informational dialogs.

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

Reviewed by Campbell Barton
2020-03-14 11:05:09 -07:00
a816a067ed GPencil: Change Select Vertex Color to similar selection
Now, instead to use the Brush color as selection patron, now it uses any previous selected color.
2020-03-14 16:26:56 +01:00
b7160f2f0a IC keymap: Fixes for GP
- Remove Shift for drawing poly-lines, just as in the default keymap
  - Use consistent hotkeys for size and strength radial controls
  - Fix some bugs/missing items from the GP merge
2020-03-14 14:00:28 +01:00
94bad2f30d GPencil: Fix missing context wheel color in Tint tool 2020-03-14 11:58:22 +01:00
cc53900baf GPencil: Add option to keep selected in Select Vertex Color 2020-03-14 11:07:35 +01:00
428e65256e GPencil: Use Linear color instead of sRGB for Select Vertex Color
The brush color is sRGB but the Vertex Color is linear.
2020-03-14 10:46:28 +01:00
b8211a4d7c GPencil: Add Select Vertex Color to menu
This option was missing
2020-03-14 10:45:23 +01:00
466171d0ef GPencil: Rename operator select_color to select_vertex_color 2020-03-14 10:33:33 +01:00
d50d410a70 GPencil: Rename operator color_select to select_material
The old name was related to the old palettes.
2020-03-14 10:30:59 +01:00
bb89cc51ec Fix T67446: UV Editor: support island select mode for box/circle/lasso
selections

Previously this was only supported in single click selections, doing an
island selection with box/circle/lasso would just select individual
vertices instead. Now selects islands properly.

This also unifys some logic between box/circle/lasso:
- use early selection test from lasso [makes things faster] in box/
circle
- circle wasnt checking visible face
2020-03-14 08:16:08 +01:00
f0b0524c5f Cleanup: spelling 2020-03-14 15:43:21 +11:00
117ccb56ad Cleanup: remove unused ARegion from bGPdata_Runtime 2020-03-14 15:39:59 +11:00
4b38eac4da CMake: use spaces instead of tabs for icon updating script 2020-03-14 15:39:59 +11:00
60e3f690cb Cleanup: sort file lists & struct declatations 2020-03-14 15:39:59 +11:00
626b2bd071 Cleanup: use doxy sections 2020-03-14 15:39:53 +11:00
acab745078 UI: Toolbar icons
- Add icons for Sculpt Cloth, Clay Thumb and Draw Face Sets, as well as GP Tint, Replace and Transform Fill tools
  - Tweak icons for Sculpt Rotate, Pinch, Multiplane Scrape, Inflate, Blob, Draw Sharp, based on feedback on Devtalk
2020-03-14 01:31:28 +01:00
5260aaf3b1 Fix T73921: Eevee volume render test memory leak in Mantaflow
Fixed memory leak that showed up after the original issue (crash) had been fixed in 93ac4709eb. The fix ensures that light cache bakes free up GPU smoke textures and the smoke domain list correctly.

This commit also removes the workaround (f3a33a9298) that disabled light cache bakes for fluid objects.
2020-03-14 00:30:55 +01:00
7d56c425f8 GPencil: Don'r Replace color if vertex color is empty
The replace tools only must work over previously vertex painted.
2020-03-13 21:54:54 +01:00
dc99c3532a Cleanup: USD, move some common code to an abstract superclass
The `check_is_animated()` function will be used by the upcoming Alembic
exporter as well. There is nothing USD-specific in the function.

No functional changes.
2020-03-13 18:17:51 +01:00
ebf3c87912 Fix T74699: File browser closing while loading crash.
Owner of filelisting job was changed, without proper update of all
access/usages of that owner to reach the job, leading to failure of
timer removal from the WM, and attempt to double-free the job...

Caused by rB2c4dfbb00246ff.
2020-03-13 17:34:21 +01:00
5ad16e6a11 Cleanup: BKE_mesh_nomain_to_mesh: Add assert that source mesh is indeed not in Main. 2020-03-13 17:17:26 +01:00
4e26afe0ae Cleanup: Comments of wmJobs callbacks. 2020-03-13 17:17:26 +01:00
110a35ef5a Fix T74397: Crash after undoing quadriflow remesh on duplicate with armature deform
The issue was that we were creating temporary mesh copies and storing
them in bmain and then later using BKE_mesh_nomain_to_mesh which would
add them to bmain once more (duplicates).

This would lead to crashes later as the custom data of the mesh could be
trashed quite easily.
2020-03-13 16:29:30 +01:00
de30fda04e Fix T74686: Loading btx file in multires modifier is not working
Was happening when object does not have CD_MDISPS allocated yet.
Need to make sure totdisp and level is specified on CD_MDISPS data
prior to loading (as the load expects them to be properly set).
2020-03-13 16:15:31 +01:00
67704cb8aa Multires: Fix loosing sculpt data when using external BTX file 2020-03-13 16:15:31 +01:00
6bcb6a0ea6 Fix stereoscopy reference image drawing in the viewport
Note: Without D6922 stereo is too broken to even test this patch.
With D6922 + this patch the fullscreen modes work (anaglyph/interlace not yet).
2020-03-13 16:07:19 +01:00
be76a37c91 GPencil: Fix UI typo 2020-03-13 15:50:26 +01:00
5593efec01 Fix stereoscopy drawing for camera background
Part of the fix was to get gputexture to use an array to accomodate each
eye. This takes care of viewports showing individual Left or Right
views.

For the combined view the fix was in overlay_image.c:camera_background_images_stereo_setup.

Note 1: Referece images are still not supporting stereo.

Note 2: For painting, and getting image bindcode I'm hardcording a
single-view experience.

Note 3: Without D6922 stereo is too broken to even test this patch.
With D6922 + this patch the fullscreen modes work (anaglyph/interlace
not yet).

Differential Revision: D7143
2020-03-13 15:40:20 +01:00
93ac4709eb Fluid: Potential fix for Eevee tests crashing with Mantaflow
Belongs to T73921. This commit fixes the crashes with light baking (disabled in f3a33a9298). There is still a memory leak to be fixed though.
2020-03-13 15:34:07 +01:00
525bd62557 Potential fix for T74609: File Selector Crashes Showing Thumbnails.
Existing code was definitively giving possibility to access freed
memory, although probably not on a super-common basis...
2020-03-13 14:37:28 +01:00
bc0a0cdf17 Multires: Fix Subdivide, Reshape and Apply Base
This change fixes artifacts produced by these operations.

On a technical aspect this is done by porting all of the operations
to the new subdivision surface implementation which ensures that
tangent space used to evaluate modifier and those operations is
exactly the same (before modifier will use new code and the operations
will still use an old one).

The next step is to get sculpting on a non-top level to work, and
that actually requires fixes in the undo system.
2020-03-13 14:14:56 +01:00
b0a1af4eb1 Multires: Increase default quality to 4
Makes it work better "out of the box" for irregular topology like
Suzanne mesh.

There might be some performance impact on non-regular meshes, but
those are not very common usecase for multires and for those its
always possible to lower the quality if needed.
2020-03-13 14:13:37 +01:00
f36d98bb1d Subdiv: Fix loose geometry callbacks in certain conditions
Loose vertices and vertices of loose edges callback was not working
correct if some of other callbacks were set to NULL.

Was caused by missing bitmask set in the callbacks which were set
to NULL.
2020-03-13 14:07:44 +01:00
8622372256 OpenSubdiv: Make non-full geometry less strict for sharpness
Allow to mark individual vertices as infinitely sharp even if there is
no full topology and no access to edges: infinite sharp vertices do not
need connectivity information.
2020-03-13 14:07:44 +01:00
48e0af52e6 GPencil: Fix typo error 2020-03-13 13:08:45 +01:00
4326d162ba GPencil: Enable Lights ON to default object in 2D template 2020-03-13 13:06:02 +01:00
Bogdan Nagirniak
9075ec8269 Python: add foreach_get and foreach_set methods to pyrna_prop_array
This allows fast access to various arrays in the Python API.
Most notably, `image.pixels` can be accessed much more efficiently now.

**Benchmark**

Below are the results of a benchmark that compares different ways to
set/get all pixel values. I do the tests on 2048x2048 rgba images.
The benchmark tests the following dimensions:
- Byte vs. float per color channel
- Python list vs. numpy array containing floats
- `foreach_set` (new) vs. `image.pixels = ...` (old)

```
Pixel amount: 2048 * 2048 = 4.194.304
Byte buffer size:  16.8 mb
Float buffer size: 67.1 mb

Set pixel colors:
    byte  - new - list:    271 ms
    byte  - new - buffer:   29 ms
    byte  - old - list:    350 ms
    byte  - old - buffer: 2900 ms

    float - new - list:    249 ms
    float - new - buffer:    8 ms
    float - old - list:    330 ms
    float - old - buffer: 2880 ms

Get pixel colors:
    byte - list:   128 ms
    byte - buffer:   9 ms
    float - list:  125 ms
    float - buffer:  8 ms
```

**Observations**

The best set and get speed can be achieved with buffers and a float image,
at the cost of higher memory consumption. Furthermore, using buffers when
using `pixels = ...` is incredibly slow, because it is not optimized.
Optimizing this is possible, but might not be trivial (there were multiple
attempts afaik).

Float images are faster due to overhead introduced by the api for byte images.
If I profiled it correctly, a lot of time is spend in the `[0, 1] -> {0, ..., 255}`
conversion. The functions doing that conversion is `unit_float_to_uchar_clamp`.
While I have an idea on how it can be optimized, I do not know if it can be done
without changing its functionality slightly. Performance wise the best solution
would be to not do this conversion at all and accept byte input from the api
user directly, but that seems to be a more involved task as well.

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

Reviewers: JacquesLucke, mont29
2020-03-13 12:59:36 +01:00
db4298c6be GPencil: Avoid segment fault when use Simplify modifier
The number of points of the evaluated stroke can be less than original or the original can use less points that evaluated.
2020-03-13 12:57:59 +01:00
cb19bb7f57 Cleanup: USD, removed unused export job data
The code was copied from the Alembic exporter, and some of the options are
no longer used.

Not updating the Alembic exporter itself, as this will be done in a much
larger rewrite.
2020-03-13 12:34:03 +01:00
cf9b3310c0 GPencil: Fix Noise modifier versioning
The versioning was setting the factor for all modes without checking flags.

Also cleanup some unused code.
2020-03-13 12:24:49 +01:00
91ca3c3c0b Fix T74696: Segment fault in Noise modifier using Vertex Groups 2020-03-13 12:07:36 +01:00
1ca582c651 Fix IDTypeInfo not having enough bits for ID filter flag 2020-03-13 12:06:29 +01:00
3652870483 GPencil: Cleanup unneeded check 2020-03-13 11:16:02 +01:00
de9c7bae7b GPencil: Join Tint and Vertex Color modifier
Both are doing almost the same and can be merged. This reduce complexity for user and less code to maintain.

Reviewed By: mendio, pepeland, fclem

Differential Revision: https://developer.blender.org/D7134
2020-03-13 10:28:59 +01:00
df032580c1 Fix info showing multi-line reports reversed (upside-down)
Also, only show the icon once per report.
2020-03-13 20:14:33 +11:00
Jeroen Bakker
54743dbf09 DeformMod: Performance by reusing buffers
The Deform modifiers was reallocating buffers that only fit the vertices
of the inner loop. This patch first counts the maximum needed buffer and
allocates one.

When using the daily dweebs animation file the playback performance went
from 0.66 fps to 0.93 fps.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D7132
2020-03-13 09:28:58 +01:00
1f0b21e713 Cleanup: pass const args (mostly Scene & RenderData) 2020-03-13 17:27:11 +11:00
fa823f0af8 Fix boundary edges detection ignoring Face Set visibility
If one of the faces connected to a vertex is hidden in the face sets, we
can assume that the vertex is part of a boundary edge, so it should be
cosidered like that in all automasking and edge detection functions.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D7126
2020-03-12 20:47:31 +01:00
69eaa19340 Fix flood fill operation not taking into account hidden vertices
The idea of the visibility system is that tools should behave like
hidden vertices do not exist, so the flood fill operation should ignore
hidden vertices for all operators.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D7125
2020-03-12 20:45:06 +01:00
b0271c6e40 Use golden ratio conjugate for Face Sets hue generation
The face set ID is sequential, so implementing this was straightforward.
Suggested by Jeroen Bakker

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D7123
2020-03-12 20:43:38 +01:00
53c03d4679 Fix Face Set operators not modifying sigle poly Face Sets
The face_set_set function which sets a face sets given a vertex index
can ignore all modifications to hidden face sets, so we can skip all
vertex visibility checks outside that function. This makes the code
faster, simpler and fixes multiple bugs.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D7122
2020-03-12 20:38:57 +01:00
9dcd6ba3eb Fix T74646: Pick a random face set to be rendered white when randomizing the colors
The previous solution was also working fine as the white face set has no
meaning, but now it is a little bit more random. Also, bigger face sets
have more chance of getting the white color.

Reviewed By: jbakker

Maniphest Tasks: T74646

Differential Revision: https://developer.blender.org/D7111
2020-03-12 20:37:49 +01:00
88fd2b1dd5 Fix T74648: Do not relax with 0 neighbors or no vertex normal
The mesh provided in the report has 0 area faces and overlapping
vertices, causing the relax code to fail when calculating the plane to
constraint the vertex movement. Now it works fine both in the brush and
in the mesh filter.

Reviewed By: jbakker

Maniphest Tasks: T74648

Differential Revision: https://developer.blender.org/D7109
2020-03-12 20:36:49 +01:00
088b92b92c Fix mesh shrinking when using the relax mesh filter.
If the relax mesh filter was used on a non manifold mesh with open
boundaries, all the vertices were relaxed and the mesh was shrinking.
This was an unintended behavior that was making the filter unusable with
these meshes.

The mesh filter is now initializing an automasking buffer using the same
boundary automasking function from the brush code. Now edges are
preserved and the relax filter works as it should.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D7097
2020-03-12 20:35:52 +01:00
472534d16e Fix memory leak in recent Cycles image texture refactor 2020-03-12 20:30:49 +01:00
2050baa139 GPencil: Move Vertex Paint mode to topbar
It's more easy to find in the topbar
2020-03-12 20:29:04 +01:00
c1290a1d1f GPencil: Fix color management in Vertex Paint tools
The brush is using sRGB and need to be Linear
2020-03-12 19:39:10 +01:00
649fdc7938 Fix T73049: Drag & drop on overlapping panels behaves incorrectly
Reviewers: brecht, Severin

Differential Revision: https://developer.blender.org/D7024
2020-03-12 19:36:13 +01:00
11e4827738 Fix T74670: crash during copy paste of objects.
Embedded data should always be considered as outside of Main database
here.

Note that it's a bit of an edge case to decide whether those should
always have their `LIB_TAG_NOMAIN` set too, or not? For now, let's keep
things as they are here.
2020-03-12 18:08:11 +01:00
4669dfe2cc Expose 'is embedded data' ID flag to RNA.
Relevant currently for root node trees and master collections.
2020-03-12 18:08:11 +01:00
38ba022858 Fix T66505: Dope Sheet shows empty Grease Pencil/Annotation layers
The behaviour of GP layers is the same as annotation layers: they show
in the dope sheet regardless of whether they have frames or not. This is
easily resolved by adding some extra filtering.
2020-03-12 17:33:48 +01:00
741888ce08 Cleanup: simplified Grease Pencil animdata filter
Part of the function was following an "if-ok: do-this" pattern, and then
mid-function switched to a "if-bad: skip" pattern. The function now just
uses the latter.

No functional changes.
2020-03-12 17:33:48 +01:00
26bea849cf Cleanup: add device_texture for images, distinct from other global memory
There was too much image texture specific stuff in device_memory, and too
much code duplication between devices.
2020-03-12 17:28:55 +01:00
75be60a667 Fix build error with recent OpenImageIO versions 2020-03-12 17:19:57 +01:00
f130c5ddb6 EEVEE: Update Preview file with new lightcache 2020-03-12 17:03:58 +01:00
5c427f4b17 GPencil: Fix unreliable comparison 2020-03-12 16:34:05 +01:00
63ee3db961 Fix T73228: UI shows settings of wrong marker when movie clip is offset 2020-03-12 15:53:52 +01:00
5929dd7129 Fix T73212: Gizmo's are still interactive when behind nodes 2020-03-13 01:29:06 +11:00
85ea7dfc54 Cleanup: move gizmo handling into a function 2020-03-13 01:29:06 +11:00
fe5933a972 Fix T71961: Soft body behavior is incorrect when CTRL + F12 animation is rendered.
The softbody modifier was missing the transform depsgraph relation and
thus the object matrix would not get updated during animation render.
2020-03-12 15:29:50 +01:00
37a07f812b Cleanup: remove unused node tree user counting functions 2020-03-12 13:23:02 +01:00
16ed7aebf2 Bug report preset update (last worked version)
I updated the "Worked" field in the online form but forgot to do it for
the oeprator from within Blender.
2020-03-12 11:14:53 +01:00
6c707aad6a Fix T74605 Key Indicator for motion paths not updating for objects
This fixes a functional change in 4db2a08281,
which was marked as 'should have non-functional changes only'.
2020-03-12 11:08:45 +01:00
4ba6a00afc GPencil: Change Build modifier UI layout for Influence Filters
The layer filter was not following the standard layout
2020-03-12 10:39:41 +01:00
8363e10ccc Fix T74659: Seaching for operator crashes Blender
The poll function was not checking the paint pointer.
2020-03-12 10:17:48 +01:00
21f016f010 DrawManager: Pack Draw State Bits
Some draw state bits are mutual exclusive. This patch will free some
draw state bits by packing the mutual exclusive bits in a mask.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D7088
2020-03-12 09:35:27 +01:00
456595fd39 Fix T74392: HDRI preview spheres appear in render passes and reflections
Do not render HDRI Previews when a renderpass is active

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D7005
2020-03-12 09:27:28 +01:00
0c0895e3e6 Fix move-3D gizmo in use 2D spaces
This fixes node corner-pin and sun-beam gizmo's cursor offsets.
2020-03-12 19:17:39 +11:00
d4d9ded09b Cleanup: text view API
- Use typed enum for line_data callback.
- Pass in 'const' arguments where possible.
- Use 'r_' prefix for return arguments.
- Remove unused return value from line_get callback.
- Remove redundant casts.
2020-03-12 16:18:38 +11:00
Phil Stopford
6ce709dceb Ocean: add new spectra modes to the ocean modifier
This extends the ocean modifier to add new spectra
(Pierson-Moskowitz, Jonswap, TMA).

These models are very different to the Phillips spectrum.
They are intended for more established,
large area, oceans and/or shallow water situations.
2020-03-12 15:48:20 +11:00
1aebcdbb3a Cleanup: spelling, clang-format 2020-03-12 12:34:54 +11:00
74855969e7 Cleanup: use term suppress instead of repress
Also check MSVC instead of WIN32, for setting MSVC flags.
2020-03-12 12:13:41 +11:00
8751af6d19 EEVEE: Bump minimum probe level to make rough reflection more precise 2020-03-12 01:33:56 +01:00
27e0998a8a EEVEE: Hair: Fix wrong color when using color attribute without actual data 2020-03-12 00:43:09 +01:00
72461c09b4 Windows: Clean-up warnings originating from bullet
Bullet currently generates the majority of the warnings
on windows all of them are silly. This patch disables
all warns from bullet for now.

We should revisit this if/when we update bullet
to a newer version.

Reviewed By: sergey brecht

Differential Revision: https://developer.blender.org/D7118
2020-03-11 14:11:19 -06:00
372dcacbe4 Windows: Cleanup warning about non returning dtor
`google::LogMessageFatal::~LogMessageFatal` calls `abort`
which MSVC correctly identifies as 'not returning'
and warns about a potential memory leak.

Given this is intended behaviour and glog is not overly
concerned with shutting down the process nicely, we
can safely ignore this warning.
2020-03-11 14:07:47 -06:00
e6d0a438ab Fix T73626: crash scrubbing timeline with Cycles viewport and smoke/fire 2020-03-11 20:45:39 +01:00
6cf4861c3a Cleanup: refactor image loading to use abstract ImageLoader base class
Rather than passing around void pointers, various Blender image sources now
subclass this. OIIO is also just another type of image loader.

Also fixes T67718: Cycles viewport render crash editing point density settings
2020-03-11 20:45:39 +01:00
d8aa613d94 Cleanup: add ImageHandle to centralize image ownership logic 2020-03-11 20:35:38 +01:00
ec3eeee46b Cycles: add internal default volume shader, to be used for new volume object
This is mostly straightforward, but required some refactoring to ensure that
the default volume material does not always turn on the volume feature for GPU
rendering.
2020-03-11 20:35:38 +01:00
5a169ae2f3 Cleanup: remove foreach include from header, conflicts with OpenVDB 2020-03-11 20:35:38 +01:00
21821601f2 Fix Optix build error on Linux with some compilers 2020-03-11 20:35:38 +01:00
cbb854a98f Cleanup: Fix build warning on windows.
printf is called for a size_t (64 bit on x64) type
but the formatter is `%lu` (32 bit) leading to a
warning with MSVC.

`%zu` is the appropriate formatter.
2020-03-11 13:26:09 -06:00
33c6b269d1 EEVEE: Fix test crashing
Probe counting now needs to have proper gl capabilities initialised to run
correctly.
2020-03-11 18:52:16 +01:00
12e64e5ec1 Cleanup: Fix unused debug var warning. 2020-03-11 18:50:48 +01:00
366d951b0c GPencil: Change default hardeness for Airbrush 2020-03-11 18:02:05 +01:00
e9220d5cd0 Depsgraph: Fix crash deleting Viewer image from Outliner
Was happening when having compositor open with Viewer node attached
directly to Render Layers output.

There were two things involved here:

1. The code which was storing CoW-ed versions of IDs was checking all
   IDs for whether they are expanded or not. This was causing access
   of freed memory for deleted IDs which do not need CoW (such as IM).

   Simple fix: store ID type as a scalar and use early check before
   doing more elaborate check based on accessing fields of id_cow.

2. The code which was ensuring view layer pointer is doing CoW for
   scene. This isn't an issue on its own, but scene might have an
   embedded ID such as compositor which was actually traversed by the
   ID remap routines. This was causing remapping procedure to go into
   non-updated copy of compositor, accessing freed Viewer image ID.

   Solved by not recursing into embedded IDs for datablocks as those
   are supposed to have own copy-on-write operations which takes care
   of re-mapping.

Reported my Bastien, and also pair-coded with him.
2020-03-11 17:38:42 +01:00
Giovanni Remigi
19b46b2fca Fix Cycles crash in BVH8 build due to out of bounds memory access
Differential Revision: https://developer.blender.org/D7114
2020-03-11 17:35:11 +01:00
200695dd89 Windows: Clean-up linker warnings regarding MSVCRT.lib
For debug builds we link the against the release mode libs
for C based libraries, which are technically linked against
a different CRT, which the linker will implicitly try to link.

Which results in a linker warning about mixing the debug/release CRT.

This patch prevents the implicit linking of the release
CRT in debug configurations for sub projects that had issues
with it.
2020-03-11 10:33:12 -06:00
a9c0ad53e2 Cleanup: Typo in comments. 2020-03-11 17:29:20 +01:00
a54e17e52d LibQuery: Add option to NOT process embedded IDs.
Request from depsgraph department, which does basically consider those
embedded IDs as any other data-block (unlike any BKE ID management code).
2020-03-11 17:26:58 +01:00
7dd0be9554 EEVEE: Replace octahedron reflection probe by cubemap array
We implement cubemap array support for EEVEE's lightcache reflection probes.
This removes stretched texels and bottom hemisphere seams artifacts caused
by the octahedral projection previously used.

This introduce versioning code for the lightcache which will discard any
lightcache version that is not compatible.

Differential Revision: https://developer.blender.org/D7066
2020-03-11 17:12:16 +01:00
c476c36e40 Workbench Simplification Refactor
This patch is (almost) a complete rewrite of workbench engine.
The features remain unchanged but the code quality is greatly improved.
Hair shading is brighter but also more correct.

This also introduce the concept of `DRWShaderLibrary` to make a simple
include system inside the GLSL files.

Differential Revision: https://developer.blender.org/D7060
2020-03-11 17:12:16 +01:00
f01bc597a8 Cleanup: stop encoding image data type in slot index
This is legacy code from when we had a fixed number of textures.
2020-03-11 17:07:17 +01:00
9910803574 Fix Cycles link error with debug + asan after RTTI changes 2020-03-11 17:05:15 +01:00
9ef7759bf0 Fix (unreported) bad user refcounting of viewer image ID.
This is typical case where you do not want to use actual ID refcounting,
but only the shallow 'user real' (aka 'user one') system...
2020-03-11 16:51:53 +01:00
e1698e3750 Windows: Clean-up warning while building blendthumb
Casting a 64 bit pointer to a 32 bit DWORD gave 2 warnings.
Solved by storing the actual DWORD in the registry table.

Would have preferred to use a union, but C++ doesn't let you
initialize anything other than the first field, and C99 style
initializers are not supported until C++20, so this solution
will have to do until then.
2020-03-11 09:27:35 -06:00
6a632f11c8 GPencil: Add missing Layer buttons in Dopesheet header and remove unneeded options
Update Dopesheet header to include missing buttons, remove Scene Active only buttton and also removed duplicated search box.

The removed options come from old 2.7x version and they are not required now.

Reviewed By: mendio, pepeland

Differential Revision: https://developer.blender.org/D7107
2020-03-11 16:10:47 +01:00
b198cef89f Fix T74516: Armature Crash on Select Similar Group
Select Similar Group and Select Similar Shape had this issue since they
were added. Basically it assumes there is pose data which in some cases
it does not.
2020-03-11 15:32:21 +01:00
Brecht Van Lommel
b9f6d033be Eevee: internal support for arbitrary number of volume grids
This has no user visible impact yet since smoke volumes only support a fixed
set of attributes, but will become important with the new volume object.

For GPU shader compilation, volume grids are now handled separately from
image textures. They are somewhere between a vertex attribute and an image
texture, basically an attribute that is stored as a texture.

Differential Revision: https://developer.blender.org/D6952
2020-03-11 14:59:05 +01:00
e1e772a802 Cleanup: add comment explaining reason for volume texture swizzling 2020-03-11 14:52:55 +01:00
c4beb518de Cycles: disable RTTI only for OSL files, other libraries like OpenVDB need it
This is a bit weak since it's not entirely clear where the boundary is, but
tested to build and pass tests on all platforms.
2020-03-11 14:42:46 +01:00
Brecht Van Lommel
c8acb6dd6c Smoke: put density/color in separate textures, fixes for workbench shader
This is more in line with standard grids and means we don't have to make
many special exceptions in the upcoming change for arbitrary number of volume
grids support in Eevee.

The workbench shader was also changed to fix bugs where squared density was
used, and the smoke color would affect the density so that black smoke would
be invisible. This can change the look of smoke in workbench significantly.

When using the color grid when smoke has a constant color, the color grid
will no longer be premultiplied by the density. If the color is constant
we want to be able not to store a grid at all. This breaks one test for
Cycles and Eevee, but the setup in that test using a color without density
does not make sense. It suffers from artifacts since the unpremultiplied
color grid by itself will not have smooth boundaries.

Differential Revision: https://developer.blender.org/D6951
2020-03-11 14:42:46 +01:00
f3a33a9298 Fix/workaround Eevee tests crashing with Mantaflow
Skip light cache baking until T73921 is fixed. This should be fixed properly
but being able to run the tests at all is important now.
2020-03-11 14:42:46 +01:00
4bee1e1c8c Fix broken logic in lib_query that could lead to NULL id_owner pointer.
Issue revealed by own recent cleanup in rB8820ab4, and moticed by
@brecht, thanks.

Note that am not 100% sure whether we should allow call on lib_query
without a proper valid owner_id, for embedded data-blocks. But this can
be investifated later, so far things have been working like that.
2020-03-11 14:37:38 +01:00
836b99ce49 Fix T74296: Free depsgraph when view layer is removed
Reviewers: sergey

Differential Revision: https://developer.blender.org/D7110
2020-03-11 14:18:22 +01:00
6eeaecdd67 Cloth: Copy point cache settings when copying cloth modifier
This fixes the issue mentioned in the comment in T74515.

Reviewers: mont29

Differential Revision: https://developer.blender.org/D7104
2020-03-11 13:43:58 +01:00
5cb2861420 Fix Cycles incorrect result when compressing some 8 bit log colorspace images
Don't clamp and do premultiply after color space conversion.
2020-03-11 12:59:29 +01:00
68c0d77b0c Cleanup: rename 'private' to 'embedded' for sub-data IDs.
'Private' can be a rather confusing term, especially when considering
its meaning in programming languages.

So now root node trees and master collections are 'embedded' IDs
instead.
2020-03-11 12:53:10 +01:00
8820ab41bd Cleanup in ID remapping code re owner_id vs. self_id.
The former is always a real, in-Main data-block, while the later, when
different, should be one of those embedded 'private' IDs (like root node
ree or master collection).
2020-03-11 12:53:10 +01:00
8b2072868d Cleanup: spelling 2020-03-11 21:39:56 +11:00
796683db8e Cycles: add view layer setting to exclude volumes, like hair and surfaces 2020-03-11 11:25:57 +01:00
b70a13fb66 UI: show more digits for adaptive sampling noise threshold 2020-03-11 10:54:28 +01:00
476c0eab4a Fix T74315: Cloth brush breaks orbit around selection
Reviewers: pablodp606

Differential Revision: https://developer.blender.org/D7095
2020-03-11 10:30:52 +01:00
e1b70e9f9c Fix T74635: GPencil RMB-menu brush settings not working in Sculpt and Weight Paint modes 2020-03-11 10:14:42 +01:00
f2c64517b5 Fix T74607: Modifier key click events ignore mouse wheel
Alt-Wheel would sent Alt-Click event, prompting to switch tools.
2020-03-11 20:09:37 +11:00
d195deef5c Cleanup: clang-format 2020-03-11 19:23:52 +11:00
Greg Neumiller
d0618570eb UI: edit modifier messages to clarify where auto-smooth is set 2020-03-11 19:19:29 +11:00
1c9829f351 GHOST: tests now build again
GLX gears work as expected, multitest_c only creates windows
but misses font drawing still.
2020-03-11 15:17:27 +11:00
15983243a4 Cleanup: remove bitmap font drawing ifdef from MultiTest.c 2020-03-11 15:01:14 +11:00
4184f890fd GPU: minor changes to support standalone GHOST builds
- Move gpuPush/Pop from GPU_draw.h into GPU_state.h
  as this is for pushing/popping state.
- Add 'GPU_STANDALONE' define, to bypass use of user-preferences
  for theme colors and pixelsize, as well as pbvh init/free functions.

Needed to get GHOST tests working again.
2020-03-11 14:52:57 +11:00
f9cca12886 Fix T74596: Gpencil invert button was not working for Sculpt brushes
The button was not checked, only the pen position or the control key.
2020-03-10 20:12:11 +01:00
9c5a120ba2 GPencil: Use high precision float buffer for final rendering
This avoid color drifting due to R11G11B10 buffers.
2020-03-10 18:17:42 +01:00
fa09b900c2 Fix T74625 GPencil: Airbrush doesn't paint anything 2020-03-10 18:11:25 +01:00
0f1f751785 Fix T74525: Fluid caches overwrite each other by default
Reviewers: sebbas

Differential Revision: https://developer.blender.org/D7093
2020-03-10 17:33:05 +01:00
a6d7280b8e Fix T74200: Alembic import crashes Blender
I've added a very minimal mesh validation before the Alembic mesh is actually
converted to a Blender mesh. This prevents a specific crash with an example
file attached to T74200.
2020-03-10 17:16:12 +01:00
7c027f9480 Cycles: Fixed Shadow and Mist passes with adaptive sampling.
This also fixes a side-effect where turning on UV pass but leaving
Shadow pass turned off destroyed the Combined pass.
2020-03-10 16:50:51 +01:00
be20bf2fc0 Fix T74617: Gpencil Sculpt Strength brush gets wonky results
Changed how the strength is calculñated and reduce the factor to get a smoother result.
2020-03-10 16:45:51 +01:00
1619a5d8e9 Fix rendering artifacts when changing Face Sets visibility
All sculpt operators and brushes need to use ID_RECALC_SHADING even when
PBVH rendering is not used.
2020-03-10 16:32:09 +01:00
dc8bb3f3a0 Cleanup: Clarify places to look for subversion bump 2020-03-10 16:17:49 +01:00
b37482bc3d Fix T74613: Assign the default face set color in the versioning code
A default face set color was not being set in previously saved meshes,
so it will always render the default face set with a random color until
the colors were recalculated.

Bump subversion to 283.8

Reviewed By: dfelinto

Maniphest Tasks: T74613

Differential Revision: https://developer.blender.org/D7094
2020-03-10 15:55:50 +01:00
e06888cf89 Cleanup: Add comment explaining DPI influence on RNA pixel-properties
Good to be explicit about the fact that we may still use the pixel
property sub-type when DPI will be applied.
See comments in https://developer.blender.org/D7077.
2020-03-10 15:19:22 +01:00
d55231e5a1 UI: Clarify 3D View Grid Size Tooltip
The 3D view grid size property is a multiplier, not the size of the grid itself.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D7085
2020-03-10 08:44:30 -05:00
a52f6d7a31 Fix T66269: Menu for Extrapolation Mode is disabled in Graph Editor
The Extrapolation Mode menu in the graph editor channel list was
incorrectly using the operator for the Action/Dopesheet editor. The
operator was even missing in the generic dopesheet hotkeys, so
{key Shift E} was listed as hotkey but didn't work. This is now all
fixed.
2020-03-10 14:18:19 +01:00
a801487ef5 Fix T65076: Missing EasingType implementation on the Dopesheet
EasingType was implemented rBdaccaa713b6e for the GraphEditor (but never
made it to the Dopesheet). If you can select Easing Mode in the
DopeSheet, then you should also be able to select the associated Easing
Type.

Thanks @lichtwerk for the initial implementation.

Maniphest Tasks: T65076

Differential Revision: https://developer.blender.org/D6094
2020-03-10 14:02:40 +01:00
ca717f0489 Fix T74425: Cannot texture paint an images sequence anymore
Caused by the introduction of UDIM (rBc30d6571bb47).

We need to make sure the tiles ImageUser is set up correctly [especially
the framenr], otherwise BKE_image_acquire_ibuf() and friends will fail
to find the correct ImBuf.

Also instead of initializing a minimal BKE_imageuser_default, now use
an appropriate ImageUser if avaliable and pass this around (instead of
just the tile_number). 2D painting can reuse the Image Editor ImageUser,
for 3D painting we still rely on a default ImageUser in most places, but
at least set the framenr correctly].

This also fixes crashes when doing image operations such as inverting or
resizing on images in a sequence in the Image Editor.

This also fixes color sampling (S) from the 3DView going wrong for image
sequences (would fallback to OpenGL sampling because an ImBuf could not
be found).

Maniphest Tasks: T74425

Differential Revision: https://developer.blender.org/D7022
2020-03-10 13:47:33 +01:00
212660f467 Fix T73369: corner pin & sun-beam nodes gizmos are too big
Note that dragging isn't working well,
however this was an issue in previous releases.
2020-03-10 23:30:59 +11:00
85cdf9a1b9 Fix T74612: file browser thumbnails not showing and using CPU continuously
This started happening after changing filter ID to 64 bit in rB2841b2be3949,
however there was a pre-existing error here in the comparison to detect updates
to filter flags.
2020-03-10 13:11:32 +01:00
Lucas Veber
915998111b Modifiers: Corrective Smooth modifier, new Scale parameter
When scaling the root bone of a rig to apply a global scale, the
corrective smooth modifier results in wrong deformation due to incorrect
scaling. The delta calculations are not taking into account any scale
value.

To fix it, a scale property is added to the modifier, allowing to set
manually the scale value for the deltas by simply multiplying the
vectors by this value. There is a similar implementation in Maya's Delta
Mush deformer. This property can be for example driven by the scale of
the root bone of the rig, to dynamically update when the animator scale
this bone.

Reviewed By: brecht, sybren

Differential Revision: https://developer.blender.org/D6622
2020-03-10 12:49:08 +01:00
982b498c22 OVERLAY: Viewport Background Color visible in Material Preview Mode
When user used a custom background color, this color was also visible in
material preview mode, when the world opacity was less than 1. This
patch will draw the theme color as it was used to.
2020-03-10 11:36:39 +01:00
dc3ff1db3f Fix T74585: Crash when scrolling viewport shading pop-up
Was dereferencing NULL pointer. Mistake from d5572eacc5.
2020-03-10 11:21:00 +01:00
9f48852ba4 Buildbot: Enable version character for development builds
Allows to have 2.82a as a beta version on buildbot.
2020-03-10 10:23:28 +01:00
1aa7c4c28a GPencil: Cleanup float indicator 2020-03-10 08:58:25 +01:00
Stefan Werner
811569dc11 Cycles: Using OpenCL popcount() in PMJ sampler. 2020-03-10 08:53:30 +01:00
7b8ac04d86 Fix T74601: Cut Particles to Shape fails for transformed object 2020-03-10 16:55:41 +11:00
5aa54207e1 Fix sequencer Slip tool skipping offset=0 case
The slip tool wasn't being applied when the offset was zero.

This caused modal operation to skip applying this offset while dragging.
2020-03-10 16:09:57 +11:00
5184328991 Cleanup: replace term 'terrible' from sequence slip
Joke from branch name, makes comments unclear.
2020-03-10 15:53:18 +11:00
94a5b7a2e2 Fix vertex slide deselecting faces
Regression from 9a5df92c1b
2020-03-10 15:15:52 +11:00
163e6b348f Cleanup: GPencil: Remove uneeded cast 2020-03-10 05:01:13 +01:00
71712d828d GPencil: Fix RNA range for uv_rotation 2020-03-10 04:47:37 +01:00
c971e812d5 Fix T74536: Grease pencil immediately crashes on macOS
It seems like OSX drivers are using standard attributes for passing
gl_VertexID and gl_InstanceID to the vertex shader, and count them in the
limit of MAX_VERTEX_ATTRIBS.

This patch make sure to never use more than 13 attributes by packing some
attributes together.
2020-03-10 04:47:37 +01:00
bf1b323b15 DRW: Fix wrong test condition
Fixes the warning: address of array 'cmd->draw.batch->inst' will
always evaluate to 'true'
2020-03-10 04:47:37 +01:00
ec9b836d3b Fix T74579: Filename with '\' causes assert when browsing files 2020-03-10 12:29:37 +11:00
fbe81db29a Fix IC keymap after recent GP merge
Just a simple fix here for now to keep the keymap working. Will revisit these areas to make them fit in properly with the keymap.
2020-03-09 23:23:06 +01:00
9c5522f7c8 Cleanup: compiler warnings 2020-03-09 21:58:55 +01:00
0133d66ada Fix error in grease pencil vertex paint levels operator 2020-03-09 21:58:55 +01:00
Pablo Dobarro
4652f23fa3 Fix T74354: Avoid division by 0 when calculating hardness
I could not reproduce the issue, but it looks like it was produced by
this division by 0. In any case, the code here was wrong.

Reviewed By: jbakker

Maniphest Tasks: T74354

Differential Revision: https://developer.blender.org/D6987
2020-03-09 21:19:55 +01:00
84b94f9e7b Sculpt: Edge Automasking
This automasking option protects the open boundary edges of the mesh from the brush deformation. This is needed to sculpt cloths and it works nicely with the cloth brush.
It has a Propagation Steps property that controls the falloff of the mask from the edge.

Limitations:
- The automask is recalculated at the beginning of each stroke, creating a little bit of lag in high poly meshes, but it is not necessary. This can be fixed in the future by caching the edge distances, increasing a little bit the complexity of the code.
- The boundary vertex detection in meshes is not ideal and it fails with triangulated geometry, but it is the same as in the smooth brush. After fixing this, we should refactor the smooth brush to use the API and let the automasking option manually control the affected vertices.
- It does not work in Multires (it needs to be implemented in the API). The smooth brush in Multires is also not making boundary vertices.
- The falloff has a visible line artifact on grid patterns. We can smooth the final automasking factors several iterations, but it will make the initialization much slower. This can also be added in the future if we decided to cache the distances.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D6705
2020-03-09 21:16:02 +01:00
Yevgeny Makarov
04e9ba7169 UI: add menus for preferences editor
This only applies to the case where preferences are opened as an editor in
a workspace, not with Edit > Preferences in a new window.

Differential Revision: https://developer.blender.org/D7001
2020-03-09 20:18:11 +01:00
Adrian Newton
2d8d30e17b UI: make workbench viewport samples label consistent with Cycles and Eevee
Differential Revision: https://developer.blender.org/D7082
2020-03-09 20:18:11 +01:00
Adrian Newton
848a4f002d UI: add "Samples" text to audio mixing buffer size preference for clarity
Differential Revision: https://developer.blender.org/D7076
2020-03-09 20:18:11 +01:00
18e3615a68 Face Sets: Use white color for a default Face Set to enable the overlay
This introduces a variable to store a face set ID which is going to be
rendered white. When initializing a mesh or randomizing the colors, this
variable gets updated to always render a white face set. This way the
face set overlay can be enabled without adding colors to the mesh if
face sets are not in use. After creating the first face set, new colors
are generated randomly like usual.

The face set stored as default does not have any special meaning for
tools or brushes, it just affects the rendering color.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D7035
2020-03-09 20:11:18 +01:00
0dfb4ac1ff Face Sets: Add relax support to Mesh Filter and Draw Face Sets
This enables a relax operation that works only on face sets boundaries,
which smooths the jagged edges that are produced when painting or
expanding face sets by sliding the topology without affecting the shape
of the mesh. This has many uses in hard surface sculpting for things
like sculpting panels or smoothing surfaces. It can also help when
working with remeshed topology as it makes the face sets looks better
and more organized if needed.

The operation is implemented as an Shift smooth in the Draw Face sets
tool, similar to the Slide/Relax tool.

The same operation is also available in the mesh filter to smooth all
the face sets boundaries uniformly or to smooth the face set under the
cursor with the Use Face Sets option.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D7034
2020-03-09 20:04:05 +01:00
e702c9a700 Fix Cloth Brush not working with automasking
The cloth brush was not using the automasking values when calculating
the mask value on each vertex.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D7083
2020-03-09 19:43:00 +01:00
0030e6a2fc Fix T74500: Rebuild the Face Sets datalayer after slicing the geometry
Was crashing SculptSession data will not longer be valid if the total
number of polys is modified when rendering the mesh again.
This deletes all face sets in the mesh when slicing the mask. I'll try
to add code to generate a new face set in with faces that are created
when filling the holes, but for now this avoids the crash.

Reviewed By: brecht

Maniphest Tasks: T74500

Differential Revision: https://developer.blender.org/D7049
2020-03-09 19:39:57 +01:00
503d5c0c65 Fix T74499: Add visibility checks to Face Sets creation operations
Create face sets by visibility needs to check if all face sets of a
vertex are visible to set the new face set. I renamed the functions to
make this more cleare in the API.

I also added a visibility check when creating by mask to avoid modifying
hidden areas.

Reviewed By: brecht

Maniphest Tasks: T74499

Differential Revision: https://developer.blender.org/D7048
2020-03-09 19:33:22 +01:00
c65b9fb825 Sculpt: Remove hardcoded hardness from Clay brush
Hardness is now a property implemented for all brushes, so this is no
longer needed.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D7078
2020-03-09 19:29:18 +01:00
6eb76f6430 Fix T74492: Reset Face Set data when cancelling the expand operator
The operator was resetting the mask data when cancelling instead of the
face set data, so it was crashing because mask data was not available
when starting the operator in expand face set mode.

Reviewed By: brecht

Maniphest Tasks: T74492

Differential Revision: https://developer.blender.org/D7043
2020-03-09 19:25:38 +01:00
a540d16ee8 Cleanup: Move Face Sets random color generation to its own function
This way we can change the color generation easily if we want to improve
it in the future. I also added more values to randomize a little bit the
saturation and value of the colors, as previously it was too easy to get
similar colors when creating new faces, forcing you to use the randomize
colors more than necessary.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D7042
2020-03-09 19:14:18 +01:00
1131e33026 Fix T74438: Vertex-only meshes disappear in wireframe mode
The problem happens because, in wireframe mode, `bool use_wire` is
always `true`, so the function that draws all edges is the called.

The solution is set `use_wire` as `false` when the mesh has no edges.

This matches the behavior of blender 2.79.

Reviewed By: fclem, brecht

Differential Revision: https://developer.blender.org/D7041
2020-03-09 15:09:26 -03:00
Adrian Newton
a468368540 UI: use pixel units for tile sizes and node auto-offset margin
Differential Revision: https://developer.blender.org/D7077
2020-03-09 18:49:42 +01:00
be2e41c397 Cleanup: Move BKE_animdata_free() call out of each IDType free data.
This has been long standing TODO...

Note that remaining usages of BKE_xxx_delete should all be carefully
checked for and utilmately nuked in favor of `BKE_id_delete()`, think we
still have quiet a few bugs hidden in those (code seems to usually
assume those functions do a full ID deletion, which is not the case).
2020-03-09 18:43:11 +01:00
6472a721f0 Cleanup: Remove unused switch/case from BKE_lib_id.
Only covers direct usages of new callbacks from IDTypeInfo.

We still have a lot of those switch/case, many can probably go away
with minimal refactor now, but that will be for later.
2020-03-09 18:43:11 +01:00
b080de79db Alembic: constraint for transform animation is using world matrix again
In rB7c5a44c71f13 I changed the way transform matrices are loaded from
Alembic. Instead of having the Alembic importer convert matrices from
local (in the Alembic file) to World (to pass to the constraint handling
the animation of transforms), I set the constraint space to
`CONSTRAINT_SPACE_LOCAL`.

This worked thanks to rB7728bfd4c45c. However, that commit was reverted,
which meant that for parentless objects `CONSTRAINT_SPACE_LOCAL` no
longer means "local space".

The situation is resolved by setting the constraint to world space
again, and computing the world matrix in the Alembic importer.
2020-03-09 18:27:18 +01:00
e672cf11c3 Cleanup: palette: Move to IDTypeInfo and remove unused BKE API. 2020-03-09 18:09:23 +01:00
3e9dbe7f62 Cleanup: GreasePencil: Move to IDTypeInfo and remove unused BKE API. 2020-03-09 18:09:23 +01:00
c010290e75 Cleanup: Ipo: Move to IDTypeInfo and remove unused BKE API. 2020-03-09 18:09:23 +01:00
214cc3c245 Fix failing assert because of invalid region coordinates
Steps to reproduce were:
* Disable tool settings region in 3D View (View > Tool Settings)
* Split the 3D View and drag all the way down

The removed code doesn't seem to be needed anymore. Tested this on hiDPI
too, seems fine.

These kind of fixes are always tricky, so I wouldn't be surprised if
there are any issues caused by this.
2020-03-09 18:02:08 +01:00
32fc22db56 Fix T72253: Mantaflow adaptive domain cuts off
The issue of T72253 was that the density threshold (RNA adapt_threshold) was considering cells as empty cells too early and thus also shrinking the domain too early. The fix for this is to use smaller threshold values for the adaptive domain. This fix gives more flexibility in the UI to do just that.
2020-03-09 17:42:38 +01:00
Yevgeny Makarov
07bdbeda84 UI: avoid blurring of view navigation widgets at some UI scales
Differential Revision: https://developer.blender.org/D6734
2020-03-09 17:11:24 +01:00
Ulysse Martin
aca222c3da Fix unnecessary grease pencil drawing when there are no grease pencil objects
Differential Revision: https://developer.blender.org/D6551
2020-03-09 17:11:24 +01:00
Yevgeny Makarov
bada2dcafd UI: improve layout of keymap preferences, more consistent with other areas
Differential Revision: https://developer.blender.org/D6592
2020-03-09 17:11:24 +01:00
Kai Jægersen
6f4612a7cc Python API: allow overriding context.workspace for workspace operators
Differential Revision: https://developer.blender.org/D6867
2020-03-09 17:11:24 +01:00
Yevgeny Makarov
da101eddef UI: input preferences layout tweaks for keymap search and zoom settings
Differential Revision: https://developer.blender.org/D6979
2020-03-09 17:11:24 +01:00
Johan Walles
8bc8713beb Cleanup: avoid (harmless) race condition reported by Helgrind
Differential Revision: https://developer.blender.org/D7058
2020-03-09 17:11:24 +01:00
Adrian Newton
58e6306b15 UI: reorder viewport/render toggle in particles for consistency with modifiers
Differential Revision: https://developer.blender.org/D7069
2020-03-09 17:11:24 +01:00
Adrian Newton
5543572cd2 Cleanup: remove unnecessary space at end of label
Differential Revision: https://developer.blender.org/D7070
2020-03-09 17:11:24 +01:00
Adrian Newton
1276380fd2 UI: add space before px unit in Eevee properties for consistency
Differential Revision: https://developer.blender.org/D7072
2020-03-09 17:11:24 +01:00
Eitan
3923738c8f UI: rename View Frame to Go to Current Frame in video sequencer
For consistency with other editors.

Differential Revision: https://developer.blender.org/D7025
2020-03-09 17:11:24 +01:00
324e24ee38 Fix layout.prop invert_checkbox not working combined with icons
Contributed by Valentin (Poulpator).

Differential Revision: https://developer.blender.org/D7027
2020-03-09 17:11:24 +01:00
81c18c2507 Fix part of T73921: hang with Eevee light baking and Mantaflow
Now it crashes instead.
2020-03-09 17:11:24 +01:00
29b405a327 Overlay: Add antialiasing to particle sprites 2020-03-09 17:09:32 +01:00
3912a2a227 Fix T74438: Overlay: Loose verts and particle not draw in some conditions
This was caused by a missing output variable for lineOutput.
This triggered some undefined behavior.
2020-03-09 17:09:32 +01:00
4d0d43ce8e Cleanup: FreestyleLineStyle: Move to IDTypeInfo and remove unused BKE API. 2020-03-09 16:56:53 +01:00
dab1d14a51 Cleanup: Mask: Move to IDTypeInfo and remove unused BKE API. 2020-03-09 16:56:53 +01:00
6965bcc0c9 Cleanup: MovieClip: Move to IDTypeInfo and remove unused BKE API. 2020-03-09 16:56:53 +01:00
d43fbbb307 Cleanup: Silence warnings 2020-03-09 16:34:55 +01:00
29f3af9527 GPencil: Refactor of Draw Engine, Vertex Paint and all internal functions
This commit is a full refactor of the grease pencil modules including Draw Engine, Modifiers, VFX, depsgraph update, improvements in operators and conversion of Sculpt and Weight paint tools to real brushes.

Also, a huge code cleanup has been done at all levels.

Thanks to @fclem for his work and yo @pepeland and @mendio for the testing and help in the development.

Differential Revision: https://developer.blender.org/D6293
2020-03-09 16:27:24 +01:00
dcb9312687 Depsgraph: fix crash caused by removing too many NO-OP nodes
Unused no-op operation nodes are not bound to a callback function, and
have no outgoing relations. Incoming relations of such nodes are removed
since ff60dd8b18. However, this was done
too broadly, causing too many relations to be lost and indirectly linked
objects to be unevaluated.

This commit introduces a `DEPSOP_FLAG_FAKE_USER` flag for operation
nodes, which indicates they are not to be removed, even when they appear
to be unused.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D7074
2020-03-09 16:05:33 +01:00
93f6369573 Fix T74533: Crash when entering sculpt mode
Apparently this happened when the object is in a flat view and has
customdata `CD_SCULPT_FACE_SETS`

Differential Revision: https://developer.blender.org/D7073
2020-03-09 12:00:11 -03:00
2756 changed files with 97252 additions and 87959 deletions

View File

@@ -132,9 +132,7 @@ PenaltyBreakAssignment: 100
AllowShortFunctionsOnASingleLine: None
# Disable for now since it complicates initial migration tests,
# TODO: look into enabling this in the future.
SortIncludes: false
SortIncludes: true
# Don't right align escaped newlines to the right because we have a wide default
AlignEscapedNewlines: DontAlign
@@ -193,6 +191,7 @@ ForEachMacros:
- FOREACH_MAIN_ID_BEGIN
- FOREACH_MAIN_LISTBASE_BEGIN
- FOREACH_MAIN_LISTBASE_ID_BEGIN
- FOREACH_MESH_BUFFER_CACHE
- FOREACH_NODETREE_BEGIN
- FOREACH_OBJECT_BEGIN
- FOREACH_OBJECT_FLAG_BEGIN
@@ -215,6 +214,7 @@ ForEachMacros:
- GHASH_ITER_INDEX
- GPU_SELECT_LOAD_IF_PICKSEL_LIST
- GP_EDITABLE_STROKES_BEGIN
- GP_EVALUATED_STROKES_BEGIN
- GSET_FOREACH_BEGIN
- GSET_ITER
- GSET_ITER_INDEX
@@ -238,7 +238,6 @@ ForEachMacros:
- LISTBASE_FOREACH_BACKWARD
- LISTBASE_FOREACH_MUTABLE
- LISTBASE_FOREACH_BACKWARD_MUTABLE
- MAN2D_ITER_AXES_BEGIN
- MAN_ITER_AXES_BEGIN
- NODE_INSTANCE_HASH_ITER
- NODE_SOCKET_TYPES_BEGIN
@@ -246,12 +245,16 @@ ForEachMacros:
- NODE_TYPES_BEGIN
- PIXEL_LOOPER_BEGIN
- PIXEL_LOOPER_BEGIN_CHANNELS
- RENDER_PASS_ITER_BEGIN
- RNA_BEGIN
- RNA_PROP_BEGIN
- RNA_STRUCT_BEGIN
- RNA_STRUCT_BEGIN_SKIP_RNA_TYPE
- SCULPT_VERTEX_DUPLICATES_AND_NEIGHBORS_ITER_BEGIN
- SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN
- SEQP_BEGIN
- SEQ_BEGIN
- SURFACE_QUAD_ITER_BEGIN
- foreach
# Use once we bump the minimum version to version 8.

View File

@@ -186,8 +186,7 @@ if(APPLE)
option(WITH_XR_OPENXR "Enable VR features through the OpenXR specification" OFF)
mark_as_advanced(WITH_XR_OPENXR)
else()
# Disabled until there's more than just the build system stuff. Should be enabled soon.
option(WITH_XR_OPENXR "Enable VR features through the OpenXR specification" OFF)
option(WITH_XR_OPENXR "Enable VR features through the OpenXR specification" ON)
endif()
# Compositor
@@ -320,6 +319,14 @@ mark_as_advanced(WITH_SYSTEM_GLOG)
# Freestyle
option(WITH_FREESTYLE "Enable Freestyle (advanced edges rendering)" ON)
# New object types
option(WITH_NEW_OBJECT_TYPES "Enable new hair and pointcloud objects (use for development only, don't save in files)" OFF)
mark_as_advanced(WITH_NEW_OBJECT_TYPES)
# New simulation data block
option(WITH_NEW_SIMULATION_TYPE "Enable simulation data block (use for development only, don't save in files)" OFF)
mark_as_advanced(WITH_NEW_SIMULATION_TYPE)
# Misc
if(WIN32)
option(WITH_INPUT_IME "Enable Input Method Editor (IME) for complex Asian character input" ON)
@@ -630,9 +637,10 @@ set_and_warn_dependency(WITH_BOOST WITH_OPENVDB OFF)
set_and_warn_dependency(WITH_BOOST WITH_OPENCOLORIO OFF)
set_and_warn_dependency(WITH_BOOST WITH_QUADRIFLOW OFF)
set_and_warn_dependency(WITH_BOOST WITH_USD OFF)
set_and_warn_dependency(WITH_BOOST WITH_ALEMBIC OFF)
if(WITH_BOOST AND NOT (WITH_CYCLES OR WITH_OPENIMAGEIO OR WITH_INTERNATIONAL OR
WITH_OPENVDB OR WITH_OPENCOLORIO OR WITH_USD))
WITH_OPENVDB OR WITH_OPENCOLORIO OR WITH_USD OR WITH_ALEMBIC))
message(STATUS "No dependencies need 'WITH_BOOST' forcing WITH_BOOST=OFF")
set(WITH_BOOST OFF)
endif()
@@ -681,6 +689,7 @@ if(WITH_GHOST_SDL OR WITH_HEADLESS)
set(WITH_X11_ALPHA OFF)
set(WITH_GHOST_XDND OFF)
set(WITH_INPUT_IME OFF)
set(WITH_XR_OPENXR OFF)
endif()
if(WITH_CPU_SSE)

View File

@@ -162,7 +162,7 @@ harvest(opensubdiv/lib opensubdiv/lib "*.a")
harvest(openvdb/include/openvdb openvdb/include/openvdb "*.h")
harvest(openvdb/lib openvdb/lib "*.a")
harvest(xr_openxr_sdk/include/openxr xr_openxr_sdk/include/openxr "*.h")
harvest(xr_openxr_sdk/lib xr_openxr_sdk/src/loader "*.a")
harvest(xr_openxr_sdk/lib xr_openxr_sdk/lib "*.a")
harvest(osl/bin osl/bin "oslc")
harvest(osl/include osl/include "*.h")
harvest(osl/lib osl/lib "*.a")

View File

@@ -146,8 +146,8 @@ set(PYTHON_URI https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTH
set(PYTHON_HASH d33e4aae66097051c2eca45ee3604803)
set(TBB_VERSION 2019_U9)
set(TBB_URI https://github.com/01org/tbb/archive/${TBB_VERSION}.tar.gz)
set(TBB_HASH 584edbec127c508f2cd5b6e79ad200fc)
set(TBB_URI https://github.com/oneapi-src/oneTBB/archive/${TBB_VERSION}.tar.gz)
set(TBB_HASH 26263622e9187212ec240dcf01b66207)
set(OPENVDB_VERSION 7.0.0)
set(OPENVDB_URI https://github.com/dreamworksanimation/openvdb/archive/v${OPENVDB_VERSION}.tar.gz)

View File

@@ -29,6 +29,8 @@ if(UNIX AND NOT APPLE)
-DBUILD_WITH_WAYLAND_HEADERS=OFF
-DBUILD_WITH_XCB_HEADERS=OFF
-DBUILD_WITH_XLIB_HEADERS=ON
-DBUILD_WITH_SYSTEM_JSONCPP=OFF
-DCMAKE_CXX_FLAGS=-DDISABLE_STD_FILESYSTEM=1
)
endif()

View File

@@ -63,8 +63,8 @@ build-ffmpeg,build-opencollada,build-alembic,build-embree,build-oidn,build-usd,\
build-xr-openxr,\
skip-python,skip-numpy,skip-boost,\
skip-ocio,skip-openexr,skip-oiio,skip-llvm,skip-osl,skip-osd,skip-openvdb,\
skip-ffmpeg,skip-opencollada,skip-alembic,skip-embree,skip-oidn,skip-usd, \
skip-xr-openxr\
skip-ffmpeg,skip-opencollada,skip-alembic,skip-embree,skip-oidn,skip-usd,\
skip-xr-openxr \
-- "$@" \
)
@@ -1289,7 +1289,7 @@ compile_Python() {
./configure --prefix=$_inst --libdir=$_inst/lib --enable-ipv6 \
--enable-loadable-sqlite-extensions --with-dbmliborder=bdb \
--with-computed-gotos --with-pymalloc
--with-computed-gotos --with-pymalloc --enable-shared
make -j$THREADS && make install
make clean
@@ -1310,6 +1310,8 @@ compile_Python() {
INFO "Own Python-$PYTHON_VERSION is up to date, nothing to do!"
INFO "If you want to force rebuild of this lib, use the --force-python option."
fi
run_ldconfig "python-$PYTHON_VERSION_MIN"
}
# ----------------------------------------------------------------------------
@@ -3128,7 +3130,7 @@ compile_XR_OpenXR_SDK() {
fi
# To be changed each time we make edits that would modify the compiled result!
xr_openxr_magic=0
xr_openxr_magic=2
_init_xr_openxr_sdk
# Clean install if needed!
@@ -3185,8 +3187,9 @@ compile_XR_OpenXR_SDK() {
cmake_d="$cmake_d -D BUILD_WITH_WAYLAND_HEADERS=OFF"
cmake_d="$cmake_d -D BUILD_WITH_XCB_HEADERS=OFF"
cmake_d="$cmake_d -D BUILD_WITH_XLIB_HEADERS=ON"
cmake_d="$cmake_d -D BUILD_WITH_SYSTEM_JSONCPP=OFF"
cmake $cmake_d ..
cmake $cmake_d "-DCMAKE_CXX_FLAGS=-DDISABLE_STD_FILESYSTEM=1" ..
make -j$THREADS && make install
make clean
@@ -5188,7 +5191,7 @@ print_info() {
PRINT ""
PRINT "If you're using CMake add this to your configuration flags:"
_buildargs="-U *SNDFILE* -U *PYTHON* -U *BOOST* -U *Boost*"
_buildargs="-U *SNDFILE* -U PYTHON* -U *BOOST* -U *Boost*"
_buildargs="$_buildargs -U *OPENCOLORIO* -U *OPENEXR* -U *OPENIMAGEIO* -U *LLVM* -U *CYCLES*"
_buildargs="$_buildargs -U *OPENSUBDIV* -U *OPENVDB* -U *COLLADA* -U *FFMPEG* -U *ALEMBIC* -U *USD*"

View File

@@ -98,7 +98,7 @@ class VersionInfo:
self.is_development_build = False
else:
# Development build
self.full_version = self.version + '-' + self.hash
self.full_version = self.version + self.version_char + '-' + self.hash
self.is_development_build = True
def _parse_header_file(self, filename, define):

View File

@@ -7,9 +7,6 @@ message(STATUS "Building in CentOS 7 64bit environment")
set(LIBDIR_NAME "linux_centos7_x86_64")
set(WITH_CXX11_ABI OFF CACHE BOOL "" FORCE)
# Default to only build Blender
set(WITH_BLENDER ON CACHE BOOL "" FORCE)
# ######## Linux-specific build options ########
# Options which are specific to Linux-only platforms
@@ -20,12 +17,6 @@ set(WITH_DOC_MANPAGE OFF CACHE BOOL "" FORCE)
set(WITH_JACK_DYNLOAD ON CACHE BOOL "" FORCE)
set(WITH_SDL_DYNLOAD ON CACHE BOOL "" FORCE)
set(WITH_SYSTEM_GLEW OFF CACHE BOOL "" FORCE)
set(WITH_OPENMP_STATIC ON CACHE BOOL "" FORCE)
set(WITH_PYTHON_INSTALL_NUMPY ON CACHE BOOL "" FORCE)
set(WITH_PYTHON_INSTALL_REQUESTS ON CACHE BOOL "" FORCE)
# ######## Release environment specific settings ########
@@ -33,13 +24,5 @@ set(LIBDIR "${CMAKE_CURRENT_LIST_DIR}/../../../../lib/${LIBDIR_NAME}" CACHE STRI
# Platform specific configuration, to ensure static linking against everything.
set(Boost_USE_STATIC_LIBS ON CACHE BOOL "" FORCE)
# We need to link OpenCOLLADA against PCRE library. Even though it is not installed
# on /usr, we do not really care -- all we care is PCRE_FOUND be TRUE and its
# library pointing to a valid one.
set(PCRE_INCLUDE_DIR "/usr/include" CACHE STRING "" FORCE)
set(PCRE_LIBRARY "${LIBDIR}/opencollada/lib/libpcre.a" CACHE STRING "" FORCE)
# Additional linking libraries
set(CMAKE_EXE_LINKER_FLAGS "-lrt -static-libstdc++ -no-pie" CACHE STRING "" FORCE)

View File

@@ -49,7 +49,6 @@ if(NOT LLVM_ROOT_DIR)
OUTPUT_VARIABLE LLVM_ROOT_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(LLVM_ROOT_DIR ${LLVM_ROOT_DIR} CACHE PATH "Path to the LLVM installation")
set(LLVM_INCLUDE_DIRS ${LLVM_ROOT_DIR}/include CACHE PATH "Path to the LLVM include directory")
endif()
if(NOT LLVM_LIBPATH)
execute_process(COMMAND ${LLVM_CONFIG} --libdir

View File

@@ -95,7 +95,7 @@ FIND_LIBRARY(OPENIMAGEDENOISE_LIBRARY
# handle the QUIETLY and REQUIRED arguments and set OPENIMAGEDENOISE_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OPENIMAGEDENOISE DEFAULT_MSG
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenImageDenoise DEFAULT_MSG
OPENIMAGEDENOISE_LIBRARY OPENIMAGEDENOISE_INCLUDE_DIR)
IF(OPENIMAGEDENOISE_FOUND)

View File

@@ -222,12 +222,10 @@ if(WITH_OPENCOLLADA)
-lMathMLSolver
-lGeneratedSaxParser
-lbuffer -lftoa -lUTF
${OPENCOLLADA_LIBPATH}/libxml2.a
)
# PCRE is bundled with openCollada
# set(PCRE ${LIBDIR}/pcre)
# set(PCRE_LIBPATH ${PCRE}/lib)
# PCRE and XML2 are bundled with OpenCollada.
set(PCRE_LIBRARIES pcre)
set(XML2_LIBRARIES xml2)
endif()
if(WITH_SDL)
@@ -449,7 +447,9 @@ if(${XCODE_VERSION} VERSION_EQUAL 5 OR ${XCODE_VERSION} VERSION_GREATER 5)
# Xcode 5 is always using CLANG, which has too low template depth of 128 for libmv
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftemplate-depth=1024")
endif()
# Get rid of eventually clashes, we export some symbols explicitly as local
# Avoid conflicts with Luxrender, and other plug-ins that may use the same
# libraries as Blender with a different version or build options.
set(PLATFORM_LINKFLAGS
"${PLATFORM_LINKFLAGS} -Xlinker -unexported_symbols_list -Xlinker '${CMAKE_SOURCE_DIR}/source/creator/osx_locals.map'"
)

View File

@@ -20,10 +20,6 @@
# Xcode and system configuration for Apple.
# require newer cmake on osx because of version handling,
# older cmake cannot handle 2 digit subversion!
cmake_minimum_required(VERSION 3.0.0)
if(NOT CMAKE_OSX_ARCHITECTURES)
set(CMAKE_OSX_ARCHITECTURES x86_64 CACHE STRING
"Choose the architecture you want to build Blender for: i386, x86_64 or ppc"
@@ -45,54 +41,98 @@ execute_process(
OUTPUT_VARIABLE XCODE_CHECK OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REPLACE "/Contents/Developer" "" XCODE_BUNDLE ${XCODE_CHECK}) # truncate to bundlepath in any case
if(${CMAKE_GENERATOR} MATCHES "Xcode")
if(NOT ${CMAKE_GENERATOR} MATCHES "Xcode")
# Unix makefile generator does not fill XCODE_VERSION var, so we get it with a command.
# Note that `xcodebuild -version` gives output in two lines: first line will include
# Xcode version, second one will include build number. We are only interested in the
# former one. Here is an example of the output:
# Xcode 11.4
# Build version 11E146
# The expected XCODE_VERSION in this case is 11.4.
# earlier xcode has no bundled developer dir, no sense in getting xcode path from
if(${XCODE_VERSION} VERSION_GREATER 4.2)
# reduce to XCode name without dp extension
string(SUBSTRING "${XCODE_CHECK}" 14 6 DP_NAME)
if(${DP_NAME} MATCHES Xcode5)
set(XCODE_VERSION 5)
endif()
endif()
##### cmake incompatibility with xcode 4.3 and higher #####
if(${XCODE_VERSION} MATCHES '') # cmake fails due looking for xcode in the wrong path, thus will be empty var
message(FATAL_ERROR "Xcode 4.3 and higher must be used with cmake 2.8-8 or higher")
endif()
### end cmake incompatibility with xcode 4.3 and higher ###
if(${XCODE_VERSION} VERSION_EQUAL 4 OR ${XCODE_VERSION} VERSION_GREATER 4 AND ${XCODE_VERSION} VERSION_LESS 4.3)
# Xcode 4 defaults to the Apple LLVM Compiler.
# Override the default compiler selection because Blender only compiles with gcc up to xcode 4.2
set(CMAKE_XCODE_ATTRIBUTE_GCC_VERSION "com.apple.compilers.llvmgcc42")
message(STATUS "Setting compiler to: " ${CMAKE_XCODE_ATTRIBUTE_GCC_VERSION})
endif()
else() # unix makefile generator does not fill XCODE_VERSION var, so we get it with a command
execute_process(COMMAND xcodebuild -version OUTPUT_VARIABLE XCODE_VERS_BUILD_NR)
string(SUBSTRING "${XCODE_VERS_BUILD_NR}" 6 3 XCODE_VERSION) # truncate away build-nr
# Convert output to a single line by replacling newlines with spaces.
# This is needed because regex replace can not operate through the newline character
# and applies substitutions for each individual lines.
string(REPLACE "\n" " " XCODE_VERS_BUILD_NR_SINGLE_LINE "${XCODE_VERS_BUILD_NR}")
string(REGEX REPLACE "(.*)Xcode ([0-9\\.]+).*" "\\2" XCODE_VERSION "${XCODE_VERS_BUILD_NR_SINGLE_LINE}")
unset(XCODE_VERS_BUILD_NR)
unset(XCODE_VERS_BUILD_NR_SINGLE_LINE)
endif()
message(STATUS "Detected OS X ${OSX_SYSTEM} and Xcode ${XCODE_VERSION} at ${XCODE_BUNDLE}")
if(${XCODE_VERSION} VERSION_LESS 4.3)
# use guaranteed existing sdk
set(CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX${OSX_SYSTEM}.sdk CACHE PATH "" FORCE)
else()
# note: xcode-select path could be ambiguous,
# cause /Applications/Xcode.app/Contents/Developer or /Applications/Xcode.app would be allowed
# so i use a selfcomposed bundlepath here
set(OSX_SYSROOT_PREFIX ${XCODE_BUNDLE}/Contents/Developer/Platforms/MacOSX.platform)
message(STATUS "OSX_SYSROOT_PREFIX: " ${OSX_SYSROOT_PREFIX})
set(OSX_DEVELOPER_PREFIX /Developer/SDKs/MacOSX${OSX_SYSTEM}.sdk) # use guaranteed existing sdk
set(CMAKE_OSX_SYSROOT ${OSX_SYSROOT_PREFIX}/${OSX_DEVELOPER_PREFIX} CACHE PATH "" FORCE)
if(${CMAKE_GENERATOR} MATCHES "Xcode")
# to silence sdk not found warning, just overrides CMAKE_OSX_SYSROOT
set(CMAKE_XCODE_ATTRIBUTE_SDKROOT macosx${OSX_SYSTEM})
endif()
# Older Xcode versions had different approach to the directory hiearchy.
# Require newer Xcode which is also have better chances of being able to compile with the
# required deployment target.
#
# NOTE: Xcode version 8.2 is the latest one which runs on macOS 10.11.
if(${XCODE_VERSION} VERSION_LESS 8.2)
message(FATAL_ERROR "Only Xcode version 8.2 and newer is supported")
endif()
# note: xcode-select path could be ambiguous,
# cause /Applications/Xcode.app/Contents/Developer or /Applications/Xcode.app would be allowed
# so i use a selfcomposed bundlepath here
set(OSX_SYSROOT_PREFIX ${XCODE_BUNDLE}/Contents/Developer/Platforms/MacOSX.platform)
message(STATUS "OSX_SYSROOT_PREFIX: " ${OSX_SYSROOT_PREFIX})
# Collect list of OSX system versions which will be used to detect path to corresponding SDK.
# Start with macOS SDK version reported by xcodebuild and include possible extra ones.
#
# The reason for need of extra ones is because it's possible that xcodebuild will report
# SDK version in the full manner (aka major.minor.patch), but the actual path will only
# include major.minor.
#
# This happens, for example, on macOS Catalina 10.15.4 and Xcode 11.4: xcodebuild on this
# system outputs "10.15.4", but the actual SDK path is MacOSX10.15.sdk.
#
# This should be safe from picking wrong SDK version because (a) xcodebuild reports full semantic
# SDK version, so such SDK does exist on the system. And if it doesn't exist with full version
# in the path, what SDK is in the major.minor folder then.
set(OSX_SDK_TEST_VERSIONS ${OSX_SYSTEM})
if(OSX_SYSTEM MATCHES "([0-9]+)\\.([0-9]+)\\.([0-9]+)")
string(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1.\\2" OSX_SYSTEM_NO_PATCH "${OSX_SYSTEM}")
list(APPEND OSX_SDK_TEST_VERSIONS ${OSX_SYSTEM_NO_PATCH})
unset(OSX_SYSTEM_NO_PATCH)
endif()
# Loop through all possible versions and pick the first one which resolves to a valid SDK path.
set(OSX_SDK_PATH)
set(OSX_SDK_FOUND FALSE)
set(OSX_SDK_PREFIX ${OSX_SYSROOT_PREFIX}/Developer/SDKs)
set(OSX_SDKROOT)
foreach(OSX_SDK_VERSION ${OSX_SDK_TEST_VERSIONS})
set(CURRENT_OSX_SDK_PATH "${OSX_SDK_PREFIX}/MacOSX${OSX_SDK_VERSION}.sdk")
if(EXISTS ${CURRENT_OSX_SDK_PATH})
set(OSX_SDK_PATH "${CURRENT_OSX_SDK_PATH}")
set(OSX_SDKROOT macosx${OSX_SDK_VERSION})
set(OSX_SDK_FOUND TRUE)
break()
endif()
endforeach()
unset(OSX_SDK_PREFIX)
unset(OSX_SDK_TEST_VERSIONS)
if(NOT OSX_SDK_FOUND)
message(FATAL_ERROR "Unable to find SDK for macOS version ${OSX_SYSTEM}")
endif()
message(STATUS "Detected OSX_SYSROOT: ${OSX_SDK_PATH}")
set(CMAKE_OSX_SYSROOT ${OSX_SDK_PATH} CACHE PATH "" FORCE)
unset(OSX_SDK_PATH)
unset(OSX_SDK_FOUND)
if(${CMAKE_GENERATOR} MATCHES "Xcode")
# to silence sdk not found warning, just overrides CMAKE_OSX_SYSROOT
set(CMAKE_XCODE_ATTRIBUTE_SDKROOT ${OSX_SDKROOT})
endif()
unset(OSX_SDKROOT)
# 10.11 is our min. target, if you use higher sdk, weak linking happens
if(CMAKE_OSX_DEPLOYMENT_TARGET)
if(${CMAKE_OSX_DEPLOYMENT_TARGET} VERSION_LESS 10.11)

View File

@@ -195,8 +195,14 @@ endif()
if(WITH_OPENCOLLADA)
find_package_wrapper(OpenCOLLADA)
if(OPENCOLLADA_FOUND)
if(WITH_STATIC_LIBS)
# PCRE is bundled with OpenCollada without headers, so can't use
# find_package reliably to detect it.
set(PCRE_LIBRARIES ${LIBDIR}/opencollada/lib/libpcre.a)
else()
find_package_wrapper(PCRE)
endif()
find_package_wrapper(XML2)
find_package_wrapper(PCRE)
else()
set(WITH_OPENCOLLADA OFF)
endif()
@@ -405,13 +411,6 @@ if(WITH_LLVM)
endif()
endif()
if(WITH_LLVM OR WITH_SDL_DYNLOAD)
# Fix for conflict with Mesa llvmpipe
set(PLATFORM_LINKFLAGS
"${PLATFORM_LINKFLAGS} -Wl,--version-script='${CMAKE_SOURCE_DIR}/source/creator/blender.map'"
)
endif()
if(WITH_OPENSUBDIV)
find_package_wrapper(OpenSubdiv)
@@ -601,3 +600,16 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "Intel")
set(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing")
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -static-intel")
endif()
# Avoid conflicts with Mesa llvmpipe, Luxrender, and other plug-ins that may
# use the same libraries as Blender with a different version or build options.
set(PLATFORM_LINKFLAGS
"${PLATFORM_LINKFLAGS} -Wl,--version-script='${CMAKE_SOURCE_DIR}/source/creator/blender.map'"
)
# Don't use position independent executable for portable install since file
# browsers can't properly detect blender as an executable then. Still enabled
# for non-portable installs as typically used by Linux distributions.
if(WITH_INSTALL_PORTABLE)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -no-pie")
endif()

View File

@@ -669,7 +669,7 @@ if(WITH_USD)
set(USD_INCLUDE_DIRS ${LIBDIR}/usd/include)
set(USD_RELEASE_LIB ${LIBDIR}/usd/lib/libusd_m.lib)
set(USD_DEBUG_LIB ${LIBDIR}/usd/lib/libusd_m_d.lib)
set(USD_LIBRARY_DIR ${LIBDIR}/usd/lib/usd)
set(USD_LIBRARY_DIR ${LIBDIR}/usd/lib)
set(USD_LIBRARIES
debug ${USD_DEBUG_LIB}
optimized ${USD_RELEASE_LIB}

View File

@@ -6,9 +6,6 @@ if %ERRORLEVEL% EQU 0 goto DetectionComplete
call "%~dp0\detect_msvc2019.cmd"
if %ERRORLEVEL% EQU 0 goto DetectionComplete
call "%~dp0\detect_msvc2015.cmd"
if %ERRORLEVEL% EQU 0 goto DetectionComplete
echo Compiler Detection failed. Use verbose switch for more information.
exit /b 1

View File

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

View File

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

View File

@@ -27,7 +27,13 @@ if NOT "%verbose%" == "" (
if "%VS_InstallDir%"=="" (
if NOT "%verbose%" == "" (
echo Visual Studio is detected but the "Desktop development with C++" workload has not been instlled
echo.
echo Visual Studio is detected but no suitable installation was found.
echo.
echo Check the "Desktop development with C++" workload has been installed.
echo.
echo If you are attempting to use either Visual Studio Preview version or the Visual C++ Build tools, Please see 'make help' on how to opt in to those toolsets.
echo.
goto FAIL
)
)

View File

@@ -66,8 +66,6 @@ if NOT "%1" == "" (
) else if "%1" == "2019b" (
set BUILD_VS_YEAR=2019
set VSWHERE_ARGS=-products Microsoft.VisualStudio.Product.BuildTools
) else if "%1" == "2015" (
set BUILD_VS_YEAR=2015
) else if "%1" == "packagename" (
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -DCPACK_OVERRIDE_PACKAGENAME="%2"
shift /1

View File

@@ -23,15 +23,17 @@ echo - with_tests ^(enable building unit tests^)
echo - nobuildinfo ^(disable buildinfo^)
echo - debug ^(Build an unoptimized debuggable build^)
echo - packagename [newname] ^(override default cpack package name^)
echo - buildir [newdir] ^(override default build folder^)
echo - builddir [newdir] ^(override default build folder^)
echo - 2017 ^(build with visual studio 2017^)
echo - 2017pre ^(build with visual studio 2017 pre-release^)
echo - 2017b ^(build with visual studio 2017 Build Tools^)
echo - 2019 ^(build with visual studio 2019^)
echo - 2019pre ^(build with visual studio 2019 pre-release^)
echo - 2019b ^(build with visual studio 2019 Build Tools^)
echo.
echo Experimental options
echo - with_opengl_tests ^(enable both the render and draw opengl test suites^)
echo - 2015 ^(build with visual studio 2015^)
echo - clang ^(enable building with clang^)
echo - asan ^(enable asan when building with clang^)
echo - ninja ^(enable building with ninja instead of msbuild^)

View File

@@ -2,20 +2,20 @@
Basic Sound Playback
++++++++++++++++++++
This script shows how to use the classes: :class:`Device`, :class:`Factory` and
This script shows how to use the classes: :class:`Device`, :class:`Sound` and
:class:`Handle`.
"""
import aud
device = aud.device()
device = aud.Device()
# load sound file (it can be a video file with audio)
factory = aud.Factory('music.ogg')
sound = aud.Sound('music.ogg')
# play the audio, this return a handle to control play/pause
handle = device.play(factory)
handle = device.play(sound)
# if the audio is not too big and will be used often you can buffer it
factory_buffered = aud.Factory.buffer(factory)
handle_buffered = device.play(factory_buffered)
sound_buffered = aud.Sound.buffer(sound)
handle_buffered = device.play(sound_buffered)
# stop the sounds (otherwise they play until their ends)
handle.stop()

View File

@@ -205,15 +205,15 @@ Support Overview
* - Usage
- :class:`bpy.types.MeshPolygon`
- :class:`bpy.types.MeshTessFace`
- :class:`bpy.types.MeshLoopTriangle`
- :class:`bmesh.types.BMFace`
* - Import/Create
- Poor *(inflexible)*
- Good *(supported as upgrade path)*
- Unusable *(read-only)*.
- Best
* - Manipulate
- Poor *(inflexible)*
- Poor *(loses ngons)*
- Unusable *(read-only)*.
- Best
* - Export/Output
- Good *(ngon support)*

View File

@@ -1052,6 +1052,7 @@ context_type_map = {
"selected_editable_fcurves": ("FCurve", True),
"selected_editable_objects": ("Object", True),
"selected_editable_sequences": ("Sequence", True),
"selected_nla_strips": ("NlaStrip", True),
"selected_nodes": ("Node", True),
"selected_objects": ("Object", True),
"selected_pose_bones": ("PoseBone", True),
@@ -1073,6 +1074,7 @@ context_type_map = {
"visible_pose_bones": ("PoseBone", True),
"visible_fcurves": ("FCurve", True),
"weight_paint_object": ("Object", False),
"volume": ("Volume", False),
"world": ("World", False),
}

View File

@@ -4,35 +4,51 @@ Tutorials
Introduction
------------
The C and Python binding for audaspace were designed with simplicity in mind. This means however that to use the full capabilities of audaspace, there is no way around the C++ library.
The C and Python binding for audaspace were designed with simplicity in mind.
This means however that to use the full capabilities of audaspace,
there is no way around the C++ library.
Simple Demo
-----------
The **simple.py** example program contains all the basic building blocks for an application using audaspace. These building blocks are basically the classes :class:`aud.Device`, :class:`aud.Sound` and :class:`aud.Handle`.
The **simple.py** example program contains all the basic
building blocks for an application using audaspace.
These building blocks are basically the classes :class:`aud.Device`,
:class:`aud.Sound` and :class:`aud.Handle`.
We start with importing :mod:`aud` and :mod:`time` as the modules we need for our simple example.
We start with importing :mod:`aud` and :mod:`time`
as the modules we need for our simple example.
.. code-block:: python
#!/usr/bin/python
import aud, time
The first step now is to open an output device and this can simply be done by allocating a :class:`aud.Device` object.
The first step now is to open an output device and this
can simply be done by allocating a :class:`aud.Device` object.
.. code-block:: python
device = aud.Device()
To create a sound we can choose to load one from a :func:`aud.Sound.file`, or we use one of our signal generators. We decide to do the latter and create a :func:`aud.Sound.sine` signal with a frequency of 440 Hz.
To create a sound we can choose to load one from a :func:`aud.Sound.file`,
or we use one of our signal generators. We decide to do the latter
and create a :func:`aud.Sound.sine` signal with a frequency of 440 Hz.
.. code-block:: python
sine = aud.Sound.sine(440)
.. note:: At this point nothing is playing back yet, :class:`aud.Sound` objects are just descriptions of sounds.
.. note:: At this point nothing is playing back yet,
:class:`aud.Sound` objects are just descriptions of sounds.
However instead of a sine wave, we would like to have a square wave to produce a more retro gaming sound. We could of course use the :func:`aud.Sound.square` generator instead of sine, but we want to show how to apply effects, so we apply a :func:`aud.Sound.threshold` which makes a square wave out of our sine too, even if less efficient than directly generating the square wave.
However instead of a sine wave, we would like to have a square wave
to produce a more retro gaming sound. We could of course use the
:func:`aud.Sound.square` generator instead of sine,
but we want to show how to apply effects,
so we apply a :func:`aud.Sound.threshold`
which makes a square wave out of our sine too,
even if less efficient than directly generating the square wave.
.. code-block:: python
@@ -40,13 +56,19 @@ However instead of a sine wave, we would like to have a square wave to produce a
.. note:: The :class:`aud.Sound` class offers generator and effect functions.
The we can play our sound by calling the :func:`aud.Device.play` method of our device. This method returns a :class:`aud.Handle` which is used to control the playback of the sound.
The we can play our sound by calling the
:func:`aud.Device.play` method of our device.
This method returns a :class:`aud.Handle`
which is used to control the playback of the sound.
.. code-block:: python
handle = device.play(square)
Now if we do nothing else anymore the application will quit immediately, so we won't hear much of our square wave, so we decide to wait for three seconds before quitting the application by calling :func:`time.sleep`.
Now if we do nothing else anymore the application will quit immediately,
so we won't hear much of our square wave,
so we decide to wait for three seconds before
quitting the application by calling :func:`time.sleep`.
.. code-block:: python
@@ -55,29 +77,47 @@ Now if we do nothing else anymore the application will quit immediately, so we w
Audioplayer
-----------
Now that we know the basics of audaspace, we can build our own music player easily by just slightly changing the previous program. The **player.py** example does exactly that, let's have a short look at the differences:
Now that we know the basics of audaspace,
we can build our own music player easily
by just slightly changing the previous program.
The **player.py** example does exactly that,
let's have a short look at the differences:
Instead of creating a sine signal and thresholding it, we in fact use the :func:`aud.Sound.file` function to load a sound from a file. The filename we pass is the first command line argument our application got.
Instead of creating a sine signal and thresholding it,
we in fact use the :func:`aud.Sound.file` function to load a sound from a file.
The filename we pass is the first command line argument our application got.
.. code-block:: python
sound = aud.Sound.file(sys.argv[1])
When the sound gets played back we now want to wait until the whole file has been played, so we use the :data:`aud.Handle.status` property to determine whether the sound finished playing.
When the sound gets played back we now want to wait until
the whole file has been played, so we use the :data:`aud.Handle.status`
property to determine whether the sound finished playing.
.. code-block:: python
while handle.status:
time.sleep(0.1)
We don't make any error checks if the user actually added a command line argument. As an exercise you could extend this program to play any number of command line supplied files in sequence.
We don't make any error checks if the user actually added a command
line argument. As an exercise you could extend this program to play
any number of command line supplied files in sequence.
Siren
-----
Let's get a little bit more complex. The **siren.py** example plays a generated siren sound that circles around your head. Depending on how many speakers you have and if the output device used supports the speaker setup, you will hear this effect. With stereo speakers you should at least hear some left-right-panning.
Let's get a little bit more complex. The **siren.py** example
plays a generated siren sound that circles around your head.
Depending on how many speakers you have and if the output
device used supports the speaker setup, you will hear this effect.
With stereo speakers you should at least hear some left-right-panning.
We start off again with importing the modules we need and we also define some properties of our siren sound. We want it to consist of two sine sounds with different frequencies. We define a length for the sine sounds and how long a fade in/out should take. We also know already how to open a device.
We start off again with importing the modules we need and
we also define some properties of our siren sound.
We want it to consist of two sine sounds with different frequencies.
We define a length for the sine sounds and how long a fade in/out should take.
We also know already how to open a device.
.. code-block:: python
@@ -88,27 +128,35 @@ We start off again with importing the modules we need and we also define some pr
device = aud.Device()
The next thing to do is to define our sine waves and apply all the required effects. As each of the effect functions returns the corresponding sound, we can easily chain those calls together.
The next thing to do is to define our sine waves and apply all the required effects.
As each of the effect functions returns the corresponding sound,
we can easily chain those calls together.
.. code-block:: python
high = aud.Sound.sine(880).limit(0, length).fadein(0, fadelength).fadeout(length - fadelength, length)
low = aud.Sound.sine(700).limit(0, length).fadein(0, fadelength).fadeout(length - fadelength, length).volume(0.6)
The next step is to connect the two sines, which we do using the :func:`aud.Sound.join` function.
The next step is to connect the two sines,
which we do using the :func:`aud.Sound.join` function.
.. code-block:: python
sound = high.join(low)
The generated siren sound can now be played back and what we also do is to loop it. Therefore we set the :data:`aud.Handle.loop_count` to a negative value to loop forever.
The generated siren sound can now be played back and what we also do is to loop it.
Therefore we set the :data:`aud.Handle.loop_count` to a negative value to loop forever.
.. code-block:: python
handle = device.play(sound)
handle.loop_count = -1
Now we use some timing code to make sure our demo runs for 10 seconds, but we also use the time to update the location of our playing sound, with the :data:`aud.Handle.location` property, which is a three dimensional vector. The trigonometic calculation based on the running time of the program keeps the sound on the XZ plane letting it follow a circle around us.
Now we use some timing code to make sure our demo runs for 10 seconds,
but we also use the time to update the location of our playing sound,
with the :data:`aud.Handle.location` property, which is a three dimensional vector.
The trigonometic calculation based on the running time of the program keeps
the sound on the XZ plane letting it follow a circle around us.
.. code-block:: python
@@ -119,33 +167,54 @@ Now we use some timing code to make sure our demo runs for 10 seconds, but we al
handle.location = [math.sin(angle), 0, -math.cos(angle)]
As an exercise you could try to let the sound come from the far left and go to the far right and a little bit in front of you within the 10 second runtime of the program. With this change you should be able to hear the volume of the sound change, depending on how far it is away from you. Updating the :data:`aud.Handle.velocity` property properly also enables the doppler effect. Compare your solution to the **siren2.py** demo.
As an exercise you could try to let the sound come from the far left
and go to the far right and a little bit in front of you within the
10 second runtime of the program. With this change you should be able
to hear the volume of the sound change, depending on how far it is away from you.
Updating the :data:`aud.Handle.velocity` property properly also enables the doppler effect.
Compare your solution to the **siren2.py** demo.
Tetris
------
The **tetris.py** demo application shows an even more complex application which generates retro tetris music. Looking at the source code there should be nothing new here, again the functions used from audaspace are the same as in the previous examples. In the :func:`parseNote` function all single notes get joined which leads to a very long chain of sounds. If you think of :func:`aud.Sound.join` as a function that creates a binary tree with the two joined sounds as leaves then the :func:`parseNote` function creates a very unbalanced tree.
The **tetris.py** demo application shows an even more
complex application which generates retro tetris music.
Looking at the source code there should be nothing new here,
again the functions used from audaspace are the same as in the previous examples.
In the :func:`parseNote` function all single notes get joined which leads
to a very long chain of sounds. If you think of :func:`aud.Sound.join`
as a function that creates a binary tree with the two joined sounds as
leaves then the :func:`parseNote` function creates a very unbalanced tree.
Insted we could rewrite the code to use two other classes: :class:`aud.Sequence` and :class:`aud.SequenceEntry` to sequence the notes. The **tetris2.py** application does exactly that. Before the while loop we add a variable that stores the current position in the score and create a new :class:`aud.Sequence` object.
Insted we could rewrite the code to use two other classes:
:class:`aud.Sequence` and :class:`aud.SequenceEntry` to sequence the notes.
The **tetris2.py** application does exactly that.
Before the while loop we add a variable that stores the current position
in the score and create a new :class:`aud.Sequence` object.
.. code-block:: python
position = 0
sequence = aud.Sequence()
Then in the loop we can create the note simply by chaining the :func:`aud.Sound.square` generator and :func:`aud.Sound.fadein` and :func:`aud.Sound.fadeout` effects.
Then in the loop we can create the note simply by chaining the
:func:`aud.Sound.square` generator and :func:`aud.Sound.fadein`
and :func:`aud.Sound.fadeout` effects.
.. code-block:: python
note = aud.Sound.square(freq, rate).fadein(0, fadelength).fadeout(length - fadelength, fadelength)
Now instead of using :func:`aud.Sound.limit` and :func:`aud.Sound.join` we simply add the sound to the sequence.
Now instead of using :func:`aud.Sound.limit` and :func:`aud.Sound.join`
we simply add the sound to the sequence.
.. code-block:: python
entry = sequence.add(note, position, position + length, 0)
The entry returned from the :func:`aud.Sequence.add` function is an object of the :class:`aud.SequenceEntry` class. We can use this entry to mute the note in case it's actually a pause.
The entry returned from the :func:`aud.Sequence.add`
function is an object of the :class:`aud.SequenceEntry` class.
We can use this entry to mute the note in case it's actually a pause.
.. code-block:: python
@@ -158,9 +227,14 @@ Lastly we have to update our position variable.
position += length
Now in **tetris2.py** we used the :data:`aud.SequenceEntry.muted` property to show how the :class:`aud.SequenceEntry` class can be used, but it would actually be smarter to not even create a note for pauses and just skip them. You can try to implement this as an exercise and then check out the solution in **tetris3.py**.
Now in **tetris2.py** we used the :data:`aud.SequenceEntry.muted`
property to show how the :class:`aud.SequenceEntry` class can be used,
but it would actually be smarter to not even create a note for pauses and just skip them.
You can try to implement this as an exercise and then check out the solution in **tetris3.py**.
Conclusion
----------
We introduced all five currently available classes in the audaspace Python API. Of course all classes offer a lot more functions than have been used in these demo applications, check out the specific class documentation for more details.
We introduced all five currently available classes in the audaspace Python API.
Of course all classes offer a lot more functions than have been used in these demo applications,
check out the specific class documentation for more details.

View File

@@ -124,15 +124,17 @@ Device_new(PyTypeObject* type, PyObject* args, PyObject* kwds)
}
PyDoc_STRVAR(M_aud_Device_lock_doc,
"lock()\n\n"
"Locks the device so that it's guaranteed, that no samples are "
"read from the streams until :meth:`unlock` is called.\n"
"This is useful if you want to do start/stop/pause/resume some "
"sounds at the same time.\n\n"
".. note:: The device has to be unlocked as often as locked to be "
"able to continue playback.\n\n"
".. warning:: Make sure the time between locking and unlocking is "
"as short as possible to avoid clicks.");
".. classmethod:: lock()\n\n"
" Locks the device so that it's guaranteed, that no samples are\n"
" read from the streams until :meth:`unlock` is called.\n"
" This is useful if you want to do start/stop/pause/resume some\n"
" sounds at the same time.\n\n"
" .. note::\n\n"
" The device has to be unlocked as often as locked to be\n"
" able to continue playback.\n\n"
" .. warning::\n\n"
" Make sure the time between locking and unlocking is\n"
" as short as possible to avoid clicks.");
static PyObject *
Device_lock(Device* self)
@@ -150,15 +152,15 @@ Device_lock(Device* self)
}
PyDoc_STRVAR(M_aud_Device_play_doc,
"play(sound, keep=False)\n\n"
"Plays a sound.\n\n"
":arg sound: The sound to play.\n"
":type sound: :class:`Sound`\n"
":arg keep: See :attr:`Handle.keep`.\n"
":type keep: bool\n"
":return: The playback handle with which playback can be "
"controlled with.\n"
":rtype: :class:`Handle`");
".. classmethod:: play(sound, keep=False)\n\n"
" Plays a sound.\n\n"
" :arg sound: The sound to play.\n"
" :type sound: :class:`Sound`\n"
" :arg keep: See :attr:`Handle.keep`.\n"
" :type keep: bool\n"
" :return: The playback handle with which playback can be\n"
" controlled with.\n"
" :rtype: :class:`Handle`");
static PyObject *
Device_play(Device* self, PyObject* args, PyObject* kwds)
@@ -210,8 +212,8 @@ Device_play(Device* self, PyObject* args, PyObject* kwds)
}
PyDoc_STRVAR(M_aud_Device_stopAll_doc,
"stopAll()\n\n"
"Stops all playing and paused sounds.");
".. classmethod:: stopAll()\n\n"
" Stops all playing and paused sounds.");
static PyObject *
Device_stopAll(Device* self)
@@ -229,9 +231,9 @@ Device_stopAll(Device* self)
}
PyDoc_STRVAR(M_aud_Device_unlock_doc,
"unlock()\n\n"
"Unlocks the device after a lock call, see :meth:`lock` for "
"details.");
".. classmethod:: unlock()\n\n"
" Unlocks the device after a lock call, see :meth:`lock` for\n"
" details.");
static PyObject *
Device_unlock(Device* self)
@@ -284,7 +286,7 @@ Device_get_channels(Device* self, void* nothing)
PyDoc_STRVAR(M_aud_Device_distance_model_doc,
"The distance model of the device.\n\n"
".. seealso:: http://connect.creativelabs.com/openal/Documentation/OpenAL%201.1%20Specification.htm#_Toc199835864");
".. seealso:: `OpenAL Documentation <https://www.openal.org/documentation/>`__");
static PyObject *
Device_get_distance_model(Device* self, void* nothing)

View File

@@ -60,12 +60,12 @@ DynamicMusic_dealloc(DynamicMusicP* self)
}
PyDoc_STRVAR(M_aud_DynamicMusic_addScene_doc,
"addScene(scene)\n\n"
"Adds a new scene.\n\n"
":arg scene: The scene sound.\n"
":type scene: :class:`Sound`\n"
":return: The new scene id.\n"
":rtype: int");
".. classmethod:: addScene(scene)\n\n"
" Adds a new scene.\n\n"
" :arg scene: The scene sound.\n"
" :type scene: :class:`Sound`\n"
" :return: The new scene id.\n"
" :rtype: int");
static PyObject *
DynamicMusic_addScene(DynamicMusicP* self, PyObject* args)
@@ -90,16 +90,16 @@ DynamicMusic_addScene(DynamicMusicP* self, PyObject* args)
}
PyDoc_STRVAR(M_aud_DynamicMusic_addTransition_doc,
"addTransition(ini, end, transition)\n\n"
"Adds a new scene.\n\n"
":arg ini: the initial scene foor the transition.\n"
":type ini: int\n"
":arg end: The final scene for the transition.\n"
":type end: int\n"
":arg transition: The transition sound.\n"
":type transition: :class:`Sound`\n"
":return: false if the ini or end scenes don't exist, true othrwise.\n"
":rtype: bool");
".. classmethod:: addTransition(ini, end, transition)\n\n"
" Adds a new scene.\n\n"
" :arg ini: the initial scene foor the transition.\n"
" :type ini: int\n"
" :arg end: The final scene for the transition.\n"
" :type end: int\n"
" :arg transition: The transition sound.\n"
" :type transition: :class:`Sound`\n"
" :return: false if the ini or end scenes don't exist, true othrwise.\n"
" :rtype: bool");
static PyObject *
DynamicMusic_addTransition(DynamicMusicP* self, PyObject* args)
@@ -125,10 +125,10 @@ DynamicMusic_addTransition(DynamicMusicP* self, PyObject* args)
}
PyDoc_STRVAR(M_aud_DynamicMusic_resume_doc,
"resume()\n\n"
"Resumes playback of the scene.\n\n"
":return: Whether the action succeeded.\n"
":rtype: bool");
".. classmethod:: resume()\n\n"
" Resumes playback of the scene.\n\n"
" :return: Whether the action succeeded.\n"
" :rtype: bool");
static PyObject *
DynamicMusic_resume(DynamicMusicP* self)
@@ -145,10 +145,10 @@ DynamicMusic_resume(DynamicMusicP* self)
}
PyDoc_STRVAR(M_aud_DynamicMusic_pause_doc,
"pause()\n\n"
"Pauses playback of the scene.\n\n"
":return: Whether the action succeeded.\n"
":rtype: bool");
".. classmethod:: pause()\n\n"
" Pauses playback of the scene.\n\n"
" :return: Whether the action succeeded.\n"
" :rtype: bool");
static PyObject *
DynamicMusic_pause(DynamicMusicP* self)
@@ -165,10 +165,10 @@ DynamicMusic_pause(DynamicMusicP* self)
}
PyDoc_STRVAR(M_aud_DynamicMusic_stop_doc,
"stop()\n\n"
"Stops playback of the scene.\n\n"
":return: Whether the action succeeded.\n"
":rtype: bool\n\n");
".. classmethod:: stop()\n\n"
" Stops playback of the scene.\n\n"
" :return: Whether the action succeeded.\n"
" :rtype: bool\n\n");
static PyObject *
DynamicMusic_stop(DynamicMusicP* self)
@@ -464,4 +464,4 @@ void addDynamicMusicToModule(PyObject* module)
{
Py_INCREF(&DynamicMusicType);
PyModule_AddObject(module, "DynamicMusic", (PyObject *)&DynamicMusicType);
}
}

View File

@@ -54,16 +54,16 @@ HRTF_dealloc(HRTFP* self)
}
PyDoc_STRVAR(M_aud_HRTF_addImpulseResponse_doc,
"addImpulseResponseFromSound(sound, azimuth, elevation)\n\n"
"Adds a new hrtf to the HRTF object\n\n"
":arg sound: The sound that contains the hrtf.\n"
":type sound: :class:`Sound`\n"
":arg azimuth: The azimuth angle of the hrtf.\n"
":type azimuth: float\n"
":arg elevation: The elevation angle of the hrtf.\n"
":type elevation: float\n"
":return: Whether the action succeeded.\n"
":rtype: bool");
".. classmethod:: addImpulseResponseFromSound(sound, azimuth, elevation)\n\n"
" Adds a new hrtf to the HRTF object\n\n"
" :arg sound: The sound that contains the hrtf.\n"
" :type sound: :class:`Sound`\n"
" :arg azimuth: The azimuth angle of the hrtf.\n"
" :type azimuth: float\n"
" :arg elevation: The elevation angle of the hrtf.\n"
" :type elevation: float\n"
" :return: Whether the action succeeded.\n"
" :rtype: bool");
static PyObject *
HRTF_addImpulseResponseFromSound(HRTFP* self, PyObject* args)
@@ -90,14 +90,14 @@ HRTF_addImpulseResponseFromSound(HRTFP* self, PyObject* args)
}
PyDoc_STRVAR(M_aud_HRTF_loadLeftHrtfSet_doc,
"loadLeftHrtfSet(extension, directory)\n\n"
"Loads all HRTFs from a directory.\n\n"
":arg extension: The file extension of the hrtfs.\n"
":type extension: string\n"
":arg directory: The path to where the HRTF files are located.\n"
":type extension: string\n"
":return: The loaded :class:`HRTF` object.\n"
":rtype: :class:`HRTF`\n\n");
".. classmethod:: loadLeftHrtfSet(extension, directory)\n\n"
" Loads all HRTFs from a directory.\n\n"
" :arg extension: The file extension of the hrtfs.\n"
" :type extension: string\n"
" :arg directory: The path to where the HRTF files are located.\n"
" :type extension: string\n"
" :return: The loaded :class:`HRTF` object.\n"
" :rtype: :class:`HRTF`\n\n");
static PyObject *
HRTF_loadLeftHrtfSet(PyTypeObject* type, PyObject* args)
@@ -125,14 +125,14 @@ HRTF_loadLeftHrtfSet(PyTypeObject* type, PyObject* args)
}
PyDoc_STRVAR(M_aud_HRTF_loadRightHrtfSet_doc,
"loadLeftHrtfSet(extension, directory)\n\n"
"Loads all HRTFs from a directory.\n\n"
":arg extension: The file extension of the hrtfs.\n"
":type extension: string\n"
":arg directory: The path to where the HRTF files are located.\n"
":type extension: string\n"
":return: The loaded :class:`HRTF` object.\n"
":rtype: :class:`HRTF`\n\n");
".. classmethod:: loadLeftHrtfSet(extension, directory)\n\n"
" Loads all HRTFs from a directory.\n\n"
" :arg extension: The file extension of the hrtfs.\n"
" :type extension: string\n"
" :arg directory: The path to where the HRTF files are located.\n"
" :type extension: string\n"
" :return: The loaded :class:`HRTF` object.\n"
" :rtype: :class:`HRTF`\n\n");
static PyObject *
HRTF_loadRightHrtfSet(PyTypeObject* type, PyObject* args)

View File

@@ -38,10 +38,10 @@ Handle_dealloc(Handle* self)
}
PyDoc_STRVAR(M_aud_Handle_pause_doc,
"pause()\n\n"
"Pauses playback.\n\n"
":return: Whether the action succeeded.\n"
":rtype: bool");
".. classmethod:: pause()\n\n"
" Pauses playback.\n\n"
" :return: Whether the action succeeded.\n"
" :rtype: bool");
static PyObject *
Handle_pause(Handle* self)
@@ -58,10 +58,10 @@ Handle_pause(Handle* self)
}
PyDoc_STRVAR(M_aud_Handle_resume_doc,
"resume()\n\n"
"Resumes playback.\n\n"
":return: Whether the action succeeded.\n"
":rtype: bool");
".. classmethod:: resume()\n\n"
" Resumes playback.\n\n"
" :return: Whether the action succeeded.\n"
" :rtype: bool");
static PyObject *
Handle_resume(Handle* self)
@@ -78,11 +78,11 @@ Handle_resume(Handle* self)
}
PyDoc_STRVAR(M_aud_Handle_stop_doc,
"stop()\n\n"
"Stops playback.\n\n"
":return: Whether the action succeeded.\n"
":rtype: bool\n\n"
".. note:: This makes the handle invalid.");
".. classmethod:: stop()\n\n"
" Stops playback.\n\n"
" :return: Whether the action succeeded.\n"
" :rtype: bool\n\n"
" .. note:: This makes the handle invalid.");
static PyObject *
Handle_stop(Handle* self)
@@ -1122,5 +1122,3 @@ void addHandleToModule(PyObject* module)
Py_INCREF(&HandleType);
PyModule_AddObject(module, "Handle", (PyObject *)&HandleType);
}

View File

@@ -60,14 +60,15 @@ PlaybackManager_dealloc(PlaybackManagerP* self)
}
PyDoc_STRVAR(M_aud_PlaybackManager_play_doc,
"setVolume(sound, catKey)\n\n"
"Plays a sound through the playback manager and assigns it to a category.\n\n"
":arg sound: The sound to play.\n"
":type sound: :class:`Sound`\n"
":arg catKey: the key of the category in which the sound will be added, if it doesn't exist, a new one will be created.\n"
":type catKey: int\n"
":return: The playback handle with which playback can be controlled with.\n"
":rtype: :class:`Handle`");
".. classmethod:: setVolume(sound, catKey)\n\n"
" Plays a sound through the playback manager and assigns it to a category.\n\n"
" :arg sound: The sound to play.\n"
" :type sound: :class:`Sound`\n"
" :arg catKey: the key of the category in which the sound will be added,\n"
" if it doesn't exist, a new one will be created.\n"
" :type catKey: int\n"
" :return: The playback handle with which playback can be controlled with.\n"
" :rtype: :class:`Handle`");
static PyObject *
PlaybackManager_play(PlaybackManagerP* self, PyObject* args)
@@ -103,12 +104,12 @@ PlaybackManager_play(PlaybackManagerP* self, PyObject* args)
}
PyDoc_STRVAR(M_aud_PlaybackManager_resume_doc,
"resume(catKey)\n\n"
"Resumes playback of the catgory.\n\n"
":arg catKey: the key of the category.\n"
":type catKey: int\n"
":return: Whether the action succeeded.\n"
":rtype: bool");
".. classmethod:: resume(catKey)\n\n"
" Resumes playback of the catgory.\n\n"
" :arg catKey: the key of the category.\n"
" :type catKey: int\n"
" :return: Whether the action succeeded.\n"
" :rtype: bool");
static PyObject *
PlaybackManager_resume(PlaybackManagerP* self, PyObject* args)
@@ -130,12 +131,12 @@ PlaybackManager_resume(PlaybackManagerP* self, PyObject* args)
}
PyDoc_STRVAR(M_aud_PlaybackManager_pause_doc,
"pause(catKey)\n\n"
"Pauses playback of the category.\n\n"
":arg catKey: the key of the category.\n"
":type catKey: int\n"
":return: Whether the action succeeded.\n"
":rtype: bool");
".. classmethod:: pause(catKey)\n\n"
" Pauses playback of the category.\n\n"
" :arg catKey: the key of the category.\n"
" :type catKey: int\n"
" :return: Whether the action succeeded.\n"
" :rtype: bool");
static PyObject *
PlaybackManager_pause(PlaybackManagerP* self, PyObject* args)
@@ -157,12 +158,12 @@ PlaybackManager_pause(PlaybackManagerP* self, PyObject* args)
}
PyDoc_STRVAR(M_aud_PlaybackManager_add_category_doc,
"addCategory(volume)\n\n"
"Adds a category with a custom volume.\n\n"
":arg volume: The volume for ther new category.\n"
":type volume: float\n"
":return: The key of the new category.\n"
":rtype: int\n\n");
".. classmethod:: addCategory(volume)\n\n"
" Adds a category with a custom volume.\n\n"
" :arg volume: The volume for ther new category.\n"
" :type volume: float\n"
" :return: The key of the new category.\n"
" :rtype: int\n\n");
static PyObject *
PlaybackManager_add_category(PlaybackManagerP* self, PyObject* args)
@@ -184,12 +185,12 @@ PlaybackManager_add_category(PlaybackManagerP* self, PyObject* args)
}
PyDoc_STRVAR(M_aud_PlaybackManager_get_volume_doc,
"getVolume(catKey)\n\n"
"Retrieves the volume of a category.\n\n"
":arg catKey: the key of the category.\n"
":type catKey: int\n"
":return: The volume of the cateogry.\n"
":rtype: float\n\n");
".. classmethod:: getVolume(catKey)\n\n"
" Retrieves the volume of a category.\n\n"
" :arg catKey: the key of the category.\n"
" :type catKey: int\n"
" :return: The volume of the cateogry.\n"
" :rtype: float\n\n");
static PyObject *
PlaybackManager_get_volume(PlaybackManagerP* self, PyObject* args)
@@ -211,14 +212,14 @@ PlaybackManager_get_volume(PlaybackManagerP* self, PyObject* args)
}
PyDoc_STRVAR(M_aud_PlaybackManager_set_volume_doc,
"setVolume(volume, catKey)\n\n"
"Changes the volume of a category.\n\n"
":arg volume: the new volume value.\n"
":type volume: float\n"
":arg catKey: the key of the category.\n"
":type catKey: int\n"
":return: Whether the action succeeded.\n"
":rtype: int\n\n");
".. classmethod:: setVolume(volume, catKey)\n\n"
" Changes the volume of a category.\n\n"
" :arg volume: the new volume value.\n"
" :type volume: float\n"
" :arg catKey: the key of the category.\n"
" :type catKey: int\n"
" :return: Whether the action succeeded.\n"
" :rtype: int\n\n");
static PyObject *
PlaybackManager_set_volume(PlaybackManagerP* self, PyObject* args)
@@ -241,12 +242,12 @@ PlaybackManager_set_volume(PlaybackManagerP* self, PyObject* args)
}
PyDoc_STRVAR(M_aud_PlaybackManager_stop_doc,
"stop(catKey)\n\n"
"Stops playback of the category.\n\n"
":arg catKey: the key of the category.\n"
":type catKey: int\n"
":return: Whether the action succeeded.\n"
":rtype: bool\n\n");
".. classmethod:: stop(catKey)\n\n"
" Stops playback of the category.\n\n"
" :arg catKey: the key of the category.\n"
" :type catKey: int\n"
" :return: Whether the action succeeded.\n"
" :rtype: bool\n\n");
static PyObject *
PlaybackManager_stop(PlaybackManagerP* self, PyObject* args)
@@ -268,8 +269,8 @@ PlaybackManager_stop(PlaybackManagerP* self, PyObject* args)
}
PyDoc_STRVAR(M_aud_PlaybackManager_clean_doc,
"clean()\n\n"
"Cleans all the invalid and finished sound from the playback manager.\n\n");
".. classmethod:: clean()\n\n"
" Cleans all the invalid and finished sound from the playback manager.\n\n");
static PyObject *
PlaybackManager_clean(PlaybackManagerP* self)

View File

@@ -99,18 +99,18 @@ Sequence_new(PyTypeObject* type, PyObject* args, PyObject* kwds)
}
PyDoc_STRVAR(M_aud_Sequence_add_doc,
"add()\n\n"
"Adds a new entry to the sequence.\n\n"
":arg sound: The sound this entry should play.\n"
":type sound: :class:`Sound`\n"
":arg begin: The start time.\n"
":type begin: float\n"
":arg end: The end time or a negative value if determined by the sound.\n"
":type end: float\n"
":arg skip: How much seconds should be skipped at the beginning.\n"
":type skip: float\n"
":return: The entry added.\n"
":rtype: :class:`SequenceEntry`");
".. classmethod:: add()\n\n"
" Adds a new entry to the sequence.\n\n"
" :arg sound: The sound this entry should play.\n"
" :type sound: :class:`Sound`\n"
" :arg begin: The start time.\n"
" :type begin: float\n"
" :arg end: The end time or a negative value if determined by the sound.\n"
" :type end: float\n"
" :arg skip: How much seconds should be skipped at the beginning.\n"
" :type skip: float\n"
" :return: The entry added.\n"
" :rtype: :class:`SequenceEntry`");
static PyObject *
Sequence_add(Sequence* self, PyObject* args, PyObject* kwds)
@@ -151,10 +151,10 @@ Sequence_add(Sequence* self, PyObject* args, PyObject* kwds)
}
PyDoc_STRVAR(M_aud_Sequence_remove_doc,
"remove()\n\n"
"Removes an entry from the sequence.\n\n"
":arg entry: The entry to remove.\n"
":type entry: :class:`SequenceEntry`\n");
".. classmethod:: remove()\n\n"
" Removes an entry from the sequence.\n\n"
" :arg entry: The entry to remove.\n"
" :type entry: :class:`SequenceEntry`\n");
static PyObject *
Sequence_remove(Sequence* self, PyObject* args)
@@ -183,16 +183,16 @@ Sequence_remove(Sequence* self, PyObject* args)
}
PyDoc_STRVAR(M_aud_Sequence_setAnimationData_doc,
"setAnimationData()\n\n"
"Writes animation data to a sequence.\n\n"
":arg type: The type of animation data.\n"
":type type: int\n"
":arg frame: The frame this data is for.\n"
":type frame: int\n"
":arg data: The data to write.\n"
":type data: sequence of float\n"
":arg animated: Whether the attribute is animated.\n"
":type animated: bool");
".. classmethod:: setAnimationData()\n\n"
" Writes animation data to a sequence.\n\n"
" :arg type: The type of animation data.\n"
" :type type: int\n"
" :arg frame: The frame this data is for.\n"
" :type frame: int\n"
" :arg data: The data to write.\n"
" :type data: sequence of float\n"
" :arg animated: Whether the attribute is animated.\n"
" :type animated: bool");
static PyObject *
Sequence_setAnimationData(Sequence* self, PyObject* args)
@@ -325,7 +325,7 @@ Sequence_set_channels(Sequence* self, PyObject* args, void* nothing)
PyDoc_STRVAR(M_aud_Sequence_distance_model_doc,
"The distance model of the sequence.\n\n"
".. seealso:: http://connect.creativelabs.com/openal/Documentation/OpenAL%201.1%20Specification.htm#_Toc199835864");
".. seealso:: `OpenAL Documentation <https://www.openal.org/documentation/>`__");
static PyObject *
Sequence_get_distance_model(Sequence* self, void* nothing)

View File

@@ -43,14 +43,14 @@ SequenceEntry_dealloc(SequenceEntry* self)
}
PyDoc_STRVAR(M_aud_SequenceEntry_move_doc,
"move()\n\n"
"Moves the entry.\n\n"
":arg begin: The new start time.\n"
":type begin: float\n"
":arg end: The new end time or a negative value if unknown.\n"
":type end: float\n"
":arg skip: How many seconds to skip at the beginning.\n"
":type skip: float\n");
".. classmethod:: move()\n\n"
" Moves the entry.\n\n"
" :arg begin: The new start time.\n"
" :type begin: float\n"
" :arg end: The new end time or a negative value if unknown.\n"
" :type end: float\n"
" :arg skip: How many seconds to skip at the beginning.\n"
" :type skip: float\n");
static PyObject *
SequenceEntry_move(SequenceEntry* self, PyObject* args)
@@ -73,16 +73,16 @@ SequenceEntry_move(SequenceEntry* self, PyObject* args)
}
PyDoc_STRVAR(M_aud_SequenceEntry_setAnimationData_doc,
"setAnimationData()\n\n"
"Writes animation data to a sequenced entry.\n\n"
":arg type: The type of animation data.\n"
":type type: int\n"
":arg frame: The frame this data is for.\n"
":type frame: int\n"
":arg data: The data to write.\n"
":type data: sequence of float\n"
":arg animated: Whether the attribute is animated.\n"
":type animated: bool");
".. classmethod:: setAnimationData()\n\n"
" Writes animation data to a sequenced entry.\n\n"
" :arg type: The type of animation data.\n"
" :type type: int\n"
" :arg frame: The frame this data is for.\n"
" :type frame: int\n"
" :arg data: The data to write.\n"
" :type data: sequence of float\n"
" :arg animated: Whether the attribute is animated.\n"
" :type animated: bool");
static PyObject *
SequenceEntry_setAnimationData(SequenceEntry* self, PyObject* args)

View File

@@ -114,11 +114,11 @@ Sound_new(PyTypeObject* type, PyObject* args, PyObject* kwds)
}
PyDoc_STRVAR(M_aud_Sound_data_doc,
"data()\n\n"
"Retrieves the data of the sound as numpy array.\n\n"
":return: A two dimensional numpy float array.\n"
":rtype: :class:`numpy.ndarray`\n\n"
".. note:: Best efficiency with cached sounds.");
".. classmethod:: data()\n\n"
" Retrieves the data of the sound as numpy array.\n\n"
" :return: A two dimensional numpy float array.\n"
" :rtype: :class:`numpy.ndarray`\n\n"
" .. note:: Best efficiency with cached sounds.");
static PyObject *
Sound_data(Sound* self)
@@ -145,24 +145,24 @@ Sound_data(Sound* self)
}
PyDoc_STRVAR(M_aud_Sound_write_doc,
"write(filename, rate, channels, format, container, codec, bitrate, buffersize)\n\n"
"Writes the sound to a file.\n\n"
":arg filename: The path to write to.\n"
":type filename: string\n"
":arg rate: The sample rate to write with.\n"
":type rate: int\n"
":arg channels: The number of channels to write with.\n"
":type channels: int\n"
":arg format: The sample format to write with.\n"
":type format: int\n"
":arg container: The container format for the file.\n"
":type container: int\n"
":arg codec: The codec to use in the file.\n"
":type codec: int\n"
":arg bitrate: The bitrate to write with.\n"
":type bitrate: int\n"
":arg buffersize: The size of the writing buffer.\n"
":type buffersize: int\n");
".. classmethod:: write(filename, rate, channels, format, container, codec, bitrate, buffersize)\n\n"
" Writes the sound to a file.\n\n"
" :arg filename: The path to write to.\n"
" :type filename: string\n"
" :arg rate: The sample rate to write with.\n"
" :type rate: int\n"
" :arg channels: The number of channels to write with.\n"
" :type channels: int\n"
" :arg format: The sample format to write with.\n"
" :type format: int\n"
" :arg container: The container format for the file.\n"
" :type container: int\n"
" :arg codec: The codec to use in the file.\n"
" :type codec: int\n"
" :arg bitrate: The bitrate to write with.\n"
" :type bitrate: int\n"
" :arg buffersize: The size of the writing buffer.\n"
" :type buffersize: int");
static PyObject *
Sound_write(Sound* self, PyObject* args, PyObject* kwds)
@@ -286,14 +286,14 @@ Sound_write(Sound* self, PyObject* args, PyObject* kwds)
}
PyDoc_STRVAR(M_aud_Sound_buffer_doc,
"buffer(data, rate)\n\n"
"Creates a sound from a data buffer.\n\n"
":arg data: The data as two dimensional numpy array.\n"
":type data: numpy.ndarray\n"
":arg rate: The sample rate.\n"
":type rate: double\n"
":return: The created :class:`Sound` object.\n"
":rtype: :class:`Sound`");
".. classmethod:: buffer(data, rate)\n\n"
" Creates a sound from a data buffer.\n\n"
" :arg data: The data as two dimensional numpy array.\n"
" :type data: numpy.ndarray\n"
" :arg rate: The sample rate.\n"
" :type rate: double\n"
" :return: The created :class:`Sound` object.\n"
" :rtype: :class:`Sound`");
static PyObject *
Sound_buffer(PyTypeObject* type, PyObject* args)
@@ -356,16 +356,17 @@ Sound_buffer(PyTypeObject* type, PyObject* args)
}
PyDoc_STRVAR(M_aud_Sound_cache_doc,
"cache()\n\n"
"Caches a sound into RAM.\n"
"This saves CPU usage needed for decoding and file access if the "
"underlying sound reads from a file on the harddisk, but it "
"consumes a lot of memory.\n\n"
":return: The created :class:`Sound` object.\n"
":rtype: :class:`Sound`\n\n"
".. note:: Only known-length factories can be buffered.\n\n"
".. warning:: Raw PCM data needs a lot of space, only buffer "
"short factories.");
".. classmethod:: cache()\n\n"
" Caches a sound into RAM.\n\n"
" This saves CPU usage needed for decoding and file access if the\n"
" underlying sound reads from a file on the harddisk,\n"
" but it consumes a lot of memory.\n\n"
" :return: The created :class:`Sound` object.\n"
" :rtype: :class:`Sound`\n\n"
" .. note:: Only known-length factories can be buffered.\n\n"
" .. warning::\n\n"
" Raw PCM data needs a lot of space, only buffer\n"
" short factories.");
static PyObject *
Sound_cache(Sound* self)
@@ -391,15 +392,16 @@ Sound_cache(Sound* self)
}
PyDoc_STRVAR(M_aud_Sound_file_doc,
"file(filename)\n\n"
"Creates a sound object of a sound file.\n\n"
":arg filename: Path of the file.\n"
":type filename: string\n"
":return: The created :class:`Sound` object.\n"
":rtype: :class:`Sound`\n\n"
".. warning:: If the file doesn't exist or can't be read you will "
"not get an exception immediately, but when you try to start "
"playback of that sound.");
".. classmethod:: file(filename)\n\n"
" Creates a sound object of a sound file.\n\n"
" :arg filename: Path of the file.\n"
" :type filename: string\n"
" :return: The created :class:`Sound` object.\n"
" :rtype: :class:`Sound`\n\n"
" .. warning::\n\n"
" If the file doesn't exist or can't be read you will\n"
" not get an exception immediately, but when you try to start\n"
" playback of that sound.\n");
static PyObject *
Sound_file(PyTypeObject* type, PyObject* args)
@@ -430,15 +432,15 @@ Sound_file(PyTypeObject* type, PyObject* args)
}
PyDoc_STRVAR(M_aud_Sound_sawtooth_doc,
"sawtooth(frequency, rate=48000)\n\n"
"Creates a sawtooth sound which plays a sawtooth wave.\n\n"
":arg frequency: The frequency of the sawtooth wave in Hz.\n"
":type frequency: float\n"
":arg rate: The sampling rate in Hz. It's recommended to set this "
"value to the playback device's samling rate to avoid resamping.\n"
":type rate: int\n"
":return: The created :class:`Sound` object.\n"
":rtype: :class:`Sound`");
".. classmethod:: sawtooth(frequency, rate=48000)\n\n"
" Creates a sawtooth sound which plays a sawtooth wave.\n\n"
" :arg frequency: The frequency of the sawtooth wave in Hz.\n"
" :type frequency: float\n"
" :arg rate: The sampling rate in Hz. It's recommended to set this\n"
" value to the playback device's samling rate to avoid resamping.\n"
" :type rate: int\n"
" :return: The created :class:`Sound` object.\n"
" :rtype: :class:`Sound`");
static PyObject *
Sound_sawtooth(PyTypeObject* type, PyObject* args)
@@ -470,13 +472,13 @@ Sound_sawtooth(PyTypeObject* type, PyObject* args)
}
PyDoc_STRVAR(M_aud_Sound_silence_doc,
"silence(rate=48000)\n\n"
"Creates a silence sound which plays simple silence.\n\n"
":arg rate: The sampling rate in Hz. It's recommended to set this "
"value to the playback device's samling rate to avoid resamping.\n"
":type rate: int\n"
":return: The created :class:`Sound` object.\n"
":rtype: :class:`Sound`");
".. classmethod:: silence(rate=48000)\n\n"
" Creates a silence sound which plays simple silence.\n\n"
" :arg rate: The sampling rate in Hz. It's recommended to set this\n"
" value to the playback device's samling rate to avoid resamping.\n"
" :type rate: int\n"
" :return: The created :class:`Sound` object.\n"
" :rtype: :class:`Sound`");
static PyObject *
Sound_silence(PyTypeObject* type, PyObject* args)
@@ -507,15 +509,15 @@ Sound_silence(PyTypeObject* type, PyObject* args)
}
PyDoc_STRVAR(M_aud_Sound_sine_doc,
"sine(frequency, rate=48000)\n\n"
"Creates a sine sound which plays a sine wave.\n\n"
":arg frequency: The frequency of the sine wave in Hz.\n"
":type frequency: float\n"
":arg rate: The sampling rate in Hz. It's recommended to set this "
"value to the playback device's samling rate to avoid resamping.\n"
":type rate: int\n"
":return: The created :class:`Sound` object.\n"
":rtype: :class:`Sound`");
".. classmethod:: sine(frequency, rate=48000)\n\n"
" Creates a sine sound which plays a sine wave.\n\n"
" :arg frequency: The frequency of the sine wave in Hz.\n"
" :type frequency: float\n"
" :arg rate: The sampling rate in Hz. It's recommended to set this\n"
" value to the playback device's samling rate to avoid resamping.\n"
" :type rate: int\n"
" :return: The created :class:`Sound` object.\n"
" :rtype: :class:`Sound`");
static PyObject *
Sound_sine(PyTypeObject* type, PyObject* args)
@@ -547,15 +549,15 @@ Sound_sine(PyTypeObject* type, PyObject* args)
}
PyDoc_STRVAR(M_aud_Sound_square_doc,
"square(frequency, rate=48000)\n\n"
"Creates a square sound which plays a square wave.\n\n"
":arg frequency: The frequency of the square wave in Hz.\n"
":type frequency: float\n"
":arg rate: The sampling rate in Hz. It's recommended to set this "
"value to the playback device's samling rate to avoid resamping.\n"
":type rate: int\n"
":return: The created :class:`Sound` object.\n"
":rtype: :class:`Sound`");
".. classmethod:: square(frequency, rate=48000)\n\n"
" Creates a square sound which plays a square wave.\n\n"
" :arg frequency: The frequency of the square wave in Hz.\n"
" :type frequency: float\n"
" :arg rate: The sampling rate in Hz. It's recommended to set this\n"
" value to the playback device's samling rate to avoid resamping.\n"
" :type rate: int\n"
" :return: The created :class:`Sound` object.\n"
" :rtype: :class:`Sound`");
static PyObject *
Sound_square(PyTypeObject* type, PyObject* args)
@@ -587,15 +589,15 @@ Sound_square(PyTypeObject* type, PyObject* args)
}
PyDoc_STRVAR(M_aud_Sound_triangle_doc,
"triangle(frequency, rate=48000)\n\n"
"Creates a triangle sound which plays a triangle wave.\n\n"
":arg frequency: The frequency of the triangle wave in Hz.\n"
":type frequency: float\n"
":arg rate: The sampling rate in Hz. It's recommended to set this "
"value to the playback device's samling rate to avoid resamping.\n"
":type rate: int\n"
":return: The created :class:`Sound` object.\n"
":rtype: :class:`Sound`");
".. classmethod:: triangle(frequency, rate=48000)\n\n"
" Creates a triangle sound which plays a triangle wave.\n\n"
" :arg frequency: The frequency of the triangle wave in Hz.\n"
" :type frequency: float\n"
" :arg rate: The sampling rate in Hz. It's recommended to set this\n"
" value to the playback device's samling rate to avoid resamping.\n"
" :type rate: int\n"
" :return: The created :class:`Sound` object.\n"
" :rtype: :class:`Sound`");
static PyObject *
Sound_triangle(PyTypeObject* type, PyObject* args)
@@ -627,14 +629,16 @@ Sound_triangle(PyTypeObject* type, PyObject* args)
}
PyDoc_STRVAR(M_aud_Sound_accumulate_doc,
"accumulate(additive=False)\n\n"
"Accumulates a sound by summing over positive input differences thus generating a monotonic sigal. "
"If additivity is set to true negative input differences get added too, but positive ones with a factor of two. "
"Note that with additivity the signal is not monotonic anymore.\n\n"
":arg additive: Whether the accumulation should be additive or not.\n"
":type time: bool\n"
":return: The created :class:`Sound` object.\n"
":rtype: :class:`Sound`");
".. classmethod:: accumulate(additive=False)\n\n"
" Accumulates a sound by summing over positive input\n"
" differences thus generating a monotonic sigal.\n"
" If additivity is set to true negative input differences get added too,\n"
" but positive ones with a factor of two.\n\n"
" Note that with additivity the signal is not monotonic anymore.\n\n"
" :arg additive: Whether the accumulation should be additive or not.\n"
" :type time: bool\n"
" :return: The created :class:`Sound` object.\n"
" :rtype: :class:`Sound`");
static PyObject *
Sound_accumulate(Sound* self, PyObject* args)
@@ -677,19 +681,19 @@ Sound_accumulate(Sound* self, PyObject* args)
}
PyDoc_STRVAR(M_aud_Sound_ADSR_doc,
"ADSR(attack,decay,sustain,release)\n\n"
"Attack-Decay-Sustain-Release envelopes the volume of a sound. "
"Note: there is currently no way to trigger the release with this API.\n\n"
":arg attack: The attack time in seconds.\n"
":type attack: float\n"
":arg decay: The decay time in seconds.\n"
":type decay: float\n"
":arg sustain: The sustain level.\n"
":type sustain: float\n"
":arg release: The release level.\n"
":type release: float\n"
":return: The created :class:`Sound` object.\n"
":rtype: :class:`Sound`");
".. classmethod:: ADSR(attack, decay, sustain, release)\n\n"
" Attack-Decay-Sustain-Release envelopes the volume of a sound.\n"
" Note: there is currently no way to trigger the release with this API.\n\n"
" :arg attack: The attack time in seconds.\n"
" :type attack: float\n"
" :arg decay: The decay time in seconds.\n"
" :type decay: float\n"
" :arg sustain: The sustain level.\n"
" :type sustain: float\n"
" :arg release: The release level.\n"
" :type release: float\n"
" :return: The created :class:`Sound` object.\n"
" :rtype: :class:`Sound`");
static PyObject *
Sound_ADSR(Sound* self, PyObject* args)
@@ -720,14 +724,12 @@ Sound_ADSR(Sound* self, PyObject* args)
}
PyDoc_STRVAR(M_aud_Sound_delay_doc,
"delay(time)\n\n"
"Delays by playing adding silence in front of the other sound's "
"data.\n\n"
":arg time: How many seconds of silence should be added before "
"the sound.\n"
":type time: float\n"
":return: The created :class:`Sound` object.\n"
":rtype: :class:`Sound`");
".. classmethod:: delay(time)\n\n"
" Delays by playing adding silence in front of the other sound's data.\n\n"
" :arg time: How many seconds of silence should be added before the sound.\n"
" :type time: float\n"
" :return: The created :class:`Sound` object.\n"
" :rtype: :class:`Sound`");
static PyObject *
Sound_delay(Sound* self, PyObject* args)
@@ -758,19 +760,18 @@ Sound_delay(Sound* self, PyObject* args)
}
PyDoc_STRVAR(M_aud_Sound_envelope_doc,
"envelope(attack, release, threshold, arthreshold)\n\n"
"Delays by playing adding silence in front of the other sound's "
"data.\n\n"
":arg attack: The attack factor.\n"
":type attack: float\n"
":arg release: The release factor.\n"
":type release: float\n"
":arg threshold: The general threshold value.\n"
":type threshold: float\n"
":arg arthreshold: The attack/release threshold value.\n"
":type arthreshold: float\n"
":return: The created :class:`Sound` object.\n"
":rtype: :class:`Sound`");
".. classmethod:: envelope(attack, release, threshold, arthreshold)\n\n"
" Delays by playing adding silence in front of the other sound's data.\n\n"
" :arg attack: The attack factor.\n"
" :type attack: float\n"
" :arg release: The release factor.\n"
" :type release: float\n"
" :arg threshold: The general threshold value.\n"
" :type threshold: float\n"
" :arg arthreshold: The attack/release threshold value.\n"
" :type arthreshold: float\n"
" :return: The created :class:`Sound` object.\n"
" :rtype: :class:`Sound`");
static PyObject *
Sound_envelope(Sound* self, PyObject* args)
@@ -801,16 +802,16 @@ Sound_envelope(Sound* self, PyObject* args)
}
PyDoc_STRVAR(M_aud_Sound_fadein_doc,
"fadein(start, length)\n\n"
"Fades a sound in by raising the volume linearly in the given "
"time interval.\n\n"
":arg start: Time in seconds when the fading should start.\n"
":type start: float\n"
":arg length: Time in seconds how long the fading should last.\n"
":type length: float\n"
":return: The created :class:`Sound` object.\n"
":rtype: :class:`Sound`\n\n"
".. note:: Before the fade starts it plays silence.");
".. classmethod:: fadein(start, length)\n\n"
" Fades a sound in by raising the volume linearly in the given\n"
" time interval.\n\n"
" :arg start: Time in seconds when the fading should start.\n"
" :type start: float\n"
" :arg length: Time in seconds how long the fading should last.\n"
" :type length: float\n"
" :return: The created :class:`Sound` object.\n"
" :rtype: :class:`Sound`\n\n"
" .. note:: Before the fade starts it plays silence.");
static PyObject *
Sound_fadein(Sound* self, PyObject* args)
@@ -841,17 +842,18 @@ Sound_fadein(Sound* self, PyObject* args)
}
PyDoc_STRVAR(M_aud_Sound_fadeout_doc,
"fadeout(start, length)\n\n"
"Fades a sound in by lowering the volume linearly in the given "
"time interval.\n\n"
":arg start: Time in seconds when the fading should start.\n"
":type start: float\n"
":arg length: Time in seconds how long the fading should last.\n"
":type length: float\n"
":return: The created :class:`Sound` object.\n"
":rtype: :class:`Sound`\n\n"
".. note:: After the fade this sound plays silence, so that "
"the length of the sound is not altered.");
".. classmethod:: fadeout(start, length)\n\n"
" Fades a sound in by lowering the volume linearly in the given\n"
" time interval.\n\n"
" :arg start: Time in seconds when the fading should start.\n"
" :type start: float\n"
" :arg length: Time in seconds how long the fading should last.\n"
" :type length: float\n"
" :return: The created :class:`Sound` object.\n"
" :rtype: :class:`Sound`\n\n"
" .. note::\n\n"
" After the fade this sound plays silence, so that\n"
" the length of the sound is not altered.");
static PyObject *
Sound_fadeout(Sound* self, PyObject* args)
@@ -882,20 +884,20 @@ Sound_fadeout(Sound* self, PyObject* args)
}
PyDoc_STRVAR(M_aud_Sound_filter_doc,
"filter(b, a = (1))\n\n"
"Filters a sound with the supplied IIR filter coefficients.\n"
"Without the second parameter you'll get a FIR filter.\n"
"If the first value of the a sequence is 0 it will be set to 1 "
"automatically.\n"
"If the first value of the a sequence is neither 0 nor 1, all "
"filter coefficients will be scaled by this value so that it is 1 "
"in the end, you don't have to scale yourself.\n\n"
":arg b: The nominator filter coefficients.\n"
":type b: sequence of float\n"
":arg a: The denominator filter coefficients.\n"
":type a: sequence of float\n"
":return: The created :class:`Sound` object.\n"
":rtype: :class:`Sound`");
".. classmethod:: filter(b, a = (1))\n\n"
" Filters a sound with the supplied IIR filter coefficients.\n"
" Without the second parameter you'll get a FIR filter.\n\n"
" If the first value of the a sequence is 0,\n"
" it will be set to 1 automatically.\n"
" If the first value of the a sequence is neither 0 nor 1, all\n"
" filter coefficients will be scaled by this value so that it is 1\n"
" in the end, you don't have to scale yourself.\n\n"
" :arg b: The nominator filter coefficients.\n"
" :type b: sequence of float\n"
" :arg a: The denominator filter coefficients.\n"
" :type a: sequence of float\n"
" :return: The created :class:`Sound` object.\n"
" :rtype: :class:`Sound`");
static PyObject *
Sound_filter(Sound* self, PyObject* args)
@@ -982,15 +984,15 @@ Sound_filter(Sound* self, PyObject* args)
}
PyDoc_STRVAR(M_aud_Sound_highpass_doc,
"highpass(frequency, Q=0.5)\n\n"
"Creates a second order highpass filter based on the transfer "
"function H(s) = s^2 / (s^2 + s/Q + 1)\n\n"
":arg frequency: The cut off trequency of the highpass.\n"
":type frequency: float\n"
":arg Q: Q factor of the lowpass.\n"
":type Q: float\n"
":return: The created :class:`Sound` object.\n"
":rtype: :class:`Sound`");
".. classmethod:: highpass(frequency, Q=0.5)\n\n"
" Creates a second order highpass filter based on the transfer\n"
" function :math:`H(s) = s^2 / (s^2 + s/Q + 1)`\n\n"
" :arg frequency: The cut off trequency of the highpass.\n"
" :type frequency: float\n"
" :arg Q: Q factor of the lowpass.\n"
" :type Q: float\n"
" :return: The created :class:`Sound` object.\n"
" :rtype: :class:`Sound`");
static PyObject *
Sound_highpass(Sound* self, PyObject* args)
@@ -1022,14 +1024,14 @@ Sound_highpass(Sound* self, PyObject* args)
}
PyDoc_STRVAR(M_aud_Sound_limit_doc,
"limit(start, end)\n\n"
"Limits a sound within a specific start and end time.\n\n"
":arg start: Start time in seconds.\n"
":type start: float\n"
":arg end: End time in seconds.\n"
":type end: float\n"
":return: The created :class:`Sound` object.\n"
":rtype: :class:`Sound`");
".. classmethod:: limit(start, end)\n\n"
" Limits a sound within a specific start and end time.\n\n"
" :arg start: Start time in seconds.\n"
" :type start: float\n"
" :arg end: End time in seconds.\n"
" :type end: float\n"
" :return: The created :class:`Sound` object.\n"
" :rtype: :class:`Sound`");
static PyObject *
Sound_limit(Sound* self, PyObject* args)
@@ -1060,15 +1062,16 @@ Sound_limit(Sound* self, PyObject* args)
}
PyDoc_STRVAR(M_aud_Sound_loop_doc,
"loop(count)\n\n"
"Loops a sound.\n\n"
":arg count: How often the sound should be looped. "
"Negative values mean endlessly.\n"
":type count: integer\n"
":return: The created :class:`Sound` object.\n"
":rtype: :class:`Sound`\n\n"
".. note:: This is a filter function, you might consider using "
":attr:`Handle.loop_count` instead.");
".. classmethod:: loop(count)\n\n"
" Loops a sound.\n\n"
" :arg count: How often the sound should be looped.\n"
" Negative values mean endlessly.\n"
" :type count: integer\n"
" :return: The created :class:`Sound` object.\n"
" :rtype: :class:`Sound`\n\n"
" .. note::\n\n"
" This is a filter function, you might consider using\n"
" :attr:`Handle.loop_count` instead.");
static PyObject *
Sound_loop(Sound* self, PyObject* args)
@@ -1099,15 +1102,15 @@ Sound_loop(Sound* self, PyObject* args)
}
PyDoc_STRVAR(M_aud_Sound_lowpass_doc,
"lowpass(frequency, Q=0.5)\n\n"
"Creates a second order lowpass filter based on the transfer "
"function H(s) = 1 / (s^2 + s/Q + 1)\n\n"
":arg frequency: The cut off trequency of the lowpass.\n"
":type frequency: float\n"
":arg Q: Q factor of the lowpass.\n"
":type Q: float\n"
":return: The created :class:`Sound` object.\n"
":rtype: :class:`Sound`");
".. classmethod:: lowpass(frequency, Q=0.5)\n\n"
" Creates a second order lowpass filter based on the transfer "
" function :math:`H(s) = 1 / (s^2 + s/Q + 1)`\n\n"
" :arg frequency: The cut off trequency of the lowpass.\n"
" :type frequency: float\n"
" :arg Q: Q factor of the lowpass.\n"
" :type Q: float\n"
" :return: The created :class:`Sound` object.\n"
" :rtype: :class:`Sound`");
static PyObject *
Sound_lowpass(Sound* self, PyObject* args)
@@ -1139,14 +1142,15 @@ Sound_lowpass(Sound* self, PyObject* args)
}
PyDoc_STRVAR(M_aud_Sound_modulate_doc,
"modulate(sound)\n\n"
"Modulates two factories.\n\n"
":arg sound: The sound to modulate over the other.\n"
":type sound: :class:`Sound`\n"
":return: The created :class:`Sound` object.\n"
":rtype: :class:`Sound`\n\n"
".. note:: The two factories have to have the same specifications "
"(channels and samplerate).");
".. classmethod:: modulate(sound)\n\n"
" Modulates two factories.\n\n"
" :arg sound: The sound to modulate over the other.\n"
" :type sound: :class:`Sound`\n"
" :return: The created :class:`Sound` object.\n"
" :rtype: :class:`Sound`\n\n"
" .. note::\n\n"
" The two factories have to have the same specifications\n"
" (channels and samplerate).");
static PyObject *
Sound_modulate(Sound* self, PyObject* object)
@@ -1180,17 +1184,19 @@ Sound_modulate(Sound* self, PyObject* object)
}
PyDoc_STRVAR(M_aud_Sound_pitch_doc,
"pitch(factor)\n\n"
"Changes the pitch of a sound with a specific factor.\n\n"
":arg factor: The factor to change the pitch with.\n"
":type factor: float\n"
":return: The created :class:`Sound` object.\n"
":rtype: :class:`Sound`\n\n"
".. note:: This is done by changing the sample rate of the "
"underlying sound, which has to be an integer, so the factor "
"value rounded and the factor may not be 100 % accurate.\n\n"
".. note:: This is a filter function, you might consider using "
":attr:`Handle.pitch` instead.");
".. classmethod:: pitch(factor)\n\n"
" Changes the pitch of a sound with a specific factor.\n\n"
" :arg factor: The factor to change the pitch with.\n"
" :type factor: float\n"
" :return: The created :class:`Sound` object.\n"
" :rtype: :class:`Sound`\n\n"
" .. note::\n\n"
" This is done by changing the sample rate of the\n"
" underlying sound, which has to be an integer, so the factor\n"
" value rounded and the factor may not be 100 % accurate.\n\n"
" .. note::\n\n"
" This is a filter function, you might consider using\n"
" :attr:`Handle.pitch` instead.");
static PyObject *
Sound_pitch(Sound* self, PyObject* args)
@@ -1221,12 +1227,12 @@ Sound_pitch(Sound* self, PyObject* args)
}
PyDoc_STRVAR(M_aud_Sound_rechannel_doc,
"rechannel(channels)\n\n"
"Rechannels the sound.\n\n"
":arg channels: The new channel configuration.\n"
":type channels: int\n"
":return: The created :class:`Sound` object.\n"
":rtype: :class:`Sound`");
".. classmethod:: rechannel(channels)\n\n"
" Rechannels the sound.\n\n"
" :arg channels: The new channel configuration.\n"
" :type channels: int\n"
" :return: The created :class:`Sound` object.\n"
" :rtype: :class:`Sound`");
static PyObject *
Sound_rechannel(Sound* self, PyObject* args)
@@ -1261,14 +1267,14 @@ Sound_rechannel(Sound* self, PyObject* args)
}
PyDoc_STRVAR(M_aud_Sound_resample_doc,
"resample(rate, high_quality)\n\n"
"Resamples the sound.\n\n"
":arg rate: The new sample rate.\n"
":type rate: double\n"
":arg high_quality: When true use a higher quality but slower resampler.\n"
":type high_quality: bool\n"
":return: The created :class:`Sound` object.\n"
":rtype: :class:`Sound`");
".. classmethod:: resample(rate, high_quality)\n\n"
" Resamples the sound.\n\n"
" :arg rate: The new sample rate.\n"
" :type rate: double\n"
" :arg high_quality: When true use a higher quality but slower resampler.\n"
" :type high_quality: bool\n"
" :return: The created :class:`Sound` object.\n"
" :rtype: :class:`Sound`");
static PyObject *
Sound_resample(Sound* self, PyObject* args)
@@ -1316,17 +1322,19 @@ Sound_resample(Sound* self, PyObject* args)
}
PyDoc_STRVAR(M_aud_Sound_reverse_doc,
"reverse()\n\n"
"Plays a sound reversed.\n\n"
":return: The created :class:`Sound` object.\n"
":rtype: :class:`Sound`\n\n"
".. note:: The sound has to have a finite length and has to be "
"seekable. It's recommended to use this only with factories with "
"fast and accurate seeking, which is not true for encoded audio "
"files, such ones should be buffered using :meth:`cache` before "
"being played reversed.\n\n"
".. warning:: If seeking is not accurate in the underlying sound "
"you'll likely hear skips/jumps/cracks.");
".. classmethod:: reverse()\n\n"
" Plays a sound reversed.\n\n"
" :return: The created :class:`Sound` object.\n"
" :rtype: :class:`Sound`\n\n"
" .. note::\n\n"
" The sound has to have a finite length and has to be seekable.\n"
" It's recommended to use this only with factories with\n"
" fast and accurate seeking, which is not true for encoded audio\n"
" files, such ones should be buffered using :meth:`cache` before\n"
" being played reversed.\n\n"
" .. warning::\n\n"
" If seeking is not accurate in the underlying sound\n"
" you'll likely hear skips/jumps/cracks.");
static PyObject *
Sound_reverse(Sound* self)
@@ -1352,10 +1360,10 @@ Sound_reverse(Sound* self)
}
PyDoc_STRVAR(M_aud_Sound_sum_doc,
"sum()\n\n"
"Sums the samples of a sound.\n\n"
":return: The created :class:`Sound` object.\n"
":rtype: :class:`Sound`");
".. classmethod:: sum()\n\n"
" Sums the samples of a sound.\n\n"
" :return: The created :class:`Sound` object.\n"
" :rtype: :class:`Sound`");
static PyObject *
Sound_sum(Sound* self)
@@ -1381,12 +1389,12 @@ Sound_sum(Sound* self)
}
PyDoc_STRVAR(M_aud_Sound_threshold_doc,
"threshold(threshold = 0)\n\n"
"Makes a threshold wave out of an audio wave by setting all samples "
"with a amplitude >= threshold to 1, all <= -threshold to -1 and "
"all between to 0.\n\n"
":arg threshold: Threshold value over which an amplitude counts "
"non-zero.\n"
".. classmethod:: threshold(threshold = 0)\n\n"
" Makes a threshold wave out of an audio wave by setting all samples\n"
" with a amplitude >= threshold to 1, all <= -threshold to -1 and\n"
" all between to 0.\n\n"
" :arg threshold: Threshold value over which an amplitude counts\n"
" non-zero.\n"
":type threshold: float\n"
":return: The created :class:`Sound` object.\n"
":rtype: :class:`Sound`");
@@ -1420,15 +1428,16 @@ Sound_threshold(Sound* self, PyObject* args)
}
PyDoc_STRVAR(M_aud_Sound_volume_doc,
"volume(volume)\n\n"
"Changes the volume of a sound.\n\n"
":arg volume: The new volume..\n"
":type volume: float\n"
":return: The created :class:`Sound` object.\n"
":rtype: :class:`Sound`\n\n"
".. note:: Should be in the range [0, 1] to avoid clipping.\n\n"
".. note:: This is a filter function, you might consider using "
":attr:`Handle.volume` instead.");
".. classmethod:: volume(volume)\n\n"
" Changes the volume of a sound.\n\n"
" :arg volume: The new volume..\n"
" :type volume: float\n"
" :return: The created :class:`Sound` object.\n"
" :rtype: :class:`Sound`\n\n"
" .. note:: Should be in the range [0, 1] to avoid clipping.\n\n"
" .. note::\n\n"
" This is a filter function, you might consider using\n"
" :attr:`Handle.volume` instead.");
static PyObject *
Sound_volume(Sound* self, PyObject* args)
@@ -1459,14 +1468,15 @@ Sound_volume(Sound* self, PyObject* args)
}
PyDoc_STRVAR(M_aud_Sound_join_doc,
"join(sound)\n\n"
"Plays two factories in sequence.\n\n"
":arg sound: The sound to play second.\n"
":type sound: :class:`Sound`\n"
":return: The created :class:`Sound` object.\n"
":rtype: :class:`Sound`\n\n"
".. note:: The two factories have to have the same specifications "
"(channels and samplerate).");
".. classmethod:: join(sound)\n\n"
" Plays two factories in sequence.\n\n"
" :arg sound: The sound to play second.\n"
" :type sound: :class:`Sound`\n"
" :return: The created :class:`Sound` object.\n"
" :rtype: :class:`Sound`\n\n"
" .. note::\n\n"
" The two factories have to have the same specifications\n"
" (channels and samplerate).");
static PyObject *
Sound_join(Sound* self, PyObject* object)
@@ -1501,14 +1511,15 @@ Sound_join(Sound* self, PyObject* object)
}
PyDoc_STRVAR(M_aud_Sound_mix_doc,
"mix(sound)\n\n"
"Mixes two factories.\n\n"
":arg sound: The sound to mix over the other.\n"
":type sound: :class:`Sound`\n"
":return: The created :class:`Sound` object.\n"
":rtype: :class:`Sound`\n\n"
".. note:: The two factories have to have the same specifications "
"(channels and samplerate).");
".. classmethod:: mix(sound)\n\n"
" Mixes two factories.\n\n"
" :arg sound: The sound to mix over the other.\n"
" :type sound: :class:`Sound`\n"
" :return: The created :class:`Sound` object.\n"
" :rtype: :class:`Sound`\n\n"
" .. note::\n\n"
" The two factories have to have the same specifications\n"
" (channels and samplerate).");
static PyObject *
Sound_mix(Sound* self, PyObject* object)
@@ -1542,11 +1553,11 @@ Sound_mix(Sound* self, PyObject* object)
}
PyDoc_STRVAR(M_aud_Sound_pingpong_doc,
"pingpong()\n\n"
"Plays a sound forward and then backward.\n"
"This is like joining a sound with its reverse.\n\n"
":return: The created :class:`Sound` object.\n"
":rtype: :class:`Sound`");
".. classmethod:: pingpong()\n\n"
" Plays a sound forward and then backward.\n"
" This is like joining a sound with its reverse.\n\n"
" :return: The created :class:`Sound` object.\n"
" :rtype: :class:`Sound`");
static PyObject *
Sound_pingpong(Sound* self)
@@ -1572,12 +1583,12 @@ Sound_pingpong(Sound* self)
}
PyDoc_STRVAR(M_aud_Sound_list_doc,
"list()\n\n"
"Creates an empty sound list that can contain several sounds.\n\n"
":arg random: wether the playback will be random or not.\n"
":type random: int\n"
":return: The created :class:`Sound` object.\n"
":rtype: :class:`Sound`");
".. classmethod:: list()\n\n"
" Creates an empty sound list that can contain several sounds.\n\n"
" :arg random: whether the playback will be random or not.\n"
" :type random: int\n"
" :return: The created :class:`Sound` object.\n"
" :rtype: :class:`Sound`");
static PyObject *
Sound_list(PyTypeObject* type, PyObject* args)
@@ -1608,11 +1619,11 @@ Sound_list(PyTypeObject* type, PyObject* args)
}
PyDoc_STRVAR(M_aud_Sound_mutable_doc,
"mutable()\n\n"
"Creates a sound that will be restarted when sought backwards.\n"
"If the original sound is a sound list, the playing sound can change.\n\n"
":return: The created :class:`Sound` object.\n"
":rtype: :class:`Sound`");
".. classmethod:: mutable()\n\n"
" Creates a sound that will be restarted when sought backwards.\n"
" If the original sound is a sound list, the playing sound can change.\n\n"
" :return: The created :class:`Sound` object.\n"
" :rtype: :class:`Sound`");
static PyObject *
Sound_mutable(Sound* self)
@@ -1638,12 +1649,12 @@ Sound_mutable(Sound* self)
}
PyDoc_STRVAR(M_aud_Sound_list_addSound_doc,
"addSound(sound)\n\n"
"Adds a new sound to a sound list.\n\n"
":arg sound: The sound that will be added to the list.\n"
":type sound: :class:`Sound`\n\n"
".. note:: You can only add a sound to a sound list.");
".. classmethod:: addSound(sound)\n\n"
" Adds a new sound to a sound list.\n\n"
" :arg sound: The sound that will be added to the list.\n"
" :type sound: :class:`Sound`\n\n"
" .. note:: You can only add a sound to a sound list.");
static PyObject *
Sound_list_addSound(Sound* self, PyObject* object)
{
@@ -1671,14 +1682,14 @@ Sound_list_addSound(Sound* self, PyObject* object)
#ifdef WITH_CONVOLUTION
PyDoc_STRVAR(M_aud_Sound_convolver_doc,
"convolver()\n\n"
"Creates a sound that will apply convolution to another sound.\n\n"
":arg impulseResponse: The filter with which convolve the sound.\n"
":type impulseResponse: :class:`ImpulseResponse`\n"
":arg threadPool: A thread pool used to parallelize convolution.\n"
":type threadPool: :class:`ThreadPool`\n"
":return: The created :class:`Sound` object.\n"
":rtype: :class:`Sound`");
".. classmethod:: convolver()\n\n"
" Creates a sound that will apply convolution to another sound.\n\n"
" :arg impulseResponse: The filter with which convolve the sound.\n"
" :type impulseResponse: :class:`ImpulseResponse`\n"
" :arg threadPool: A thread pool used to parallelize convolution.\n"
" :type threadPool: :class:`ThreadPool`\n"
" :return: The created :class:`Sound` object.\n"
" :rtype: :class:`Sound`");
static PyObject *
Sound_convolver(Sound* self, PyObject* args)
@@ -1720,16 +1731,16 @@ Sound_convolver(Sound* self, PyObject* args)
}
PyDoc_STRVAR(M_aud_Sound_binaural_doc,
"convolver()\n\n"
"Creates a binaural sound using another sound as source. The original sound must be mono\n\n"
":arg hrtfs: An HRTF set.\n"
":type hrtf: :class:`HRTF`\n"
":arg source: An object representing the source position of the sound.\n"
":type source: :class:`Source`\n"
":arg threadPool: A thread pool used to parallelize convolution.\n"
":type threadPool: :class:`ThreadPool`\n"
":return: The created :class:`Sound` object.\n"
":rtype: :class:`Sound`");
".. classmethod:: convolver()\n\n"
" Creates a binaural sound using another sound as source. The original sound must be mono\n\n"
" :arg hrtfs: An HRTF set.\n"
" :type hrtf: :class:`HRTF`\n"
" :arg source: An object representing the source position of the sound.\n"
" :type source: :class:`Source`\n"
" :arg threadPool: A thread pool used to parallelize convolution.\n"
" :type threadPool: :class:`ThreadPool`\n"
" :return: The created :class:`Sound` object.\n"
" :rtype: :class:`Sound`");
static PyObject *
Sound_binaural(Sound* self, PyObject* args)

View File

@@ -415,4 +415,11 @@ if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive")
endif()
if(MSVC)
# bullet is responsible for quite a few silly warnings
# suppress all of them. Not great, but they really needed
# to sort that out themselves.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W0")
endif()
blender_add_lib(extern_bullet "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")

View File

@@ -77,6 +77,11 @@ if(WIN32)
list(APPEND INC
src/windows
)
if(MSVC)
# Suppress warning about google::LogMessageFatal::~LogMessageFatal
# not returning.
add_definitions("/wd4722")
endif()
else()
list(APPEND INC
include

View File

@@ -71,7 +71,7 @@ rm $BLENDER_INSTALLATION/blender/tmp/preprocessed/fileio/*.reg
cd $BLENDER_INSTALLATION/blender/tmp/
echo "Applying clang format to Mantaflow source files"
find . -iname *.h -o -iname *.cpp | xargs clang-format --verbose -i -style=file
find . -iname *.h -o -iname *.cpp | xargs clang-format --verbose -i -style=file -sort-includes=0
find . -iname *.h -o -iname *.cpp | xargs dos2unix --verbose
# ==================== 5) MOVE MANTAFLOW FILES TO EXTERN/ ================================

View File

@@ -192,7 +192,7 @@ int cbDisableConstructor(PyObject *self, PyObject *args, PyObject *kwds)
return -1;
}
PyMODINIT_FUNC PyInit_Main(void)
PyMODINIT_FUNC PyInit_manta_main(void)
{
MantaEnsureRegistration();
#if PY_MAJOR_VERSION >= 3
@@ -567,7 +567,7 @@ void WrapperRegistry::construct(const string &scriptname, const vector<string> &
registerDummyTypes();
// work around for certain gcc versions, cast to char*
PyImport_AppendInittab((char *)gDefaultModuleName.c_str(), PyInit_Main);
PyImport_AppendInittab((char *)gDefaultModuleName.c_str(), PyInit_manta_main);
}
inline PyObject *castPy(PyTypeObject *p)

View File

@@ -62,7 +62,7 @@ void MantaEnsureRegistration();
#ifdef BLENDER
# ifdef PyMODINIT_FUNC
PyMODINIT_FUNC PyInit_Main(void);
PyMODINIT_FUNC PyInit_manta_main(void);
# endif
#endif

View File

@@ -15,7 +15,7 @@
#define _VECTORBASE_H
// get rid of windos min/max defines
#if defined(WIN32) || defined(_WIN32)
#if (defined(WIN32) || defined(_WIN32)) && !defined(NOMINMAX)
# define NOMINMAX
#endif

View File

@@ -1,3 +1,3 @@
#define MANTA_GIT_VERSION "commit 1d55979473c25318f39c4a6bf48a5ab77b3bf39b"
#define MANTA_GIT_VERSION "commit 21303fab2eda588ec22988bf9e5762d2001c131f"

View File

@@ -853,6 +853,147 @@ template<class T> struct knPermuteAxes : public KernelBase {
int axis2;
};
struct knJoinVec : public KernelBase {
knJoinVec(Grid<Vec3> &a, const Grid<Vec3> &b, bool keepMax)
: KernelBase(&a, 0), a(a), b(b), keepMax(keepMax)
{
runMessage();
run();
}
inline void op(IndexInt idx, Grid<Vec3> &a, const Grid<Vec3> &b, bool keepMax) const
{
Real a1 = normSquare(a[idx]);
Real b1 = normSquare(b[idx]);
a[idx] = (keepMax) ? max(a1, b1) : min(a1, b1);
}
inline Grid<Vec3> &getArg0()
{
return a;
}
typedef Grid<Vec3> type0;
inline const Grid<Vec3> &getArg1()
{
return b;
}
typedef Grid<Vec3> type1;
inline bool &getArg2()
{
return keepMax;
}
typedef bool type2;
void runMessage()
{
debMsg("Executing kernel knJoinVec ", 3);
debMsg("Kernel range"
<< " x " << maxX << " y " << maxY << " z " << minZ << " - " << maxZ << " ",
4);
};
void operator()(const tbb::blocked_range<IndexInt> &__r) const
{
for (IndexInt idx = __r.begin(); idx != (IndexInt)__r.end(); idx++)
op(idx, a, b, keepMax);
}
void run()
{
tbb::parallel_for(tbb::blocked_range<IndexInt>(0, size), *this);
}
Grid<Vec3> &a;
const Grid<Vec3> &b;
bool keepMax;
};
struct knJoinInt : public KernelBase {
knJoinInt(Grid<int> &a, const Grid<int> &b, bool keepMax)
: KernelBase(&a, 0), a(a), b(b), keepMax(keepMax)
{
runMessage();
run();
}
inline void op(IndexInt idx, Grid<int> &a, const Grid<int> &b, bool keepMax) const
{
a[idx] = (keepMax) ? max(a[idx], b[idx]) : min(a[idx], b[idx]);
}
inline Grid<int> &getArg0()
{
return a;
}
typedef Grid<int> type0;
inline const Grid<int> &getArg1()
{
return b;
}
typedef Grid<int> type1;
inline bool &getArg2()
{
return keepMax;
}
typedef bool type2;
void runMessage()
{
debMsg("Executing kernel knJoinInt ", 3);
debMsg("Kernel range"
<< " x " << maxX << " y " << maxY << " z " << minZ << " - " << maxZ << " ",
4);
};
void operator()(const tbb::blocked_range<IndexInt> &__r) const
{
for (IndexInt idx = __r.begin(); idx != (IndexInt)__r.end(); idx++)
op(idx, a, b, keepMax);
}
void run()
{
tbb::parallel_for(tbb::blocked_range<IndexInt>(0, size), *this);
}
Grid<int> &a;
const Grid<int> &b;
bool keepMax;
};
struct knJoinReal : public KernelBase {
knJoinReal(Grid<Real> &a, const Grid<Real> &b, bool keepMax)
: KernelBase(&a, 0), a(a), b(b), keepMax(keepMax)
{
runMessage();
run();
}
inline void op(IndexInt idx, Grid<Real> &a, const Grid<Real> &b, bool keepMax) const
{
a[idx] = (keepMax) ? max(a[idx], b[idx]) : min(a[idx], b[idx]);
}
inline Grid<Real> &getArg0()
{
return a;
}
typedef Grid<Real> type0;
inline const Grid<Real> &getArg1()
{
return b;
}
typedef Grid<Real> type1;
inline bool &getArg2()
{
return keepMax;
}
typedef bool type2;
void runMessage()
{
debMsg("Executing kernel knJoinReal ", 3);
debMsg("Kernel range"
<< " x " << maxX << " y " << maxY << " z " << minZ << " - " << maxZ << " ",
4);
};
void operator()(const tbb::blocked_range<IndexInt> &__r) const
{
for (IndexInt idx = __r.begin(); idx != (IndexInt)__r.end(); idx++)
op(idx, a, b, keepMax);
}
void run()
{
tbb::parallel_for(tbb::blocked_range<IndexInt>(0, size), *this);
}
Grid<Real> &a;
const Grid<Real> &b;
bool keepMax;
};
template<class T> Grid<T> &Grid<T>::safeDivide(const Grid<T> &a)
{
knGridSafeDiv<T>(*this, a);
@@ -928,6 +1069,18 @@ void Grid<T>::permuteAxesCopyToGrid(int axis0, int axis1, int axis2, Grid<T> &ou
"Permuted grids must have the same dimensions!");
knPermuteAxes<T>(*this, out, axis0, axis1, axis2);
}
template<> void Grid<Vec3>::join(const Grid<Vec3> &a, bool keepMax)
{
knJoinVec(*this, a, keepMax);
}
template<> void Grid<int>::join(const Grid<int> &a, bool keepMax)
{
knJoinInt(*this, a, keepMax);
}
template<> void Grid<Real>::join(const Grid<Real> &a, bool keepMax)
{
knJoinReal(*this, a, keepMax);
}
template<> Real Grid<Real>::getMax() const
{

View File

@@ -966,10 +966,38 @@ template<class T> class Grid : public GridBase {
}
}
//! join other grid by either keeping min or max value at cell
void join(const Grid<T> &a, bool keepMax = true);
static PyObject *_W_27(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
try {
PbArgs _args(_linargs, _kwds);
Grid *pbo = dynamic_cast<Grid *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Grid::join", !noTiming);
PyObject *_retval = 0;
{
ArgLocker _lock;
const Grid<T> &a = *_args.getPtr<Grid<T>>("a", 0, &_lock);
bool keepMax = _args.getOpt<bool>("keepMax", 1, true, &_lock);
pbo->_args.copy(_args);
_retval = getPyNone();
pbo->join(a, keepMax);
pbo->_args.check();
}
pbFinalizePlugin(pbo->getParent(), "Grid::join", !noTiming);
return _retval;
}
catch (std::exception &e) {
pbSetError("Grid::join", e.what());
return 0;
}
}
// common compound operators
//! get absolute max value in grid
Real getMaxAbs() const;
static PyObject *_W_27(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
static PyObject *_W_28(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
try {
PbArgs _args(_linargs, _kwds);
@@ -994,7 +1022,7 @@ template<class T> class Grid : public GridBase {
//! get max value in grid
Real getMax() const;
static PyObject *_W_28(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
static PyObject *_W_29(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
try {
PbArgs _args(_linargs, _kwds);
@@ -1019,7 +1047,7 @@ template<class T> class Grid : public GridBase {
//! get min value in grid
Real getMin() const;
static PyObject *_W_29(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
static PyObject *_W_30(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
try {
PbArgs _args(_linargs, _kwds);
@@ -1044,7 +1072,7 @@ template<class T> class Grid : public GridBase {
//! calculate L1 norm of grid content
Real getL1(int bnd = 0);
static PyObject *_W_30(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
static PyObject *_W_31(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
try {
PbArgs _args(_linargs, _kwds);
@@ -1070,7 +1098,7 @@ template<class T> class Grid : public GridBase {
//! calculate L2 norm of grid content
Real getL2(int bnd = 0);
static PyObject *_W_31(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
static PyObject *_W_32(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
try {
PbArgs _args(_linargs, _kwds);
@@ -1096,7 +1124,7 @@ template<class T> class Grid : public GridBase {
//! set all boundary cells to constant value (Dirichlet)
void setBound(T value, int boundaryWidth = 1);
static PyObject *_W_32(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
static PyObject *_W_33(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
try {
PbArgs _args(_linargs, _kwds);
@@ -1124,7 +1152,7 @@ template<class T> class Grid : public GridBase {
//! set all boundary cells to last inner value (Neumann)
void setBoundNeumann(int boundaryWidth = 1);
static PyObject *_W_33(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
static PyObject *_W_34(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
try {
PbArgs _args(_linargs, _kwds);
@@ -1151,7 +1179,7 @@ template<class T> class Grid : public GridBase {
//! get data pointer of grid
std::string getDataPointer();
static PyObject *_W_34(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
static PyObject *_W_35(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
try {
PbArgs _args(_linargs, _kwds);
@@ -1176,7 +1204,7 @@ template<class T> class Grid : public GridBase {
//! debugging helper, print grid from python. skip boundary of width bnd
void printGrid(int zSlice = -1, bool printIndex = false, int bnd = 1);
static PyObject *_W_35(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
static PyObject *_W_36(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
try {
PbArgs _args(_linargs, _kwds);
@@ -1244,7 +1272,7 @@ class MACGrid : public Grid<Vec3> {
{
mType = (GridType)(TypeMAC | TypeVec3);
}
static int _W_36(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
static int _W_37(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
PbClass *obj = Pb::objFromPy(_self);
if (obj)
@@ -1326,7 +1354,7 @@ class MACGrid : public Grid<Vec3> {
//! set all boundary cells of a MAC grid to certain value (Dirchlet). Respects staggered grid
//! locations optionally, only set normal components
void setBoundMAC(Vec3 value, int boundaryWidth, bool normalOnly = false);
static PyObject *_W_37(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
static PyObject *_W_38(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
try {
PbArgs _args(_linargs, _kwds);
@@ -1367,7 +1395,7 @@ class FlagGrid : public Grid<int> {
{
mType = (GridType)(TypeFlags | TypeInt);
}
static int _W_38(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
static int _W_39(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
PbClass *obj = Pb::objFromPy(_self);
if (obj)
@@ -1547,7 +1575,7 @@ class FlagGrid : public Grid<int> {
const std::string &inflow = " ",
const std::string &outflow = " ",
Grid<Real> *phiWalls = 0x00);
static PyObject *_W_39(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
static PyObject *_W_40(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
try {
PbArgs _args(_linargs, _kwds);
@@ -1581,7 +1609,7 @@ class FlagGrid : public Grid<int> {
//! set fluid flags inside levelset (liquids)
void updateFromLevelset(LevelsetGrid &levelset);
static PyObject *_W_40(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
static PyObject *_W_41(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
try {
PbArgs _args(_linargs, _kwds);
@@ -1608,7 +1636,7 @@ class FlagGrid : public Grid<int> {
//! set all cells (except obs/in/outflow) to type (fluid by default)
void fillGrid(int type = TypeFluid);
static PyObject *_W_41(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
static PyObject *_W_42(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
try {
PbArgs _args(_linargs, _kwds);
@@ -1637,7 +1665,7 @@ class FlagGrid : public Grid<int> {
//! warning for large grids! only regular int returned (due to python interface)
//! optionally creates mask in RealGrid (1 where flag matches, 0 otherwise)
int countCells(int flag, int bnd = 0, Grid<Real> *mask = NULL);
static PyObject *_W_42(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
static PyObject *_W_43(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
try {
PbArgs _args(_linargs, _kwds);

View File

@@ -8,11 +8,11 @@ namespace Manta {
#ifdef _C_FlagGrid
static const Pb::Register _R_26("FlagGrid", "FlagGrid", "Grid<int>");
template<> const char *Namify<FlagGrid>::S = "FlagGrid";
static const Pb::Register _R_27("FlagGrid", "FlagGrid", FlagGrid::_W_38);
static const Pb::Register _R_28("FlagGrid", "initDomain", FlagGrid::_W_39);
static const Pb::Register _R_29("FlagGrid", "updateFromLevelset", FlagGrid::_W_40);
static const Pb::Register _R_30("FlagGrid", "fillGrid", FlagGrid::_W_41);
static const Pb::Register _R_31("FlagGrid", "countCells", FlagGrid::_W_42);
static const Pb::Register _R_27("FlagGrid", "FlagGrid", FlagGrid::_W_39);
static const Pb::Register _R_28("FlagGrid", "initDomain", FlagGrid::_W_40);
static const Pb::Register _R_29("FlagGrid", "updateFromLevelset", FlagGrid::_W_41);
static const Pb::Register _R_30("FlagGrid", "fillGrid", FlagGrid::_W_42);
static const Pb::Register _R_31("FlagGrid", "countCells", FlagGrid::_W_43);
#endif
#ifdef _C_Grid
static const Pb::Register _R_32("Grid<int>", "Grid<int>", "GridBase");
@@ -35,92 +35,95 @@ static const Pb::Register _R_47("Grid<int>", "clamp", Grid<int>::_W_23);
static const Pb::Register _R_48("Grid<int>", "stomp", Grid<int>::_W_24);
static const Pb::Register _R_49("Grid<int>", "permuteAxes", Grid<int>::_W_25);
static const Pb::Register _R_50("Grid<int>", "permuteAxesCopyToGrid", Grid<int>::_W_26);
static const Pb::Register _R_51("Grid<int>", "getMaxAbs", Grid<int>::_W_27);
static const Pb::Register _R_52("Grid<int>", "getMax", Grid<int>::_W_28);
static const Pb::Register _R_53("Grid<int>", "getMin", Grid<int>::_W_29);
static const Pb::Register _R_54("Grid<int>", "getL1", Grid<int>::_W_30);
static const Pb::Register _R_55("Grid<int>", "getL2", Grid<int>::_W_31);
static const Pb::Register _R_56("Grid<int>", "setBound", Grid<int>::_W_32);
static const Pb::Register _R_57("Grid<int>", "setBoundNeumann", Grid<int>::_W_33);
static const Pb::Register _R_58("Grid<int>", "getDataPointer", Grid<int>::_W_34);
static const Pb::Register _R_59("Grid<int>", "printGrid", Grid<int>::_W_35);
static const Pb::Register _R_60("Grid<Real>", "Grid<Real>", "GridBase");
static const Pb::Register _R_51("Grid<int>", "join", Grid<int>::_W_27);
static const Pb::Register _R_52("Grid<int>", "getMaxAbs", Grid<int>::_W_28);
static const Pb::Register _R_53("Grid<int>", "getMax", Grid<int>::_W_29);
static const Pb::Register _R_54("Grid<int>", "getMin", Grid<int>::_W_30);
static const Pb::Register _R_55("Grid<int>", "getL1", Grid<int>::_W_31);
static const Pb::Register _R_56("Grid<int>", "getL2", Grid<int>::_W_32);
static const Pb::Register _R_57("Grid<int>", "setBound", Grid<int>::_W_33);
static const Pb::Register _R_58("Grid<int>", "setBoundNeumann", Grid<int>::_W_34);
static const Pb::Register _R_59("Grid<int>", "getDataPointer", Grid<int>::_W_35);
static const Pb::Register _R_60("Grid<int>", "printGrid", Grid<int>::_W_36);
static const Pb::Register _R_61("Grid<Real>", "Grid<Real>", "GridBase");
template<> const char *Namify<Grid<Real>>::S = "Grid<Real>";
static const Pb::Register _R_61("Grid<Real>", "Grid", Grid<Real>::_W_9);
static const Pb::Register _R_62("Grid<Real>", "save", Grid<Real>::_W_10);
static const Pb::Register _R_63("Grid<Real>", "load", Grid<Real>::_W_11);
static const Pb::Register _R_64("Grid<Real>", "clear", Grid<Real>::_W_12);
static const Pb::Register _R_65("Grid<Real>", "copyFrom", Grid<Real>::_W_13);
static const Pb::Register _R_66("Grid<Real>", "getGridType", Grid<Real>::_W_14);
static const Pb::Register _R_67("Grid<Real>", "add", Grid<Real>::_W_15);
static const Pb::Register _R_68("Grid<Real>", "sub", Grid<Real>::_W_16);
static const Pb::Register _R_69("Grid<Real>", "setConst", Grid<Real>::_W_17);
static const Pb::Register _R_70("Grid<Real>", "addConst", Grid<Real>::_W_18);
static const Pb::Register _R_71("Grid<Real>", "addScaled", Grid<Real>::_W_19);
static const Pb::Register _R_72("Grid<Real>", "mult", Grid<Real>::_W_20);
static const Pb::Register _R_73("Grid<Real>", "multConst", Grid<Real>::_W_21);
static const Pb::Register _R_74("Grid<Real>", "safeDivide", Grid<Real>::_W_22);
static const Pb::Register _R_75("Grid<Real>", "clamp", Grid<Real>::_W_23);
static const Pb::Register _R_76("Grid<Real>", "stomp", Grid<Real>::_W_24);
static const Pb::Register _R_77("Grid<Real>", "permuteAxes", Grid<Real>::_W_25);
static const Pb::Register _R_78("Grid<Real>", "permuteAxesCopyToGrid", Grid<Real>::_W_26);
static const Pb::Register _R_79("Grid<Real>", "getMaxAbs", Grid<Real>::_W_27);
static const Pb::Register _R_80("Grid<Real>", "getMax", Grid<Real>::_W_28);
static const Pb::Register _R_81("Grid<Real>", "getMin", Grid<Real>::_W_29);
static const Pb::Register _R_82("Grid<Real>", "getL1", Grid<Real>::_W_30);
static const Pb::Register _R_83("Grid<Real>", "getL2", Grid<Real>::_W_31);
static const Pb::Register _R_84("Grid<Real>", "setBound", Grid<Real>::_W_32);
static const Pb::Register _R_85("Grid<Real>", "setBoundNeumann", Grid<Real>::_W_33);
static const Pb::Register _R_86("Grid<Real>", "getDataPointer", Grid<Real>::_W_34);
static const Pb::Register _R_87("Grid<Real>", "printGrid", Grid<Real>::_W_35);
static const Pb::Register _R_88("Grid<Vec3>", "Grid<Vec3>", "GridBase");
static const Pb::Register _R_62("Grid<Real>", "Grid", Grid<Real>::_W_9);
static const Pb::Register _R_63("Grid<Real>", "save", Grid<Real>::_W_10);
static const Pb::Register _R_64("Grid<Real>", "load", Grid<Real>::_W_11);
static const Pb::Register _R_65("Grid<Real>", "clear", Grid<Real>::_W_12);
static const Pb::Register _R_66("Grid<Real>", "copyFrom", Grid<Real>::_W_13);
static const Pb::Register _R_67("Grid<Real>", "getGridType", Grid<Real>::_W_14);
static const Pb::Register _R_68("Grid<Real>", "add", Grid<Real>::_W_15);
static const Pb::Register _R_69("Grid<Real>", "sub", Grid<Real>::_W_16);
static const Pb::Register _R_70("Grid<Real>", "setConst", Grid<Real>::_W_17);
static const Pb::Register _R_71("Grid<Real>", "addConst", Grid<Real>::_W_18);
static const Pb::Register _R_72("Grid<Real>", "addScaled", Grid<Real>::_W_19);
static const Pb::Register _R_73("Grid<Real>", "mult", Grid<Real>::_W_20);
static const Pb::Register _R_74("Grid<Real>", "multConst", Grid<Real>::_W_21);
static const Pb::Register _R_75("Grid<Real>", "safeDivide", Grid<Real>::_W_22);
static const Pb::Register _R_76("Grid<Real>", "clamp", Grid<Real>::_W_23);
static const Pb::Register _R_77("Grid<Real>", "stomp", Grid<Real>::_W_24);
static const Pb::Register _R_78("Grid<Real>", "permuteAxes", Grid<Real>::_W_25);
static const Pb::Register _R_79("Grid<Real>", "permuteAxesCopyToGrid", Grid<Real>::_W_26);
static const Pb::Register _R_80("Grid<Real>", "join", Grid<Real>::_W_27);
static const Pb::Register _R_81("Grid<Real>", "getMaxAbs", Grid<Real>::_W_28);
static const Pb::Register _R_82("Grid<Real>", "getMax", Grid<Real>::_W_29);
static const Pb::Register _R_83("Grid<Real>", "getMin", Grid<Real>::_W_30);
static const Pb::Register _R_84("Grid<Real>", "getL1", Grid<Real>::_W_31);
static const Pb::Register _R_85("Grid<Real>", "getL2", Grid<Real>::_W_32);
static const Pb::Register _R_86("Grid<Real>", "setBound", Grid<Real>::_W_33);
static const Pb::Register _R_87("Grid<Real>", "setBoundNeumann", Grid<Real>::_W_34);
static const Pb::Register _R_88("Grid<Real>", "getDataPointer", Grid<Real>::_W_35);
static const Pb::Register _R_89("Grid<Real>", "printGrid", Grid<Real>::_W_36);
static const Pb::Register _R_90("Grid<Vec3>", "Grid<Vec3>", "GridBase");
template<> const char *Namify<Grid<Vec3>>::S = "Grid<Vec3>";
static const Pb::Register _R_89("Grid<Vec3>", "Grid", Grid<Vec3>::_W_9);
static const Pb::Register _R_90("Grid<Vec3>", "save", Grid<Vec3>::_W_10);
static const Pb::Register _R_91("Grid<Vec3>", "load", Grid<Vec3>::_W_11);
static const Pb::Register _R_92("Grid<Vec3>", "clear", Grid<Vec3>::_W_12);
static const Pb::Register _R_93("Grid<Vec3>", "copyFrom", Grid<Vec3>::_W_13);
static const Pb::Register _R_94("Grid<Vec3>", "getGridType", Grid<Vec3>::_W_14);
static const Pb::Register _R_95("Grid<Vec3>", "add", Grid<Vec3>::_W_15);
static const Pb::Register _R_96("Grid<Vec3>", "sub", Grid<Vec3>::_W_16);
static const Pb::Register _R_97("Grid<Vec3>", "setConst", Grid<Vec3>::_W_17);
static const Pb::Register _R_98("Grid<Vec3>", "addConst", Grid<Vec3>::_W_18);
static const Pb::Register _R_99("Grid<Vec3>", "addScaled", Grid<Vec3>::_W_19);
static const Pb::Register _R_100("Grid<Vec3>", "mult", Grid<Vec3>::_W_20);
static const Pb::Register _R_101("Grid<Vec3>", "multConst", Grid<Vec3>::_W_21);
static const Pb::Register _R_102("Grid<Vec3>", "safeDivide", Grid<Vec3>::_W_22);
static const Pb::Register _R_103("Grid<Vec3>", "clamp", Grid<Vec3>::_W_23);
static const Pb::Register _R_104("Grid<Vec3>", "stomp", Grid<Vec3>::_W_24);
static const Pb::Register _R_105("Grid<Vec3>", "permuteAxes", Grid<Vec3>::_W_25);
static const Pb::Register _R_106("Grid<Vec3>", "permuteAxesCopyToGrid", Grid<Vec3>::_W_26);
static const Pb::Register _R_107("Grid<Vec3>", "getMaxAbs", Grid<Vec3>::_W_27);
static const Pb::Register _R_108("Grid<Vec3>", "getMax", Grid<Vec3>::_W_28);
static const Pb::Register _R_109("Grid<Vec3>", "getMin", Grid<Vec3>::_W_29);
static const Pb::Register _R_110("Grid<Vec3>", "getL1", Grid<Vec3>::_W_30);
static const Pb::Register _R_111("Grid<Vec3>", "getL2", Grid<Vec3>::_W_31);
static const Pb::Register _R_112("Grid<Vec3>", "setBound", Grid<Vec3>::_W_32);
static const Pb::Register _R_113("Grid<Vec3>", "setBoundNeumann", Grid<Vec3>::_W_33);
static const Pb::Register _R_114("Grid<Vec3>", "getDataPointer", Grid<Vec3>::_W_34);
static const Pb::Register _R_115("Grid<Vec3>", "printGrid", Grid<Vec3>::_W_35);
static const Pb::Register _R_91("Grid<Vec3>", "Grid", Grid<Vec3>::_W_9);
static const Pb::Register _R_92("Grid<Vec3>", "save", Grid<Vec3>::_W_10);
static const Pb::Register _R_93("Grid<Vec3>", "load", Grid<Vec3>::_W_11);
static const Pb::Register _R_94("Grid<Vec3>", "clear", Grid<Vec3>::_W_12);
static const Pb::Register _R_95("Grid<Vec3>", "copyFrom", Grid<Vec3>::_W_13);
static const Pb::Register _R_96("Grid<Vec3>", "getGridType", Grid<Vec3>::_W_14);
static const Pb::Register _R_97("Grid<Vec3>", "add", Grid<Vec3>::_W_15);
static const Pb::Register _R_98("Grid<Vec3>", "sub", Grid<Vec3>::_W_16);
static const Pb::Register _R_99("Grid<Vec3>", "setConst", Grid<Vec3>::_W_17);
static const Pb::Register _R_100("Grid<Vec3>", "addConst", Grid<Vec3>::_W_18);
static const Pb::Register _R_101("Grid<Vec3>", "addScaled", Grid<Vec3>::_W_19);
static const Pb::Register _R_102("Grid<Vec3>", "mult", Grid<Vec3>::_W_20);
static const Pb::Register _R_103("Grid<Vec3>", "multConst", Grid<Vec3>::_W_21);
static const Pb::Register _R_104("Grid<Vec3>", "safeDivide", Grid<Vec3>::_W_22);
static const Pb::Register _R_105("Grid<Vec3>", "clamp", Grid<Vec3>::_W_23);
static const Pb::Register _R_106("Grid<Vec3>", "stomp", Grid<Vec3>::_W_24);
static const Pb::Register _R_107("Grid<Vec3>", "permuteAxes", Grid<Vec3>::_W_25);
static const Pb::Register _R_108("Grid<Vec3>", "permuteAxesCopyToGrid", Grid<Vec3>::_W_26);
static const Pb::Register _R_109("Grid<Vec3>", "join", Grid<Vec3>::_W_27);
static const Pb::Register _R_110("Grid<Vec3>", "getMaxAbs", Grid<Vec3>::_W_28);
static const Pb::Register _R_111("Grid<Vec3>", "getMax", Grid<Vec3>::_W_29);
static const Pb::Register _R_112("Grid<Vec3>", "getMin", Grid<Vec3>::_W_30);
static const Pb::Register _R_113("Grid<Vec3>", "getL1", Grid<Vec3>::_W_31);
static const Pb::Register _R_114("Grid<Vec3>", "getL2", Grid<Vec3>::_W_32);
static const Pb::Register _R_115("Grid<Vec3>", "setBound", Grid<Vec3>::_W_33);
static const Pb::Register _R_116("Grid<Vec3>", "setBoundNeumann", Grid<Vec3>::_W_34);
static const Pb::Register _R_117("Grid<Vec3>", "getDataPointer", Grid<Vec3>::_W_35);
static const Pb::Register _R_118("Grid<Vec3>", "printGrid", Grid<Vec3>::_W_36);
#endif
#ifdef _C_GridBase
static const Pb::Register _R_116("GridBase", "GridBase", "PbClass");
static const Pb::Register _R_119("GridBase", "GridBase", "PbClass");
template<> const char *Namify<GridBase>::S = "GridBase";
static const Pb::Register _R_117("GridBase", "GridBase", GridBase::_W_0);
static const Pb::Register _R_118("GridBase", "getSizeX", GridBase::_W_1);
static const Pb::Register _R_119("GridBase", "getSizeY", GridBase::_W_2);
static const Pb::Register _R_120("GridBase", "getSizeZ", GridBase::_W_3);
static const Pb::Register _R_121("GridBase", "getSize", GridBase::_W_4);
static const Pb::Register _R_122("GridBase", "is3D", GridBase::_W_5);
static const Pb::Register _R_123("GridBase", "is4D", GridBase::_W_6);
static const Pb::Register _R_124("GridBase", "getSizeT", GridBase::_W_7);
static const Pb::Register _R_125("GridBase", "getStrideT", GridBase::_W_8);
static const Pb::Register _R_120("GridBase", "GridBase", GridBase::_W_0);
static const Pb::Register _R_121("GridBase", "getSizeX", GridBase::_W_1);
static const Pb::Register _R_122("GridBase", "getSizeY", GridBase::_W_2);
static const Pb::Register _R_123("GridBase", "getSizeZ", GridBase::_W_3);
static const Pb::Register _R_124("GridBase", "getSize", GridBase::_W_4);
static const Pb::Register _R_125("GridBase", "is3D", GridBase::_W_5);
static const Pb::Register _R_126("GridBase", "is4D", GridBase::_W_6);
static const Pb::Register _R_127("GridBase", "getSizeT", GridBase::_W_7);
static const Pb::Register _R_128("GridBase", "getStrideT", GridBase::_W_8);
#endif
#ifdef _C_MACGrid
static const Pb::Register _R_126("MACGrid", "MACGrid", "Grid<Vec3>");
static const Pb::Register _R_129("MACGrid", "MACGrid", "Grid<Vec3>");
template<> const char *Namify<MACGrid>::S = "MACGrid";
static const Pb::Register _R_127("MACGrid", "MACGrid", MACGrid::_W_36);
static const Pb::Register _R_128("MACGrid", "setBoundMAC", MACGrid::_W_37);
static const Pb::Register _R_130("MACGrid", "MACGrid", MACGrid::_W_37);
static const Pb::Register _R_131("MACGrid", "setBoundMAC", MACGrid::_W_38);
#endif
static const Pb::Register _R_7("GridType_TypeNone", 0);
static const Pb::Register _R_8("GridType_TypeReal", 1);
@@ -247,6 +250,9 @@ void PbRegister_file_7()
KEEP_UNUSED(_R_126);
KEEP_UNUSED(_R_127);
KEEP_UNUSED(_R_128);
KEEP_UNUSED(_R_129);
KEEP_UNUSED(_R_130);
KEEP_UNUSED(_R_131);
}
}
} // namespace Manta

View File

@@ -525,7 +525,7 @@ struct knFlipSampleSecondaryParticlesMoreCylinders : public KernelBase {
if (!(flags(i, j, k) & itype))
return;
RandomStream mRand(9832);
static RandomStream mRand(9832);
Real radius =
0.25; // diameter=0.5 => sampling with two cylinders in each dimension since cell size=1
for (Real x = i - radius; x <= i + radius; x += 2 * radius) {
@@ -791,11 +791,9 @@ struct knFlipSampleSecondaryParticles : public KernelBase {
const int n = KE * (k_ta * TA + k_wc * WC) * dt; // number of secondary particles
if (n == 0)
return;
RandomStream mRand(9832);
static RandomStream mRand(9832);
Vec3 xi = Vec3(i + mRand.getReal(),
j + mRand.getReal(),
k + mRand.getReal()); // randomized offset uniform in cell
Vec3 xi = Vec3(i, j, k) + mRand.getVec3(); // randomized offset uniform in cell
Vec3 vi = v.getInterpolated(xi);
Vec3 dir = dt * vi; // direction of movement of current particle
Vec3 e1 = getNormalized(Vec3(dir.z, 0, -dir.x)); // perpendicular to dir
@@ -1834,7 +1832,7 @@ struct knFlipDeleteParticlesInObstacle : public KernelBase {
}
int gridIndex = flags.index(xidx);
// remove particles that penetrate obstacles
if (flags[gridIndex] == FlagGrid::TypeObstacle || flags[gridIndex] == FlagGrid::TypeOutflow) {
if (flags.isObstacle(gridIndex) || flags.isOutflow(gridIndex)) {
pts.kill(idx);
}
}

View File

@@ -37,8 +37,8 @@
#endif
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <intrin.h>
#include <windows.h>
#if defined(__clang__)
# pragma GCC diagnostic push

View File

@@ -47,10 +47,10 @@
#ifndef __ATOMIC_OPS_UTILS_H__
#define __ATOMIC_OPS_UTILS_H__
#include <stdint.h>
#include <stddef.h>
#include <stdlib.h>
#include <limits.h>
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <assert.h>

View File

@@ -25,8 +25,8 @@
#include "AUD_PyInit.h"
#include <AUD_Sound.h>
#include <python/PySound.h>
#include <python/PyAPI.h>
#include <python/PySound.h>
extern "C" {
extern void *BKE_sound_get_factory(void *sound);

View File

@@ -18,23 +18,23 @@
* \ingroup clog
*/
#include <assert.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <assert.h>
/* Disable for small single threaded programs
* to avoid having to link with pthreads. */
#ifdef WITH_CLOG_PTHREADS
# include <pthread.h>
# include "atomic_ops.h"
# include <pthread.h>
#endif
/* For 'isatty' to check for color. */
#if defined(__unix__) || defined(__APPLE__) || defined(__HAIKU__)
# include <unistd.h>
# include <sys/time.h>
# include <unistd.h>
#endif
#if defined(_MSC_VER)

View File

@@ -177,14 +177,11 @@ if(CXX_HAS_AVX2)
add_definitions(-DWITH_KERNEL_AVX2)
endif()
if(WITH_CYCLES_OSL)
# LLVM and OSL need to build without RTTI
if(WIN32 AND MSVC)
set(RTTI_DISABLE_FLAGS "/GR- -DBOOST_NO_RTTI -DBOOST_NO_TYPEID")
elseif(CMAKE_COMPILER_IS_GNUCC OR (CMAKE_C_COMPILER_ID MATCHES "Clang"))
set(RTTI_DISABLE_FLAGS "-fno-rtti -DBOOST_NO_RTTI -DBOOST_NO_TYPEID")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${RTTI_DISABLE_FLAGS}")
# LLVM and OSL need to build without RTTI
if(WIN32 AND MSVC)
set(RTTI_DISABLE_FLAGS "/GR- -DBOOST_NO_RTTI -DBOOST_NO_TYPEID")
elseif(CMAKE_COMPILER_IS_GNUCC OR (CMAKE_C_COMPILER_ID MATCHES "Clang"))
set(RTTI_DISABLE_FLAGS "-fno-rtti -DBOOST_NO_RTTI -DBOOST_NO_TYPEID")
endif()
# Definitions and Includes
@@ -316,9 +313,7 @@ if(WITH_CYCLES_CUDA_BINARIES AND (NOT WITH_CYCLES_CUBIN_COMPILER))
set(MAX_MSVC 1910)
elseif(${CUDA_VERSION} EQUAL "9.1")
set(MAX_MSVC 1911)
elseif(${CUDA_VERSION} EQUAL "10.0")
set(MAX_MSVC 1999)
elseif(${CUDA_VERSION} EQUAL "10.1")
elseif(${CUDA_VERSION} LESS "11.0")
set(MAX_MSVC 1999)
endif()
if(NOT MSVC_VERSION LESS ${MAX_MSVC} OR CMAKE_C_COMPILER_ID MATCHES "Clang")
@@ -335,7 +330,7 @@ if(WITH_CYCLES_CUDA_BINARIES AND (NOT WITH_CYCLES_CUBIN_COMPILER))
endif()
# NVRTC gives wrong rendering result in CUDA 10.0, so we must use NVCC.
if(WITH_CYCLES_CUDA_BINARIES AND WITH_CYCLES_CUBIN_COMPILER)
if(WITH_CYCLES_CUDA_BINARIES AND WITH_CYCLES_CUBIN_COMPILER AND NOT WITH_CYCLES_CUBIN_COMPILER_OVERRRIDE)
if(NOT (${CUDA_VERSION} VERSION_LESS 10.0))
message(STATUS "cycles_cubin_cc not supported for CUDA 10.0+, using nvcc instead.")
set(WITH_CYCLES_CUBIN_COMPILER OFF)
@@ -353,17 +348,6 @@ if(WITH_CYCLES_NETWORK)
add_definitions(-DWITH_NETWORK)
endif()
if(WITH_OPENCOLORIO)
add_definitions(-DWITH_OCIO)
include_directories(
SYSTEM
${OPENCOLORIO_INCLUDE_DIRS}
)
if(WIN32)
add_definitions(-DOpenColorIO_STATIC)
endif()
endif()
if(WITH_CYCLES_STANDALONE OR WITH_CYCLES_NETWORK OR WITH_CYCLES_CUBIN_COMPILER)
add_subdirectory(app)
endif()

View File

@@ -60,6 +60,7 @@ link_directories(
${TIFF_LIBPATH}
${OPENEXR_LIBPATH}
${OPENJPEG_LIBPATH}
${OPENVDB_LIBPATH}
)
if(WITH_OPENCOLORIO)

View File

@@ -14,8 +14,8 @@
* limitations under the License.
*/
#include <stdio.h>
#include <stdint.h>
#include <stdio.h>
#include <string>
#include <vector>
@@ -43,7 +43,8 @@ template<typename T> std::string to_string(const T &n)
class CompilationSettings {
public:
CompilationSettings() : target_arch(0), bits(64), verbose(false), fast_math(false)
CompilationSettings()
: target_arch(0), bits(64), verbose(false), fast_math(false), ptx_only(false)
{
}
@@ -57,12 +58,13 @@ class CompilationSettings {
int bits;
bool verbose;
bool fast_math;
bool ptx_only;
};
static bool compile_cuda(CompilationSettings &settings)
{
const char *headers[] = {"stdlib.h", "float.h", "math.h", "stdio.h"};
const char *header_content[] = {"\n", "\n", "\n", "\n"};
const char *headers[] = {"stdlib.h", "float.h", "math.h", "stdio.h", "stddef.h"};
const char *header_content[] = {"\n", "\n", "\n", "\n", "\n"};
printf("Building %s\n", settings.input_file.c_str());
@@ -83,6 +85,8 @@ static bool compile_cuda(CompilationSettings &settings)
options.push_back("-D__KERNEL_CUDA_VERSION__=" + std::to_string(cuewNvrtcVersion()));
options.push_back("-arch=compute_" + std::to_string(settings.target_arch));
options.push_back("--device-as-default-execution-space");
options.push_back("-DCYCLES_CUBIN_CC");
options.push_back("--std=c++11");
if (settings.fast_math)
options.push_back("--use_fast_math");
@@ -134,10 +138,14 @@ static bool compile_cuda(CompilationSettings &settings)
fprintf(stderr, "Error: nvrtcGetPTX failed (%d)\n\n", (int)result);
return false;
}
/* Write a file in the temp folder with the ptx code. */
settings.ptx_file = OIIO::Filesystem::temp_directory_path() + "/" +
OIIO::Filesystem::unique_path();
if (settings.ptx_only) {
settings.ptx_file = settings.output_file;
}
else {
/* Write a file in the temp folder with the ptx code. */
settings.ptx_file = OIIO::Filesystem::temp_directory_path() + "/" +
OIIO::Filesystem::unique_path();
}
FILE *f = fopen(settings.ptx_file.c_str(), "wb");
fwrite(&ptx_code[0], 1, ptx_size, f);
fclose(f);
@@ -249,6 +257,9 @@ static bool parse_parameters(int argc, const char **argv, CompilationSettings &s
"-D %L",
&settings.defines,
"Add additional defines",
"-ptx",
&settings.ptx_only,
"emit PTX code",
"-v",
&settings.verbose,
"Use verbose logging",
@@ -303,8 +314,10 @@ int main(int argc, const char **argv)
exit(EXIT_FAILURE);
}
if (!link_ptxas(settings)) {
exit(EXIT_FAILURE);
if (!settings.ptx_only) {
if (!link_ptxas(settings)) {
exit(EXIT_FAILURE);
}
}
return 0;

View File

@@ -20,11 +20,11 @@
#include "util/util_args.h"
#include "util/util_foreach.h"
#include "util/util_logging.h"
#include "util/util_path.h"
#include "util/util_stats.h"
#include "util/util_string.h"
#include "util/util_task.h"
#include "util/util_logging.h"
using namespace ccl;

View File

@@ -16,12 +16,12 @@
#include <stdio.h>
#include "device/device.h"
#include "render/buffers.h"
#include "render/camera.h"
#include "device/device.h"
#include "render/integrator.h"
#include "render/scene.h"
#include "render/session.h"
#include "render/integrator.h"
#include "util/util_args.h"
#include "util/util_foreach.h"

View File

@@ -16,9 +16,9 @@
#include <stdio.h>
#include <sstream>
#include <algorithm>
#include <iterator>
#include <sstream>
#include "graph/node_xml.h"
@@ -32,8 +32,8 @@
#include "render/nodes.h"
#include "render/object.h"
#include "render/osl.h"
#include "render/shader.h"
#include "render/scene.h"
#include "render/shader.h"
#include "subd/subd_patch.h"
#include "subd/subd_split.h"
@@ -292,7 +292,7 @@ static void xml_read_shader_graph(XMLReadState &state, Shader *shader, xml_node
filepath = path_join(state.base, filepath);
}
snode = ((OSLShaderManager *)manager)->osl_node(filepath);
snode = OSLShaderManager::osl_node(manager, filepath);
if (!snode) {
fprintf(stderr, "Failed to create OSL node from \"%s\".\n", filepath.c_str());

View File

@@ -38,6 +38,7 @@ set(SRC
CCL_api.h
blender_device.h
blender_id_map.h
blender_image.h
blender_object_cull.h
blender_sync.h
blender_session.h
@@ -91,6 +92,20 @@ if(WITH_MOD_FLUID)
add_definitions(-DWITH_FLUID)
endif()
if(WITH_NEW_OBJECT_TYPES)
add_definitions(-DWITH_NEW_OBJECT_TYPES)
endif()
if(WITH_OPENVDB)
add_definitions(-DWITH_OPENVDB ${OPENVDB_DEFINITIONS})
list(APPEND INC_SYS
${OPENVDB_INCLUDE_DIRS}
)
list(APPEND LIB
${OPENVDB_LIBRARIES}
)
endif()
blender_add_lib(bf_intern_cycles "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
# avoid link failure with clang 3.4 debug

View File

@@ -33,7 +33,7 @@ def _is_using_buggy_driver():
# in the version string, but those cards do not quite work and
# causing crashes.
return True
regex = re.compile(".*Compatibility Profile Context ([0-9]+(\.[0-9]+)+)$")
regex = re.compile(".*Compatibility Profile Context ([0-9]+(\\.[0-9]+)+)$")
if not regex.match(version):
# Skip cards like FireGL
return False
@@ -260,15 +260,16 @@ def list_render_passes(srl):
if crl.use_pass_volume_indirect: yield ("VolumeInd", "RGB", 'COLOR')
# Cryptomatte passes.
crypto_depth = (crl.pass_crypto_depth + 1) // 2
if crl.use_pass_crypto_object:
for i in range(0, crl.pass_crypto_depth, 2):
yield ("CryptoObject" + '{:02d}'.format(i//2), "RGBA", 'COLOR')
for i in range(0, crypto_depth):
yield ("CryptoObject" + '{:02d}'.format(i), "RGBA", 'COLOR')
if crl.use_pass_crypto_material:
for i in range(0, crl.pass_crypto_depth, 2):
yield ("CryptoMaterial" + '{:02d}'.format(i//2), "RGBA", 'COLOR')
for i in range(0, crypto_depth):
yield ("CryptoMaterial" + '{:02d}'.format(i), "RGBA", 'COLOR')
if srl.cycles.use_pass_crypto_asset:
for i in range(0, srl.cycles.pass_crypto_depth, 2):
yield ("CryptoAsset" + '{:02d}'.format(i//2), "RGBA", 'COLOR')
for i in range(0, crypto_depth):
yield ("CryptoAsset" + '{:02d}'.format(i), "RGBA", 'COLOR')
# Denoising passes.
if crl.use_denoising or crl.denoising_store_passes:

View File

@@ -361,6 +361,7 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
description="Noise level step to stop sampling at, lower values reduce noise the cost of render time. Zero for automatic setting based on number of AA samples",
min=0.0, max=1.0,
default=0.0,
precision=4,
)
adaptive_min_samples: IntProperty(
name="Adaptive Min Samples",
@@ -443,13 +444,20 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
default=8,
)
volume_step_size: FloatProperty(
name="Step Size",
description="Distance between volume shader samples when rendering the volume "
"(lower values give more accurate and detailed results, but also increased render time)",
default=0.1,
min=0.0000001, max=100000.0, soft_min=0.01, soft_max=1.0, precision=4,
unit='LENGTH'
volume_step_rate: FloatProperty(
name="Step Rate",
description="Globally adjust detail for volume rendering, on top of automatically estimated step size. "
"Higher values reduce render time, lower values render with more detail",
default=1.0,
min=0.01, max=100.0, soft_min=0.1, soft_max=10.0, precision=2
)
volume_preview_step_rate: FloatProperty(
name="Step Rate",
description="Globally adjust detail for volume rendering, on top of automatically estimated step size. "
"Higher values reduce render time, lower values render with more detail",
default=1.0,
min=0.01, max=100.0, soft_min=0.1, soft_max=10.0, precision=2
)
volume_max_steps: IntProperty(
@@ -933,6 +941,14 @@ class CyclesMaterialSettings(bpy.types.PropertyGroup):
default='LINEAR',
)
volume_step_rate: FloatProperty(
name="Step Rate",
description="Scale the distance between volume shader samples when rendering the volume "
"(lower values give more accurate and detailed results, but also increased render time)",
default=1.0,
min=0.001, max=1000.0, soft_min=0.1, soft_max=10.0, precision=4
)
displacement_method: EnumProperty(
name="Displacement Method",
description="Method to use for the displacement",
@@ -1043,6 +1059,13 @@ class CyclesWorldSettings(bpy.types.PropertyGroup):
items=enum_volume_interpolation,
default='LINEAR',
)
volume_step_size: FloatProperty(
name="Step Size",
description="Distance between volume shader samples when rendering the volume "
"(lower values give more accurate and detailed results, but also increased render time)",
default=1.0,
min=0.0000001, max=100000.0, soft_min=0.1, soft_max=100.0, precision=4
)
@classmethod
def register(cls):

View File

@@ -373,7 +373,7 @@ class CYCLES_RENDER_PT_subdivision(CyclesButtonsPanel, Panel):
col = layout.column()
sub = col.column(align=True)
sub.prop(cscene, "dicing_rate", text="Dicing Rate Render")
sub.prop(cscene, "preview_dicing_rate", text="Preview")
sub.prop(cscene, "preview_dicing_rate", text="Viewport")
col.separator()
@@ -428,9 +428,11 @@ class CYCLES_RENDER_PT_volumes(CyclesButtonsPanel, Panel):
scene = context.scene
cscene = scene.cycles
col = layout.column()
col.prop(cscene, "volume_step_size", text="Step Size")
col.prop(cscene, "volume_max_steps", text="Max Steps")
col = layout.column(align=True)
col.prop(cscene, "volume_step_rate", text="Step Rate Render")
col.prop(cscene, "volume_preview_step_rate", text="Viewport")
layout.prop(cscene, "volume_max_steps", text="Max Steps")
class CYCLES_RENDER_PT_light_paths(CyclesButtonsPanel, Panel):
@@ -770,6 +772,8 @@ class CYCLES_RENDER_PT_filter(CyclesButtonsPanel, Panel):
col.prop(view_layer, "use_solid", text="Surfaces")
col = flow.column()
col.prop(view_layer, "use_strand", text="Hair")
col = flow.column()
col.prop(view_layer, "use_volumes", text="Volumes")
if with_freestyle:
col = flow.column()
col.prop(view_layer, "use_freestyle", text="Freestyle")
@@ -1413,8 +1417,6 @@ class CYCLES_LIGHT_PT_light(CyclesButtonsPanel, Panel):
light = context.light
clamp = light.cycles
layout.use_property_decorate = False
if self.bl_space_type == 'PROPERTIES':
layout.row().prop(light, "type", expand=True)
layout.use_property_split = True
@@ -1696,6 +1698,9 @@ class CYCLES_WORLD_PT_settings_volume(CyclesButtonsPanel, Panel):
sub.prop(cworld, "volume_sampling", text="Sampling")
col.prop(cworld, "volume_interpolation", text="Interpolation")
col.prop(cworld, "homogeneous_volume", text="Homogeneous")
sub = col.column()
sub.active = not cworld.homogeneous_volume
sub.prop(cworld, "volume_step_size")
class CYCLES_MATERIAL_PT_preview(CyclesButtonsPanel, Panel):
@@ -1827,6 +1832,9 @@ class CYCLES_MATERIAL_PT_settings_volume(CyclesButtonsPanel, Panel):
sub.prop(cmat, "volume_sampling", text="Sampling")
col.prop(cmat, "volume_interpolation", text="Interpolation")
col.prop(cmat, "homogeneous_volume", text="Homogeneous")
sub = col.column()
sub.active = not cmat.homogeneous_volume
sub.prop(cmat, "volume_step_rate")
def draw(self, context):
self.draw_shared(self, context, context.material)
@@ -1909,7 +1917,6 @@ class CYCLES_RENDER_PT_bake_influence(CyclesButtonsPanel, Panel):
flow.prop(cbk, "use_pass_diffuse")
flow.prop(cbk, "use_pass_glossy")
flow.prop(cbk, "use_pass_transmission")
flow.prop(cbk, "use_pass_subsurface")
flow.prop(cbk, "use_pass_ambient_occlusion")
flow.prop(cbk, "use_pass_emit")
@@ -2079,7 +2086,7 @@ class CYCLES_RENDER_PT_simplify_viewport(CyclesButtonsPanel, Panel):
col.prop(rd, "simplify_child_particles", text="Child Particles")
col.prop(cscene, "texture_limit", text="Texture Limit")
col.prop(cscene, "ao_bounces", text="AO Bounces")
col.prop(rd, "use_simplify_smoke_highres")
class CYCLES_RENDER_PT_simplify_render(CyclesButtonsPanel, Panel):
bl_label = "Render"

View File

@@ -595,40 +595,6 @@ static void ExportCurveTriangleGeometry(Mesh *mesh, ParticleCurveData *CData, in
/* texture coords still needed */
}
static void export_hair_motion_validate_attribute(Hair *hair,
int motion_step,
int num_motion_keys,
bool have_motion)
{
Attribute *attr_mP = hair->attributes.find(ATTR_STD_MOTION_VERTEX_POSITION);
const int num_keys = hair->curve_keys.size();
if (num_motion_keys != num_keys || !have_motion) {
/* No motion or hair "topology" changed, remove attributes again. */
if (num_motion_keys != num_keys) {
VLOG(1) << "Hair topology changed, removing attribute.";
}
else {
VLOG(1) << "No motion, removing attribute.";
}
hair->attributes.remove(ATTR_STD_MOTION_VERTEX_POSITION);
}
else if (motion_step > 0) {
VLOG(1) << "Filling in new motion vertex position for motion_step " << motion_step;
/* Motion, fill up previous steps that we might have skipped because
* they had no motion, but we need them anyway now. */
for (int step = 0; step < motion_step; step++) {
float4 *mP = attr_mP->data_float4() + step * num_keys;
for (int key = 0; key < num_keys; key++) {
mP[key] = float3_to_float4(hair->curve_keys[key]);
mP[key].w = hair->curve_radius[key];
}
}
}
}
static void ExportCurveSegments(Scene *scene, Hair *hair, ParticleCurveData *CData)
{
int num_keys = 0;
@@ -748,6 +714,40 @@ static float4 LerpCurveSegmentMotionCV(ParticleCurveData *CData, int sys, int cu
return lerp(mP, mP2, remainder);
}
static void export_hair_motion_validate_attribute(Hair *hair,
int motion_step,
int num_motion_keys,
bool have_motion)
{
Attribute *attr_mP = hair->attributes.find(ATTR_STD_MOTION_VERTEX_POSITION);
const int num_keys = hair->curve_keys.size();
if (num_motion_keys != num_keys || !have_motion) {
/* No motion or hair "topology" changed, remove attributes again. */
if (num_motion_keys != num_keys) {
VLOG(1) << "Hair topology changed, removing attribute.";
}
else {
VLOG(1) << "No motion, removing attribute.";
}
hair->attributes.remove(ATTR_STD_MOTION_VERTEX_POSITION);
}
else if (motion_step > 0) {
VLOG(1) << "Filling in new motion vertex position for motion_step " << motion_step;
/* Motion, fill up previous steps that we might have skipped because
* they had no motion, but we need them anyway now. */
for (int step = 0; step < motion_step; step++) {
float4 *mP = attr_mP->data_float4() + step * num_keys;
for (int key = 0; key < num_keys; key++) {
mP[key] = float3_to_float4(hair->curve_keys[key]);
mP[key].w = hair->curve_radius[key];
}
}
}
}
static void ExportCurveSegmentsMotion(Hair *hair, ParticleCurveData *CData, int motion_step)
{
VLOG(1) << "Exporting curve motion segments for hair " << hair->name << ", motion step "
@@ -817,7 +817,7 @@ static void ExportCurveSegmentsMotion(Hair *hair, ParticleCurveData *CData, int
}
}
/* in case of new attribute, we verify if there really was any motion */
/* In case of new attribute, we verify if there really was any motion. */
if (new_attribute) {
export_hair_motion_validate_attribute(hair, motion_step, i, have_motion);
}
@@ -1154,6 +1154,194 @@ void BlenderSync::sync_particle_hair(
}
}
#ifdef WITH_NEW_OBJECT_TYPES
static float4 hair_point_as_float4(BL::HairPoint b_point)
{
float4 mP = float3_to_float4(get_float3(b_point.co()));
mP.w = b_point.radius();
return mP;
}
static float4 interpolate_hair_points(BL::Hair b_hair,
const int first_point_index,
const int num_points,
const float step)
{
const float curve_t = step * (num_points - 1);
const int point_a = clamp((int)curve_t, 0, num_points - 1);
const int point_b = min(point_a + 1, num_points - 1);
const float t = curve_t - (float)point_a;
return lerp(hair_point_as_float4(b_hair.points[first_point_index + point_a]),
hair_point_as_float4(b_hair.points[first_point_index + point_b]),
t);
}
static void export_hair_curves(Scene *scene, Hair *hair, BL::Hair b_hair)
{
/* TODO: optimize so we can straight memcpy arrays from Blender? */
/* Add requested attributes. */
Attribute *attr_intercept = NULL;
Attribute *attr_random = NULL;
if (hair->need_attribute(scene, ATTR_STD_CURVE_INTERCEPT)) {
attr_intercept = hair->attributes.add(ATTR_STD_CURVE_INTERCEPT);
}
if (hair->need_attribute(scene, ATTR_STD_CURVE_RANDOM)) {
attr_random = hair->attributes.add(ATTR_STD_CURVE_RANDOM);
}
/* Reserve memory. */
const int num_keys = b_hair.points.length();
const int num_curves = b_hair.curves.length();
if (num_curves > 0) {
VLOG(1) << "Exporting curve segments for hair " << hair->name;
}
hair->reserve_curves(num_curves, num_keys);
/* Export curves and points. */
vector<float> points_length;
BL::Hair::curves_iterator b_curve_iter;
for (b_hair.curves.begin(b_curve_iter); b_curve_iter != b_hair.curves.end(); ++b_curve_iter) {
BL::HairCurve b_curve = *b_curve_iter;
const int first_point_index = b_curve.first_point_index();
const int num_points = b_curve.num_points();
float3 prev_co = make_float3(0.0f, 0.0f, 0.0f);
float length = 0.0f;
if (attr_intercept) {
points_length.clear();
points_length.reserve(num_points);
}
/* Position and radius. */
for (int i = 0; i < num_points; i++) {
BL::HairPoint b_point = b_hair.points[first_point_index + i];
const float3 co = get_float3(b_point.co());
const float radius = b_point.radius();
hair->add_curve_key(co, radius);
if (attr_intercept) {
if (i > 0) {
length += len(co - prev_co);
points_length.push_back(length);
}
prev_co = co;
}
}
/* Normalized 0..1 attribute along curve. */
if (attr_intercept) {
for (int i = 0; i < num_points; i++) {
attr_intercept->add((length == 0.0f) ? 0.0f : points_length[i] / length);
}
}
/* Random number per curve. */
if (attr_random != NULL) {
attr_random->add(hash_uint2_to_float(b_curve.index(), 0));
}
/* Curve. */
const int shader_index = 0;
hair->add_curve(first_point_index, shader_index);
}
}
static void export_hair_curves_motion(Hair *hair, BL::Hair b_hair, int motion_step)
{
VLOG(1) << "Exporting curve motion segments for hair " << hair->name << ", motion step "
<< motion_step;
/* Find or add attribute. */
Attribute *attr_mP = hair->attributes.find(ATTR_STD_MOTION_VERTEX_POSITION);
bool new_attribute = false;
if (!attr_mP) {
VLOG(1) << "Creating new motion vertex position attribute";
attr_mP = hair->attributes.add(ATTR_STD_MOTION_VERTEX_POSITION);
new_attribute = true;
}
/* Export motion keys. */
const int num_keys = hair->curve_keys.size();
float4 *mP = attr_mP->data_float4() + motion_step * num_keys;
bool have_motion = false;
int num_motion_keys = 0;
int curve_index = 0;
BL::Hair::curves_iterator b_curve_iter;
for (b_hair.curves.begin(b_curve_iter); b_curve_iter != b_hair.curves.end(); ++b_curve_iter) {
BL::HairCurve b_curve = *b_curve_iter;
const int first_point_index = b_curve.first_point_index();
const int num_points = b_curve.num_points();
Hair::Curve curve = hair->get_curve(curve_index);
curve_index++;
if (num_points == curve.num_keys) {
/* Number of keys matches. */
for (int i = 0; i < num_points; i++) {
int point_index = first_point_index + i;
if (point_index < num_keys) {
mP[num_motion_keys] = hair_point_as_float4(b_hair.points[point_index]);
num_motion_keys++;
if (!have_motion) {
/* TODO: use epsilon for comparison? Was needed for particles due to
* transform, but ideally should not happen anymore. */
float4 curve_key = float3_to_float4(hair->curve_keys[i]);
curve_key.w = hair->curve_radius[i];
have_motion = !(mP[i] == curve_key);
}
}
}
}
else {
/* Number of keys has changed. Generate an interpolated version
* to preserve motion blur. */
const float step_size = curve.num_keys > 1 ? 1.0f / (curve.num_keys - 1) : 0.0f;
for (int i = 0; i < curve.num_keys; i++) {
const float step = i * step_size;
mP[num_motion_keys] = interpolate_hair_points(b_hair, first_point_index, num_points, step);
num_motion_keys++;
}
have_motion = true;
}
}
/* In case of new attribute, we verify if there really was any motion. */
if (new_attribute) {
export_hair_motion_validate_attribute(hair, motion_step, num_motion_keys, have_motion);
}
}
#endif /* WITH_NEW_OBJECT_TYPES */
/* Hair object. */
void BlenderSync::sync_hair(Hair *hair, BL::Object &b_ob, bool motion, int motion_step)
{
#ifdef WITH_NEW_OBJECT_TYPES
/* Convert Blender hair to Cycles curves. */
BL::Hair b_hair(b_ob.data());
if (motion) {
export_hair_curves_motion(hair, b_hair, motion_step);
}
else {
export_hair_curves(scene, hair, b_hair);
}
#else
(void)hair;
(void)b_ob;
(void)motion;
(void)motion_step;
#endif /* WITH_NEW_OBJECT_TYPES */
}
void BlenderSync::sync_hair(BL::Depsgraph b_depsgraph,
BL::Object b_ob,
Geometry *geom,
@@ -1179,14 +1367,24 @@ void BlenderSync::sync_hair(BL::Depsgraph b_depsgraph,
geom->used_shaders = used_shaders;
if (view_layer.use_hair && scene->curve_system_manager->use_curves) {
/* Particle hair. */
bool need_undeformed = geom->need_attribute(scene, ATTR_STD_GENERATED);
BL::Mesh b_mesh = object_to_mesh(
b_data, b_ob, b_depsgraph, need_undeformed, Mesh::SUBDIVISION_NONE);
#ifdef WITH_NEW_OBJECT_TYPES
if (b_ob.type() == BL::Object::type_HAIR) {
/* Hair object. */
sync_hair(hair, b_ob, false);
assert(mesh == NULL);
}
else
#endif
{
/* Particle hair. */
bool need_undeformed = geom->need_attribute(scene, ATTR_STD_GENERATED);
BL::Mesh b_mesh = object_to_mesh(
b_data, b_ob, b_depsgraph, need_undeformed, Mesh::SUBDIVISION_NONE);
if (b_mesh) {
sync_particle_hair(geom, b_mesh, b_ob, false);
free_object_to_mesh(b_data, b_ob, b_mesh);
if (b_mesh) {
sync_particle_hair(geom, b_mesh, b_ob, false);
free_object_to_mesh(b_data, b_ob, b_mesh);
}
}
}
@@ -1213,13 +1411,24 @@ void BlenderSync::sync_hair_motion(BL::Depsgraph b_depsgraph,
/* Export deformed coordinates. */
if (ccl::BKE_object_is_deform_modified(b_ob, b_scene, preview)) {
/* Particle hair. */
BL::Mesh b_mesh = object_to_mesh(b_data, b_ob, b_depsgraph, false, Mesh::SUBDIVISION_NONE);
if (b_mesh) {
sync_particle_hair(geom, b_mesh, b_ob, true, motion_step);
free_object_to_mesh(b_data, b_ob, b_mesh);
#ifdef WITH_NEW_OBJECT_TYPES
if (b_ob.type() == BL::Object::type_HAIR) {
/* Hair object. */
sync_hair(hair, b_ob, true, motion_step);
assert(mesh == NULL);
return;
}
else
#endif
{
/* Particle hair. */
BL::Mesh b_mesh = object_to_mesh(b_data, b_ob, b_depsgraph, false, Mesh::SUBDIVISION_NONE);
if (b_mesh) {
sync_particle_hair(geom, b_mesh, b_ob, true, motion_step);
free_object_to_mesh(b_data, b_ob, b_mesh);
return;
}
}
}
/* No deformation on this frame, copy coordinates if other frames did have it. */

View File

@@ -17,6 +17,8 @@
#include "blender/blender_device.h"
#include "blender/blender_util.h"
#include "util/util_foreach.h"
CCL_NAMESPACE_BEGIN
enum DenoiserType {

View File

@@ -18,9 +18,9 @@
#define __BLENDER_DEVICE_H__
#include "MEM_guardedalloc.h"
#include "RNA_types.h"
#include "RNA_access.h"
#include "RNA_blender_cpp.h"
#include "RNA_types.h"
#include "device/device.h"

View File

@@ -23,6 +23,8 @@
#include "blender/blender_sync.h"
#include "blender/blender_util.h"
#include "util/util_foreach.h"
CCL_NAMESPACE_BEGIN
Geometry *BlenderSync::sync_geometry(BL::Depsgraph &b_depsgraph,
@@ -36,11 +38,19 @@ Geometry *BlenderSync::sync_geometry(BL::Depsgraph &b_depsgraph,
BL::ID b_key_id = (BKE_object_is_modified(b_ob)) ? b_ob_instance : b_ob_data;
GeometryKey key(b_key_id.ptr.data, use_particle_hair);
BL::Material material_override = view_layer.material_override;
Shader *default_shader = scene->default_surface;
Geometry::Type geom_type = (use_particle_hair &&
Shader *default_shader = (b_ob.type() == BL::Object::type_VOLUME) ? scene->default_volume :
scene->default_surface;
#ifdef WITH_NEW_OBJECT_TYPES
Geometry::Type geom_type = ((b_ob.type() == BL::Object::type_HAIR || use_particle_hair) &&
(scene->curve_system_manager->primitive != CURVE_TRIANGLES)) ?
Geometry::HAIR :
Geometry::MESH;
#else
Geometry::Type geom_type = ((use_particle_hair) &&
(scene->curve_system_manager->primitive != CURVE_TRIANGLES)) ?
Geometry::HAIR :
Geometry::MESH;
#endif
/* Find shader indices. */
vector<Shader *> used_shaders;
@@ -119,10 +129,14 @@ Geometry *BlenderSync::sync_geometry(BL::Depsgraph &b_depsgraph,
geom->name = ustring(b_ob_data.name().c_str());
#ifdef WITH_NEW_OBJECT_TYPES
if (b_ob.type() == BL::Object::type_HAIR || use_particle_hair) {
#else
if (use_particle_hair) {
#endif
sync_hair(b_depsgraph, b_ob, geom, used_shaders);
}
else if (object_fluid_gas_domain_find(b_ob)) {
else if (b_ob.type() == BL::Object::type_VOLUME || object_fluid_gas_domain_find(b_ob)) {
Mesh *mesh = static_cast<Mesh *>(geom);
sync_volume(b_ob, mesh, used_shaders);
}
@@ -159,10 +173,14 @@ void BlenderSync::sync_geometry_motion(BL::Depsgraph &b_depsgraph,
return;
}
#ifdef WITH_NEW_OBJECT_TYPES
if (b_ob.type() == BL::Object::type_HAIR || use_particle_hair) {
#else
if (use_particle_hair) {
#endif
sync_hair_motion(b_depsgraph, b_ob, geom, motion_step);
}
else if (object_fluid_gas_domain_find(b_ob)) {
else if (b_ob.type() == BL::Object::type_VOLUME || object_fluid_gas_domain_find(b_ob)) {
/* No volume motion blur support yet. */
}
else {

View File

@@ -14,206 +14,71 @@
* limitations under the License.
*/
#include "render/image.h"
#include "MEM_guardedalloc.h"
#include "blender/blender_sync.h"
#include "blender/blender_image.h"
#include "blender/blender_session.h"
#include "blender/blender_util.h"
CCL_NAMESPACE_BEGIN
/* builtin image file name is actually an image datablock name with
* absolute sequence frame number concatenated via '@' character
*
* this function splits frame from builtin name
*/
int BlenderSession::builtin_image_frame(const string &builtin_name)
/* Packed Images */
BlenderImageLoader::BlenderImageLoader(BL::Image b_image, int frame)
: b_image(b_image), frame(frame), free_cache(!b_image.has_data())
{
int last = builtin_name.find_last_of('@');
return atoi(builtin_name.substr(last + 1, builtin_name.size() - last - 1).c_str());
}
void BlenderSession::builtin_image_info(const string &builtin_name,
void *builtin_data,
ImageMetaData &metadata)
bool BlenderImageLoader::load_metadata(ImageMetaData &metadata)
{
/* empty image */
metadata.width = 1;
metadata.height = 1;
metadata.width = b_image.size()[0];
metadata.height = b_image.size()[1];
metadata.depth = 1;
metadata.channels = b_image.channels();
if (!builtin_data)
return;
/* recover ID pointer */
PointerRNA ptr;
RNA_id_pointer_create((ID *)builtin_data, &ptr);
BL::ID b_id(ptr);
if (b_id.is_a(&RNA_Image)) {
/* image data */
BL::Image b_image(b_id);
metadata.builtin_free_cache = !b_image.has_data();
metadata.is_float = b_image.is_float();
metadata.width = b_image.size()[0];
metadata.height = b_image.size()[1];
metadata.depth = 1;
metadata.channels = b_image.channels();
if (metadata.is_float) {
/* Float images are already converted on the Blender side,
* no need to do anything in Cycles. */
metadata.colorspace = u_colorspace_raw;
if (b_image.is_float()) {
if (metadata.channels == 1) {
metadata.type = IMAGE_DATA_TYPE_FLOAT;
}
}
else if (b_id.is_a(&RNA_Object)) {
/* smoke volume data */
BL::Object b_ob(b_id);
BL::FluidDomainSettings b_domain = object_fluid_gas_domain_find(b_ob);
metadata.is_float = true;
metadata.depth = 1;
metadata.channels = 1;
if (!b_domain)
return;
if (builtin_name == Attribute::standard_name(ATTR_STD_VOLUME_DENSITY) ||
builtin_name == Attribute::standard_name(ATTR_STD_VOLUME_FLAME) ||
builtin_name == Attribute::standard_name(ATTR_STD_VOLUME_HEAT) ||
builtin_name == Attribute::standard_name(ATTR_STD_VOLUME_TEMPERATURE))
metadata.channels = 1;
else if (builtin_name == Attribute::standard_name(ATTR_STD_VOLUME_COLOR))
metadata.channels = 4;
else if (builtin_name == Attribute::standard_name(ATTR_STD_VOLUME_VELOCITY))
metadata.channels = 3;
else
return;
int3 resolution = get_int3(b_domain.domain_resolution());
int amplify = (b_domain.use_noise()) ? b_domain.noise_scale() : 1;
/* Velocity and heat data is always low-resolution. */
if (builtin_name == Attribute::standard_name(ATTR_STD_VOLUME_VELOCITY) ||
builtin_name == Attribute::standard_name(ATTR_STD_VOLUME_HEAT)) {
amplify = 1;
}
metadata.width = resolution.x * amplify;
metadata.height = resolution.y * amplify;
metadata.depth = resolution.z * amplify;
}
else {
/* TODO(sergey): Check we're indeed in shader node tree. */
PointerRNA ptr;
RNA_pointer_create(NULL, &RNA_Node, builtin_data, &ptr);
BL::Node b_node(ptr);
if (b_node.is_a(&RNA_ShaderNodeTexPointDensity)) {
BL::ShaderNodeTexPointDensity b_point_density_node(b_node);
metadata.channels = 4;
metadata.width = b_point_density_node.resolution();
metadata.height = metadata.width;
metadata.depth = metadata.width;
metadata.is_float = true;
}
}
}
bool BlenderSession::builtin_image_pixels(const string &builtin_name,
void *builtin_data,
int tile,
unsigned char *pixels,
const size_t pixels_size,
const bool associate_alpha,
const bool free_cache)
{
if (!builtin_data) {
return false;
}
const int frame = builtin_image_frame(builtin_name);
PointerRNA ptr;
RNA_id_pointer_create((ID *)builtin_data, &ptr);
BL::Image b_image(ptr);
const int width = b_image.size()[0];
const int height = b_image.size()[1];
const int channels = b_image.channels();
unsigned char *image_pixels = image_get_pixels_for_frame(b_image, frame, tile);
const size_t num_pixels = ((size_t)width) * height;
if (image_pixels && num_pixels * channels == pixels_size) {
memcpy(pixels, image_pixels, pixels_size * sizeof(unsigned char));
}
else {
if (channels == 1) {
memset(pixels, 0, pixels_size * sizeof(unsigned char));
else if (metadata.channels == 4) {
metadata.type = IMAGE_DATA_TYPE_FLOAT4;
}
else {
const size_t num_pixels_safe = pixels_size / channels;
unsigned char *cp = pixels;
for (size_t i = 0; i < num_pixels_safe; i++, cp += channels) {
cp[0] = 255;
cp[1] = 0;
cp[2] = 255;
if (channels == 4) {
cp[3] = 255;
}
}
return false;
}
/* Float images are already converted on the Blender side,
* no need to do anything in Cycles. */
metadata.colorspace = u_colorspace_raw;
}
else {
if (metadata.channels == 1) {
metadata.type = IMAGE_DATA_TYPE_BYTE;
}
else if (metadata.channels == 4) {
metadata.type = IMAGE_DATA_TYPE_BYTE4;
}
else {
return false;
}
}
if (image_pixels) {
MEM_freeN(image_pixels);
}
/* Free image buffers to save memory during render. */
if (free_cache) {
b_image.buffers_free();
}
if (associate_alpha) {
/* Premultiply, byte images are always straight for Blender. */
unsigned char *cp = pixels;
for (size_t i = 0; i < num_pixels; i++, cp += channels) {
cp[0] = (cp[0] * cp[3]) >> 8;
cp[1] = (cp[1] * cp[3]) >> 8;
cp[2] = (cp[2] * cp[3]) >> 8;
}
}
return true;
}
bool BlenderSession::builtin_image_float_pixels(const string &builtin_name,
void *builtin_data,
int tile,
float *pixels,
const size_t pixels_size,
const bool,
const bool free_cache)
bool BlenderImageLoader::load_pixels(const ImageMetaData &metadata,
void *pixels,
const size_t pixels_size,
const bool associate_alpha)
{
if (!builtin_data) {
return false;
}
const size_t num_pixels = ((size_t)metadata.width) * metadata.height;
const int channels = metadata.channels;
const int tile = 0; /* TODO(lukas): Support tiles here? */
PointerRNA ptr;
RNA_id_pointer_create((ID *)builtin_data, &ptr);
BL::ID b_id(ptr);
if (b_id.is_a(&RNA_Image)) {
if (b_image.is_float()) {
/* image data */
BL::Image b_image(b_id);
int frame = builtin_image_frame(builtin_name);
const int width = b_image.size()[0];
const int height = b_image.size()[1];
const int channels = b_image.channels();
float *image_pixels;
image_pixels = image_get_float_pixels_for_frame(b_image, frame, tile);
const size_t num_pixels = ((size_t)width) * height;
if (image_pixels && num_pixels * channels == pixels_size) {
memcpy(pixels, image_pixels, pixels_size * sizeof(float));
@@ -224,7 +89,7 @@ bool BlenderSession::builtin_image_float_pixels(const string &builtin_name,
}
else {
const size_t num_pixels_safe = pixels_size / channels;
float *fp = pixels;
float *fp = (float *)pixels;
for (int i = 0; i < num_pixels_safe; i++, fp += channels) {
fp[0] = 1.0f;
fp[1] = 0.0f;
@@ -239,107 +104,91 @@ bool BlenderSession::builtin_image_float_pixels(const string &builtin_name,
if (image_pixels) {
MEM_freeN(image_pixels);
}
/* Free image buffers to save memory during render. */
if (free_cache) {
b_image.buffers_free();
}
return true;
}
else if (b_id.is_a(&RNA_Object)) {
/* smoke volume data */
BL::Object b_ob(b_id);
BL::FluidDomainSettings b_domain = object_fluid_gas_domain_find(b_ob);
if (!b_domain) {
return false;
}
#ifdef WITH_FLUID
int3 resolution = get_int3(b_domain.domain_resolution());
int length, amplify = (b_domain.use_noise()) ? b_domain.noise_scale() : 1;
/* Velocity and heat data is always low-resolution. */
if (builtin_name == Attribute::standard_name(ATTR_STD_VOLUME_VELOCITY) ||
builtin_name == Attribute::standard_name(ATTR_STD_VOLUME_HEAT)) {
amplify = 1;
}
const int width = resolution.x * amplify;
const int height = resolution.y * amplify;
const int depth = resolution.z * amplify;
const size_t num_pixels = ((size_t)width) * height * depth;
if (builtin_name == Attribute::standard_name(ATTR_STD_VOLUME_DENSITY)) {
FluidDomainSettings_density_grid_get_length(&b_domain.ptr, &length);
if (length == num_pixels) {
FluidDomainSettings_density_grid_get(&b_domain.ptr, pixels);
return true;
}
}
else if (builtin_name == Attribute::standard_name(ATTR_STD_VOLUME_FLAME)) {
/* this is in range 0..1, and interpreted by the OpenGL smoke viewer
* as 1500..3000 K with the first part faded to zero density */
FluidDomainSettings_flame_grid_get_length(&b_domain.ptr, &length);
if (length == num_pixels) {
FluidDomainSettings_flame_grid_get(&b_domain.ptr, pixels);
return true;
}
}
else if (builtin_name == Attribute::standard_name(ATTR_STD_VOLUME_COLOR)) {
/* the RGB is "premultiplied" by density for better interpolation results */
FluidDomainSettings_color_grid_get_length(&b_domain.ptr, &length);
if (length == num_pixels * 4) {
FluidDomainSettings_color_grid_get(&b_domain.ptr, pixels);
return true;
}
}
else if (builtin_name == Attribute::standard_name(ATTR_STD_VOLUME_VELOCITY)) {
FluidDomainSettings_velocity_grid_get_length(&b_domain.ptr, &length);
if (length == num_pixels * 3) {
FluidDomainSettings_velocity_grid_get(&b_domain.ptr, pixels);
return true;
}
}
else if (builtin_name == Attribute::standard_name(ATTR_STD_VOLUME_HEAT)) {
FluidDomainSettings_heat_grid_get_length(&b_domain.ptr, &length);
if (length == num_pixels) {
FluidDomainSettings_heat_grid_get(&b_domain.ptr, pixels);
return true;
}
}
else if (builtin_name == Attribute::standard_name(ATTR_STD_VOLUME_TEMPERATURE)) {
FluidDomainSettings_temperature_grid_get_length(&b_domain.ptr, &length);
if (length == num_pixels) {
FluidDomainSettings_temperature_grid_get(&b_domain.ptr, pixels);
return true;
}
}
else {
fprintf(
stderr, "Cycles error: unknown volume attribute %s, skipping\n", builtin_name.c_str());
pixels[0] = 0.0f;
return false;
}
#endif
fprintf(stderr, "Cycles error: unexpected smoke volume resolution, skipping\n");
}
else {
/* We originally were passing view_layer here but in reality we need a
* a depsgraph to pass to the RE_point_density_minmax() function.
*/
/* TODO(sergey): Check we're indeed in shader node tree. */
PointerRNA ptr;
RNA_pointer_create(NULL, &RNA_Node, builtin_data, &ptr);
BL::Node b_node(ptr);
if (b_node.is_a(&RNA_ShaderNodeTexPointDensity)) {
BL::ShaderNodeTexPointDensity b_point_density_node(b_node);
int length;
b_point_density_node.calc_point_density(b_depsgraph, &length, &pixels);
unsigned char *image_pixels = image_get_pixels_for_frame(b_image, frame, tile);
if (image_pixels && num_pixels * channels == pixels_size) {
memcpy(pixels, image_pixels, pixels_size * sizeof(unsigned char));
}
else {
if (channels == 1) {
memset(pixels, 0, pixels_size * sizeof(unsigned char));
}
else {
const size_t num_pixels_safe = pixels_size / channels;
unsigned char *cp = (unsigned char *)pixels;
for (size_t i = 0; i < num_pixels_safe; i++, cp += channels) {
cp[0] = 255;
cp[1] = 0;
cp[2] = 255;
if (channels == 4) {
cp[3] = 255;
}
}
}
}
if (image_pixels) {
MEM_freeN(image_pixels);
}
if (associate_alpha) {
/* Premultiply, byte images are always straight for Blender. */
unsigned char *cp = (unsigned char *)pixels;
for (size_t i = 0; i < num_pixels; i++, cp += channels) {
cp[0] = (cp[0] * cp[3]) >> 8;
cp[1] = (cp[1] * cp[3]) >> 8;
cp[2] = (cp[2] * cp[3]) >> 8;
}
}
}
return false;
/* Free image buffers to save memory during render. */
if (free_cache) {
b_image.buffers_free();
}
return true;
}
string BlenderImageLoader::name() const
{
return BL::Image(b_image).name();
}
bool BlenderImageLoader::equals(const ImageLoader &other) const
{
const BlenderImageLoader &other_loader = (const BlenderImageLoader &)other;
return b_image == other_loader.b_image && frame == other_loader.frame;
}
/* Point Density */
BlenderPointDensityLoader::BlenderPointDensityLoader(BL::Depsgraph b_depsgraph,
BL::ShaderNodeTexPointDensity b_node)
: b_depsgraph(b_depsgraph), b_node(b_node)
{
}
bool BlenderPointDensityLoader::load_metadata(ImageMetaData &metadata)
{
metadata.channels = 4;
metadata.width = b_node.resolution();
metadata.height = metadata.width;
metadata.depth = metadata.width;
metadata.type = IMAGE_DATA_TYPE_FLOAT4;
return true;
}
bool BlenderPointDensityLoader::load_pixels(const ImageMetaData &,
void *pixels,
const size_t,
const bool)
{
int length;
b_node.calc_point_density(b_depsgraph, &length, (float **)&pixels);
return true;
}
void BlenderSession::builtin_images_load()
@@ -357,4 +206,15 @@ void BlenderSession::builtin_images_load()
manager->device_load_builtin(device, session->scene, session->progress);
}
string BlenderPointDensityLoader::name() const
{
return BL::ShaderNodeTexPointDensity(b_node).name();
}
bool BlenderPointDensityLoader::equals(const ImageLoader &other) const
{
const BlenderPointDensityLoader &other_loader = (const BlenderPointDensityLoader &)other;
return b_node == other_loader.b_node && b_depsgraph == other_loader.b_depsgraph;
}
CCL_NAMESPACE_END

View File

@@ -0,0 +1,61 @@
/*
* Copyright 2011-2020 Blender Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef __BLENDER_IMAGE_H__
#define __BLENDER_IMAGE_H__
#include "RNA_blender_cpp.h"
#include "render/image.h"
CCL_NAMESPACE_BEGIN
class BlenderImageLoader : public ImageLoader {
public:
BlenderImageLoader(BL::Image b_image, int frame);
bool load_metadata(ImageMetaData &metadata) override;
bool load_pixels(const ImageMetaData &metadata,
void *pixels,
const size_t pixels_size,
const bool associate_alpha) override;
string name() const override;
bool equals(const ImageLoader &other) const override;
BL::Image b_image;
int frame;
bool free_cache;
};
class BlenderPointDensityLoader : public ImageLoader {
public:
BlenderPointDensityLoader(BL::Depsgraph depsgraph, BL::ShaderNodeTexPointDensity b_node);
bool load_metadata(ImageMetaData &metadata) override;
bool load_pixels(const ImageMetaData &metadata,
void *pixels,
const size_t pixels_size,
const bool associate_alpha) override;
string name() const override;
bool equals(const ImageLoader &other) const override;
BL::Depsgraph b_depsgraph;
BL::ShaderNodeTexPointDensity b_node;
};
CCL_NAMESPACE_END
#endif /* __BLENDER_IMAGE_H__ */

View File

@@ -14,25 +14,25 @@
* limitations under the License.
*/
#include "render/camera.h"
#include "render/colorspace.h"
#include "render/mesh.h"
#include "render/object.h"
#include "render/scene.h"
#include "render/camera.h"
#include "blender/blender_sync.h"
#include "blender/blender_session.h"
#include "blender/blender_sync.h"
#include "blender/blender_util.h"
#include "subd/subd_patch.h"
#include "subd/subd_split.h"
#include "util/util_algorithm.h"
#include "util/util_disjoint_set.h"
#include "util/util_foreach.h"
#include "util/util_hash.h"
#include "util/util_logging.h"
#include "util/util_math.h"
#include "util/util_disjoint_set.h"
#include "mikktspace.h"

View File

@@ -15,14 +15,14 @@
*/
#include "render/camera.h"
#include "render/integrator.h"
#include "render/graph.h"
#include "render/integrator.h"
#include "render/light.h"
#include "render/mesh.h"
#include "render/object.h"
#include "render/scene.h"
#include "render/nodes.h"
#include "render/object.h"
#include "render/particles.h"
#include "render/scene.h"
#include "render/shader.h"
#include "blender/blender_object_cull.h"
@@ -67,10 +67,20 @@ bool BlenderSync::object_is_mesh(BL::Object &b_ob)
return false;
}
if (b_ob.type() == BL::Object::type_CURVE) {
BL::Object::type_enum type = b_ob.type();
#ifdef WITH_NEW_OBJECT_TYPES
if (type == BL::Object::type_VOLUME || type == BL::Object::type_HAIR) {
#else
if (type == BL::Object::type_VOLUME) {
#endif
/* Will be exported attached to mesh. */
return true;
}
else if (type == BL::Object::type_CURVE) {
/* Skip exporting curves without faces, overhead can be
* significant if there are many for path animation. */
BL::Curve b_curve(b_ob.data());
BL::Curve b_curve(b_ob_data);
return (b_curve.bevel_object() || b_curve.extrude() != 0.0f || b_curve.bevel_depth() != 0.0f ||
b_curve.dimensions() == BL::Curve::dimensions_2D || b_ob.modifiers.length());

View File

@@ -19,8 +19,8 @@
#include "blender/CCL_api.h"
#include "blender/blender_device.h"
#include "blender/blender_sync.h"
#include "blender/blender_session.h"
#include "blender/blender_sync.h"
#include "blender/blender_util.h"
#include "render/denoising.h"
@@ -38,8 +38,8 @@
#ifdef WITH_OSL
# include "render/osl.h"
# include <OSL/oslquery.h>
# include <OSL/oslconfig.h>
# include <OSL/oslquery.h>
#endif
#ifdef WITH_OPENCL

View File

@@ -41,8 +41,8 @@
#include "util/util_progress.h"
#include "util/util_time.h"
#include "blender/blender_sync.h"
#include "blender/blender_session.h"
#include "blender/blender_sync.h"
#include "blender/blender_util.h"
CCL_NAMESPACE_BEGIN
@@ -138,14 +138,6 @@ void BlenderSession::create_session()
scene = new Scene(scene_params, session->device);
scene->name = b_scene.name();
/* setup callbacks for builtin image support */
scene->image_manager->builtin_image_info_cb = function_bind(
&BlenderSession::builtin_image_info, this, _1, _2, _3);
scene->image_manager->builtin_image_pixels_cb = function_bind(
&BlenderSession::builtin_image_pixels, this, _1, _2, _3, _4, _5, _6, _7);
scene->image_manager->builtin_image_float_pixels_cb = function_bind(
&BlenderSession::builtin_image_float_pixels, this, _1, _2, _3, _4, _5, _6, _7);
session->scene = scene;
/* There is no single depsgraph to use for the entire render.

View File

@@ -157,22 +157,6 @@ class BlenderSession {
bool do_update_only);
void do_write_update_render_tile(RenderTile &rtile, bool do_update_only, bool highlight);
int builtin_image_frame(const string &builtin_name);
void builtin_image_info(const string &builtin_name, void *builtin_data, ImageMetaData &metadata);
bool builtin_image_pixels(const string &builtin_name,
void *builtin_data,
int tile,
unsigned char *pixels,
const size_t pixels_size,
const bool associate_alpha,
const bool free_cache);
bool builtin_image_float_pixels(const string &builtin_name,
void *builtin_data,
int tile,
float *pixels,
const size_t pixels_size,
const bool associate_alpha,
const bool free_cache);
void builtin_images_load();
/* Update tile manager to reflect resumable render settings. */

View File

@@ -23,14 +23,15 @@
#include "render/scene.h"
#include "render/shader.h"
#include "blender/blender_texture.h"
#include "blender/blender_image.h"
#include "blender/blender_sync.h"
#include "blender/blender_texture.h"
#include "blender/blender_util.h"
#include "util/util_debug.h"
#include "util/util_foreach.h"
#include "util/util_string.h"
#include "util/util_set.h"
#include "util/util_string.h"
#include "util/util_task.h"
CCL_NAMESPACE_BEGIN
@@ -619,16 +620,16 @@ static ShaderNode *add_node(Scene *scene,
/* create script node */
BL::ShaderNodeScript b_script_node(b_node);
OSLShaderManager *manager = (OSLShaderManager *)scene->shader_manager;
ShaderManager *manager = scene->shader_manager;
string bytecode_hash = b_script_node.bytecode_hash();
if (!bytecode_hash.empty()) {
node = manager->osl_node("", bytecode_hash, b_script_node.bytecode());
node = OSLShaderManager::osl_node(manager, "", bytecode_hash, b_script_node.bytecode());
}
else {
string absolute_filepath = blender_absolute_path(
b_data, b_ntree, b_script_node.filepath());
node = manager->osl_node(absolute_filepath, "");
node = OSLShaderManager::osl_node(manager, absolute_filepath, "");
}
}
#else
@@ -650,6 +651,18 @@ static ShaderNode *add_node(Scene *scene,
get_tex_mapping(&image->tex_mapping, b_texture_mapping);
if (b_image) {
PointerRNA colorspace_ptr = b_image.colorspace_settings().ptr;
image->colorspace = get_enum_identifier(colorspace_ptr, "name");
image->animated = b_image_node.image_user().use_auto_refresh();
image->alpha_type = get_image_alpha_type(b_image);
image->tiles.clear();
BL::Image::tiles_iterator b_iter;
for (b_image.tiles.begin(b_iter); b_iter != b_image.tiles.end(); ++b_iter) {
image->tiles.push_back(b_iter->number());
}
/* builtin images will use callback-based reading because
* they could only be loaded correct from blender side
*/
@@ -666,34 +679,13 @@ static ShaderNode *add_node(Scene *scene,
*/
int scene_frame = b_scene.frame_current();
int image_frame = image_user_frame_number(b_image_user, scene_frame);
image->filename = b_image.name() + "@" + string_printf("%d", image_frame);
image->builtin_data = b_image.ptr.data;
image->handle = scene->image_manager->add_image(
new BlenderImageLoader(b_image, image_frame), image->image_params());
}
else {
image->filename = image_user_file_path(
b_image_user, b_image, b_scene.frame_current(), true);
image->builtin_data = NULL;
}
PointerRNA colorspace_ptr = b_image.colorspace_settings().ptr;
image->colorspace = get_enum_identifier(colorspace_ptr, "name");
image->animated = b_image_node.image_user().use_auto_refresh();
image->alpha_type = get_image_alpha_type(b_image);
image->tiles.clear();
BL::Image::tiles_iterator b_iter;
for (b_image.tiles.begin(b_iter); b_iter != b_image.tiles.end(); ++b_iter) {
image->tiles.push_back(b_iter->number());
}
/* TODO: restore */
/* TODO(sergey): Does not work properly when we change builtin type. */
#if 0
if (b_image.is_updated()) {
scene->image_manager->tag_reload_image(image->image_key());
}
#endif
}
node = image;
}
@@ -709,6 +701,12 @@ static ShaderNode *add_node(Scene *scene,
get_tex_mapping(&env->tex_mapping, b_texture_mapping);
if (b_image) {
PointerRNA colorspace_ptr = b_image.colorspace_settings().ptr;
env->colorspace = get_enum_identifier(colorspace_ptr, "name");
env->animated = b_env_node.image_user().use_auto_refresh();
env->alpha_type = get_image_alpha_type(b_image);
bool is_builtin = b_image.packed_file() || b_image.source() == BL::Image::source_GENERATED ||
b_image.source() == BL::Image::source_MOVIE ||
(b_engine.is_preview() && b_image.source() != BL::Image::source_SEQUENCE);
@@ -716,28 +714,13 @@ static ShaderNode *add_node(Scene *scene,
if (is_builtin) {
int scene_frame = b_scene.frame_current();
int image_frame = image_user_frame_number(b_image_user, scene_frame);
env->filename = b_image.name() + "@" + string_printf("%d", image_frame);
env->builtin_data = b_image.ptr.data;
env->handle = scene->image_manager->add_image(new BlenderImageLoader(b_image, image_frame),
env->image_params());
}
else {
env->filename = image_user_file_path(
b_image_user, b_image, b_scene.frame_current(), false);
env->builtin_data = NULL;
}
PointerRNA colorspace_ptr = b_image.colorspace_settings().ptr;
env->colorspace = get_enum_identifier(colorspace_ptr, "name");
env->animated = b_env_node.image_user().use_auto_refresh();
env->alpha_type = get_image_alpha_type(b_image);
/* TODO: restore */
/* TODO(sergey): Does not work properly when we change builtin type. */
#if 0
if (b_image.is_updated()) {
scene->image_manager->tag_reload_image(env->image_key());
}
#endif
}
node = env;
}
@@ -881,18 +864,13 @@ static ShaderNode *add_node(Scene *scene,
else if (b_node.is_a(&RNA_ShaderNodeTexPointDensity)) {
BL::ShaderNodeTexPointDensity b_point_density_node(b_node);
PointDensityTextureNode *point_density = new PointDensityTextureNode();
point_density->filename = b_point_density_node.name();
point_density->space = (NodeTexVoxelSpace)b_point_density_node.space();
point_density->interpolation = get_image_interpolation(b_point_density_node);
point_density->builtin_data = b_point_density_node.ptr.data;
point_density->image_manager = scene->image_manager;
point_density->handle = scene->image_manager->add_image(
new BlenderPointDensityLoader(b_depsgraph, b_point_density_node),
point_density->image_params());
/* TODO(sergey): Use more proper update flag. */
if (true) {
point_density->add_image();
b_point_density_node.cache_point_density(b_depsgraph);
scene->image_manager->tag_reload_image(point_density->image_key());
}
b_point_density_node.cache_point_density(b_depsgraph);
node = point_density;
/* Transformation form world space to texture space.
@@ -1282,6 +1260,7 @@ void BlenderSync::sync_materials(BL::Depsgraph &b_depsgraph, bool update_all)
shader->heterogeneous_volume = !get_boolean(cmat, "homogeneous_volume");
shader->volume_sampling_method = get_volume_sampling(cmat);
shader->volume_interpolation_method = get_volume_interpolation(cmat);
shader->volume_step_rate = get_float(cmat, "volume_step_rate");
shader->displacement_method = get_displacement_method(cmat);
shader->set_graph(graph);
@@ -1346,6 +1325,7 @@ void BlenderSync::sync_world(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d,
shader->heterogeneous_volume = !get_boolean(cworld, "homogeneous_volume");
shader->volume_sampling_method = get_volume_sampling(cworld);
shader->volume_interpolation_method = get_volume_interpolation(cworld);
shader->volume_step_rate = get_float(cworld, "volume_step_size");
}
else if (new_viewport_parameters.use_scene_world && b_world) {
BackgroundNode *background = new BackgroundNode();

View File

@@ -16,6 +16,7 @@
#include "render/background.h"
#include "render/camera.h"
#include "render/curves.h"
#include "render/film.h"
#include "render/graph.h"
#include "render/integrator.h"
@@ -25,19 +26,18 @@
#include "render/object.h"
#include "render/scene.h"
#include "render/shader.h"
#include "render/curves.h"
#include "device/device.h"
#include "blender/blender_device.h"
#include "blender/blender_sync.h"
#include "blender/blender_session.h"
#include "blender/blender_sync.h"
#include "blender/blender_util.h"
#include "util/util_debug.h"
#include "util/util_foreach.h"
#include "util/util_opengl.h"
#include "util/util_hash.h"
#include "util/util_opengl.h"
CCL_NAMESPACE_BEGIN
@@ -178,6 +178,11 @@ void BlenderSync::sync_recalc(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d
world_recalc = true;
}
}
/* Volume */
else if (b_id.is_a(&RNA_Volume)) {
BL::Volume b_volume(b_id);
geometry_map.set_recalc(b_volume);
}
}
BlenderViewportParameters new_viewport_parameters(b_v3d);
@@ -257,7 +262,8 @@ void BlenderSync::sync_integrator()
integrator->transparent_max_bounce = get_int(cscene, "transparent_max_bounces");
integrator->volume_max_steps = get_int(cscene, "volume_max_steps");
integrator->volume_step_size = get_float(cscene, "volume_step_size");
integrator->volume_step_rate = (preview) ? get_float(cscene, "volume_preview_step_rate") :
get_float(cscene, "volume_step_rate");
integrator->caustics_reflective = get_boolean(cscene, "caustics_reflective");
integrator->caustics_refractive = get_boolean(cscene, "caustics_refractive");
@@ -405,6 +411,7 @@ void BlenderSync::sync_view_layer(BL::SpaceView3D & /*b_v3d*/, BL::ViewLayer &b_
view_layer.use_background_ao = b_view_layer.use_ao();
view_layer.use_surfaces = b_view_layer.use_solid();
view_layer.use_hair = b_view_layer.use_strand();
view_layer.use_volumes = b_view_layer.use_volumes();
/* Material override. */
view_layer.material_override = b_view_layer.material_override();
@@ -626,11 +633,11 @@ vector<Pass> BlenderSync::sync_render_passes(BL::RenderLayer &b_rlay,
/* Cryptomatte stores two ID/weight pairs per RGBA layer.
* User facing parameter is the number of pairs. */
int crypto_depth = min(16, get_int(crp, "pass_crypto_depth")) / 2;
int crypto_depth = divide_up(min(16, get_int(crp, "pass_crypto_depth")), 2);
scene->film->cryptomatte_depth = crypto_depth;
scene->film->cryptomatte_passes = CRYPT_NONE;
if (get_boolean(crp, "use_pass_crypto_object")) {
for (int i = 0; i < crypto_depth; ++i) {
for (int i = 0; i < crypto_depth; i++) {
string passname = cryptomatte_prefix + string_printf("Object%02d", i);
b_engine.add_pass(passname.c_str(), 4, "RGBA", b_view_layer.name().c_str());
Pass::add(PASS_CRYPTOMATTE, passes, passname.c_str());
@@ -639,7 +646,7 @@ vector<Pass> BlenderSync::sync_render_passes(BL::RenderLayer &b_rlay,
CRYPT_OBJECT);
}
if (get_boolean(crp, "use_pass_crypto_material")) {
for (int i = 0; i < crypto_depth; ++i) {
for (int i = 0; i < crypto_depth; i++) {
string passname = cryptomatte_prefix + string_printf("Material%02d", i);
b_engine.add_pass(passname.c_str(), 4, "RGBA", b_view_layer.name().c_str());
Pass::add(PASS_CRYPTOMATTE, passes, passname.c_str());
@@ -648,7 +655,7 @@ vector<Pass> BlenderSync::sync_render_passes(BL::RenderLayer &b_rlay,
CRYPT_MATERIAL);
}
if (get_boolean(crp, "use_pass_crypto_asset")) {
for (int i = 0; i < crypto_depth; ++i) {
for (int i = 0; i < crypto_depth; i++) {
string passname = cryptomatte_prefix + string_printf("Asset%02d", i);
b_engine.add_pass(passname.c_str(), 4, "RGBA", b_view_layer.name().c_str());
Pass::add(PASS_CRYPTOMATTE, passes, passname.c_str());

View File

@@ -18,9 +18,9 @@
#define __BLENDER_SYNC_H__
#include "MEM_guardedalloc.h"
#include "RNA_types.h"
#include "RNA_access.h"
#include "RNA_blender_cpp.h"
#include "RNA_types.h"
#include "blender/blender_id_map.h"
#include "blender/blender_viewport.h"
@@ -157,6 +157,7 @@ class BlenderSync {
BL::Object b_ob,
Geometry *geom,
int motion_step);
void sync_hair(Hair *hair, BL::Object &b_ob, bool motion, int motion_step = 0);
void sync_particle_hair(
Geometry *geom, BL::Mesh &b_mesh, BL::Object &b_ob, bool motion, int motion_step = 0);
void sync_curve_settings();
@@ -236,6 +237,7 @@ class BlenderSync {
use_background_ao(true),
use_surfaces(true),
use_hair(true),
use_volumes(true),
samples(0),
bound_samples(false)
{
@@ -247,6 +249,7 @@ class BlenderSync {
bool use_background_ao;
bool use_surfaces;
bool use_hair;
bool use_volumes;
int samples;
bool bound_samples;
} view_layer;

View File

@@ -17,8 +17,8 @@
#ifndef __BLENDER_TEXTURE_H__
#define __BLENDER_TEXTURE_H__
#include <stdlib.h>
#include "blender/blender_sync.h"
#include <stdlib.h>
CCL_NAMESPACE_BEGIN

View File

@@ -18,9 +18,9 @@
#define __BLENDER_VIEWPORT_H__
#include "MEM_guardedalloc.h"
#include "RNA_types.h"
#include "RNA_access.h"
#include "RNA_blender_cpp.h"
#include "RNA_types.h"
#include "render/film.h"
#include "util/util_param.h"

View File

@@ -1,4 +1,3 @@
/*
* Copyright 2011-2013 Blender Foundation
*
@@ -16,14 +15,177 @@
*/
#include "render/colorspace.h"
#include "render/image.h"
#include "render/image_vdb.h"
#include "render/mesh.h"
#include "render/object.h"
#include "blender/blender_sync.h"
#include "blender/blender_util.h"
#ifdef WITH_OPENVDB
# include <openvdb/openvdb.h>
openvdb::GridBase::ConstPtr BKE_volume_grid_openvdb_for_read(const struct Volume *volume,
struct VolumeGrid *grid);
#endif
CCL_NAMESPACE_BEGIN
/* TODO: verify this is not loading unnecessary attributes. */
class BlenderSmokeLoader : public ImageLoader {
public:
BlenderSmokeLoader(const BL::Object &b_ob, AttributeStandard attribute)
: b_ob(b_ob), attribute(attribute)
{
}
bool load_metadata(ImageMetaData &metadata) override
{
BL::FluidDomainSettings b_domain = object_fluid_gas_domain_find(b_ob);
if (!b_domain) {
return false;
}
if (attribute == ATTR_STD_VOLUME_DENSITY || attribute == ATTR_STD_VOLUME_FLAME ||
attribute == ATTR_STD_VOLUME_HEAT || attribute == ATTR_STD_VOLUME_TEMPERATURE) {
metadata.type = IMAGE_DATA_TYPE_FLOAT;
metadata.channels = 1;
}
else if (attribute == ATTR_STD_VOLUME_COLOR) {
metadata.type = IMAGE_DATA_TYPE_FLOAT4;
metadata.channels = 4;
}
else if (attribute == ATTR_STD_VOLUME_VELOCITY) {
metadata.type = IMAGE_DATA_TYPE_FLOAT4;
metadata.channels = 3;
}
else {
return false;
}
int3 resolution = get_int3(b_domain.domain_resolution());
int amplify = (b_domain.use_noise()) ? b_domain.noise_scale() : 1;
/* Velocity and heat data is always low-resolution. */
if (attribute == ATTR_STD_VOLUME_VELOCITY || attribute == ATTR_STD_VOLUME_HEAT) {
amplify = 1;
}
metadata.width = resolution.x * amplify;
metadata.height = resolution.y * amplify;
metadata.depth = resolution.z * amplify;
/* Create a matrix to transform from object space to mesh texture space.
* This does not work with deformations but that can probably only be done
* well with a volume grid mapping of coordinates. */
BL::Mesh b_mesh(b_ob.data());
float3 loc, size;
mesh_texture_space(b_mesh, loc, size);
metadata.transform_3d = transform_translate(-loc) * transform_scale(size);
metadata.use_transform_3d = true;
return true;
}
bool load_pixels(const ImageMetaData &, void *pixels, const size_t, const bool) override
{
/* smoke volume data */
BL::FluidDomainSettings b_domain = object_fluid_gas_domain_find(b_ob);
if (!b_domain) {
return false;
}
#ifdef WITH_FLUID
int3 resolution = get_int3(b_domain.domain_resolution());
int length, amplify = (b_domain.use_noise()) ? b_domain.noise_scale() : 1;
/* Velocity and heat data is always low-resolution. */
if (attribute == ATTR_STD_VOLUME_VELOCITY || attribute == ATTR_STD_VOLUME_HEAT) {
amplify = 1;
}
const int width = resolution.x * amplify;
const int height = resolution.y * amplify;
const int depth = resolution.z * amplify;
const size_t num_pixels = ((size_t)width) * height * depth;
float *fpixels = (float *)pixels;
if (attribute == ATTR_STD_VOLUME_DENSITY) {
FluidDomainSettings_density_grid_get_length(&b_domain.ptr, &length);
if (length == num_pixels) {
FluidDomainSettings_density_grid_get(&b_domain.ptr, fpixels);
return true;
}
}
else if (attribute == ATTR_STD_VOLUME_FLAME) {
/* this is in range 0..1, and interpreted by the OpenGL smoke viewer
* as 1500..3000 K with the first part faded to zero density */
FluidDomainSettings_flame_grid_get_length(&b_domain.ptr, &length);
if (length == num_pixels) {
FluidDomainSettings_flame_grid_get(&b_domain.ptr, fpixels);
return true;
}
}
else if (attribute == ATTR_STD_VOLUME_COLOR) {
/* the RGB is "premultiplied" by density for better interpolation results */
FluidDomainSettings_color_grid_get_length(&b_domain.ptr, &length);
if (length == num_pixels * 4) {
FluidDomainSettings_color_grid_get(&b_domain.ptr, fpixels);
return true;
}
}
else if (attribute == ATTR_STD_VOLUME_VELOCITY) {
FluidDomainSettings_velocity_grid_get_length(&b_domain.ptr, &length);
if (length == num_pixels * 3) {
FluidDomainSettings_velocity_grid_get(&b_domain.ptr, fpixels);
return true;
}
}
else if (attribute == ATTR_STD_VOLUME_HEAT) {
FluidDomainSettings_heat_grid_get_length(&b_domain.ptr, &length);
if (length == num_pixels) {
FluidDomainSettings_heat_grid_get(&b_domain.ptr, fpixels);
return true;
}
}
else if (attribute == ATTR_STD_VOLUME_TEMPERATURE) {
FluidDomainSettings_temperature_grid_get_length(&b_domain.ptr, &length);
if (length == num_pixels) {
FluidDomainSettings_temperature_grid_get(&b_domain.ptr, fpixels);
return true;
}
}
else {
fprintf(stderr,
"Cycles error: unknown volume attribute %s, skipping\n",
Attribute::standard_name(attribute));
fpixels[0] = 0.0f;
return false;
}
#else
(void)pixels;
#endif
fprintf(stderr, "Cycles error: unexpected smoke volume resolution, skipping\n");
return false;
}
string name() const override
{
return Attribute::standard_name(attribute);
}
bool equals(const ImageLoader &other) const override
{
const BlenderSmokeLoader &other_loader = (const BlenderSmokeLoader &)other;
return b_ob == other_loader.b_ob && attribute == other_loader.attribute;
}
BL::Object b_ob;
AttributeStandard attribute;
};
static void sync_smoke_volume(Scene *scene, BL::Object &b_ob, Mesh *mesh, float frame)
{
BL::FluidDomainSettings b_domain = object_fluid_gas_domain_find(b_ob);
@@ -31,7 +193,6 @@ static void sync_smoke_volume(Scene *scene, BL::Object &b_ob, Mesh *mesh, float
return;
}
ImageManager *image_manager = scene->image_manager;
AttributeStandard attributes[] = {ATTR_STD_VOLUME_DENSITY,
ATTR_STD_VOLUME_COLOR,
ATTR_STD_VOLUME_FLAME,
@@ -46,47 +207,172 @@ static void sync_smoke_volume(Scene *scene, BL::Object &b_ob, Mesh *mesh, float
continue;
}
mesh->volume_isovalue = b_domain.clipping();
mesh->volume_clipping = b_domain.clipping();
Attribute *attr = mesh->attributes.add(std);
VoxelAttribute *volume_data = attr->data_voxel();
ImageMetaData metadata;
ImageKey key;
key.filename = Attribute::standard_name(std);
key.builtin_data = b_ob.ptr.data;
ImageLoader *loader = new BlenderSmokeLoader(b_ob, std);
ImageParams params;
params.frame = frame;
volume_data->manager = image_manager;
volume_data->slot = image_manager->add_image(key, frame, metadata);
attr->data_voxel() = scene->image_manager->add_image(loader, params);
}
}
class BlenderVolumeLoader : public VDBImageLoader {
public:
BlenderVolumeLoader(BL::Volume b_volume, const string &grid_name)
: VDBImageLoader(grid_name),
b_volume(b_volume),
b_volume_grid(PointerRNA_NULL),
unload(false)
{
#ifdef WITH_OPENVDB
/* Find grid with matching name. */
BL::Volume::grids_iterator b_grid_iter;
for (b_volume.grids.begin(b_grid_iter); b_grid_iter != b_volume.grids.end(); ++b_grid_iter) {
if (b_grid_iter->name() == grid_name) {
b_volume_grid = *b_grid_iter;
}
}
#endif
}
/* Create a matrix to transform from object space to mesh texture space.
* This does not work with deformations but that can probably only be done
* well with a volume grid mapping of coordinates. */
if (mesh->need_attribute(scene, ATTR_STD_GENERATED_TRANSFORM)) {
Attribute *attr = mesh->attributes.add(ATTR_STD_GENERATED_TRANSFORM);
Transform *tfm = attr->data_transform();
bool load_metadata(ImageMetaData &metadata) override
{
if (!b_volume_grid) {
return false;
}
BL::Mesh b_mesh(b_ob.data());
float3 loc, size;
mesh_texture_space(b_mesh, loc, size);
unload = !b_volume_grid.is_loaded();
*tfm = transform_translate(-loc) * transform_scale(size);
#ifdef WITH_OPENVDB
Volume *volume = (Volume *)b_volume.ptr.data;
VolumeGrid *volume_grid = (VolumeGrid *)b_volume_grid.ptr.data;
grid = BKE_volume_grid_openvdb_for_read(volume, volume_grid);
#endif
return VDBImageLoader::load_metadata(metadata);
}
bool load_pixels(const ImageMetaData &metadata,
void *pixels,
const size_t pixel_size,
const bool associate_alpha) override
{
if (!b_volume_grid) {
return false;
}
return VDBImageLoader::load_pixels(metadata, pixels, pixel_size, associate_alpha);
}
bool equals(const ImageLoader &other) const override
{
/* TODO: detect multiple volume datablocks with the same filepath. */
const BlenderVolumeLoader &other_loader = (const BlenderVolumeLoader &)other;
return b_volume == other_loader.b_volume && b_volume_grid == other_loader.b_volume_grid;
}
void cleanup() override
{
VDBImageLoader::cleanup();
if (b_volume_grid && unload) {
b_volume_grid.unload();
}
}
BL::Volume b_volume;
BL::VolumeGrid b_volume_grid;
bool unload;
};
static void sync_volume_object(BL::BlendData &b_data, BL::Object &b_ob, Scene *scene, Mesh *mesh)
{
BL::Volume b_volume(b_ob.data());
b_volume.grids.load(b_data.ptr.data);
BL::VolumeRender b_render(b_volume.render());
mesh->volume_clipping = b_render.clipping();
mesh->volume_step_size = b_render.step_size();
mesh->volume_object_space = (b_render.space() == BL::VolumeRender::space_OBJECT);
/* Find grid with matching name. */
BL::Volume::grids_iterator b_grid_iter;
for (b_volume.grids.begin(b_grid_iter); b_grid_iter != b_volume.grids.end(); ++b_grid_iter) {
BL::VolumeGrid b_grid = *b_grid_iter;
ustring name = ustring(b_grid.name());
AttributeStandard std = ATTR_STD_NONE;
if (name == Attribute::standard_name(ATTR_STD_VOLUME_DENSITY)) {
std = ATTR_STD_VOLUME_DENSITY;
}
else if (name == Attribute::standard_name(ATTR_STD_VOLUME_COLOR)) {
std = ATTR_STD_VOLUME_COLOR;
}
else if (name == Attribute::standard_name(ATTR_STD_VOLUME_FLAME)) {
std = ATTR_STD_VOLUME_FLAME;
}
else if (name == Attribute::standard_name(ATTR_STD_VOLUME_HEAT)) {
std = ATTR_STD_VOLUME_HEAT;
}
else if (name == Attribute::standard_name(ATTR_STD_VOLUME_TEMPERATURE)) {
std = ATTR_STD_VOLUME_TEMPERATURE;
}
else if (name == Attribute::standard_name(ATTR_STD_VOLUME_VELOCITY)) {
std = ATTR_STD_VOLUME_VELOCITY;
}
if ((std != ATTR_STD_NONE && mesh->need_attribute(scene, std)) ||
mesh->need_attribute(scene, name)) {
Attribute *attr = (std != ATTR_STD_NONE) ?
mesh->attributes.add(std) :
mesh->attributes.add(name, TypeDesc::TypeFloat, ATTR_ELEMENT_VOXEL);
ImageLoader *loader = new BlenderVolumeLoader(b_volume, name.string());
ImageParams params;
params.frame = b_volume.grids.frame();
attr->data_voxel() = scene->image_manager->add_image(loader, params);
}
}
}
/* If the voxel attributes change, we need to rebuild the bounding mesh. */
static vector<int> get_voxel_image_slots(Mesh *mesh)
{
vector<int> slots;
for (const Attribute &attr : mesh->attributes.attributes) {
if (attr.element == ATTR_ELEMENT_VOXEL) {
slots.push_back(attr.data_voxel().svm_slot());
}
}
return slots;
}
void BlenderSync::sync_volume(BL::Object &b_ob, Mesh *mesh, const vector<Shader *> &used_shaders)
{
bool old_has_voxel_attributes = mesh->has_voxel_attributes();
vector<int> old_voxel_slots = get_voxel_image_slots(mesh);
mesh->clear();
mesh->used_shaders = used_shaders;
/* Smoke domain. */
sync_smoke_volume(scene, b_ob, mesh, b_scene.frame_current());
if (view_layer.use_volumes) {
if (b_ob.type() == BL::Object::type_VOLUME) {
/* Volume object. Create only attributes, bounding mesh will then
* be automatically generated later. */
sync_volume_object(b_data, b_ob, scene, mesh);
}
else {
/* Smoke domain. */
sync_smoke_volume(scene, b_ob, mesh, b_scene.frame_current());
}
}
/* Tag update. */
bool rebuild = (old_has_voxel_attributes != mesh->has_voxel_attributes());
bool rebuild = (old_voxel_slots != get_voxel_image_slots(mesh));
mesh->tag_update(scene, rebuild);
}

View File

@@ -535,8 +535,9 @@ void BVH::pack_instances(size_t nodes_size, size_t leaf_nodes_size)
/* Modify offsets into arrays */
int4 data = bvh_nodes[i + nsize_bbox];
int4 data1 = bvh_nodes[i + nsize_bbox - 1];
if (use_obvh) {
int4 data1 = bvh_nodes[i + nsize_bbox - 1];
data.z += (data.z < 0) ? -noffset_leaf : noffset;
data.w += (data.w < 0) ? -noffset_leaf : noffset;
data.x += (data.x < 0) ? -noffset_leaf : noffset;
@@ -545,6 +546,8 @@ void BVH::pack_instances(size_t nodes_size, size_t leaf_nodes_size)
data1.w += (data1.w < 0) ? -noffset_leaf : noffset;
data1.x += (data1.x < 0) ? -noffset_leaf : noffset;
data1.y += (data1.y < 0) ? -noffset_leaf : noffset;
pack_nodes[pack_nodes_offset + nsize_bbox] = data;
pack_nodes[pack_nodes_offset + nsize_bbox - 1] = data1;
}
else {
data.z += (data.z < 0) ? -noffset_leaf : noffset;
@@ -553,10 +556,7 @@ void BVH::pack_instances(size_t nodes_size, size_t leaf_nodes_size)
data.x += (data.x < 0) ? -noffset_leaf : noffset;
data.y += (data.y < 0) ? -noffset_leaf : noffset;
}
}
pack_nodes[pack_nodes_offset + nsize_bbox] = data;
if (use_obvh) {
pack_nodes[pack_nodes_offset + nsize_bbox - 1] = data1;
pack_nodes[pack_nodes_offset + nsize_bbox] = data;
}
/* Usually this copies nothing, but we better

View File

@@ -22,20 +22,20 @@
#include "bvh/bvh_params.h"
#include "bvh_split.h"
#include "render/curves.h"
#include "render/hair.h"
#include "render/mesh.h"
#include "render/object.h"
#include "render/scene.h"
#include "render/curves.h"
#include "util/util_algorithm.h"
#include "util/util_foreach.h"
#include "util/util_logging.h"
#include "util/util_progress.h"
#include "util/util_stack_allocator.h"
#include "util/util_simd.h"
#include "util/util_time.h"
#include "util/util_queue.h"
#include "util/util_simd.h"
#include "util/util_stack_allocator.h"
#include "util/util_time.h"
CCL_NAMESPACE_BEGIN

View File

@@ -35,9 +35,9 @@
#ifdef WITH_EMBREE
# include <embree3/rtcore_geometry.h>
# include <pmmintrin.h>
# include <xmmintrin.h>
# include <embree3/rtcore_geometry.h>
# include "bvh/bvh_embree.h"
@@ -45,9 +45,9 @@
*/
# include "kernel/bvh/bvh_embree.h"
# include "kernel/kernel_compat_cpu.h"
# include "kernel/split/kernel_split_data_types.h"
# include "kernel/kernel_globals.h"
# include "kernel/kernel_random.h"
# include "kernel/split/kernel_split_data_types.h"
# include "render/hair.h"
# include "render/mesh.h"

View File

@@ -18,10 +18,11 @@
#ifdef WITH_OPTIX
# include "bvh/bvh_optix.h"
# include "render/hair.h"
# include "render/geometry.h"
# include "render/hair.h"
# include "render/mesh.h"
# include "render/object.h"
# include "util/util_foreach.h"
# include "util/util_logging.h"
# include "util/util_progress.h"

View File

@@ -155,9 +155,13 @@ class CUDADevice : public Device {
virtual void const_copy_to(const char *name, void *host, size_t size);
void tex_alloc(device_memory &mem);
void global_alloc(device_memory &mem);
void tex_free(device_memory &mem);
void global_free(device_memory &mem);
void tex_alloc(device_texture &mem);
void tex_free(device_texture &mem);
bool denoising_non_local_means(device_ptr image_ptr,
device_ptr guide_ptr,

View File

@@ -39,8 +39,8 @@
# include "util/util_path.h"
# include "util/util_string.h"
# include "util/util_system.h"
# include "util/util_types.h"
# include "util/util_time.h"
# include "util/util_types.h"
# include "util/util_windows.h"
# include "kernel/split/kernel_split_data_types.h"
@@ -185,7 +185,7 @@ void CUDADevice::cuda_error_message(const string &message)
}
CUDADevice::CUDADevice(DeviceInfo &info, Stats &stats, Profiler &profiler, bool background_)
: Device(info, stats, profiler, background_), texture_info(this, "__texture_info", MEM_TEXTURE)
: Device(info, stats, profiler, background_), texture_info(this, "__texture_info", MEM_GLOBAL)
{
first_error = true;
background = background_;
@@ -684,7 +684,8 @@ void CUDADevice::move_textures_to_host(size_t size, bool for_texture)
device_memory &mem = *pair.first;
CUDAMem *cmem = &pair.second;
bool is_texture = (mem.type == MEM_TEXTURE) && (&mem != &texture_info);
bool is_texture = (mem.type == MEM_TEXTURE || mem.type == MEM_GLOBAL) &&
(&mem != &texture_info);
bool is_image = is_texture && (mem.data_height > 1);
/* Can't move this type of memory. */
@@ -724,8 +725,7 @@ void CUDADevice::move_textures_to_host(size_t size, bool for_texture)
device_ptr prev_pointer = max_mem->device_pointer;
size_t prev_size = max_mem->device_size;
tex_free(*max_mem);
tex_alloc(*max_mem);
mem_copy_to(*max_mem);
size = (max_size >= size) ? 0 : size - max_size;
max_mem->device_pointer = prev_pointer;
@@ -759,7 +759,7 @@ CUDADevice::CUDAMem *CUDADevice::generic_alloc(device_memory &mem, size_t pitch_
* If there is not enough room for working memory, we will try to move
* textures to host memory, assuming the performance impact would have
* been worse for working memory. */
bool is_texture = (mem.type == MEM_TEXTURE) && (&mem != &texture_info);
bool is_texture = (mem.type == MEM_TEXTURE || mem.type == MEM_GLOBAL) && (&mem != &texture_info);
bool is_image = is_texture && (mem.data_height > 1);
size_t headroom = (is_texture) ? device_texture_headroom : device_working_headroom;
@@ -922,6 +922,9 @@ void CUDADevice::mem_alloc(device_memory &mem)
else if (mem.type == MEM_TEXTURE) {
assert(!"mem_alloc not supported for textures.");
}
else if (mem.type == MEM_GLOBAL) {
assert(!"mem_alloc not supported for global memory.");
}
else {
generic_alloc(mem);
}
@@ -932,9 +935,13 @@ void CUDADevice::mem_copy_to(device_memory &mem)
if (mem.type == MEM_PIXELS) {
assert(!"mem_copy_to not supported for pixels.");
}
else if (mem.type == MEM_GLOBAL) {
global_free(mem);
global_alloc(mem);
}
else if (mem.type == MEM_TEXTURE) {
tex_free(mem);
tex_alloc(mem);
tex_free((device_texture &)mem);
tex_alloc((device_texture &)mem);
}
else {
if (!mem.device_pointer) {
@@ -950,7 +957,7 @@ void CUDADevice::mem_copy_from(device_memory &mem, int y, int w, int h, int elem
if (mem.type == MEM_PIXELS && !background) {
pixels_copy_from(mem, y, w, h);
}
else if (mem.type == MEM_TEXTURE) {
else if (mem.type == MEM_TEXTURE || mem.type == MEM_GLOBAL) {
assert(!"mem_copy_from not supported for textures.");
}
else if (mem.host_pointer) {
@@ -993,8 +1000,11 @@ void CUDADevice::mem_free(device_memory &mem)
if (mem.type == MEM_PIXELS && !background) {
pixels_free(mem);
}
else if (mem.type == MEM_GLOBAL) {
global_free(mem);
}
else if (mem.type == MEM_TEXTURE) {
tex_free(mem);
tex_free((device_texture &)mem);
}
else {
generic_free(mem);
@@ -1017,7 +1027,25 @@ void CUDADevice::const_copy_to(const char *name, void *host, size_t size)
cuda_assert(cuMemcpyHtoD(mem, host, size));
}
void CUDADevice::tex_alloc(device_memory &mem)
void CUDADevice::global_alloc(device_memory &mem)
{
CUDAContextScope scope(this);
generic_alloc(mem);
generic_copy_to(mem);
const_copy_to(mem.name, &mem.device_pointer, sizeof(mem.device_pointer));
}
void CUDADevice::global_free(device_memory &mem)
{
if (mem.device_pointer) {
CUDAContextScope scope(this);
generic_free(mem);
}
}
void CUDADevice::tex_alloc(device_texture &mem)
{
CUDAContextScope scope(this);
@@ -1027,7 +1055,7 @@ void CUDADevice::tex_alloc(device_memory &mem)
size_t size = mem.memory_size();
CUaddress_mode address_mode = CU_TR_ADDRESS_MODE_WRAP;
switch (mem.extension) {
switch (mem.info.extension) {
case EXTENSION_REPEAT:
address_mode = CU_TR_ADDRESS_MODE_WRAP;
break;
@@ -1043,22 +1071,13 @@ void CUDADevice::tex_alloc(device_memory &mem)
}
CUfilter_mode filter_mode;
if (mem.interpolation == INTERPOLATION_CLOSEST) {
if (mem.info.interpolation == INTERPOLATION_CLOSEST) {
filter_mode = CU_TR_FILTER_MODE_POINT;
}
else {
filter_mode = CU_TR_FILTER_MODE_LINEAR;
}
/* Data Storage */
if (mem.interpolation == INTERPOLATION_NONE) {
generic_alloc(mem);
generic_copy_to(mem);
const_copy_to(bind_name.c_str(), &mem.device_pointer, sizeof(mem.device_pointer));
return;
}
/* Image Texture Storage */
CUarray_format_enum format;
switch (mem.data_type) {
@@ -1169,15 +1188,6 @@ void CUDADevice::tex_alloc(device_memory &mem)
}
/* Kepler+, bindless textures. */
int flat_slot = 0;
if (string_startswith(mem.name, "__tex_image")) {
int pos = string(mem.name).rfind("_");
flat_slot = atoi(mem.name + pos + 1);
}
else {
assert(0);
}
CUDA_RESOURCE_DESC resDesc;
memset(&resDesc, 0, sizeof(resDesc));
@@ -1214,25 +1224,20 @@ void CUDADevice::tex_alloc(device_memory &mem)
cuda_assert(cuTexObjectCreate(&cmem->texobject, &resDesc, &texDesc, NULL));
/* Resize once */
if (flat_slot >= texture_info.size()) {
const uint slot = mem.slot;
if (slot >= texture_info.size()) {
/* Allocate some slots in advance, to reduce amount
* of re-allocations. */
texture_info.resize(flat_slot + 128);
texture_info.resize(slot + 128);
}
/* Set Mapping and tag that we need to (re-)upload to device */
TextureInfo &info = texture_info[flat_slot];
info.data = (uint64_t)cmem->texobject;
info.cl_buffer = 0;
info.interpolation = mem.interpolation;
info.extension = mem.extension;
info.width = mem.data_width;
info.height = mem.data_height;
info.depth = mem.data_depth;
texture_info[slot] = mem.info;
texture_info[slot].data = (uint64_t)cmem->texobject;
need_texture_info = true;
}
void CUDADevice::tex_free(device_memory &mem)
void CUDADevice::tex_free(device_texture &mem)
{
if (mem.device_pointer) {
CUDAContextScope scope(this);

View File

@@ -25,11 +25,11 @@
#include "util/util_logging.h"
#include "util/util_math.h"
#include "util/util_opengl.h"
#include "util/util_time.h"
#include "util/util_string.h"
#include "util/util_system.h"
#include "util/util_time.h"
#include "util/util_types.h"
#include "util/util_vector.h"
#include "util/util_string.h"
CCL_NAMESPACE_BEGIN
@@ -597,6 +597,7 @@ DeviceInfo Device::get_multi_device(const vector<DeviceInfo> &subdevices,
info.has_half_images = true;
info.has_volume_decoupled = true;
info.has_adaptive_stop_per_sample = true;
info.has_osl = true;
info.has_profiling = true;
@@ -639,6 +640,7 @@ DeviceInfo Device::get_multi_device(const vector<DeviceInfo> &subdevices,
/* Accumulate device info. */
info.has_half_images &= device.has_half_images;
info.has_volume_decoupled &= device.has_volume_decoupled;
info.has_adaptive_stop_per_sample &= device.has_adaptive_stop_per_sample;
info.has_osl &= device.has_osl;
info.has_profiling &= device.has_profiling;
}

View File

@@ -27,8 +27,8 @@
#include "util/util_list.h"
#include "util/util_stats.h"
#include "util/util_string.h"
#include "util/util_thread.h"
#include "util/util_texture.h"
#include "util/util_thread.h"
#include "util/util_types.h"
#include "util/util_vector.h"
@@ -75,12 +75,13 @@ class DeviceInfo {
string description;
string id; /* used for user preferences, should stay fixed with changing hardware config */
int num;
bool display_device; /* GPU is used as a display device. */
bool has_half_images; /* Support half-float textures. */
bool has_volume_decoupled; /* Decoupled volume shading. */
bool has_osl; /* Support Open Shading Language. */
bool use_split_kernel; /* Use split or mega kernel. */
bool has_profiling; /* Supports runtime collection of profiling info. */
bool display_device; /* GPU is used as a display device. */
bool has_half_images; /* Support half-float textures. */
bool has_volume_decoupled; /* Decoupled volume shading. */
bool has_adaptive_stop_per_sample; /* Per-sample adaptive sampling stopping. */
bool has_osl; /* Support Open Shading Language. */
bool use_split_kernel; /* Use split or mega kernel. */
bool has_profiling; /* Supports runtime collection of profiling info. */
int cpu_threads;
vector<DeviceInfo> multi_devices;
vector<DeviceInfo> denoising_devices;
@@ -94,6 +95,7 @@ class DeviceInfo {
display_device = false;
has_half_images = false;
has_volume_decoupled = false;
has_adaptive_stop_per_sample = false;
has_osl = false;
use_split_kernel = false;
has_profiling = false;

View File

@@ -264,7 +264,7 @@ class CPUDevice : public Device {
CPUDevice(DeviceInfo &info_, Stats &stats_, Profiler &profiler_, bool background_)
: Device(info_, stats_, profiler_, background_),
texture_info(this, "__texture_info", MEM_TEXTURE),
texture_info(this, "__texture_info", MEM_GLOBAL),
#define REGISTER_KERNEL(name) name##_kernel(KERNEL_FUNCTIONS(name))
REGISTER_KERNEL(path_trace),
REGISTER_KERNEL(convert_to_half_float),
@@ -372,6 +372,9 @@ class CPUDevice : public Device {
if (mem.type == MEM_TEXTURE) {
assert(!"mem_alloc not supported for textures.");
}
else if (mem.type == MEM_GLOBAL) {
assert(!"mem_alloc not supported for global memory.");
}
else {
if (mem.name) {
VLOG(1) << "Buffer allocate: " << mem.name << ", "
@@ -396,9 +399,13 @@ class CPUDevice : public Device {
void mem_copy_to(device_memory &mem)
{
if (mem.type == MEM_TEXTURE) {
tex_free(mem);
tex_alloc(mem);
if (mem.type == MEM_GLOBAL) {
global_free(mem);
global_alloc(mem);
}
else if (mem.type == MEM_TEXTURE) {
tex_free((device_texture &)mem);
tex_alloc((device_texture &)mem);
}
else if (mem.type == MEM_PIXELS) {
assert(!"mem_copy_to not supported for pixels.");
@@ -430,8 +437,11 @@ class CPUDevice : public Device {
void mem_free(device_memory &mem)
{
if (mem.type == MEM_TEXTURE) {
tex_free(mem);
if (mem.type == MEM_GLOBAL) {
global_free(mem);
}
else if (mem.type == MEM_TEXTURE) {
tex_free((device_texture &)mem);
}
else if (mem.device_pointer) {
if (mem.type == MEM_DEVICE_ONLY) {
@@ -453,51 +463,50 @@ class CPUDevice : public Device {
kernel_const_copy(&kernel_globals, name, host, size);
}
void tex_alloc(device_memory &mem)
void global_alloc(device_memory &mem)
{
VLOG(1) << "Texture allocate: " << mem.name << ", "
VLOG(1) << "Global memory allocate: " << mem.name << ", "
<< string_human_readable_number(mem.memory_size()) << " bytes. ("
<< string_human_readable_size(mem.memory_size()) << ")";
if (mem.interpolation == INTERPOLATION_NONE) {
/* Data texture. */
kernel_tex_copy(&kernel_globals, mem.name, mem.host_pointer, mem.data_size);
}
else {
/* Image Texture. */
int flat_slot = 0;
if (string_startswith(mem.name, "__tex_image")) {
int pos = string(mem.name).rfind("_");
flat_slot = atoi(mem.name + pos + 1);
}
else {
assert(0);
}
if (flat_slot >= texture_info.size()) {
/* Allocate some slots in advance, to reduce amount
* of re-allocations. */
texture_info.resize(flat_slot + 128);
}
TextureInfo &info = texture_info[flat_slot];
info.data = (uint64_t)mem.host_pointer;
info.cl_buffer = 0;
info.interpolation = mem.interpolation;
info.extension = mem.extension;
info.width = mem.data_width;
info.height = mem.data_height;
info.depth = mem.data_depth;
need_texture_info = true;
}
kernel_global_memory_copy(&kernel_globals, mem.name, mem.host_pointer, mem.data_size);
mem.device_pointer = (device_ptr)mem.host_pointer;
mem.device_size = mem.memory_size();
stats.mem_alloc(mem.device_size);
}
void tex_free(device_memory &mem)
void global_free(device_memory &mem)
{
if (mem.device_pointer) {
mem.device_pointer = 0;
stats.mem_free(mem.device_size);
mem.device_size = 0;
}
}
void tex_alloc(device_texture &mem)
{
VLOG(1) << "Texture allocate: " << mem.name << ", "
<< string_human_readable_number(mem.memory_size()) << " bytes. ("
<< string_human_readable_size(mem.memory_size()) << ")";
mem.device_pointer = (device_ptr)mem.host_pointer;
mem.device_size = mem.memory_size();
stats.mem_alloc(mem.device_size);
const uint slot = mem.slot;
if (slot >= texture_info.size()) {
/* Allocate some slots in advance, to reduce amount of re-allocations. */
texture_info.resize(slot + 128);
}
texture_info[slot] = mem.info;
texture_info[slot].data = (uint64_t)mem.host_pointer;
need_texture_info = true;
}
void tex_free(device_texture &mem)
{
if (mem.device_pointer) {
mem.device_pointer = 0;
@@ -830,7 +839,7 @@ class CPUDevice : public Device {
return true;
}
bool adaptive_sampling_filter(KernelGlobals *kg, RenderTile &tile)
bool adaptive_sampling_filter(KernelGlobals *kg, RenderTile &tile, int sample)
{
WorkTile wtile;
wtile.x = tile.x;
@@ -841,11 +850,24 @@ class CPUDevice : public Device {
wtile.stride = tile.stride;
wtile.buffer = (float *)tile.buffer;
/* For CPU we do adaptive stopping per sample so we can stop earlier, but
* for combined CPU + GPU rendering we match the GPU and do it per tile
* after a given number of sample steps. */
if (!kernel_data.integrator.adaptive_stop_per_sample) {
for (int y = wtile.y; y < wtile.y + wtile.h; ++y) {
for (int x = wtile.x; x < wtile.x + wtile.w; ++x) {
const int index = wtile.offset + x + y * wtile.stride;
float *buffer = wtile.buffer + index * kernel_data.film.pass_stride;
kernel_do_adaptive_stopping(kg, buffer, sample);
}
}
}
bool any = false;
for (int y = tile.y; y < tile.y + tile.h; ++y) {
for (int y = wtile.y; y < wtile.y + wtile.h; ++y) {
any |= kernel_do_adaptive_filter_x(kg, y, &wtile);
}
for (int x = tile.x; x < tile.x + tile.w; ++x) {
for (int x = wtile.x; x < wtile.x + wtile.w; ++x) {
any |= kernel_do_adaptive_filter_y(kg, x, &wtile);
}
return (!any);
@@ -908,7 +930,7 @@ class CPUDevice : public Device {
tile.sample = sample + 1;
if (task.adaptive_sampling.use && task.adaptive_sampling.need_filter(sample)) {
const bool stop = adaptive_sampling_filter(kg, tile);
const bool stop = adaptive_sampling_filter(kg, tile, sample);
if (stop) {
const int num_progress_samples = end_sample - sample;
tile.sample = end_sample;
@@ -1318,6 +1340,7 @@ void device_cpu_info(vector<DeviceInfo> &devices)
info.id = "CPU";
info.num = 0;
info.has_volume_decoupled = true;
info.has_adaptive_stop_per_sample = true;
info.has_osl = true;
info.has_half_images = true;
info.has_profiling = true;

View File

@@ -16,9 +16,9 @@
#ifdef WITH_CUDA
# include "device/cuda/device_cuda.h"
# include "device/device.h"
# include "device/device_intern.h"
# include "device/cuda/device_cuda.h"
# include "util/util_logging.h"
# include "util/util_string.h"
@@ -129,6 +129,7 @@ void device_cuda_info(vector<DeviceInfo> &devices)
info.has_half_images = (major >= 3);
info.has_volume_decoupled = false;
info.has_adaptive_stop_per_sample = false;
int pci_location[3] = {0, 0, 0};
cuDeviceGetAttribute(&pci_location[0], CU_DEVICE_ATTRIBUTE_PCI_DOMAIN_ID, num);

View File

@@ -14,8 +14,8 @@
* limitations under the License.
*/
#include "device/device.h"
#include "device/device_memory.h"
#include "device/device.h"
CCL_NAMESPACE_BEGIN
@@ -31,8 +31,6 @@ device_memory::device_memory(Device *device, const char *name, MemoryType type)
data_depth(0),
type(type),
name(name),
interpolation(INTERPOLATION_NONE),
extension(EXTENSION_REPEAT),
device(device),
device_pointer(0),
host_pointer(0),
@@ -76,7 +74,7 @@ void device_memory::host_free()
void device_memory::device_alloc()
{
assert(!device_pointer && type != MEM_TEXTURE);
assert(!device_pointer && type != MEM_TEXTURE && type != MEM_GLOBAL);
device->mem_alloc(*this);
}
@@ -96,7 +94,7 @@ void device_memory::device_copy_to()
void device_memory::device_copy_from(int y, int w, int h, int elem)
{
assert(type != MEM_TEXTURE && type != MEM_READ_ONLY);
assert(type != MEM_TEXTURE && type != MEM_READ_ONLY && type != MEM_GLOBAL);
device->mem_copy_from(*this, y, w, h, elem);
}
@@ -139,4 +137,93 @@ device_sub_ptr::~device_sub_ptr()
device->mem_free_sub_ptr(ptr);
}
/* Device Texture */
device_texture::device_texture(Device *device,
const char *name,
const uint slot,
ImageDataType image_data_type,
InterpolationType interpolation,
ExtensionType extension)
: device_memory(device, name, MEM_TEXTURE), slot(slot)
{
switch (image_data_type) {
case IMAGE_DATA_TYPE_FLOAT4:
data_type = TYPE_FLOAT;
data_elements = 4;
break;
case IMAGE_DATA_TYPE_FLOAT:
data_type = TYPE_FLOAT;
data_elements = 1;
break;
case IMAGE_DATA_TYPE_BYTE4:
data_type = TYPE_UCHAR;
data_elements = 4;
break;
case IMAGE_DATA_TYPE_BYTE:
data_type = TYPE_UCHAR;
data_elements = 1;
break;
case IMAGE_DATA_TYPE_HALF4:
data_type = TYPE_HALF;
data_elements = 4;
break;
case IMAGE_DATA_TYPE_HALF:
data_type = TYPE_HALF;
data_elements = 1;
break;
case IMAGE_DATA_TYPE_USHORT4:
data_type = TYPE_UINT16;
data_elements = 4;
break;
case IMAGE_DATA_TYPE_USHORT:
data_type = TYPE_UINT16;
data_elements = 1;
break;
case IMAGE_DATA_NUM_TYPES:
assert(0);
return;
}
memset(&info, 0, sizeof(info));
info.data_type = image_data_type;
info.interpolation = interpolation;
info.extension = extension;
}
device_texture::~device_texture()
{
device_free();
host_free();
}
/* Host memory allocation. */
void *device_texture::alloc(const size_t width, const size_t height, const size_t depth)
{
const size_t new_size = size(width, height, depth);
if (new_size != data_size) {
device_free();
host_free();
host_pointer = host_alloc(data_elements * datatype_size(data_type) * new_size);
assert(device_pointer == 0);
}
data_size = new_size;
data_width = width;
data_height = height;
data_depth = depth;
info.width = width;
info.height = height;
info.depth = depth;
return host_pointer;
}
void device_texture::copy_to_device()
{
device_copy_to();
}
CCL_NAMESPACE_END

View File

@@ -23,6 +23,7 @@
#include "util/util_array.h"
#include "util/util_half.h"
#include "util/util_string.h"
#include "util/util_texture.h"
#include "util/util_types.h"
#include "util/util_vector.h"
@@ -31,7 +32,14 @@ CCL_NAMESPACE_BEGIN
class Device;
enum MemoryType { MEM_READ_ONLY, MEM_READ_WRITE, MEM_DEVICE_ONLY, MEM_TEXTURE, MEM_PIXELS };
enum MemoryType {
MEM_READ_ONLY,
MEM_READ_WRITE,
MEM_DEVICE_ONLY,
MEM_GLOBAL,
MEM_TEXTURE,
MEM_PIXELS
};
/* Supported Data Types */
@@ -208,8 +216,6 @@ class device_memory {
size_t data_depth;
MemoryType type;
const char *name;
InterpolationType interpolation;
ExtensionType extension;
/* Pointers. */
Device *device;
@@ -310,7 +316,7 @@ template<typename T> class device_only_memory : public device_memory {
* in and copied to the device with copy_to_device(). Or alternatively
* allocated and set to zero on the device with zero_to_device().
*
* When using memory type MEM_TEXTURE, a pointer to this memory will be
* When using memory type MEM_GLOBAL, a pointer to this memory will be
* automatically attached to kernel globals, using the provided name
* matching an entry in kernel_textures.h. */
@@ -503,6 +509,33 @@ class device_sub_ptr {
device_ptr ptr;
};
/* Device Texture
*
* 2D or 3D image texture memory. */
class device_texture : public device_memory {
public:
device_texture(Device *device,
const char *name,
const uint slot,
ImageDataType image_data_type,
InterpolationType interpolation,
ExtensionType extension);
~device_texture();
void *alloc(const size_t width, const size_t height, const size_t depth = 0);
void copy_to_device();
uint slot;
TextureInfo info;
protected:
size_t size(const size_t width, const size_t height, const size_t depth)
{
return width * ((height == 0) ? 1 : height) * ((depth == 0) ? 1 : depth);
}
};
CCL_NAMESPACE_END
#endif /* __DEVICE_MEMORY_H__ */

View File

@@ -14,8 +14,8 @@
* limitations under the License.
*/
#include <stdlib.h>
#include <sstream>
#include <stdlib.h>
#include "device/device.h"
#include "device/device_intern.h"

View File

@@ -14,9 +14,9 @@
* limitations under the License.
*/
#include "device/device_network.h"
#include "device/device.h"
#include "device/device_intern.h"
#include "device/device_network.h"
#include "util/util_foreach.h"
#include "util/util_logging.h"
@@ -311,6 +311,7 @@ void device_network_info(vector<DeviceInfo> &devices)
/* todo: get this info from device */
info.has_volume_decoupled = false;
info.has_adaptive_stop_per_sample = false;
info.has_osl = false;
devices.push_back(info);

View File

@@ -19,19 +19,19 @@
#ifdef WITH_NETWORK
# include <boost/archive/text_iarchive.hpp>
# include <boost/archive/text_oarchive.hpp>
# include <boost/archive/binary_iarchive.hpp>
# include <boost/archive/binary_oarchive.hpp>
# include <boost/archive/text_iarchive.hpp>
# include <boost/archive/text_oarchive.hpp>
# include <boost/array.hpp>
# include <boost/asio.hpp>
# include <boost/bind.hpp>
# include <boost/serialization/vector.hpp>
# include <boost/thread.hpp>
# include <deque>
# include <iostream>
# include <sstream>
# include <deque>
# include "render/buffers.h"

View File

@@ -16,9 +16,9 @@
#ifdef WITH_OPENCL
# include "device/opencl/device_opencl.h"
# include "device/device.h"
# include "device/device_intern.h"
# include "device/opencl/device_opencl.h"
# include "util/util_foreach.h"
# include "util/util_logging.h"
@@ -119,6 +119,7 @@ void device_opencl_info(vector<DeviceInfo> &devices)
info.display_device = true;
info.use_split_kernel = true;
info.has_volume_decoupled = false;
info.has_adaptive_stop_per_sample = false;
info.id = id;
/* Check OpenCL extensions */

View File

@@ -17,28 +17,28 @@
#ifdef WITH_OPTIX
# include "device/cuda/device_cuda.h"
# include "device/device_intern.h"
# include "device/device_denoising.h"
# include "bvh/bvh.h"
# include "render/scene.h"
# include "device/cuda/device_cuda.h"
# include "device/device_denoising.h"
# include "device/device_intern.h"
# include "render/buffers.h"
# include "render/hair.h"
# include "render/mesh.h"
# include "render/object.h"
# include "render/buffers.h"
# include "render/scene.h"
# include "util/util_debug.h"
# include "util/util_logging.h"
# include "util/util_md5.h"
# include "util/util_path.h"
# include "util/util_time.h"
# include "util/util_debug.h"
# include "util/util_logging.h"
# ifdef WITH_CUDA_DYNLOAD
# include <cuew.h>
// Do not use CUDA SDK headers when using CUEW
# define OPTIX_DONT_INCLUDE_CUDA
# endif
# include <optix_stubs.h>
# include <optix_function_table_definition.h>
# include <optix_stubs.h>
// TODO(pmours): Disable this once drivers have native support
# define OPTIX_DENOISER_NO_PIXEL_STRIDE 1
@@ -477,9 +477,9 @@ class OptiXDevice : public CUDADevice {
// Calculate maximum trace continuation stack size
unsigned int trace_css = stack_size[PG_HITD].cssCH;
// This is based on the maximum of closest-hit and any-hit/intersection programs
trace_css = max(trace_css, stack_size[PG_HITD].cssIS + stack_size[PG_HITD].cssAH);
trace_css = max(trace_css, stack_size[PG_HITL].cssIS + stack_size[PG_HITL].cssAH);
trace_css = max(trace_css, stack_size[PG_HITS].cssIS + stack_size[PG_HITS].cssAH);
trace_css = std::max(trace_css, stack_size[PG_HITD].cssIS + stack_size[PG_HITD].cssAH);
trace_css = std::max(trace_css, stack_size[PG_HITL].cssIS + stack_size[PG_HITL].cssAH);
trace_css = std::max(trace_css, stack_size[PG_HITS].cssIS + stack_size[PG_HITS].cssAH);
OptixPipelineLinkOptions link_options;
link_options.maxTraceDepth = 1;
@@ -548,8 +548,9 @@ class OptiXDevice : public CUDADevice {
&pipelines[PIP_SHADER_EVAL]));
// Calculate continuation stack size based on the maximum of all ray generation stack sizes
const unsigned int css = max(stack_size[PG_BAKE].cssRG,
max(stack_size[PG_DISP].cssRG, stack_size[PG_BACK].cssRG)) +
const unsigned int css = std::max(stack_size[PG_BAKE].cssRG,
std::max(stack_size[PG_DISP].cssRG,
stack_size[PG_BACK].cssRG)) +
link_options.maxTraceDepth * trace_css;
check_result_optix_ret(optixPipelineSetStackSize(
@@ -1557,7 +1558,7 @@ void device_optix_info(vector<DeviceInfo> &devices)
}
// Only add devices with RTX support
if (rtcore_version == 0)
if (rtcore_version == 0 && !getenv("CYCLES_OPTIX_TEST"))
it = cuda_devices.erase(it);
else
++it;

View File

@@ -138,8 +138,7 @@ void DeviceTask::update_progress(RenderTile *rtile, int pixel_samples)
/* Adaptive Sampling */
AdaptiveSampling::AdaptiveSampling()
: use(true), adaptive_step(ADAPTIVE_SAMPLE_STEP), min_samples(0)
AdaptiveSampling::AdaptiveSampling() : use(true), adaptive_step(0), min_samples(0)
{
}

View File

@@ -88,9 +88,12 @@ class OpenCLInfo {
static bool device_supported(const string &platform_name, const cl_device_id device_id);
static bool platform_version_check(cl_platform_id platform, string *error = NULL);
static bool device_version_check(cl_device_id device, string *error = NULL);
static bool get_device_version(cl_device_id device,
int *r_major,
int *r_minor,
string *error = NULL);
static string get_hardware_id(const string &platform_name, cl_device_id device_id);
static void get_usable_devices(vector<OpenCLPlatformDevice> *usable_devices,
bool force_all = false);
static void get_usable_devices(vector<OpenCLPlatformDevice> *usable_devices);
/* ** Some handy shortcuts to low level cl*GetInfo() functions. ** */
@@ -428,8 +431,10 @@ class OpenCLDevice : public Device {
int mem_sub_ptr_alignment();
void const_copy_to(const char *name, void *host, size_t size);
void tex_alloc(device_memory &mem);
void tex_free(device_memory &mem);
void global_alloc(device_memory &mem);
void global_free(device_memory &mem);
void tex_alloc(device_texture &mem);
void tex_free(device_texture &mem);
size_t global_size_round_up(int group_size, int global_size);
void enqueue_kernel(cl_kernel kernel,

View File

@@ -257,16 +257,16 @@ void OpenCLDevice::OpenCLSplitPrograms::load_kernels(
/* Ordered with most complex kernels first, to reduce overall compile time. */
ADD_SPLIT_KERNEL_PROGRAM(subsurface_scatter);
ADD_SPLIT_KERNEL_PROGRAM(direct_lighting);
ADD_SPLIT_KERNEL_PROGRAM(indirect_background);
if (requested_features.use_volume || is_preview) {
ADD_SPLIT_KERNEL_PROGRAM(do_volume);
}
ADD_SPLIT_KERNEL_PROGRAM(shader_eval);
ADD_SPLIT_KERNEL_PROGRAM(lamp_emission);
ADD_SPLIT_KERNEL_PROGRAM(holdout_emission_blurring_pathtermination_ao);
ADD_SPLIT_KERNEL_PROGRAM(shadow_blocked_dl);
ADD_SPLIT_KERNEL_PROGRAM(shadow_blocked_ao);
ADD_SPLIT_KERNEL_PROGRAM(holdout_emission_blurring_pathtermination_ao);
ADD_SPLIT_KERNEL_PROGRAM(lamp_emission);
ADD_SPLIT_KERNEL_PROGRAM(direct_lighting);
ADD_SPLIT_KERNEL_PROGRAM(indirect_background);
ADD_SPLIT_KERNEL_PROGRAM(shader_eval);
/* Quick kernels bundled in a single program to reduce overhead of starting
* Blender processes. */
@@ -613,7 +613,7 @@ OpenCLDevice::OpenCLDevice(DeviceInfo &info, Stats &stats, Profiler &profiler, b
kernel_programs(this),
preview_programs(this),
memory_manager(this),
texture_info(this, "__texture_info", MEM_TEXTURE)
texture_info(this, "__texture_info", MEM_GLOBAL)
{
cpPlatform = NULL;
cdDevice = NULL;
@@ -945,7 +945,7 @@ void OpenCLDevice::mem_alloc(device_memory &mem)
cl_mem_flags mem_flag;
void *mem_ptr = NULL;
if (mem.type == MEM_READ_ONLY || mem.type == MEM_TEXTURE)
if (mem.type == MEM_READ_ONLY || mem.type == MEM_TEXTURE || mem.type == MEM_GLOBAL)
mem_flag = CL_MEM_READ_ONLY;
else
mem_flag = CL_MEM_READ_WRITE;
@@ -969,9 +969,13 @@ void OpenCLDevice::mem_alloc(device_memory &mem)
void OpenCLDevice::mem_copy_to(device_memory &mem)
{
if (mem.type == MEM_TEXTURE) {
tex_free(mem);
tex_alloc(mem);
if (mem.type == MEM_GLOBAL) {
global_free(mem);
global_alloc(mem);
}
else if (mem.type == MEM_TEXTURE) {
tex_free((device_texture &)mem);
tex_alloc((device_texture &)mem);
}
else {
if (!mem.device_pointer) {
@@ -1077,8 +1081,11 @@ void OpenCLDevice::mem_zero(device_memory &mem)
void OpenCLDevice::mem_free(device_memory &mem)
{
if (mem.type == MEM_TEXTURE) {
tex_free(mem);
if (mem.type == MEM_GLOBAL) {
global_free(mem);
}
else if (mem.type == MEM_TEXTURE) {
tex_free((device_texture &)mem);
}
else {
if (mem.device_pointer) {
@@ -1101,7 +1108,7 @@ int OpenCLDevice::mem_sub_ptr_alignment()
device_ptr OpenCLDevice::mem_alloc_sub_ptr(device_memory &mem, int offset, int size)
{
cl_mem_flags mem_flag;
if (mem.type == MEM_READ_ONLY || mem.type == MEM_TEXTURE)
if (mem.type == MEM_READ_ONLY || mem.type == MEM_TEXTURE || mem.type == MEM_GLOBAL)
mem_flag = CL_MEM_READ_ONLY;
else
mem_flag = CL_MEM_READ_WRITE;
@@ -1141,9 +1148,9 @@ void OpenCLDevice::const_copy_to(const char *name, void *host, size_t size)
data->copy_to_device();
}
void OpenCLDevice::tex_alloc(device_memory &mem)
void OpenCLDevice::global_alloc(device_memory &mem)
{
VLOG(1) << "Texture allocate: " << mem.name << ", "
VLOG(1) << "Global memory allocate: " << mem.name << ", "
<< string_human_readable_number(mem.memory_size()) << " bytes. ("
<< string_human_readable_size(mem.memory_size()) << ")";
@@ -1155,7 +1162,7 @@ void OpenCLDevice::tex_alloc(device_memory &mem)
textures_need_update = true;
}
void OpenCLDevice::tex_free(device_memory &mem)
void OpenCLDevice::global_free(device_memory &mem)
{
if (mem.device_pointer) {
mem.device_pointer = 0;
@@ -1173,6 +1180,25 @@ void OpenCLDevice::tex_free(device_memory &mem)
}
}
void OpenCLDevice::tex_alloc(device_texture &mem)
{
VLOG(1) << "Texture allocate: " << mem.name << ", "
<< string_human_readable_number(mem.memory_size()) << " bytes. ("
<< string_human_readable_size(mem.memory_size()) << ")";
memory_manager.alloc(mem.name, mem);
/* Set the pointer to non-null to keep code that inspects its value from thinking its
* unallocated. */
mem.device_pointer = 1;
textures[mem.name] = &mem;
textures_need_update = true;
}
void OpenCLDevice::tex_free(device_texture &mem)
{
global_free(mem);
}
size_t OpenCLDevice::global_size_round_up(int group_size, int global_size)
{
int r = global_size % group_size;
@@ -1273,10 +1299,10 @@ void OpenCLDevice::flush_texture_buffers()
foreach (TexturesMap::value_type &tex, textures) {
string name = tex.first;
device_memory *mem = tex.second;
if (string_startswith(name, "__tex_image")) {
int pos = name.rfind("_");
int id = atoi(name.data() + pos + 1);
if (mem->type == MEM_TEXTURE) {
const uint id = ((device_texture *)mem)->slot;
texture_slots.push_back(texture_slot_t(name, num_data_slots + id));
num_slots = max(num_slots, num_data_slots + id + 1);
}
@@ -1289,22 +1315,20 @@ void OpenCLDevice::flush_texture_buffers()
/* Fill in descriptors */
foreach (texture_slot_t &slot, texture_slots) {
device_memory *mem = textures[slot.name];
TextureInfo &info = texture_info[slot.slot];
MemoryManager::BufferDescriptor desc = memory_manager.get_descriptor(slot.name);
if (mem->type == MEM_TEXTURE) {
info = ((device_texture *)mem)->info;
}
else {
memset(&info, 0, sizeof(TextureInfo));
}
info.data = desc.offset;
info.cl_buffer = desc.device_buffer;
if (string_startswith(slot.name, "__tex_image")) {
device_memory *mem = textures[slot.name];
info.width = mem->data_width;
info.height = mem->data_height;
info.depth = mem->data_depth;
info.interpolation = mem->interpolation;
info.extension = mem->extension;
}
}
/* Force write of descriptors. */
@@ -1872,6 +1896,17 @@ string OpenCLDevice::kernel_build_options(const string *debug_src)
{
string build_options = "-cl-no-signed-zeros -cl-mad-enable ";
/* Build with OpenCL 2.0 if available, this improves performance
* with AMD OpenCL drivers on Windows and Linux (legacy drivers).
* Note that OpenCL selects the highest 1.x version by default,
* only for 2.0 do we need the explicit compiler flag. */
int version_major, version_minor;
if (OpenCLInfo::get_device_version(cdDevice, &version_major, &version_minor)) {
if (version_major >= 2) {
build_options += "-cl-std=CL2.0 ";
}
}
if (platform_name == "NVIDIA CUDA") {
build_options +=
"-D__KERNEL_OPENCL_NVIDIA__ "

View File

@@ -19,8 +19,8 @@
#include "device/device.h"
#include "util/util_map.h"
#include "util/util_vector.h"
#include "util/util_string.h"
#include "util/util_vector.h"
#include "clew.h"

View File

@@ -16,15 +16,16 @@
#ifdef WITH_OPENCL
# include "device/opencl/device_opencl.h"
# include "device/device_intern.h"
# include "device/opencl/device_opencl.h"
# include "util/util_debug.h"
# include "util/util_logging.h"
# include "util/util_md5.h"
# include "util/util_path.h"
# include "util/util_time.h"
# include "util/util_semaphore.h"
# include "util/util_system.h"
# include "util/util_time.h"
using std::cerr;
using std::endl;
@@ -390,8 +391,27 @@ static void escape_python_string(string &str)
string_replace(str, "'", "\'");
}
static int opencl_compile_process_limit()
{
/* Limit number of concurrent processes compiling, with a heuristic based
* on total physical RAM and estimate of memory usage needed when compiling
* with all Cycles features enabled.
*
* This is somewhat arbitrary as we don't know the actual available RAM or
* how much the kernel compilation will needed depending on the features, but
* better than not limiting at all. */
static const int64_t GB = 1024LL * 1024LL * 1024LL;
static const int64_t process_memory = 2 * GB;
static const int64_t base_memory = 2 * GB;
static const int64_t system_memory = system_physical_ram();
static const int64_t process_limit = (system_memory - base_memory) / process_memory;
return max((int)process_limit, 1);
}
bool OpenCLDevice::OpenCLProgram::compile_separate(const string &clbin)
{
/* Construct arguments. */
vector<string> args;
args.push_back("--background");
args.push_back("--factory-startup");
@@ -419,14 +439,23 @@ bool OpenCLDevice::OpenCLProgram::compile_separate(const string &clbin)
kernel_file_escaped.c_str(),
clbin_escaped.c_str()));
double starttime = time_dt();
/* Limit number of concurrent processes compiling. */
static thread_counting_semaphore semaphore(opencl_compile_process_limit());
semaphore.acquire();
/* Compile. */
const double starttime = time_dt();
add_log(string("Cycles: compiling OpenCL program ") + program_name + "...", false);
add_log(string("Build flags: ") + kernel_build_options, true);
if (!system_call_self(args) || !path_exists(clbin)) {
const bool success = system_call_self(args);
const double elapsed = time_dt() - starttime;
semaphore.release();
if (!success || !path_exists(clbin)) {
return false;
}
double elapsed = time_dt() - starttime;
add_log(
string_printf("Kernel compilation of %s finished in %.2lfs.", program_name.c_str(), elapsed),
false);
@@ -747,6 +776,10 @@ bool OpenCLInfo::device_supported(const string &platform_name, const cl_device_i
}
VLOG(3) << "OpenCL driver version " << driver_major << "." << driver_minor;
if (getenv("CYCLES_OPENCL_TEST")) {
return true;
}
/* It is possible to have Iris GPU on AMD/Apple OpenCL framework
* (aka, it will not be on Intel framework). This isn't supported
* and needs an explicit blacklist.
@@ -806,18 +839,30 @@ bool OpenCLInfo::platform_version_check(cl_platform_id platform, string *error)
return true;
}
bool OpenCLInfo::device_version_check(cl_device_id device, string *error)
bool OpenCLInfo::get_device_version(cl_device_id device, int *r_major, int *r_minor, string *error)
{
const int req_major = 1, req_minor = 1;
int major, minor;
char version[256];
clGetDeviceInfo(device, CL_DEVICE_OPENCL_C_VERSION, sizeof(version), &version, NULL);
if (sscanf(version, "OpenCL C %d.%d", &major, &minor) < 2) {
if (sscanf(version, "OpenCL C %d.%d", r_major, r_minor) < 2) {
if (error != NULL) {
*error = string_printf("OpenCL: failed to parse OpenCL C version string (%s).", version);
}
return false;
}
if (error != NULL) {
*error = "";
}
return true;
}
bool OpenCLInfo::device_version_check(cl_device_id device, string *error)
{
const int req_major = 1, req_minor = 1;
int major, minor;
if (!get_device_version(device, &major, &minor, error)) {
return false;
}
if (!((major == req_major && minor >= req_minor) || (major > req_major))) {
if (error != NULL) {
*error = string_printf("OpenCL: C version 1.1 or later required, found %d.%d", major, minor);
@@ -858,7 +903,7 @@ string OpenCLInfo::get_hardware_id(const string &platform_name, cl_device_id dev
return "";
}
void OpenCLInfo::get_usable_devices(vector<OpenCLPlatformDevice> *usable_devices, bool force_all)
void OpenCLInfo::get_usable_devices(vector<OpenCLPlatformDevice> *usable_devices)
{
const cl_device_type device_type = OpenCLInfo::device_type();
static bool first_time = true;
@@ -924,7 +969,7 @@ void OpenCLInfo::get_usable_devices(vector<OpenCLPlatformDevice> *usable_devices
FIRST_VLOG(2) << "Ignoring device " << device_name << " due to old compiler version.";
continue;
}
if (force_all || device_supported(platform_name, device_id)) {
if (device_supported(platform_name, device_id)) {
cl_device_type device_type;
if (!get_device_type(device_id, &device_type, &error)) {
FIRST_VLOG(2) << "Ignoring device " << device_name

View File

@@ -452,7 +452,7 @@ if(WITH_CYCLES_CUDA_BINARIES)
endif()
add_custom_command(
OUTPUT ${cuda_cubin}
OUTPUT ${cuda_file}
COMMAND ${CUBIN_CC_ENV}
"$<TARGET_FILE:cycles_cubin_cc>"
-target ${CUDA_ARCH}
@@ -461,7 +461,6 @@ if(WITH_CYCLES_CUDA_BINARIES)
-v
-cuda-toolkit-dir "${CUDA_TOOLKIT_ROOT_DIR}"
DEPENDS ${kernel_sources} cycles_cubin_cc)
set(cuda_file ${cuda_cubin})
else()
add_custom_command(
OUTPUT ${cuda_file}
@@ -517,7 +516,6 @@ if(WITH_CYCLES_DEVICE_OPTIX)
-I "${OPTIX_INCLUDE_DIR}"
-I "${CMAKE_CURRENT_SOURCE_DIR}/.."
-I "${CMAKE_CURRENT_SOURCE_DIR}/kernels/cuda"
-arch=sm_30
--use_fast_math
-o ${output})
@@ -525,25 +523,62 @@ if(WITH_CYCLES_DEVICE_OPTIX)
set(cuda_flags ${cuda_flags}
-D __KERNEL_DEBUG__)
endif()
if(WITH_CYCLES_CUBIN_COMPILER)
add_custom_command(
OUTPUT
${output}
DEPENDS
${input}
${SRC_HEADERS}
${SRC_KERNELS_CUDA_HEADERS}
${SRC_KERNELS_OPTIX_HEADERS}
${SRC_BVH_HEADERS}
${SRC_SVM_HEADERS}
${SRC_GEOM_HEADERS}
${SRC_CLOSURE_HEADERS}
${SRC_UTIL_HEADERS}
COMMAND
${CUDA_NVCC_EXECUTABLE} --ptx ${cuda_flags} ${input}
WORKING_DIRECTORY
"${CMAKE_CURRENT_SOURCE_DIR}")
# Needed to find libnvrtc-builtins.so. Can't do it from inside
# cycles_cubin_cc since the env variable is read before main()
if(APPLE)
set(CUBIN_CC_ENV ${CMAKE_COMMAND}
-E env DYLD_LIBRARY_PATH="${CUDA_TOOLKIT_ROOT_DIR}/lib")
elseif(UNIX)
set(CUBIN_CC_ENV ${CMAKE_COMMAND}
-E env LD_LIBRARY_PATH="${CUDA_TOOLKIT_ROOT_DIR}/lib64")
endif()
add_custom_command(
OUTPUT ${output}
DEPENDS
${input}
${SRC_HEADERS}
${SRC_KERNELS_CUDA_HEADERS}
${SRC_KERNELS_OPTIX_HEADERS}
${SRC_BVH_HEADERS}
${SRC_SVM_HEADERS}
${SRC_GEOM_HEADERS}
${SRC_CLOSURE_HEADERS}
${SRC_UTIL_HEADERS}
COMMAND ${CUBIN_CC_ENV}
"$<TARGET_FILE:cycles_cubin_cc>"
-target 30
-ptx
-i ${CMAKE_CURRENT_SOURCE_DIR}/${input}
${cuda_flags}
-v
-cuda-toolkit-dir "${CUDA_TOOLKIT_ROOT_DIR}"
DEPENDS ${kernel_sources} cycles_cubin_cc)
else()
add_custom_command(
OUTPUT
${output}
DEPENDS
${input}
${SRC_HEADERS}
${SRC_KERNELS_CUDA_HEADERS}
${SRC_KERNELS_OPTIX_HEADERS}
${SRC_BVH_HEADERS}
${SRC_SVM_HEADERS}
${SRC_GEOM_HEADERS}
${SRC_CLOSURE_HEADERS}
${SRC_UTIL_HEADERS}
COMMAND
${CUDA_NVCC_EXECUTABLE}
--ptx
-arch=sm_30
${cuda_flags}
${input}
WORKING_DIRECTORY
"${CMAKE_CURRENT_SOURCE_DIR}")
endif()
list(APPEND optix_ptx ${output})
delayed_install("${CMAKE_CURRENT_BINARY_DIR}" "${output}" ${CYCLES_INSTALL_PATH}/lib)

View File

@@ -493,6 +493,36 @@ ccl_device void bsdf_principled_hair_blur(ShaderClosure *sc, float roughness)
bsdf->m0_roughness = fmaxf(roughness, bsdf->m0_roughness);
}
/* Hair Albedo */
ccl_device_inline float bsdf_principled_hair_albedo_roughness_scale(
const float azimuthal_roughness)
{
const float x = azimuthal_roughness;
return (((((0.245f * x) + 5.574f) * x - 10.73f) * x + 2.532f) * x - 0.215f) * x + 5.969f;
}
ccl_device float3 bsdf_principled_hair_albedo(ShaderClosure *sc)
{
PrincipledHairBSDF *bsdf = (PrincipledHairBSDF *)sc;
return exp3(-sqrt(bsdf->sigma) * bsdf_principled_hair_albedo_roughness_scale(bsdf->v));
}
ccl_device_inline float3
bsdf_principled_hair_sigma_from_reflectance(const float3 color, const float azimuthal_roughness)
{
const float3 sigma = log3(color) /
bsdf_principled_hair_albedo_roughness_scale(azimuthal_roughness);
return sigma * sigma;
}
ccl_device_inline float3 bsdf_principled_hair_sigma_from_concentration(const float eumelanin,
const float pheomelanin)
{
return eumelanin * make_float3(0.506f, 0.841f, 1.653f) +
pheomelanin * make_float3(0.343f, 0.733f, 1.924f);
}
CCL_NAMESPACE_END
#endif /* __BSDF_HAIR_PRINCIPLED_H__ */

View File

@@ -103,17 +103,21 @@ ccl_device_inline
const Ray *ray,
float3 verts[3])
{
# ifdef __KERNEL_OPTIX__
/* isect->t is always in world space with OptiX. */
return motion_triangle_refine(kg, sd, isect, ray, verts);
# else
float3 P = ray->P;
float3 D = ray->D;
float t = isect->t;
# ifdef __INTERSECTION_REFINE__
# ifdef __INTERSECTION_REFINE__
if (isect->object != OBJECT_NONE) {
# ifdef __OBJECT_MOTION__
# ifdef __OBJECT_MOTION__
Transform tfm = sd->ob_itfm;
# else
# else
Transform tfm = object_fetch_transform(kg, isect->object, OBJECT_INVERSE_TRANSFORM);
# endif
# endif
P = transform_point(&tfm, P);
D = transform_direction(&tfm, D);
@@ -135,19 +139,20 @@ ccl_device_inline
P = P + D * rt;
if (isect->object != OBJECT_NONE) {
# ifdef __OBJECT_MOTION__
# ifdef __OBJECT_MOTION__
Transform tfm = sd->ob_tfm;
# else
# else
Transform tfm = object_fetch_transform(kg, isect->object, OBJECT_TRANSFORM);
# endif
# endif
P = transform_point(&tfm, P);
}
return P;
# else /* __INTERSECTION_REFINE__ */
# else /* __INTERSECTION_REFINE__ */
return P + D * t;
# endif /* __INTERSECTION_REFINE__ */
# endif /* __INTERSECTION_REFINE__ */
# endif
}
#endif /* __BVH_LOCAL__ */

View File

@@ -320,6 +320,26 @@ ccl_device_inline uint object_patch_map_offset(KernelGlobals *kg, int object)
return kernel_tex_fetch(__objects, object).patch_map_offset;
}
/* Volume step size */
ccl_device_inline float object_volume_density(KernelGlobals *kg, int object)
{
if (object == OBJECT_NONE) {
return 1.0f;
}
return kernel_tex_fetch(__objects, object).surface_area;
}
ccl_device_inline float object_volume_step_size(KernelGlobals *kg, int object)
{
if (object == OBJECT_NONE) {
return kernel_data.background.volume_step_size;
}
return kernel_tex_fetch(__object_volume_step, object);
}
/* Pass ID for shader */
ccl_device int shader_pass_id(KernelGlobals *kg, const ShaderData *sd)

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