Commit Graph

48 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 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 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
Hans Goudey 3b6ee8cee7 Refactor: Move vertex group names to object data
This commit moves the storage of `bDeformGroup` and the active index
to `Mesh`, `Lattice`, and `bGPdata` instead of `Object`. Utility
functions are added to allow easy access to the vertex groups given
an object or an ID.

As explained in T88951, the list of vertex group names is currently
stored separately per object, even though vertex group data is stored
on the geometry. This tends to complicate code and cause bugs,
especially as geometry is created procedurally and tied less closely
to an object.

The "Copy Vertex Groups to Linked" operator is removed, since they
are stored on the geometry anyway.

This patch leaves the object-level python API for vertex groups in
place. Creating a geometry-level RNA API can be a separate step;
the changes in this commit are invasive enough as it is.

Note that opening a file saved in 3.0 in an earlier version means
the vertex groups will not be available.

Differential Revision: https://developer.blender.org/D11689
2021-07-13 12:10:34 -04: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
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 79b703bb63 Fix T69822: Switching sculpt objects breaks undo
This introduces object mode tagging for data which hasn't yet been
written back to the ID data.

Now when selecting other sculpt objects, the original objects data is
flushed back to the ID before writing a memfile undo step.
2019-11-07 16:56:21 +11: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 b271cbfcb0 Cleanup: unused DNA struct members
- Timeline theme.
- 3D view runtime variables.
- Exclude EditLatt from SDNA.
2019-02-13 19:14:36 +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 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
Campbell Barton 06a1a66a9b Merge branch 'master' into blender2.8 2018-06-17 17:10:19 +02:00
Campbell Barton 78fbd146f3 Cleanup: trailing space for DNA headers 2018-06-17 17:04:09 +02:00
Campbell Barton 2128e26d86 Draw Manager: initial lattice support
Still misses support for edit-mode selection & weight drawing.
2017-04-13 22:09:59 +10:00
Sergey Sharybin c46cbc602e Make lattice deform safe for threading
Lattice deformation used to store some runtime data
inside of lattice datablock itself. It's something
which is REALLY bad. Ideally DNA shouldn't contain
and runtime data.

For now solved it in a way that initialization of
lattice deform will create a structure which contains
lattice object for which deformation is calculating
and that runtime data which used to be stored in
lattice datablock itself.

It works really fine for mesh deform modifier, but
there's still runtime data stored in particle system
DNA, It didn't look something easy to be solved, so
leaving this as-is for now.

