Commit Graph

117 Commits

Author SHA1 Message Date
Campbell Barton 6f6a6ace39 Cleanup: redundant forward declarations of structs 2024-03-08 11:31:11 +11:00
Bastien Montagne 03c1cc4310 Cleanup: Move `BKE_lib_query` header to Cpp era. 2024-01-18 12:21:19 +01:00
Sybren A. Stüvel 562e9b9f4c Refactor: remove unused argument to `BKE_constraint_remove_ex()`
Remove the `bool clear_dep` argument of `BKE_constraint_remove_ex()`, as
it was always `true` on every call anyway.

No functional changes.
2023-12-04 17:13:47 +01:00
Campbell Barton 4fc5d287ac Cleanup: doxygen parameters, blank comment lines 2023-09-08 16:53:30 +10:00
Campbell Barton 0c26c84704 Cleanup: spelling in comments 2023-09-05 11:04:27 +10:00
Bastien Montagne b53c7a804a Readfile: Replace the 'lib_link' specific code by generic usage of foreach_id.
The `lib_link` callback cannot always be fully replaced/removed, as in
some case it is also doing some validation checks, or data editing based
on the result of lib_linking internal ID pointers.

The callback has been renamed for that purpose, from `read_lib` to
`read_after_liblink`. It is now called after all ID pointers have been
fully lib-linked for the current ID, but still before the call to
`do_versions_after_linking`.

This change should not have any behavioral effect. Although in theory
the side-effect of this commit (to split lib linking itself, and the
validation/further processing code) into two completely separated steps
could have some effects, in practice none are expected, and tests did
not show any changes in behavior either..

Part of implementing #105134: Removal of readfile's lib_link & expand code.
2023-08-24 16:33:31 +02:00
Bastien Montagne 8bb5916183 Readfile: Replace the 'expand' specific code by generic usage of foreach_id.
The `expand` callback is 'trivial' to replace, since it is only iterating
over ID pointers and calling a callback.

The only change in behavior here is that some pointers that were not
processed previously will now be.

In practice this is not expected to have any real effect (usually
the IDs used by these pointers would have been expanded through other
usages anyway). But it may solve a few corner cases, undocumented issues
though.

Part of implementing #105134: Removal of readfile's lib_link & expand code.
2023-08-23 16:44:56 +02:00
Bastien Montagne 709ec52c7d Core: foreach_id: Add a new callback flag to skip processing at readfile time.
In readfile context, some ID pointers have to be ignored: typically the
'owner_id' pointers of embedded data.

