114521 Commits

Author SHA1 Message Date
Bastien Montagne
84756b68e6 Add documentation about Image/ImBuf to python/RNA API.
Related to T95616, the relationship between Image ID and ImBuf 'cached'
buffers can be fairly confusing when using the RNA API.

Reviewed By: campbellbarton, jbakker

Differential Revision: https://developer.blender.org/D14833
2022-05-06 11:11:33 +02:00
Campbell Barton
62450e8485 WM: suppress assertion when switching tools
Changing the object mode outside the 3D view would trigger this
assertion. This was harmless, only assert for space types that
define the tools mode.
2022-05-06 17:44:32 +10:00
Campbell Barton
693aa573db Fix T96585: Intersect(Knife) tool is selecting wrong edges
Regression caused by [0] which flushed selection from vertices -> edges,
causing additional edges to be selected. Now selected is flushed based
on the mode, instead of all elements. Note that these function names
could be improved to make it clearer how these flushing functions are
different.

Also skip flushing unless selection is performed.

[0]: 55c82d8380ea3fd37a9d966fad10f42cc5b365d5
2022-05-06 16:18:04 +10:00
Campbell Barton
929a210608 Fix T97758: Applying modifiers bakes shape-keys
Regression in [0] which is useful when applying modifiers as a shape-key
but not when applying modifiers which keeps the existing shape-keys.

[0]: 65c5ebf5779d07fb92fabd0ff992337f6c980cde
2022-05-06 13:40:54 +10:00
Brecht Van Lommel
1b566b70c1 Fix T95308, T93913: Cycles mist pass wrong with SSS shader
It was wrongly writing passes twice, for both the surface entry and exit points.
We can skip code for filtering closures, emission and holdout also, as these do
nothing with only a subsurface diffuse closure present.
2022-05-05 22:01:45 +02:00
Brecht Van Lommel
e4931ab86d Cleanup: clang format 2022-05-05 21:57:08 +02:00
Brecht Van Lommel
75a051a6ab Fix T93246: Cycles wrong volume shading after transparent surface
The Russian roulette probability was not taken into account for volumes in all
cases. It should not be left out from the SD_HAS_ONLY_VOLUME case.
2022-05-05 20:51:01 +02:00
Campbell Barton
b891c72d2d Fix T97575: Toggling fullscreen causes compositor recalc
The root of the issue is that compositor is using refresh mechanism
to handle recalc.

The safest fix which does not require deep refactor is to check to
whether node space was tagged for refresh from listener (currently
it is listeners which are responsible for tackling compositor tree
recalc).

Differential Revision: https://developer.blender.org/D14856
2022-05-05 15:35:59 +02:00
Aras Pranckevicius
1830a3dfb5 Fix T97863: new OBJ importer issues with extra whitespace after "f" keywords
While possible extra whitespace after all OBJ/MTL keywords was properly
skipped, it was not done for the "f" (face definition) keyword.

While at it, also support indented keywords, i.e. extra whitespace at
the beginning of the line.

There's a tiny bit of performance drop while importing (e.g. importing
blender 3.0 splash scene: 53.38sec -> 54.21sec on my machine). But
correctness is more important.

Reviewed By: Howard Trickey
Differential Revision: https://developer.blender.org/D14854
2022-05-05 14:59:46 +03:00
Campbell Barton
756710800c File missing from 78fc5ea1c398f70d22cda72be33c105146c0d542 2022-05-05 20:40:56 +10:00
Campbell Barton
78fc5ea1c3 Workaround T81065: Merge UV's when applying modifiers
Support merging UV's that share the same vertex and are very close when
applying modifiers.

This is needed to prevent UV's becoming "detached" which can happen when
applying the subdivision surface modifier.

This regression was caused by [0] which removed selection threshold for
nearby coordinates. While restoring the UV selection threshold could be
done - some selection operations that walk around connected UV fans
wouldn't behave in a deterministic way (such as select shortest path).
There are also other cases where UV's may be compared without a
threshold such as tangent calculation and exporters which have their own
logic to handling UV's.

Also resolves T86896, T89903.

[0]: b88dd3b8e7b9c02ae08d4679bb427963c5d21250

Reviewed By: sergey

