Commit Graph

98 Commits

Author SHA1 Message Date
Campbell Barton d5d1025e94 Cleanup: use const pointer arguments 2024-04-03 10:22:05 +11:00
Hans Goudey 99f9084bee Cleanup: Replace some CLAMP macros with C++ functions
Pull Request: https://projects.blender.org/blender/blender/pulls/117460
2024-01-23 21:10:33 +01:00
Campbell Barton e955c94ed3 License Headers: Set copyright to "Blender Authors", add AUTHORS
Listing the "Blender Foundation" as copyright holder implied the Blender
Foundation holds copyright to files which may include work from many
developers.

While keeping copyright on headers makes sense for isolated libraries,
Blender's own code may be refactored or moved between files in a way
that makes the per file copyright holders less meaningful.

Copyright references to the "Blender Foundation" have been replaced with
"Blender Authors", with the exception of `./extern/` since these this
contains libraries which are more isolated, any changed to license
headers there can be handled on a case-by-case basis.

Some directories in `./intern/` have also been excluded:

- `./intern/cycles/` it's own `AUTHORS` file is planned.
- `./intern/opensubdiv/`.

An "AUTHORS" file has been added, using the chromium projects authors
file as a template.

Design task: #110784

Ref !110783.
2023-08-16 00:20:26 +10:00
Campbell Barton 52acf6a6ec Cleanup: correct file names in comments after C -> C++ renaming
Use back-tick quotes to differentiate these from plain text.
2023-07-31 13:02:30 +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
Sergey Sharybin a12a8a71bb Remove "All Rights Reserved" from Blender Foundation copyright code
The goal is to solve confusion of the "All rights reserved" for licensing
code under an open-source license.

The phrase "All rights reserved" comes from a historical convention that
required this phrase for the copyright protection to apply. This convention
is no longer relevant.

However, even though the phrase has no meaning in establishing the copyright
it has not lost meaning in terms of licensing.

This change makes it so code under the Blender Foundation copyright does
not use "all rights reserved". This is also how the GPL license itself
states how to apply it to the source code:

    <one line to give the program's name and a brief idea of what it does.>
    Copyright (C) <year>  <name of author>

    This program is free software ...

This change does not change copyright notice in cases when the copyright
is dual (BF and an author), or just an author of the code. It also does
mot change copyright which is inherited from NaN Holding BV as it needs
some further investigation about what is the proper way to handle it.
2023-03-30 10:51:59 +02:00
Campbell Barton 0ef96cd392 Cleanup: ensure space after file named in headers
Add blank lines after file references to avoid them being interpreted as
doc-strings the following declarations.
2022-04-04 13:34:42 +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
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 606805d1b7 Cleanup: use 'r_' prefix for return arguments, order last 2021-02-05 22:34:03 +11:00
Bastien Montagne df5fe9718b Cleanup: Remove `BKE_mask_copy_nolib()` and `BKE_mask_free()`.
Generic ID management code can now do those local temp copy handling, so
no need for duplicated own code for that.

No behavioral changes expected here.
2020-10-08 11:40:55 +02:00
Bastien Montagne 253dbe71dc Refactor: remove `BKE_<id_type>_copy` functions.
Those were only shallow wrappers around `BKE_id_copy`, barely used (even
fully unused in some cases), and we want to get rid of those ID-specific
helpers for the common ID management tasks. Also prevents weird custom
behaviors (like `BKE_object_copy`, who was the only basic ID copy
function to reset user count of the new copy to zero).

Part of 71219.
2020-10-07 18:05:06 +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 9fe0505db0 Cleanup: macro hygiene, parenthesize arguments 2020-04-05 13:53:32 +10:00
Campbell Barton 1587eb16d8 Cleanup: use const to for some mask arguments 2020-03-25 19:32:44 +11:00
Bastien Montagne dab1d14a51 Cleanup: Mask: Move to IDTypeInfo and remove unused BKE API. 2020-03-09 16:56:53 +01:00
Bastien Montagne 4bfa256ea4 Refactor ID make local to use a single flag parameter.
Instead of using anonymous booleans flags, also allows to keep the same
behavior in all cases, without needing special handling from calling
code for our beloved oddballs object proxies...
2020-03-04 11:43:31 +01:00
Jacques Lucke 5de56f9596 Cleanup: make remaining blenkernel headers work in C++ 2020-03-02 15:07:49 +01:00
Campbell Barton 6eadd40597 Cleanup: redundant struct declarations 2019-08-25 16:45:47 +10:00
Sybren A. Stüvel 42798a5ca1 Fix T67516 VSE: Animation evaluated incorrectly when scene strip present
The calls to `BKE_animsys_evaluate_all_animation()` and
`BKE_mask_evaluate_all_masks()` used the wrong timecode to evaluate the
animation system. This happened:

