Commit Graph

128 Commits

Author SHA1 Message Date
Campbell Barton c434782e3a File headers: SPDX License migration
Use a shorter/simpler license convention, stops the header taking so
much space.

Follow the SPDX license specification: https://spdx.org/licenses

- C/C++/objc/objc++
- Python
- Shell Scripts
- CMake, GNUmakefile

While most of the source tree has been included

- `./extern/` was left out.
- `./intern/cycles` & `./intern/atomic` are also excluded because they
  use different header conventions.

doc/license/SPDX-license-identifiers.txt has been added to list SPDX all
used identifiers.

See P2788 for the script that automated these edits.

Reviewed By: brecht, mont29, sergey

Ref D14069
2022-02-11 09:14:36 +11:00
Campbell Barton ffc4c126f5 Cleanup: move public doc-strings into headers for 'blenkernel'
- Added space below non doc-string comments to make it clear
  these aren't comments for the symbols directly below them.
- Use doxy sections for some headers.
- Minor improvements to doc-strings.

Ref T92709
2021-12-07 17:38:48 +11:00
Campbell Barton 77e927b58f Cleanup: reserve C++ comments for disabled code
Use C comments for plain text.
2021-07-20 15:01:05 +10:00
Campbell Barton f1e4903854 Cleanup: full sentences in comments, improve comment formatting 2021-06-26 21:50:48 +10:00
Campbell Barton 4b9ff3cd42 Cleanup: comment blocks, trailing space in comments 2021-06-24 15:59:34 +10:00
Campbell Barton fea335fe8b Cleanup: spelling 2021-02-13 17:44:51 +11:00
Alexander Gavrilov e44e0e4e78 Cloth: add a vertex group setting to exclude from object collision.
This can be useful as a workaround on the boundary with the pinned
vertices in some situations among other things, and completely copies
the existing design of the self collision vertex group setting.

Differential Revision: https://developer.blender.org/D10043
2021-01-11 19:34:33 +03:00
Hans Goudey c3238bd500 Cleanup: Use DNA defaults for cloth modifier
Followup for rB8398050695
This requires moving a few enum definitions to DNA instead of BKE, and
adding default definitions for the two structs the cloth modifier where
the cloth modifier stores its settings. The defaults are also reordered
to be consistent with the order of each item in the struct.
2020-10-01 12:56:34 -05:00
Jacques Lucke 91694b9b58 Code Style: use "#pragma once" in source directory
This replaces header include guards with `#pragma once`.
A couple of include guards are not removed yet (e.g. `__RNA_TYPES_H__`),
because they are used in other places.

This patch has been generated by P1561 followed by `make format`.

Differential Revision: https://developer.blender.org/D8466
2020-08-07 09:50:34 +02:00
Germano Cavalcante 12817083ec Cleanup: Use the BLI_edgehash API in the sewing simulation of cloths
Also remove the code in the ghash that is no longer used.

This change simplifies the existing code.

Differential Revision: https://developer.blender.org/D8219
2020-07-06 14:44:30 -03:00
Alexander Gavrilov b1f9799508 Cloth: implement support for a hydrostatic pressure gradient.
When a fluid is put under influence of gravity or acceleration, it
forms an internal pressure gradient, which causes observable effects
like buoyancy. Since now cloth has support for simulating pressure
changes caused by fluid compression or expansion, it makes sense to
also support the effects of gravity.

This is intended for better simulation of objects filled or
surrounded by fluids, especially when constrained by collisions
or pinned vertices, and should result in more realistic shapes.

Obviously, this doesn't actually simulate fluid dynamics; instead
it is assumed that the fluid immediately adapts to changes in the
shape or acceleration of the object without friction or turbulence,
and instantly reaches a new static equilibrium.

Differential Revision: https://developer.blender.org/D6442
2020-06-12 18:19:40 +03:00
Dalai Felinto 2d1cce8331 Cleanup: `make format` after SortedIncludes change 2020-03-19 09:33:58 +01:00
Campbell Barton 60e3f690cb Cleanup: sort file lists & struct declatations 2020-03-14 15:39:59 +11:00
Jacques Lucke 5de56f9596 Cleanup: make remaining blenkernel headers work in C++ 2020-03-02 15:07:49 +01:00
Ish Bosamiya 5afa4b1dc8 Fix T65568: sewing and self collision issue
As explained in T65568 by @LucaRood, the self collision system should exclude triangles that are connected by sewing springs.

Differential Revision: https://developer.blender.org/D6911
2020-03-02 11:02:26 -03:00
Campbell Barton 5dcb6fb22f Cleanup: unused enums 2020-02-20 12:19:55 +11:00
Luca Rood d42a7bbd6e Integrate hair collisions with cloth collision
This integrates hair collisions with the new cloth collision system,
greatly improving reliability, and reducing the amount of hair-specific
code paths in the cloth code.

The removes all the point constraint based collision stuff, instead
implementing segment impulse based collisions, using the same collision
response code as the normal cloth solver.

The hair system can now also collide with the emitter if it is a
collision object.