Ref D14841
2022-05-05 20:36:15 +10:00
Campbell Barton
598917f49b Fix T97874: Python exception after undo with image space visible
Ensure tools are initialized with the correct area type set.
2022-05-05 20:13:10 +10:00
Campbell Barton
7e02c90103 Fix WM_toolsystem_refresh_screen_all failing to refresh tools
Error in 3e1baa7d539757b8e5fa870d4909354e0b5645b9.
2022-05-05 20:13:10 +10:00
Clément Foucault
94533ca4b8 Cleanup: EEVEE: Fix clang-tidy warnings and unused var warning 2022-05-05 11:55:13 +02:00
Clément Foucault
3505d948c6 DRW: Hair: Fix shader compilation of transform feedback shader
Introduced by rBadbe71c3faba.
2022-05-05 11:44:31 +02:00
Germano Cavalcante
adbe71c3fa Fix T97835: crash when creating hair particle system on Mac
Recently `gpu_shader_3D_smooth_color_frag.glsl` had the uniform declarations removed.

For shaders without `ShaderCreateInfo` that require this source this results in the error:
```
ERROR (gpu.shader): hair_refine_shader_transform_feedback_workaround_create FragShader:
      |
   54 |   fragColor = finalColor;
      |
      | gpu_shader_3D_smooth_color_frag.glsl:5:0: Error: Use of undeclared identifier 'fragColor'
      | gpu_shader_3D_smooth_color_frag.glsl:5:0: Error: Use of undeclared identifier 'finalColor'
      |
   55 |   fragColor = blender_srgb_to_framebuffer_space(fragColor);
      |
      | gpu_shader_3D_smooth_color_frag.glsl:6:0: Error: Use of undeclared identifier 'fragColor'
      | gpu_shader_3D_smooth_color_frag.glsl:6:0: Error: Use of undeclared identifier 'fragColor'
```

So port that shader to use `ShaderCreateInfo`.
2022-05-04 21:42:38 -03:00
Brecht Van Lommel
f11dba8892 Fix Cycles world light group confusing UI
Move to a subpanel of the Settings panel. Otherwise it seems like it's a
setting of one of the shader nodes.
2022-05-04 21:23:18 +02:00
Lukas Stockner
0fa1c65ee3 Fix T95644: Cycles doesn't update modified object attributes on GPU
evice_update_preprocess is supposed to detect modified attributes and flag the
device_vector for a copy through device_update_flags. However, since object
attributes are only created in device_update_attributes afterwards, they can't
be included in that check.

Change the function that actually updates the device_vector to tag it as
modified as soon as its content gets updated.

Differential Revision: https://developer.blender.org/D14815
2022-05-04 20:07:19 +02:00
Brecht Van Lommel
54f447ecde Fix T96718: Cycles invalid pixels when using bump normal for light emission
A shader node setup accidentally used the bump normal as emission. Bump
mapping nodes are excluded from light shader evaluation to reduce kernel size
and register pressure, but in that case should write zero instead of leaving
memory uninitialized.

Thanks to Lukas for helping identify the cause.
2022-05-04 20:01:04 +02:00
Brecht Van Lommel
ac9ebc9de3 Fix Cycles division by zero in material preview render
If the render gets cancelled before the first sample finishes.
2022-05-04 20:01:04 +02:00
Kévin Dietrich
fc0f6d19ad Fix T96845: artifacts with GPU subdivision and mirror modifier
The coarse polygon count was set to the one of the BMesh instead of
the the one of the mesh used for subdivision, which caused the
compute shaders to output wrong data.
2022-05-04 19:31:53 +02:00
Brecht Van Lommel
5d7ee44406 Fix T95527: wrong motion blur with rigid bodies
This index is not meant for the point cache data array, it's already offset.
2022-05-04 19:28:17 +02:00
Bastien Montagne
60772baebf Fix T97709: Compositor: Scenes are being set to no users after doing a full copy.
Similar issue/solution as in rB5188c14718c5 from this Monday actually,
there may be more of those still lurking around... Quite surprising they
all get reported now, this behavior has been in Blender since years.
2022-05-04 17:29:50 +02:00
Antonio Vazquez
b5c3885bf0 Fix T97851: GPencil Bake object transform operator wrong transformation
The problem was the layer transformation was already applied in the layer and if we apply in the bake, we are doing double transformation.

Differential Revision: https://developer.blender.org/D14844
2022-05-04 17:18:58 +02:00
Brecht Van Lommel
5559ea59a1 Cycles: mark all CUDA 11.x versions as supported
All released versions appear to work fine. Also slightly change wording.
2022-05-04 17:07:39 +02:00
Brecht Van Lommel
b5b6ae06f9 Build: update outdated description of WITH_TBB option 2022-05-04 17:07:39 +02:00
Jacques Lucke
54b293237e Fix T97375: changing node tree from Python is very slow
The issue was that the `NodeTreeRef` acceleration data structure was
rebuild much more often than necessary. That happened because the
Map Range node accidentally tagged the node tree for change even
though it did not actually change.

