Commit Graph

42 Commits

Author SHA1 Message Date
Campbell Barton d5d1025e94 Cleanup: use const pointer arguments 2024-04-03 10:22:05 +11:00
Hans Goudey a1792e98a4 Cleanup: Use std::string for RNA path functions
Use an optional string instead of a manually allocated char pointer.
Optional is used because sometimes `nullptr` was returned. It's
still inconsistent though, because often "" or ".." was returned
instead.
2024-01-31 13:00:28 -05: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
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 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
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
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
Bastien Montagne 4d0d43ce8e Cleanup: FreestyleLineStyle: 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
Campbell Barton 6eadd40597 Cleanup: redundant struct declarations 2019-08-25 16:45:47 +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 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
Brecht Van Lommel 67b014af48 Workspaces: active view layer now always comes from workspace, not scene.
Both the scene and workspace had an active view layer, and it was confusing
which settings were being used or displayed where. Now we always have one,
so there is no mismatch.

The "View Layers" tab in the properties editor is now "View Layer", no longer
showing a list of layers. Instead view layers can be added and removed with
the workspace view layer selector. They are also listed and selectable in the
outliner.

Single layer rendering uses the active view layer from the workspace.

This fixes bugs where the wrong active view layer was used, but more places
remain that are wrong and are now using the first view layer in the scene.
These are all marked with BKE_view_layer_context_active_PLACEHOLDER.
2018-04-26 17:06:14 +02:00
Bastien Montagne 41830cc432 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 20:34:36 +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
Julian Eisel 572bc1364c BLI_listbase: Add/use utility to move link (BLI_listbase_link_move)
We were calling BLI_remlink and then BLI_insertlinkbefore/after quite often. BLI_listbase_link_move simplifies code a bit and makes it easier to follow. It also returns if link position has changed which can be used to avoid unnecessary updates.

Added it to a number of list reorder operators for now and made use of return value. Behavior shouldn't be changed.

Also some minor cleanup.
2016-09-18 21:44:42 +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 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
Bastien Montagne e5916187e8 First step to handle missing libs/datablocks when reading a file.
Idea is, instead of ignoring completely missing linked datablocks, to
create void placeholders for them.

That way, you can work on your file, save it, and find again your missing data once
lib becomes available again. Or you can edit missing lib's path (in Outliner),
save and reload the file, and you are done.

Also, Outliner now shows broken libraries (and placeholders) with a 'broken lib' icon.

Future plans are also to be able to relocate missing libs and reload them at runtime.

Code notes:
    - Placeholder ID is just a regular datablock of same type as expected linked one,
      with 'default' data, and a LIB_MISSING bitflag set.
    - To allow creation of such datablocks, creation of datablocks in BKE was split in two step:
        + Allocation of memory itself.
        + Setting of all internal data to default values.

See also the design task (T43351).

Reviewed by @campbellbarton, thanks a bunch!

Differential Revision: https://developer.blender.org/D1394
2015-10-20 14:44:57 +02:00
Campbell Barton 2a2bf3c1ab Freestyle: pass Main struct to new/copy 2015-03-19 14:34:14 +11:00
Tamito Kajiyama 4fc2b8dcc6 Added BKE_linestyle_use_textures() to check if stroke textures are enabled. 2014-08-12 10:10:32 +09:00
Tamito Kajiyama cb75f79b8a Freestyle: Add BKE_linestyle_default_shader() for creating the default line style shader node tree.
Changes to ED_node_shader_default() were reverted since the code there was actually
not suitable for setting up the default line style node tree properly.
2014-08-12 10:10:22 +09:00
Tamito Kajiyama a798e01dc3 Follow-up to code cleanup in rB415af0b: Keep compound terms as they are. 2014-07-17 09:23:30 +09:00
Campbell Barton 415af0bec8 Cleanup: Adhere to our naming convention for BKE_linestyle.h API 2014-07-16 15:13:40 +10:00
Tamito Kajiyama 647969f9b6 Renamed CTX_data_linestyle_from_scene() to BKE_get_linestyle_from_scene().
The function is to retrieve the active line style ID datablock from a scene and
there is nothing related to bContext.
2014-07-16 13:38:58 +09:00
Tamito Kajiyama a31962287a Freestyle: Added .new() and .remove() methods to collection types of line style modifiers. 2014-05-13 16:18:28 +09:00
Tamito Kajiyama 62cede96d3 A major code update for making the DNA file specification of Freestyle settings
and RNA for it independent of the build flag for enabling Freestyle.  Suggested
by Sergey Sharybin through a code review of the branch.

* Many #ifdef WITH_FREESTYLE blocks were removed to always have Freestyle-specific
DNA file specification and RNA for it built in Blender.  This will allow Freestyle
setting survive even when a non-Freestyle build is used for loading and saving
files.  It is noted that operations are still conditionally built through #ifdef
WITH_FREESTYLE blocks.

