Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2020-09-07 13:49:50 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-09-07 14:02:15 +0300
commit99e3541d3b1a1fc62fcd24e9f0d12a631e4caead (patch)
treedb27deb3bac69a53183f6ebbc9924394ee5ca377 /source/blender/makesdna/intern
parenta2921067994bdec012a5b9edc7168d10b1b0627c (diff)
Docs: add note on updating startup defaults to dna_defaults
Without this it's not clear which defaults these values are used for.
Diffstat (limited to 'source/blender/makesdna/intern')
-rw-r--r--source/blender/makesdna/intern/dna_defaults.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/source/blender/makesdna/intern/dna_defaults.c b/source/blender/makesdna/intern/dna_defaults.c
index 2d86e97debf..50794d1d2e5 100644
--- a/source/blender/makesdna/intern/dna_defaults.c
+++ b/source/blender/makesdna/intern/dna_defaults.c
@@ -19,6 +19,9 @@
/** \file
* \ingroup DNA
*
+ * DNA Defaults
+ * ============
+ *
* This API provides direct access to DNA default structs
* to avoid duplicating values for initialization, versioning and RNA.
* This allows DNA default definitions to be defined in a single header along side the types.
@@ -26,11 +29,20 @@
*
* Defining the defaults is optional since it doesn't make sense for some structs to have defaults.
*
+ * Adding Defaults
+ * ---------------
+ *
+ * Adding/removing defaults for existing structs can be done by hand.
+ * When adding new defaults for larger structs you may want to write-out the in-memory data.
+ *
* To create these defaults there is a GDB script which can be handy to get started:
* `./source/tools/utils/gdb_struct_repr_c99.py`
*
* Magic numbers should be replaced with flags before committing.
*
+ * Public API
+ * ----------
+ *
* The main functions to access these are:
* - #DNA_struct_default_get
* - #DNA_struct_default_alloc
@@ -38,6 +50,22 @@
* These access the struct table #DNA_default_table using the struct number.
*
* \note Struct members only define their members (pointers are left as NULL set).
+ *
+ * Typical Usage
+ * -------------
+ *
+ * While there is no restriction for using these defaults,
+ * it's worth noting where these functions are typically used:
+ *
+ * - When creating/allocating new data.
+ * - RNA property defaults, used for "Set Default Value" in the buttons right-click context menu.
+ *
+ * These defaults are not used:
+ *
+ * - When loading old files that don't contain newly added struct members (these will be zeroed)
+ * to set their values use `versioning_{BLENDER_VERSION}.c` source files.
+ * - For startup file data, to update these defaults use
+ * #BLO_update_defaults_startup_blend & #BLO_version_defaults_userpref_blend.
*/
#include <limits.h>