Differential Revision: https://developer.blender.org/D14842
2022-05-04 15:02:19 +02:00
Kévin Dietrich
d86d7c935e Fix T97827: material preview not displaying textures
Caused by rB281bcc1c1dd6 which did not properly made use
of `vec4` for UVs which are now loaded as attributes.
2022-05-04 14:30:52 +02:00
Aras Pranckevicius
cbeb8770cc Fix T97794: new OBJ importer does not handle quoted MTL paths
Fixes T97794 (which is a reintroduction of an older issue T67266 that
has been fixed in the python importer, but the fix was not in the C++
one). Some software produces OBJ files with mtllib statements like
mtllib "file name in quotes.mtl", and the new importer was not stripping
the quotes away.

While at it, I noticed that MTLParser constructor was taking a StringRef
and treating it as a zero-terminated string, which is not necessarily
the case. Fixed that by explicitly using a StringRefNull type.

Reviewed By: Howard Trickey
Differential Revision: https://developer.blender.org/D14838
2022-05-04 15:10:54 +03:00
Yann Lanthony
b31f5b8ce7 GPencil: Apply layer transforms to visible frames
Fix regression described in T97799.

Apply layer transform and layer parenting to all visible frames, i.e. active frame + onion skinning frames.

Reviewed By: #grease_pencil, antoniov

Maniphest Tasks: T97799

Differential Revision: https://developer.blender.org/D14829
2022-05-04 12:58:57 +02:00
Hans Goudey
302584bd6e Fix T97831: Curve to mesh node can create invalid wire mesh
When the profile only has one control point, its segment count was
determined incorrectly. There needs to be a special case for a single
control point, when there are no segments even if the curve is cyclic.
2022-05-04 12:26:59 +02:00
Campbell Barton
79e94caa6b Fix error pasting text containing tabs
Regression in [0] which missed updating the string length
when converting tabs to spaces - the pasted string would be shorter.

[0]: e2f4c4db8d6cbe4694c24d599e16ee3889871bdd
2022-05-04 19:28:11 +10:00
Jeroen Bakker
0375720e28 Fix T95165: Custom Normals tools dont update immediately.
Recalc selection count at the end of the circle selection.
This was removed from circle selection as it became a performance
bottleneck, helas some operators rely on it.
2022-05-04 09:22:17 +02:00
Campbell Barton
0383047257 Cleanup: quiet strict-prototypes warning 2022-05-04 14:01:18 +10:00
Campbell Barton
2a89509e45 License headers: add missing license headers
Add missing license headers based on files in the same directory.
2022-05-04 13:58:53 +10:00
Brecht Van Lommel
e86b62f195 Fix wrong task priority for particle distribution and tanget computation
These kinds of depsgraph evaluations should not be marked as low priority as
this could negatively affect playback performance. Low priority should mainly
be used for background tasks.
2022-05-03 23:08:29 +02:00
Brecht Van Lommel
5b2a6b6ebb Fix T96880: viewport render animation hangs Blender
Isolate frame writing task so that multithreaded image operations don't cause
the thread to start writing another frame. If that happens we may reach the
MAX_SCHEDULED_FRAMES limit, and cause the render thread and writing threads to
deadlock waiting for each other.

Additionally, don't set task priority to low because this may cause the task
scheduler to be slow in scheduling the write and color management tasks.
2022-05-03 23:08:29 +02:00
Kévin Dietrich
281bcc1c1d Fix T93179: geonodes UVs and Vertex colors do not work in EEVEE
Overwriting UV map or vertex color data in Geometry nodes will move the
layers to another CustomData channel, and as such, will make attribute
lookup fail from the UVMap and Vertex Color nodes in EEVEE as the
CustomDataType will also be modified (i.e. no longer `CD_MTFACE` or
`CD_MCOL`).

As discussed in T93179, the solution is to use `CD_PROP_AUTO_FROM_NAME`
so that the render engine is able to find the attributes. This also makes
EEVEE emulate Cycles behaviour in this regard. `attr_load_uv` and
`attr_load_color` are also removed in favor of the generic attribute
API in the various GLSL shaders.

Although `CD_PROP_AUTO_FROM_NAME` is now used even for UV maps, the
active UV map is still used in case the attribute name is empty, to
preserve the old behavior.

Differential Revision: https://developer.blender.org/D13730
2022-05-03 22:50:04 +02:00
Brecht Van Lommel
94205e1d02 Fix T96822: Cycles motion blur + persistent data not updating properly
At the frame before/after an object starts moving, it's transform may not be
modified but its motion would be and requires an update.
2022-05-03 22:16:08 +02:00
Kévin Dietrich
947f8ba300 Fix T96338: GPU subdiv crash switching to UV editing
The crash is caused as the data for the UV editor is requested before
the data for the mesh as a separate draw update. Since building the UV
stretch angle buffer requires the position buffer, the latter is not
created yet in this case.

