Commit Graph

109803 Commits

Author SHA1 Message Date
Hans Goudey
7d3d09b69c Geometry Nodes: Get and set nodes for ID attribute
These nodes allow accessing and changing the stable/random ID used
for motion blur with instances and stable randomness.

Since rB40c3b8836b7a, the stable ID is a built-in attribute, so to be
consistent and allow changing it in the node tree like other built-in
attributes, it has get and set nodes.
2021-10-26 15:40:57 -05:00
Cian Jinks
b37caa3f06 Fix: Knife unused function warning 2021-10-26 21:21:22 +01:00
Cian Jinks
71fd0f7b7b Fix: Knife measurements broken when a cut point is in space
Knife angle measurements were mis-aligned if a cut point was in space.
Specifically, the arc drawing would not match with the cut line.

Fixed by removing a correction for kcd->prev.cage.
This correction was originally added for panning with measurements to work.
In hindsight it is not needed and only introduces issues like this.
2021-10-26 21:12:48 +01:00
Julian Eisel
ca2ae350ec Asset Browser: Improve hint for asset library that isn't found
We already show a message when showing an asset library whose path can't be
found on disk. The red text was making it look like some fatal error happened.
And the message could be a bit more useful generally.

So this removes the red color of the text, (arguably) improves the text and
adds a button as shortcut to open the Preferences with the asset library
settings.

Differential Revision: https://developer.blender.org/D12894
2021-10-26 21:57:38 +02:00
Julian Eisel
d040493cd4 UI: Rename operator to open Preferences window
Renames the operator from "Show Preferences" to "Open Preferences...".  "Open"
is more clear than "Show" (since they could be shown in-place). "..." is
usually used in Blender to indicate that a new Window or popup will be opened.

Note that vanilla Blender doesn't actually show this name anywhere, so this
change shouldn't be visible. That may change, see D12894.
2021-10-26 21:57:38 +02:00
Ray Molenkamp
8422b24e1c Fix: Build issue on windows
Empty initializer is not appreciated by MSVC.
2021-10-26 13:44:26 -06:00
Julian Eisel
0cf9794c7e Assets: Rename "Default" asset library to "User Library"
Feedback was that "Default" is a bit of a weird name, so switching it to "User
Library". Added versioning code which won't be entirely bullet proof (e.g. will
also rename libraries named "Default" by the user), but it doesn't have to be.

Addresses T90298.
2021-10-26 21:01:44 +02:00
Jacques Lucke
319de793d7 Fix T92508: cache invalidation bug in Set Position node
The call to `attribute_try_get_for_output` does some cache invalidation
internally. Under some circumstances the call to `position_evaluator.evaluate()`
recomputed the caches (e.g. when the Normal node was used, the evaluated
handle positions cache on curves were updated). After the positions have
been updated in the Set Position node, the cache was not invalidated again.,
leading to incorrect rendering.

The proper solution will be to do the cache invalidation in `OutputAttribute.save()`
again. That is a bit more involved though. For now just reorder the code a bit
to do the cache invalidation after the field has been computed.
There is a follow up task: T92509.
2021-10-26 20:52:18 +02:00
Hans Goudey
35aa3bf22d Cleanup: Restore alphabetical order 2021-10-26 13:39:09 -05:00
Julian Eisel
f81c514bd2 Assets: Disable snap-dragging for linking object assets
The location of a linked object isn't editable, or at least it will be reset
when reloading the file. So the drag & drop shouldn't even pretend like this
would work, so disable the snapping of the object and the bounding-box to show
the snapped object location while dragging.
2021-10-26 20:30:51 +02:00
Julian Eisel
18ace3b541 Fix linked objects not appearing after dragging in from Asset Browser
When the Asset Browser import type was set to "Link", after dragging in an
object asset the object wouldn't actually appear in the viewport. Do the same
depsgraph tagging (and TODO comment) as the `OBJECT_OT_add_named` operator,
which does similar things.
2021-10-26 20:30:51 +02:00
Julian Eisel
63de6078da Fix objects not appearing in Outliner after dragging in from Asset Browser
When dragging in an object from an external asset library from the Asset
Browser, the Outliner wouldn't update.
2021-10-26 20:30:51 +02:00
Pablo Vazquez
4db4a97355 Node Editor: Style update to nodes
This patch changes how nodes look visually, in an attempt to fix a number of issues:
* The header background is currently drawn using a theme color fully opaque, this limits the colors we can use because the node name/label is drawn on top.
* Hard-coded transparency makes nodes hard to read. The node backdrop already has alpha so if the user wants it they can set it. This patch uses alpha from the theme.
* Better muted status indicator, instead of simply making everything transparent and the wires inside red, draw a red outline around the node, darken the header and backdrop.
* On muted nodes, display wires behind the backdrop to not interfere with text/widgets inside the node.

