Commit Graph

54 Commits

Author SHA1 Message Date
Julian Eisel 4c8847ec4f Cleanup: Remove `extern "C"` from DNA headers
`extern "C"` did not actually have an effect here since it only impacts
name mangling of functions, not structs (or other class types). Now this
can get in the way when we add C++ blocks with functions , e.g.
templates are not allowed in code with C-linkage.

Most of these were added in ad4b7741db, even though it was known that
this doesn't have any impact. Reason was because developers thought they
would have to add that to all direct and indirect includes to be able to
use a header in C++ (a common misconception). Now with most files
compiled in C++, it's obvious that this isn't the case.

Pull Request: https://projects.blender.org/blender/blender/pulls/111926
2023-09-04 15:59:40 +02: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 0222876a34 Cleanup: replace defines with enum in DNA
- Group ambiguous flags Object::flag & Base::legacy_flag.
- Replace ambiguous hints (e.g. `paf->flag` with doxygen types).
- Remove unused flag PAF_MAXMULT.
2023-06-27 14:45:00 +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
Sergey Sharybin 25c357124d Cover some DNA files with C++ utility macros
Solves compilation warning with Clang, and moves manipulation with
DNA structures to the designed way for C++.

The tests and few other places are update to the new code by Jacques.

Ref T96847

Maniphest Tasks: T96847

Differential Revision: https://developer.blender.org/D14625
2022-04-13 11:48:12 +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
YimingWu b331acf477 Cleanup: comment spelling & punctuation 2021-07-27 18:06:29 +10:00
Julian Eisel ad4b7741db Build-system: Force C linkage for all DNA type headers
Some DNA headers already did this, most did not. Even though many of them would
be included in C++ files and thus compiled as C++. This would be confusing and
developers may think they have to add `extern "C"` too a whole lot of
(indirect) includes to be able to use a C header in C++.

However, this is a misconception.
`extern "C"` does not cause code to be compiled with C rather than C++! It only
causes the linker to not use C++ function name mangling. See
https://stackoverflow.com/a/1041880.
Because extern DNA headers don't have function declarations, using `extern "C"`
actually should not have any effect. On the other hand, adding it causes no
harm and avoids confusion. So let's just have it consistently in C header
files.

Differential Revision: https://developer.blender.org/D9578

Reviewed by: Bastien Montagne, Sybren Stüvel
2020-11-19 13:41:50 +01:00
Harley Acheson 3a7fd309fc Spelling: It's Versus Its
Corrects incorrect usage of contraction for 'it is', when possessive 'its' was required.

Differential Revision: https://developer.blender.org/D9250

Reviewed by Campbell Barton
2020-10-19 08:12:33 -07: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
Dalai Felinto 2d1cce8331 Cleanup: `make format` after SortedIncludes change 2020-03-19 09:33:58 +01: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 6a03199b50 Cleanup: use '_pad' convention for padding in all DNA structs
Avoids mixing these in with regular variables in code-completion.

Use char for pad members except for 'void *', to make size clearer.

Removed/shrink a few redundant padding vars which were >= 8 bytes.
2019-02-27 15:09:48 +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 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 5a43406e1b Cleanup: move DNA comments before struct members
Needed for clang-format in some cases, see: T53211
2019-01-08 00:43:00 +11:00
Campbell Barton 75fc1c3507 Cleanup: trailing whitespace (comment blocks)
Strip unindented comment blocks - mainly headers to avoid conflicts.
2018-06-01 18:19:39 +02:00
Tamito Kajiyama 25638a9656 Code cleanup: White space and dead code. 2015-07-10 23:15:57 +09:00
Folkert de Vries eeeb845d33 Freestyle: new stroke modifiers
This patch introduces a couple new stroke modifiers. The ones currently implemented are based on prototypes by @kjym3 and myself.

The new modifiers:
  - Tangent
  - Thickness noise
  - Crease Angle
  - Simplification
  - Curvature 3D

