1
1

Compare commits

...

513 Commits

Author SHA1 Message Date
38b12c763f Merge branch 'master' into soc-2021-porting-modifiers-to-nodes_all 2021-08-22 08:51:26 +02:00
49a16a1ca8 Fix: Default selection in dissolve node. 2021-08-21 23:27:55 +02:00
7ac9f9a97f Fix: Inset socket nameing was wrong 2021-08-20 00:05:24 +02:00
cb66eb8da2 Fix: changed BMiter to BMOIter in BM_tag_<Elem_Type>_from_operator_slot 2021-08-19 23:25:38 +02:00
bfaf97dec9 Merge branch 'master' into soc-2021-porting-modifiers-to-nodes_all 2021-08-19 22:40:00 +02:00
8137c1be09 SOC2021 Porting Modifiers To nodes all
This branch merges all branches from soc2021 porting modifiers to nodes
into one. The branche is mainly used to make a testbuild.
2021-08-19 22:07:01 +02:00
c674adb6f4 SOC2021 Porting Modifiers To nodes all
This branch merges all branches from soc2021 porting modifiers to nodes
into one. The branche is mainly used to make a testbuild.
2021-08-19 07:30:47 +02:00
2fb714443c Merge branch 'soc-2021-porting-modifiers-to-nodes-solidify' into soc-2021-porting-modifiers-to-nodes
# Conflicts:
#	release/scripts/startup/nodeitems_builtins.py
#	source/blender/blenkernel/BKE_node.h
#	source/blender/geometry/CMakeLists.txt
#	source/blender/makesrna/RNA_enum_types.h
#	source/blender/modifiers/CMakeLists.txt
#	source/blender/nodes/NOD_static_types.h
2021-08-17 22:46:29 +02:00
529a132cc9 Merge branch 'soc-2021-porting-modifiers-to-nodes-remesh-voxel' into soc-2021-porting-modifiers-to-nodes
# Conflicts:
#	release/scripts/startup/nodeitems_builtins.py
#	source/blender/blenkernel/BKE_node.h
#	source/blender/blenkernel/intern/node.cc
#	source/blender/nodes/CMakeLists.txt
#	source/blender/nodes/NOD_geometry.h
#	source/blender/nodes/NOD_static_types.h
#	source/blender/nodes/geometry/nodes/node_geo_remesh_voxel.cc
2021-08-17 22:42:40 +02:00
6e58f6b304 Merge branch 'soc-2021-porting-modifiers-to-nodes-remesh-blocks' into soc-2021-porting-modifiers-to-nodes
# Conflicts:
#	release/scripts/startup/nodeitems_builtins.py
#	source/blender/blenkernel/BKE_node.h
#	source/blender/geometry/CMakeLists.txt
#	source/blender/makesrna/intern/rna_nodetree.c
2021-08-17 22:39:49 +02:00
9e4e3b5f5f Merge branch 'soc-2021-porting-modifiers-to-nodes-merge-by-distance' into soc-2021-porting-modifiers-to-nodes
# Conflicts:
#	source/blender/blenkernel/BKE_node.h
#	source/blender/makesrna/RNA_enum_types.h
2021-08-17 22:36:26 +02:00
844d975972 Merge branch 'soc-2021-porting-modifiers-to-nodes-extrude-and-move' into soc-2021-porting-modifiers-to-nodes
# Conflicts:
#	release/scripts/startup/nodeitems_builtins.py
#	source/blender/blenkernel/BKE_node.h
2021-08-17 22:35:07 +02:00
f5f2e685f5 Merge branch 'soc-2021-porting-modifiers-to-nodes-extrude' into soc-2021-porting-modifiers-to-nodes
# Conflicts:
#	release/scripts/startup/nodeitems_builtins.py
#	source/blender/blenkernel/BKE_node.h
#	source/blender/bmesh/intern/bmesh_mesh.c
#	source/blender/bmesh/intern/bmesh_mesh.h
2021-08-17 22:33:55 +02:00
7649b84462 Merge branch 'soc-2021-porting-modifiers-to-nodes-decimate' into soc-2021-porting-modifiers-to-nodes 2021-08-17 22:32:46 +02:00
6dda3a7f2e Cleanup 2021-08-16 07:56:36 +02:00
4a5d913d1d Merge remote-tracking branch 'origin/soc-2021-porting-modifiers-to-nodes-extrude-and-move' into soc-2021-porting-modifiers-to-nodes-extrude-and-move 2021-08-16 07:53:46 +02:00
038b87b8b2 Cleanup 2021-08-16 07:53:30 +02:00
9887dac2fb Geometry Nodes: Mesh Extrude
Node that extrudes vertices, edges and Faces. Uses the
corresponding bmesh operator.

I renamed D12108, which was previously named Mesh Extrude to Mesh Inset,
 because that uses the bmesh inset operators.

 NOTE: This requires an update of the attribute interpolation to work,
 that is not yet in master.

 Part of the GSOC 2021

Differential Revision: https://developer.blender.org/D12224
2021-08-16 07:50:52 +02:00
33c35c9340 Geometry Nodes: Mesh Extrude
Node that extrudes vertices, edges and Faces. Uses the
corresponding bmesh operator.

I renamed D12108, which was previously named Mesh Extrude to Mesh Inset,
 because that uses the bmesh inset operators.

 NOTE: This requires an update of the attribute interpolation to work,
 that is not yet in master.

 Part of the GSOC 2021
2021-08-16 07:48:04 +02:00
fad55ce70b Merge branch 'master' into soc-2021-porting-modifiers-to-nodes-extrude-and-move
# Conflicts:
#	source/blender/blenkernel/BKE_node.h
2021-08-15 09:13:45 +02:00
ce4420e803 Changes based on review by Jacques Lucke
(JacquesLucke)
2021-08-15 09:05:00 +02:00
4bab2cca5d Merge branch 'master' into soc-2021-porting-modifiers-to-nodes-remesh-blocks
# Conflicts:
#	source/blender/blenkernel/BKE_node.h
#	source/blender/modifiers/CMakeLists.txt
2021-08-15 02:10:46 +02:00
fb8c049232 Changes based on review by Hans Goudey (HooglyBoogly) and Jacques Lucke
(JacquesLucke)
2021-08-15 02:07:29 +02:00
45904e2dd1 Merge branch 'master' into soc-2021-porting-modifiers-to-nodes-remesh-voxel
# Conflicts:
#	source/blender/blenkernel/BKE_node.h
2021-08-14 21:05:42 +02:00
ec0ebcdcc4 Changes based on review by Hans Goudey (HooglyBoogly) and Jacques Lucke
(JacquesLucke)
2021-08-14 20:52:49 +02:00
ee7b2e2678 Merge branch 'master' into soc-2021-porting-modifiers-to-nodes-decimate
# Conflicts:
#	source/blender/blenkernel/BKE_node.h
2021-08-14 15:03:34 +02:00
bcb7f4c172 Merge branch 'master' into soc-2021-porting-modifiers-to-nodes-solidify 2021-08-14 00:08:23 +02:00
c54bdc7fb6 fixed typo in rna 2021-08-14 00:01:13 +02:00
a28e518917 Changes based on review by Hans Goudey (HooglyBoogly) 2021-08-13 23:57:13 +02:00
b60fa77678 Added missing line breaks at end of files. 2021-08-13 08:26:39 +02:00
4de8acc88d Merge branch 'master' into soc-2021-porting-modifiers-to-nodes-merge-by-distance 2021-08-13 08:19:37 +02:00
7df84749ad Changes based on review bv Hans Goudey (HooglyBoogly) 2021-08-13 08:18:58 +02:00
20d2c92119 Merge branch 'master' into soc-2021-porting-modifiers-to-nodes-merge-by-distance
# Conflicts:
#	source/blender/blenkernel/BKE_node.h
#	source/blender/editors/asset/ED_asset_temp_id_consumer.h
2021-08-12 21:49:52 +02:00
745ff852f5 Merge branch 'master' into soc-2021-porting-modifiers-to-nodes-solidify
# Conflicts:
#	source/blender/blenkernel/BKE_node.h
#	source/blender/geometry/intern/solidify_nonmanifold.c
#	source/blender/nodes/NOD_static_types.h
2021-08-06 07:58:14 +02:00
a7dc3d1e90 Merge remote-tracking branch 'origin/soc-2021-porting-modifiers-to-nodes-extrude' into soc-2021-porting-modifiers-to-nodes-extrude 2021-08-06 07:53:56 +02:00
6fd836f53b Merged Master 2021-08-06 07:48:40 +02:00
991f6b15f3 Merge branch 'master' into soc-2021-porting-modifiers-to-nodes-extrude
# Conflicts:
#	source/blender/blenkernel/BKE_node.h
2021-08-05 23:50:08 +02:00
aef45a4ef2 Merge remote-tracking branch 'origin/soc-2021-porting-modifiers-to-nodes-extrude' into soc-2021-porting-modifiers-to-nodes-extrude
# Conflicts:
#	source/blender/bmesh/intern/bmesh_mesh.c
#	source/blender/bmesh/intern/bmesh_mesh.h
#	source/blender/nodes/NOD_static_types.h
#	source/blender/nodes/geometry/nodes/node_geo_extrude.cc
2021-08-05 23:48:58 +02:00
504e3c563f added side selection. 2021-08-05 23:47:44 +02:00
b5573bfbf4 Merge branch 'master' into soc-2021-porting-modifiers-to-nodes-extrude 2021-08-03 21:02:56 +02:00
ba9561ab0d Geometry Nodes: Extrude
Differential Revision: https://developer.blender.org/D12108
2021-08-02 19:04:04 +02:00
c659af0c13 Geometry Nodes: Extrude 2021-08-02 19:02:38 +02:00
41f75384e7 Merge remote-tracking branch 'origin/soc-2021-porting-modifiers-to-nodes-remesh-voxel' into soc-2021-porting-modifiers-to-nodes-remesh-voxel
# Conflicts:
#	source/blender/blenkernel/BKE_node.h
2021-07-31 00:21:24 +02:00
383a8e519b - changes based on review by Jacques Lucke (JacquesLucke) 2021-07-31 00:20:43 +02:00
6d2cc371b5 Merge branch 'master' into soc-2021-porting-modifiers-to-nodes-remesh-voxel
# Conflicts:
#	source/blender/blenkernel/BKE_node.h
2021-07-31 00:15:29 +02:00
7a2994a741 - reverted unneeded change 2021-07-31 00:11:17 +02:00
326d86f23f Merge remote-tracking branch 'origin/soc-2021-porting-modifiers-to-nodes-remesh-blocks' into soc-2021-porting-modifiers-to-nodes-remesh-blocks
# Conflicts:
#	source/blender/nodes/geometry/nodes/node_geo_remesh_blocks.cc
2021-07-31 00:07:32 +02:00
17b7cbe975 - changes based on Review by Jacques Lucke (JacquesLucke) 2021-07-31 00:06:43 +02:00
94210c3186 - changes based on Review by Jacques Lucke (JacquesLucke) 2021-07-30 23:51:31 +02:00
9d2342fd28 Merge branch 'master' into soc-2021-porting-modifiers-to-nodes-remesh-blocks 2021-07-30 21:11:26 +02:00
86e359b03b - reverted unrelated changes 2021-07-30 21:07:29 +02:00
4c8def9895 Merge branch 'master' into soc-2021-porting-modifiers-to-nodes-decimate
# Conflicts:
#	source/blender/blenkernel/BKE_node.h
#	source/blender/blenloader/intern/versioning_defaults.c
#	source/blender/editors/asset/intern/asset_filter.cc
#	source/blender/editors/interface/interface.c
#	source/blender/editors/interface/view2d_draw.c
#	source/blender/freestyle/intern/winged_edge/Curvature.cpp
#	source/blender/makesdna/DNA_fluid_types.h
#	source/blender/python/intern/bpy_props.c
#	source/blender/windowmanager/WM_types.h
#	source/blender/windowmanager/intern/wm_dragdrop.c
2021-07-30 21:02:50 +02:00
5e198321c2 - changes based on Review by Jacques Lucke (JacquesLucke) and feedback by Miro Horváth (dreamak). 2021-07-30 20:50:44 +02:00
c24be2dd44 GPencil: Fix unreported problems painting after import SVG
After doing an import, the bounding box of the stroke was not calculated and any operation related to brushes (Sculpt, Weight Paint and Vertex Paint) was not working as expected because the bounding box of the stroke was wrong.

This problem was solved automatically after any edit operation, but must be solved in the import process.
2021-07-30 16:56:30 +02:00
3f29b8ec64 Fix T89213: Some modifier properties have wrong subtype
This commit resolves these RNA warnings:
```
offset: "", WARN (bpy.rna): ...\source\blender\python\intern\bpy_rna.c:1505 pyrna_enum_to_py: current value '65536' matches no enum in 'FloatProperty', 'offset', 'subtype'
project_limit: "", WARN (bpy.rna): ...\source\blender\python\intern\bpy_rna.c:1505 pyrna_enum_to_py: current value '65536' matches no enum in 'FloatProperty', 'project_limit', 'subtype'
falloff_radius: "", WARN (bpy.rna): ...\source\blender\python\intern\bpy_rna.c:1505 pyrna_enum_to_py: current value '65567' matches no enum in 'FloatProperty', 'falloff_radius', 'subtype'
```
2021-07-30 16:56:30 +02:00
0b060a585d GHOST/X11: enable EGL
This will replace GLX with EGL for X11. GLEW does not support GLX and EGL
at the same time. Most distributions build GLEW with GLX support, so we
have to use the externally provided GLEW and build with EGL support.
This effectively sets WITH_SYSTEM_GLEW to OFF for all Linux configurations.

Differential Revision: https://developer.blender.org/D12034
2021-07-30 16:56:30 +02:00
e5c7f12f8b Fix T89976: Mirror Keys By Value performs wrong scale conversion
In the graph editor, Mirror Keys by Value would convert the value to mirror
over, to account for different units for linear & rotational properties.
The conversion was done in the different direction, though, resulting in
values that were too large by a factor of (180/pi)^2.
2021-07-30 16:56:30 +02:00
5466552a42 deps/win: Remove media foundation dep for ffmpeg
This caused a blender load error on windows N,
given we do not use these codecs they can safely
be disabled.

This will fix T90200 once the new libraries are
in SVN
2021-07-30 16:56:30 +02:00
ba06899b2a Fix T90295: inconsistent render pass order between Cycles and Eevee 2021-07-30 16:56:30 +02:00
b23cdd5737 Render: remove unused Blender Internal view layer settings
These should have been removed earlier but were forgotten.
2021-07-30 16:56:30 +02:00
df5551fb15 Render: disable Z pass by default, leave only Combined
It was somewhat arbitrary to have this one pass enabled that adds a bit of
additional memory and render time overhead, even though it's not necessarily
more important than others.
2021-07-30 16:56:30 +02:00
11012a8fc1 Assets/UI: Resolve major asset view UI template limitation
Before this, all asset view templates showing the same asset library
would show the same assets, even if they should show different ID types.
That was a major limitation since the design did forsee that this
template can be put anywhere in the UI to display various sub-sets of
assets.

Initially I did the ID type filtering close to the asset-list reading,
because I wanted to optimize reading so that we would only actually read
asset information from disk of the ID type to be shown. But this will be
quite complex and I'm not sure if I'll get to work on this anytime soon.
So this commit moves the filtering to the template display level solving
this limitation.

Note: This also adds the code to filter by tags, together with the ID
type. But it's not actually used anywhere yet.
2021-07-30 16:56:30 +02:00
300632742c Cleanup: Remove unnecessary code for asset view UI template
From what I can tell there is no reason anymore to do this. The design
has changed since this was added.
2021-07-30 16:56:30 +02:00
17fba21226 Assets/UI: Sanity check argument for UILayout.template_asset_view()
Was already doing some sanity checks, but wasn't checking if the passed
property actually is a collection property, which is important.
2021-07-30 16:56:30 +02:00
4b0255238d Cleanup: Pass asset handle to asset iterator, rather than wrapped file
This iterator was introduced before `AssetHandle` existed, so it was
dealing with the file data directly. Now we want as little code as
possible to deal with the file data, all access should happen via the
`AssetHandle`.
2021-07-30 16:56:30 +02:00
83d537c950 Cleanup: Consistent indent style for asset CMakeLists file
Was mixing 4 and 2 space indent in a single file.
2021-07-30 16:56:30 +02:00
ab66f1d792 install_deps: update OIDN to 1.4.1, and ISPC to 1.16.0.
Ref. T88438.
2021-07-30 16:56:30 +02:00
4c97a026e7 install_deps: Update OSL to 1.11.14.1.
This has been a huge pain to get working, for several reasons (new flags
needed, patching is now mandatory, etc.).

Further more, discovered that debian OIIO package is now silently
relying on OpenCV, without even proper handling of this dependency (at
least in the `-dev` package), so had to revert to force-build own OIIO
again on that distro for the time being.

Ref. T88438.
2021-07-30 16:56:30 +02:00
6d296ff00b Cleanup: OSL buildlib patch: Remove .rej part.
This patch contained changes for an `.rej` rejection file generated by
failed patch apply... Definitly nothing to do here.
2021-07-30 16:56:30 +02:00
db796922c8 install_deps: Update OIIO to 1.1.15.1.
Ref. T88438.
2021-07-30 16:56:30 +02:00
350d32f6d5 install_deps: Update llvm to 12.0 (with minimal now being 11.0).
Ref T88438.
2021-07-30 16:56:30 +02:00
d917311776 Install_deps: add flex dependency.
Was already installed on Debian-like and Fedore/Suse actually, now also
explicitely required on Arch and listed in docs.

Ref. T88438.
2021-07-30 16:56:29 +02:00
3a5fd9713e Install_deps: Add zstd dependency.
Ref T88438.
2021-07-30 16:56:29 +02:00
Germano Cavalcante
efee24c34e Fix 'BLI_task_parallel_mempool' keeping 'user_chunk' unchanged
When `BLI_task_parallel_mempool` does not use threading, the
`userdata_chunk` is allocated locally simulating a TLS.

However `func_reduce` is not called so the original chunk is ignored.

`task_parallel_iterator_no_threads` is another function that doesn't call
`func_reduce`. It also ignores `userdata_chunk_local` in the main iterator.

The solution in these cases is not to create a `userdata_chunk_local`.

This fixes T90131

Differential Revision: https://developer.blender.org/D12067
2021-07-30 16:56:29 +02:00
f68e8e4f23 deps: Reduce llvm/clang footprint for windows
We shipped the whole bin folder for llvm/clang
while we only needed clang-format, by shipping
just the bits we need we save about 700 megabytes
off our svn lib download.
2021-07-30 16:56:29 +02:00
35a4cef6b5 Data-block Preview: Create preview using current frame
The preview was always using frame 1, but maybe the object has changed and it's better create preview using the current frame.

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D12018
2021-07-30 16:56:29 +02:00
695dd31e34 Cleanup: Remove debug-only code 2021-07-30 16:56:29 +02:00
5b0dfca417 Fix building without Cycles logging
Ideally can use assert() checks instead of suppressing the check entirely,
but for now just fix compilation error quickly.
2021-07-30 16:56:29 +02:00
9a9c533631 Cleanup: Fix build warning
Introduced in 3964785a14
2021-07-30 16:56:29 +02:00
jim man
f49bf8d05c cleanup: editor_image : Remove unused draw functions
These functions are unused currently..

Reviewed By: deadpin, jbakker

Differential Revision: https://developer.blender.org/D11968
2021-07-30 16:56:29 +02:00
48b6ccecb0 Fix Cycles crash with fluid object motion blur disabled
Motion attributes expects mesh to have non-zero number of motion steps,
which was violated in the case when fluid mesh had motion blur disabled.

This is a bit of annoying fix, because of the order of updates. More
ideal solution would be to handle cached and fluid velocities in the
sync_mesh_motion() which ensures all the dependencies between settings.
2021-07-30 16:56:29 +02:00
ce1e226b7c VSE: Change grid line drawing
Add overlay option to disable grid drawing.
Reuse drawing code from other editors (timeline editor)
Add argument `display_minor_lines` to function
`UI_view2d_draw_lines_x__discrete_frames_or_seconds`
This way minor line drawing can be disabled and so it doesn't cause
too much visual noise. Also spacing seems to be too fine, so VSE uses 3x
what is defined in preferences.

Reviewed By: fsiddi, Severin

Differential Revision: https://developer.blender.org/D11790
2021-07-30 16:56:29 +02:00
a4db9318fb VSE: don't snap by default
Snapping by default goes against convention, so this setting was
re-evaluated. Also snapping by default can conflict with new image
transform system, see T90156

There wasn't consensus, so disable snapping by default to follow
established convention.

ref T89665

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D12054
2021-07-30 16:56:29 +02:00
03368c5344 UI: Fix time labels drawing
Calculate frequency of time/frame label drawing, such that labels have
at least 10px margin and don't overlap.

Change timecode format:
- Use at least `mm:ss` format
- Don't display frames if all labels would end with +00

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D11792
2021-07-30 16:56:29 +02:00
9f8e938900 Fix T89952: GPencil channel box selection offset
The channel box selection was offset for grease pencil layers.

This is a proposed fix by @yann-lty

Before:
{F10227973}

After:
{F10227974}

Reviewed By: #grease_pencil, antoniov

Maniphest Tasks: T89952

Differential Revision: https://developer.blender.org/D11962
2021-07-30 16:56:29 +02:00
490b36b289 Fix memory leaks in Python gizmo get/set handlers 2021-07-30 16:56:29 +02:00
f36b7c0c8c Fix gpu.types.GPUTexture crash when the size argument was too big
Missing length check on the size argument before copying it
into a fixed size buffer.
2021-07-30 16:56:29 +02:00
660bcfc32d Cleanup: use PyC_AsArray_FAST function where possible
Oversight in 2453dc1b0e.
2021-07-30 16:56:29 +02:00
b4ee5b7934 PyAPI: support multi-dimensional arrays for bpy.props vector types
- Multi-dimensional boolean, int and float vector types are supported.
- A sequence of int's for the "size" is used to declare dimensions.
- Nested sequences are required for default arguments.

Now it's possible to define matrix properties, for e.g:

  bpy.props.FloatVectorProperty(size=(4, 4), subtype='MATRIX')
2021-07-30 16:56:29 +02:00
a645d990d9 PyAPI: add multi-dimensional array conversion utility functions
Add array conversion functions that take dimension arguments.

- PyC_AsArray_Multi (version of PyC_AsArray).
- PyC_Tuple_PackArray_Multi_* (version of PyC_Tuple_Pack_*).
2021-07-30 16:56:29 +02:00
d13c3ac5d9 Cleanup: spelling 2021-07-30 16:56:29 +02:00
ae4affa280 Fix T75028: Improved Font Names in File Manager
When viewing font files in the File Manager, this patch uses the font's
family and style names to show the same type of string shown to users
in operating system lists. For example "Book Antiqua Regular" instead
of "BKANT.ttf"

see D12020 for details and examples.

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

Reviewed by Campbell Barton and Julian Eisel
2021-07-30 16:56:29 +02:00
49240bcd25 Cycles: remove WITH_CYCLES_DEBUG, add WITH_CYCLES_DEBUG_NAN
WITH_CYCLES_DEBUG was used for rendering BVH debugging passes. But since we
mainly use Embree an OptiX now, this information is no longer important.

WITH_CYCLES_DEBUG_NAN will enable additional checks for NaNs and invalid values
in the kernel, for Cycles developers. Previously these asserts where enabled in
all debug builds, but this is too likely to crash Blender in scenes that render
fine regardless of the NaNs. So this is behind a CMake option now.

Fixes T90240
2021-07-30 16:56:29 +02:00
9ce2fc8a17 Cleanup: Remove unnecesary undefs
Macros `SEQ_ALL_END` and `SEQ_ALL_BEGIN` no longer use `seq->tmp`.
Therefore they are safe to use regardless from where they are called.
2021-07-30 16:56:29 +02:00
db5110e9d3 Assets: Improve error message when "Clear Asset" fails
When using "Clear Asset" from the Asset Browser but with an asset
selected that is not stored in the current file, we can show a more
informative error message.
2021-07-30 16:56:29 +02:00
a8eb36b7ef VSE: Fix audio not recalculated
Changing strip offsets with RNA properties didn't tag depsgraph to
update for new strip start/end points.
2021-07-30 16:56:29 +02:00
b0e3e55036 Cleanup: VSE cache invalidated twice
Multiple RNA update function invalidated cache twice.
2021-07-30 16:56:29 +02:00
Wannes Malfait
2bcdb4a19e Fix T90221: geometry viewer node links to other socket types
The viewer node in geometry node trees only supports geometry nodes.
This patch ensures that when ctrl shift clicking on a node, it will only
link to geometry sockets.

Differential Revision: https://developer.blender.org/D12055
2021-07-30 16:56:29 +02:00
641dade2be Remove the code in BKE_collection_move to preserve LayerCollection flags.
This code was actually buggy (forcefully re-enabling excluded layers in some
cases).

Further more, it should not be needed now that layerCollection resync code
reuses as much as possible existing layers instead of deleting and
re-creating them all the time.

Differential Revision: https://developer.blender.org/D12016
2021-07-30 16:56:29 +02:00
0f7254199b LayerCollection: Refactor of resync-with-Collection-hierarchy process.
The goal of this refactor is to improve resync of LayerCollections
hierarchy to match again Collection one.

Current code would destroy and re-create valid layers whenever a parent
collection would be removed, which leads to losing way too often
layer-related settings when editing collection hierarchies.

While this could be partially addressed from operators side, there was
no way to fix those issues from lower level, more generic ID management
code like ID remapping or library override resync processes.

The new code builds a shallow wrapper around existing (aka old) layers
hierarchy, does a set of checks to define the status of all existing
layers, and try to find the closest matching unused layer in cases where
layers and collections hierarchies do not match anymore.

The intent is to both re-use as much as possible existing layers, and
to pick the 'best' possible layer to re-use, following those heuristics:
 * Prefer layers children of current one first (in old hierarchy), and only
   use those from other higher-level hierarchies if no (grand-)child is found.
 * Prefer to use closest layers available in the old hierarchy.

NOTE: The new code is about 12%-15% slower than the previous one, which is
expected given the increased complexity. Note that this would not be an
issue in practice if this code was not called way too often (needs to
be converted to lazy update instead, which is a long known TODO).

NOTE: The LayerCollectionResync code uses its own built-in version of
FIFO queue, as performances in this code is currently a critical point
(it can get called tens of thousands of times during a single (heavy)
ID management operation currently, in a production file e.g.).

Differential Revision: https://developer.blender.org/D12016
2021-07-30 16:56:29 +02:00
Wannes Malfait
7fa2e087f5 Fix T89415: update multi input indices after deleting a node
When deleting a node, links attached to that node are deleted, but if one
of those links was connected to a multi input socket, the indices of the
other links connected to it were not updated. This adds updates both in
the case of a normal delete as well as after a delete with reconnect.

Differential Revision: https://developer.blender.org/D11716
2021-07-30 16:56:29 +02:00
d19528020f Fix particle system duplication duplicates all systems
Followup to rB3834dc2f7b38 (where getting the proper particle system was
fixed for the Adjust Last Operation panel in the Properties Editor). But
since this operator can also be called from the 3DView, get a current
particle system there as well.

Without this, _all_ particle systems would be copied when executing from
the 3DView (which was never really intended [operator description uses
singular] -- it just happens to use `copy_particle_systems_to_object`
internally as well -- same as the `Copy Active/All to Selected Objects`
operators)).

ref. T83317

Maniphest Tasks: T83317

Differential Revision: https://developer.blender.org/D12033
2021-07-30 16:56:29 +02:00
c67137ab0d Fix T90154, T90213: curve issues since recent cleanup commit
Caused by {rB8cbff7093d65}.

Since above commit only one modifier would get calculated and the
displaylist boundingbox was calculated wrong.

Maniphest Tasks: T90154