* To this end, new blenkernel files BKE_freestyle.h and intern/freestyle.c have
been added.  All API functions in FRS_freestyle_config.h as well as some of those
in FRS_freestyle.h were moved to the new files.  Now the relocated API functions
have BKE_ prefix instead of FRS_.
2013-03-23 03:00:37 +00:00
Tamito Kajiyama a462d69bbf Another big patch set by Bastien Montagne, thanks a lot!
* Made Freestyle optional (turned on by default).

* Fix for missing bpath.c updates in the previous merge of trunk changes.
2012-12-20 07:57:26 +00:00
Tamito Kajiyama 53d845ba69 A big cleaning patch by Bastien Montagne (thanks a lot!)
* Split and moved Cycles’ render layers panels into the render_layer
context as well (would be nice to hide this context when not needed,
e.g. with the BGE, but this is not so easy to do nicely...).

* Fixed some inconsistencies with trunk (probably due to svn merge
glitches) using r52858 as reference.  Also recovered the missing
release/bin/blender-softwaregl file.

* A bunch of style code fixes in Blender's own code (not Freestyle
itself yet): line lengths, spaces around operators, block formatting,
headers, etc.  In rna_linestyle.c, color_blend_items was replaced by
ramp_blend_items (exported from rna_material.c).
2012-12-11 22:00:22 +00:00
Tamito Kajiyama 3c4987f983 Fix for a number of compiler warnings as well as a bug hidden by the warnings.
Patch contribution by Bastien Montagne, thanks!
2012-12-08 22:24:41 +00:00
Tamito Kajiyama 624e91a77a Implemented a button to make a single-user copy of a line style. 2011-11-14 00:43:37 +00:00
Tamito Kajiyama 6bc5d5258f Stroke geometry modifiers
Added a set of stroke geometry modifiers to the Geometry tab of line styles
in the Parameter Editor mode.  Now the following stroke geometry modifiers are
available, each with a set of animateable parameters:
- Sampling: changes the resolution of stroke backbone polylines.
- Bezier Curve: replace stroke backbone with a Bezier approximation of the
  stroke backbone.
- Sinus Displacement: add sinus displacement to stroke backbone.
- Spatial Noise: add spatial noise to stroke backbone.
- Perlin Noise 1D: add one-dimensional Perlin noise to stroke backbone.
- Perlin Noise 2D: add two-dimensional Perlin noise to stroke backbone.
- Backbone Stretcher: stretch the beginning and the end of strokes.
- Tip Remover: remove a piece of stroke at the beginning and the end of strokes.

To branch users: When you have a .blend file with Freestyle options specified,
you may want to add a Sampling modifier with the 'sampling' value set to 5.
This value specifies a resolution of polylines for line drawing in Freestyle.
If no sampling modifier is specified, your line drawing will result in coarse
polylines.  Before geometry modifiers were introduced, this initial sampling
was automatically done.  Now the initial sampling is a tunable parameter that
can be omitted, allowing better control on polyline resolution.
2011-08-19 14:05:11 +00:00
Tamito Kajiyama 2f52fa7820 Fix for properly unlinking target object pointers when objects are deleted
from scenes.
2010-11-29 21:24:55 +00:00
Tamito Kajiyama 56303415e4 Added support for animation of line style parameters.
Most stylization parameters in line style datablocks are now
animatable by means of keyframes.  Right click on a line
style parameter, and you will see a list of keyframe-related
commands in the context menu.

Concerning the implementation, RNA path resolution has been
extended to properly address color ramps in line style color
modifiers.  File I/O has been also improved to load/save the
animation data associated with line style datablocks.

Known issue: Freestyle-related options in render layers are
not animatable at the moment, because of general inability (or
maybe a bug) that keyframes cannot be inserted with respect to
render layer options.
2010-09-18 00:31:22 +00:00
Tamito Kajiyama bd68a72869 A WIP commit for proof-of-concept implementations of line style modifiers.
A number of UI elements were newly introduced to control line color, alpha
transparency and line thickness by means of base color/alpha/thickness plus
modifiers that alter the base values.  To begin with, three basic modifiers
were prototyped with the aim of putting the new UI framework in practice
and evaluating if it works properly.

The Parameter Editor mode is still in a work-in-progress state and totally
useless from users' viewpoint.
2010-07-20 17:57:33 +00:00
Tamito Kajiyama ee61785384 A step toward a new user-friendly GUI for manipulating line style parameters.
This commit is just meant to give the new GUI framework a concrete shape.
There is no usefulness in newly introduced elements at the moment.

Freestyle options in render layers now include a pull-down menu named Control
Mode that allows you to choose either the Python Scripting or Parameter Editor
mode.  The Python Scripting mode is the conventional way of controlling
Freestyle by directly using style modules written in Python.  The Parameter
Editor is a new control mode that is intended to be used by everyone without
relying on Python programming.

In the Parameter Editor mode, you can specify multiple line sets for each
render layer.  A line set defines feature edge selection criteria, as
well as a line style for drawing the selected feature edges using specific
line stylization parameters.  Line style is a new datablock type, meaning
that a line style can be shared by multiple line sets (possibly those in
different render layers in different scenes).

Much more additions are anticipated in subsequent commits to implement UI
controls for specifying feature edge selection criteria and line stylization
parameters.
2010-06-25 22:45:42 +00:00