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:
authorJacques Lucke <jacques@blender.org>2020-07-27 17:26:32 +0300
committerJacques Lucke <jacques@blender.org>2020-07-27 17:26:43 +0300
commit38e65331a8345054874e81668772dc8c66ad1a1e (patch)
treed30764b2b9193a01d01dcba5efc19a308a3f31fa /source/blender/functions/intern
parenta83bb170b09d109b93e80002112e4a28ce5d6ff9 (diff)
Particles: initial support for events and actions
The following nodes work now (although things can still be improved of course): Particle Birth Event, Praticle Time Step Event, Set Particle Attribute and Execute Condition. Multiple Set Particle Attribute nodes can be chained using the "Execute" sockets. They will be executed from left to right.
Diffstat (limited to 'source/blender/functions/intern')
-rw-r--r--source/blender/functions/intern/attributes_ref.cc11
1 files changed, 8 insertions, 3 deletions
diff --git a/source/blender/functions/intern/attributes_ref.cc b/source/blender/functions/intern/attributes_ref.cc
index 7bfcc69671a..4686e217911 100644
--- a/source/blender/functions/intern/attributes_ref.cc
+++ b/source/blender/functions/intern/attributes_ref.cc
@@ -25,7 +25,7 @@ AttributesInfoBuilder::~AttributesInfoBuilder()
}
}
-void AttributesInfoBuilder::add(StringRef name, const CPPType &type, const void *default_value)
+bool AttributesInfoBuilder::add(StringRef name, const CPPType &type, const void *default_value)
{
if (names_.add_as(name)) {
types_.append(&type);
@@ -36,10 +36,15 @@ void AttributesInfoBuilder::add(StringRef name, const CPPType &type, const void
void *dst = allocator_.allocate(type.size(), type.alignment());
type.copy_to_uninitialized(default_value, dst);
defaults_.append(dst);
+ return true;
}
else {
- /* The same name can be added more than once as long as the type is always the same. */
- BLI_assert(types_[names_.index_of_as(name)] == &type);
+ const CPPType &stored_type = *types_[names_.index_of_as(name)];
+ if (stored_type != type) {
+ std::cout << "Warning: Tried to add an attribute twice with different types (" << name
+ << ": " << stored_type.name() << ", " << type.name() << ").\n";
+ }
+ return false;
}
}