Differential Revision: https://developer.blender.org/D12037
2021-07-30 16:56:29 +02:00
43f0494929 Fix menu poll function being ignored for UILayout.menu
Using `UILayout.menu()` [1] or `UILayout.menu_contents() [2], the menu
would just always be added, the `poll()` check not being executed. As
API user I would expect the `poll()` to deterimine visiblity of the
menu.

[1] https://docs.blender.org/api/current/bpy.types.UILayout.html#bpy.types.UILayout.menu
[2] https://docs.blender.org/api/current/bpy.types.UILayout.html#bpy.types.UILayout.menu_contents

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

Reviewed by: Campbell Barton
2021-07-30 16:56:29 +02:00
2c9e8a2f29 LineArt: Camera Overscan
Expand camera effective region to a portion beyond image frame so strokes won't end right at the border.

Reviewed By: Antonio Vazquez (antoniov)

Differential Revision: https://developer.blender.org/D12049
2021-07-30 16:56:29 +02:00
ffdf9fa1bf Fix (studio-reported) liboverride resync crash after recent changes.
Recent own rBabf3ce811f6e prevented any LayerCollection update during
the whole liboverride resync process, for both performances and feature
reasons.

However that means that the various runtime caches like the Base GHash
are not cleared anymore during ID remapping process, so we need to call
`BKE_main_collection_sync_remap` instead of `BKE_main_collection_sync`
when we finally are ready for this update.

Reported by @eyecandy (Andy Goralczyk) from Blender studio, thanks!
2021-07-30 16:56:29 +02:00
d360c5d8da VSE: Add tooltips for add_effect_strips operator
This patch adds propper tooltips to the effect strips in the "Add" menu.
Note that not all effect strips are actually in the "Effect Strips"
submenu like color strips, text strips or transitions. For these types
of effect strips, a dediacted tooltip is especially useful.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D11714
2021-07-30 16:56:29 +02:00
3e6fd42290 Cleanup: reduce indentation in bpy.props
Remove unnecessary NULL checks.
2021-07-30 16:56:29 +02:00
c2087da3d3 VSE: Draw strips transparent during transform overlap
While transforming a strip, draw the background semi-transparent
if it overlaps with another strip. It's convenient to see what's
underneath, especially with the upcoming Overwrite feature.

Thanks to @iss for the help and review.
2021-07-30 16:56:29 +02:00
31d0434344 Deps: ensure osl/bin/oslc is using static libpng
Pass `-DLINKSTATIC=ON` to the OSL CMake, to ensure it statically links to
our libpng. Previously this was only applied on Windows, it's now on all
platforms.
2021-07-30 16:56:29 +02:00
b1602da72f Add StringRef::trim() functions
Add three functions that trim characters from the front & end of a
`StringRef`. All functions return a new `StringRef` that references a
sub-string of the original `StringRef`.

- `trim(chars_to_remove)`: strips all characters from the start and end
  that occur in `chars_to_remove`.
- `trim(char_to_remove)`: same, but with a single character to remove.
- `trim()`: remove leading & trailing whitespace, so same as
  `trim(" \r\n\t")`

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D12031
2021-07-30 16:56:29 +02:00
8105cc6692 Fix LLVM 12 symbol conflict with Mesa drivers, after recent Linux libs update 2021-07-30 16:56:29 +02:00
12298a5251 Fix LibOverride crashing in some cases where reference linked data gets MIA.
When the root of an override hierarchy disapears, there is no way to do
a proper resync, just abort.

Reported by studio, thx.
2021-07-30 16:56:29 +02:00
Himanshi Kalra
5b6ced1346 Regression Testing: Running tests based on blend files
Runs tests based on blend files with minimum python interaction.
Developed as part of GSoC 2021 - Regression Testing of Geometry Nodes.
Earlier, tests were built from scratch by adding a modifier/operation
from the Python API.
Now, tests can also be created inside blender and are compared using
Python script.

Features: Automatically adding expected object if it doesn't exist.
This patch adds tests for the following Geometry Nodes category:
* Curves
* Geometry
* Mesh
* Points

The implemented UML diagram for refactoring of mesh test framework.
{F10225906}

Technical Changes:
SpecMeshTest: It adds the modifier/operation based on the Spec provided.
BlendFileTest: It applies already existing modifier/operation from the blend file.

Test folders hierarchy with tests. This folder should be extracted to `lib\tests\modeling`
{F10240651}
Note: The `geometry_nodes` folder might lie under another `geometry_nodes` folder while extracting, please double check. Use the inner-most one.
The hierarchy should be:
-`lib\tests\modeling\geometry_nodes\mesh`
-`lib\tests\modeling\geometry_nodes\points`
and so on.

* From `ctest` the tests should be run as `ctest -R geo_node -C [Configuration]` on Windows.
* Each single test can be run with its entire name e..g `ctest -R geo_node_geometry_join_geometry`.(just an example). Run `ctest -N -R geo_node` to see all tests.
* From blender, the tests can be run `blender -b path\to\blend\file --python path\to\geo_node_test.py`

Reviewed By: zazizizou, JacquesLucke

Differential Revision: https://developer.blender.org/D11611
2021-07-30 16:56:29 +02:00
6a5df54477 Fix memory leak with Python RNA property get callback errors
Failure to return a list of the expected size & type wasn't
decrementing the value, leaking a reference.

Caused by 127b5423d6 a workaround for the
real error that was fixed f5e020a7a6.
2021-07-30 16:56:29 +02:00
Charlie Jolly
d7f228a394 Geometry Nodes: Add node labels to Attribute maths nodes
This adds the operator name to the node label which is consistent with the shading nodes.
The vector node has `Vector` as a prefix.

The Attribute nodes already have a different coloured header.

The same label is used when collapsing nodes, this helps readability.

Reviewed By: pablovazquez

Differential Revision: https://developer.blender.org/D10749
2021-07-30 16:56:29 +02:00
8c06fb2267 Added YAML builtbot config file.
Builtbot is switching over from json to yaml. Both
configuration files should be kept in sync for now.

The json file will be removed when everything works as expected.
2021-07-30 16:56:29 +02:00
53ed446f1f BlenRead: Add GHash-based search for already read linked IDs.
Ths commit adds a new `IDNameLibMap` to `Main`, used during file reading
to quickly find already read linked IDs.

Without that, search would use string-based search over list of linked
data, which becomes extremely slow and inneficient in cases where a lot
of IDs are linked from a same library. See also {T89194}.

Extrem-usecase reported in T89194 is now about 4 times faster in linked
data reading (about 2 times faster for the whole .blend file loading).

More normal cases (like Sprites studio production files) have barely
measurable speed improvements, a few percents at best.

NOTE: `main_idmap` API was extended to support insertion and removal of
IDs from the mapping, avoids having to re-create the whole thing several
time during libraries expansion in readcode.

Differential Revision: https://developer.blender.org/D11757
2021-07-30 16:56:29 +02:00
8311cc98db PyAPI: support different int sizes for PyC_AsArray 2021-07-30 16:56:29 +02:00
cac41070c0 Cleanup: pass sizeof array element to PyC_AsArray
Replace the is_double argument which was only used for single/double
precision floats.

This allows supporting different sized int types more easily.
2021-07-30 16:56:29 +02:00
c4c2f117ff Fix missing passes update on Use Denoising change
Makes it so Render Layers node in the compositor is updated as soon
as Use Denoising is changed for the final render.

Differential Revision: https://developer.blender.org/D12010
2021-07-30 16:56:29 +02:00
b9658d548c Deps builder: OIIO/OSL/ISPC/OIDN/LLVM/Flex updates
This diff somewhat snowballed out of updating OIDN to 1.4.1 it had some
changes that allowed us to remove the arm hacks we had in place and
revert to using identical versions for a whole bunch of deps. But that
required an update to ISPC which needed a newer LLVM and if we're
updating LLVM we may as well update OSL, and when we update OSL, OIIO
may as well be dragged in soo......anyhow...

This diff updates:

LLVM 9.0.0 (11.0.1 for mac/arm) -> 12.0.0
OIIO 2.1.15.0 -> 2.2.15.1
OSL 1.11.10.0 -> 1.11.14.1
winflex_bison 2.5.5-> 2.5.24 (ispc needed newer bison, windows only dep)
OIDN 1.4.0 -> 1.4.1
ISPC v1.14.1(random hash for mac/arm) -> v1.16.0
Flex 2.6.4 (ISPC needed newer Flex than available on CentOS 7)

and removes most of the "special arm/mac" versions. I think just ssl and
embree are left with special versions.

notable changes:
@LazyDodo included some clang headers in the linux/mac harvest which are
needed to start writing custom clang based tooling like D9465 these were
already shipping on windows, but not the other platforms.

[macOS] Change the `LC_ID_DYLIB` of OpenMP  for {D11997}. This changes
where the executables look for dylibs.

Reviewed By: sebbas, LazyDodo

Differential Revision: https://developer.blender.org/D11748
2021-07-30 16:56:29 +02:00
6bae63d69d Cleanup: add note from T85517 fix 2021-07-30 16:56:29 +02:00
7eb08a7ab0 Cleanup: comment spelling & punctuation 2021-07-30 16:56:29 +02:00
122bad7f7a LineArt: Occlusion accuracy fix.
This patch fixes occlusion function to handle one specific case (when an edge shares a point with triangle) better,especially when there's overlapping edges in this case.
2021-07-30 16:56:29 +02:00
Aaron Carlisle
a7ac6c014e Anotations: Fix a several issues with stroke placement
Previously, this option was not exposed in the UI, only for the clip editor.
There were also multiple rna properties that did the same thing for each of the 2D editors.

There was also an issue where the property enum items were the same as the 3d view which didnt make much sense.

Reviewed By: antoniov

Differential Revision: https://developer.blender.org/D12027
2021-07-30 16:56:29 +02:00
1e35b59443 Fix compile error on macos introduced in last commit
std::optional::value() is not available on macos.
2021-07-30 16:56:28 +02:00
Christoph Lendenfeld
3f55b127e7 Fix: Instantly hide bones after hitting H key in pose sliding
When using a pose slider it is possible to hide bones with the 'H' key.
Before this patch the screen didn't update, so you had to move the mouse 1 pixel to update.
This patch makes it so it updates right away

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D12024
Ref: D12024
2021-07-30 16:56:28 +02:00
4822a11bdd Compositor: Full frame Box Mask node
Adds full frame implementation to this node operation.
No functional changes.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11627
2021-07-30 16:56:28 +02:00
f79ac72208 Compositor: Full frame Levels node
Adds full frame implementation to this node operations.
No functional changes.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11749
2021-07-30 16:56:28 +02:00
f464c18540 Compositor: Fix memory leak when exporting operations on debug 2021-07-30 16:56:28 +02:00
7482a56554 Compositor: Full frame Scale node
Adds full frame implementation to this node operations.
No functional changes.

Includes a new operation method `init_data` used to initialize any data
needed after operations are linked and resolutions determined.
Once tiled implementation is removed `initExecution` may be renamed
to `init_rendering` and `init_data` to `init_execution`.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11944
2021-07-30 16:56:28 +02:00
035cf075e2 Cycles: upgrade CUDA to 11.4
This fixes a performance regression on Ampere cards, on specific scenes like
classroom. For cycles-x there is little difference, but this is still helpful
for LTS releases, and we need to upgrade at some point anyway.
2021-07-30 16:56:28 +02:00
Nikhil Shringarpurey
26f3c8717d Cleanup: fix compiler warnings due to implicit cast
Differential Revision: https://developer.blender.org/D11950
2021-07-30 16:56:28 +02:00
a2b0f4bc32 Fix Python error in benchmark executable detection after recent changes 2021-07-30 16:56:28 +02:00
43111cdfdf LayerCollections: Add a way to prevent their resync with Collection hierarchy.
This is an easy & safe, yet not-so-nice way to address the
LayerCollections vs. Collections hierarchy resync problem.

Currently this resync is enforced everytime something changes in the
Collections hierarchy, which is extremely inneficient, and can even
produce 'loss' of LayerCollection data during complex Collection
processes.

Current example is during Library Overrides resync process. New code:
 * Makes resync significantly faster (between 10 and 15%).
 * Fixes 'disappearing' layer collections settings on sub-collections'
   layers.

NOTE: This is not a proper fix for the underlying issue. However,
implementing and testing the 'lazy update' solution as proposed by
{T73411} requires a significant amount of time (especially in testing
and tracking all places where code would need to ensure LayerCollections
are up-to-date), which is not possible currently.

Differential Revision: https://developer.blender.org/D11889
2021-07-30 16:56:28 +02:00
e7694f68a1 Cleanup: Fix compiler warning in previous commit 2021-07-30 16:56:28 +02:00
9b13a5759b Fix T90127: Merge Down layer doesn't take the transform location into account
Now the layer transformation is applied before the merge.
2021-07-30 16:56:28 +02:00
7ec4a83a6c Mantaflow: Remove Noise Type Option
Mantflow only supports wavelet noise, thus the parameter with only one option is no longer useful.

Differential Revision: https://developer.blender.org/D6770
2021-07-30 16:56:28 +02:00
Germano Cavalcante
57c04b3165 Cleanup: Rearrange mesh extraction files
In the draw module, it's not easy to identify what its header is, and
where the shared functions are.

So move `draw_cache_extract_mesh_extractors.c` and
`draw_cache_extract_mesh_private.h` to the same folder as the extractors
and rename these files to make them more identifiable.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11991
2021-07-30 16:56:28 +02:00
59a9c07d09 macOS Cleanup: Remove old version specific code
Reviewed By: #platform_macos, brecht
Differential Revision: https://developer.blender.org/D12021
2021-07-30 16:56:28 +02:00
f488c7ee69 VSE: Fix snapping bugs
Fix hold offset check causing missing snapping point when strip have
only still frames.

Fix effect strips of transformed strips causing snapping to prevoius
strip positions.

Reviewed By: mano-wii

Differential Revision: https://developer.blender.org/D11948
2021-07-30 16:56:28 +02:00
9d1ce7d5a9 Cleanup: missed comment in D12029
No functional change.
2021-07-30 16:56:28 +02:00
55fe618254 Geometry Nodes: Fix vector math project bug
Implementation is incorrect compared to Cycles/Eevee.

Reported by @DrDubosc in comments of T88922.

Differential Revision: https://developer.blender.org/D12029
2021-07-30 16:56:28 +02:00
d7aa608ab7 VSE: Fix truncated label
Label for snapping current frame to strips was cut off and not very readable.

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D11951
2021-07-30 16:56:28 +02:00
04001b2b02 Revert "cmake: enable Wayland by default"
This reverts commit a2ccd0e495.

This change was part of the still-under-review patch D11489, which
hasn't been accepted yet.
2021-07-30 16:56:28 +02:00
ba98a976cb Revert "GHOST/wayland: use Wayland only when 'BLENDER_WAYLAND' is set"
This reverts commit c971c851d3.

This change was part of the still-under-review patch D11489, which
hasn't been accepted yet.
2021-07-30 16:56:28 +02:00
Stefan Werner
a2877c0caf Cycles: Fixed memory leak in ColorSpaceManager
Cached OCIO processors were not freed, instead the color spaces were freed twice.

Reviewed By: brecht, sergey

Differential Revision: https://developer.blender.org/D12011
2021-07-30 16:56:28 +02:00
947c098519 Cleanup: clang tidy 2021-07-30 16:56:28 +02:00
Himanshi Kalra
95b6beb8d8 Fix T85517: Cannot type Space while holding Shift key in text-field like spaces.
Fix for T85517
Bug: Couldn't type space while holding down the shift key in text spaces (e.g. when saving a file, changing the name of object).

Changes: Removing the key combination of Shift + space in `WM_event_is_ime_switch` method.

Reviewed By: harley, mont29

Maniphest Tasks: T85517

Differential Revision: https://developer.blender.org/D10452
2021-07-30 16:56:28 +02:00
b85e249875 Cleanup: clang-format 2021-07-30 16:56:28 +02:00
6c0f7276dc Cleanup: spelling in comments 2021-07-30 16:56:28 +02:00
6333be56d9 Cleanup: use doxy comments 2021-07-30 16:56:28 +02:00
0888a0af14 UI: Line Art: Rename "Baking" panel to "Bake"
Avoid using verbs for panel names, and be consistent with the
"Bake" panel in Cycles, Ocean Modifier, etc.
2021-07-30 16:56:28 +02:00
511f6ff09a UI: Line Art: Always use Material icon on picker
The Material picker shouldn't change icon based on it's state,
it should always display the Material icon.
2021-07-30 16:56:28 +02:00
b829b0b555 UI: Fix button alignment on Grease Pencil modifiers 2021-07-30 16:56:28 +02:00
27b5d234ae UI: Line Art Modifier: Tweaks to labels and tooltips
- Clearer tooltips for Source Object/Collection.
- Remove redundant Source/Target on labels.
- Always write Grease Pencil with title case.
2021-07-30 16:56:28 +02:00
62a84f0995 Fix T86768, bevel doesn't loop slide sometimes.
Six years ago, Bug T44961 about unwanted spikes had me not do a loop
slide if the angle was too extreme, to avoid unwanted spikes.
The current bug showed that that angle was much too big, and limited
desired behavior in many cases. Changing the angle from 0.25 radians
to 0.0001 radians (about 0.006 degrees) still fixes the original bug
and seems very unlikely to be limiting desired behavior now.
2021-07-30 16:56:28 +02:00
8bdbfee9d7 Fix T89391, etc. Boolean bugs when objects have negative scale.
The old modifier code, now just used for Fast, has code in it to
flip faces of arguments when their tranform's negativity differs
from the main object's transform's negativity.
I had neglected to put that logic in when I made the change that
skipped the round trip through BMesh.
Fixing this means that the results are more what the user expects
when some or all operands have negative scales.
2021-07-30 16:56:28 +02:00
Christoph Lendenfeld
9e56b50e9f Fix: Remove automatic hiding of bones when using the pose slider
This patch addresses the issue raised in T88340.
When entering a pose sliding operator bones would automatically get hidden.
While technically not a bug it was decided that it is too confusing.
Hiding with 'H' is still possible though, just won't happen automatically

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D11883
Ref: D11883
2021-07-30 16:56:28 +02:00
77feb1dcac GHOST/wayland: use Wayland only when 'BLENDER_WAYLAND' is set 2021-07-30 16:56:28 +02:00
5c729d4c26 cmake: enable Wayland by default 2021-07-30 16:56:28 +02:00
6e4f6f94e4 GHOST/wayland: explicitly delete 'GHOST_SystemWayland' when fallback to X11 2021-07-30 16:56:28 +02:00
121e854ee2 Cleanup: fix warning -Wparentheses 2021-07-30 16:56:28 +02:00
f90cd854ec UI: Do not abbreviate/shorten wording
Abbreviations are harder to read and understand thus it is best to be direct.
For example without understanding and context it is hard to know exactly what "Len" means.
2021-07-30 16:56:28 +02:00
70b2d56e8d GTest: Use INC/INC_SYS for Libmv/OSD tests
This change transitions libmv/osd tests to our
blender_add_test_executable macro that explicitly
takes the include directories as a parameter.

This is in preparation for future clean-up of
global include directories.

Differential Revision: https://developer.blender.org/D12012
Reviewed By: sergey
2021-07-30 16:56:28 +02:00
21d8d5279c Revert "VSE UX: Make Speed Effect strips more user friendly."
This reverts commit 3123f33380 and
a092baa7f9.
2021-07-30 16:56:28 +02:00
Fredrik Hansson
b6f5841d23 Weld Modifier: add "loose_edges" option
This improve the cloth modeling workflow by allowing you to weld only the
edges that are used for the sewing forces.

Reviewed By: mano-wii, weasel

Differential Revision: https://developer.blender.org/D10710
2021-07-30 16:56:28 +02:00
253d0ffe97 Many tweaks to f-curve drawing code 2021-07-30 16:56:28 +02:00
Germano Cavalcante
370a3cf599 VSE UX: Make Speed Effect strips more user friendly.
**Drawing Changes:**
- F-curve drawing for Stretch, Multiply, Length and Frame Number.
- Value drawing when no keyframes for Stretch, Length and Frame Numbers.

General view of the new drawing for each speed effect mode:
{F9796642, size=full}

Detail of the horizontal zero (blue) line in the new `Multiply` mode:
{F9798520, size=full}

Nice to have (but I don't know how):
- Auto adjusting of endframe when using Multiply or Boost.

Differential Revision: https://developer.blender.org/D6110
2021-07-30 16:56:28 +02:00
462c91debd PyDocs: Fix syntax errors resulting in warnings 2021-07-30 16:56:28 +02:00
0bc2620854 XR: Fix for Viewport Denoising Artifacts
Addresses T76003. When using VR with Eevee and viewport denoising,
scene geometry could sometimes be occluded for one eye. Solution is
to use a separate GPUViewport/GPUOffscreen for each VR view instead
of reusing a single one for rendering.

Reviewed By: Julian Eisel, Clément Foucault

Differential Revision: http://developer.blender.org/D11858
2021-07-30 16:56:28 +02:00
b18d421924 Fix T89393: crash when selecting edges when geometry nodes has "on cage" turned on
The core problem is that the geometry nodes modifier sometimes support
"mapping" (i.e. it remembers which new vertices correspond to edit mode
vertices) and sometimes it does not, depending on what the nodes are doing.
Also see rB07ce9910f7cc.

The solution here is that the fallback case in `BKE_mesh_foreach_mapped_edge`
does not call the callback with "invalid" indices.

Differential Revision: https://developer.blender.org/D12007
2021-07-30 16:56:28 +02:00
24011d3e9e Fix T90065: disable attribute search in places where there is too little context
Differential Revision: https://developer.blender.org/D12008
2021-07-30 16:56:28 +02:00
ce1a4929c3 Fix: avoid creating improper rotation matrix
This might change the rotation of some instances after a Curve to Points.
Unfortunately, there is not much we can do about that, the math before
was just wrong. The forward and up axis stayed the same though.

Differential Revision: https://developer.blender.org/D12006
2021-07-30 16:56:28 +02:00
ee07416685 Fix T89829: wrong active context path check in spreadsheet
The problem was that the modifier was reevaluated all the time, even
between showing the attribute search and clicking on the attribute
name. This freed the data referenced by attribute search. The real bug
here was that the dependency graph was tagged for update even
though nothing changed. This was because the spreadsheet thought
its active context has changed and it wanted to compute the new
value to be shown in the spreadsheet.

The reason for the bug was that I confused how the tree-path of a
node editor works. The second element in the tree path contains
the name of the group node in the root tree that we're in (instead
of the first element).

Differential Revision: https://developer.blender.org/D12009
2021-07-30 16:56:27 +02:00
fc91ec92a3 Another slight increase in speed for Delaunay CDT.
When the new "need_ids" flag is false and the output type is not
one of the valid BMesh kinds, there is no need to propagate even
a dummy id to all of the faces.
2021-07-30 16:56:27 +02:00
5efb0d1d2e Cleanup: double spaces in strings 2021-07-30 16:56:27 +02:00
7ce8fce0fe Cleanup: code comments punctuation / spacing 2021-07-30 16:56:27 +02:00
ee10b21c55 Cleanup: de-duplicate code for edge-split tagging
Share functionality for single and multi-threaded edge-split tagging.

Remove logic that ensured vert & loop indices in bm_mesh_edges_sharp_tag
(missing from fd9fc809b7).
2021-07-30 16:56:27 +02:00
e68767640e XR: Reference Space Improvements
Improves control over the XR reference space by using the stage ref
space (user-defined tracking bounds) instead of local ref space
(position at application launch), if available. Also adds an
"absolute tracking" session option to skip applying eye offsets that
are normally added for placing users exactly at landmarks.

By enabling absolute tracking, users can define the tracking origin
in a way that is not linked to the headset position. Instead, the
tracking values given by the XR runtime are left unadjusted and a
user can manually calibrate an "origin" landmark object to adjust to
their real world space.

Can be useful for applications that use external tracking systems
and those that primarily only need to use controllers and not the
headset (e.g. motion capture).

The absolute tracking option requires an update to the VR
Scene Inspection addon to be accessible by regular users.

Reviewed By: Julian Eisel

Differential Revision: http://developer.blender.org/D10946
2021-07-30 16:56:27 +02:00
c19eea1d93 Cleanup: "position tracking" typo in enum member 2021-07-30 16:56:27 +02:00
3d4454e641 Cleanup: remove unused BM_mesh_loop_normals_update function
The only difference with BM_loops_calc_normal_vcos was passing in
custom coordinates which may be NULL.
2021-07-30 16:56:27 +02:00
dd3e69ea7a Fix error setting sharp edges in recent normal calculation changes
bm_mesh_edges_sharp_tag was called with setting sharp edges enabled.
Error in 39b2a7bb7e.
2021-07-30 16:56:27 +02:00
2933a0ec9b Cleanup: remove normal assignment from bm_mesh_edges_sharp_tag
This was added in 0b7f581397
but seems not to be needed as the assignment was never correct
since only one corner on either side of the smooth edge had the
vertex normal written to it.
2021-07-30 16:56:27 +02:00
da860d5d1b Edit Mesh: multi-thread auto-smooth sharp-edge calculation
Merge the sharp edge tagging into bm_mesh_loops_calc_normals,
this has the advantage that edge tagging can be performed as part of
walking over each vertices edges - instead of tagging in a separate loop.

Even though this will tag edges twice (once for each vertex),
the computation isn't heavy as it's only calculating a dot-product
between the two face users to compare the angle.

This change combined with 4ba06ad0a8
makes BM_loops_calc_normal_vcos around 5.68x faster,
with an overall speedup over 2.6x when transforming a high poly mesh.
(tested on a system with 32 cores).

Reviewed By: mont29

Ref D11970
2021-07-30 16:56:27 +02:00
426ac092ec Edit Mesh: multi-thread auto-smooth & custom normal calculations
Supported multi-threading for bm_mesh_loops_calc_normals.

This is done by operating on vertex-loops instead of face-loops.

Single threaded operation still loops over faces since iterating
over vertices adds some overhead in the case of custom-normals
as the order used for accessing loops must be the same as iterating
of a faces loops.

From isolated timing tests of bm_mesh_loops_calc_normals on high
poly models, this gives between 3.5x to 10x speedup,
with larger gains for meshes with custom-normals.

NOTE: this is part one of two patches for multi-threaded auto-smooth,
tagging edges as sharp is still single threaded.

Reviewed By: mont29

Ref D11928
2021-07-30 16:56:27 +02:00
9162d9827e Man Page: Fix spelling 2021-07-30 16:56:27 +02:00
Christoph Lendenfeld
4fdfcde98d Animation: Generic Slider implementation
Extract the slider gui implemented for the pose slide tools.
Generalise it so it can be used by other tools as well.

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D9314
Ref: D9314
2021-07-30 16:56:27 +02:00
b1f3d49296 Geometry Nodes: Display Node Warnings in Modifier
With this commit, node warnings added to nodes during evaluation
(not "Info" warnings) will also draw in the modifier. In the future
there could be a "search for this node" button as well.

Differential Revision: https://developer.blender.org/D11983
2021-07-30 16:56:27 +02:00
164e0ada87 Cleanup: Add function to check a curve's spline types
The need for this has come up a few times.
2021-07-30 16:56:27 +02:00
e089f41bcd Fix: "Bake" automatically calculated handles in set handle node
Because these handles are calculated lazily, we need to make sure they
are calculated before switching to a manually positioned mode.
I doubt it would ever be necessary, but theoretically this could happen
on a per-point level, to avoid calculating handles not in the selection.
2021-07-30 16:56:27 +02:00
Germano Cavalcante
8fb5731173 VSE: Speed Effect layout updates
**Changes:**
- New enums correspond to 4 modes: `Stretch`, `Multiply`, `Frame Number` and `Length`.
- "`Multiply Factor`" has been removed;
- Value corresponding to "`use as speed`" enabled is now the value appended to the `Multiply` enum;
- Value corresponding to "`use as speed`" disabled is now the value appended to the `Frame Number` enum;
- Value corresponding to "`Scale to Length`" enabled is now the value appended to the `Length` enum;
- Except `Stretch` each mode has now its respective control values.

Differential Revision: https://developer.blender.org/D11856
2021-07-30 16:56:27 +02:00
f137a3409b Fix name used when parsing arguments 2021-07-30 16:56:27 +02:00
4c251dd864 PyGPU: new method 'GPUFrameBuffer.read_depth'
Method requested by users in order to port addons to new API.
2021-07-30 16:56:27 +02:00
5ab90b1052 Compositor: Fix crash when using empty input sources
It's the case of Image or Movie Clip node when not selecting any
source or an empty one.
Render methods expect an output buffer with size, only render
operations with resolution.
2021-07-30 16:56:27 +02:00
63d957c645 Compositor: Full frame Texture node
Adds full frame implementation to this node operation.
No functional changes.
2021-07-30 16:56:27 +02:00
2aac74b657 Compositor: Full frame Movie Clip node
Adds full frame implementation to this node operation.
No functional changes.
2x faster than tiled fallback.
2021-07-30 16:56:27 +02:00
a109435043 Compositor: Fix buffer area iterating past the end 2021-07-30 16:56:27 +02:00
1bdc33cc2a Compositor: Add coordinates to BuffersIterator
Allows to cover many use cases where iterating both buffers and
coordinates is needed.
2021-07-30 16:56:27 +02:00
33569fc1f1 Fix T90026: attributes added in editmode are lost on modeswitch
When exiting editmode, customdata [and thus attributes] are copied from
**BMesh** to **Mesh** (in `BM_mesh_bm_to_me`).
When adding attributes, these were always added via
`CustomData_add_layer_named` only.
Instead (if we are in mesh editmode), we need to go through
`BM_data_layer_add_named` to properly update the **BMesh** (see
`update_data_blocks`) so we have stuff available to copy back to
**Mesh** when exiting editmode.
Same is done for removing (also going through BMesh).

This is now done, DomainInfo is updated to point to BMesh (instead of
Mesh) customdata when in editmode.

Maniphest Tasks: T90026

Differential Revision: https://developer.blender.org/D11998
2021-07-30 16:56:27 +02:00
Johnny Matthews
4d25d74a1a Geometry Nodes: Set Bezier Handle Type Node
This node takes a curve and a point selection and allows you to set the
specified (or all) points left/right or both handles to a given type.

Differential Revision: https://developer.blender.org/D11992
2021-07-30 16:56:27 +02:00
b652f01504 Tests: continue running benchmarks if some tests fail to build or run
Convenient when testing many revisions where some might be broken.
2021-07-30 16:56:01 +02:00
ee367eecf4 Tests: improve finding of Blender executables in benchmarking
* Allow specifying a folder and automatically setting the proper executable
  name depending on the operating system
* Use executables from configs for listing devices instead of a blender
  command being available
2021-07-30 16:56:01 +02:00
01aa9f34af Versioning: move "until next subveresion bump" code
Move "until next subveresion bump" code into the 300.13 version block.
This should have happened in rB8d5b9478a25.
2021-07-30 16:56:01 +02:00
cf243cd302 Cleanup: Silence warning - unused parameter 2021-07-30 16:56:01 +02:00
Yann Lanthony
41f6c7b298 Fix T89733: Py API: bpy.data.orphans_purge argument parsing
On Windows, using `bpy.data.orphans_purge` with some arguments (eg: `do_recursive=True`) does not produce the expected results. This is due to arguments not being parsed correctly on this platform with the current code.

The proposed fix is based on how other functions with boolean attributes are exposed to the Python API.

Reviewed By: #python_api, mont29

Maniphest Tasks: T89733

Differential Revision: https://developer.blender.org/D11963
2021-07-30 16:56:01 +02:00
Philipp Oeser
292724c389 Make polls for removing mesh data layers consistent
This was reported in T90026 for attributes, but was also true for:
- UVMaps
- Vertex Colors
- Sculpt Vertex Colors
- Face Maps

For Vertex groups and Shapekeys this was already done (in that their
remove poll would check if there is a vertex group or shapekey to begin
with), now make this consistent across all mentioned types.

Thx @vvv for the initial patch (where this was done for attributes only)

ref T90026

Reviewed By: HooglyBoogly

Maniphest Tasks: T90026

Differential Revision: https://developer.blender.org/D11990
2021-07-30 16:56:01 +02:00
e16982fe94 Bump subversion to avoid infinite enabling pose_library add-on
Bump Blender's sub-version to make sure the pose_library add-on isn't
auto-enabled on every run of Blender.
2021-07-30 16:56:01 +02:00
3115e957d6 Cleanup: Move reorganize asset files
I'm trying to move away from general files with lots of things in them,
and instead have many small & focused files. I find that easier to
work with since everything has clear responsibilities, even if there is
some minor overhead in managing all these files.
I also try to differentiate more clearly between public and internal
files. So source files and internal headers are in a `intern/`
sub-directory, public functions are in a number of headers one level
higher.
For convenience and to make this compatible with our existing general
headers in `editors/include`, I made the `ED_asset.h` there include all
these public headers.
This is of course a bit of an experiment, let's see how it works in
practice.

Also corrected the name of `ED_asset_can_make_single_from_context()`.
2021-07-30 16:56:01 +02:00
Germano Cavalcante
aa23609f14 Draw Cache: extract tris in parallel ranges
The `ibo.tris` extraction in multithread is currently only done if the
mesh has only 1 material.

Now we cache a map indicating the index of each polygon after sort and
thus allow the extraction of tris with materials in multithreaded.

As caching is a heavy operation and was already being performed in
multi-thread for triangle offsets, no significant improvements are
expected.

The benefit will be much greater when we can skip updating the cache
while transforming a geometry.

**Profiling:**
||master:|PATCH:
|---|---|---|
|large_mesh_editing_materials:|Average: 13.855380 FPS|Average: 15.525684 FPS
||rdata 9ms iter 36ms (frame 71ms)|rdata 9ms iter 29ms (frame 64ms)
|subdiv_mesh_final_only_materials:|Average: 28.113742 FPS|Average: 28.633599 FPS
||rdata 0ms iter 1ms (frame 36ms)|rdata 0ms iter 1ms (frame 35ms)

1.1x overall speedup

Differential Revision: https://developer.blender.org/D11445
2021-07-30 16:56:01 +02:00
49e72bf3b0 Fix T90017: Bone widget drawing inconsistent with editing
The `lines_loose` extractor did not trigger loose geometry caching.
2021-07-30 16:56:01 +02:00
ff7563fb57 Cleanup: Move loose geometry cache creation to render data task
This centralizes caching functions.
2021-07-30 16:56:01 +02:00
76dbc9a0e9 Cleanup: Centralize/unify asset library reference from/to enum code
This was an open TODO, I wanted to have code for translating asset
library references from and to enum values in a central place, and
access that in the same way from both the Asset Browser and the
Workspace RNA code.

* Adds own file for the related functions.
* Adds doxygen comments.
* Updates RNA callbacks to properly use these functions.
* Let these functions call each other, avoid duplicating logic.
2021-07-30 16:56:01 +02:00
e775f2239a Assets: Replace duplicated asset library reference type from DNA
Since recently it's possible to access assets from outside the
File/Asset Browser, via the asset view template. So we are slowly
moving away from file space specific code to dedicated asset system
code. I introduced `AssetLibraryReference` as a duplicate of
`FileSelectAssetLibraryUID`, with a plan to delete the latter in a
separate cleanup commit. That's exactly what this commit is.

This will cause Asset Browsers to open with the default "Current File"
Asset Library. We could avoid that, but it's a minor issue really.
2021-07-30 16:56:01 +02:00
46eeaa0544 Assets: Rename workspace active asset library DNA variable
This new variable was introduced with 7898089de3. We don't usually use
an `active` prefix variable. Plus, this makes the name match the one of
the Asset Browser active library variable, so we can use the
`rna_def_asset_library_reference_common()` helper for both.

This will cause Asset Views to open with the default "Current File"
Asset Library. We could avoid that, but it's a minor issue really.
2021-07-30 16:56:01 +02:00
b7ad67082b Cleanup: Add missing doxygen file/group comment in new asset file 2021-07-30 16:56:01 +02:00
9848426848 Fix incorrect use of BLI_assert with error strings
Some asserts were never raised because of invalid checks.
2021-07-30 16:56:01 +02:00
209a07e3b5 Cleanup: replace BLI_assert(test || !"text") with BLI_assert_msg(test, text) 2021-07-30 16:56:01 +02:00
Yuki Hashimoto
7a9822ace1 Cleanup: correct the comment in ghost
The same comments were written in clientToScreen and screenToClient in
GHOST. I corrected them.

Ref D11986
2021-07-30 16:56:00 +02:00
93e7fb464a Fix bug in assert in delaunay test.
Assert was trying to say x coords of arcs lined up, and didn't do that.
2021-07-30 16:56:00 +02:00
0220c85f47 Cleanup: Split set_preview_visibilty. 2021-07-30 16:56:00 +02:00
118f4dc93b Cleanup: replace BLI_assert(!"text") with BLI_assert_msg(0, "text") 2021-07-30 16:56:00 +02:00
5f35c9c3cd Cleanup: spelling 2021-07-30 16:56:00 +02:00
f4a30c2c20 Cleanup: replace BLI_assert(0 && "text") with BLI_assert_msg 2021-07-30 16:56:00 +02:00
7a129b0a6f Fix T89881: ignore unavailable sockets when searching for link cycles 2021-07-30 16:56:00 +02:00
5a0a69166b Fix compile issue. 2021-07-30 16:56:00 +02:00
55e603a5bb Fix i18n utils_cli mistake.
Reported by James Monthea (@jmonteath), thanks.
2021-07-30 16:56:00 +02:00
c127093820 Cleanup Preview rendering: Separate world preparation.
Small cleanup that moves world preparation out of scene preparation.
2021-07-30 16:56:00 +02:00
405c41e431 Cleanup: use named enum types.
Added ePreviewRenderMethod and ePreviewType.
2021-07-30 16:56:00 +02:00
e9b69bbd85 Cleanup: replace NB with NOTE in comments 2021-07-30 16:56:00 +02:00
Smitty van Bodegom
e18f76a0cb UI: Use more descriptive wording for particle modifier conversions
Currently the wording is a bit unclear: it doesn't specify //what// the particles will be converted into. This clarifies it by stating what the particles will be converted into: they will either be converted to a mesh or the instances will be made real.

Reviewed By: Blendify

Differential Revision: https://developer.blender.org/D11795
2021-07-30 16:56:00 +02:00
Romain Toumi
61aca25ee2 UI: Fix Cycles Materials menu Layout
Fix an incoherence between the Eevee Materials menu and the Cycles Materials menu :

Eevee :
{F10230448}

Cycles :
{F10230449}

Simply Fixed by replacing the Cycles UI code by the Eevee UI code.

Thanks to @Brainzman for helping me create this diff and translate

Reviewed By: Blendify

Differential Revision: https://developer.blender.org/D11979
2021-07-30 16:56:00 +02:00
7da330e57a Fix API doc generation after recent context additions 2021-07-30 16:56:00 +02:00
5355f00f41 Fix T89827: Attribute transfer node crash on mesh with no faces
Just add a check for whether the mesh has faces when retrieving an
attribute on the corner domain. In the future there could be an info
message in the node in this case, since maybe it's not intuitive.
2021-07-30 16:56:00 +02:00
5d91724656 Fix memory leak with asset view template operator properties 2021-07-30 16:56:00 +02:00
9eda619105 Cleanup: Store asset-handle in drag data
Would previously pass a few properties that are available via the
asset-handle now. This asset-handle is also required for some of the
asset API, e.g. the temporary ID loading. This will probably be needed
before too long.
2021-07-30 16:56:00 +02:00
2610e7480b Cleanup: Use asset utility function to get the asset .blend path
For this to work, the utility function needs to be callable without
context, which is only needed for a File Browser specific hack anyway
(doesn't apply to this usage of it).
2021-07-30 16:56:00 +02:00
b2bfadf511 Cleanup: Move asset-handle functions to own file
Keeps files minimal and focused. I much prefer that over having all
kinds of stuff in general files like `asset_edit.cc`.
2021-07-30 16:56:00 +02:00
9b0c917f8a Cleanup: Getters for asset-handle data
While the asset-handle design is supposed to be temporary (see
35affaa971), I prefer keeping the fact that it's nothing but a file
entry pointer an implementation detail that is abstracted away. So this
introduces getters for the file data we typically access for
asset-handles.
2021-07-30 16:56:00 +02:00
1dd6775ad7 Cleanup: Use const for internal file data of asset-handle
Note that the current asset-handle design is temporary, see
35affaa971. I still prefer this to be const, as code outside the
asset-list/file-list code should never mess with the file data of an
asset.
2021-07-30 16:56:00 +02:00
3ac14e4220 Asset: Clearly describe RNA property description as temporary
The asset handle design is only temporary (see 35affaa971) and this
RNA property is only needed for internal, technical reasons of the asset
view template. So although not nice, at least make it clear in the RNA
property description that this should not be used.
2021-07-30 16:56:00 +02:00
b18e973f54 Cleanup: Correct asset TODO comment, move setter next to getter 2021-07-30 16:56:00 +02:00
616816c694 Fix T89993: Failed assert drawing single point cyclic splines
The same check used for the curve to mesh node.
2021-07-30 16:56:00 +02:00
b1c09892ad Fix T89687: Curve to mesh node incorrect face orientation
The new faces should have a winding direction that points them outward,
the fix was swapping the order of each face's edge and vertex indices.
2021-07-30 16:56:00 +02:00
bcbc626a05 Cleanup: Use const arguments and less sequential iteration
Using const indexes and offsets helps to make the logic less sequential,
which is hopefully easier to understand and possibly easier to parallelize
in the future. Also order return arguments last.
2021-07-30 16:56:00 +02:00
16ec757b94 Armature test: properly initialize bone hierarchy
Fix segfault in `BKE_armature_find_selected_bones_test` by property
initializing the bone hierarchy listbases.

No functional changes to Blender.
2021-07-30 16:56:00 +02:00
Jagannadhan Ravi
9744ca099e Speedup rigid body "Copy from Active" operator
If there were lots of selected objects without an existing rigid body,
we would add rigid bodies to them one by one.

This would be slow in python, now we instead do this as a batch
operation in C.

On my (Intel) MacBook it used to take 60 seconds and with this change it
takes about 0.3 seconds.

Reviewed By: Sebastian Parborg

Differential Revision: http://developer.blender.org/D11957
2021-07-30 16:56:00 +02:00
2c75332d4f Cleanup: Fix missing braces warning on Clang 2021-07-30 16:56:00 +02:00
12a26c3381 Pose Library: remove assumption about Action group names
Remove the assumption of the pose library that Action groups are named
after the bones in the armature. Even though this assumption is correct
when the keys are created by Blender, action groups can be renamed. Keys
created by Python scripts can also use arbitrary group names.

Since there is more code in Blender making this assumption, and looping
over selected bones is also a common occurrence, this commit contains
some generic functionality to aid in this:

- `BKE_armature_find_selected_bones`: function that iterates over all
  bones in an armature and calls a callback for each selected one. It
  returns a struct with info about the selection states (all or no bones
  selected).
- `BKE_armature_find_selected_bone_names(armature)` uses the above
  function to return a set of selected bone names.
- `BKE_pose_find_fcurves_with_bones()` calls a callback for each FCurve
  in an Action that targets a bone, also passing it the bone name.
2021-07-30 16:56:00 +02:00
d2b00a5774 Cleanup: fix clang-tidy warning readability-qualified-auto
No functional changes.
2021-07-30 16:56:00 +02:00
5e5b471789 Cleanup: fix clang-tidy readability-else-after-return
No functional changes
2021-07-30 16:56:00 +02:00
3e179144a4 Cleanup: fix clang-tidy warning modernize-use-nullptr
No functional changes.
2021-07-30 16:56:00 +02:00
69c623ab16 Pose backup: convert from C to C++
Convert `pose_backup.c` (in C) to `pose_backup.cc` (in C++). This will
make future improvements easier. For now, it's the same code with just
some additional explicit casts (C++ doesn't allow implicitly casting
`void *`), `NULL` changed into `nullptr`, and some other simple changes.

No functional changes.
2021-07-30 16:56:00 +02:00
9b4afce6a2 Fix T89981: missing refresh on the compositors render layer node when adding/removing AOVs
Just refresh the node's outputs via ntreeCompositUpdateRLayers().

Maniphest Tasks: T89981

Differential Revision: https://developer.blender.org/D11973
2021-07-30 16:56:00 +02:00
024e169d0f Fix T89982: Geometry Nodes: 'New' Button tries to create node_tree on active modifier, rather than button context
When done from the Properties Editor, the context's modifier should be
used (this is where the button is located), when done from elsewhere,
the active modifier is still the way to go (since the context modifier is
not available then)

Maniphest Tasks: T89982

Differential Revision: https://developer.blender.org/D11972
2021-07-30 16:56:00 +02:00
Johnny Matthews
e2c52ea2e7 Fix: Bezier segment node adds handles incorrectly
This caused the "cyclic" attribute to appear dysfunctional.
2021-07-30 16:56:00 +02:00
a113eca4d4 Fix T89979: Assert in edit mode with curve to mesh node
The node tagged polys normals dirty,  but the function to calculate the
normals didn't clear the dirty flags for polys. Now clear the poly and
corner dirty normal flags.
2021-07-30 16:56:00 +02:00
26e15daa7a Cleanup: use single back-tick quoting in comments
While doxygen supports both, conform to our style guide.

Note that single back-tick's are already used in a majority of comments.
2021-07-30 16:56:00 +02:00
5b77e167ab Cleanup: use doxygen style parameters in noise.c
These used their own ad-hoc syntax.
2021-07-30 16:56:00 +02:00
9f0fad8b6d Cleanup: added const keyword to BLI_dlrbTree search functions. 2021-07-30 16:56:00 +02:00
0c211e94f2 Cleanup: Remove redundant forward declarations. 2021-07-30 16:56:00 +02:00
63acac2cf4 Fix crash in delaunay C interface test.
The test forgot to set the new need_ids field, which luckily
exposed a bug in the C api for delaunay when that field is false.
Fixed the bug and the test, and added a test for the need_ids false
case.
2021-07-30 16:56:00 +02:00
fb91ddeb9c Compositor: Fix crash when connecting multiple constant inputs
Operation receiving inputs was being folded more than once
when it was constant foldable.
2021-07-30 16:56:00 +02:00
8bfceff845 LineArt: UI cleanups.
Wording on the UI, slider consistency and material mask switches layout.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: http://developer.blender.org/D11839
2021-07-30 16:56:00 +02:00
1af5e8cab1 Cleanup: reserve C++ comments for disabled code
Use C comments for plain text.
2021-07-30 16:56:00 +02:00
3852211d2c Cleanup: use '#if 0' for disabling multiple lines 2021-07-30 16:56:00 +02:00
49e4e4c08d Cleanup: Make function static, use const object argument
Also use `const Curve *` instead of `const Object *`, since the
function works at a lower level than objects anyway.

And also remove another unused function. Since this section of code
for converting curves to meshes will likely be replaced, it's nicer to
see which parts actually remain used at this point.
2021-07-30 16:56:00 +02:00
40d270248d Cleanup: spelling 2021-07-30 16:56:00 +02:00
4f27228b0c Cleanup: quiet GCC maybe-uninitialized warning
Function signatures for snap callbacks used `const` incorrectly
which was hidden by casting function types.

This made it seem as if the input arguments wouldn't be change and
wouldn't be initialized.

Name return arguments with an `r_` prefix, order them last,
remove function casts and correct `const` usage.
2021-07-30 16:56:00 +02:00
84f565ed4f Cleanup: Remove unused function 2021-07-30 16:56:00 +02:00
45f4c8ed78 Docs: Update RNA to user manual mappings 2021-07-30 16:56:00 +02:00
55898b107e Cleanup: Clang format 2021-07-30 16:55:59 +02:00
a7bf4ce629 Compositor: Export operation results as debug option
When fixing issues, seeing operation results can be helpful for
detecting which operation went wrong.

This commit adds an option for exporting all operations results to
image files.
Exceptions are:
- Output operations: They are already exported or can be seen in UI.
- Constant operations: There are too many and is rarely useful.

They are exported to "<temp session folder>/COM_operations/"
with filenames "<operation class name>_<operation id>.png".
Only works on full frame execution mode.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11722
2021-07-30 16:55:59 +02:00
60af1ead0c Compositor: Full frame Brightness node
Adds full frame implementation to this node operation.
No functional changes.
2.4x faster than tiled fallback.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11677
2021-07-30 16:55:59 +02:00
9f2a38db45 Compositor: Full frame Mix node
Adds full frame implementation to this node operations.
No functional changes.
2.3x faster than tiled fallback on average.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11686
2021-07-30 16:55:59 +02:00
3e9f20ae90 Compositor: Full frame Viewer node
Adds full frame implementation to this node operation.
No functional changes.
No performance changes.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11698
2021-07-30 16:55:59 +02:00
eba3086802 Compositor: Full frame Double Edge Mask node
Adds full frame implementation to this node operation.
No functional changes.
No performances changes.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11750
2021-07-30 16:55:59 +02:00
7b03da863a Compositor: Full frame Ellipse Mask node
Adds full frame implementation to this node operation.
No functional changes.
3x times faster than tiled fallback.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11635
2021-07-30 16:55:59 +02:00
41cc9fa930 Compositor: Buffer iterators
Currently we mostly iterate buffer areas using x/y loops or through
utility methods extending from base classes.

To simplify code in simple operations this commit adds wrappers for
specifying buffer areas and their iterators for raw buffers with any
element stride:
- BufferRange: Specifies a range of contiguous buffer elements from a
 given element index.
- BufferRangeIterator: Iterates elements in a BufferRange.
- BufferArea: Specifies a rectangle area of elements in a 2D buffer.
- BufferAreaIterator: Iterates elements in a BufferArea.
- BuffersIterator: Simultaneously iterates an area of elements in an
 output buffer and any number of input buffers.
- BuffersIteratorBuilder: Helper for building BuffersIterator adding
 buffers one by one.
For iterating areas coordinates it adds `XRange` and `YRange` methods
that return `IndexRange`.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11882
2021-07-30 16:55:59 +02:00
8d88c7c811 Cleanup: Move asset library reference C++ wrapper to own files
Although currently only the asset list code uses the asset library
reference wrapper, it can stand on its own and may be used in more
places in the future. So I prefer to give it its own source & header
file.

Also removed unused includes, added proper namespaces as per our C++
style guidelines, and removed an unnecessary TODO comment.
2021-07-30 16:55:59 +02:00
c051cdc3df Cleanup: Remove unused function, unused declaration 2021-07-30 16:55:59 +02:00
9150ba6845 Fix some mesh edition macro operators incorrectly setting an empty description string.
No operator or macro should be missing description. But if they do, then
they should use NULL pointer, and not an empty string.

This behavior was already enforced (through an assert) for operators,
previous commit made it the same for macros.
2021-07-30 16:55:59 +02:00
879c922f2b Fix broken 'undocumented' case in registration of Macro opertators.
Code dealing with macro operators missing description field was slightly
different than the one from Operator registration.

This lead to invalid memory accesses in some python introspection cases
like the i18n messages extraction code in `bl_i18n_utils` module.
2021-07-30 16:55:59 +02:00
212aa101a1 Cleanup: Separate keyframes_draw and keyframes_keylist.
The keylist functions are used in other places for none drawing related
stuff. Fe pose_slide uses it.
2021-07-30 16:55:59 +02:00
2c731304c3 Revert "Depsgraph: Implement 'ID_RECALC_GEOMETRY_DEFORM'"
This reverts commits
 bfa3dc91b7,
 52b94049f2,
 ae379714e4,
 a770faa811,
 4ed029fc02,
 101a493ab5 and
 62a2faa7ef.

And fixes T89955.

Changing the dependency graph is a can of worms and the result is
a kind of unpredictable.

A different solution will be planned.
2021-07-30 16:55:59 +02:00
9ae685bc97 Object update: Remove fallback from batch_cache_deform_tag
Falback is not really necessary, and causes
`BKE_object_data_batch_cache_dirty_tag` to run multithreaded in an
unsafe way.

No functional changes.
2021-07-30 16:55:59 +02:00
2be5b2fcf0 Fix T89941: No path`s bevel update, when I change bevel profile curve
Update was skipping the batch cache.
2021-07-30 16:55:59 +02:00
745f6ac101 Cleanup: minor correction to delaunay_2d_cdt doc-string
Use more conventional syntax for default arguments.
2021-07-30 16:55:59 +02:00
243d8df588 Cleanup: remove unused pathlib import 2021-07-30 16:55:59 +02:00
da79efd820 Cleanup: remove unused MTex.pmapto, pmaptoneg & defines
These have not been in use since 2.57
fafbd9d71b.
2021-07-30 16:55:59 +02:00
ccbd93299d Fix: memcpy overlapping region ASAN warning in curve trim node 2021-07-30 16:55:59 +02:00
bd0af14c16 Cleanup: Make curve trim node code more semantically correct
The code used `Spline::LookupResult` in a way that referred to evaluated
points and control points interchangeably. That didn't affect the logic,
but the code became harder to read. Instead, introduce a local struct
to contain the data in a more obvious way.
2021-07-30 16:55:59 +02:00
4aa3f06f1f Update documentation string for mathutils.geometry.delaunay_2d_cdt. 2021-07-30 16:55:59 +02:00
57e639caa1 Make it optional to track input->output mapping in delaunay_2d_calc.
Some uses of delaunay_2d_calc don't need to know the original verts,
edges, and faces that correspond to output elements.
This change adds a "need_ids" value to the CDT input spec, default true,
which tracks the input ids only when true.
The python api mathutils.geometry.delaunay_2d_cdt gets an optional
final bool argument that is the value of need_ids. If the argument
is not supplied, it is true by default, so this won't break old uses
of the API.