- Sequencer in scene A was rendered at frame X.
- Scene strip for scene B which should be evaluated at frame Y.
- BKE_animsys_evaluate_all_animation() was called with frame Y, which
  also re-evaluated the animation data in scene A.
- Other sequencer strips with animated values were then evaluated for
  frame Y and not frame X.

Since the depsgraph for rendering the scene strip is already OK and does
its job, it's no longer necessary to re-evaluate all the animation in
this way.

Removed `BKE_mask_evaluate_all_masks()` because it's no longer used.

Reviewers: sergey, brecht, iss

Differential Revision: https://developer.blender.org/D5394
2019-08-13 16:38:22 +02:00
Sergey Sharybin fec9615ea0 Masks: Properly port to Copy-on-Write concept
Masks were not really covered by Copy-on-Write due to mistake
in the dependency graph. After correcting that mistake a lot
of tools became broken, so majority of the patch is related
on making it so access to evaluated/tessellated masks is done.

When accessing evaluated mask state make sure access to an
evaluated dependency graph is done. This solves possible
access to NULL data on redo.

Fixes T64899: Re-doing new point addition causes crash

Reviewers: brecht

Reviewed By: brecht

Maniphest Tasks: T64899

Differential Revision: https://developer.blender.org/D4918
2019-05-23 09:47:13 +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
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
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
Sergey Sharybin 84c5ccca74 Masks: Remove unused function
It was used by old dependency graph. New one does things differently.
2017-12-13 16:14:08 +01:00
Sergey Sharybin 09c6c6c486 Fix T52749: New Depsgraph - Render View Mask is not initialized correctly 2017-09-14 16:12:01 +05:00
Sergey Sharybin 3573f49bfd Masks: Split layer evaluation into separate function
This way we can easily re-use bits of code for new dependency graph.

Currently should be no functional changes.
2017-09-14 16:09:06 +05:00
Bastien Montagne 9da7dfa158 Refactor ID copying (and to some extent, ID freeing).
This will allow much finer controll over how we copy data-blocks, from
full copy in Main database, to "lighter" ones (out of Main, inside an
already allocated datablock, etc.).

This commit also transfers a llot of what was previously handled by
per-ID-type custom code to generic ID handling code in BKE_library.
Hopefully will avoid in future inconsistencies and missing bits we had
all over the codebase in the past.

It also adds missing copying handling for a few types, most notably
Scene (which where using a fully customized handling previously).

Note that the type of allocation used during copying (regular in Main,
allocated but outside of Main, or not allocated by ID handling code at
all) is stored in ID's, which allows to handle them correctly when
freeing. This needs to be taken care of with caution when doing 'weird'
unusual things with ID copying and/or allocation!

As a final note, while rather noisy, this commit will hopefully not
break too much existing branches, old 'API' has been kept for the main
part, as a wrapper around new code. Cleaning it up will happen later.

Design task : T51804
Phab Diff: D2714
2017-08-07 16:39:55 +02:00
Bastien Montagne eeb9e5316a Make whole ID copying code use const source pointer.
Noisy change, but safe, and better do it sooner than later if we are to
rework copying code. Also, previous commit shows this *is* useful to
catch some mistakes.
2017-06-14 22:38:11 +02:00
Bastien Montagne b156674251 Fix missing datablocks types in id_make_local.
Adding make_local for vfont/gpencil/group/freestyle linestyle/mask/scene/sound/text.

Note that there are still some lose ends here, since some type are not handled by id_copy
(Scene, Sound and VFont), which means in case a datablock of that type is used both
directly and indirectly, localization will fail.

Scene copying might be doable though (maybe with a simple new 'full shalow' mode to existing BKE_scene_copy?),
not sure about sounds and vfonts... Situations where this becomes an issue should be very rare corner cases anyway.
2016-07-21 16:54:36 +02:00
Bastien Montagne 87b974caa1 Cleanup/Refactor: pass Main pointer to all ID copy functions.
Also allows us to get rid of a few _copy_ex() versions...
2016-07-10 14:52:00 +02:00
Bastien Montagne 897e97f078 ID-Remap - Step one: core work (cleanup and rework of generic ID datablock handling).
This commit changes a lot of how IDs are handled internally, especially the unlinking/freeing
processes. So far, this was very fuzy, to summarize cleanly deleting or replacing a datablock
was pretty much impossible, except for a few special cases.