Nodes:

* Darken header to improve readability of node label.
* Draw a line under the header
* Thicker outline.
* Do not hard-code transparency on nodes, use the theme's node backdrop alpha component.
* Use angle icon instead of triangle (to be consistent with the [[ https://developer.blender.org/D12814 | changes ]] to panels)

Style adjustment to sockets drawing:

* Do not hard-code the socket outline color to black, use `TH_WIRE` instead
* Do not use `TH_TEXT_HI` for selected sockets, use `TH_ACTIVE` (active node outline)
* Do not draw sockets background transparent on muted nodes.
* Thicker outline to help contrast and readability

{F11496707, size=full}

Reviewed By: #user_interface, HooglyBoogly

Differential Revision: https://developer.blender.org/D12884
2021-10-26 20:19:24 +02:00
Hans Goudey
c7b27f45ae Fix: Show node editor dot grid when there is no node tree 2021-10-26 13:03:09 -05:00
Jacques Lucke
0bfae1b120 Geometry Nodes: geometry component type warning system
Previously, every node had to create warnings for unsupported input
geometry manually. Now this is automated. Nodes just have to specify
the geometry types they support in the node declaration.

Differential Revision: https://developer.blender.org/D12899
2021-10-26 20:00:10 +02:00
Hans Goudey
be3e09ecec Fix: Inverted normal for one curve to mesh cap 2021-10-26 12:59:46 -05:00
Hans Goudey
9fa304bf13 Geometry Nodes: Only create instance IDs when they exist
Instance IDs serve no purpose for rendering when they aren't stable from
one frame to the next, and if the index is used in the end anyway, there
is no point in storing a vector of IDs and copying it around.

This commit exposes the `id` attribute on the instances component,
makes it optional-- only generated by default with the distribute points
on faces node.

Since the string to curves node only added the index as each instance's
ID, I removed it. This means that it would be necessary to add the ID
data manually if the initial index actually helps (when deleting only
certain characters, for example).

Differential Revision: https://developer.blender.org/D12980
2021-10-26 12:50:39 -05:00
Hans Goudey
b6d2bee28f Geometry Nodes: Support instances in the remove attribute node
This node is still hidden, but allowing removing the `id` attribute is
useful for testing, and possibly optimization in the future.
2021-10-26 12:45:47 -05:00
6871f8482b 3D View, Objects menu: Always show Assets sub-menu
Now that object assets are no longer considered experimental, the Assets
submenu can always be shown (regardless of the Extended Asset Browser
experimental feature).
2021-10-26 19:27:01 +02:00
Julian Eisel
3286150ac9 Assets: Enable object asset support by default
The two blocking issues for object assets are addressed, see T92111 and T90198.
So now, objects can be marked as assets and be used in the Asset Browser.
2021-10-26 19:24:46 +02:00
7bffddfa6e Don't deselect assets in ED_fileselect_activate_by_id
`ED_fileselect_activate_by_id()` activates an asset (i.e. marks it as
the active asset in the asset browser). To avoid an "active but not
selected" state, it also selects it.

Before this commit, the function would also deselect all other assets,
but that's considered doing too much. If deselection is required, the
`ED_fileselect_deselect_all()` function can be called.

Manifest Task: T92152
2021-10-26 19:21:22 +02:00
Campbell Barton
a062d86230 Drop object assets and associated objects at the cursor location
When dropping asset objects, place them under the mouse-cursor
along with any other objects they link in.

Ref D12935

Reviewed By: Severin
2021-10-27 04:19:45 +11:00
eaed38cbd3 Add Assets menu to 3D View's Object menu
In the 3D Viewport, add an "Assets" submenu to the Objects menu, for the
same operators as available in the outliner: Mark as Asset, Clear Asset,
Clear Asset (Set Fake User).

Since object assets are still considered experimental, the menu is only
shown when the Extended Asset Browser experimental feature is enabled.
2021-10-26 18:56:13 +02:00
Julian Eisel
730de2e7fd Asset Browser: Show disabled-hint when dragging external assets over catalog
There's now a message displayed in red next to the cursor explaining that only
assets from the current file can be moved between catalogs.

The previous commit prepared this.
2021-10-26 18:55:27 +02:00
Julian Eisel
11e8a2ec5f UI: Support disabled-hint for dropping in the tree-view API
A tree-view item's drop controller can now return a message for the user
explaining why dropping isn't possible with the dropped data. This is then
displayed in red text next to the cursor.

This isn't actually used yet, the follow up commit will do that.
2021-10-26 18:55:27 +02:00
03c0581c6e Assets: allow Mark/Clear Asset operators from 3D Viewport
Make it possible to run `ASSET_OT_mark` and `ASSET_OT_clear` operators from
the 3D Viewport. There is no menu entry, just compatibility with pressing
F3 and executing the operators from the operator search.
2021-10-26 18:35:13 +02:00
2d5c9e0baf Cleanup: 3D View context, early returns for clearer flow
Refactor `view3d_context()` to use early `return`s instead of a bundle of
`if`/`else if`/`else`, some of which had `return`s and some not.

No functional changes.
2021-10-26 18:35:13 +02:00
5acbc01d0d Cleanup: 3D View context, use enum values
Use explicit enum values instead of returning 0/1 from `view3d_context()`.

No functional changes.
2021-10-26 18:35:13 +02:00
26e3045eb9 3D View context: return "ok" when fetching view3d context dir
`view3d_context()` would return `-1` ("found but not available") when
fetching the context dir. This is incorrect; it should return 1 ("ok").

This is a semantic change in preparation of further cleanup of the code.
2021-10-26 18:35:13 +02:00
Kévin Dietrich
03013d19d1 Eevee: support accessing custom mesh attributes
This adds generic attribute rendering support for meshes for Eevee and
Workbench. Each attribute is stored inside of the `MeshBufferList` as a
separate VBO, with a maximum of `GPU_MAX_ATTR` VBOs for consistency with
the GPU shader compilation code.

Since `DRW_MeshCDMask` is not general enough, attribute requests are
stored in new `DRW_AttributeRequest` structures inside of a convenient
`DRW_MeshAttributes` structure. The latter is used in a similar manner
as `DRW_MeshCDMask`, with the `MeshBatchCache` keeping track of needed,
used, and used-over-time attributes. Again, `GPU_MAX_ATTR` is used in
`DRW_MeshAttributes` to prevent too many attributes being used.

To ensure thread-safety when updating the used attributes list, a mutex
is added to the Mesh runtime. This mutex will also be used in the future
for other things when other part of the rendre pre-processing are multi-threaded.

`GPU_BATCH_VBO_MAX_LEN` was increased to 16 in order to accommodate for
this design.

Since `CD_PROP_COLOR` are a valid attribute type, sculpt vertex colors
are now handled using this system to avoid to complicate things. In the
future regular vertex colors will also use this. From this change, bit
operations for DRW_MeshCDMask are now using uint32_t (to match the
representation now used by the compiler).

Due to the difference in behavior for implicit type conversion for scalar types
between OpenGL and what users expect (a scalar `s` is converted to
`vec4(s, 0, 0, 1)` by OpenGL, vs. `vec4(s, s, s, 1)` in Blender's various node graphs) ,
all scalar types are using a float3 internally for now, which increases memory usage.
This will be resolved during or after the EEVEE rewrite as properly handling
this involves much deeper changes.

Ref T85075

Reviewed By: fclem

Maniphest Tasks: T85075

Differential Revision: https://developer.blender.org/D12969
2021-10-26 18:29:30 +02:00
Hans Goudey
8ddfdfd2b2 Geometry Nodes: Handle multiple grids in the volume to mesh node
In future use cases, a volume can contain many grids that represent the
density information. In this case, it's better if the volume to mesh node
creates a mesh based on all of the grids in the volume.

This is also a benefit to share-ability, since one doesn't have to
specify the grid name in the node. Instead, in the future we can have
a way to split particular grids into separate volumes, if only one
grid should be considered.

The code changes are relatively simple:
 - Move the old volume to mesh node to the legacy folder.
 - Run the volume to mesh node on all instance geometry, like elsewhere.
 - Make the blenkernel's volume to mesh API a bit more specific.

Differential Revision: https://developer.blender.org/D12997
2021-10-26 11:25:44 -05:00
Julian Eisel
7979dff9dc UI: Let object drop operator display hint why it's disabled
When dragging an object in non-object mode into a 3D View, there will now be
red text explaining that this is only possible in object mode.
The previous commit enabled this.
2021-10-26 18:14:17 +02:00
Julian Eisel
df2e053935 UI: Improved feedback when dropping is not possible on drag 'n drop
* Allow operators to show a "disabled hint" in red text explaining why dropping
  at the current location and in current context doesn't work. Should greatly
  help users to understand what's the problem.
* Show a "stop" cursor when dropping isn't possible, like it's common on OSes.

Differential Revision: https://developer.blender.org/D10358
2021-10-26 18:14:17 +02:00
YimingWu
ec831ce5df LineArt: Trimming edges right at the image border
This option allows the edge to end right at the border
instead of extending beyond.
Useful when having multiple camera setup where you
want the border to be clean.
Also moved overscan option down inside "Composition" sub panel
so it makes more sense.

Reviewed By: Antonio Vazquez (antoniov)

Differential Revision: https://developer.blender.org/D12126
2021-10-27 00:10:49 +08:00
Hans Goudey
3371a4c472 UI: Improve node editor breadcrumbs display
This patch upgrades node editor breadcrumbs to have slightly more
visual weight, to including the base path of object/modifier/world,
etc, have more visually pleasing spacing, and contain icons.

In the code, a generic "context path" is added to interface code.
The idea is that this could be used to draw other breadcrumbs in areas
like the property editor or the spreadsheet, and features could be added
to all of those areas at the same time.

Ideally we would be able to control the color of the breadcrumbs with a
specific theme color, but since they are drawn with the regular layout
system, that is not easily possible.

Thanks to @fabian_schempp for the original patch.

Differential Revision: https://developer.blender.org/D10413
2021-10-26 11:05:11 -05:00
Hans Goudey
f1a662c157 Fix: Assert on startup from incorrect float property min 2021-10-26 11:03:45 -05:00
Jacques Lucke
01d7211380 Fix T92505: previewing specific node outputs did not work anymore
This was missing from my refactor in rB5bfe09df2244cb9de0b6554a378eecef77b1e75d.
2021-10-26 17:53:41 +02:00
YimingWu
efbd36429a LineArt: Custom Camera
Allows line art camera to be different from scene active camera,
useful when baking multiple shots in different angle as
well as for motion graphics effect.

Reviewed By: Antonio Vazquez (antoniov)

Differential Revision: https://developer.blender.org/D12047
2021-10-26 23:44:13 +08:00
YimingWu
773f5065f3 LineArt: Fix prop range for stroke_depth_offset. 2021-10-26 23:44:13 +08:00
YimingWu
c3ef1c15f5 LineArt: Stroke offset towards camera.
Allows the user to turn off in_front option for grease pencil object
and offset strokes towards camera to allow depth interaction of the
rest of the scene.

Reviewed By: Antonio Vazquez (antoniov)

Differential Revision: https://developer.blender.org/D12046
2021-10-26 23:02:17 +08:00
Charlie Jolly
52ccb44501 Geometry Nodes: Add Brick Texture node
Port brick shader node to GN

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D12783
2021-10-26 15:39:53 +01:00
Brecht Van Lommel
a90cb41cb9 Cleanup: clang-format 2021-10-26 16:35:26 +02:00
Brecht Van Lommel
d89c4999a7 Fix Cycles runtime GPU kernel compilation after recent refactor 2021-10-26 16:22:50 +02:00
Brecht Van Lommel
dde11219c6 Cleanup: remove files that should not have been added in file renames 2021-10-26 16:22:50 +02:00
William Leeson
366262bef5 Distance Scrambling for for Cycles X - Sobol version
Cycles:Distance Scrambling for Cycles Sobol Sampler

This option implements micro jittering an is based on the INRIA
research paper [[ https://hal.inria.fr/hal-01325702/document | on micro jittering ]]
and work by Lukas Stockner for implementing the scrambling distance.
It works by controlling the correlation between pixels by either using
a user supplied value or an adaptive algorithm to limit the maximum
deviation of the sample values between pixels.

This is a follow up of https://developer.blender.org/D12316

The PMJ version can be found here: https://developer.blender.org/D12511

Reviewed By: leesonw

Differential Revision: https://developer.blender.org/D12318
2021-10-26 16:11:27 +02:00
Sergey Sharybin
4094868f73 Fix T92502: Position Pass broken
The kernel was writing it for the first sample only, while the film
accessor was thinking it needs to be filtered.
2021-10-26 16:06:35 +02:00
Dorian
f41d4735e9 Nodes: support transparency for link highlight color
Node links that are connected to selected nodes are highlighted
using the Wire Select theme color. Now it is possible to change the
transparency of this color to allow the actual link color to be visible
through the highlight (or to turn of the highlight entirely).

Differential Revision: https://developer.blender.org/D12973
2021-10-26 15:55:44 +02:00
Brecht Van Lommel
567bcb9387 Cleanup: skip unnecessary OIIO image setup when not using tiled render 2021-10-26 15:39:58 +02:00
Brecht Van Lommel
b937b6d069 Cleanup: silence address sanitizer warning about NULL + 0 2021-10-26 15:39:25 +02:00
Brecht Van Lommel
8de942b11d Cleanup: compiler warning when building without OpenSubdiv 2021-10-26 15:38:37 +02:00