On a sample text test, not tracking ids save about 30% of the runtime.
For most inputs the difference will not be so dramatic: it only really
kicks in if there are a lot of holes.
2021-07-30 16:55:59 +02:00
ceb42e4cc5 Fix T89929: Crash when hiding in the render a previously keyframed volume
Regression introduced in {rBbfa3dc91b754}.

`ID_RECALC_GEOMETRY` should tag all operations of the `GEOMETRY`
component and not just the operation of node `GEOMETRY_EVAL_INIT`.
2021-07-30 16:55:59 +02:00
Angus Stanton
54c69bf729 Geometry Nodes: Curve Trim Node
This node implements shortening each spline in the curve based on
either a length from the start of each spline, or a factor of the
total length of each spline, similar to the "Start & End Mapping"
panel of curve properties.

For Bezier curves, the first and last control points are adjusted
to maintain the shape of the curve, but NURB splines are currently
implicitly converted to poly splines.

The node is implemented to avoid copying where possible, so it outputs
a changed version of the input curve rather than a new one.

Differential Revision: https://developer.blender.org/D11901
2021-07-30 16:55:59 +02:00
8725fc5087 Speed up Delaunay raycast.
From Erik Abrahamsson, this uses parallel loops for raycasting.
It speeds up one example with many crossings of a bezier curve,
from 0.68s to 0.28s.
2021-07-30 16:51:35 +02:00
2b3f1fe2f2 Versioning: fix vertex group name loss in linked duplicates.
After rB3b6ee8cee708 by @HooglyBoogly vertex groups were moved
to mesh data, and versioning code was provided to upgrade old
files. However, it fails to consider the case of linked duplicates
having different name lists, and dependent on the object order
can cause some of the names to be lost. This can even be all of
them, if there is a duplicate without any names, which can be
easily created by lazy Python code.

To fix this, change the code to use the longest available name list.

Differential Revision: https://developer.blender.org/D11958
2021-07-30 16:51:35 +02:00
Angus Stanton
f0a98f14f0 Fix: Incorrect logic in spline lookup function
This section of code deals with evaluated points,
so that is the size it should use.
2021-07-30 16:51:35 +02:00
88f33af4ac Greatly improve speed of Delaunay when have a lot of holes.
Using part of a patch from Erik Abrahamsson, this replaces the
use of linked lists for original id tracking by Sets.
I had thought that the lists were unlikely to grow to more than
a few elements, but when the mesh has a lot of holes (whose
original ids go *outside* the hole, and therefore, most of the
mesh), this assumption can be very wrong.
On a Text regression test, the time went from 11.67s to 0.16s
with this fix. I also tested to make sure that Boolean didn't
slow down with this, and found it actually had a very slight speedup.

Using Sets exposed a dependency on the ordering of the items
in the id lists, luckily caught by a mesh intersect regression test,
so fixed that.
2021-07-30 16:51:35 +02:00
Jesse Yurkovich
41d4a7b55e Fix T89868: Crash showing thumbnail of wide-aspect image
Scaling down images could create images with a width or height of zero.

Clamp at 1 to prevent a crash, also add an assert to scaling functions.

Ref D11956
2021-07-30 16:51:35 +02:00
43a0d4eecb Cleanup: Simplify realizing of pointcloud instances
Just a small change to make the function slightly shorter.
2021-07-30 16:51:35 +02:00
8c8597a623 Fix T89624: Vertex painting causes mesh to flicker
The `ibo.lines_paint_mask` extractor doesn't have a callback to iterate
bmesh faces, this made `filter_into` ignore the extractor.
2021-07-30 16:51:35 +02:00
8ac3b212ef Cleanup: Simplify logic, use C++ types
Also remove an unecessary null check, and make inner loop simpler.
2021-07-30 16:51:35 +02:00
05b2831ff1 VSE: Fix multicam splitting all selected strips
`split_multicam` used split operator, where if more strips than
multicam were selected, all would be split, which is undesirable.

Add `Sequence.split()` RNA API function. to split individual strips.
Function accepts `frame` and `split_method arguments`. Returns right
strip after splitting.

In case when strip being split have effects, these will be split too, so
no invalid state should be created.

Selection is not handled, this is by design up to user.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D11926
2021-07-30 16:51:35 +02:00
a6d9100505 Fix T89722: Duplicate macro can cause strips to overlap
Bug caused by 78693d524c accidentally removing overlap handling when
transform operator is canceled.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D11899
2021-07-30 16:51:35 +02:00
956e41db7b Cleanup: Move gpencil_geom.c to C++
This will help enable development on optimizations to the perimeter
calculation here. Using C++ data structures like Array can make the
code easier to read as well.

Longer term, this can help improve integration with attributes
and possibly the new curve code (since strokes and curves are
quite similar in theory).

Differential Revision: https://developer.blender.org/D11941
2021-07-30 16:51:34 +02:00
0415578ce1 Fix T89899: Crashes when accessing vertex groups from objects
We need to be more strict about trying to retrieve a list of vertex group
names from objects now, as only three object types support them.
This commit adds a check for vertex group support in a few places, the
data transfer operator/modifier, copying vertex groups to selected
objects, and the vertex group remove and clear functions.

Differential Revision: https://developer.blender.org/D11947
2021-07-30 16:51:34 +02:00
c155315698 Cleanup: Get vertex group names directly from grease pencil data 2021-07-30 16:51:34 +02:00
8d79fe22ca Cleanup: Remove redundant logic
The object type was checked twice unnecessarily. Also use a function
for the check to be more explicit.
2021-07-30 16:51:34 +02:00
e2ffe9d630 Surface Deform: support sparse binding mode for improving performance.
When a vertex group is used to limit the influence of the modifier
to a subset of vertices, binding data for vertices with zero weight
is not needed. This wastes memory, disk space and CPU cycles.

If the vertex group contents is known to be final and constant,
it is reasonable to optimize by only storing data group vertices.
This has to be an option in case the group can change.

Supporting this requires adding a vertex index field and spliting
the vertex count into mesh and bind variants, but both happen to
fit in available padding. The old numverts field is renamed to the
new bound vertex count field to maintain the array length invariant.
Versioning is used to initialize the other new fields.

If a file with sparse binding is opened in an old blender version,
it is corrupted into a non-sparse bind with vertex count mismatch,
preventing the modifier from working until rebind.

Differential Revision: https://developer.blender.org/D11924
2021-07-30 16:51:34 +02:00
5c7968ab0d Fix T89875: False dependency cycle on particle systems
`POINT_CACHE_RESET` pointed to `GEOMETRY_EVAL_INIT` while
`GEOMETRY_EVAL_INIT` pointed to `POINT_CACHE_RESET`.

Now `POINT_CACHE_RESET` points to the same nodes pointed to by
`GEOMETRY_EVAL_INIT` thus avoiding the dependency cycle.
2021-07-30 16:51:34 +02:00
9a58acb71c Fix T89782: Segfault populating popup menu with dimensions above the opengl limit
The crash happens because `GPU_offscreen_create` is called with `err_out` `NULL`.

This patch proposes a solution within the `GPU_offscreen_create` itself
and raises an error report in the interface if a menu is called with
dimensions beyond what is supported.

Ref T89782

Maniphest Tasks: T89782

Differential Revision: https://developer.blender.org/D11927
2021-07-30 16:51:34 +02:00
233862ed04 Cleanup: preview rendering, update assumptions in comment
The `action_preview_render()` function used to just render, but now it
also temporarily applies the pose. Its comment is now updated for this.

No functional changes.
2021-07-30 16:51:34 +02:00
58e2f62483 Rename UI error message on attributes panel for name collisions
* Name Collisions > Name collisions
* Info icon > Error icon
2021-07-30 16:51:34 +02:00
30f431aeac Fix T89861: Checking face selection breaks UV stitch operator 2021-07-30 16:51:34 +02:00
7a29a37e7b Fix T70356: Scaling up 1x1 pixel image reads past buffer bounds
Also resolve a crash when when displaying thumbnails, see T89868.
2021-07-30 16:51:34 +02:00
105850b750 Cleanup: reduce variable scope in task_iterator.c
Would have prevented the error in
15cdcb4e90.
2021-07-30 16:51:34 +02:00
1caf30a6a9 Fix error using uninitialized state in BLI_task_parallel_mempool
Single threaded operation used the state before it had variables
written into it.

Error in 15cdcb4e90.
2021-07-30 16:51:34 +02:00
b3602acd22 Cleanup: sort struct declarations 2021-07-30 16:51:34 +02:00
38dd4ac4dd Cleanup: remove redundant parentheses 2021-07-30 16:51:34 +02:00
91b76b38be Cleanup: spelling in comments 2021-07-30 16:51:33 +02:00
8428aec80e Cleanup: compiler warnings 2021-07-30 16:51:33 +02:00
Aidan Haile
c1bd9ecd01 Fix T49944: Compositor ID Mask Anti-Aliasing not working
Replaces current ID Mask node Anti-Aliasing operation by SMAA
operations with default settings as proposed by Jeroen Bakker.
SMAA produces smoother edges.

Reviewed By: manzanilla

Differential Revision: https://developer.blender.org/D11881
2021-07-30 16:51:33 +02:00
Red Mser
54c46ca4c1 UI: Flip driver editor debug lines
In driver editor, vertically flip the value debug lines to align
them with the timeline header values. This makes it easier to read
the values. Also set the line width explicitly, which was incorrect
in some cases.

Differential Revision: https://developer.blender.org/D8877
2021-07-30 16:51:32 +02:00
ce382eec94 Cleanup: Clang tidy 2021-07-30 16:51:32 +02:00
ae8cf5ecfd Cleanup: Remove use of designated initializers in C++ code
Does not compile on Windows.
2021-07-30 16:51:32 +02:00
2e297933ca Cleanup: Move UI list template code to own file (C++)
This move was already prepared with 788d380460 and 26b098c04f. The
template is quite big already, better to give it its own file. Plus it
could use some C++ features like RAII and maybe some more object
oriented code. I plan further refactoring there.
2021-07-30 16:51:32 +02:00
a0a35f78f3 Fix failing tests from vertex group name parameter copy
It turns out `BKE_mesh_copy_parameters` can be called while other
tools are running calculations, which meant that it was called at the
same time as `armature_deform_coords_impl`. Beause of that, we
shouldn't do any freeing (of the old vertex group names) there.

Since the materials are copied in the "for_eval" version anyway,
it seems to make sense to copy the vertex group name list there also.

Fixes T89877, and also the failing `deform_modifiers` test.

Differential Revision: https://developer.blender.org/D11936
2021-07-30 16:51:32 +02:00
c58b00a6af Cleanup: unused variable capture 2021-07-30 16:51:32 +02:00
081638638c Animation/add-ons: Enable the poselib add-on by default
The new Asset Browser-based pose library is partially implemented in an
add-on. This commit enables the add-on by default, as the old pose
library was built-in and thus always enabled.

The ability to disable the add-on is there mostly for cases where
people/studios want to use their own custom pose library.
2021-07-30 16:51:32 +02:00
c0d5c13b46 Fix T88281: Pose Library 'flip pose' sometimes flips wrong
Correct cases where the X-axis of the bone (in pose space) aligns with
the pose-space Y or Z-axis. In these cases the decomposition of the
matrix fails, and a negative scale of the X-axis turns into a 180°
rotation around the Y-axis. An extra -1 scale to the X and Z axes of the
resulting matrix seems to fix things.
2021-07-30 16:51:32 +02:00
9987a2b11e Asset Browser: Python mixin utility for category-specific panels
Using this mixin for a panel definition, it's possible to set in which
categories the panel should appear. This is used by the Pose Library
add-on.
2021-07-30 16:51:32 +02:00
75feaceab8 UI/Assets: Initial Asset View UI template
The asset view UI template is a mini-version of the Asset Browser that
can be placed in regular layouts, regions or popups. At this point it's
made specifically for placement in vertical layouts, it can be made more
flexible in the future.
Generally the way this is implemented will likely change a lot still as
the asset system evolves.

The Pose Library add-on will use the asset view to display pose
libraries in the 3D View sidebar.

References:
* https://developer.blender.org/T86139
* https://code.blender.org/2021/06/asset-browser-project-update/#what-are-we-building
* https://code.blender.org/2021/05/pose-library-v2-0/#use-from-3d-viewport

Notes:
* Important limitation: Due to the early & WIP implementation of the
  asset list, all asset views showing the same library will show the
  same assets. That is despite the ID type filter option the template
  provides. The first asset view created will determine what's visible.
  Of course this should be made to work eventually.
* The template supports passing an activate and a drag operator name.
  The former is called when an asset is clicked on (e.g. to apply the
  asset) the latter when dragging (e.g. to .blend a pose asset). If no
  drag operator is set, regular asset drag & drop will be executed.
* The template returns the properties for both operators (see example
  below).
* The argument list for using the template is quite long, but we can't
  avoid that currently. The UI list design requires that we pass a
  number of RNA or custom properties to work with, that for the Pose
  Libraries should be registered at the Pose Library add-on level, not
  in core Blender.
* Idea is that Python scripts or add-ons that want to use the asset view
  can register custom properties, to hold data like the list of assets,
  and the active asset index. Maybe that will change in future and we
  can manage these internally.

As an example, the pose library add-on uses it like this:
```
activate_op_props, drag_op_props = layout.template_asset_view(
    "pose_assets",
    workspace,
    "active_asset_library",
    wm,
    "pose_assets",
    workspace,
    "active_pose_asset_index",
    filter_id_types={"filter_action"},
    activate_operator="poselib.apply_pose_asset",
    drag_operator="poselib.blend_pose_asset",
)
drag_op_props.release_confirm = True
drag_op_props.flipped = wm.poselib_flipped
activate_op_props.flipped = wm.poselib_flipped
```
2021-07-30 16:51:31 +02:00
e3b1fb44b4 Cleanup: Use const for UI icon getter function 2021-07-30 16:51:31 +02:00
612ac59fc9 UI: Support defining UI lists in C
So far all UI lists had to be defined in Python, this makes it possible
to define them in C as well. Note that there is a whole bunch of special
handling for the Python API that isn't there for C. I think most
importantly custom properties support, which currently can't be added
for C defined UI lists.

The upcoming asset view UI template will use this, which needs to be
defined in C.

Adds a new file `interface_template_list.cc`, which at this point is
mostly a dummy to have a place for the `ED_uilisttypes_ui()` definition.
I plan a separate cleanup to move the UI-list template to that file.
2021-07-30 16:51:31 +02:00
33d495399f UI: New button/widget type for Asset Browser like preview tiles
This button type shows a preview image above centered text, similar to
the File Browser files in Thumbnail Display Mode or the default Asset
Browser display. In fact we may want to port these over to use the new
button type at some point.

Will be used by the asset view UI template that will be added in a
following commit. That is basically a mini version of the Asset Browser
that can be displayed elsewhere in the UI.
2021-07-30 16:51:31 +02:00
0a35fee6bc UI: Auto-scroll to keep active text buttons in view
If a text button is activated that is not in view (i.e. scrolled away),
the scrolling will now be adjusted to have it in view (with some
small additional margin). While entering text, the view may also be
updated should the button move out of view, for whatever reason. For the
most part, this feature shouldn't be needed and won't kick in, except
when a clicked on text button is partially out of view or very close to
the region edge. It's however quite important for the previously
committed feature, that is, pressing Ctrl+F to start searching in a UI
list. The end of the list where the scroll button appears may not be in
view. Plus while filtering the number of visible items changes so the
scrolling has to be updated to keep the search button visible.

Note that I disabled the auto-scrolling for when the text button spawned
an additional popup, like for search-box buttons. That is because
current code assumes the button to have a fixed position while the popup
is open. There is no code to update the popup position together with the
button/scrolling.

I also think that the logic added here could be used in more places,
e.g. for the "ensure file in view" logic the File Browser does.
2021-07-30 16:51:31 +02:00
3c76c983aa UI: Support pressing Ctrl+F over UI lists to search
Adds an operator invoked by default with Ctrl+F that while hovering a UI
list, opens the search field of the list and enables text input for it.
With this commit the search button may actually be out of view after
Ctrl+F still. The following commit adds auto-scroll to solve that.

A downside is that in the Properties, there also is Ctrl+F to start
the editor-wide search. That's not unusual in Blender though (e.g.
scolling with the mouse over a UI list also scrolls the list, not the
region).
2021-07-30 16:51:31 +02:00
7083656da3 UI: Support UI list tooltips, defined via Python scripts
Makes it possible to create tooltips for UI list rows, which can be
filled in .py scripts, similar to how they can extend other menus. This
is used by the (to be committed) Pose Library add-on to display pose
operations (selecting bones of a pose, blending a pose, etc).

It's important that the Python scripts check if the UI list is the
correct one by checking the list ID.
For this to work, a new `bpy.context.ui_list` can be checked. For
example, the Pose Library add-on does the following check:
```
def is_pose_asset_view() -> bool:
  # Important: Must check context first, or the menu is added for every kind of list.
  list = getattr(context, "ui_list", None)
  if not list or list.bl_idname != "UI_UL_asset_view" or list.list_id != "pose_assets":
    return False
  if not context.asset_handle:
    return False
  return True
```
2021-07-30 16:51:31 +02:00
fb797b18d5 UI: Support left-right arrow key walk navigation in UI lists
Add improved arrow key walk navigation in grid layout UI List templates.
Pressing up or down walks the active item to the adjacent row in that
direction, while left and right walk through the items along the columns
wrapping at the rows.

Note from Julian:
In combination with the following commit, this has the important
limitation that the list's custom activate operator won't be called when
"walking over" an item that is scrolled out of the list. That is because
we don't actually create any buttons for those that could be used for
the handling logic. For our purposes of the pose libraries that should
be fine since the asset view list is always made big enough to display
all items. Solving this might be difficult, we don't properly support
nesting boxes with proper scrolling in regular layouts. It's all just
hacked a bit for UI-lists to work. Overlaps quite a bit with T86149.

Differential Revision: https://developer.blender.org/D11063
2021-07-30 16:51:31 +02:00
dd7c341c32 UI: Internal support for custom UI list item drag & activate operators
For pose libraries, we need to be able to apply a pose whenever
activating (clicking) an item in the Pose Library asset view and blend
it by dragging (press & move). And since we want to allow Python scripts
to define what happens at least when activating an asset (so they can
define for example a custom "Apply" operator for preset assets), it
makes sense to just let them pass an operator name to the asset view
template. The template will be introduced in a following commit.
2021-07-30 16:51:31 +02:00
58d1fe4790 UI: New UI list layout type for big preview tiles
This new layout type is meant for the upcoming asset view UI template.
With it it is possible to show big asset previews with their names in a
responsive grid layout.

Notes:
* The layout is only available for C defined UI lists. We could expose
  it to Python, but I think there are still some scrolling issues to be
  fixed first. (The asset view template doesn't use scrolling for the UI
  list.)
* I'd consider this a more usable version of the existing `GRID` layout
  type. We may remove that in favor of the new one in future.
2021-07-30 16:51:31 +02:00
caacb0f7bd UI: UI list refactor & preparations for asset view template
This is more of a first-pass refactor for the UI list template. More
improvements could be done, but that's better done separately. Main
purpose of this is to make the UI list code more manageable and ready
for the asset view template.

No functional changes for users.

* Split the huge template function into more manageable functions, with
  clear names and a few structs with high coherency.
* Move runtime data management to the template code, with a free
  callback called from BKE. This is UI data and should be managed at
  that level.
* Replace boolean arguments with bit-flags (easily extendable and more
  readable from the caller).
* Allow passing custom-data to the UI list for callbacks to access.
* Make list grip button for resizing optional.
* Put logic for generating the internal UI list identifier (stored in
  .blends) into function. This is a quite important bit and a later
  commit adds a related function. Good to have a clear API for this.
* Improve naming, comments, etc.

As part of further cleanups I'd like to move this to an own file.
2021-07-30 16:51:31 +02:00
135d1bd9ec Assets: temporarily apply pose when generating preview image
When generating a preview image for a pose, temporarily apply it to the
armature. Contrary to the usual pose application, this ignores the
selected bones and always applies the entire pose.
2021-07-30 16:51:31 +02:00
a4cf4273fd Animation: new pose library based on Asset Browser
Introduce new pose library, based on the Asset Browser. Contrary to the
old pose library (in `editors/armature/pose_lib.c`), which stored an
entire library of poses in an `Action`, in the new library each pose is
its own `Action` datablock. This is done for compatibility with the
asset browser, and also to make it easier to attach preview images,
share datablocks, etc. Furthermore, it opens the door to having
animation snippets in the pose library as well.

This commit contains the C code for the pose library; in order to fully
use it, an addon is required as well (which will be committed shortly).
2021-07-30 16:51:31 +02:00
4812ad4d26 Animation: add function to blend Action into pose
Add function `BKE_pose_apply_action_blend()`, which blends a given
Action into current pose. The Action is evaluated at a specified frame,
and the result is applied to the armature's pose.

A blend factor can be given to blend between the current pose and the
one in the Action. Quaternions are interpolated with SLERP; it is
assumed that their FCurves are consecutively stored in the Action.

This function will be used in the upcoming new Pose Library.
2021-07-30 16:51:31 +02:00
e8d00e507a Animation: apply pose to all or selected bones of armature
New function `BKE_pose_apply_action_all_bones()`, which will be
necessary for the upcoming pose library v2.0.

This renames the function `BKE_pose_apply_action` to
`BKE_pose_apply_action_selected_bones`, to reflect that it only works on
selected bones, to contrast it to the new function.
2021-07-30 16:51:31 +02:00
393fd9168f Assets: Open Blend File operator
Add operator 'Open Blend File' to the Asset Browser. This operator:
- starts a new Blender process,
- opens the blend file containing the asset,
- monitors the new Blender process, and when it stops,
- reloads the assets to show any changes made.
2021-07-30 16:51:31 +02:00
727d58dedd Assets: Abstraction for temporary loading of asset data-blocks
This is an editor-level abstraction for the `BLO_library_temp_xxx()`
API for temporary loading of data-blocks from another Blend file. It
abstracts away the asset specific code, like asset file-path handling
and local asset data-block handling.

Main use-case for this is applying assets as presets that are based on
data-blocks, like poses. Such preset assets are an important part of the
asset system design, so such an abstraction will likely find more usage
in the future.
2021-07-30 16:51:31 +02:00
d0a2763b04 File/Asset Browser: Extend file-entry and asset handle Python API
Adds the following to `bpy.types.FileSelectEntry`:
* `id_type`: The data-block type the file represenets, if any.
* `local_id`: The local data-block it represents, if any (assets only).

And the following to `bpy.types.AssetHandle`:
* `local_id`: The local data-block the asset represents, if any.

This kind of information and the references are important for asset related
operators and UIs. They will be used by upcoming Pose Library features.
2021-07-30 16:51:31 +02:00
ab7046ab1c Assets: Initial Asset List as part of the Asset System design
Implements a basic, WIP version of the asset list. This is needed to
give the asset view UI template asset reading and displaying
functionality.

See:
* Asset System: Data Storage, Reading & UI Access - https://developer.blender.org/T88184

Especially the asset list internals should change. It uses the
File/Asset Browser's `FileList` API, which isn't really meant for access
from outside the File Browser. But as explained in T88184, it does a lot
of the stuff we currently need, so we (Sybren Stüvel and I) decided to
go this route for now. Work on a file-list rewrite which integrates well
with the asset system started in the `asset-system-filelist` branch.

Further includes:
* Operator to reload the asset list.
* New `bpy.types.AssetHandle.get_full_library_path()` function, which
  gets the full path of the asset via the asset-list.
