Commit Graph

118 Commits

Author SHA1 Message Date
Hans Goudey ea5bfedb49 Cleanup: Further use of const for retrieved custom data layers
Similar to cf69652618.
2022-05-14 18:57:52 +02:00
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 3d3bc74884 Cleanup: remove redundant const qualifiers for POD types
MSVC used to warn about const mismatch for arguments passed by value.
Remove these as newer versions of MSVC no longer show this warning.
2022-01-07 14:16:26 +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 4b9ff3cd42 Cleanup: comment blocks, trailing space in comments 2021-06-24 15:59:34 +10:00
Jacques Lucke 150a1d158a Cleanup: remove some forward declared enums
Forward declaring enums are not allowed in C++.

Differential Revision: https://developer.blender.org/D9811
2020-12-11 11:48:58 +01:00
Sergey Sharybin 17381c7b90 Multires: Remove simple subdivision type
The simple subdivision as a type only causes issues like no-continuous
normals across edges, inability to reliably switch the type and things
like this.

The new subdivision operators supports wider variety of how to add
details to the model, which are more powerful than a single one-time
decision on the subdivision type.

The versioning code is adjusting topology converter to specify all
edges as infinitely sharp. The reason for this (instead of using
settings.is_simple) is because in a longer term the simple subdivision
will be removed from Subsurf modifier as well, and will be replaced
with more efficient bmesh-based modifier.

This is finished up version of D8436.

Differential Revision: https://developer.blender.org/D9350
2020-10-27 10:31:48 +01:00
Sergey Sharybin dea3b8d984 Multires: Remove legacy subdivision code
Is no longer used, fully replaced with more powerful algorithm.
2020-10-22 12:41:18 +02:00
Sergey Sharybin d11e357824 Multires: Remove legacy compatibility code
It was rather a huge chunk of code, which started to become
more harder to maintain with the transition to OpenSubdiv based
implementation. Because of this transition, the compatibility was
also rather on a poor side.

Remove compatibility support for pre-2.50.9 multires.

Ref T77107

Reviewed By: brecht, mont29

Differential Revision: https://developer.blender.org/D9238
2020-10-22 12:15:57 +02:00
Sebastian Parborg 2115232a16 Cleanup: Clang-Tidy readability-inconsistent-declaration-parameter-name fix
No functional changes
2020-09-04 21:04:16 +02: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
Campbell Barton 00e99959d3 Cleanup: double-spaces in comments 2020-05-09 17:15:43 +10:00
Pablo Dobarro 134619fabb Multires: Subdivide Simple and Subdivide Linear
This introduces two alternative subdivision modes that generates
displacement on the grids that look as Simple subdivisions but while
using the Catmull-Clark subdivision type in the modifier. This way,
Simple and Catmull-Clark subdivision can be combined when creating new
levels if needed, for example, to sculpt hard surface objects.

Subdivide simple smooths the sculpted data when creating a new
subdivision level. Subdivide linear also preserves the sharpness
in the sculpted data.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D7415
2020-04-30 16:57:29 +02:00
Pablo Dobarro f28875a998 Multires: Unsubdivide and Rebuild Subdivisions
This implements the main unsubdivide algorithm which rebuilds a base mesh and extracts the grid's data from a high resolution mesh.
It includes the Rebuild Subdivisions operator, which generates all subdivision levels down to the level 0 base mesh.

It supports:
- Rebuilding an arbitrary number of levels (Unsubdivide) or as many levels as possible down to level 0 in a single step (Rebuild Subdivisions).
- Rebuilding with already existing grids.
- Meshes with n-gons and triangles
- Meshes with more than 2 faces per edge
- Base mesh made completely out of triangles
- Meshes without poles
- Meshes with multiple disconnected elements at the same subdivision level

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D7372
2020-04-30 16:49:56 +02:00
Pablo Dobarro d4c547b7bd Multires: Enable sculpting in all subdivision levels
Return the correct sculpt level in BKE_multires_sculpt_level_get and
enable the property in the UI

Reviewed By: sergey

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

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

Reviewed By: Brecht van Lommel

Differential Revision: https://developer.blender.org/D7163
2020-03-26 15:34:53 +01:00
Campbell Barton ed4c47632f Cleanup: spelling 2020-03-19 12:09:07 +11:00
Sergey Sharybin f958560a99 Multires: Properly support virtual modifiers for Apply Base
The initial code from earlier from today didn't really work reliable
since it is not possible to apply virtual modifiers but not the real
multires one (in a situation like mesh with shapekeys and multires).

New code uses less memory and has better performance for the case
when there are actual modifiers leading the multires. The case when
there is only multires will not be as performant as possible at this
moment.
2020-03-17 17:40:54 +01:00
Sergey Sharybin 628d799c85 Multires: Add utility to create deformed base mesh
The new function will use original object as a starting point
and apply all enabled deformation modifiers prior to the multires.
2020-03-17 16:41:43 +01:00
Sergey Sharybin a45c34ae8e Multires: Cleanup, argument naming and order
Use full argument name.

