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:
authorAlexander Gavrilov <angavrilov@gmail.com>2022-09-30 21:00:27 +0300
committerAlexander Gavrilov <angavrilov@gmail.com>2022-10-03 18:02:24 +0300
commit2f7234d3e1bbc11c63204e89d718c7ee25ef3c02 (patch)
treecc873d20f3c214f4d5c9a170de8402b3be523f93 /source/blender/blenkernel/BKE_duplilist.h
parenta6083cdeef17c09622914c12fb6261f47a87cd89 (diff)
Attribute Node: access geometry node instance attributes.
The Instancer mode of the node is intended for varying material behavior between instances. Since Geometry Nodes support arbitrary named instance attributes, this mode should include them in lookup. To implement this it is sufficient to store references to Geometry Node data in DupliObject, and check it during dupli attribute lookup. In order to reduce the memory usage of DupliObject, only 4 array entries are allocated, even though the current dupli recursion stack limit is 8. This assumes that not every entry would be associated with a GeometrySet instance. Hopefully, soon the whole system will be rewritten to remove the hard limits altogether. Differential Revision: https://developer.blender.org/D16114
Diffstat (limited to 'source/blender/blenkernel/BKE_duplilist.h')
-rw-r--r--source/blender/blenkernel/BKE_duplilist.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_duplilist.h b/source/blender/blenkernel/BKE_duplilist.h
index 79f37d2edde..8a37348377a 100644
--- a/source/blender/blenkernel/BKE_duplilist.h
+++ b/source/blender/blenkernel/BKE_duplilist.h
@@ -60,6 +60,17 @@ typedef struct DupliObject {
/* Particle this dupli was generated from. */
struct ParticleSystem *particle_system;
+ /* Geometry set stack for instance attributes; for each level lists the
+ * geometry set and instance index within it.
+ *
+ * Only non-null entries are stored, ordered from innermost to outermost.
+ * To save memory, these arrays are allocated smaller than persistent_id,
+ * assuming that not every entry will be associated with a GeometrySet; any
+ * size between 1 and MAX_DUPLI_RECUR can be used without issues.
+ */
+ int instance_idx[4];
+ const struct GeometrySet *instance_data[4];
+
/* Random ID for shading */
unsigned int random_id;
} DupliObject;