Reviewed By: mano-wii, Sebastian Parborg

Differential Revision: https://developer.blender.org/D6545
2020-01-16 18:54:30 +01:00
Sebastian Parborg 62ef59aa0c Add the ability to create internal springs to the cloth sim
This can be used to make closed surfaces behave more like a soft body.

Reviewed By: Jacques Lucke

Differential Revision: http://developer.blender.org/D5788
2019-12-09 19:18:10 +01:00
Sebastian Parborg 541d0fdba6 Add cloth pressure vertex group and unlock cloth shrink values range
Introduced a way to specify cloth pressure force influence with a vertex
group. This will allow users to only have pressure affect certain parts
of the mesh.

In addition to this, the "shrink factor" is now also unlocked to allow
negative values and thus allowing the cloth mesh to grow as well.

Reviewed By: Jaques Lucke

Differential Revision: http://developer.blender.org/D6347
2019-12-04 11:30:14 +01:00
Sebastian Parborg f6cefbef22 Fix T30941: Add cloth air pressure simulation
This adds some basic simulation of internal air pressure inside of
closed cloth mesh objects.

Reviewed By: Jacques Lucke

Differential Revision: http://developer.blender.org/D5473
2019-11-27 15:01:15 +01:00
Campbell Barton 6eadd40597 Cleanup: redundant struct declarations 2019-08-25 16:45:47 +10:00
Campbell Barton 545610d3aa Cleanup: un-wrap lines in headers, use doxy comments 2019-06-26 12:44:22 +10:00
Campbell Barton e12c08e8d1 ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211.

For details on usage and instructions for migrating branches
without conflicts, see:

https://wiki.blender.org/wiki/Tools/ClangFormat
2019-04-17 06:21:24 +02:00
Campbell Barton 6470056a0d Cleanup: empty expression statement warning 2019-04-02 17:54:04 +11:00
Campbell Barton de13d0a80c doxygen: add newline after \file
While \file doesn't need an argument, it can't have another doxy
command after it.
2019-02-18 08:22:12 +11:00
Campbell Barton eef4077f18 Cleanup: remove redundant doxygen \file argument
Move \ingroup onto same line to be more compact and
make it clear the file is in the group.
2019-02-06 15:45:22 +11:00
Campbell Barton 4ef09cf937 Cleanup: remove author/date info from doxy headers 2019-02-02 11:58:24 +11:00
Campbell Barton 65ec7ec524 Cleanup: remove redundant, invalid info from headers
BF-admins agree to remove header information that isn't useful,
to reduce noise.

- BEGIN/END license blocks

  Developers should add non license comments as separate comment blocks.
  No need for separator text.

- Contributors

  This is often invalid, outdated or misleading
  especially when splitting files.

  It's more useful to git-blame to find out who has developed the code.

See P901 for script to perform these edits.
2019-02-02 01:36:28 +11:00
Campbell Barton c0f88ed8a8 Cleanup: sort forward declarations of enum & struct
Done using:
  source/tools/utils_maintenance/c_sort_blocks.py
2019-01-28 21:17:58 +11:00
Campbell Barton b8467273b8 Cleanup: redundant defines
Comment or remove unused defines.
2019-01-26 19:15:30 +11:00
Campbell Barton 756ac74f81 Cleanup: rename 'dm' -> 'me' for 'Mesh' types 2018-10-23 15:00:40 +11:00
Luca Rood 0666ece2e2 Cloth: Collision improvements
This commit includes several performance, stability, and reliability
improvements to cloth collisions.

Most notably:
* The implementation of a new self-collisions system.
* Multithreading of collision detection.
* Implementation of single sided collisions and normal overrides.
* Replacement of the `plNearestPoints` function from Bullet with a
dedicated solution.

Further, this also includes several bug fixes, and algorithmic
improvements.

Reviewed By: brecht

Differential Revision: http://developer.blender.org/D3712
2018-09-26 17:49:40 +02:00
Luca Rood c4ef2e2f2e Cloth: Improve UI
This reorganizes the cloth UI, and changes some of the behaviour to be
more reasonable.

Changes included here:
* Reorganized cloth panels
* Improved some tooltips
* Removed `vel_damping` option
* Removed cloth pinning checkbox
* Removed stiffness scaling checkbox
* Separated shrinking from sewing
* Separated self collisions from object collisions

Reviewed By: brecht

Differential Revision: http://developer.blender.org/D3691
2018-09-14 15:52:00 +02:00
Luca Rood b6f0f8a5b5 Cloth: Implement angular bending springs
This implements angular bending springs for cloth simulation. This also
adds shearing springs for n-gons.

This angular spring implementation does not include Jacobian matrices,
as the springs can exist between polygons of different vertex counts,
rendering their relationships asymmetrical, and thus impossible to solve
with the current implementation. This means that the bending component
is solved explicitly. However, this is usually not a big problem, as
bending springs contribute less to instability than structural springs.

The the old linear bending model can still be used, and is the default for
existing files, to keep compatibility. However, the new angular bending
model is the default for any new simulation.