To fix this, create a local position buffer from the subdivision data. An
alternate fix was considered to remove the dependency on the position
buffer by interpolating on the GPU the coarse stretch angle buffer but
this did work. Maybe this will be revisited.
2022-05-03 18:02:10 +02:00
Aras Pranckevicius
5962db093f Fix T97793, Fix T97795: Use correct defaults for missing values in new OBJ importer
- Fix T97793: when a UV coordinate after vt is missing, use zero. While
  at it, also use zeroes for positions & normals, since "maximum
  possible float" is very likely to cause issues in imported meshes.
- Fix T97795: use 1.0 default if -bm value is missing, instead of zero.

Reviewed By: Howard Trickey
Differential Revision: https://developer.blender.org/D14826
2022-05-03 14:45:44 +03:00
Aras Pranckevicius
5f5e7ac317 Fix T97757: Some MTL import correctness issues in the new OBJ importer
Fix several correctness issues where the new OBJ/MTL importer was not
producing the same results as the old one, mostly because the code for
some reason had slightly different logic. Fixes T97757:

- When .obj file tries to use a material that does not exist, the code
  was continuing to use the previous material, instead of creating new
  default one, as the previous importer did.
- Previous importer was always searching/parsing "foo.mtl" for a
  "foo.obj" file, even if the file itself does not contain
  "mtllib foo.mtl" statement. One file from T97757 repros happens to
  depend on that, so resurrect that behavior.
- When IOR (Ni) or Alpha (d) are not specified in .mtl file, do not
  wrongly set -1 values to the blender material.
- When base (Kd) or emissive (Ke) colors are not specified in the .mtl
  file, do not set them on the blender material.
- Roughness and metallic values used by viewport shading were not set
  onto blender material.
- The logic for when metallic was set to zero was incorrect; it should
  be set to zero when "not using reflection", not when "mtl file does
  not contain metallic".
- Do not produce a warning when illum value is not spelled out in .mtl
  file, treat as default (1).
- Parse illum as a float just like python importer does, as to not
  reintroduce part of T60135.

Reviewed By: Howard Trickey
Differential Revision: https://developer.blender.org/D14822
2022-05-03 14:44:49 +03:00
Richard Antalik
a2e3005b42 Fix VSE view clamping not working
Clamping was set up, but `v2d->cur` was never actually modified.
2022-05-03 10:55:05 +02:00
Richard Antalik
2ea9d1fccf Fix T97720: Fix meta strip shows incorrect mute state.
Caused by only checking mute state for meta strip itself and not the
children.
2022-05-03 10:55:05 +02:00
Bastien Montagne
20f819d708 Fix T95541: Broken vertex weight with mirror modifier.
Regression from rB1a7757b0bc69/rBa0acb9bd0cc0. Special handling
(averaging) of weights on merged center vertices also requires to be
'reversed' when new correct merge order is used, compared to previous
behavior.
2022-05-03 10:33:38 +02:00
Campbell Barton
cfdec85cd9 Cleanup: auto-format 2022-05-03 18:32:12 +10:00
Campbell Barton
4824cad580 GNUmakefile: include autopep8 in the "make format" target
Run autopep8 as well as clang-format when calling "make format",
the PATHS argument is passed to both utilities which will only operate
on files they support.

For example: `make format PATHS=release/scripts` formats Python scripts,
`make format PATHS=source/blender/blenlib` would format C/C++.
If users really want they can format C/C++ & Python files at the same
time since both formatting utilities filter on file extension.

`make format PATHS="release/scripts/startup/nodeitems_builtins.py source/creator/creator.c"`

A LIBDIR variable has been added to the GNUmakefile to simplify
references to this directory which can be one of 3 possible values.

Reviewed By: sybren, brecht

Ref D14789
2022-05-03 18:32:00 +10:00
Campbell Barton
74dfb7ca23 Fix T97731: Python traceback no longer includes line-numbers
Regression caused by [0] that caused the error message to be
created based on a normalized exception (which hid line numbers).

PyC_ExceptionBuffer{_Simple} & BPy_errors_to_report
no longer clears the exception.

This could have been resolved by changing python_script_error_jump
however that would involve changes to reference counting that are more
risky (noted in code-comment).

[0]: 2d2baeaf04d481f284bc2f098fb6d7ee9268151f
2022-05-03 18:22:54 +10:00
Campbell Barton
a821a2db3d Cleanup: remove redundant PyErr_Clear calls after PyErr_Fetch 2022-05-03 18:22:54 +10:00
Campbell Barton
1fc95d829f CMake: fix error building when CUDA_NVCC_EXECUTABLE is missing 2022-05-03 18:22:54 +10:00