Also, unlinking was handled by each datatype, in a rather messy and prone-to-errors way (quite
a few ID usages were missed or wrongly handled that way).

One of the main goal of id-remap branch was to cleanup this, and fatorize ID links handling
by using library_query utils to allow generic handling of those, which is now the case
(now, generic ID links handling is only "knwon" from readfile.c and library_query.c).

This commit also adds backends to allow live replacement and deletion of datablocks in Blender
(so-called 'remapping' process, where we replace all usages of a given ID pointer by a new one,
or NULL one in case of unlinking).

This will allow nice new features, like ability to easily reload or relocate libraries, real immediate
deletion of datablocks in blender, replacement of one datablock by another, etc.
Some of those are for next commits.

A word of warning: this commit is highly risky, because it affects potentially a lot in Blender core.
Though it was tested rather deeply, being totally impossible to check all possible ID usage cases,
it's likely there are some remaining issues and bugs in new code... Please report them! ;)

Review task: D2027 (https://developer.blender.org/D2027).
Reviewed by campbellbarton, thanks a bunch.
2016-06-22 17:53:50 +02:00
Campbell Barton 9bd51735a1 Cleanup: use const, duplicate header 2016-04-27 13:12:55 +10:00
Antony Riakiotakis 5114637967 Fix T45016, mask animation data lost after layer rename
We need to fix up animation data.
2015-06-11 19:34:21 +02:00
Sergey Sharybin 5e4f789173 Code cleanup: use false/true/bool for masking 2014-03-31 15:23:27 +06:00
Sergey Sharybin 1af69b6df3 Implement asymmetric and free handles type for masks
Summary:
The title actually says it all, it's just possible to
have independent free handles for mask splines. Also
it's now possible to have aligned handles displayed
as independent handles.

Required changes in quite a few places, but they're
rather straightforward.

From user perspective there's one really visible change
which is removed Handle Type menu from the panel. With
asymmetric handles it's not clear which handle type to
display there. So now the only way to change handle type
is via V-key menu.

Rewrote normal evaluation function to make it deal
with new type of handles we support. Now it works in
the following way:

- Offset the original spline by maximal weight
- Calculate vector between corresponding U positions
  on offset and original spline
- Normalize this vector.

Seems to be giving more adequate results and doesn't
tend to self-intersect as much as old behavior used to,

There're still some changes which needed to be done, but
which are planned for further patch:

- Support colors and handle size via themes.
- Make handles color-coded, just the same as done for
  regular bezier splines in 3D viewport.

Additional changes to make roto workflow even better:
- Use circles to draw handles
- Support AA for handles
- Change click-create-drag to change curvature of the
  spline instead of adjusting point position.

Reviewers: campbellbarton

CC: sebastian_k, hype, cronk

Differential Revision: http://developer.blender.org/D121
2014-03-28 17:54:38 +06:00
Campbell Barton d900f5be55 Code cleanup: use bools where possible 2014-02-03 19:35:44 +11:00
Sergey Sharybin 1d12c3fd53 Implement clipboard for mask splines
So now it's possible to copy-paste splines between layers.

Implementation is pretty much straightforward and duplicates
some logic which we've got in sequencer/tracking clipboards.

Will work on a common routine for clipboards later, for now
it's not so much crucial to have.
2014-01-27 15:42:46 +06:00
Sergey Sharybin 8632aab88d Remove TODO. Those args could be useful in the future. 2013-12-27 18:34:36 +06:00
Sergey Sharybin 39daf283ae Don't use with_resol suffix for functions which doesn't get resolution 2013-12-20 16:00:05 +06:00
Sergey Sharybin b54ac21622 Code cleanup: remove unused functions from mask module
This functions doesn't seem to be used even from a commented code.
2013-12-20 15:47:19 +06:00
Campbell Barton 4fcd8b64da Code Cleanup: remove redundant/misleading NULL checks 2013-12-03 09:22:29 +11:00
Emanuel Claesson 3ca4387bc8 UI: remove unnecessary confirmation popups
This makes a number of operators no longer ask for confirmation, rather it will
show an info message after performing the operation. Ref T37422 for decision. In
particular, these were changed:

* Delete objects, bones, keyframes, masks, mask curves, motion tracks, markers.
* Clear and delete keyframes in the 3D view.
* Align bone to parents.
* Separate bones from armature.
* Group/ungroup metastrips in sequencer.
* Copy/paste objects to/from buffer.

Reviewed By: brecht, dingto

Differential Revision: http://developer.blender.org/D35
2013-11-25 12:21:45 +01:00
Campbell Barton 3b91a77c7d code cleanup: typo in function name 2013-11-04 11:27:11 +00:00