--
svn merge -r58277:58278 -r58795:58796 ^/branches/soc-2013-depsgraph_mt
2013-08-19 10:11:48 +00:00
Campbell Barton 1a55b53375 lattice: use functions rather then defines, also added a function to get uvw from an index.
- BKE_lattice_index_from_uvw()
- BKE_lattice_index_to_uvw()
2013-06-24 13:45:35 +00:00
Campbell Barton eabb30a236 patch [#35631] Active element for Lattice
by Kevin Mackay (yakca)

Was one of our TODO's from the wiki.
2013-06-09 20:28:08 +00:00
Campbell Barton 2b7ca2304a unify include guard defines, __$FILENAME__
without the underscores these clogged up the namespace for autocompleation which was annoying.
2012-02-17 18:59:41 +00:00
Sergey Sharybin 51bada696f Longer names support for all ID and other object names
This commit extends limit of ID and objects to 64 (it means 63 meaning
characters and 1 for zero-terminator). CustomData layers names are also
extended.
Changed DNA structures and all places where length constants were hardcoded.

All names which are "generating" from ID block should be limited by MAX_ID_NAME-2,
all non-id names now has got own define called MAX_NAME which should be used all
over for non-id names to make further name migration stuff easier.

All name fields in DNA now have comment with constant which corresponds to
hardcoded numeric value which should make it easier to further update this
limits or even switch to non-hardcoded values in DNA.

Special thanks to Campbell who helped figuring out some issues and helped a lot
in finding all cases where hardcoded valued were still used in code.

Both of forwards and backwards compatibility is stored with blender versions newer
than January 5, 2011. Older versions had issue with placing null-terminator to
DNA strings on file load which will lead to some unpredictable behavior or even
crashes.
2012-01-11 08:51:06 +00:00
Campbell Barton ca629d5ccc minor dna header cleanup 2011-12-30 07:25:49 +00:00
Campbell Barton 31ff21d735 add define for deprecated DNA struct members: DNA_DEPRECATED,
this means use of deprecated struct members gives a warning.

- makesdna.c preprocessor skips this.
- DNA_DEPRECATED_ALLOW is used so readfile.c can do versioning without warnings.
- this exposes some use of deprecated struct members, will deal with this after.
2011-12-04 06:05:48 +00:00
Campbell Barton 4a04f72069 remove $Id: tags after discussion on the mailign list: http://markmail.org/message/fp7ozcywxum3ar7n 2011-10-23 17:52:20 +00:00
Campbell Barton e55833a094 fix [#27572] Mirror Shapekey and Mirror vertex Group not working for Lattice. 2011-06-06 06:40:09 +00:00
Nathan Letwory 22dbae84e5 DNA header files are now grouped under the same module. No further documentation done. 2011-02-17 20:48:12 +00:00
Joshua Leung 09852b9a58 Animation data for lattices is now shown in the Animaton Editors 2011-01-05 00:37:21 +00:00
Joshua Leung 1474b32456 Lattices now have AnimData
This allows manual (point by point) animation of their control verts,
although many other settings cannot really be animated with any
visible effects yet. Interestingly, lattices also had IPO block
pointers, though they were never really used (AFAIK).

Todo:
- Animation Editor support has yet to be added. I've got a few other
things to add to, so will group those changes together.
2010-12-13 06:31:49 +00:00
Campbell Barton 5f69c0ec09 string lookup for scene.object_bases, also removed some unused DNA vars. 2010-11-10 00:51:34 +00:00
Sergey Sharybin c0e39df6ac - Enable shape key switching in edit mode for curves, surfaces and latticies
- Disable changing of lattice size if there are shape keys
2010-08-10 06:36:42 +00:00
Campbell Barton 24eedb2175 vertex group option for lattice, needed for applying a lattice to a beard/moustache without moving the roots about. 2010-04-20 21:38:55 +00:00
Campbell Barton 081c1205a3 correct fsf address 2010-02-12 13:34:04 +00:00
Ton Roosendaal 637ffd1dfb 2.5
More globals discovered; lattice deform stored static
deform array and a matrix. Tsk!
2009-01-07 16:05:55 +00:00
Ton Roosendaal a6721c60d9 2.5
From the anti-globalization department: 
G.obedit terminated!

Wherever possible, use CTX_data_edit_object(C) to get this
now. It's stored in scene now, and the screen context has
it defined.
2009-01-02 19:10:35 +00:00
Chris Want 5e3cffc64a Patch to change license to GPL only, from GSR. 2008-01-07 19:13:47 +00:00
Ton Roosendaal 4603f452c2 Animation department feature request: support for vertex groups in Lattices
In a quick glance: (temp image)
http://www.blender.org/bf/rt.png

Main reason is that Lattices are useful a lot for Armature deformation.
Lattices just provide much more precise and interesting control. However,
with only bone envelopes it's very hard to use.

Working with Lattice vertex groups is nearly identical to Mesh:
- on CTRL+P 'make parent' you can choose the deform option now
- In editmode, the buttons to control vertex groups are available
- In outliner you can select vertexgroups too
- Deforming Lattices with Armatures has all options as for Mesh now.

Note:
- No WeightPaint has been added yet. To compensate, the editmode
  drawing for a Lattice with vertex group shows weight values for the active
  vertex group.
- Lattice editmode doesn't undo/redo weight editing yet.
- Softbody for Lattice still uses own vertex weights

Implementation notes:
- derivedmesh weight_to_rgb() is now exported to drawobject.c
- been doing cleanups in code (order of includes, var declarations, etc)
- weightpaint button handling now is generic

I've checked on Brecht's proposal for Custom Element data;
http://mediawiki.blender.org/index.php/BlenderDev/CustomElementData
It could have been used, but that would mean the existing code for
vertexgroup handling and armature deform couldn't be re-used. I guess this
is really a later todo.
2006-09-03 12:16:14 +00:00
Daniel Dunbar 2abd79b491 - readded DL_VERTS type to store lattice deformed verts
- new feature, twiddled with lattice resizing to try to maintain
   existing vertex changes... much nicer than just resetting the
   lattice if you decide you need more detail in the lattice.
 - modifiers work with lattices now. yes, that does mean you
   can make a chain of lattices effecting each other 8 miles
   long.
 - some cleanup of softbody code, was rather splintered and call
   path was twisted and confusing. reworked main object step
   routine to do things in a more obvious and consistent manner
   and without duplicate code
 - added ob->softflag OB_SB_RESET instead of sbObjectReset
   call
 - modifier changes reset softbody now
 - moved curve_getVertexCos/curve_applyVertexCos into curve.c
 - update curve modifier eval to work with virtual modifiers
 - update modifier apply to work with curves/surfs
 - update make parent to also recalc object data

NOTE: Although you can turn SB on for curve/font objects at the
moment it doesn't really work because they call deform in
multiple steps and this confuses SB. Not sure how to deal with
atm.
2005-08-15 10:30:53 +00:00
Daniel Dunbar 16e90d56d2 - replaced AUTOSPACE define with {ME_,CU_,MB_}AUTOSPACE,
different objects shouldn't share flags this way (still sharing of
  other mesh flags in renderer... ickity pickity, but I'm not fixing now)
 - removed some unnecessary uses of DNA_mesh_types.h
2004-03-14 16:59:48 +00:00
Kent Mein f1c4f705a1 Removed the config.h thing from the .h's in the source dir.
So we should be all set now :)

Kent
--
mein@cs.umn.edu
2002-12-27 13:11:01 +00:00
Kent Mein b9a19f1ea7 Did all of the .h's in source
(adding)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

also the Makefile.in's were from previous patch adding
the system depend stuff to configure.ac

Kent
--
mein@cs.umn.edu
2002-11-25 11:16:17 +00:00
Kent Mein 01bff70383 fixed spacing in the headers to get rid of some warnings and some other
little minor spacing issues.
2002-10-30 02:07:20 +00:00
Hans Lambermont 12315f4d0e Initial revision 2002-10-12 11:37:38 +00:00