Currently unused, but required for replacing `blend_read_lib`/
`blend_read_expand` by `foreach_id` (#105666).
2023-08-22 22:17:04 +02:00
Bastien Montagne 7a0a406ff8 Core: foreach_id: add optional support for deprecated ID pointers.
This commit adds a new option flag to the lib_query foreach_id code,
which will make deprecated ID pointers to be processed as well.

NOTE: Currently there is no report to the callbakcs about the fact that
it is processing a deprecated ID. This can be easily added later if it
becomes necessary.

Part of implementing #105134: Removal of readfile's lib_link & expand code.
2023-08-22 17:47:57 +02:00
Bastien Montagne 695995d7cb Refactor: Move 'local data' liboverride flag clearing from 'lib_link' to 'read_data' code.
There is no reason to do that in the 'lib_link' stage of blendfile
reading, whether the owner ID is linked or local is already known info
at the 'read_data' stage of the process. And it is more logical to do
that in code affecting internal private data of an ID, rather than in
code handling updates of it ID pointers.

Note that the camera's baground image case was already handled in the
'read_data' stage.

No behavioral change expected here.
2023-08-14 16:45:18 +02:00
Aras Pranckevicius d973355b3a Cleanup: reduce amount of math-related includes
Using ClangBuildAnalyzer on the whole Blender build, it was pointing
out that BLI_math.h is the heaviest "header hub" (i.e. non tiny file
that is included a lot).

However, there's very little (actually zero) source files in Blender
that need "all the math" (base, colors, vectors, matrices,
quaternions, intersection, interpolation, statistics, solvers and
time). A common use case is source files needing just vectors, or
just vectors & matrices, or just colors etc. Actually, 181 files
were including the whole math thing without needing it at all.

This change removes BLI_math.h completely, and instead in all the
places that need it, includes BLI_math_vector.h or BLI_math_color.h
and so on.

Change from that:
- BLI_math_color.h was included 1399 times -> now 408 (took 114.0sec
  to parse -> now 36.3sec)
- BLI_simd.h 1403 -> 418 (109.7sec -> 34.9sec).

Full rebuild of Blender (Apple M1, Xcode, RelWithDebInfo) is not
affected much (342sec -> 334sec). Most of benefit would be when
someone's changing BLI_simd.h or BLI_math_color.h or similar files,
that now there's 3x fewer files result in a recompile.

Pull Request #110944
2023-08-10 14:51:40 +03:00
Campbell Barton cc892efcd4 Cleanup: use snake case, especially for structs that define callbacks
Use snake case for ShaderFxTypeInfo, ModifierTypeInfo,
GpencilModifierTypeInfo & bConstraintTypeInfo.
2023-07-27 12:21:06 +10:00
Campbell Barton ac9f66e742 Cleanup: correct struct member comments 2023-07-18 14:34:59 +10:00
Sergey Sharybin c1bc70b711 Cleanup: Add a copyright notice to files and use SPDX format
A lot of files were missing copyright field in the header and
the Blender Foundation contributed to them in a sense of bug
fixing and general maintenance.

This change makes it explicit that those files are at least
partially copyrighted by the Blender Foundation.

Note that this does not make it so the Blender Foundation is
the only holder of the copyright in those files, and developers
who do not have a signed contract with the foundation still
hold the copyright as well.

Another aspect of this change is using SPDX format for the
header. We already used it for the license specification,
and now we state it for the copyright as well, following the
FAQ:

    https://reuse.software/faq/
2023-05-31 16:19:06 +02:00
Campbell Barton 8bf9d482da Cleanup: colon after params, move text into public doc-strings, spelling 2022-06-30 23:48:22 +10:00
Alexander Gavrilov 4a7e1c9209 Constraints: rename and refactor custom space initialization.
Rename and simplify the function for initializing the custom space,
avoiding the need for the calling code to be aware of the internals
of bConstraintOb. This patch should not change any behavior.

This was split off from D9732.

Differential Revision: https://developer.blender.org/D15252
2022-06-30 12:51:26 +03:00
Alexander Gavrilov d040e1da4f Constraints: introduce wrapper functions to access target lists.
Instead of directly accessing constraint-specific callbacks
in code all over blender, introduce two wrappers to retrieve
and free the target list.

This incidentally revealed a place within the Collada exporter
in BCAnimationSampler.cpp that didn't clean up after retrieving
the targets, resulting in a small memory leak. Fixing this should
be the only functional change in this commit.

This was split off from D9732.

Differential Revision: https://developer.blender.org/D13844
2022-06-03 16:18:26 +03:00
Campbell Barton 427a2c920a Cleanup: spelling in comments, capitalize tags
Also add missing task-ID reference & remove colon after \note as it
doesn't render properly in doxygen.
2022-05-13 09:29:25 +10: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
Bastien Montagne e9fc25835f Remove internal proxy code, and deprecate related DNA data.
Part of T91671.

Not much else to say, this is mainly a massive deletion of code.

Note that a few cleanups possible after this proxy removal were kept out
of this commit to try to reduce a bit its size.

Reviewed By: sergey, brecht

Maniphest Tasks: T91671

Differential Revision: https://developer.blender.org/D13995
2022-02-04 09:30:44 +01:00
Sybren A. Stüvel f9aa6376f1 Cleanup: anim, remove `const` declarations from pass-by-value params
Remove `const` from pass-by-value parameters in function declarations.
The variables passed as parameters can never be modified by the function
anyway, so declaring them as `const` is meaningless. Having the
declaration there could confuse, especially as it suggests it does have
a meaning, training people to write meaningless code.
2022-01-06 11:41:03 +01: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
Henrik Dick d6891d9bee Add Extras Dropdown Menu to Constraints
Add Apply Constraint, Duplicate Constraint, and Copy To Selected
operators, and include them in a menu similar to the menu for modifiers.
The shortcuts in the extras menu are also matched to modifiers.

All the here added operators are intended to work exactly like the
analogous ones for modifiers. That means the apply operator should apply
a constraint as if it was first in the list, just like modifiers do. I
have added the same warning message as for modifiers when that happens.

The decision to use this approach of appling the constraint as if it was
first, was made for consistency with modifiers. People are already used
to how it works there. Is also provides more intricate control over the
applied transforms, then just applying all constraints up to that one.
Apply all constraints is already kinda implemented in Bake Animation.

Reviewed By: HooglyBoogly, sybren, #user_interface

Differential Revision: https://developer.blender.org/D10914
2021-08-12 14:24:27 +02:00
Campbell Barton 4b9ff3cd42 Cleanup: comment blocks, trailing space in comments 2021-06-24 15:59:34 +10:00
Campbell Barton a869a61c88 Cleanup: sort struct blocks 2020-12-16 16:26:23 +11:00
Bastien Montagne 682ccd770c LibOverride: Refactor collection items 'local' helper functions.
It's easier to read and less 'weird' to check that an item is non-local
in a liboverride data-block, than the other way around. Thanks to
@sybren for noticing it.
2020-12-08 09:40:42 +01:00
Bastien Montagne bab57550b6 LibOverride: Abstract a bit handling of local items of RNA collections.
RNA collections that support insertion of new items in liboverride
data-block need a special way to distiguish between locale and
orig-from-linked items (since some operations are allowed on the forer,
but no the latter).

In future we want a proper solution to abstract that at the
`BKE_lib_override` level, but for now we need to add some code for each
case.

Note that this commit also fixes a few potential issues with GPencil
modifiers, and constraints, regarding their handling of local overrides.
2020-12-07 16:55:51 +01:00
Henrik Dick a6c4e39876 Add Custom Object Space to Constraints
Add Custom Space to the list of space conversions for constraints.

Constraints can use World Space, Local Space, Pose Space, Local with
Parent, and now also Custom Space with a custom object to define the
evaluation space.

The Custom Space option uses the Local Space of an other
object/bone/vertex group. If selected on owner or target it will show a
box for object selection. If an armature is selected, then it will also
show a box for bone selection. If a mesh object is selected it will show
the option for using the local space of a vertex group.

Reviewed By: #animation_rigging, sybren, Severin, angavrilov

Differential Revision: https://developer.blender.org/D7437
2020-12-03 11:20:21 +01:00
Jacques Lucke 58e9b51f95 Refactor: move Constraint .blend I/O to blenkernel
Ref T76372.
2020-11-06 17:45:29 +01:00
Nathan Craddock 0e47e57eb7 Outliner: Properties editor sync on selection
When outliner datablocks are selected, switch to the corresponding tab
for that datablock in properties editors. Only properties editors
that share an edge with the outliner will change tabs.

Additionally, when modifiers, constraints, and shader effects are
selected from the outliner, the panel will be expanded in all properties
editors.

Part of T77408

Manifest Task: https://developer.blender.org/T63991

Differential Revision: https://developer.blender.org/D8638
2020-10-28 11:54:29 -06: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
Alexander Gavrilov 64a584b38a Python API: add methods to allow copying of constraints.
Blender has an operator to do Copy & Paste of constraints between
objects and bones, but no simple method to do that directly via
the Python API is provided. This adds a copy() method to object
and pose bone constraint collections.

Differential Revision: https://developer.blender.org/D8112
2020-06-25 12:10:18 +03:00
Hans Goudey a24cd69d78 Cleanup: Remove unused BKE_constraint functions 2020-06-19 13:21:39 -04:00
Hans Goudey eaa44afe70 UI: Drag and Drop Constraints, Layout Updates
This patch implements the list panel system D7490 for constraints.
In this case the panels are still defined in Python.

The layouts are also updated to use subpanels and the a more organized
single column layout. There may be more tweaks necessary for the
layouts.

Reviewed By: Severin, billreynish, Mets

Differential Revision: https://developer.blender.org/D7499
2020-06-19 12:40:48 -04:00
Sybren A. Stüvel f881162f81 Revert "Constraints: remove special meaning of Local Space for parentless Objects."
This reverts commit 7728bfd4c4.

Although this brings back an inconsistency in the behaviour of
constraints on objects and bones, people were relying on the old
behaviour, and the new behaviour broke their files.

It is still desired to remove this inconsistency, but it will happen
more gradually.
2020-03-09 10:44:55 +01:00
Alexander Gavrilov 7728bfd4c4 Constraints: remove special meaning of Local Space for parentless Objects.
In 2011 special handling was introduced, apparently for no other
reason than to address a complaint in T25707 that World and Local
space are equivalent for objects without parent. This causes issues
and confusion, as mentioned in rB599c8a2c8e4.

This special meaning of Local Space is not documented in the manual,
and is not known to experienced riggers, so removing it should not
be a problem.

Differential Revision: https://developer.blender.org/D6095
2019-11-06 15:36:05 +03:00
Campbell Barton aa42da0385 Cleanup: comments (long lines) in blenkernel 2019-04-27 12:07:07 +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 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 a1d73d03eb Cleanup: move comments above definitions
For clang-format not to wrap definitions.
2019-01-14 16:20:55 +11:00
Alexander Gavrilov 5c27c76ed3 Depsgraph: fix relations for drivers on bone weight in Armature constraint. 2018-11-14 14:01:40 +03:00
Alexander Gavrilov 798cdaeeb6 Implement an Armature constraint that mimics the modifier.
The main use one can imagine for this is adding tweak controls to
parts of a model that are already deformed by multiple other major
bones. It is natural to expect such locations to deform as if the
tweaks aren't there by default; however currently there is no easy
way to make a bone follow multiple other bones.

This adds a new constraint that implements the math behind the Armature
modifier, with support for explicit weights, bone envelopes, and dual
quaternion blending. It can also access bones from multiple armatures
at the same time (mainly because it's easier to code it that way.)

This also fixes dquat_to_mat4, which wasn't used anywhere before.

Differential Revision: https://developer.blender.org/D3664
2018-11-06 10:56:08 +03:00
Campbell Barton ae57383648 Cleanup: comment blocks 2018-09-02 18:28:27 +10: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