Also order arguments in the generosity order: from depsgraph
(which has everything) to object (which contains multires)
specific multires modifier.
2020-03-17 16:41:43 +01:00
Sergey Sharybin 17abae45f1 Multires: Cleanup, remove redundant argument
Scene can be queried from the dependency graph.
2020-03-17 16:41:43 +01:00
Sergey Sharybin de30fda04e Fix T74686: Loading btx file in multires modifier is not working
Was happening when object does not have CD_MDISPS allocated yet.
Need to make sure totdisp and level is specified on CD_MDISPS data
prior to loading (as the load expects them to be properly set).
2020-03-13 16:15:31 +01:00
Sergey Sharybin bc0a0cdf17 Multires: Fix Subdivide, Reshape and Apply Base
This change fixes artifacts produced by these operations.

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

The next step is to get sculpting on a non-top level to work, and
that actually requires fixes in the undo system.
2020-03-13 14:14:56 +01:00
Jacques Lucke 5de56f9596 Cleanup: make remaining blenkernel headers work in C++ 2020-03-02 15:07:49 +01:00
Sergey Sharybin feead324fd Multires: Cleanup, naming 2020-02-28 12:24:26 +01:00
Sergey Sharybin fe86375d1c Force sculpting on highest multires level
This is a workaround for T58473 to avoid likely event of ruining
sculpted data.

Differential Revision: https://developer.blender.org/D6244
2019-11-13 17:15:54 +01:00
Brecht Van Lommel 3009429c90 Fix T69809, T69810: sculpt gone or crashing after render
Make a distinction between flush sculpt changes for rendering, and forcing
sculpt data structures to be rebuilt after mesh changes. Also don't use PBVH
for renders.
2019-09-17 19:20:08 +02:00
Sergey Sharybin 89c762dd99 Fix T57652: Multires undo broken with shared object data 2019-07-09 12:12:54 +02: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 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 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
Sergey Sharybin 02f86482b4 Multires: Simplify reshaping code
The idea is to run reshaping for every boundary vertex
of a grid rather than trying to copy boundary grid
elements.

While this is somewhat slower, this avoids all this
tangent flipping magic, which tempts to be rather tricky
and fragile.
2019-01-18 12:29:53 +01:00
Campbell Barton 88a80fcec8 Cleanup: commas at the end of enums
Without this clang-format may wrap them onto a single line.
2019-01-16 00:03:03 +11:00
Campbell Barton 5681631109 Cleanup: ensure header guards come first
Causes clang-format not to detect header guards,
indenting all preprocessor lines in the header.
2019-01-10 08:46:38 +11:00
Sergey Sharybin 92a47e3b53 Multires: Cleanup, remove unused function 2018-11-20 10:34:01 +01:00
Sergey Sharybin a0e82342d7 Multires: Cleanup, naming
First of all, follow our naming convention to use module prefix.

Second of all, mesh is being created and is to be freed, we also
have convention for such function names.
2018-11-02 13:59:04 +01:00
Sergey Sharybin d710cb91b9 Subdiv: Cleanup, de-duplicate tangent matrix calculation 2018-11-01 15:20:50 +01:00
Sergey Sharybin 43c4d0bf23 Multires: Pass total level instead of modifier data
This is the only thing which needs to be done to perform propoer
reshape. Makes it easier to re-use code from other places.
2018-09-25 09:58:40 +02:00
Sergey Sharybin a933293f11 Multires: Pass mesh instead of object
There is nothing we need from object in this case.
2018-09-25 09:38:23 +02:00
Sergey Sharybin 12372e8d8b Multires: Support sculpting on a lover levels
Added propagation of displacement to a higher levels.

Has the same limitation as reshape from object, which makes
grids somewhat choppy due to linear interpolation nature.

This is to be addressed next.
2018-09-21 11:43:42 +02:00
Sergey Sharybin 8e8952b7e3 Multires: Initial work to get sculpting to work with OpenSubdiv
Allows to go to sculpt mode, do brush strokes, get out of sculpt mode
and have deformation preserved.

The issues currently is that the current implementation of CCG
storage is created from the limit surface, without displacement
taken into account. It is trivial to get displaced coordinates,
but it is more tricky to get displaced normals. This is something
to be solved next.

Another limitation is that this only works for sculpting at a maximal
multires level. There is code to be done to support propagation
of displacement onto a higher levels.
2018-09-14 14:43:56 +02:00
Sergey Sharybin 61462ab2b4 Multires: Use more clear naming
There are so many reshapes now, and one more is to come.
Better be explicit.
2018-09-12 16:31:04 +02:00
Sergey Sharybin 564a378bd1 Multires: Remove another unused argument from reshape function 2018-08-22 16:59:00 +02:00
Sergey Sharybin 6a681981e4 Multires: Fix reshape when active level is lower than the total one 2018-08-22 16:07:57 +02:00
Sergey Sharybin 9dd279cbdf Multires: Remove unused function argument 2018-08-22 16:07:57 +02:00
Sergey Sharybin 9e11b8e249 Multires: implement reshape operation
The one which is used by applying deformation modifiers on the multires.
2018-08-22 10:21:45 +02:00
Sergey Sharybin 50cb9b52bb Multires: Implement function to get mesh at multires position of stack 2018-08-16 14:42:06 +02:00
Sergey Sharybin 642c6d2fc9 Multires: Cleanup, naming and bool type 2018-08-16 14:42:06 +02:00