The documentation for these new modifier types can be found [[ http://www.blender.org/manual/render/freestyle/parameter_editor/index.html | in the manual ]]:

{F134441}
(left: AnisotropicThicknessShader, right: NoiseThicknessShader)

{F140499}
(left: Curvature 3D, right: Simplification)

Author: Folkert de Vries (flokkievids)

Reviewers: kjym3

Subscribers: #user_interface, plasmasolutions, kjym3

Projects: #bf_blender

Differential Revision: https://developer.blender.org/D963
2015-07-10 23:15:56 +09:00
Tamito Kajiyama f4a260fb3c Fix T42198: Linked lines only work with linked objects.
The reported issue was caused by a backward incompatibility due to careless
code changes made when per-material Freestyle line colors were introduced
in rB7915d7277ac8c605f016f30f943080556244fb59.  In 2.71 line style
Material color/alpha/thickness modifiers was retrieving alpha transparency
from Material.alpha, whereas in 2.72 Material.line_color[3] was referenced.

The present fix reverts the aforementioned code changes.

This issue is a regression from 2.71, so the fix is appropriate for inclusion in
the 2.72a release.
2014-10-14 01:14:33 +09:00
Tamito Kajiyama 2cb134be2b Freestyle: New line style options for sorting and chain selection.
The following two sort keys are added for sorting chains.

* Projected X - Sort by the projected X value in the image coordinate system.
* Projected Y - Sort by the projected Y value in the image coordinate system.

A new line style option for the selection of first N chains is also added.

Moreover, the chain sorting and chain selection operations are now executed
in this order instead of the reverse order used previously.  The UI has also
changed accordingly.  This functional change is backward compatible and
won't result in visual differences.
2014-10-01 16:01:40 +09:00
Campbell Barton d93c07d987 Cleanup 2014-08-21 09:23:07 +10:00
Tamito Kajiyama 7915d7277a Per-material line color settings for Freestyle.
New properties 'line_color' and 'line_priority' are added to Material ID data blocks.

The 'line_color' property allows users to specify a per-material line color that can be
used as a Freestyle line color through Material color modifiers of line style settings.

The new line color property is intended to provide a solution for line color
stylization when a proper Freestyle support for Cycles is implemented (likely
as part of the upcoming Blender 2.72 release; see Patch D632).  Materials in
Cycles are usually set up using shader nodes, and Freestyle won't be capable
of retrieving colors and other properties from node-based materials any soon.

The new line color property of materials addresses this foreseen limitation by
providing artists with an intuitive alternative mean to specify line colors on a
per-material basis independently from node trees.

The 'line_priority' property gives users a way to control line colors at material
boundaries.  When a line is drawn along a feature edge at material boundaries,
one of the two materials on both sides of the edge has to be picked up to
determine the line color.  So far there was no way to control this selection
(which was in effect at random).  Now the material with a higher line color
priority will be selected.

The new per-material line settings are shown in the new Freestyle Line tab in
the Material context of the Properties window (only when Freestyle is enabled).
2014-07-07 16:19:51 +09:00
Tamito Kajiyama 1cf5e95f3d Freestyle: added missing forward declarations of referenced struct's. 2014-05-22 16:03:36 +09:00
Tamito Kajiyama b7f085d9c1 Patch D246: Texture Marks for freestyle strokes, written and contributed by Paolo Acampora.
Reviewers: brecht, kjym3, #freestyle

Reviewed By: brecht, kjym3

Differential Revision: https://developer.blender.org/D246
2014-05-03 18:54:59 +09:00
Tamito Kajiyama f60a66f417 Freestyle: New options for sorting to arrange the stacking order of lines.
Line styles now have a set of new options for rearranging the stacking order of lines.
This gives artists more control to determine which lines should be drawn on top of others.
Two available sort keys are the distance from camera and curvilinear 2D length.
Since the distance of a line from camera may vary over vertices, another option called
integration type is used to compute the sort key for a line from the values computed at
individual vertices.  Available integration types are MEAN, MIN, MAX, FIRST and LAST
(see the tool tips for more detail).
2014-04-18 15:02:45 +09:00
Campbell Barton 8beb565c59 code cleanup: headers - doxy comments. 2013-09-12 03:02:50 +00:00
Tamito Kajiyama 1f6c9d18ed Fix for MAX_NAME (== 64) and FILE_MAX (== 1024) in DNA headers.
Suggested by Sergey Sharybin through a code review of the branch.
2013-03-20 01:05:37 +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 5083e0737f All angle properties were switched from degrees to radians (using PROP_ANGLE
RNA subtype), since Freestyle internally use angles in radians.
A patch set by Bastien Montagne (many thanks!)

NOTICE FOR BRANCH USERS:
This commit may break line drawing settings of already saved Freestyle files.
All angles are now treated as radians instead of degrees, so collections of
angle values might be necessary in order to recover previous visual results.
Affected properties are:
- Crease Angle in the edge detection options
- Min 2D Angle in the 'Splitting' section of a line style
- Max 2D Angle in the 'Splitting' section of a line style
- 'orientation' parameter of the Calligraphy thickness modifier
- 'angle' parameter of the PerlinNoise1D geometry modifier
- 'angle' parameter of the PerlinNoise2D geometry modifier
- 'angle' parameter of the 2DTransform geometry modifier
2012-12-09 23:19:46 +00:00
Tamito Kajiyama dd633f1aff Fix for dashed line options not working as expected in some applications
when combined with geometry modifiers.

The problem is that users were not able to choose the time when the
dashed line options are applied.  Instead, the dashed line options were
applied only before geometry modifiers were employed.  Since dashes were
separate strokes, the geometry modifiers were processed dash by dash.
Depending on users' artistic intention, this may or may not lead to
expected stylization results, as reported by octane98 in the
BlenderArtists Freestyle thread on January 3, 2012.
http://blenderartists.org/forum/showthread.php?89986-Freestyle-for-Blender&p=2018592&viewfull=1#post2018592

Now the Strokes tab of the Freestyle Line Style panel has two sets of
dashed line options.  One is in the Splitting section of the Strokes tab
and used for splitting strokes by dashed line patterns.  The other set
is called "Dashed Line" and used to generate dashed lines based on the
strokes after the geometry modifiers are applied.  The two sets of
dashed line options are independent of each other, so that users can
enable one of them as well as both at the same time.
2012-11-04 23:52:26 +00:00
Tamito Kajiyama e94abda66d New options in the Parameter Editor mode for controling the position of stroke thickness.
The new options enable a better control on the position of stroke thickness with
respect to stroke backbone geometry.  Three predefined positions are:
* center: thickness is evenly split to the left and right side of the stroke geometry.
* inside: strokes are drawn within object boundary.
* outside: strokes are drawn outside the object boundary.
Another option called "relative" allows users to specify the relative position by a
number between 0 (inside) and 1 (outside).

The thickness position options are applied only to strokes of the edge types SILHOUETTE
and BORDER, since these are the only edge types defined in terms of object boundary.
Strokes of other edge types are always using the "center" option.
2012-04-07 17:28:09 +00:00
Tamito Kajiyama f88501a44d Added two stroke geometry modifiers:
- 2D Offset: Adds two-dimensional offsets to stroke backbone geometry.
- 2D Transform: Applies two-dimensional scaling and rotation to stroke backbone geometry.
2012-01-04 00:23:34 +00:00
Tamito Kajiyama 32db495e50 Updates on the Parameter Editor mode:
* Added a new chain splitting option for dividing chains into pieces having
a given curvilinear 2D length.

* Rearranged the UI controls of chain splitting options according to the
actual order of processing.

* Made changes for converting each view edge into a chain in the case of
not using chaining.
2011-12-11 23:41:15 +00:00
Tamito Kajiyama 99f7f3ac81 Added new options for splitting chains of feature edges by a minimum
and maximum 2D angle.
2011-11-13 20:20:50 +00:00
Tamito Kajiyama e7a4d45435 Added to the Parameter Editor mode new stroke geometry modifier `Blueprint'
that produces a blueprint using circular, elliptic, and square contour strokes.
Related changes and bug fixes were made as follows:

* The randomness in radius and center has been transformed into optional
parameters of the pyBluePrintCirclesShader and pyBluePrintEllipsesShader.
Also a new optional parameter to control the randomness of backbone
stretching has been added to the pyBluePrintSquaresShader.

* A bug in the pyBluePrintSquaresShader that invisible stroke vertices at
corners of rectangular contour strokes were not properly drawn.  The problem
was due to the changes of the / operator between Python 2.x to 3.x.  Even
when the two operands of the division operator are integers, Python 3.x
gives a floating-point number when the quotient is not an integer.  The fix
was just to replace the / operator by the // operator for integer division.

* An unpleasant discontinuity in circular and elliptical contour strokes
was fixed.

* The length parameter of the Backbone Stretcher geometry modifier has been
renamed to `backbone_length' in line with the parameter of the same name in
the pyBluePrintSquaresShader.
2011-11-11 20:35:03 +00:00
Tamito Kajiyama ac6bdfb653 Added two stroke geometry modifiers: Parameterization and Guiding Lines. 2011-11-01 09:47:41 +00:00
Tamito Kajiyama 510c69368b New option for disabling the chaining of feature edges in the Parameter Editor mode. 2011-10-25 23:24:59 +00:00
Tamito Kajiyama 5582d9fac1 Rearranged the organization of chaining options in line styles.
New there are only two chaining types: plain and sketchy.  Both chaining types
have the "same object" option.  With this option enabled, only feature edges of
the same object are chained.  The sketchy chaining also has the "rounds" option
to specify the number of rounds in a sketchy multiple touch.

Also removed a temporary workaround (implemented by means of a custom chaining
rule) for infinite straight lines, which has resulted in much cleaner strokes.
2011-09-19 23:24:14 +00:00
Tamito Kajiyama 38f24637d4 Added new line style options for sketchy chaining of feature edges.
The default chaining option is now called "Natural", while the new chaining options
are "Sketchy: Topology Preserved" and "Sketchy: Topology broken".  The latter two
options allow for generating chains of feature edges with a sketchy multiple touch.
The "Sketchy: Topology Preserved" option takes account of the topology of objects
in the view map, while the "Sketchy: Topology broken" ignores the edge topology.
The "rounds" option specifies the number of rounds in sketchy strokes.
2011-09-19 22:40:44 +00:00
Tamito Kajiyama 513293a256 Added new line style options for selecting chains by min/max 2D lengths. 2011-09-18 22:59:51 +00:00
Tamito Kajiyama 6be21a9125 Implemented a calligraphic thickness modifier in the Parameter Editor mode.
Also fixed a typo in the docstring of the CalligraphicShader.
2011-09-11 19:57:38 +00:00
Tamito Kajiyama edde9f2666 Added an 'angle' parameter to the Perlin Noise 1D and 2D geometry modifiers
to specify a displacement direction in degrees.
2011-08-30 00:29:12 +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 5057810bda New line style option for splitting chains of feature edges at material boundaries. 2011-08-13 00:05:25 +00:00
Tamito Kajiyama 0a9094a8e3 New line style modifiers for changing line color, alpha transparency, and
line thickness based on object materials.  Accessible material attributes
are diffuse color, specular color, specular hardness, and alpha.
2011-07-24 23:29:19 +00:00
Tamito Kajiyama 86e433728d Added support for dashed line in the Parameter Editor mode. 2010-10-23 20:42:26 +00:00
Tamito Kajiyama 84f5a9a718 Added support for three types of stroke caps that determines the shape
of both ends of strokes.  The three cap types are: 1) butt caps (flat);
2) round caps (half-circle); and 3) square caps (flat and extended).
Also implemented an option to join those feature edges of the same
object.  These options are available in the "Stroke" tab of the
"Freestyle: Line Style" panel in the Render buttons.
2010-10-10 22:50:32 +00:00