[Bf-blender-cvs] [3a3970c2e07] functions-experimental-refactor: change uint8_t to bool
Jacques Lucke
noreply at git.blender.org
Fri Nov 8 20:36:45 CET 2019
Commit: 3a3970c2e074dc1aa4a6cff068d45ac09bfaa70d
Author: Jacques Lucke
Date: Fri Nov 8 19:50:23 2019 +0100
Branches: functions-experimental-refactor
https://developer.blender.org/rB3a3970c2e074dc1aa4a6cff068d45ac09bfaa70d
change uint8_t to bool
===================================================================
M source/blender/simulations/bparticles/action_interface.hpp
M source/blender/simulations/bparticles/actions.cpp
M source/blender/simulations/bparticles/events.cpp
M source/blender/simulations/bparticles/node_frontend.cpp
M source/blender/simulations/bparticles/particle_function_input_providers.cpp
M source/blender/simulations/bparticles/simulate.cpp
===================================================================
diff --git a/source/blender/simulations/bparticles/action_interface.hpp b/source/blender/simulations/bparticles/action_interface.hpp
index 5bb52b9d440..34abbfcecf3 100644
--- a/source/blender/simulations/bparticles/action_interface.hpp
+++ b/source/blender/simulations/bparticles/action_interface.hpp
@@ -310,7 +310,7 @@ inline ArrayRef<float> ActionInterface::current_times()
inline void ActionInterface::kill(ArrayRef<uint> pindices)
{
- auto kill_states = m_attributes.get<uint8_t>("Kill State");
+ auto kill_states = m_attributes.get<bool>("Kill State");
for (uint pindex : pindices) {
kill_states[pindex] = 1;
}
diff --git a/source/blender/simulations/bparticles/actions.cpp b/source/blender/simulations/bparticles/actions.cpp
index f9f7aec9046..d21a54dc066 100644
--- a/source/blender/simulations/bparticles/actions.cpp
+++ b/source/blender/simulations/bparticles/actions.cpp
@@ -179,7 +179,7 @@ void ConditionAction::execute(ActionInterface &interface)
void AddToGroupAction::execute(ActionInterface &interface)
{
- auto is_in_group = interface.attributes().get<uint8_t>(m_group_name);
+ auto is_in_group = interface.attributes().get<bool>(m_group_name);
for (uint pindex : interface.pindices()) {
is_in_group[pindex] = true;
}
@@ -187,12 +187,12 @@ void AddToGroupAction::execute(ActionInterface &interface)
void RemoveFromGroupAction::execute(ActionInterface &interface)
{
- auto is_in_group_optional = interface.attributes().try_get<uint8_t>(m_group_name);
+ auto is_in_group_optional = interface.attributes().try_get<bool>(m_group_name);
if (!is_in_group_optional.has_value()) {
return;
}
- MutableArrayRef<uint8_t> is_in_group = *is_in_group_optional;
+ MutableArrayRef<bool> is_in_group = *is_in_group_optional;
for (uint pindex : interface.pindices()) {
is_in_group[pindex] = false;
}
diff --git a/source/blender/simulations/bparticles/events.cpp b/source/blender/simulations/bparticles/events.cpp
index c844ff356f4..067e402b8f6 100644
--- a/source/blender/simulations/bparticles/events.cpp
+++ b/source/blender/simulations/bparticles/events.cpp
@@ -27,7 +27,7 @@ void AgeReachedEvent::filter(EventFilterInterface &interface)
float end_time = interface.step_end_time();
auto birth_times = attributes.get<float>("Birth Time");
- auto was_activated_before = attributes.get<uint8_t>(m_is_triggered_attribute);
+ auto was_activated_before = attributes.get<bool>(m_is_triggered_attribute);
for (uint pindex : interface.pindices()) {
if (was_activated_before[pindex]) {
@@ -56,7 +56,7 @@ void AgeReachedEvent::filter(EventFilterInterface &interface)
void AgeReachedEvent::execute(EventExecuteInterface &interface)
{
- auto was_activated_before = interface.attributes().get<uint8_t>(m_is_triggered_attribute);
+ auto was_activated_before = interface.attributes().get<bool>(m_is_triggered_attribute);
for (uint pindex : interface.pindices()) {
was_activated_before[pindex] = true;
}
@@ -69,7 +69,7 @@ void AgeReachedEvent::execute(EventExecuteInterface &interface)
void CustomEvent::filter(EventFilterInterface &interface)
{
- auto was_activated_before = interface.attributes().get<uint8_t>(m_is_triggered_attribute);
+ auto was_activated_before = interface.attributes().get<bool>(m_is_triggered_attribute);
TemporaryVector<uint> pindices_to_check;
pindices_to_check.reserve(interface.pindices().size());
@@ -97,7 +97,7 @@ void CustomEvent::filter(EventFilterInterface &interface)
void CustomEvent::execute(EventExecuteInterface &interface)
{
- auto was_activated_before = interface.attributes().get<uint8_t>(m_is_triggered_attribute);
+ auto was_activated_before = interface.attributes().get<bool>(m_is_triggered_attribute);
for (uint pindex : interface.pindices()) {
was_activated_before[pindex] = true;
}
diff --git a/source/blender/simulations/bparticles/node_frontend.cpp b/source/blender/simulations/bparticles/node_frontend.cpp
index 87af2d2cb11..835ef7aef77 100644
--- a/source/blender/simulations/bparticles/node_frontend.cpp
+++ b/source/blender/simulations/bparticles/node_frontend.cpp
@@ -397,7 +397,7 @@ static std::unique_ptr<Action> ACTION_add_to_group(InfluencesCollector &collecto
/* Add group to all particle systems for now. */
collector.m_attributes.foreach_value(
- [&](AttributesInfoBuilder *builder) { builder->add<uint8_t>(group_name, 0); });
+ [&](AttributesInfoBuilder *builder) { builder->add<bool>(group_name, 0); });
Action *action = new AddToGroupAction(group_name);
return std::unique_ptr<Action>(action);
@@ -564,7 +564,7 @@ static void PARSE_age_reached_event(InfluencesCollector &collector,
std::string is_triggered_attribute = vnode.name();
for (const std::string &system_name : system_names) {
- collector.m_attributes.lookup(system_name)->add<uint8_t>(is_triggered_attribute, 0);
+ collector.m_attributes.lookup(system_name)->add<bool>(is_triggered_attribute, 0);
Event *event = new AgeReachedEvent(is_triggered_attribute, inputs_fn, action);
collector.m_events.add(system_name, event);
}
@@ -757,7 +757,7 @@ static void PARSE_custom_event(InfluencesCollector &collector,
for (const std::string &system_name : system_names) {
Event *event = new CustomEvent(is_triggered_attribute, inputs_fn, action);
- collector.m_attributes.lookup(system_name)->add<uint8_t>(system_name, 0);
+ collector.m_attributes.lookup(system_name)->add<bool>(system_name, 0);
collector.m_events.add(system_name, event);
}
}
@@ -835,7 +835,7 @@ static void collect_influences(VTreeData &vtree_data,
for (std::string &system_name : r_system_names) {
AttributesInfoBuilder &attributes = *r_attributes_per_type.lookup(system_name);
- attributes.add<uint8_t>("Kill State", 0);
+ attributes.add<bool>("Kill State", 0);
attributes.add<int32_t>("ID", 0);
attributes.add<float>("Birth Time", 0);
attributes.add<float3>("Position", float3(0, 0, 0));
diff --git a/source/blender/simulations/bparticles/particle_function_input_providers.cpp b/source/blender/simulations/bparticles/particle_function_input_providers.cpp
index 408abdb6776..fa7ea91aaa5 100644
--- a/source/blender/simulations/bparticles/particle_function_input_providers.cpp
+++ b/source/blender/simulations/bparticles/particle_function_input_providers.cpp
@@ -247,11 +247,11 @@ Optional<ParticleFunctionInputArray> RandomFloatInputProvider::get(
Optional<ParticleFunctionInputArray> IsInGroupInputProvider::get(InputProviderInterface &interface)
{
- auto is_in_group_output = BLI::temporary_allocate_array<uint8_t>(interface.attributes().size());
+ auto is_in_group_output = BLI::temporary_allocate_array<bool>(interface.attributes().size());
- auto is_in_group_optional = interface.attributes().try_get<uint8_t>(m_group_name);
+ auto is_in_group_optional = interface.attributes().try_get<bool>(m_group_name);
if (is_in_group_optional.has_value()) {
- ArrayRef<uint8_t> is_in_group = *is_in_group_optional;
+ ArrayRef<bool> is_in_group = *is_in_group_optional;
for (uint pindex : interface.pindices()) {
is_in_group_output[pindex] = is_in_group[pindex];
}
diff --git a/source/blender/simulations/bparticles/simulate.cpp b/source/blender/simulations/bparticles/simulate.cpp
index f93e6586cfe..d4515255a6f 100644
--- a/source/blender/simulations/bparticles/simulate.cpp
+++ b/source/blender/simulations/bparticles/simulate.cpp
@@ -148,7 +148,7 @@ BLI_NOINLINE static void compute_current_time_per_particle(ArrayRef<uint> pindic
BLI_NOINLINE static void find_unfinished_particles(ArrayRef<uint> pindices_with_event,
ArrayRef<float> time_factors_to_next_event,
- ArrayRef<uint8_t> kill_states,
+ ArrayRef<bool> kill_states,
VectorAdaptor<uint> &r_unfinished_pindices)
{
for (uint pindex : pindices_with_event) {
@@ -197,7 +197,7 @@ BLI_NOINLINE static void simulate_to_next_event(BlockStepData &step_data,
TemporaryVector<uint> pindices_with_event;
uint max_event_storage_size = std::max(get_max_event_storage_size(system_info.events), 1u);
- TemporaryArray<uint8_t> event_storage_array(max_event_storage_size * amount);
+ TemporaryArray<bool> event_storage_array(max_event_storage_size * amount);
EventStorage event_storage((void *)event_storage_array.begin(), max_event_storage_size);
find_next_event_per_particle(step_data,
@@ -236,7 +236,7 @@ BLI_NOINLINE static void simulate_to_next_event(BlockStepData &step_data,
find_unfinished_particles(pindices_with_event,
time_factors_to_next_event,
- step_data.attributes.get<uint8_t>("Kill State"),
+ step_data.attributes.get<bool>("Kill State"),
r_unfinished_pindices);
}
@@ -358,7 +358,7 @@ BLI_NOINLINE static void simulate_block(SimulationState &simulation_state,
BLI_NOINLINE static void delete_tagged_particles_and_reorder(AttributesBlock &block)
{
- auto kill_states = block.as_ref().get<uint8_t>("Kill State");
+ auto kill_states = block.as_ref().get<bool>("Kill State");
TemporaryVector<uint> indices_to_delete;
for (uint i = 0; i < kill_states.size(); i++) {
More information about the Bf-blender-cvs
mailing list