This commit makes small breaking changes, in that shearing springs are
now created on n-gons (also in linear bending mode), while n-gons were
previously ignored.

Reviewed By: brecht

Differential Revision: http://developer.blender.org/D3662
2018-08-31 16:39:43 +02:00
Luca Rood e3d31b8dfb Cloth: Componentize forces
This separates cloth stiffness and damping forces into tension,
compression, and shearing components, allowing more control over the
cloth behaviour.

This also adds a bending model selector (although the new bending model
itself is not implemented in this commit). This is because some of the
features implemented here only make sense within the new bending model,
while the old model is kept for compatibility.

This commit makes non-breaking changes, and thus maintains full
compatibility with existing simulations.

Reviewed By: brecht

Differential Revision: http://developer.blender.org/D3655
2018-08-31 16:33:59 +02:00
Campbell Barton 18d87e79e9 Merge branch 'master' into blender2.8 2018-06-29 09:25:40 +02:00
Campbell Barton b372766816 Cleanup: trailing newlines 2018-06-29 09:23:51 +02:00
Brecht Van Lommel a99dcab148 Depsgraph: cache collision relations, for performance and stability.
Same reasoning as effector relations in earlier commit.
2018-06-25 13:35:41 +02:00
Sergey Sharybin fffe34531d Cloth: Move away from scene stored in cloth modifier data 2018-06-22 15:12:03 +02:00
Campbell Barton 06a1a66a9b Merge branch 'master' into blender2.8 2018-06-17 17:10:19 +02:00
Campbell Barton 6fc8a74886 Cleanup: trailing space for blenkernel 2018-06-17 17:05:51 +02:00
Sybren A. Stüvel f5d911f8b0 Modifiers: ported Cloth DerivedMesh → Mesh
The modifier is still quite slow; this could be due to caches being written
to a CoW datablock instead of the original one. More investigation is
needed.
2018-05-22 17:11:30 +02:00
Brecht Van Lommel 34ab90f546 Depsgraph: remove EvaluationContext, pass Depsgraph instead.
The depsgraph was always created within a fixed evaluation context. Passing
both risks the depsgraph and evaluation context not matching, and it
complicates the Python API where we'd have to expose both which is not so
easy to understand.

This also removes the global evaluation context in main, which assumed there
to be a single active scene and view layer.

Differential Revision: https://developer.blender.org/D3152
2018-04-16 19:55:33 +02:00
Campbell Barton 1c24c04e60 Remove workspace object mode, reverts changes w/ 2.8
This caused too many problems syncing object modes
with multiple objects/windows/workspaces, see: D3130 for details.
2018-04-05 18:21:14 +02:00
Campbell Barton ce0cb4de8d Object Mode: use eval_ctx for modifiers_isCorrectableDeformed
Some other minor changes from D3037 as well
2018-02-06 19:35:06 +11:00
Campbell Barton 1b462e5a51 Pass EvaluationContext instead of bContext
2.8x branch added bContext arg in many places,
pass eval-context instead since its not simple to reason about what
what nested functions do when they can access and change almost anything.

Also use const to prevent unexpected modifications.

This fixes crash loading files with shadows,
since off-screen buffers use a NULL context for rendering.
2017-08-16 12:46:04 +10:00
Luca Rood 1c4c288727 Pass EvaluationContext argument everywhere
Note that some little parts of code have been dissabled because eval_ctx
was not available there. This should be resolved once DerivedMesh is
replaced.
2017-07-21 14:47:26 +02:00
Luca Rood 4f4a484b9b Cloth refactor: Remove goal springs and some other cleanup
This removes the goal springs, in favor of simply calculating the goal forces on the vertices directly. The vertices already store all the necessary data for the goal forces, thus the springs were redundant, and just defined both ends as being the same vertex.

The main advantage of removing the goal springs, is an increase in flexibility, allowing us to much more nicely do some neat dynamic stuff with the goals/pins, such as animated vertex weights. But this also has the advantage of simpler code, and a slightly reduced memory footprint.

This also removes the `f`, `dfdx` and `dfdv` fields from the `ClothSpring` struct, as that data is only used by the solver, and is re-computed on each step, and thus does not need to be stored throughout the simulation.

Reviewers: sergey

Reviewed By: sergey

Tags: #physics

Differential Revision: https://developer.blender.org/D2514
2017-03-23 03:52:46 -03:00
Campbell Barton 7a4353160c Cloth: option to use dynamic base mesh
This adds the ability for cloth simulations to respect changes in the underlying mesh.
So you can for instance, animate shape keys, armatures, or add any deformation modifiers (above the cloth modifier).

This is mainly useful for (but not limited to) cartoon animations,
where your character might stretch or change shape, and you want the clothes to follow accordingly.

D1903 by @LucaRood
2016-07-30 14:57:48 +10:00
Alexander Gavrilov 2a9ddc808d Cloth: Change ClothVertex::xrest to actually store the rest position.
Originally the value was only needed when building the springs,
so a pointer to the input data was somewhat ok. However, recalculating
spring length dynamically requires keeping the actual value around.
2016-05-06 11:40:19 +03:00