* Changes to preview loading to prevent the preview loading job to run
  eternally for asset views. File Browsers have this issue too, but
  should be fixed separately.
2021-07-30 16:51:31 +02:00
0d889f1f4c Assets: Show asset path in asset browser sidebar
It's useful to know where an asset is stored in, before this there was no way
to tell this. This could probably be displayed nicer in the UI but we're
currently unsure how. But at least the information is there now.
2021-07-30 16:51:31 +02:00
91b3814301 Assets: AssetHandle type as temporary design to reference assets
With temporary I mean that this is not intended to be part of the
eventual asset system design. For that we are planning to have an
`AssetRepresentation` instead, see T87235. Once the `AssetList` is
implemented (see T88184), that would be the owner of the asset
representations.

However for the upcoming asset system, asset browser, asset view and
pose library commits we need some kind of asset handle to pass around.
That is what this commit introduces.
Idea is a handle to wrap the `FileDirEntry` representing the asset, and
an API to access its data (currently very small, will be extended in
further commits). So the fact that an asset is currently a file
internally is abstracted away. However: We have to expose it as file in
the Python API, because we can't return the asset-handle directly there,
for reasons explained in the code. So the active asset file is exposed
as `bpy.context.asset_file_handle`.
2021-07-30 16:51:31 +02:00
fada98c621 Assets: Expose active asset library in context
For the Asset Browser, this returns the active asset library of the
Asset Browser, otherwise it returns the one active in the workspace.

This gives simple access to the active asset library from UI code and
Python scripts. For example the upcoming Pose Library add-on uses this,
as well as the upcoming asset view template.
2021-07-30 16:51:30 +02:00
675536fd4b Assets: Add an active asset library per workspace, for the UI to use
This per-workspace active asset library will be used by the asset views
later. Note that Asset Browsers have their own active asset library,
overriding the one from the workspace.

As part of this the `FileSelectAssetLibraryUID` type gets replaced by
`AssetLibraryReference` which is on the asset level now, not the
File/Asset Browser level. But some more work is needed to complete that,
which is better done in a separate commit.
This also moves the asset library from/to enum-value logic from RNA to
the editor asset level, which will later be used by the asset view.
2021-07-30 16:51:30 +02:00
Robert Sheldon
5f4edeb367 Fix T88188: Allow keyframing vertex mass in cloth sim
Update vertex weights between simulation steps if they have changed.
This allows for animated vertex weights in the cloth sim.

Reviewed By: Sebastian Parborg

Differential Revision: http://developer.blender.org/D11640
2021-07-30 16:51:30 +02:00
f993802456 Library loading: Fix access of out-of-scope memory in py context manager
The `__enter__` function of the `bpy.data.libraries.load` context manager
was storing a pointer to a stack-allocated variable, which was subsequently
used in the `__exit__` function, causing a crash. This is now fixed.

Thanks @Severin for the patch.
2021-07-30 16:51:30 +02:00
Paul Golter
8225cca4fb Fix: Subtitles: Order of channels in the .blend file will be kept in the .rst file.
If text strips have the same start frame but are stacked on top of each
other in different channels the order in which they are written in the
.rst file was random before.

Reviewed By: Richard Antalik

Differential Revision: https://developer.blender.org/D11903
2021-07-30 16:51:30 +02:00
Heinrich Schuchardt
5d7bb20b17 Add support for RISC-V architecture
* On RISC-V GCC 10.3 does not define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_n.
* Avoid a build error
  "Please add support for your platform in build_config.h"
  Cf: https://github.com/sergeyvfx/libNumaAPI/pull/3

Differential Revision: https://developer.blender.org/D11910
2021-07-30 16:51:30 +02:00
2b49389786 Cleanup: LayerCollection resync: Proper r_ prefix for return function parameter. 2021-07-30 16:51:30 +02:00
12e8ecd09c Cleanup: improve comments, remove debug printf 2021-07-30 16:51:30 +02:00
27d0c21eeb Keymap: use Shift-Tab to toggle snap in the sequencer
Match the same shortcut for the 3D view & UV editor.
2021-07-30 16:51:30 +02:00
68e06b10d8 Cleanup: LayerCollection resync code.
Mainly naming (also droping the `layer_collection`  in favor of just
`layer` for internal code, this is clear enough and much shorter). Add
proper parent/child identifiers, `r_` prefix for parameters also used as
return values, etc.

Also made some parameters const.
2021-07-30 16:51:30 +02:00
da777ab2e5 Fix: crash when creating new node links
This was a regression in rBc27ef1e9e8e663e02173e518c1e669e9845b3d1f.
2021-07-30 16:51:30 +02:00
021eb28836 Fix T89870: Vertex groups lost when opening 3.0 files in 2.93
The original refactor for vertex groups (3b6ee8cee7)
forgot to bump the minimum file requirement.

I'm also bumping the subversion to 12 so everyone can switch to a
working subversion number.

Differential Revision: https://developer.blender.org/D11931
2021-07-30 16:51:30 +02:00
56ce9c8ff2 macOS/glog: Silence syscall deprecation warning
Upstream will release the fix in 0.6 which will take time.
Silence two warnings.

Differential Revision: https://developer.blender.org/D11246
2021-07-30 16:51:30 +02:00
34e273c2ed Keymap: use Alt-Q instead of D for transfer mode operator
This now works in all modes (not just sculpt) and activates on press
instead of release. See design task T89757.
2021-07-30 16:51:30 +02:00
eb525f8466 Revert "Keymap: use D-Key for view-pie menu"
This reverts commit f92f5d1ac6.

See: T89757 for rationale for reverting this change.
2021-07-30 16:51:30 +02:00
19e5a0783a Fix: missing null check
This was a regression in rB3b6ee8cee7080af200e25e944fe30d310240e138.
2021-07-30 16:51:30 +02:00
9c4b18dd96 Geometry Nodes: dim links whose start and end sockets are not visible
This makes node trees with long links that cross other nodes easier to work with.
Dimmed links will be ignored by various modal operators like cut and reroute insertion.

Differential Revision: https://developer.blender.org/D11813
2021-07-30 16:51:30 +02:00
04d5bac6e6 Cleanup: use raw strings, quiet clang-tidy warnings 2021-07-30 16:51:30 +02:00
1f30133770 Cleanup: replace BLI_assert(!"text") with BLI_assert_msg(0, "text")
This shows the text as part of the assertion message.
2021-07-30 16:51:30 +02:00
1a1955776b Cleanup: clang-format 2021-07-30 16:51:30 +02:00
d5d8f1f6cc Cleanup: ensure one newline at end of file, strip trailing space 2021-07-30 16:51:29 +02:00
0dbfb40d20 CMake: update config for checking utility 2021-07-30 16:51:29 +02:00
b7de6735c1 BLI_task: add a callback to initialize TLS
Useful when TLS requires it's own allocated structures.
2021-07-30 16:51:29 +02:00
98f92c807a BLI_memarena: support merging memory arenas
Useful when thread-local storage has it's own memory arena containing
data which is kept after the multi-threaded operation has finished.
2021-07-30 16:51:29 +02:00
4aa2187dce deps_builder: zstd 1.5.0
Having zstd available is a requirement for landing D5799

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D11079
2021-07-30 16:51:29 +02:00
694249940a GHOST/wayland: create mmap-ed file manually if memfd_create is unavailable 2021-07-30 16:51:29 +02:00
e3d8f427d5 CMake: Have CMake Control the C++ version.
We were manually setting the compiler flags
for C++17 support for this previously. CMake
can do this for us in a uniform way without
having to worry about compiler specifics.

Setting these flags manually somehow brought
out some unwanted behaviour (CMake switching
back to C++14) in the nightly CMake builds.

Unsure if that's a CMake bug or planned
new behaviour for future version, but best
to play it safe.

These flags are supported since CMake 3.1
so should not break anything.

Reviewed by: Campbell Barton

Differential Revision: https://developer.blender.org/D11891
2021-07-30 16:51:29 +02:00
d948bd616d Bezier Spline: Add a more generalized insertion utility
This logic is from the curve sundivide node, used to add points with
proper handles in between two existing points. However, the same logic
is used for trimming of Bezier splines, and possibly interactive point
insertion in the future, so it's helpful as a general utility.

The logic is converted to depend on a bezier spline instead of being
static. A temporary segment spline can be used for the latter use case.
2021-07-30 16:51:29 +02:00
239bf16cc7 Merge remote-tracking branch 'origin/soc-2021-porting-modifiers-to-nodes-merge-by-distance' into soc-2021-porting-modifiers-to-nodes-merge-by-distance 2021-07-24 22:48:52 +02:00
529913b2df - copied point cloud support from D10888 to this patch
- added support for selection with point cloud mode
2021-07-24 22:48:42 +02:00
2c6aeb6240 - copied point cloud support from D10888 to this patch
- added support for selection with point cloud mode
2021-07-24 22:47:58 +02:00
9503e34e99 Merge branch 'master' into soc-2021-porting-modifiers-to-nodes-merge-by-distance
# Conflicts:
#	source/blender/modifiers/intern/MOD_weld.c
2021-07-24 11:41:37 +02:00
5c79a2953b changes based on review by Hans Goudey (HooglyBoogly) 2021-07-24 11:38:36 +02:00
7f33ff779f Merge branch 'master' into soc-2021-porting-modifiers-to-nodes-remesh-blocks 2021-07-24 11:20:30 +02:00
80870aebd0 added mode selector 2021-07-23 23:23:49 +02:00
aaee6e13d4 Merge branch 'master' into soc-2021-porting-modifiers-to-nodes-remesh-blocks
# Conflicts:
#	source/blender/blenkernel/BKE_node.h
2021-07-23 21:08:25 +02:00
096d6017cc Merge remote-tracking branch 'origin/soc-2021-porting-modifiers-to-nodes-merge-by-distance' into soc-2021-porting-modifiers-to-nodes-merge-by-distance 2021-07-23 21:07:07 +02:00
18f45f874c Geometry Nodes: Merge by Distance (Direct Modifier Port)
This patch is a direct port of the Weld modifier that moves the
common code to the geometry module.
I had made another version of a Merge by Distance Modifier (D10888), with an own implementation,
but I found that the original modifiers algorithm gives finer results.

Differential Revision: https://developer.blender.org/D12019
2021-07-23 21:00:07 +02:00
607119dd3f formatting 2021-07-23 12:03:45 +02:00
d777efbf5c Merge branch 'master' into soc-2021-porting-modifiers-to-nodes-merge-by-distance
# Conflicts:
#	source/blender/blenkernel/BKE_node.h
2021-07-23 08:15:08 +02:00
7425af128f initial commit 2021-07-23 08:14:34 +02:00
9823ac0767 initial commit 2021-07-19 23:48:50 +02:00
226ae2e69f moved remesh_blocks to geometry module 2021-07-19 00:10:22 +02:00
0b654b04cb Merge branch 'master' into soc-2021-porting-modifiers-to-nodes-remesh-blocks 2021-07-16 23:13:48 +02:00
474828bf25 Merge branch 'master' into soc-2021-porting-modifiers-to-nodes-remesh-voxel 2021-07-16 21:51:01 +02:00
c21f9930bc removed makesrna from includes in CMakeLists.txt 2021-07-16 21:17:19 +02:00
906347042d - added geometry module
- moved solidify to geometry module
2021-07-15 22:33:26 +02:00
0d8bb5f898 more cleanup 2021-07-15 11:28:08 +02:00
bcd1a5af89 Cleanup 2021-07-15 11:19:56 +02:00
de9dda76ab Merge branch 'master' into soc-2021-porting-modifiers-to-nodes-solidify
# Conflicts:
#	release/scripts/startup/nodeitems_builtins.py
#	source/blender/blenkernel/BKE_node.h
#	source/blender/blenkernel/intern/node.cc
#	source/blender/blenkernel/intern/solidify_nonmanifold.c
#	source/blender/nodes/CMakeLists.txt
#	source/blender/nodes/NOD_geometry.h
#	source/blender/nodes/NOD_static_types.h
2021-07-15 00:07:52 +02:00
6beb133315 Changes based on review by Jacques Lucke (JacquesLucke) 2021-07-14 23:56:29 +02:00
f9f3ece427 Merge branch 'master' into soc-2021-porting-modifiers-to-nodes-decimate
# Conflicts:
#	source/blender/blenkernel/BKE_node.h
2021-07-14 19:42:12 +02:00
db07041c44 Geometry Nodes: Remesh Blocks
This patch adds a Remesh Voxel node (compared to Remesh Blocks)
The node uses the BKE function for voxel remeshing used in the modifier as well.

Part of the GSOC 2021

Differential Revision: https://developer.blender.org/D11907
2021-07-14 01:08:20 +02:00
62ecb33642 Merge branch 'master' into soc-2021-porting-modifiers-to-nodes-remesh-voxel
# Conflicts:
#	release/scripts/startup/nodeitems_builtins.py
#	source/blender/blenkernel/BKE_node.h
2021-07-14 00:28:50 +02:00
e1f9b7442b cleanup 2021-07-14 00:27:13 +02:00
7bad25040a - renamed WITH_MOD_REMESH to WITH_REMESH_DUALCON
since it is now shared between node and modifier no longer specific to
the modifier.
2021-07-14 00:23:50 +02:00
c7a1eeaf7b Merge remote-tracking branch 'origin/soc-2021-porting-modifiers-to-nodes-remesh-blocks' into soc-2021-porting-modifiers-to-nodes-remesh-blocks
# Conflicts:
#	source/blender/nodes/geometry/nodes/node_geo_remesh_blocks.cc
2021-07-13 23:43:22 +02:00
b191448bcb - fixed a bug with mesh renderin points. 2021-07-13 23:42:13 +02:00
0a75579e1f Geometry Nodes: Remesh Blocks
This patch adds a Remesh Blocks node (compared to Remesh Voxel)

It internaly  moves the remesh algorithm,
used in all modes of the Remesh modifier except the Voxel mode to blender kernel
and shares that code with the modifier.

Differential Revision: https://developer.blender.org/D11905
2021-07-13 22:15:37 +02:00
80f6798191 - cleanup 2021-07-13 22:00:23 +02:00
60c84d0a64 Merge branch 'master' into soc-2021-porting-modifiers-to-nodes-remesh-blocks
# Conflicts:
#	source/blender/blenkernel/BKE_node.h
2021-07-13 20:39:12 +02:00
ef0e0af332 - Renamed Remesh to Remesh Block.
- Moved Dualcon Remesh to BKE
- Used new BKE_mesh_remesh_blocks in modifier and node.
2021-07-12 23:55:33 +02:00
344b59b66c Merge branch 'master' into soc-2021-porting-modifiers-to-nodes-remesh
# Conflicts:
#	release/scripts/startup/nodeitems_builtins.py
#	source/blender/blenkernel/BKE_node.h
2021-07-09 23:29:44 +02:00
77116c1841 Merge branch 'master' into soc-2021-porting-modifiers-to-nodes-decimate
# Conflicts:
#	release/scripts/startup/nodeitems_builtins.py
#	source/blender/blenkernel/BKE_node.h
#	source/blender/blenkernel/intern/node.cc
2021-07-09 10:30:41 +02:00
950f1bf476 Renamed Limittypes from Face to Border and from Edge to Selection
because you can use them with different domains and the real difference
is how it uses this data.
2021-07-09 10:18:08 +02:00
d2b9cc41e7 Added attribute delimiter for dissolve node 2021-07-08 12:11:23 +02:00
1512c5c973 changes based on review by Hans Goudey (HooglyBoogly) 2021-07-07 09:17:15 +02:00
402422e8ab Merge branch 'master' into soc-2021-porting-modifiers-to-nodes-decimate
# Conflicts:
#	source/blender/blenkernel/BKE_node.h
#	source/blender/blenkernel/intern/node.cc
#	source/blender/nodes/CMakeLists.txt
#	source/blender/nodes/NOD_geometry.h
#	source/blender/nodes/NOD_static_types.h
2021-07-06 22:26:09 +02:00
126026c63c Merge remote-tracking branch 'origin/soc-2021-porting-modifiers-to-nodes-decimate' into soc-2021-porting-modifiers-to-nodes-decimate 2021-07-06 22:24:03 +02:00
79f8e7137d cleanup 2021-07-06 22:22:53 +02:00
54a45d1c1b Merge branch 'master' into soc-2021-porting-modifiers-to-nodes-remesh
# Conflicts:
#	source/blender/blenkernel/BKE_node.h
#	source/blender/nodes/NOD_geometry.h
2021-07-05 22:23:42 +02:00
bcc1b614d8 Geometry Nodes: Collapse Node, Dissolve Node, Unsubdivide Node
initially working node

added factor as slot

Merge branch 'master' into gsoc-2021-porting-modifiers-to-nodes-decimate

# Conflicts:
#	source/blender/blenkernel/BKE_node.h
#	source/blender/blenkernel/intern/node.cc
#	source/blender/nodes/CMakeLists.txt
#	source/blender/nodes/NOD_geometry.h
#	source/blender/nodes/NOD_static_types.h

Split decimate into three different nodes.

Set default values for dissolve node

removed decimate node and reformatting

Merge branch 'master' into soc-2021-porting-modifiers-to-nodes-decimate

# Conflicts:
#	source/blender/blenkernel/BKE_node.h
#	source/blender/nodes/CMakeLists.txt

merged with master and cleanup

Differential Revision: https://developer.blender.org/D11791
2021-07-03 00:56:23 +02:00
7cacec80e5 merged with master and cleanup 2021-07-03 00:07:14 +02:00
d85d59afc9 Merge branch 'master' into soc-2021-porting-modifiers-to-nodes-decimate
# Conflicts:
#	source/blender/blenkernel/BKE_node.h
#	source/blender/nodes/CMakeLists.txt
2021-07-02 21:57:53 +02:00
703bdbe492 removed decimate node and reformatting 2021-07-02 21:49:59 +02:00
328084acb6 Set default values for dissolve node 2021-07-02 21:36:21 +02:00
78322cbee6 Split decimate into three different nodes. 2021-07-02 20:49:28 +02:00
9722c8348d Merge branch 'master' into gsoc-2021-porting-modifiers-to-nodes-decimate
# Conflicts:
#	source/blender/blenkernel/BKE_node.h
#	source/blender/blenkernel/intern/node.cc
#	source/blender/nodes/CMakeLists.txt
#	source/blender/nodes/NOD_geometry.h
#	source/blender/nodes/NOD_static_types.h
2021-06-27 10:28:21 +02:00
f0f26b3fcb - cleanup 2021-06-25 09:15:21 +02:00
28ee6ef31a - changes previously lost due to merge conflict.
- some more cleanup.
2021-06-25 09:06:18 +02:00
6afd66c2eb Merge branch 'master' into soc-2021-porting-modifiers-to-nodes-solidify 2021-06-25 08:04:02 +02:00
5379633e59 - corrected two comments in corresponding test 2021-06-24 23:11:39 +02:00
051ce30390 Merge branch 'master' into gsoc-2021-porting-modifiers-to-nodes-solidify 2021-06-24 21:16:25 +02:00
1f70e8b748 - changes based on review by Hans Goudey. 2021-06-24 01:37:45 +02:00
ecc67c10e1 - changes based on review by Hans Goudey. 2021-06-24 00:40:57 +02:00
75df5d34d3 - some more cleanup 2021-06-22 11:31:34 +02:00
aedf0f3efa Merge remote-tracking branch 'origin/gsoc-2021-porting-modifiers-to-nodes-solidify' into gsoc-2021-porting-modifiers-to-nodes-solidify
# Conflicts:
#	source/blender/nodes/CMakeLists.txt
#	source/blender/nodes/geometry/nodes/node_geo_solidifiy.cc
2021-06-22 10:49:28 +02:00
97aab4245e - re-added the one important file that I deleted by accident. 2021-06-22 10:43:29 +02:00
897838a2cc - deleted unneeded files 2021-06-22 09:45:28 +02:00
0766941f8f rebaseing and cleanup 2021-06-22 09:41:49 +02:00
bfbeabeb39 - selection for simple 2021-06-22 09:40:18 +02:00
efcab1bc1b makeing node and modifier working with solidify kernel version. 2021-06-22 09:37:36 +02:00
4a4445124e moved solidify to Blender Kernel 2021-06-22 09:28:13 +02:00
a58a4cfc14 - working with data from node 2021-06-22 09:26:06 +02:00
c71b4ee3f6 solidify_extrude_generaly working. 2021-06-22 09:25:49 +02:00
496e3b2b1a - rebased to master
- removed solidify extrude mode from node and reverted solidify extrude
back to internal version in modifier
- fixed vertex-groups for
2021-06-22 09:22:19 +02:00
fa06eb9b97 - added output groups for rim and fill 2021-06-22 09:20:46 +02:00
7d2b039942 Initial setup for solidify node
solidify_extrude_generaly working.

- working with data from node

- added basic support for input data

moved solidify to Blender Kernel

makeing node and modifier working with solidify kernel version.

- added offset and boundary data enums for nonmanifold mode.

- selection for simple

make selection work for complex mode

rebaseing and cleanup

Differential Revision: https://developer.blender.org/D11575
2021-06-22 09:18:10 +02:00
a13e9edfbb - selection for simple 2021-06-22 09:16:06 +02:00
00a3241095 makeing node and modifier working with solidify kernel version. 2021-06-22 09:12:54 +02:00
171a1feeb3 moved solidify to Blender Kernel 2021-06-22 09:04:35 +02:00
c17b1601b7 - added basic support for input data 2021-06-22 09:00:02 +02:00
931b1ed7c7 - working with data from node 2021-06-22 09:00:02 +02:00
b51602996e solidify_extrude_generaly working. 2021-06-22 09:00:02 +02:00
1cc5ab539b Initial setup for solidify node 2021-06-22 09:00:02 +02:00
f12f0f0cd9 generalized material offset for solidify_modifier 2021-06-22 08:59:34 +02:00
2869ee328c added back vertex-group reverse option. 2021-06-22 08:59:34 +02:00
84ecc6c3e1 rebaseing and cleanup 2021-06-22 08:59:34 +02:00
0176d404f1 - selection for simple 2021-06-22 08:59:34 +02:00
821b17be25 makeing node and modifier working with solidify kernel version. 2021-06-22 08:59:34 +02:00
751679edc2 moved solidify to Blender Kernel 2021-06-22 08:59:34 +02:00
fd9932d380 - working with data from node 2021-06-22 08:59:34 +02:00
da94c057fd solidify_extrude_generaly working. 2021-06-22 08:59:34 +02:00
a44785c4dc - formatting 2021-06-22 08:59:34 +02:00
ef51c65775 - rebased to master
- removed solidify extrude mode from node and reverted solidify extrude
back to internal version in modifier
- fixed vertex-groups for
2021-06-22 08:59:34 +02:00
b4ff2ce85d - added output groups for rim and fill 2021-06-22 08:59:34 +02:00
1640c3536f Initial setup for solidify node
solidify_extrude_generaly working.

- working with data from node

- added basic support for input data

moved solidify to Blender Kernel

makeing node and modifier working with solidify kernel version.

- added offset and boundary data enums for nonmanifold mode.

- selection for simple

make selection work for complex mode

rebaseing and cleanup

Differential Revision: https://developer.blender.org/D11575
2021-06-22 08:59:34 +02:00
08fc5f1d8e make selection work for complex mode 2021-06-22 08:59:34 +02:00
339b7a7b03 - selection for simple 2021-06-22 08:59:34 +02:00
5af6c35dd1 - added offset and boundary data enums for nonmanifold mode. 2021-06-22 08:59:34 +02:00
a33076f769 makeing node and modifier working with solidify kernel version. 2021-06-22 08:59:33 +02:00
7026eca6e3 moved solidify to Blender Kernel 2021-06-22 08:59:33 +02:00
0291553d70 - added basic support for input data 2021-06-22 08:59:33 +02:00
48fc1bde95 - working with data from node 2021-06-22 08:59:33 +02:00
48dc0c6fd6 solidify_extrude_generaly working. 2021-06-22 08:59:33 +02:00
95bd8e494c Initial setup for solidify node 2021-06-22 08:59:33 +02:00
328406cf60 generalized material offset for solidify_modifier 2021-06-18 21:14:59 +02:00
3ecf0753e8 added back vertex-group reverse option. 2021-06-18 17:22:24 +02:00
dbeb2a7724 Merge remote-tracking branch 'origin/gsoc-2021-porting-modifiers-to-nodes-solidify' into gsoc-2021-porting-modifiers-to-nodes-solidify
# Conflicts:
#	source/blender/blenkernel/BKE_node.h
#	source/blender/blenkernel/BKE_solidifiy.h
#	source/blender/blenkernel/CMakeLists.txt
#	source/blender/blenkernel/intern/node.cc
#	source/blender/blenkernel/intern/solidify_nonmanifold.c
#	source/blender/makesrna/intern/rna_nodetree.c
#	source/blender/modifiers/intern/MOD_solidify.c
#	source/blender/nodes/CMakeLists.txt
#	source/blender/nodes/NOD_geometry.h
#	source/blender/nodes/NOD_static_types.h
2021-06-18 16:24:12 +02:00
f07aa393bf - formatting 2021-06-18 16:07:51 +02:00
68a28e1982 - rebased to master
- removed solidify extrude mode from node and reverted solidify extrude
back to internal version in modifier
- fixed vertex-groups for
2021-06-18 16:07:51 +02:00
f23bb03cbb - added output groups for rim and fill 2021-06-18 16:07:51 +02:00
1fcbade10c Initial setup for solidify node
solidify_extrude_generaly working.

- working with data from node

- added basic support for input data

moved solidify to Blender Kernel

makeing node and modifier working with solidify kernel version.

- added offset and boundary data enums for nonmanifold mode.

- selection for simple

make selection work for complex mode

rebaseing and cleanup

Differential Revision: https://developer.blender.org/D11575
2021-06-18 16:07:51 +02:00
cbe359bbf2 make selection work for complex mode 2021-06-18 16:07:51 +02:00
3493fefb74 - selection for simple 2021-06-18 16:07:51 +02:00
8f600e8256 - added offset and boundary data enums for nonmanifold mode. 2021-06-18 16:07:51 +02:00
607eef0ae7 makeing node and modifier working with solidify kernel version. 2021-06-18 16:07:51 +02:00
035ee22a50 moved solidify to Blender Kernel 2021-06-18 16:07:51 +02:00
e39543a64d - added basic support for input data 2021-06-18 16:07:51 +02:00
a97bfc4e31 - working with data from node 2021-06-18 16:07:51 +02:00
30ea058694 solidify_extrude_generaly working. 2021-06-18 16:07:51 +02:00
6fad4ce981 Initial setup for solidify node 2021-06-18 16:07:51 +02:00
c718d169a9 rebaseing and cleanup 2021-06-10 21:01:34 +02:00
0a96b035cf make selection work for complex mode 2021-06-10 20:11:24 +02:00
39f1908ba9 - selection for simple 2021-06-10 20:11:24 +02:00
1f38c1f3b2 - added offset and boundary data enums for nonmanifold mode. 2021-06-10 20:11:24 +02:00
5444335e44 makeing node and modifier working with solidify kernel version. 2021-06-10 20:11:24 +02:00
531c65fd93 moved solidify to Blender Kernel 2021-06-10 20:11:09 +02:00
1e07e070fc - added basic support for input data 2021-06-10 20:10:23 +02:00
29c0528eb6 - working with data from node 2021-06-10 20:10:23 +02:00
174052e1de solidify_extrude_generaly working. 2021-06-10 20:10:23 +02:00
caac062b55 Initial setup for solidify node 2021-06-10 20:10:23 +02:00
2f65eed0e7 - make initial setup work. 2021-05-27 21:05:39 +02:00
ff8ad9b24b - first impression 2021-05-27 20:32:20 +02:00
641d268d59 added factor as slot 2021-05-26 00:55:37 +02:00
d82bda7b44 initially working node 2021-05-26 00:45:40 +02:00
ded679d866 Initial setup for decimate node 2021-05-20 20:21:06 +02:00
0ddfdb0dbf Initial setup for remesh node 2021-05-20 11:01:08 +02:00
52 changed files with 4718 additions and 2333 deletions

View File

@@ -269,10 +269,11 @@ if(UNIX AND NOT APPLE)
option(WITH_SYSTEM_EIGEN3 "Use the systems Eigen3 library" OFF)
endif()
# Geometry
option(WITH_REMESH_DUALCON "Enable Remesh Algorithm using Dualcon" ON)
# Modifiers
option(WITH_MOD_FLUID "Enable Mantaflow Fluid Simulation Framework" ON)
option(WITH_MOD_REMESH "Enable Remesh Modifier" ON)
option(WITH_MOD_OCEANSIM "Enable Ocean Modifier" ON)
# Image format support
@@ -1995,7 +1996,7 @@ if(FIRST_RUN)
info_cfg_text("Modifiers:")
info_cfg_option(WITH_MOD_FLUID)
info_cfg_option(WITH_MOD_OCEANSIM)
info_cfg_option(WITH_MOD_REMESH)
info_cfg_option(WITH_REMESH_DUALCON)
info_cfg_text("OpenGL:")
if(WIN32)

View File

@@ -37,7 +37,7 @@ set(WITH_LZMA ON CACHE BOOL "" FORCE)
set(WITH_LZO ON CACHE BOOL "" FORCE)
set(WITH_MOD_FLUID ON CACHE BOOL "" FORCE)
set(WITH_MOD_OCEANSIM ON CACHE BOOL "" FORCE)
set(WITH_MOD_REMESH ON CACHE BOOL "" FORCE)
set(WITH_REMESH_DUALCON ON CACHE BOOL "" FORCE)
set(WITH_NANOVDB ON CACHE BOOL "" FORCE)
set(WITH_OPENAL ON CACHE BOOL "" FORCE)
set(WITH_OPENCOLLADA ON CACHE BOOL "" FORCE)

View File

@@ -43,7 +43,7 @@ set(WITH_LZMA OFF CACHE BOOL "" FORCE)
set(WITH_LZO OFF CACHE BOOL "" FORCE)
set(WITH_MOD_FLUID OFF CACHE BOOL "" FORCE)
set(WITH_MOD_OCEANSIM OFF CACHE BOOL "" FORCE)
set(WITH_MOD_REMESH OFF CACHE BOOL "" FORCE)
set(WITH_REMESH_DUALCON OFF CACHE BOOL "" FORCE)
set(WITH_NANOVDB OFF CACHE BOOL "" FORCE)
set(WITH_OPENAL OFF CACHE BOOL "" FORCE)
set(WITH_OPENCOLLADA OFF CACHE BOOL "" FORCE)

View File

@@ -38,7 +38,7 @@ set(WITH_LZMA ON CACHE BOOL "" FORCE)
set(WITH_LZO ON CACHE BOOL "" FORCE)
set(WITH_MOD_FLUID ON CACHE BOOL "" FORCE)
set(WITH_MOD_OCEANSIM ON CACHE BOOL "" FORCE)
set(WITH_MOD_REMESH ON CACHE BOOL "" FORCE)
set(WITH_REMESH_DUALCON ON CACHE BOOL "" FORCE)
set(WITH_NANOVDB ON CACHE BOOL "" FORCE)
set(WITH_OPENAL ON CACHE BOOL "" FORCE)
set(WITH_OPENCOLLADA ON CACHE BOOL "" FORCE)

View File

@@ -37,7 +37,7 @@ if(WITH_AUDASPACE)
add_subdirectory(audaspace)
endif()
if(WITH_MOD_REMESH)
if(WITH_REMESH_DUALCON)
add_subdirectory(dualcon)
endif()

View File

@@ -532,6 +532,7 @@ geometry_node_categories = [
NodeItem("GeometryNodeJoinGeometry"),
NodeItem("GeometryNodeSeparateComponents"),
NodeItem("GeometryNodeRaycast"),
NodeItem("GeometryNodeMergeByDistance"),
]),
GeometryNodeCategory("GEO_INPUT", "Input", items=[
NodeItem("GeometryNodeObjectInfo"),
@@ -554,6 +555,14 @@ geometry_node_categories = [
NodeItem("GeometryNodeEdgeSplit"),
NodeItem("GeometryNodeSubdivisionSurface"),
NodeItem("GeometryNodeMeshSubdivide"),
NodeItem("GeometryNodeSolidify"),
NodeItem("GeometryNodeRemeshVoxel"),
NodeItem("GeometryNodeRemeshBlocks"),
NodeItem("GeometryNodeMeshExtrude"),
NodeItem("GeometryNodeMeshInset"),
NodeItem("GeometryNodeCollapse"),
NodeItem("GeometryNodeUnsubdivide"),
NodeItem("GeometryNodeDissolve"),
]),
GeometryNodeCategory("GEO_PRIMITIVES_MESH", "Mesh Primitives", items=[
NodeItem("GeometryNodeMeshCircle"),

View File

@@ -118,6 +118,7 @@ add_subdirectory(blenloader)
add_subdirectory(depsgraph)
add_subdirectory(ikplugin)
add_subdirectory(simulation)
add_subdirectory(geometry)
add_subdirectory(gpu)
add_subdirectory(imbuf)
add_subdirectory(nodes)

View File

@@ -1472,7 +1472,15 @@ int ntreeTexExecTree(struct bNodeTree *ntree,
#define GEO_NODE_CURVE_SET_HANDLES 1072
#define GEO_NODE_CURVE_SPLINE_TYPE 1073
#define GEO_NODE_CURVE_SELECT_HANDLES 1074
#define GEO_NODE_SOLIDIFY 1075
#define GEO_NODE_REMESH_VOXEL 1076
#define GEO_NODE_REMESH_BLOCKS 1077
#define GEO_NODE_MERGE_BY_DISTANCE 1078
#define GEO_NODE_MESH_EXTRUDE 1079
#define GEO_NODE_MESH_INSET 1080
#define GEO_NODE_COLLAPSE 1081
#define GEO_NODE_UNSUBDIVIDE 1082
#define GEO_NODE_DISSOLVE 1083
/** \} */
/* -------------------------------------------------------------------- */

View File

@@ -5135,6 +5135,7 @@ static void registerGeometryNodes()
register_node_type_geo_attribute_vector_rotate();
register_node_type_geo_boolean();
register_node_type_geo_bounding_box();
register_node_type_geo_collapse();
register_node_type_geo_collection_info();
register_node_type_geo_convex_hull();
register_node_type_geo_curve_endpoints();
@@ -5155,12 +5156,15 @@ static void registerGeometryNodes()
register_node_type_geo_curve_to_points();
register_node_type_geo_curve_trim();
register_node_type_geo_delete_geometry();
register_node_type_geo_dissolve();
register_node_type_geo_edge_split();
register_node_type_geo_input_material();
register_node_type_geo_is_viewport();
register_node_type_geo_join_geometry();
register_node_type_geo_material_assign();
register_node_type_geo_material_replace();
register_node_type_geo_mesh_extrude();
register_node_type_geo_mesh_inset();
register_node_type_geo_mesh_primitive_circle();
register_node_type_geo_mesh_primitive_cone();
register_node_type_geo_mesh_primitive_cube();
@@ -5180,14 +5184,19 @@ static void registerGeometryNodes()
register_node_type_geo_point_translate();
register_node_type_geo_points_to_volume();
register_node_type_geo_raycast();
register_node_type_geo_merge_by_distance();
register_node_type_geo_sample_texture();
register_node_type_geo_select_by_handle_type();
register_node_type_geo_select_by_material();
register_node_type_geo_separate_components();
register_node_type_geo_solidify();
register_node_type_geo_subdivision_surface();
register_node_type_geo_switch();
register_node_type_geo_remesh_voxel();
register_node_type_geo_remesh_blocks();
register_node_type_geo_transform();
register_node_type_geo_triangulate();
register_node_type_geo_unsubdivide();
register_node_type_geo_viewer();
register_node_type_geo_volume_to_mesh();
}

View File

@@ -1446,4 +1446,242 @@ void BM_mesh_vert_coords_apply_with_mat4(BMesh *bm,
}
}
/** \} */
/**
* Use to select bmesh vertex data based on an array of bool.
*/
void BM_select_vertices(BMesh *bm, const bool *mask)
{
BMIter iter;
BMVert *v;
int i;
BM_ITER_MESH_INDEX (v, &iter, bm, BM_VERTS_OF_MESH, i) {
BM_elem_flag_set(v, BM_ELEM_SELECT, mask[i]);
}
}
/**
* Use to select bmesh edge data based on an array of bool.
*/
void BM_select_edges(BMesh *bm, const bool *mask)
{
BMIter iter;
BMEdge *e;
int i;
BM_ITER_MESH_INDEX (e, &iter, bm, BM_EDGES_OF_MESH, i) {
BM_elem_flag_set(e, BM_ELEM_SELECT, mask[i]);
}
}
/**
* Use to select bmesh face data based on an array of bool.
*/
void BM_select_faces(BMesh *bm, const bool *mask)
{
BMIter iter;
BMFace *f;
int i = 0;
BM_ITER_MESH_INDEX (f, &iter, bm, BM_FACES_OF_MESH, i) {
BM_elem_flag_set(f, BM_ELEM_SELECT, mask[i]);
}
}
/**
* Use to temporary tag bmesh edge data based on an array of bool.
*/
void BM_tag_vertices(BMesh *bm, const bool *mask)
{
BMIter iter;
BMVert *v;
int i;
BM_ITER_MESH_INDEX (v, &iter, bm, BM_VERTS_OF_MESH, i) {
BM_elem_flag_set(v, BM_ELEM_TAG, mask[i]);
}
}
/**
* Use to temporary tag bmesh edge data based on an array of bool.
*/
void BM_tag_edges(BMesh *bm, const bool *mask)
{
BMIter iter;
BMEdge *e;
int i;
BM_ITER_MESH_INDEX (e, &iter, bm, BM_EDGES_OF_MESH, i) {
BM_elem_flag_set(e, BM_ELEM_TAG, mask[i]);
}
}
/**
* Use to temporary tag bmesh face data based on an array of bool.
*/
void BM_tag_faces(BMesh *bm, const bool *mask)
{
BMIter iter;
BMFace *f;
int i;
BM_ITER_MESH_INDEX (f, &iter, bm, BM_FACES_OF_MESH, i) {
BM_elem_flag_set(f, BM_ELEM_TAG, mask[i]);
}
}
/**
* Write selected bmesh vertex to array of bool with length of totvert.
*/
void BM_get_selected_vertices(BMesh *bm, bool *selection)
{
BMIter iter;
BMVert *v;
int i;
BM_ITER_MESH_INDEX (v, &iter, bm, BM_VERTS_OF_MESH, i) {
selection[i] = BM_elem_flag_test(v, BM_ELEM_SELECT);
}
}
/**
* Write selected bmesh edge to array of bool with length of totedge.
*/
void BM_get_selected_edges(BMesh *bm, bool *selection)
{
BMIter iter;
BMEdge *e;
int i;
BM_ITER_MESH_INDEX (e, &iter, bm, BM_EDGES_OF_MESH, i) {
selection[i] = BM_elem_flag_test(e, BM_ELEM_SELECT);
}
}
/**
* Write selected bmesh face to array of bool with length of totpoly.
*/
void BM_get_selected_faces(BMesh *bm, bool *selection)
{
BMIter iter;
BMFace *f;
int i;
BM_ITER_MESH_INDEX (f, &iter, bm, BM_FACES_OF_MESH, i) {
selection[i] = BM_elem_flag_test(f, BM_ELEM_SELECT);
}
}
/**
* Write tagged bmesh vertex to array of bool with length of totvert.
*/
void BM_get_tagged_vertices(BMesh *bm, bool *selection)
{
BMIter iter;
BMVert *v;
int i;
BM_ITER_MESH_INDEX (v, &iter, bm, BM_VERTS_OF_MESH, i) {
selection[i] = BM_elem_flag_test(v, BM_ELEM_TAG);
}
}
/**
* Write tagged bmesh edge to array of bool with length of totedge.
*/
void BM_get_tagged_edges(BMesh *bm, bool *selection)
{
BMIter iter;
BMEdge *e;
int i;
BM_ITER_MESH_INDEX (e, &iter, bm, BM_EDGES_OF_MESH, i) {
selection[i] = BM_elem_flag_test(e, BM_ELEM_TAG);
}
}
/**
* Write tagged bmesh faces to array of bool with length of totpoly.
*/
void BM_get_tagged_faces(BMesh *bm, bool *selection)
{
BMIter iter;
BMFace *f;
int i;
BM_ITER_MESH_INDEX (f, &iter, bm, BM_FACES_OF_MESH, i) {
selection[i] = BM_elem_flag_test(f, BM_ELEM_TAG);
}
}
/**
* Use to remove tag from all bmesh verts that are tagged with another tag.
*/
void BM_untag_vertices_by_tag(BMesh *bm, int tag)
{
BMIter iter;
BMVert *v;
int i;
BM_ITER_MESH_INDEX (v, &iter, bm, BM_VERTS_OF_MESH, i) {
if (BM_elem_flag_test(v, tag)) {
BM_elem_flag_disable(v, BM_ELEM_TAG);
}
}
}
/**
* Use to remove tag from all bmesh edges that are tagged with another tag.
*/
void BM_untag_edges_by_tag(BMesh *bm, int tag)
{
BMIter iter;
BMEdge *e;
int i;
BM_ITER_MESH_INDEX (e, &iter, bm, BM_EDGES_OF_MESH, i) {
if (BM_elem_flag_test(e, tag)) {
BM_elem_flag_disable(e, BM_ELEM_TAG);
}
}
}
/**
* Use to remove tag from all bmesh faces that are tagged with another tag.
*/
void BM_untag_faces_by_tag(BMesh *bm, int tag)
{
BMIter iter;
BMFace *f;
int i;
BM_ITER_MESH_INDEX (f, &iter, bm, BM_FACES_OF_MESH, i) {
if (BM_elem_flag_test(f, tag)) {
BM_elem_flag_disable(f, BM_ELEM_TAG);
}
}
}
void BM_tag_vertices_from_operator_slot(BMesh *bm,
BMOperator *b_mesh_operator,
const char *slot,
const int tag)
{
BMOIter iter;
BMVert *v;
BM_mesh_elem_hflag_disable_all(bm, BM_VERT, BM_ELEM_TAG, false);
BMO_ITER (v, &iter, b_mesh_operator->slots_out, slot, tag) {
BM_elem_flag_enable(v, BM_ELEM_TAG);
}
}
void BM_tag_edges_from_operator_slot(BMesh *bm,
BMOperator *b_mesh_operator,
const char *slot,
const int tag)
{
BMOIter iter;
BMEdge *e;
BM_mesh_elem_hflag_disable_all(bm, BM_EDGE, BM_ELEM_TAG, false);
BMO_ITER (e, &iter, b_mesh_operator->slots_out, slot, tag) {
BM_elem_flag_enable(e, BM_ELEM_TAG);
}
}
void BM_tag_faces_from_operator_slot(BMesh *bm,
BMOperator *b_mesh_operator,
const char *slot,
const int tag)
{
BMOIter iter;
BMFace *f;
BM_mesh_elem_hflag_disable_all(bm, BM_FACE, BM_ELEM_TAG, false);
BMO_ITER (f, &iter, b_mesh_operator->slots_out, slot, tag) {
BM_elem_flag_enable(f, BM_ELEM_TAG);
}
}

View File

@@ -134,3 +134,36 @@ void BM_mesh_vert_coords_apply(BMesh *bm, const float (*vert_coords)[3]);
void BM_mesh_vert_coords_apply_with_mat4(BMesh *bm,
const float (*vert_coords)[3],
const float mat[4][4]);
void BM_select_vertices(BMesh *bm, const bool *mask);
void BM_select_edges(BMesh *bm, const bool *mask);
void BM_select_faces(BMesh *bm, const bool *mask);
void BM_tag_vertices(BMesh *bm, const bool *mask);
void BM_tag_edges(BMesh *bm, const bool *mask);
void BM_tag_faces(BMesh *bm, const bool *mask);
void BM_get_selected_vertices(BMesh *bm, bool *selection);
void BM_get_selected_edges(BMesh *bm, bool *selection);
void BM_get_selected_faces(BMesh *bm, bool *selection);
void BM_get_tagged_vertices(BMesh *bm, bool *selection);
void BM_get_tagged_edges(BMesh *bm, bool *selection);
void BM_get_tagged_faces(BMesh *bm, bool *selection);
void BM_untag_vertices_by_tag(BMesh *bm, int tag);
void BM_untag_edges_by_tag(BMesh *bm, int tag);
void BM_untag_faces_by_tag(BMesh *bm, int tag);
void BM_tag_vertices_from_operator_slot(BMesh *bm,
BMOperator *b_mesh_operator,
const char *slot,
const int tag);
void BM_tag_edges_from_operator_slot(BMesh *bm,
BMOperator *b_mesh_operator,
const char *slot,
const int tag);
void BM_tag_faces_from_operator_slot(BMesh *bm,
BMOperator *b_mesh_operator,
const char *slot,
const int tag);

View File

@@ -1898,6 +1898,9 @@ static BMOpDefine bmo_inset_individual_def = {
{{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */
{"thickness", BMO_OP_SLOT_FLT}, /* thickness */
{"depth", BMO_OP_SLOT_FLT}, /* depth */
{"thickness_array", BMO_OP_SLOT_PTR}, /* thickness */
{"depth_array", BMO_OP_SLOT_PTR}, /* depth */
{"use_attributes", BMO_OP_SLOT_BOOL}, /* Use spans for thickness and depth */
{"use_even_offset", BMO_OP_SLOT_BOOL}, /* scale the offset to give more even thickness */
{"use_interpolate", BMO_OP_SLOT_BOOL}, /* blend face data across the inset */
{"use_relative_offset", BMO_OP_SLOT_BOOL}, /* scale the offset by surrounding geometry */
@@ -1929,6 +1932,9 @@ static BMOpDefine bmo_inset_region_def = {
{"use_edge_rail", BMO_OP_SLOT_BOOL}, /* inset the region along existing edges */
{"thickness", BMO_OP_SLOT_FLT}, /* thickness */
{"depth", BMO_OP_SLOT_FLT}, /* depth */
{"thickness_array", BMO_OP_SLOT_PTR}, /* thickness */
{"depth_array", BMO_OP_SLOT_PTR}, /* depth */
{"use_attributes", BMO_OP_SLOT_BOOL}, /* Use spans for thickness and depth */
{"use_outset", BMO_OP_SLOT_BOOL}, /* outset rather than inset */
{{'\0'}},
},

View File

@@ -428,6 +428,9 @@ typedef enum {
BMO_DELIM_SEAM = 1 << 2,
BMO_DELIM_SHARP = 1 << 3,
BMO_DELIM_UV = 1 << 4,
BMO_DELIM_EDGE_SELECTION_INVSE = 1 << 5,
BMO_DELIM_EDGE_SELECTION = 1 << 6,
BMO_DELIM_FACE_SELECTION = 1 << 7,
} BMO_Delimit;
void BMO_op_flag_enable(BMesh *bm, BMOperator *op, const int op_flag);

View File

@@ -419,6 +419,9 @@ void bmo_inset_individual_exec(BMesh *bm, BMOperator *op)
BMOIter oiter;
MemArena *interp_arena = NULL;
const bool use_attributes = BMO_slot_bool_get(op->slots_in, "use_attributes");
const float *thickness_array = BMO_slot_ptr_get(op->slots_in, "thickness_array");
const float *depth_array = BMO_slot_ptr_get(op->slots_in, "depth_array");
const float thickness = BMO_slot_float_get(op->slots_in, "thickness");
const float depth = BMO_slot_float_get(op->slots_in, "depth");
const bool use_even_offset = BMO_slot_bool_get(op->slots_in, "use_even_offset");
@@ -433,19 +436,37 @@ void bmo_inset_individual_exec(BMesh *bm, BMOperator *op)
if (use_interpolate) {
interp_arena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, __func__);
}
int i = 0;
if (use_attributes) {
BMO_ITER_INDEX (f, &oiter, op->slots_in, "faces", BM_FACE, i) {
bmo_face_inset_individual(bm,
f,
interp_arena,
thickness_array[i],
depth_array[i],
use_even_offset,
use_relative_offset,
use_interpolate);
BMO_ITER (f, &oiter, op->slots_in, "faces", BM_FACE) {
bmo_face_inset_individual(bm,
f,
interp_arena,
thickness,
depth,
use_even_offset,
use_relative_offset,
use_interpolate);
if (use_interpolate) {
BLI_memarena_clear(interp_arena);
}
}
}
else {
BMO_ITER (f, &oiter, op->slots_in, "faces", BM_FACE) {
bmo_face_inset_individual(bm,
f,
interp_arena,
thickness,
depth,
use_even_offset,
use_relative_offset,
use_interpolate);
if (use_interpolate) {
BLI_memarena_clear(interp_arena);
if (use_interpolate) {
BLI_memarena_clear(interp_arena);
}
}
}
@@ -683,6 +704,9 @@ void bmo_inset_region_exec(BMesh *bm, BMOperator *op)
const bool use_edge_rail = BMO_slot_bool_get(op->slots_in, "use_edge_rail");
const bool use_interpolate = BMO_slot_bool_get(op->slots_in, "use_interpolate");
const float thickness = BMO_slot_float_get(op->slots_in, "thickness");
const bool use_attributes = BMO_slot_bool_get(op->slots_in, "use_attributes");
const float *thickness_array = BMO_slot_ptr_get(op->slots_in, "thickness_array");
const float *depth_array = BMO_slot_ptr_get(op->slots_in, "depth_array");
const float depth = BMO_slot_float_get(op->slots_in, "depth");
#ifdef USE_LOOP_CUSTOMDATA_MERGE
const bool has_math_ldata = (use_interpolate && CustomData_has_math(&bm->ldata));
@@ -1096,7 +1120,12 @@ void bmo_inset_region_exec(BMesh *bm, BMOperator *op)
}
/* apply the offset */
madd_v3_v3fl(v_split->co, tvec, thickness);
if (use_attributes) {
madd_v3_v3fl(v_split->co, tvec, thickness_array[v_split->head.index]);
}
else {
madd_v3_v3fl(v_split->co, tvec, thickness);
}
}
/* this saves expensive/slow glue check for common cases */

View File

@@ -104,6 +104,22 @@ static bool bm_edge_is_delimiter(const BMEdge *e,
BLI_assert(BM_edge_is_manifold(e));
if (delimit != 0) {
if (delimit & BMO_DELIM_EDGE_SELECTION_INVSE) {
if (!BM_elem_flag_test(e, BM_ELEM_SELECT)) {
return true;
}
}
if (delimit & BMO_DELIM_EDGE_SELECTION) {
if (BM_elem_flag_test(e, BM_ELEM_SELECT)) {
return true;
}
}
if (delimit & BMO_DELIM_FACE_SELECTION) {
if (BM_elem_flag_test(e->l->f, BM_ELEM_TAG) !=
BM_elem_flag_test(e->l->radial_next->f, BM_ELEM_TAG)) {
return true;
}
}
if (delimit & BMO_DELIM_SEAM) {
if (BM_elem_flag_test(e, BM_ELEM_SEAM)) {
return true;

View File

@@ -0,0 +1,61 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2006, Blender Foundation
# All rights reserved.
# ***** END GPL LICENSE BLOCK *****
set(INC
.
../blenfont
../blenkernel
../blenlib
../blentranslation
../functions
../makesdna
../makesrna
../../../intern/guardedalloc
../makesdna/intern
${CMAKE_BINARY_DIR}/source/blender/makesdna/intern
)
set(SRC
intern/solidify_nonmanifold.c
GEO_solidifiy.h
intern/remesh_blocks.c
GEO_mesh_remesh_blocks.h
intern/mesh_merge_by_distance.c
intern/pointcloud_merge_by_distance.cc
GEO_mesh_merge_by_distance.h
GEO_pointcloud_merge_by_distance.h
)
set(LIB
bf_blenkernel
bf_blenlib
)
if(WITH_REMESH_DUALCON)
list(APPEND INC
../../../intern/dualcon
)
list(APPEND LIB
bf_intern_dualcon
)
add_definitions(-DWITH_REMESH_DUALCON)
endif()
blender_add_lib(bf_geometry "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")

View File

@@ -0,0 +1,39 @@
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#pragma once
/** \file
* \ingroup geo
*/
#ifdef __cplusplus
extern "C" {
#endif
enum {
WELD_MODE_ALL = 0,
WELD_MODE_CONNECTED = 1,
};
struct Mesh *GEO_mesh_merge_by_distance(const struct Mesh *mesh,
const bool *mask,
const float merge_distance,
const int weld_mode);
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,48 @@
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#pragma once
/** \file
* \ingroup geo
*/
#ifdef __cplusplus
extern "C" {
#endif
struct Mesh;
typedef enum eRemeshBlocksMode {
/* Blocks. */
REMESH_BLOCKS_CENTROID = 0,
/* Smooth. */
REMESH_BLOCKS_MASS_POINT = 1,
/* Smooth with sharp edges. */
REMESH_BLOCKS_SHARP_FEATURES = 2,
} eRemeshBlocksMode;
struct Mesh *GEO_mesh_remesh_blocks(const struct Mesh *mesh,
const char remesh_flag,
const char remesh_mode,
const float threshold,
const int hermite_num,
const float scale,
const int depth);
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,33 @@
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#pragma once
/** \file
* \ingroup geo
*/
#ifdef __cplusplus
extern "C" {
#endif
PointCloud *merge_by_distance_pointcloud(const PointCloud &point_cloud,
const float merge_threshold,
blender::Span<bool> selection);
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,43 @@
#include "DNA_object_types.h"
#ifdef __cplusplus
extern "C" {
#endif
struct Mesh;
typedef struct SolidifyData {
const Object *object;
/** New surface offset level. (Thickness) */
float offset;
/** Midpoint of the offset. */
float offset_fac;
/**
* Factor for the minimum weight to use when vertex-groups are used,
* avoids 0.0 weights giving duplicate geometry.
*/
float offset_fac_vg;
/** Clamp offset based on surrounding geometry. */
float offset_clamp;
/** Variables for #MOD_SOLIDIFY_MODE_NONMANIFOLD. */
char nonmanifold_offset_mode;
char nonmanifold_boundary_mode;
int flag;
float merge_tolerance;
float bevel_convex;
const float *distance;
} SolidifyData;
struct Mesh *solidify_nonmanifold(const SolidifyData *solidify_data,
struct Mesh *mesh,
bool **r_shell_verts,
bool **r_rim_verts,
bool **r_shell_faces,
bool **r_rim_faces);
#ifdef __cplusplus
}
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,120 @@
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "BKE_pointcloud.h"
#include "BLI_array.hh"
#include "BLI_float3.hh"
#include "BLI_kdtree.h"
#include "BLI_span.hh"
#include "BLI_vector.hh"
#include "DNA_pointcloud_types.h"
#include "GEO_pointcloud_merge_by_distance.h" /* Own include. */
#include "FN_generic_span.hh"
using blender::Array;
using blender::float3;
using blender::Span;
using blender::Vector;
static KDTree_3d *build_kdtree(Span<float3> positions, Span<bool> selection)
{
BLI_assert(positions.size() == selection.size());
KDTree_3d *kdtree = BLI_kdtree_3d_new(selection.size());
for (const int i : positions.index_range()) {
if (selection[i]) {
BLI_kdtree_3d_insert(kdtree, i, positions[i]);
}
}
BLI_kdtree_3d_balance(kdtree);
return kdtree;
}
static void build_merge_map(Span<float3> &positions,
Array<bool> &merge_map,
int &total_merge_operations,
const float merge_threshold,
Span<bool> selection)
{
KDTree_3d *kdtree = build_kdtree(positions, selection);
for (int i : positions.index_range()) {
struct CallbackData {
int index;
int &total_merge_operations;
Array<bool> &merge_map;
Span<bool> selection;
} callback_data = {i, total_merge_operations, merge_map, selection};
BLI_kdtree_3d_range_search_cb(
kdtree,
positions[i],
merge_threshold,
[](void *user_data,
int source_vertex_index,
const float *UNUSED(co),
float UNUSED(distance_squared)) {
CallbackData &callback_data = *static_cast<CallbackData *>(user_data);
int target_vertex_index = callback_data.index;
if (source_vertex_index != target_vertex_index &&
!callback_data.merge_map[source_vertex_index] &&
!callback_data.merge_map[target_vertex_index] &&
callback_data.selection[source_vertex_index] &&
callback_data.selection[target_vertex_index]) {
callback_data.merge_map[source_vertex_index] = true;
callback_data.total_merge_operations++;
}
return true;
},
&callback_data);
}
BLI_kdtree_3d_free(kdtree);
}
PointCloud *merge_by_distance_pointcloud(const PointCloud &point_cloud,
const float merge_threshold,
Span<bool> selection)
{
Array<bool> merge_map(point_cloud.totpoint, false);
Span<float3> positions((const float3 *)point_cloud.co, point_cloud.totpoint);
int total_merge_operations = 0;
BLI_assert(positions.size() == merge_map.size());
build_merge_map(positions, merge_map, total_merge_operations, merge_threshold, selection);
PointCloud *result = BKE_pointcloud_new_nomain(positions.size() - total_merge_operations);
int offset = 0;
for (const int i : positions.index_range()) {
/* Only copy the unmerged points to new pointcloud. */
if (!merge_map[i]) {
copy_v3_v3(result->co[offset], positions[i]);
result->radius[offset] = point_cloud.radius[i];
offset++;
}
}
return result;
}

View File

@@ -0,0 +1,171 @@
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/** \file
* \ingroup geo
*/
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_modifier_types.h"
#include "DNA_customdata_types.h"
#include "BKE_mesh.h"
#include "BKE_mesh_runtime.h"
#include "BLI_math_vector.h"
#include "BLI_threads.h"
#include "GEO_mesh_remesh_blocks.h" /* own include */
#include "MEM_guardedalloc.h"
#ifdef WITH_REMESH_DUALCON
# include "dualcon.h"
#endif
static void init_dualcon_mesh(DualConInput *input, const Mesh *mesh)
{
memset(input, 0, sizeof(DualConInput));
input->co = (void *)mesh->mvert;
input->co_stride = sizeof(MVert);
input->totco = mesh->totvert;
input->mloop = (void *)mesh->mloop;
input->loop_stride = sizeof(MLoop);
BKE_mesh_runtime_looptri_ensure(mesh);
input->looptri = (void *)mesh->runtime.looptris.array;
input->tri_stride = sizeof(MLoopTri);
input->tottri = mesh->runtime.looptris.len;
INIT_MINMAX(input->min, input->max);
BKE_mesh_minmax(mesh, input->min, input->max);
}
/* simple structure to hold the output: a CDDM and two counters to
* keep track of the current elements */
typedef struct {
Mesh *mesh;
int curvert, curface;
} DualConOutput;
/* allocate and initialize a DualConOutput */
static void *dualcon_alloc_output(int totvert, int totquad)
{
DualConOutput *output;
if (!(output = MEM_callocN(sizeof(DualConOutput), "DualConOutput"))) {
return NULL;
}
output->mesh = BKE_mesh_new_nomain(totvert, 0, 0, 4 * totquad, totquad);
return output;
}
static void dualcon_add_vert(void *output_v, const float co[3])
{
DualConOutput *output = output_v;
Mesh *mesh = output->mesh;
BLI_assert(output->curvert < mesh->totvert);
copy_v3_v3(mesh->mvert[output->curvert].co, co);
output->curvert++;
}
static void dualcon_add_quad(void *output_v, const int vert_indices[4])
{
DualConOutput *output = output_v;
Mesh *mesh = output->mesh;
MLoop *mloop;
MPoly *cur_poly;
int i;
BLI_assert(output->curface < mesh->totpoly);
mloop = mesh->mloop;
cur_poly = &mesh->mpoly[output->curface];
cur_poly->loopstart = output->curface * 4;
cur_poly->totloop = 4;
for (i = 0; i < 4; i++) {
mloop[output->curface * 4 + i].v = vert_indices[i];
}
output->curface++;
}
Mesh *GEO_mesh_remesh_blocks(const Mesh *mesh,
const char remesh_flag,
const char remesh_mode,
const float threshold,
const int hermite_num,
const float scale,
const int depth)
{
#ifdef WITH_REMESH_DUALCON
DualConOutput *output;
DualConInput input;
Mesh *result;
DualConFlags flags = 0;
DualConMode mode = 0;
/* Dualcon modes. */
init_dualcon_mesh(&input, mesh);
if (remesh_flag & MOD_REMESH_FLOOD_FILL) {
flags |= DUALCON_FLOOD_FILL;
}
switch (remesh_mode) {
case REMESH_BLOCKS_CENTROID:
mode = DUALCON_CENTROID;
break;
case REMESH_BLOCKS_MASS_POINT:
mode = DUALCON_MASS_POINT;
break;
case REMESH_BLOCKS_SHARP_FEATURES:
mode = DUALCON_SHARP_FEATURES;
break;
}
/* TODO(jbakker): Dualcon crashes when run in parallel. Could be related to incorrect
* input data or that the library isn't thread safe.
* This was identified when changing the task isolation's during T76553. */
static ThreadMutex dualcon_mutex = BLI_MUTEX_INITIALIZER;
BLI_mutex_lock(&dualcon_mutex);
output = dualcon(&input,
dualcon_alloc_output,
dualcon_add_vert,
dualcon_add_quad,
flags,
mode,
threshold,
hermite_num,
scale,
depth);
BLI_mutex_unlock(&dualcon_mutex);
result = output->mesh;
MEM_freeN(output);
return result;
#else
return BKE_mesh_new_nomain(0,0,0,0,0);
#endif
}

View File

@@ -18,24 +18,20 @@
* \ingroup modifiers
*/
#include "BLI_utildefines.h"
#include "BKE_customdata.h"
#include "BKE_mesh.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
#include "DNA_modifier_types.h"
#include "GEO_solidifiy.h"
#include "MEM_guardedalloc.h"
#include "BKE_deform.h"
#include "BKE_mesh.h"
#include "BKE_particle.h"
#include "MOD_modifiertypes.h"
#include "MOD_solidify_util.h" /* Own include. */
#include "MOD_util.h"
#ifdef __GNUC__
# pragma GCC diagnostic error "-Wsign-conversion"
#endif
@@ -143,12 +139,14 @@ static int comp_float_int_pair(const void *a, const void *b)
}
/* NOLINTNEXTLINE: readability-function-size */
Mesh *MOD_solidify_nonmanifold_modifyMesh(ModifierData *md,
const ModifierEvalContext *ctx,
Mesh *mesh)
Mesh *solidify_nonmanifold(const SolidifyData *solidify_data,
Mesh *mesh,
bool **r_shell_verts,
bool **r_rim_verts,
bool **r_shell_faces,
bool **r_rim_faces)
{
Mesh *result;
const SolidifyModifierData *smd = (SolidifyModifierData *)md;
MVert *mv, *mvert, *orig_mvert;
MEdge *ed, *medge, *orig_medge;
@@ -163,39 +161,26 @@ Mesh *MOD_solidify_nonmanifold_modifyMesh(ModifierData *md,
return mesh;
}
/* Only use material offsets if we have 2 or more materials. */
const short mat_nrs = ctx->object->totcol > 1 ? ctx->object->totcol : 1;
const short mat_nr_max = mat_nrs - 1;
const short mat_ofs = mat_nrs > 1 ? smd->mat_ofs : 0;
const short mat_ofs_rim = mat_nrs > 1 ? smd->mat_ofs_rim : 0;
float(*poly_nors)[3] = NULL;
const float ofs_front = (smd->offset_fac + 1.0f) * 0.5f * smd->offset;
const float ofs_back = ofs_front - smd->offset * smd->offset_fac;
const float ofs_front_clamped = clamp_nonzero(smd->offset > 0 ? ofs_front : ofs_back, 1e-5f);
const float ofs_back_clamped = clamp_nonzero(smd->offset > 0 ? ofs_back : ofs_front, 1e-5f);
const float offset_fac_vg = smd->offset_fac_vg;
const float offset_fac_vg_inv = 1.0f - smd->offset_fac_vg;
const float offset = fabsf(smd->offset) * smd->offset_clamp;
const bool do_angle_clamp = smd->flag & MOD_SOLIDIFY_OFFSET_ANGLE_CLAMP;
const bool do_flip = (smd->flag & MOD_SOLIDIFY_FLIP) != 0;
const bool do_rim = smd->flag & MOD_SOLIDIFY_RIM;
const bool do_shell = ((smd->flag & MOD_SOLIDIFY_RIM) && (smd->flag & MOD_SOLIDIFY_NOSHELL)) ==
0;
const bool do_clamp = (smd->offset_clamp != 0.0f);
const float ofs_front = (solidify_data->offset_fac + 1.0f) * 0.5f * solidify_data->offset;
const float ofs_back = ofs_front - solidify_data->offset * solidify_data->offset_fac;
const float ofs_front_clamped = max_ff(1e-5f,
fabsf(solidify_data->offset > 0 ? ofs_front : ofs_back));
const float ofs_back_clamped = max_ff(1e-5f,
fabsf(solidify_data->offset > 0 ? ofs_back : ofs_front));
const float offset_fac_vg = solidify_data->offset_fac_vg;
const float offset_fac_vg_inv = 1.0f - solidify_data->offset_fac_vg;
const float offset = fabsf(solidify_data->offset) * solidify_data->offset_clamp;
const bool do_angle_clamp = solidify_data->flag & MOD_SOLIDIFY_OFFSET_ANGLE_CLAMP;
const bool do_flip = (solidify_data->flag & MOD_SOLIDIFY_FLIP) != 0;
const bool do_rim = solidify_data->flag & MOD_SOLIDIFY_RIM;
const bool do_shell = solidify_data->flag & MOD_SOLIDIFY_SHELL;
const bool do_clamp = (solidify_data->offset_clamp != 0.0f);
const float bevel_convex = smd->bevel_convex;
const float bevel_convex = solidify_data->bevel_convex;
MDeformVert *dvert;
const bool defgrp_invert = (smd->flag & MOD_SOLIDIFY_VGROUP_INV) != 0;
int defgrp_index;
const int shell_defgrp_index = BKE_id_defgroup_name_index(&mesh->id, smd->shell_defgrp_name);
const int rim_defgrp_index = BKE_id_defgroup_name_index(&mesh->id, smd->rim_defgrp_name);
MOD_get_vgroup(ctx->object, mesh, smd->defgrp_name, &dvert, &defgrp_index);
const bool do_flat_faces = dvert && (smd->flag & MOD_SOLIDIFY_NONMANIFOLD_FLAT_FACES);
const bool do_flat_faces = solidify_data->flag & MOD_SOLIDIFY_NONMANIFOLD_FLAT_FACES;
orig_mvert = mesh->mvert;
orig_medge = mesh->medge;
@@ -216,10 +201,11 @@ Mesh *MOD_solidify_nonmanifold_modifyMesh(ModifierData *md,
NewFaceRef *face_sides_arr = MEM_malloc_arrayN(
numPolys * 2, sizeof(*face_sides_arr), "face_sides_arr in solidify");
bool *null_faces =
(smd->nonmanifold_offset_mode == MOD_SOLIDIFY_NONMANIFOLD_OFFSET_MODE_CONSTRAINTS) ?
MEM_calloc_arrayN(numPolys, sizeof(*null_faces), "null_faces in solidify") :
NULL;
bool *null_faces = (solidify_data->nonmanifold_offset_mode ==
MOD_SOLIDIFY_NONMANIFOLD_OFFSET_MODE_CONSTRAINTS) ?
MEM_calloc_arrayN(
numPolys, sizeof(*null_faces), "null_faces in solidify") :
NULL;
uint largest_ngon = 3;
/* Calculate face to #NewFaceRef map. */
{
@@ -359,7 +345,8 @@ Mesh *MOD_solidify_nonmanifold_modifyMesh(ModifierData *md,
bool *face_singularity = MEM_calloc_arrayN(
numPolys, sizeof(*face_singularity), "face_sides_arr in solidify");
const float merge_tolerance_sqr = smd->merge_tolerance * smd->merge_tolerance;
const float merge_tolerance_sqr = solidify_data->merge_tolerance *
solidify_data->merge_tolerance;
uint *combined_verts = MEM_calloc_arrayN(
numVerts, sizeof(*combined_verts), "combined_verts in solidify");
@@ -1393,14 +1380,7 @@ Mesh *MOD_solidify_nonmanifold_modifyMesh(ModifierData *md,
int loopend = mp->loopstart + mp->totloop;
ml = orig_mloop + mp->loopstart;
for (int j = mp->loopstart; j < loopend; j++, ml++) {
MDeformVert *dv = &dvert[ml->v];
if (defgrp_invert) {
scalar_vgroup = min_ff(1.0f - BKE_defvert_find_weight(dv, defgrp_index),
scalar_vgroup);
}
else {
scalar_vgroup = min_ff(BKE_defvert_find_weight(dv, defgrp_index), scalar_vgroup);
}
scalar_vgroup = min_ff(solidify_data->distance[i], scalar_vgroup);
}
scalar_vgroup = offset_fac_vg + (scalar_vgroup * offset_fac_vg_inv);
face_weight[i] = scalar_vgroup;
@@ -1416,11 +1396,12 @@ Mesh *MOD_solidify_nonmanifold_modifyMesh(ModifierData *md,
if (!g->is_singularity) {
float *nor = g->no;
float move_nor[3] = {0, 0, 0};
bool disable_boundary_fix = (smd->nonmanifold_boundary_mode ==
bool disable_boundary_fix = (solidify_data->nonmanifold_boundary_mode ==
MOD_SOLIDIFY_NONMANIFOLD_BOUNDARY_MODE_NONE ||
(g->is_orig_closed || g->split));
/* Constraints Method. */
if (smd->nonmanifold_offset_mode == MOD_SOLIDIFY_NONMANIFOLD_OFFSET_MODE_CONSTRAINTS) {
if (solidify_data->nonmanifold_offset_mode ==
MOD_SOLIDIFY_NONMANIFOLD_OFFSET_MODE_CONSTRAINTS) {
NewEdgeRef *first_edge = NULL;
NewEdgeRef **edge_ptr = g->edges;
/* Contains normal and offset [nx, ny, nz, ofs]. */
@@ -1466,7 +1447,7 @@ Mesh *MOD_solidify_nonmanifold_modifyMesh(ModifierData *md,
}
}
uint face_nors_len = 0;
const float stop_explosion = 0.999f - fabsf(smd->offset_fac) * 0.05f;
const float stop_explosion = 0.999f - fabsf(solidify_data->offset_fac) * 0.05f;
while (queue_index > 0) {
if (face_nors_len == 0) {
if (queue_index <= 2) {
@@ -1616,7 +1597,7 @@ Mesh *MOD_solidify_nonmanifold_modifyMesh(ModifierData *md,
ofs *= face_weight[face->index];
}
if (smd->nonmanifold_offset_mode ==
if (solidify_data->nonmanifold_offset_mode ==
MOD_SOLIDIFY_NONMANIFOLD_OFFSET_MODE_EVEN) {
MLoop *ml_next = orig_mloop + face->face->loopstart;
ml = ml_next + (face->face->totloop - 1);
@@ -1662,7 +1643,8 @@ Mesh *MOD_solidify_nonmanifold_modifyMesh(ModifierData *md,
}
/* Set normal length with selected method. */
if (smd->nonmanifold_offset_mode == MOD_SOLIDIFY_NONMANIFOLD_OFFSET_MODE_EVEN) {
if (solidify_data->nonmanifold_offset_mode ==
MOD_SOLIDIFY_NONMANIFOLD_OFFSET_MODE_EVEN) {
if (has_front) {
float length_sq = len_squared_v3(nor);
if (LIKELY(length_sq > FLT_EPSILON)) {
@@ -1751,7 +1733,8 @@ Mesh *MOD_solidify_nonmanifold_modifyMesh(ModifierData *md,
sub_v3_v3v3(e1,
orig_mvert_co[vm[e1_edge->v1] == i ? e1_edge->v2 : e1_edge->v1],
orig_mvert_co[i]);
if (smd->nonmanifold_boundary_mode == MOD_SOLIDIFY_NONMANIFOLD_BOUNDARY_MODE_FLAT) {
if (solidify_data->nonmanifold_boundary_mode ==
MOD_SOLIDIFY_NONMANIFOLD_BOUNDARY_MODE_FLAT) {
cross_v3_v3v3(constr_nor, e0, e1);
}
else {
@@ -1785,14 +1768,8 @@ Mesh *MOD_solidify_nonmanifold_modifyMesh(ModifierData *md,
}
float scalar_vgroup = 1;
/* Use vertex group. */
if (dvert && !do_flat_faces) {
MDeformVert *dv = &dvert[i];
if (defgrp_invert) {
scalar_vgroup = 1.0f - BKE_defvert_find_weight(dv, defgrp_index);
}
else {
scalar_vgroup = BKE_defvert_find_weight(dv, defgrp_index);
}
if (!do_flat_faces) {
scalar_vgroup = solidify_data->distance[i];
scalar_vgroup = offset_fac_vg + (scalar_vgroup * offset_fac_vg_inv);
}
/* Do clamping. */
@@ -1925,16 +1902,32 @@ Mesh *MOD_solidify_nonmanifold_modifyMesh(ModifierData *md,
result->cd_flag |= ME_CDFLAG_EDGE_BWEIGHT;
}
/* Checks that result has dvert data. */
if (shell_defgrp_index != -1 || rim_defgrp_index != -1) {
dvert = CustomData_duplicate_referenced_layer(&result->vdata, CD_MDEFORMVERT, result->totvert);
/* If no vertices were ever added to an object's vgroup, dvert might be NULL. */
if (dvert == NULL) {
/* Add a valid data layer! */
dvert = CustomData_add_layer(
&result->vdata, CD_MDEFORMVERT, CD_CALLOC, NULL, result->totvert);
}
result->dvert = dvert;
*r_shell_verts = MEM_malloc_arrayN(
(size_t)result->totvert, sizeof(bool), "shell verts selection in solidify");
for (int i = 0; i < result->totvert; i++) {
(*r_shell_verts)[i] = false;
}
*r_rim_verts = MEM_malloc_arrayN(
(size_t)result->totvert, sizeof(bool), "rim verts selection in solidify");
for (int i = 0; i < result->totvert; i++) {
(*r_rim_verts)[i] = false;
}
*r_shell_faces = MEM_malloc_arrayN(
(size_t)result->totpoly, sizeof(bool), "shell faces selection in solidify");
for (int i = 0; i < result->totpoly; i++) {
(*r_shell_faces)[i] = false;
}
*r_rim_faces = MEM_malloc_arrayN(
(size_t)result->totpoly, sizeof(bool), "rim faces selection in solidify");
for (int i = 0; i < result->totpoly; i++) {
(*r_rim_faces)[i] = false;
}
/* Make_new_verts. */
@@ -2163,50 +2156,17 @@ Mesh *MOD_solidify_nonmanifold_modifyMesh(ModifierData *md,
/* Loop data. */
int *loops = MEM_malloc_arrayN(j, sizeof(*loops), "loops in solidify");
/* The #mat_nr is from consensus. */
short most_mat_nr = 0;
uint most_mat_nr_face = 0;
uint most_mat_nr_count = 0;
for (short l = 0; l < mat_nrs; l++) {
uint count = 0;
uint face = 0;
uint k = 0;
for (EdgeGroup *g3 = g2; g3->valid && k < j; g3++) {
if ((do_rim && !g3->is_orig_closed) || (do_shell && g3->split)) {
/* Check both far ends in terms of faces of an edge group. */
if (g3->edges[0]->faces[0]->face->mat_nr == l) {
face = g3->edges[0]->faces[0]->index;
count++;
}
NewEdgeRef *le = g3->edges[g3->edges_len - 1];
if (le->faces[1] && le->faces[1]->face->mat_nr == l) {
face = le->faces[1]->index;
count++;
}
else if (!le->faces[1] && le->faces[0]->face->mat_nr == l) {
face = le->faces[0]->index;
count++;
}
k++;
}
}
if (count > most_mat_nr_count) {
most_mat_nr = l;
most_mat_nr_face = face;
most_mat_nr_count = count;
}
}
CustomData_copy_data(
&mesh->pdata, &result->pdata, (int)most_mat_nr_face, (int)poly_index, 1);
if (origindex_poly) {
origindex_poly[poly_index] = ORIGINDEX_NONE;
}
mpoly[poly_index].loopstart = (int)loop_index;
mpoly[poly_index].totloop = (int)j;
mpoly[poly_index].mat_nr = most_mat_nr +
(g->is_orig_closed || !do_rim ? 0 : mat_ofs_rim);
CLAMP(mpoly[poly_index].mat_nr, 0, mat_nr_max);
mpoly[poly_index].flag = orig_mpoly[most_mat_nr_face].flag;
if (g->is_orig_closed || !do_rim) {
(*r_rim_faces)[poly_index] = true;
}
poly_index++;
for (uint k = 0; g2->valid && k < j; g2++) {
@@ -2278,8 +2238,8 @@ Mesh *MOD_solidify_nonmanifold_modifyMesh(ModifierData *md,
&mesh->pdata, &result->pdata, (int)(*new_edges)->faces[0]->index, (int)poly_index, 1);
mpoly[poly_index].loopstart = (int)loop_index;
mpoly[poly_index].totloop = 4 - (int)(v1_singularity || v2_singularity);
mpoly[poly_index].mat_nr = face->mat_nr + mat_ofs_rim;
CLAMP(mpoly[poly_index].mat_nr, 0, mat_nr_max);
(*r_rim_faces)[poly_index] = true;
mpoly[poly_index].flag = face->flag;
poly_index++;
@@ -2300,20 +2260,17 @@ Mesh *MOD_solidify_nonmanifold_modifyMesh(ModifierData *md,
MEdge *open_face_edge;
uint open_face_edge_index;
if (!do_flip) {
if (rim_defgrp_index != -1) {
BKE_defvert_ensure_index(&result->dvert[medge[edge1->new_edge].v1], rim_defgrp_index)
->weight = 1.0f;
}
(*r_rim_verts)[medge[edge1->new_edge].v1] = true;
CustomData_copy_data(&mesh->ldata, &result->ldata, loop1, (int)loop_index, 1);
mloop[loop_index].v = medge[edge1->new_edge].v1;
mloop[loop_index++].e = edge1->new_edge;
if (!v2_singularity) {
open_face_edge_index = edge1->link_edge_groups[1]->open_face_edge;
if (rim_defgrp_index != -1) {
BKE_defvert_ensure_index(&result->dvert[medge[edge1->new_edge].v2], rim_defgrp_index)
->weight = 1.0f;
}
(*r_rim_verts)[medge[edge1->new_edge].v2] = true;
CustomData_copy_data(&mesh->ldata, &result->ldata, loop2, (int)loop_index, 1);
mloop[loop_index].v = medge[edge1->new_edge].v2;
open_face_edge = medge + open_face_edge_index;
@@ -2324,21 +2281,17 @@ Mesh *MOD_solidify_nonmanifold_modifyMesh(ModifierData *md,
mloop[loop_index++].e = edge2->link_edge_groups[1]->open_face_edge;
}
}
(*r_rim_verts)[medge[edge2->new_edge].v2] = true;
if (rim_defgrp_index != -1) {
BKE_defvert_ensure_index(&result->dvert[medge[edge2->new_edge].v2], rim_defgrp_index)
->weight = 1.0f;
}
CustomData_copy_data(&mesh->ldata, &result->ldata, loop2, (int)loop_index, 1);
mloop[loop_index].v = medge[edge2->new_edge].v2;
mloop[loop_index++].e = edge2->new_edge;
if (!v1_singularity) {
open_face_edge_index = edge2->link_edge_groups[0]->open_face_edge;
if (rim_defgrp_index != -1) {
BKE_defvert_ensure_index(&result->dvert[medge[edge2->new_edge].v1], rim_defgrp_index)
->weight = 1.0f;
}
(*r_rim_verts)[medge[edge2->new_edge].v1] = true;
CustomData_copy_data(&mesh->ldata, &result->ldata, loop1, (int)loop_index, 1);
mloop[loop_index].v = medge[edge2->new_edge].v1;
open_face_edge = medge + open_face_edge_index;
@@ -2353,10 +2306,9 @@ Mesh *MOD_solidify_nonmanifold_modifyMesh(ModifierData *md,
else {
if (!v1_singularity) {
open_face_edge_index = edge1->link_edge_groups[0]->open_face_edge;
if (rim_defgrp_index != -1) {
BKE_defvert_ensure_index(&result->dvert[medge[edge1->new_edge].v1], rim_defgrp_index)
->weight = 1.0f;
}
(*r_rim_verts)[medge[edge1->new_edge].v1] = true;
CustomData_copy_data(&mesh->ldata, &result->ldata, loop1, (int)loop_index, 1);
mloop[loop_index].v = medge[edge1->new_edge].v1;
open_face_edge = medge + open_face_edge_index;
@@ -2368,20 +2320,17 @@ Mesh *MOD_solidify_nonmanifold_modifyMesh(ModifierData *md,
}
}
if (rim_defgrp_index != -1) {
BKE_defvert_ensure_index(&result->dvert[medge[edge2->new_edge].v1], rim_defgrp_index)
->weight = 1.0f;
}
(*r_rim_verts)[medge[edge2->new_edge].v1] = true;
CustomData_copy_data(&mesh->ldata, &result->ldata, loop1, (int)loop_index, 1);
mloop[loop_index].v = medge[edge2->new_edge].v1;
mloop[loop_index++].e = edge2->new_edge;
if (!v2_singularity) {
open_face_edge_index = edge2->link_edge_groups[1]->open_face_edge;
if (rim_defgrp_index != -1) {
BKE_defvert_ensure_index(&result->dvert[medge[edge2->new_edge].v2], rim_defgrp_index)
->weight = 1.0f;
}
(*r_rim_verts)[medge[edge2->new_edge].v2] = true;
CustomData_copy_data(&mesh->ldata, &result->ldata, loop2, (int)loop_index, 1);
mloop[loop_index].v = medge[edge2->new_edge].v2;
open_face_edge = medge + open_face_edge_index;
@@ -2393,10 +2342,8 @@ Mesh *MOD_solidify_nonmanifold_modifyMesh(ModifierData *md,
}
}
if (rim_defgrp_index != -1) {
BKE_defvert_ensure_index(&result->dvert[medge[edge1->new_edge].v2], rim_defgrp_index)
->weight = 1.0f;
}
(*r_rim_verts)[medge[edge1->new_edge].v2] = true;
CustomData_copy_data(&mesh->ldata, &result->ldata, loop2, (int)loop_index, 1);
mloop[loop_index].v = medge[edge1->new_edge].v2;
mloop[loop_index++].e = edge1->new_edge;
@@ -2410,10 +2357,13 @@ Mesh *MOD_solidify_nonmanifold_modifyMesh(ModifierData *md,
NewFaceRef *fr = face_sides_arr;
uint *face_loops = MEM_malloc_arrayN(
largest_ngon * 2, sizeof(*face_loops), "face_loops in solidify");
uint *face_verts = MEM_malloc_arrayN(
largest_ngon * 2, sizeof(*face_verts), "face_verts in solidify");
uint *face_edges = MEM_malloc_arrayN(
largest_ngon * 2, sizeof(*face_edges), "face_edges in solidify");
for (uint i = 0; i < numPolys * 2; i++, fr++) {
const uint loopstart = (uint)fr->face->loopstart;
uint totloop = (uint)fr->face->totloop;
@@ -2469,15 +2419,15 @@ Mesh *MOD_solidify_nonmanifold_modifyMesh(ModifierData *md,
CustomData_copy_data(&mesh->pdata, &result->pdata, (int)(i / 2), (int)poly_index, 1);
mpoly[poly_index].loopstart = (int)loop_index;
mpoly[poly_index].totloop = (int)k;
mpoly[poly_index].mat_nr = fr->face->mat_nr + (fr->reversed != do_flip ? mat_ofs : 0);
CLAMP(mpoly[poly_index].mat_nr, 0, mat_nr_max);
if (fr->reversed != do_flip) {
(*r_shell_faces)[poly_index] = true;
}
mpoly[poly_index].flag = fr->face->flag;
if (fr->reversed != do_flip) {
for (int l = (int)k - 1; l >= 0; l--) {
if (shell_defgrp_index != -1) {
BKE_defvert_ensure_index(&result->dvert[face_verts[l]], shell_defgrp_index)
->weight = 1.0f;
}
(*r_shell_verts)[face_verts[l]] = true;
CustomData_copy_data(
&mesh->ldata, &result->ldata, (int)face_loops[l], (int)loop_index, 1);
mloop[loop_index].v = face_verts[l];
@@ -2502,27 +2452,28 @@ Mesh *MOD_solidify_nonmanifold_modifyMesh(ModifierData *md,
MEM_freeN(face_verts);
MEM_freeN(face_edges);
}
if (edge_index != numNewEdges) {
BKE_modifier_set_error(ctx->object,
md,
"Internal Error: edges array wrong size: %u instead of %u",
numNewEdges,
edge_index);
}
if (poly_index != numNewPolys) {
BKE_modifier_set_error(ctx->object,
md,
"Internal Error: polys array wrong size: %u instead of %u",
numNewPolys,
poly_index);
}
if (loop_index != numNewLoops) {
BKE_modifier_set_error(ctx->object,
md,
"Internal Error: loops array wrong size: %u instead of %u",
numNewLoops,
loop_index);
}
/* Haven't found a good way to generalize this. */
// if (edge_index != numNewEdges) {
/*BKE_modifier_set_error(ctx->object,
md,A
"Internal Error: edges array wrong size: %u instead of %u",
numNewEdges,
edge_index);*/
//}
// if (poly_index != numNewPolys) {
/*BKE_modifier_set_error(ctx->object,
md,
"Internal Error: polys array wrong size: %u instead of %u",
numNewPolys,f
poly_index);*/
//}
// if (loop_index != numNewLoops) {
/*BKE_modifier_set_error(ctx->object,
md,
"Internal Error: loops array wrong size: %u instead of %u",
numNewLoops,
loop_index);*/
//}
BLI_assert(edge_index == numNewEdges);
BLI_assert(poly_index == numNewPolys);
BLI_assert(loop_index == numNewLoops);

View File

@@ -27,7 +27,6 @@
#pragma once
#include "BLI_utildefines.h"
#include "dna_type_offsets.h"
#ifdef __cplusplus

View File

@@ -282,9 +282,9 @@ enum {
/* We can't have both flags enabled at once,
* flags defined in DNA_scene_types.h */
#define ME_EDIT_PAINT_SEL_MODE(_me) \
(((_me)->editflag & ME_EDIT_PAINT_FACE_SEL) ? SCE_SELECT_FACE : \
((_me)->editflag & ME_EDIT_PAINT_VERT_SEL) ? SCE_SELECT_VERTEX : \
0)
(((_me)->editflag & ME_EDIT_PAINT_FACE_SEL) ? \
SCE_SELECT_FACE : \
((_me)->editflag & ME_EDIT_PAINT_VERT_SEL) ? SCE_SELECT_VERTEX : 0)
/* me->flag */
enum {

View File

@@ -805,7 +805,7 @@
#define _DNA_DEFAULT_WeldModifierData \
{ \
.merge_dist = 0.001f, \
.mode = MOD_WELD_MODE_ALL, \
.mode = 0, \
.defgrp_name = "", \
}

View File

@@ -1287,9 +1287,11 @@ enum {
MOD_SOLIDIFY_RIM_MATERIAL = (1 << 4), /* deprecated, used in do_versions */
#endif
MOD_SOLIDIFY_FLIP = (1 << 5),
MOD_SOLIDIFY_NOSHELL = (1 << 6),
MOD_SOLIDIFY_OFFSET_ANGLE_CLAMP = (1 << 7),
MOD_SOLIDIFY_NONMANIFOLD_FLAT_FACES = (1 << 8),
MOD_SOLIDIFY_SHELL = (1 << 6),
MOD_SOLIDIFY_NOSHELL = (1 << 7), /* MOD_SOLIDIFY_SHELL should be used. instead This is kept as
long as the Modifier uses it. */
MOD_SOLIDIFY_OFFSET_ANGLE_CLAMP = (1 << 8),
MOD_SOLIDIFY_NONMANIFOLD_FLAT_FACES = (1 << 9),
};
/** #SolidifyModifierData.mode */
@@ -2044,12 +2046,6 @@ enum {
MOD_WELD_LOOSE_EDGES = (1 << 1),
};
/* #WeldModifierData.mode */
enum {
MOD_WELD_MODE_ALL = 0,
MOD_WELD_MODE_CONNECTED = 1,
};
typedef struct DataTransferModifierData {
ModifierData modifier;

View File

@@ -1235,6 +1235,14 @@ typedef struct NodeInputVector {
float vector[3];
} NodeInputVector;
typedef struct NodeGeometrySolidify {
/* GeometryNodeAttributeInputMode */
uint8_t thickness_mode;
uint8_t nonmanifold_offset_mode;
uint8_t nonmanifold_boundary_mode;
char _pad[5];
} NodeGeometrySolidify;
typedef struct NodeInputString {
char *string;
} NodeInputString;
@@ -1437,6 +1445,16 @@ typedef struct NodeGeometryRaycast {
char _pad[1];
} NodeGeometryRaycast;
typedef struct NodeGeometryCollapse {
/* GeometryNodeCollapseSymmetryAxis. */
int8_t symmetry_axis;
} NodeGeometryCollapse;
typedef struct NodeGeometryDissolve {
/* GeometryNodeDissolveDelimiter */
int8_t selection_type;
} NodeGeometryDissolve;
/* script node mode */
#define NODE_SCRIPT_INTERNAL 0
#define NODE_SCRIPT_EXTERNAL 1
@@ -2008,6 +2026,19 @@ typedef enum GeometryNodeRaycastMapMode {
GEO_NODE_RAYCAST_NEAREST = 1,
} GeometryNodeRaycastMapMode;
typedef enum GeometryNodeCollapseSymmetryAxis {
GEO_NODE_COLLAPSE_SYMMETRY_AXIS_NONE = -1,
GEO_NODE_COLLAPSE_SYMMETRY_AXIS_X = 0,
GEO_NODE_COLLAPSE_SYMMETRY_AXIS_Y = 1,
GEO_NODE_COLLAPSE_SYMMETRY_AXIS_Z = 2,
} GeometryNodeCollapseSymmetryAxis;
typedef enum GeometryNodeDissolveDelimiter {
GEO_NODE_DISSOLVE_DELIMITTER_UNSELECTED = 0,
GEO_NODE_DISSOLVE_DELIMITTER_LIMIT = 1,
GEO_NODE_DISSOLVE_DELIMITTER_SELECTION_BORDER = 2,
} GeometryNodeDissolveDelimiter;
#ifdef __cplusplus
}
#endif

View File

@@ -35,6 +35,71 @@ struct bNodeType;
#define DEF_ENUM(id) extern const EnumPropertyItem id[];
#include "RNA_enum_items.h"
extern const EnumPropertyItem rna_enum_operator_context_items[];
extern const EnumPropertyItem rna_enum_wm_report_items[];
extern const EnumPropertyItem rna_enum_transform_pivot_items_full[];
extern const EnumPropertyItem rna_enum_transform_orientation_items[];
extern const EnumPropertyItem rna_enum_transform_mode_types[];
extern const EnumPropertyItem rna_enum_property_type_items[];
extern const EnumPropertyItem rna_enum_property_subtype_items[];
extern const EnumPropertyItem rna_enum_property_unit_items[];
extern const EnumPropertyItem rna_enum_shading_type_items[];
extern const EnumPropertyItem rna_enum_navigation_mode_items[];
extern const EnumPropertyItem rna_enum_node_socket_in_out_items[];
extern const EnumPropertyItem rna_enum_node_math_items[];
extern const EnumPropertyItem rna_enum_mapping_type_items[];
extern const EnumPropertyItem rna_enum_node_vec_math_items[];
extern const EnumPropertyItem rna_enum_node_boolean_math_items[];
extern const EnumPropertyItem rna_enum_node_float_compare_items[];
extern const EnumPropertyItem rna_enum_node_filter_items[];
extern const EnumPropertyItem rna_enum_node_float_to_int_items[];
extern const EnumPropertyItem rna_enum_node_map_range_items[];
extern const EnumPropertyItem rna_enum_node_clamp_items[];
extern const EnumPropertyItem rna_enum_weld_mode_items[];
extern const EnumPropertyItem rna_enum_ramp_blend_items[];
extern const EnumPropertyItem rna_enum_prop_dynamicpaint_type_items[];
extern const EnumPropertyItem rna_enum_clip_editor_mode_items[];
extern const EnumPropertyItem rna_enum_icon_items[];
extern const EnumPropertyItem rna_enum_uilist_layout_type_items[];
extern const EnumPropertyItem rna_enum_linestyle_color_modifier_type_items[];
extern const EnumPropertyItem rna_enum_linestyle_alpha_modifier_type_items[];
extern const EnumPropertyItem rna_enum_linestyle_thickness_modifier_type_items[];
extern const EnumPropertyItem rna_enum_linestyle_geometry_modifier_type_items[];
extern const EnumPropertyItem nonmanifold_thickness_mode_items[];
extern const EnumPropertyItem nonmanifold_boundary_mode_items[];
extern const EnumPropertyItem rna_enum_window_cursor_items[];
extern const EnumPropertyItem rna_enum_dt_method_vertex_items[];
extern const EnumPropertyItem rna_enum_dt_method_edge_items[];
extern const EnumPropertyItem rna_enum_dt_method_loop_items[];
extern const EnumPropertyItem rna_enum_dt_method_poly_items[];
extern const EnumPropertyItem rna_enum_dt_mix_mode_items[];
extern const EnumPropertyItem rna_enum_dt_layers_select_src_items[];
extern const EnumPropertyItem rna_enum_dt_layers_select_dst_items[];
extern const EnumPropertyItem rna_enum_context_mode_items[];
extern const EnumPropertyItem rna_enum_curveprofile_preset_items[];
extern const EnumPropertyItem rna_enum_preference_section_items[];
extern const EnumPropertyItem rna_enum_attribute_type_items[];
extern const EnumPropertyItem rna_enum_attribute_type_with_auto_items[];
extern const EnumPropertyItem rna_enum_attribute_domain_items[];
extern const EnumPropertyItem rna_enum_attribute_domain_with_auto_items[];
extern const EnumPropertyItem *rna_enum_attribute_domain_itemf(struct ID *id, bool *r_free);
/**

View File

@@ -382,6 +382,7 @@ blender_include_dirs(
../../bmesh
../../depsgraph
../../draw
../../geometry
../../gpu
../../ikplugin
../../imbuf

View File

@@ -4559,6 +4559,36 @@ static void rna_def_modifier_surface(BlenderRNA *brna)
RNA_def_struct_ui_icon(srna, ICON_MOD_PHYSICS);
}
const EnumPropertyItem nonmanifold_thickness_mode_items[] = {
{MOD_SOLIDIFY_NONMANIFOLD_OFFSET_MODE_FIXED,
"FIXED",
0,
"Fixed",
"Most basic thickness calculation"},
{MOD_SOLIDIFY_NONMANIFOLD_OFFSET_MODE_EVEN,
"EVEN",
0,
"Even",
"Even thickness calculation which takes the angle between faces into account"},
{MOD_SOLIDIFY_NONMANIFOLD_OFFSET_MODE_CONSTRAINTS,
"CONSTRAINTS",
0,
"Constraints",
"Thickness calculation using constraints, most advanced"},
{0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem nonmanifold_boundary_mode_items[] = {
{MOD_SOLIDIFY_NONMANIFOLD_BOUNDARY_MODE_NONE, "NONE", 0, "None", "No shape correction"},
{MOD_SOLIDIFY_NONMANIFOLD_BOUNDARY_MODE_ROUND,
"ROUND",
0,
"Round",
"Round open perimeter shape"},
{MOD_SOLIDIFY_NONMANIFOLD_BOUNDARY_MODE_FLAT, "FLAT", 0, "Flat", "Flat open perimeter shape"},
{0, NULL, 0, NULL, NULL},
};
static void rna_def_modifier_solidify(BlenderRNA *brna)
{
static const EnumPropertyItem mode_items[] = {
@@ -4577,40 +4607,6 @@ static void rna_def_modifier_solidify(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem nonmanifold_thickness_mode_items[] = {
{MOD_SOLIDIFY_NONMANIFOLD_OFFSET_MODE_FIXED,
"FIXED",
0,
"Fixed",
"Most basic thickness calculation"},
{MOD_SOLIDIFY_NONMANIFOLD_OFFSET_MODE_EVEN,
"EVEN",
0,
"Even",
"Even thickness calculation which takes the angle between faces into account"},
{MOD_SOLIDIFY_NONMANIFOLD_OFFSET_MODE_CONSTRAINTS,
"CONSTRAINTS",
0,
"Constraints",
"Thickness calculation using constraints, most advanced"},
{0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem nonmanifold_boundary_mode_items[] = {
{MOD_SOLIDIFY_NONMANIFOLD_BOUNDARY_MODE_NONE, "NONE", 0, "None", "No shape correction"},
{MOD_SOLIDIFY_NONMANIFOLD_BOUNDARY_MODE_ROUND,
"ROUND",
0,
"Round",
"Round open perimeter shape"},
{MOD_SOLIDIFY_NONMANIFOLD_BOUNDARY_MODE_FLAT,
"FLAT",
0,
"Flat",
"Flat open perimeter shape"},
{0, NULL, 0, NULL, NULL},
};
StructRNA *srna;
PropertyRNA *prop;
@@ -6232,17 +6228,17 @@ static void rna_def_modifier_laplaciandeform(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_Modifier_update");
}
const EnumPropertyItem rna_enum_weld_mode_items[] = {
{0, "ALL", 0, "All", "Full merge by distance"},
{1, "CONNECTED", 0, "Connected", "Only merge along the edges"},
{0, NULL, 0, NULL, NULL},
};
static void rna_def_modifier_weld(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
static const EnumPropertyItem mode_items[] = {
{MOD_WELD_MODE_ALL, "ALL", 0, "All", "Full merge by distance"},
{MOD_WELD_MODE_CONNECTED, "CONNECTED", 0, "Connected", "Only merge along the edges"},
{0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "WeldModifier", "Modifier");
RNA_def_struct_ui_text(srna, "Weld Modifier", "Weld modifier");
RNA_def_struct_sdna(srna, "WeldModifierData");
@@ -6251,7 +6247,7 @@ static void rna_def_modifier_weld(BlenderRNA *brna)
RNA_define_lib_overridable(true);
prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, mode_items);
RNA_def_property_enum_items(prop, rna_enum_weld_mode_items);
RNA_def_property_ui_text(prop, "Mode", "Mode defines the merge rule");
RNA_def_property_update(prop, 0, "rna_Modifier_update");

View File

@@ -9109,6 +9109,26 @@ static void def_geo_triangulate(StructRNA *srna)
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_geo_remesh_blocks(StructRNA *srna)
{
static const EnumPropertyItem remesh_mode_items[] = {
{0, "BLOCKS", 0, "Blocks", "Output a blocky surface with no smoothing"},
{1, "SMOOTH", 0, "Smooth", "Output a smooth surface with no sharp-features detection"},
{2,
"SHARP",
0,
"Sharp",
"Output a surface that reproduces sharp edges and corners from the input mesh"},
{0, NULL, 0, NULL, NULL},
};
PropertyRNA *prop = RNA_def_property(srna, "remesh_blocks_mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "custom1");
RNA_def_property_enum_items(prop, remesh_mode_items);
RNA_def_property_ui_text(prop, "Mode", "Mesh smoothing mode for remesh operation");
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_geo_subdivision_surface(StructRNA *srna)
{
PropertyRNA *prop;
@@ -9750,6 +9770,29 @@ static void def_geo_point_scale(StructRNA *srna)
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
}
static void def_geo_solidify(StructRNA *srna)
{
PropertyRNA *prop;
RNA_def_struct_sdna_from(srna, "NodeGeometrySolidify", "storage");
prop = RNA_def_property(srna, "thickness_mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, rna_node_geometry_attribute_input_type_items_float);
RNA_def_property_ui_text(
prop, "Thickness", "Changes the Thickness input between Float and Attribute");
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
prop = RNA_def_property(srna, "nonmanifold_offset_mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, nonmanifold_thickness_mode_items);
RNA_def_property_ui_text(prop, "Mode", "Selects the used thickness algorithm");
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
prop = RNA_def_property(srna, "nonmanifold_boundary_mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, nonmanifold_boundary_mode_items);
RNA_def_property_ui_text(prop, "Boundary", "Selects the boundary adjustment algorithm");
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
}
static void def_geo_point_translate(StructRNA *srna)
{
PropertyRNA *prop;
@@ -10108,6 +10151,58 @@ static void def_geo_curve_resample(StructRNA *srna)
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
}
static void def_geo_collapse(StructRNA *srna)
{
PropertyRNA *prop;
static EnumPropertyItem symmetry_axis_items[] = {
{GEO_NODE_COLLAPSE_SYMMETRY_AXIS_NONE, "NONE", 0, "None", "No Symmetry is applied"},
{GEO_NODE_COLLAPSE_SYMMETRY_AXIS_X, "X", 0, "X", "Symmetry is applied on X axis"},
{GEO_NODE_COLLAPSE_SYMMETRY_AXIS_Y, "Y", 0, "Y", "Symmetry is applied on Y axis"},
{GEO_NODE_COLLAPSE_SYMMETRY_AXIS_Z, "Z", 0, "Z", "Symmetry is applied on Z axis"},
{0, NULL, 0, NULL, NULL},
};
RNA_def_struct_sdna_from(srna, "NodeGeometryCollapse", "storage");
prop = RNA_def_property(srna, "symmetry_axis", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, symmetry_axis_items);
RNA_def_property_ui_text(
prop, "Symmetry", "Set if and on what axis symmetry is applied by the operation");
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
}
static void def_geo_dissolve(StructRNA *srna)
{
PropertyRNA *prop;
static EnumPropertyItem delimiter_items[] = {
{GEO_NODE_DISSOLVE_DELIMITTER_UNSELECTED,
"SELECTION",
0,
"Selection",
"Only dissolve selected"},
{GEO_NODE_DISSOLVE_DELIMITTER_LIMIT,
"LIMIT",
0,
"Limit",
"Only dissolve unselected. Use especially for attributes on edge domain e.g. crease"},
{GEO_NODE_DISSOLVE_DELIMITTER_SELECTION_BORDER,
"BORDER",
0,
"Border as Limit",
"Use border of selection as delimiter"},
{0, NULL, 0, NULL, NULL},
};
RNA_def_struct_sdna_from(srna, "NodeGeometryDissolve", "storage");
prop = RNA_def_property(srna, "selection_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, delimiter_items);
RNA_def_property_ui_text(prop, "Selection", "Define how selection is applied");
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
}
static void def_geo_curve_subdivide(StructRNA *srna)
{
PropertyRNA *prop;
@@ -10212,6 +10307,43 @@ static void def_geo_attribute_transfer(StructRNA *srna)
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_geo_mesh_extrude(StructRNA *srna)
{
PropertyRNA *prop;
static const EnumPropertyItem rna_node_geometry_extrude_domain_items[] = {
{0, "VERTEX", 0, "Vertex", "Extrude Vertices"},
{1, "EDGE", 0, "Edge", "Extrude Edges"},
{2, "FACE", 0, "Face", "Extrude Faces"},
{0, NULL, 0, NULL, NULL},
};
prop = RNA_def_property(srna, "extrude_mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "custom1");
RNA_def_property_enum_items(prop, rna_node_geometry_extrude_domain_items);
RNA_def_property_enum_default(prop, GEO_NODE_POINT_DISTRIBUTE_RANDOM);
RNA_def_property_ui_text(prop, "Extrude Mode", "Select mesh domain to extrude");
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
}
static void def_geo_mesh_inset(StructRNA *srna)
{
PropertyRNA *prop;
prop = RNA_def_property(srna, "distance_mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "custom1");
RNA_def_property_enum_items(prop, rna_node_geometry_attribute_input_type_items_float);
RNA_def_property_ui_text(
prop, "Distance", "Changes the Distance input between Float and Attribute");
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
prop = RNA_def_property(srna, "inset_mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "custom2");
RNA_def_property_enum_items(prop, rna_node_geometry_attribute_input_type_items_float);
RNA_def_property_ui_text(prop, "Inset", "Changes the Inset input between Float and Attribute");
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
}
static void def_geo_input_material(StructRNA *srna)
{
PropertyRNA *prop;
@@ -10261,6 +10393,16 @@ static void def_geo_raycast(StructRNA *srna)
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
}
static void def_geo_merge_by_distance(StructRNA *srna)
{
PropertyRNA *prop;
prop = RNA_def_property(srna, "merge_mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "custom1");
RNA_def_property_enum_items(prop, rna_enum_weld_mode_items);
RNA_def_property_ui_text(prop, "Mode", "Mode defines the merge rule");
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
/* -------------------------------------------------------------------------- */
static void rna_def_shader_node(BlenderRNA *brna)

View File

@@ -30,6 +30,7 @@ set(INC
../depsgraph
../editors/include
../functions
../geometry
../makesdna
../makesrna
../nodes
@@ -95,8 +96,7 @@ set(SRC
intern/MOD_softbody.c
intern/MOD_solidify.c
intern/MOD_solidify_extrude.c
intern/MOD_solidify_nonmanifold.c
intern/MOD_subsurf.c
intern/MOD_subsurf.c
intern/MOD_surface.c
intern/MOD_surfacedeform.c
intern/MOD_triangulate.c
@@ -129,6 +129,7 @@ set(SRC
set(LIB
bf_blenkernel
bf_blenlib
bf_geometry
)
if(WITH_ALEMBIC)

View File

@@ -20,15 +20,8 @@
* \ingroup modifiers
*/
#include "MEM_guardedalloc.h"
#include "BLI_utildefines.h"
#include "BLI_math_base.h"
#include "BLI_threads.h"
#include "BLT_translation.h"
#include "DNA_defaults.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
@@ -39,9 +32,10 @@
#include "BKE_context.h"
#include "BKE_mesh.h"
#include "BKE_mesh_remesh_voxel.h"
#include "BKE_mesh_runtime.h"
#include "BKE_screen.h"
#include "GEO_mesh_remesh_blocks.h"
#include "UI_interface.h"
#include "UI_resources.h"
@@ -50,15 +44,8 @@
#include "MOD_modifiertypes.h"
#include "MOD_ui_common.h"
#include <stdlib.h>
#include <string.h>
#ifdef WITH_MOD_REMESH
# include "BLI_math_vector.h"
# include "dualcon.h"
#endif
static void initData(ModifierData *md)
{
RemeshModifierData *rmd = (RemeshModifierData *)md;
@@ -68,89 +55,10 @@ static void initData(ModifierData *md)
MEMCPY_STRUCT_AFTER(rmd, DNA_struct_default_get(RemeshModifierData), modifier);
}
#ifdef WITH_MOD_REMESH
static void init_dualcon_mesh(DualConInput *input, Mesh *mesh)
{
memset(input, 0, sizeof(DualConInput));
input->co = (void *)mesh->mvert;
input->co_stride = sizeof(MVert);
input->totco = mesh->totvert;
input->mloop = (void *)mesh->mloop;
input->loop_stride = sizeof(MLoop);
BKE_mesh_runtime_looptri_ensure(mesh);
input->looptri = (void *)mesh->runtime.looptris.array;
input->tri_stride = sizeof(MLoopTri);
input->tottri = mesh->runtime.looptris.len;
INIT_MINMAX(input->min, input->max);
BKE_mesh_minmax(mesh, input->min, input->max);
}
/* simple structure to hold the output: a CDDM and two counters to
* keep track of the current elements */
typedef struct {
Mesh *mesh;
int curvert, curface;
} DualConOutput;
/* allocate and initialize a DualConOutput */
static void *dualcon_alloc_output(int totvert, int totquad)
{
DualConOutput *output;
if (!(output = MEM_callocN(sizeof(DualConOutput), "DualConOutput"))) {
return NULL;
}
output->mesh = BKE_mesh_new_nomain(totvert, 0, 0, 4 * totquad, totquad);
return output;
}
static void dualcon_add_vert(void *output_v, const float co[3])
{
DualConOutput *output = output_v;
Mesh *mesh = output->mesh;
BLI_assert(output->curvert < mesh->totvert);
copy_v3_v3(mesh->mvert[output->curvert].co, co);
output->curvert++;
}
static void dualcon_add_quad(void *output_v, const int vert_indices[4])
{
DualConOutput *output = output_v;
Mesh *mesh = output->mesh;
MLoop *mloop;
MPoly *cur_poly;
int i;
BLI_assert(output->curface < mesh->totpoly);
mloop = mesh->mloop;
cur_poly = &mesh->mpoly[output->curface];
cur_poly->loopstart = output->curface * 4;
cur_poly->totloop = 4;
for (i = 0; i < 4; i++) {
mloop[output->curface * 4 + i].v = vert_indices[i];
}
output->curface++;
}
static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *UNUSED(ctx), Mesh *mesh)
{
RemeshModifierData *rmd;
DualConOutput *output;
DualConInput input;
Mesh *result;
DualConFlags flags = 0;
DualConMode mode = 0;
rmd = (RemeshModifierData *)md;
@@ -165,47 +73,8 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *UNUSED(ctx)
}
}
else {
/* Dualcon modes. */
init_dualcon_mesh(&input, mesh);
if (rmd->flag & MOD_REMESH_FLOOD_FILL) {
flags |= DUALCON_FLOOD_FILL;
}
switch (rmd->mode) {
case MOD_REMESH_CENTROID:
mode = DUALCON_CENTROID;
break;
case MOD_REMESH_MASS_POINT:
mode = DUALCON_MASS_POINT;
break;
case MOD_REMESH_SHARP_FEATURES:
mode = DUALCON_SHARP_FEATURES;
break;
case MOD_REMESH_VOXEL:
/* Should have been processed before as an OpenVDB operation. */
BLI_assert(false);
break;
}
/* TODO(jbakker): Dualcon crashes when run in parallel. Could be related to incorrect
* input data or that the library isn't thread safe.
* This was identified when changing the task isolation's during T76553. */
static ThreadMutex dualcon_mutex = BLI_MUTEX_INITIALIZER;
BLI_mutex_lock(&dualcon_mutex);
output = dualcon(&input,
dualcon_alloc_output,
dualcon_add_vert,
dualcon_add_quad,
flags,
mode,
rmd->threshold,
rmd->hermite_num,
rmd->scale,
rmd->depth);
BLI_mutex_unlock(&dualcon_mutex);
result = output->mesh;
MEM_freeN(output);
result = GEO_mesh_remesh_blocks(
mesh, rmd->flag, rmd->mode, rmd->threshold, rmd->hermite_num, rmd->scale, rmd->depth);
}
if (rmd->flag & MOD_REMESH_SMOOTH_SHADING) {
@@ -221,24 +90,13 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *UNUSED(ctx)
BKE_mesh_copy_parameters_for_eval(result, mesh);
BKE_mesh_calc_edges(result, true, false);
result->runtime.cd_dirty_vert |= CD_MASK_NORMAL;
return result;
}
#else /* !WITH_MOD_REMESH */
static Mesh *modifyMesh(ModifierData *UNUSED(md),
const ModifierEvalContext *UNUSED(ctx),
Mesh *mesh)
{
return mesh;
}
#endif /* !WITH_MOD_REMESH */
static void panel_draw(const bContext *UNUSED(C), Panel *panel)
{
uiLayout *layout = panel->layout;
#ifdef WITH_MOD_REMESH
uiLayout *row, *col;
PointerRNA ob_ptr;
@@ -271,10 +129,6 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel)
uiItemR(layout, ptr, "use_smooth_shade", 0, NULL, ICON_NONE);
modifier_panel_end(layout, ptr);
#else /* WITH_MOD_REMESH */
uiItemL(layout, IFACE_("Built without Remesh modifier"), ICON_NONE);
#endif /* WITH_MOD_REMESH */
}
static void panelRegister(ARegionType *region_type)

View File

@@ -29,22 +29,26 @@
#include "DNA_defaults.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
#include "DNA_screen_types.h"
#include "BKE_context.h"
#include "BKE_particle.h"
#include "BKE_deform.h"
#include "BKE_screen.h"
#include "GEO_solidifiy.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "RNA_access.h"
#include "MOD_modifiertypes.h"
#include "MOD_ui_common.h"
#include "MEM_guardedalloc.h"
#include "MOD_modifiertypes.h"
#include "MOD_solidify_util.h"
#include "MOD_ui_common.h"
static bool dependsOnNormals(ModifierData *md)
{
@@ -81,14 +85,154 @@ static void requiredDataMask(Object *UNUSED(ob),
}
}
static void get_distance_factor(
Mesh *mesh, Object *ob, const char *name, bool invert, float *r_selection)
{
int defgrp_index = BKE_object_defgroup_name_index(ob, name);
if (mesh && defgrp_index != -1) {
MDeformVert *dvert = mesh->dvert;
for (int i = 0; i < mesh->totvert; i++) {
MDeformVert *dv = &dvert[i];
r_selection[i] = BKE_defvert_find_weight(dv, defgrp_index);
}
}
else {
for (int i = 0; i < mesh->totvert; i++) {
r_selection[i] = 1.0f;
}
}
if (invert) {
for (int i = 0; i < mesh->totvert; i++) {
r_selection[i] = 1.0f - r_selection[i];
}
}
}
static SolidifyData solidify_data_from_modifier_data(ModifierData *md,
const ModifierEvalContext *ctx)
{
const SolidifyModifierData *smd = (SolidifyModifierData *)md;
SolidifyData solidify_data = {
ctx->object,
smd->offset,
smd->offset_fac,
smd->offset_fac_vg,
smd->offset_clamp,
smd->nonmanifold_offset_mode,
smd->nonmanifold_boundary_mode,
smd->flag,
smd->merge_tolerance,
smd->bevel_convex,
NULL,
};
if (!(smd->flag & MOD_SOLIDIFY_NOSHELL)) {
solidify_data.flag |= MOD_SOLIDIFY_SHELL;
}
return solidify_data;
}
static Mesh *solidify_nonmanifold_modify_mesh(ModifierData *md,
const ModifierEvalContext *ctx,
Mesh *mesh,
const SolidifyModifierData *smd)
{
SolidifyData solidify_data = solidify_data_from_modifier_data(md, ctx);
const bool defgrp_invert = (solidify_data.flag & MOD_SOLIDIFY_VGROUP_INV) != 0;
float *selection = MEM_callocN(sizeof(float) * (uint64_t)mesh->totvert, __func__);
get_distance_factor(mesh, ctx->object, smd->defgrp_name, defgrp_invert, selection);
solidify_data.distance = selection;
bool *shell_verts = NULL;
bool *rim_verts = NULL;
bool *shell_faces = NULL;
bool *rim_faces = NULL;
Mesh *output_mesh = solidify_nonmanifold(
&solidify_data, mesh, &shell_verts, &rim_verts, &shell_faces, &rim_faces);
const int shell_defgrp_index = BKE_object_defgroup_name_index(ctx->object,
smd->shell_defgrp_name);
const int rim_defgrp_index = BKE_object_defgroup_name_index(ctx->object, smd->rim_defgrp_name);
MDeformVert *dvert;
if (shell_defgrp_index != -1 || rim_defgrp_index != -1) {
dvert = CustomData_duplicate_referenced_layer(
&output_mesh->vdata, CD_MDEFORMVERT, output_mesh->totvert);
/* If no vertices were ever added to an object's vgroup, dvert might be NULL. */
if (dvert == NULL) {
/* Add a valid data layer! */
dvert = CustomData_add_layer(
&output_mesh->vdata, CD_MDEFORMVERT, CD_CALLOC, NULL, output_mesh->totvert);
}
output_mesh->dvert = dvert;
if ((solidify_data.flag & MOD_SOLIDIFY_SHELL) && shell_defgrp_index != -1) {
for (int i = 0; i < output_mesh->totvert; i++) {
BKE_defvert_ensure_index(&output_mesh->dvert[i], shell_defgrp_index)->weight =
shell_verts[i];
}
}
if ((solidify_data.flag & MOD_SOLIDIFY_RIM) && rim_defgrp_index != -1) {
for (int i = 0; i < output_mesh->totvert; i++) {
BKE_defvert_ensure_index(&output_mesh->dvert[i], rim_defgrp_index)->weight = rim_verts[i];
}
}
}
/* Only use material offsets if we have 2 or more materials. */
const short mat_nrs = ctx->object->totcol > 1 ? ctx->object->totcol : 1;
const short mat_nr_max = mat_nrs - 1;
const short mat_ofs = mat_nrs > 1 ? smd->mat_ofs : 0;
const short mat_ofs_rim = mat_nrs > 1 ? smd->mat_ofs_rim : 0;
short most_mat_nr = 0;
uint most_mat_nr_count = 0;
for (int mat_nr = 0; mat_nr < mat_nrs; mat_nr++) {
uint count = 0;
for (int i = 0; i < mesh->totpoly; i++) {
if (mesh->mpoly[i].mat_nr == mat_nr) {
count++;
}
}
if (count > most_mat_nr_count) {
most_mat_nr = mat_nr;
}
}
for (int i = 0; i < output_mesh->totpoly; i++) {
output_mesh->mpoly[i].mat_nr = most_mat_nr;
if (mat_ofs > 0 && shell_faces && shell_faces[i]) {
output_mesh->mpoly[i].mat_nr += mat_ofs;
CLAMP(output_mesh->mpoly[i].mat_nr, 0, mat_nr_max);
}
else if (mat_ofs_rim > 0 && rim_faces && rim_faces[i]) {
output_mesh->mpoly[i].mat_nr += mat_ofs_rim;
CLAMP(output_mesh->mpoly[i].mat_nr, 0, mat_nr_max);
}
}
MEM_freeN(selection);
MEM_freeN(shell_verts);
MEM_freeN(rim_verts);
MEM_freeN(shell_faces);
MEM_freeN(rim_faces);
return output_mesh;
}
static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *mesh)
{
const SolidifyModifierData *smd = (SolidifyModifierData *)md;
switch (smd->mode) {
case MOD_SOLIDIFY_MODE_EXTRUDE:
return MOD_solidify_extrude_modifyMesh(md, ctx, mesh);
case MOD_SOLIDIFY_MODE_NONMANIFOLD:
return MOD_solidify_nonmanifold_modifyMesh(md, ctx, mesh);
case MOD_SOLIDIFY_MODE_NONMANIFOLD: {
return solidify_nonmanifold_modify_mesh(md, ctx, mesh, smd);
}
default:
BLI_assert(0);
}

View File

@@ -24,8 +24,3 @@
Mesh *MOD_solidify_extrude_modifyMesh(ModifierData *md,
const ModifierEvalContext *ctx,
Mesh *mesh);
/* MOD_solidify_nonmanifold.c */
Mesh *MOD_solidify_nonmanifold_modifyMesh(ModifierData *md,
const ModifierEvalContext *ctx,
Mesh *mesh);

File diff suppressed because it is too large Load Diff

View File

@@ -33,6 +33,7 @@ set(INC
../bmesh
../depsgraph
../functions
../geometry
../gpu
../imbuf
../makesdna
@@ -161,6 +162,7 @@ set(SRC
geometry/nodes/node_geo_attribute_vector_rotate.cc
geometry/nodes/node_geo_boolean.cc
geometry/nodes/node_geo_bounding_box.cc
geometry/nodes/node_geo_collapse.cc
geometry/nodes/node_geo_collection_info.cc
geometry/nodes/node_geo_common.cc
geometry/nodes/node_geo_convex_hull.cc
@@ -183,12 +185,15 @@ set(SRC
geometry/nodes/node_geo_curve_to_points.cc
geometry/nodes/node_geo_curve_trim.cc
geometry/nodes/node_geo_delete_geometry.cc
geometry/nodes/node_geo_dissolve.cc
geometry/nodes/node_geo_edge_split.cc
geometry/nodes/node_geo_input_material.cc
geometry/nodes/node_geo_is_viewport.cc
geometry/nodes/node_geo_join_geometry.cc
geometry/nodes/node_geo_material_assign.cc
geometry/nodes/node_geo_material_replace.cc
geometry/nodes/node_geo_mesh_extrude.cc
geometry/nodes/node_geo_mesh_inset.cc
geometry/nodes/node_geo_mesh_primitive_circle.cc
geometry/nodes/node_geo_mesh_primitive_cone.cc
geometry/nodes/node_geo_mesh_primitive_cube.cc
@@ -207,13 +212,18 @@ set(SRC
geometry/nodes/node_geo_point_separate.cc
geometry/nodes/node_geo_point_translate.cc
geometry/nodes/node_geo_points_to_volume.cc
geometry/nodes/node_geo_merge_by_distance.cc
geometry/nodes/node_geo_raycast.cc
geometry/nodes/node_geo_select_by_material.cc
geometry/nodes/node_geo_separate_components.cc
geometry/nodes/node_geo_solidify.cc
geometry/nodes/node_geo_subdivision_surface.cc
geometry/nodes/node_geo_switch.cc
geometry/nodes/node_geo_remesh_voxel.cc
geometry/nodes/node_geo_remesh_blocks.cc
geometry/nodes/node_geo_transform.cc
geometry/nodes/node_geo_triangulate.cc
geometry/nodes/node_geo_unsubdivide.cc
geometry/nodes/node_geo_viewer.cc
geometry/nodes/node_geo_volume_to_mesh.cc
geometry/node_geometry_exec.cc
@@ -380,9 +390,24 @@ set(SRC
set(LIB
bf_bmesh
bf_functions
bf_geometry
bf_intern_sky
)
if(WITH_OPENVDB)
list(APPEND INC
../../../intern/openvdb
)
list(APPEND INC_SYS
${OPENVDB_INCLUDE_DIRS}
)
list(APPEND LIB
bf_intern_openvdb
${OPENVDB_LIBRARIES}
)
add_definitions(-DWITH_OPENVDB ${OPENVDB_DEFINITIONS})
endif()
if(WITH_BULLET)
list(APPEND INC_SYS
${BULLET_INCLUDE_DIRS}

View File

@@ -49,6 +49,7 @@ void register_node_type_geo_attribute_vector_math(void);
void register_node_type_geo_attribute_vector_rotate(void);
void register_node_type_geo_boolean(void);
void register_node_type_geo_bounding_box(void);
void register_node_type_geo_collapse(void);
void register_node_type_geo_collection_info(void);
void register_node_type_geo_convex_hull(void);
void register_node_type_geo_curve_endpoints(void);
@@ -69,12 +70,16 @@ void register_node_type_geo_curve_to_mesh(void);
void register_node_type_geo_curve_to_points(void);
void register_node_type_geo_curve_trim(void);
void register_node_type_geo_delete_geometry(void);
void register_node_type_geo_dissolve(void);
void register_node_type_geo_edge_split(void);
void register_node_type_geo_input_material(void);
void register_node_type_geo_is_viewport(void);
void register_node_type_geo_join_geometry(void);
void register_node_type_geo_material_assign(void);
void register_node_type_geo_material_replace(void);
void register_node_type_geo_merge_by_distance(void);
void register_node_type_geo_mesh_extrude(void);
void register_node_type_geo_mesh_inset(void);
void register_node_type_geo_mesh_primitive_circle(void);
void register_node_type_geo_mesh_primitive_cone(void);
void register_node_type_geo_mesh_primitive_cube(void);
@@ -94,14 +99,18 @@ void register_node_type_geo_point_separate(void);
void register_node_type_geo_point_translate(void);
void register_node_type_geo_points_to_volume(void);
void register_node_type_geo_raycast(void);
void register_node_type_geo_remesh_voxel(void);
void register_node_type_geo_remesh_blocks(void);
void register_node_type_geo_sample_texture(void);
void register_node_type_geo_select_by_handle_type(void);
void register_node_type_geo_select_by_material(void);
void register_node_type_geo_separate_components(void);
void register_node_type_geo_solidify(void);
void register_node_type_geo_subdivision_surface(void);
void register_node_type_geo_switch(void);
void register_node_type_geo_transform(void);
void register_node_type_geo_triangulate(void);
void register_node_type_geo_unsubdivide(void);
void register_node_type_geo_viewer(void);
void register_node_type_geo_volume_to_mesh(void);

View File

@@ -289,6 +289,7 @@ DefNode(GeometryNode, GEO_NODE_ATTRIBUTE_VECTOR_MATH, def_geo_attribute_vector_m
DefNode(GeometryNode, GEO_NODE_ATTRIBUTE_VECTOR_ROTATE, def_geo_attribute_vector_rotate, "ATTRIBUTE_VECTOR_ROTATE", AttributeVectorRotate, "Attribute Vector Rotate", "")
DefNode(GeometryNode, GEO_NODE_BOOLEAN, def_geo_boolean, "BOOLEAN", Boolean, "Boolean", "")
DefNode(GeometryNode, GEO_NODE_BOUNDING_BOX, 0, "BOUNDING_BOX", BoundBox, "Bounding Box", "")
DefNode(GeometryNode, GEO_NODE_COLLAPSE, def_geo_collapse, "COLLAPSE", Collapse, "Collapse", "")
DefNode(GeometryNode, GEO_NODE_COLLECTION_INFO, def_geo_collection_info, "COLLECTION_INFO", CollectionInfo, "Collection Info", "")
DefNode(GeometryNode, GEO_NODE_CONVEX_HULL, 0, "CONVEX_HULL", ConvexHull, "Convex Hull", "")
DefNode(GeometryNode, GEO_NODE_CURVE_ENDPOINTS, 0, "CURVE_ENDPOINTS", CurveEndpoints, "Curve Endpoints", "")
@@ -310,12 +311,15 @@ DefNode(GeometryNode, GEO_NODE_CURVE_TO_MESH, 0, "CURVE_TO_MESH", CurveToMesh, "
DefNode(GeometryNode, GEO_NODE_CURVE_TO_POINTS, def_geo_curve_to_points, "CURVE_TO_POINTS", CurveToPoints, "Curve to Points", "")
DefNode(GeometryNode, GEO_NODE_CURVE_TRIM, def_geo_curve_trim, "CURVE_TRIM", CurveTrim, "Curve Trim", "")
DefNode(GeometryNode, GEO_NODE_DELETE_GEOMETRY, 0, "DELETE_GEOMETRY", DeleteGeometry, "Delete Geometry", "")
DefNode(GeometryNode, GEO_NODE_DISSOLVE, def_geo_dissolve, "DISSOLVE", Dissolve, "Dissolve", "")
DefNode(GeometryNode, GEO_NODE_EDGE_SPLIT, 0, "EDGE_SPLIT", EdgeSplit, "Edge Split", "")
DefNode(GeometryNode, GEO_NODE_INPUT_MATERIAL, def_geo_input_material, "INPUT_MATERIAL", InputMaterial, "Material", "")
DefNode(GeometryNode, GEO_NODE_IS_VIEWPORT, 0, "IS_VIEWPORT", IsViewport, "Is Viewport", "")
DefNode(GeometryNode, GEO_NODE_JOIN_GEOMETRY, 0, "JOIN_GEOMETRY", JoinGeometry, "Join Geometry", "")
DefNode(GeometryNode, GEO_NODE_MATERIAL_ASSIGN, 0, "MATERIAL_ASSIGN", MaterialAssign, "Material Assign", "")
DefNode(GeometryNode, GEO_NODE_MATERIAL_REPLACE, 0, "MATERIAL_REPLACE", MaterialReplace, "Material Replace", "")
DefNode(GeometryNode, GEO_NODE_MESH_EXTRUDE, def_geo_mesh_extrude, "MESH_EXTRUDE", MeshExtrude, "Mesh Extrude", "")
DefNode(GeometryNode, GEO_NODE_MESH_INSET, def_geo_mesh_inset, "MESH_INSET", MeshInset, "Mesh Inset", "")
DefNode(GeometryNode, GEO_NODE_MESH_PRIMITIVE_CIRCLE, def_geo_mesh_circle, "MESH_PRIMITIVE_CIRCLE", MeshCircle, "Mesh Circle", "")
DefNode(GeometryNode, GEO_NODE_MESH_PRIMITIVE_CONE, def_geo_mesh_cone, "MESH_PRIMITIVE_CONE", MeshCone, "Cone", "")
DefNode(GeometryNode, GEO_NODE_MESH_PRIMITIVE_CUBE, 0, "MESH_PRIMITIVE_CUBE", MeshCube, "Cube", "")
@@ -335,12 +339,17 @@ DefNode(GeometryNode, GEO_NODE_POINT_SEPARATE, 0, "POINT_SEPARATE", PointSeparat
DefNode(GeometryNode, GEO_NODE_POINT_TRANSLATE, def_geo_point_translate, "POINT_TRANSLATE", PointTranslate, "Point Translate", "")
DefNode(GeometryNode, GEO_NODE_POINTS_TO_VOLUME, def_geo_points_to_volume, "POINTS_TO_VOLUME", PointsToVolume, "Points to Volume", "")
DefNode(GeometryNode, GEO_NODE_RAYCAST, def_geo_raycast, "RAYCAST", Raycast, "Raycast", "")
DefNode(GeometryNode, GEO_NODE_MERGE_BY_DISTANCE, def_geo_merge_by_distance, "MERGE_BY_DISTANCE", MergeByDistance, "Merge by Distance", "")
DefNode(GeometryNode, GEO_NODE_SELECT_BY_MATERIAL, 0, "SELECT_BY_MATERIAL", SelectByMaterial, "Select by Material", "")
DefNode(GeometryNode, GEO_NODE_SEPARATE_COMPONENTS, 0, "SEPARATE_COMPONENTS", SeparateComponents, "Separate Components", "")
DefNode(GeometryNode, GEO_NODE_SOLIDIFY, def_geo_solidify, "SOLIDIFY", Solidify, "Solidify", "")
DefNode(GeometryNode, GEO_NODE_SUBDIVISION_SURFACE, def_geo_subdivision_surface, "SUBDIVISION_SURFACE", SubdivisionSurface, "Subdivision Surface", "")
DefNode(GeometryNode, GEO_NODE_SWITCH, def_geo_switch, "SWITCH", Switch, "Switch", "")
DefNode(GeometryNode, GEO_NODE_REMESH_VOXEL, 0, "REMESH_VOXEL", RemeshVoxel, "Voxel Remesh", "")
DefNode(GeometryNode, GEO_NODE_REMESH_BLOCKS, def_geo_remesh_blocks, "REMESH_BLOCKS", RemeshBlocks, "Remesh Blocks", "")
DefNode(GeometryNode, GEO_NODE_TRANSFORM, 0, "TRANSFORM", Transform, "Transform", "")
DefNode(GeometryNode, GEO_NODE_TRIANGULATE, def_geo_triangulate, "TRIANGULATE", Triangulate, "Triangulate", "")
DefNode(GeometryNode, GEO_NODE_UNSUBDIVIDE, 0, "UNSUBDIVIDE", Unsubdivide, "Unsubdivide", "")
DefNode(GeometryNode, GEO_NODE_VIEWER, 0, "VIEWER", Viewer, "Viewer", "")
DefNode(GeometryNode, GEO_NODE_VOLUME_TO_MESH, def_geo_volume_to_mesh, "VOLUME_TO_MESH", VolumeToMesh, "Volume to Mesh", "")

View File

@@ -0,0 +1,122 @@
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "BKE_mesh.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "bmesh.h"
#include "bmesh_tools.h"
#include "node_geometry_util.hh"
static bNodeSocketTemplate geo_node_collapse_in[] = {
{SOCK_GEOMETRY, N_("Geometry")},
{SOCK_FLOAT, N_("Factor"), 1.0f, 0.0f, 0.0f, 0.0f, 0, 1.0f, PROP_FACTOR},
{SOCK_STRING, N_("Selection")},
{-1, ""},
};
static bNodeSocketTemplate geo_node_collapse_out[] = {
{SOCK_GEOMETRY, N_("Geometry")},
{-1, ""},
};
static void geo_node_collapse_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiLayoutSetPropSep(layout, true);
uiLayoutSetPropDecorate(layout, false);
uiItemR(layout, ptr, "symmetry_axis", 0, nullptr, ICON_NONE);
}
static void geo_node_collapse_init(bNodeTree *UNUSED(tree), bNode *node)
{
NodeGeometryCollapse *node_storage = (NodeGeometryCollapse *)MEM_callocN(
sizeof(NodeGeometryCollapse), __func__);
node->storage = node_storage;
node_storage->symmetry_axis = GEO_NODE_COLLAPSE_SYMMETRY_AXIS_NONE;
}
namespace blender::nodes {
static Mesh *collapse_mesh(const float factor,
const VArray<float> &selection,
const bool triangulate,
const int symmetry_axis,
const Mesh *mesh)
{
const BMeshCreateParams bmesh_create_params = {0};
const BMeshFromMeshParams bmesh_from_mesh_params = {
true, 0, 0, 0, {CD_MASK_ORIGINDEX, CD_MASK_ORIGINDEX, CD_MASK_ORIGINDEX}};
BMesh *bm = BKE_mesh_to_bmesh_ex(mesh, &bmesh_create_params, &bmesh_from_mesh_params);
const float symmetry_eps = 0.00002f;
Array<float> mask(selection.size());
selection.materialize(mask);
BM_mesh_decimate_collapse(
bm, factor, mask.data(), 1.0f, triangulate, symmetry_axis, symmetry_eps);
Mesh *result = BKE_mesh_from_bmesh_for_eval_nomain(bm, NULL, mesh);
BM_mesh_free(bm);
result->runtime.cd_dirty_vert |= CD_MASK_NORMAL;
return result;
}
static void geo_node_collapse_exec(GeoNodeExecParams params)
{
GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry");
const float factor = params.extract_input<float>("Factor");
if (factor < 1.0f && geometry_set.has_mesh()) {
MeshComponent &mesh_component = geometry_set.get_component_for_write<MeshComponent>();
const float default_factor = 1.0f;
GVArray_Typed<float> selection_attribute = params.get_input_attribute<float>(
"Selection", mesh_component, ATTR_DOMAIN_POINT, default_factor);
// VArray<float> selection(selection_attribute.to);
const Mesh *input_mesh = mesh_component.get_for_read();
const bNode &node = params.node();
const NodeGeometryCollapse &node_storage = *(NodeGeometryCollapse *)node.storage;
Mesh *result = collapse_mesh(
factor, selection_attribute, false, node_storage.symmetry_axis, input_mesh);
geometry_set.replace_mesh(result);
}
params.set_output("Geometry", std::move(geometry_set));
}
} // namespace blender::nodes
void register_node_type_geo_collapse()
{
static bNodeType ntype;
geo_node_type_base(&ntype, GEO_NODE_COLLAPSE, "Collapse", NODE_CLASS_GEOMETRY, 0);
node_type_socket_templates(&ntype, geo_node_collapse_in, geo_node_collapse_out);
node_type_storage(
&ntype, "NodeGeometryCollapse", node_free_standard_storage, node_copy_standard_storage);
node_type_init(&ntype, geo_node_collapse_init);
ntype.geometry_node_execute = blender::nodes::geo_node_collapse_exec;
ntype.draw_buttons = geo_node_collapse_layout;
ntype.width = 180;
nodeRegisterType(&ntype);
}

View File

@@ -0,0 +1,138 @@
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "BKE_mesh.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "bmesh.h"
#include "bmesh_tools.h"
#include "math.h"
#include "node_geometry_util.hh"
static bNodeSocketTemplate geo_node_dissolve_in[] = {
{SOCK_GEOMETRY, N_("Geometry")},
{SOCK_FLOAT, N_("Angle"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, M_PI, PROP_ANGLE},
{SOCK_BOOLEAN, N_("All Boundaries"), false},
{SOCK_STRING, N_("Selection")},
{-1, ""},
};
static bNodeSocketTemplate geo_node_dissolve_out[] = {
{SOCK_GEOMETRY, N_("Geometry")},
{-1, ""},
};
static void geo_node_dissolve_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiLayoutSetPropSep(layout, true);
uiLayoutSetPropDecorate(layout, false);
uiItemR(layout, ptr, "selection_type", 0, nullptr, ICON_NONE);
}
static void geo_node_dissolve_init(bNodeTree *UNUSED(tree), bNode *node)
{
NodeGeometryDissolve *node_storage = (NodeGeometryDissolve *)MEM_callocN(
sizeof(NodeGeometryDissolve), __func__);
node->storage = node_storage;
node_storage->selection_type = GEO_NODE_DISSOLVE_DELIMITTER_UNSELECTED;
}
namespace blender::nodes {
static Mesh *dissolve_mesh(const float angle,
const bool all_boundaries,
const int delimiter,
const Span<bool> selection,
const Mesh *mesh)
{
const BMeshCreateParams bmesh_create_params = {0};
const BMeshFromMeshParams bmesh_from_mesh_params = {
true, 0, 0, 0, {CD_MASK_ORIGINDEX, CD_MASK_ORIGINDEX, CD_MASK_ORIGINDEX}};
BMesh *bm = BKE_mesh_to_bmesh_ex(mesh, &bmesh_create_params, &bmesh_from_mesh_params);
if (delimiter & BMO_DELIM_FACE_SELECTION) {
BM_tag_faces(bm, selection.data());
}
else {
BM_select_edges(bm, selection.data());
}
BM_mesh_decimate_dissolve(bm, angle, all_boundaries, (BMO_Delimit)delimiter);
Mesh *result = BKE_mesh_from_bmesh_for_eval_nomain(bm, NULL, mesh);
BM_mesh_free(bm);
result->runtime.cd_dirty_vert |= CD_MASK_NORMAL;
return result;
}
static void geo_node_dissolve_exec(GeoNodeExecParams params)
{
GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry");
const float angle = params.extract_input<float>("Angle");
if (angle > 0.0f && geometry_set.has_mesh()) {
const MeshComponent &mesh_component = geometry_set.get_component_for_write<MeshComponent>();
const Mesh *input_mesh = mesh_component.get_for_read();
const bool all_boundaries = params.extract_input<bool>("All Boundaries");
const bNode &node = params.node();
const NodeGeometryDissolve &node_storage = *(NodeGeometryDissolve *)node.storage;
bool default_selection = true;
AttributeDomain selection_domain = ATTR_DOMAIN_FACE;
BMO_Delimit delimiter = BMO_DELIM_FACE_SELECTION;
if (node_storage.selection_type == GEO_NODE_DISSOLVE_DELIMITTER_UNSELECTED) {
selection_domain = ATTR_DOMAIN_EDGE;
delimiter = BMO_DELIM_EDGE_SELECTION_INVSE;
default_selection = true;
}
else if (node_storage.selection_type == GEO_NODE_DISSOLVE_DELIMITTER_LIMIT) {
selection_domain = ATTR_DOMAIN_EDGE;
delimiter = BMO_DELIM_EDGE_SELECTION;
default_selection = false;
};
GVArray_Typed<bool> selection_attribute = params.get_input_attribute<bool>(
"Selection", mesh_component, selection_domain, default_selection);
VArray_Span<bool> selection{selection_attribute};
Mesh *result = dissolve_mesh(angle, all_boundaries, delimiter, selection, input_mesh);
geometry_set.replace_mesh(result);
}
params.set_output("Geometry", std::move(geometry_set));
}
} // namespace blender::nodes
void register_node_type_geo_dissolve()
{
static bNodeType ntype;
geo_node_type_base(&ntype, GEO_NODE_DISSOLVE, "Dissolve", NODE_CLASS_GEOMETRY, 0);
node_type_socket_templates(&ntype, geo_node_dissolve_in, geo_node_dissolve_out);
node_type_storage(
&ntype, "NodeGeometryDissolve", node_free_standard_storage, node_copy_standard_storage);
node_type_init(&ntype, geo_node_dissolve_init);
ntype.geometry_node_execute = blender::nodes::geo_node_dissolve_exec;
ntype.draw_buttons = geo_node_dissolve_layout;
ntype.width = 165;
nodeRegisterType(&ntype);
}

View File

@@ -0,0 +1,116 @@
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "BKE_pointcloud.h"
#include "BLI_float3.hh"
#include "BLI_span.hh"
#include "DNA_pointcloud_types.h"
#include "GEO_mesh_merge_by_distance.h"
#include "GEO_pointcloud_merge_by_distance.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "node_geometry_util.hh"
using blender::Array;
using blender::float3;
using blender::Span;
using blender::Vector;
static bNodeSocketTemplate geo_node_merge_by_distance_in[] = {
{SOCK_GEOMETRY, N_("Geometry")},
{SOCK_FLOAT, N_("Distance"), 0.0f, 0, 0, 0, 0, 10000.0f, PROP_DISTANCE},
{SOCK_STRING, N_("Selection")},
{-1, ""},
};
static bNodeSocketTemplate geo_node_merge_by_distance_out[] = {
{SOCK_GEOMETRY, N_("Geometry")},
{-1, ""},
};
static void geo_node_merge_by_distance_layout(uiLayout *layout,
bContext *UNUSED(C),
PointerRNA *ptr)
{
uiItemR(layout, ptr, "merge_mode", 0, "", ICON_NONE);
}
static void geo_merge_by_distance_init(bNodeTree *UNUSED(ntree), bNode *node)
{
node->custom1 = WELD_MODE_ALL;
}
namespace blender::nodes {
static void geo_node_merge_by_distance_exec(GeoNodeExecParams params)
{
GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry");
geometry_set = geometry_set_realize_instances(geometry_set);
const char weld_mode = params.node().custom1;
const float distance = params.extract_input<float>("Distance");
if (geometry_set.has_mesh()) {
MeshComponent &mesh_component = geometry_set.get_component_for_write<MeshComponent>();
const Mesh *input_mesh = mesh_component.get_for_read();
const bool default_selection = true;
GVArray_Typed<bool> selection_attribute = params.get_input_attribute<bool>(
"Selection", mesh_component, ATTR_DOMAIN_POINT, default_selection);
VArray_Span<bool> selection{selection_attribute};
Mesh *result = GEO_mesh_merge_by_distance(input_mesh, selection.data(), distance, weld_mode);
if (result != input_mesh) {
geometry_set.replace_mesh(result);
}
}
if (geometry_set.has_pointcloud()) {
PointCloudComponent &pointcloud_component =
geometry_set.get_component_for_write<PointCloudComponent>();
const PointCloud *pointcloud = pointcloud_component.get_for_read();
const bool default_selection = true;
GVArray_Typed<bool> selection_attribute = params.get_input_attribute<bool>(
"Selection", pointcloud_component, ATTR_DOMAIN_POINT, default_selection);
VArray_Span<bool> selection{selection_attribute};
pointcloud_component.replace(merge_by_distance_pointcloud(*pointcloud, distance, selection));
}
if (geometry_set.has_volume()) {
params.error_message_add(NodeWarningType::Warning,
TIP_("This Node does not operate on volumes"));
}
params.set_output("Geometry", std::move(geometry_set));
}
} // namespace blender::nodes
void register_node_type_geo_merge_by_distance()
{
static bNodeType ntype;
geo_node_type_base(
&ntype, GEO_NODE_MERGE_BY_DISTANCE, "Merge By Distance", NODE_CLASS_GEOMETRY, 0);
node_type_socket_templates(
&ntype, geo_node_merge_by_distance_in, geo_node_merge_by_distance_out);
node_type_init(&ntype, geo_merge_by_distance_init);
ntype.geometry_node_execute = blender::nodes::geo_node_merge_by_distance_exec;
ntype.draw_buttons = geo_node_merge_by_distance_layout;
nodeRegisterType(&ntype);
}

View File

@@ -0,0 +1,253 @@
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "BKE_mesh.h"
#include "BKE_node.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "bmesh.h"
#include "node_geometry_util.hh"
static bNodeSocketTemplate geo_node_mesh_extrude_in[] = {
{SOCK_GEOMETRY, N_("Geometry")},
{SOCK_VECTOR, N_("Offset"), 0.0f, 0.0f, 1.0f, 0.0f, -FLT_MAX, FLT_MAX, PROP_TRANSLATION},
{SOCK_STRING, N_("Selection")},
{SOCK_STRING, N_("Out Selection")},
{-1, ""},
};
static bNodeSocketTemplate geo_node_mesh_extrude_out[] = {
{SOCK_GEOMETRY, N_("Geometry")},
{-1, ""},
};
static void geo_node_mesh_extrude_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "extrude_mode", 0, "", ICON_NONE);
}
static void geo_node_mesh_extrude_init(bNodeTree *UNUSED(ntree), bNode *node)
{
node->custom1 = 0;
}
namespace blender::nodes {
static void SetOutputSelection(const std::string &selection_out_attribute_name,
BMesh *bm,
Mesh *result)
{
MeshComponent component;
component.replace(result, GeometryOwnershipType::Editable);
if (!selection_out_attribute_name.empty()) {
bke::OutputAttribute_Typed<bool> attribute = component.attribute_try_get_for_output_only<bool>(
selection_out_attribute_name, ATTR_DOMAIN_POINT);
BM_get_selected_vertices(bm, attribute.as_span().data());
attribute.save();
}
}
static Mesh *extrude_vertices(const Mesh *mesh,
const Span<bool> selection,
const float3 offset,
const std::string selection_out_attribute_name)
{
const BMeshCreateParams bmesh_create_params = {true};
const BMeshFromMeshParams bmesh_from_mesh_params = {
true, 0, 0, 0, {CD_MASK_ORIGINDEX, CD_MASK_ORIGINDEX, CD_MASK_ORIGINDEX}};
BMesh *bm = BKE_mesh_to_bmesh_ex(mesh, &bmesh_create_params, &bmesh_from_mesh_params);
BM_select_vertices(bm, selection.data());
BMOperator extrude_op;
BMO_op_initf(bm, &extrude_op, 0, "extrude_vert_indiv verts=%hv", BM_ELEM_SELECT);
BMO_op_exec(bm, &extrude_op);
float _offset[3] = {offset.x, offset.y, offset.z};
BMOperator move_op;
BM_mesh_elem_hflag_disable_all(bm, BM_VERT, BM_ELEM_SELECT, false);
BMO_slot_buffer_hflag_enable(
bm, extrude_op.slots_out, "verts.out", BM_VERT, BM_ELEM_SELECT, false);
BMO_op_initf(bm, &move_op, 0, "translate vec=%v verts=%hv", _offset, BM_ELEM_SELECT);
BMO_op_exec(bm, &move_op);
BMO_op_finish(bm, &move_op);
BMO_op_finish(bm, &extrude_op);
CustomData_MeshMasks cd_mask_extra = {CD_MASK_ORIGINDEX, CD_MASK_ORIGINDEX, CD_MASK_ORIGINDEX};
Mesh *result = BKE_mesh_from_bmesh_for_eval_nomain(bm, &cd_mask_extra, mesh);
SetOutputSelection(selection_out_attribute_name, bm, result);
BM_mesh_free(bm);
BKE_mesh_normals_tag_dirty(result);
return result;
}
static Mesh *extrude_edges(const Mesh *mesh,
const Span<bool> selection,
const float3 offset,
const std::string selection_out_attribute_name)
{
const BMeshCreateParams bmesh_create_params = {true};
const BMeshFromMeshParams bmesh_from_mesh_params = {
true, 0, 0, 0, {CD_MASK_ORIGINDEX, CD_MASK_ORIGINDEX, CD_MASK_ORIGINDEX}};
BMesh *bm = BKE_mesh_to_bmesh_ex(mesh, &bmesh_create_params, &bmesh_from_mesh_params);
BM_select_edges(bm, selection.data());
BMOperator extrude_op;
BMO_op_initf(bm,
&extrude_op,
0,
"extrude_edge_only edges=%he use_select_history=%b",
BM_ELEM_SELECT,
true);
BMO_op_exec(bm, &extrude_op);
float _offset[3] = {offset.x, offset.y, offset.z};
BMOperator move_op;
BM_mesh_elem_hflag_disable_all(bm, BM_VERT, BM_ELEM_SELECT, false);
BMO_slot_buffer_hflag_enable(
bm, extrude_op.slots_out, "geom.out", BM_VERT, BM_ELEM_SELECT, false);
BMO_op_initf(bm, &move_op, 0, "translate vec=%v verts=%hv", _offset, BM_ELEM_SELECT);
BMO_op_exec(bm, &move_op);
BMO_op_finish(bm, &move_op);
BMO_op_finish(bm, &extrude_op);
CustomData_MeshMasks cd_mask_extra = {CD_MASK_ORIGINDEX, CD_MASK_ORIGINDEX, CD_MASK_ORIGINDEX};
Mesh *result = BKE_mesh_from_bmesh_for_eval_nomain(bm, &cd_mask_extra, mesh);
SetOutputSelection(selection_out_attribute_name, bm, result);
BM_mesh_free(bm);
BKE_mesh_normals_tag_dirty(result);
return result;
}
static Mesh *extrude_faces(const Mesh *mesh,
const Span<bool> selection,
const float3 offset,
std::string selection_out_attribute_name)
{
const BMeshCreateParams bmesh_create_params = {true};
const BMeshFromMeshParams bmesh_from_mesh_params = {
true, 0, 0, 0, {CD_MASK_ORIGINDEX, CD_MASK_ORIGINDEX, CD_MASK_ORIGINDEX}};
BMesh *bm = BKE_mesh_to_bmesh_ex(mesh, &bmesh_create_params, &bmesh_from_mesh_params);
BM_select_faces(bm, selection.data());
BMOperator extrude_op;
BMO_op_initf(bm, &extrude_op, 0, "extrude_face_region geom=%hf", BM_ELEM_SELECT);
BMO_op_exec(bm, &extrude_op);
float o[3] = {offset.x, offset.y, offset.z};
BMOperator move_op;
BM_mesh_elem_hflag_disable_all(bm, BM_VERT, BM_ELEM_SELECT, false);
BMO_slot_buffer_hflag_enable(
bm, extrude_op.slots_out, "geom.out", BM_VERT, BM_ELEM_SELECT, false);
BMO_op_initf(bm, &move_op, 0, "translate vec=%v verts=%hv", o, BM_ELEM_SELECT);
BMO_op_exec(bm, &move_op);
BMO_op_finish(bm, &move_op);
BMO_op_finish(bm, &extrude_op);
CustomData_MeshMasks cd_mask_extra = {CD_MASK_ORIGINDEX, CD_MASK_ORIGINDEX, CD_MASK_ORIGINDEX};
Mesh *result = BKE_mesh_from_bmesh_for_eval_nomain(bm, &cd_mask_extra, mesh);
SetOutputSelection(selection_out_attribute_name, bm, result);
BM_mesh_free(bm);
BKE_mesh_normals_tag_dirty(result);
return result;
}
static void geo_node_mesh_extrude_exec(GeoNodeExecParams params)
{
GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry");
geometry_set = bke::geometry_set_realize_instances(geometry_set);
MeshComponent &mesh_component = geometry_set.get_component_for_write<MeshComponent>();
const float3 offset = params.extract_input<float3>("Offset");
if (offset.length() > 0 && mesh_component.has_mesh()) {
const Mesh *input_mesh = mesh_component.get_for_read();
AttributeDomain domain = ATTR_DOMAIN_POINT;
if (params.node().custom1 == 1) {
domain = ATTR_DOMAIN_EDGE;
}
else if (params.node().custom1 == 2) {
domain = ATTR_DOMAIN_FACE;
}
const bool default_selection = true;
GVArray_Typed<bool> selection_attribute = params.get_input_attribute<bool>(
"Selection", mesh_component, domain, default_selection);
VArray_Span<bool> selection{selection_attribute};
std::string out_selection_attribute_name = params.get_input<std::string>("Out Selection");
Mesh *result;
if (params.node().custom1 == 1) {
result = extrude_edges(input_mesh, selection, offset, out_selection_attribute_name);
}
else if (params.node().custom1 == 2) {
result = extrude_faces(input_mesh, selection, offset, out_selection_attribute_name);
}
else {
result = extrude_vertices(input_mesh, selection, offset, out_selection_attribute_name);
}
geometry_set.replace_mesh(result);
}
params.set_output("Geometry", std::move(geometry_set));
}
} // namespace blender::nodes
void register_node_type_geo_mesh_extrude()
{
static bNodeType ntype;
geo_node_type_base(&ntype, GEO_NODE_MESH_EXTRUDE, "Mesh Extrude", NODE_CLASS_GEOMETRY, 0);
node_type_socket_templates(&ntype, geo_node_mesh_extrude_in, geo_node_mesh_extrude_out);
node_type_init(&ntype, geo_node_mesh_extrude_init);
ntype.geometry_node_execute = blender::nodes::geo_node_mesh_extrude_exec;
ntype.draw_buttons = geo_node_mesh_extrude_layout;
nodeRegisterType(&ntype);
}

View File

@@ -0,0 +1,215 @@
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "BKE_mesh.h"
#include "BKE_node.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "bmesh.h"
#include "bmesh_tools.h"
#include "node_geometry_util.hh"
static bNodeSocketTemplate geo_node_mesh_inset_in[] = {
{SOCK_GEOMETRY, N_("Geometry")},
{SOCK_STRING, N_("Distance")},
{SOCK_FLOAT, N_("Distance"), 0.0f, 0, 0, 0, FLT_MIN, FLT_MAX, PROP_DISTANCE},
{SOCK_STRING, N_("Inset")},
{SOCK_FLOAT, N_("Inset"), 0.0f, 0, 0, 0, FLT_MIN, FLT_MAX, PROP_DISTANCE},
{SOCK_BOOLEAN, N_("Individual")},
{SOCK_STRING, N_("Selection")},
{SOCK_STRING, N_("Top Face")},
{SOCK_STRING, N_("Side Face")},
{-1, ""},
};
static bNodeSocketTemplate geo_node_mesh_inset_out[] = {
{SOCK_GEOMETRY, N_("Geometry")},
{-1, ""},
};
static void geo_node_mesh_inset_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiLayoutSetPropSep(layout, true);
uiLayoutSetPropDecorate(layout, false);
uiItemR(layout, ptr, "distance_mode", 0, nullptr, ICON_NONE);
uiItemR(layout, ptr, "inset_mode", 0, nullptr, ICON_NONE);
}
static void geo_node_mesh_inset_init(bNodeTree *UNUSED(tree), bNode *node)
{
node->custom1 = GEO_NODE_ATTRIBUTE_INPUT_FLOAT;
node->custom2 = GEO_NODE_ATTRIBUTE_INPUT_FLOAT;
}
static void geo_node_mesh_inset_update(bNodeTree *UNUSED(ntree), bNode *node)
{
blender::nodes::update_attribute_input_socket_availabilities(
*node, "Distance", (GeometryNodeAttributeInputMode)node->custom1, true);
blender::nodes::update_attribute_input_socket_availabilities(
*node, "Inset", (GeometryNodeAttributeInputMode)node->custom2, true);
}
using blender::Span;
static Mesh *mesh_inset_mesh(const Mesh *mesh,
const Span<bool> selection,
const Span<float> distance,
const Span<float> mesh_inset,
const bool mesh_inset_individual_faces,
std::string selection_top_faces_out_attribute_name,
std::string selection_side_faces_out_attribute_name)
{
const BMeshCreateParams bmesh_create_params = {true};
const BMeshFromMeshParams bmesh_from_mesh_params = {
true, 0, 0, 0, {CD_MASK_ORIGINDEX, CD_MASK_ORIGINDEX, CD_MASK_ORIGINDEX}};
BMesh *bm = BKE_mesh_to_bmesh_ex(mesh, &bmesh_create_params, &bmesh_from_mesh_params);
BM_select_faces(bm, selection.data());
BMOperator op;
if (mesh_inset_individual_faces) {
BMO_op_initf(bm,
&op,
0,
"inset_individual faces=%hf use_even_offset=%b thickness=%f depth=%f "
"thickness_array=%p depth_array=%p use_attributes=%b",
BM_ELEM_SELECT,
true,
mesh_inset[0],
distance[0],
mesh_inset.data(),
distance.data(),
true);
}
else {
BMO_op_initf(bm,
&op,
0,
"inset_region faces=%hf use_boundary=%b use_even_offset=%b thickness=%f depth=%f "
"thickness_array=%p depth_array=%p use_attributes=%b",
BM_ELEM_SELECT,
true,
true,
mesh_inset[0],
distance[0],
mesh_inset.data(),
distance.data(),
true);
}
// BM_tag_faces_from_operator_slot(bm, &op, "faces.out", BM_FACE);
BM_untag_faces_by_tag(bm, BM_ELEM_SELECT);
BMO_op_exec(bm, &op);
BMO_op_finish(bm, &op);
CustomData_MeshMasks cd_mask_extra = {CD_MASK_ORIGINDEX, CD_MASK_ORIGINDEX, CD_MASK_ORIGINDEX};
Mesh *result = BKE_mesh_from_bmesh_for_eval_nomain(bm, &cd_mask_extra, mesh);
MeshComponent component;
component.replace(result, GeometryOwnershipType::Editable);
if (!selection_top_faces_out_attribute_name.empty()) {
blender::bke::OutputAttribute_Typed<bool> attribute =
component.attribute_try_get_for_output_only<bool>(selection_top_faces_out_attribute_name,
ATTR_DOMAIN_FACE);
BM_get_selected_faces(bm, attribute.as_span().data());
attribute.save();
}
if (!selection_side_faces_out_attribute_name.empty()) {
blender::bke::OutputAttribute_Typed<bool> attribute =
component.attribute_try_get_for_output_only<bool>(selection_side_faces_out_attribute_name,
ATTR_DOMAIN_FACE);
BM_get_tagged_faces(bm, attribute.as_span().data());
attribute.save();
}
BM_mesh_free(bm);
BKE_mesh_normals_tag_dirty(result);
return result;
}
namespace blender::nodes {
static void geo_node_mesh_inset_exec(GeoNodeExecParams params)
{
GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry");
geometry_set = geometry_set_realize_instances(geometry_set);
MeshComponent &mesh_component = geometry_set.get_component_for_write<MeshComponent>();
if (mesh_component.has_mesh()) {
const bool default_selection = true;
GVArray_Typed<bool> selection_attribute = params.get_input_attribute<bool>(
"Selection", mesh_component, ATTR_DOMAIN_FACE, default_selection);
VArray_Span<bool> selection{selection_attribute};
const Mesh *input_mesh = mesh_component.get_for_read();
AttributeDomain attribute_domain = ATTR_DOMAIN_POINT;
const bool mesh_inset_individual_faces = params.extract_input<bool>("Individual");
if (mesh_inset_individual_faces) {
attribute_domain = ATTR_DOMAIN_FACE;
}
const float default_distance = 0;
GVArray_Typed<float> distance_attribute = params.get_input_attribute<float>(
"Distance", mesh_component, attribute_domain, default_distance);
VArray_Span<float> distance{distance_attribute};
const float default_mesh_inset = 0;
GVArray_Typed<float> mesh_inset_attribute = params.get_input_attribute<float>(
"Inset", mesh_component, attribute_domain, default_mesh_inset);
VArray_Span<float> mesh_inset{mesh_inset_attribute};
std::string selection_top_faces_out_attribute_name = params.get_input<std::string>("Top Face");
std::string selection_side_faces_out_attribute_name = params.get_input<std::string>(
"Side Face");
Mesh *result = mesh_inset_mesh(input_mesh,
selection,
distance,
mesh_inset,
mesh_inset_individual_faces,
selection_top_faces_out_attribute_name,
selection_side_faces_out_attribute_name);
geometry_set.replace_mesh(result);
}
params.set_output("Geometry", std::move(geometry_set));
}
} // namespace blender::nodes
void register_node_type_geo_mesh_inset()
{
static bNodeType ntype;
geo_node_type_base(&ntype, GEO_NODE_MESH_INSET, "Mesh Inset", NODE_CLASS_GEOMETRY, 0);
node_type_socket_templates(&ntype, geo_node_mesh_inset_in, geo_node_mesh_inset_out);
node_type_init(&ntype, geo_node_mesh_inset_init);
node_type_update(&ntype, geo_node_mesh_inset_update);
ntype.draw_buttons = geo_node_mesh_inset_layout;
ntype.geometry_node_execute = blender::nodes::geo_node_mesh_inset_exec;
nodeRegisterType(&ntype);
}

View File

@@ -0,0 +1,90 @@
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "BKE_mesh.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_modifier_types.h"
#include "GEO_mesh_remesh_blocks.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "node_geometry_util.hh"
static bNodeSocketTemplate geo_node_remesh_blocks_in[] = {
{SOCK_GEOMETRY, N_("Geometry")},
{SOCK_INT, N_("Depth"), 4, 0, 0, 0, 2, 64},
{SOCK_FLOAT, N_("Scale"), 0.9f, 0, 0, 0, 0.0f, 0.99f},
{SOCK_FLOAT, N_("Threshold"), 1.0f, 0, 0, 0, 0.01f, FLT_MAX},
{-1, ""},
};
static bNodeSocketTemplate geo_node_remesh_blocks_out[] = {
{SOCK_GEOMETRY, N_("Geometry")},
{-1, ""},
};
static void geo_node_remesh_blocks_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "remesh_blocks_mode", 0, "", ICON_NONE);
}
static void geo_remesh_blocks_init(bNodeTree *UNUSED(ntree), bNode *node)
{
node->custom1 = 0;
}
namespace blender::nodes {
static void geo_node_remesh_blocks_exec(GeoNodeExecParams params)
{
GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry");
const char flag = 0;
const char mode = params.node().custom1;
const int hermite_num = 1;
const int depth = params.extract_input<int>("Depth");
const float scale = min_ff(params.extract_input<float>("Scale"), 0.99f);
const float threshold = params.extract_input<float>("Threshold");
if (geometry_set.has_mesh()) {
const Mesh *input_mesh = geometry_set.get_mesh_for_read();
Mesh *output_mesh = GEO_mesh_remesh_blocks(
input_mesh, flag, mode, threshold, hermite_num, scale, depth);
BKE_mesh_copy_parameters_for_eval(output_mesh, input_mesh);
BKE_mesh_calc_edges(output_mesh, true, false);
BKE_mesh_normals_tag_dirty(output_mesh);
geometry_set.replace_mesh(output_mesh);
}
params.set_output("Geometry", std::move(geometry_set));
}
} // namespace blender::nodes
void register_node_type_geo_remesh_blocks()
{
static bNodeType ntype;
geo_node_type_base(&ntype, GEO_NODE_REMESH_BLOCKS, "Remesh Blocks", NODE_CLASS_GEOMETRY, 0);
node_type_socket_templates(&ntype, geo_node_remesh_blocks_in, geo_node_remesh_blocks_out);
node_type_init(&ntype, geo_remesh_blocks_init);
ntype.geometry_node_execute = blender::nodes::geo_node_remesh_blocks_exec;
ntype.draw_buttons = geo_node_remesh_blocks_layout;
nodeRegisterType(&ntype);
}

View File

@@ -0,0 +1,60 @@
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "UI_interface.h"
#include "BKE_mesh_remesh_voxel.h"
#include "node_geometry_util.hh"
static bNodeSocketTemplate geo_node_remesh_voxel_in[] = {
{SOCK_GEOMETRY, N_("Geometry")},
{SOCK_FLOAT, N_("Voxel Size"), 1.0f, 0, 0, 0, 0.01f, FLT_MAX},
{SOCK_FLOAT, N_("Adaptivity"), 0.0f, 0, 0, 0, 0.0f, 1.0f},
{-1, ""},
};
static bNodeSocketTemplate geo_node_remesh_voxel_out[] = {
{SOCK_GEOMETRY, N_("Geometry")},
{-1, ""},
};
namespace blender::nodes {
static void geo_node_remesh_voxel_exec(GeoNodeExecParams params)
{
GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry");
const float voxel_size = params.extract_input<float>("Voxel Size");
const float adaptivity = params.extract_input<float>("Adaptivity");
if (geometry_set.has_mesh()) {
const Mesh *input_mesh = geometry_set.get_mesh_for_read();
Mesh *output_mesh = BKE_mesh_remesh_voxel(input_mesh, voxel_size, adaptivity, 0.0f);
geometry_set.replace_mesh(output_mesh);
}
params.set_output("Geometry", std::move(geometry_set));
}
} // namespace blender::nodes
void register_node_type_geo_remesh_voxel()
{
static bNodeType ntype;
geo_node_type_base(&ntype, GEO_NODE_REMESH_VOXEL, "Voxel Remesh", NODE_CLASS_GEOMETRY, 0);
node_type_socket_templates(&ntype, geo_node_remesh_voxel_in, geo_node_remesh_voxel_out);
ntype.geometry_node_execute = blender::nodes::geo_node_remesh_voxel_exec;
nodeRegisterType(&ntype);
}

View File

@@ -0,0 +1,187 @@
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "BKE_node.h"
#include "DNA_mesh_types.h"
#include "DNA_modifier_types.h"
#include "DNA_node_types.h"
#include "GEO_solidifiy.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "node_geometry_util.hh"
static bNodeSocketTemplate geo_node_solidify_in[] = {
{SOCK_GEOMETRY, N_("Geometry")},
{SOCK_STRING, N_("Thickness")},
{SOCK_FLOAT, N_("Thickness"), 0.0f, 0.0f, 0.0f, 0.0f, -FLT_MAX, FLT_MAX, PROP_DISTANCE},
{SOCK_FLOAT, N_("Clamp"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f, PROP_FACTOR},
{SOCK_FLOAT, N_("Offset"), -1.0f, 0.0f, 0.0f, 0.0f, -1.0f, 1.0f, PROP_FACTOR},
{SOCK_BOOLEAN, N_("Fill"), true},
{SOCK_BOOLEAN, N_("Rim"), true},
{SOCK_STRING, N_("Fill Faces")},
{SOCK_STRING, N_("Rim Faces")},
{-1, ""},
};
static bNodeSocketTemplate geo_node_solidify_out[] = {
{SOCK_GEOMETRY, N_("Geometry")},
{-1, ""},
};
namespace blender::nodes {
static void geo_node_solidify_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiLayoutSetPropSep(layout, true);
uiLayoutSetPropDecorate(layout, false);
uiItemR(layout, ptr, "thickness_mode", 0, nullptr, ICON_NONE);
uiItemR(layout, ptr, "nonmanifold_offset_mode", 0, nullptr, ICON_NONE);
uiItemR(layout, ptr, "nonmanifold_boundary_mode", 0, nullptr, ICON_NONE);
}
static void geo_node_solidify_init(bNodeTree *UNUSED(tree), bNode *node)
{
NodeGeometrySolidify *node_storage = (NodeGeometrySolidify *)MEM_callocN(
sizeof(NodeGeometrySolidify), __func__);
node->storage = node_storage;
node_storage->thickness_mode = GEO_NODE_ATTRIBUTE_INPUT_FLOAT;
}
static void geo_node_solidify_update(bNodeTree *UNUSED(ntree), bNode *node)
{
const NodeGeometrySolidify *node_storage = (NodeGeometrySolidify *)node->storage;
update_attribute_input_socket_availabilities(
*node, "Thickness", (GeometryNodeAttributeInputMode)node_storage->thickness_mode, true);
}
static void geo_node_solidify_exec(GeoNodeExecParams params)
{
const bNode &node = params.node();
NodeGeometrySolidify &node_storage = *(NodeGeometrySolidify *)node.storage;
const Object *self_object = params.self_object();
GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry");
bool add_fill = params.extract_input<bool>("Fill");
bool add_rim = params.extract_input<bool>("Rim");
char flag = 0;
if (add_fill) {
flag |= MOD_SOLIDIFY_SHELL;
}
if (add_rim) {
flag |= MOD_SOLIDIFY_RIM;
}
float offset = params.extract_input<float>("Offset");
float offset_clamp = params.extract_input<float>("Clamp");
geometry_set = geometry_set_realize_instances(geometry_set);
if (geometry_set.has<MeshComponent>()) {
MeshComponent &mesh_component = geometry_set.get_component_for_write<MeshComponent>();
Mesh *input_mesh = mesh_component.get_for_write();
const float default_thickness = 0;
GVArray_Typed<float> thickness_attribute = params.get_input_attribute<float>(
"Thickness", mesh_component, ATTR_DOMAIN_POINT, default_thickness);
VArray_Span<float> thickness{thickness_attribute};
SolidifyData solidify_node_data = {
self_object,
1,
offset,
0.0f,
offset_clamp,
node_storage.nonmanifold_offset_mode,
node_storage.nonmanifold_boundary_mode,
flag,
0.01f,
0.0f,
thickness.data(),
};
bool *shell_verts = nullptr;
bool *rim_verts = nullptr;
bool *shell_faces = nullptr;
bool *rim_faces = nullptr;
Mesh *output_mesh = solidify_nonmanifold(
&solidify_node_data, input_mesh, &shell_verts, &rim_verts, &shell_faces, &rim_faces);
if (output_mesh != input_mesh) {
geometry_set.replace_mesh(output_mesh);
}
const AttributeDomain result_face_domain = ATTR_DOMAIN_FACE;
const std::string shell_faces_attribute_name = params.get_input<std::string>("Fill Faces");
const std::string rim_faces_attribute_name = params.get_input<std::string>("Rim Faces");
if (solidify_node_data.flag & MOD_SOLIDIFY_SHELL) {
if (!shell_faces_attribute_name.empty()) {
OutputAttribute_Typed<bool> shell_faces_attribute =
mesh_component.attribute_try_get_for_output_only<bool>(shell_faces_attribute_name,
result_face_domain);
Span<bool> shell_faces_span(shell_faces, shell_faces_attribute->size());
shell_faces_attribute->set_all(shell_faces_span);
shell_faces_attribute.save();
}
}
if (solidify_node_data.flag & MOD_SOLIDIFY_RIM) {
if (!rim_faces_attribute_name.empty()) {
OutputAttribute_Typed<bool> rim_faces_attribute =
mesh_component.attribute_try_get_for_output_only<bool>(rim_faces_attribute_name,
result_face_domain);
Span<bool> rim_faces_span(rim_faces, rim_faces_attribute->size());
rim_faces_attribute->set_all(rim_faces_span);
rim_faces_attribute.save();
}
}
MEM_freeN(shell_verts);
MEM_freeN(rim_verts);
MEM_freeN(shell_faces);
MEM_freeN(rim_faces);
}
params.set_output("Geometry", geometry_set);
}
} // namespace blender::nodes
void register_node_type_geo_solidify()
{
static bNodeType ntype;
geo_node_type_base(&ntype, GEO_NODE_SOLIDIFY, "Solidify", NODE_CLASS_GEOMETRY, 0);
node_type_socket_templates(&ntype, geo_node_solidify_in, geo_node_solidify_out);
node_type_storage(
&ntype, "NodeGeometrySolidify", node_free_standard_storage, node_copy_standard_storage);
node_type_init(&ntype, blender::nodes::geo_node_solidify_init);
node_type_size(&ntype, 172, 100, 600);
node_type_update(&ntype, blender::nodes::geo_node_solidify_update);
ntype.geometry_node_execute = blender::nodes::geo_node_solidify_exec;
ntype.draw_buttons = blender::nodes::geo_node_solidify_layout;
nodeRegisterType(&ntype);
}

View File

@@ -0,0 +1,87 @@
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "BKE_mesh.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "bmesh.h"
#include "bmesh_tools.h"
#include "node_geometry_util.hh"
static bNodeSocketTemplate geo_node_unsubdivide_in[] = {
{SOCK_GEOMETRY, N_("Geometry")},
{SOCK_INT, N_("Iterations"), 1, 0, 0, 0, 0, 10},
{SOCK_STRING, N_("Selection")},
{-1, ""},
};
static bNodeSocketTemplate geo_node_unsubdivide_out[] = {
{SOCK_GEOMETRY, N_("Geometry")},
{-1, ""},
};
namespace blender::nodes {
static Mesh *unsubdivide_mesh(const int iterations, const Array<bool> &selection, const Mesh *mesh)
{
const BMeshCreateParams bmesh_create_params = {0};
const BMeshFromMeshParams bmesh_from_mesh_params = {
true, 0, 0, 0, {CD_MASK_ORIGINDEX, CD_MASK_ORIGINDEX, CD_MASK_ORIGINDEX}};
BMesh *bm = BKE_mesh_to_bmesh_ex(mesh, &bmesh_create_params, &bmesh_from_mesh_params);
BM_tag_vertices(bm, selection.data());
BM_mesh_decimate_unsubdivide_ex(bm, iterations, true);
Mesh *result = BKE_mesh_from_bmesh_for_eval_nomain(bm, NULL, mesh);
BM_mesh_free(bm);
result->runtime.cd_dirty_vert |= CD_MASK_NORMAL;
return result;
}
static void geo_node_unsubdivide_exec(GeoNodeExecParams params)
{
GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry");
const int iterations = params.extract_input<int>("Iterations");
if (iterations > 0 && geometry_set.has_mesh()) {
const MeshComponent &mesh_component = geometry_set.get_component_for_write<MeshComponent>();
const Mesh *input_mesh = mesh_component.get_for_read();
const bool default_selection = true;
GVArray_Typed<bool> selection_attribute = params.get_input_attribute<bool>(
"Selection", mesh_component, ATTR_DOMAIN_POINT, default_selection);
VArray_Span<bool> selection{selection_attribute};
Mesh *result = unsubdivide_mesh(iterations, selection, input_mesh);
if (result != input_mesh) {
geometry_set.replace_mesh(result);
}
}
params.set_output("Geometry", std::move(geometry_set));
}
} // namespace blender::nodes
void register_node_type_geo_unsubdivide()
{
static bNodeType ntype;
geo_node_type_base(&ntype, GEO_NODE_UNSUBDIVIDE, "Unsubdivide", NODE_CLASS_GEOMETRY, 0);
node_type_socket_templates(&ntype, geo_node_unsubdivide_in, geo_node_unsubdivide_out);
ntype.geometry_node_execute = blender::nodes::geo_node_unsubdivide_exec;
ntype.width = 165;
nodeRegisterType(&ntype);
}

View File

@@ -302,8 +302,8 @@ if(WITH_MOD_OCEANSIM)
add_definitions(-DWITH_OCEANSIM)
endif()
if(WITH_MOD_REMESH)
add_definitions(-DWITH_MOD_REMESH)
if(WITH_REMESH_DUALCON)
add_definitions(-DWITH_REMESH_DUALCON)
endif()
if(WITH_MOD_FLUID)

View File

@@ -253,7 +253,7 @@ static PyObject *make_builtopts_info(void)
SetObjIncref(Py_False);
#endif
#ifdef WITH_MOD_REMESH
#ifdef WITH_REMESH_DUALCON
SetObjIncref(Py_True);
#else
SetObjIncref(Py_False);