[Bf-blender-cvs] [e0b82c6616f] functions: access influences collector from action parsers
Jacques Lucke
noreply at git.blender.org
Sun Sep 22 15:05:51 CEST 2019
Commit: e0b82c6616f89bcb225e53fbaf42d859ea3fe438
Author: Jacques Lucke
Date: Sun Sep 22 14:37:20 2019 +0200
Branches: functions
https://developer.blender.org/rBe0b82c6616f89bcb225e53fbaf42d859ea3fe438
access influences collector from action parsers
===================================================================
M source/blender/simulations/bparticles/node_frontend.cpp
===================================================================
diff --git a/source/blender/simulations/bparticles/node_frontend.cpp b/source/blender/simulations/bparticles/node_frontend.cpp
index ce803b1c1fa..3bdbb54fc0e 100644
--- a/source/blender/simulations/bparticles/node_frontend.cpp
+++ b/source/blender/simulations/bparticles/node_frontend.cpp
@@ -36,8 +36,10 @@ static StringRef particle_system_idname = "bp_ParticleSystemNode";
static StringRef combine_influences_idname = "bp_CombineInfluencesNode";
class VTreeData;
-using ActionParserCallback =
- std::function<std::unique_ptr<Action>(VTreeData &vtree_data, VirtualSocket *execute_vsocket)>;
+class InfluencesCollector;
+
+using ActionParserCallback = std::function<std::unique_ptr<Action>(
+ InfluencesCollector &collector, VTreeData &vtree_data, VirtualSocket *execute_vsocket)>;
StringMap<ActionParserCallback> &get_action_parsers();
class InfluencesCollector {
@@ -134,7 +136,7 @@ class VTreeData {
return *system_names;
}
- Action *build_action(VirtualSocket *start)
+ Action *build_action(InfluencesCollector &collector, VirtualSocket *start)
{
BLI_assert(start->is_input());
if (start->links().size() != 1) {
@@ -148,7 +150,7 @@ class VTreeData {
StringMap<ActionParserCallback> &parsers = get_action_parsers();
ActionParserCallback &parser = parsers.lookup(execute_socket->vnode()->idname());
- std::unique_ptr<Action> action = parser(*this, execute_socket);
+ std::unique_ptr<Action> action = parser(collector, *this, execute_socket);
Action *action_ptr = action.get();
if (action_ptr == nullptr) {
return nullptr;
@@ -157,12 +159,14 @@ class VTreeData {
return action_ptr;
}
- Action &build_action_list(VirtualNode *start_vnode, StringRef name)
+ Action &build_action_list(InfluencesCollector &collector,
+ VirtualNode *start_vnode,
+ StringRef name)
{
Vector<VirtualSocket *> execute_sockets = this->find_execute_sockets(start_vnode, name);
Vector<Action *> actions;
for (VirtualSocket *socket : execute_sockets) {
- Action *action = this->build_action(socket);
+ Action *action = this->build_action(collector, socket);
if (action != nullptr) {
actions.append(action);
}
@@ -236,13 +240,15 @@ class VTreeData {
}
};
-static std::unique_ptr<Action> ACTION_kill(VTreeData &UNUSED(vtree_data),
+static std::unique_ptr<Action> ACTION_kill(InfluencesCollector &UNUSED(collector),
+ VTreeData &UNUSED(vtree_data),
VirtualSocket *UNUSED(execute_vsocket))
{
return std::unique_ptr<Action>(new KillAction());
}
-static std::unique_ptr<Action> ACTION_change_velocity(VTreeData &vtree_data,
+static std::unique_ptr<Action> ACTION_change_velocity(InfluencesCollector &UNUSED(collector),
+ VTreeData &vtree_data,
VirtualSocket *execute_vsocket)
{
VirtualNode *vnode = execute_vsocket->vnode();
@@ -266,7 +272,8 @@ static std::unique_ptr<Action> ACTION_change_velocity(VTreeData &vtree_data,
return std::unique_ptr<Action>(action);
}
-static std::unique_ptr<Action> ACTION_explode(VTreeData &vtree_data,
+static std::unique_ptr<Action> ACTION_explode(InfluencesCollector &collector,
+ VTreeData &vtree_data,
VirtualSocket *execute_vsocket)
{
VirtualNode *vnode = execute_vsocket->vnode();
@@ -276,7 +283,7 @@ static std::unique_ptr<Action> ACTION_explode(VTreeData &vtree_data,
return {};
}
- Action &on_birth_action = vtree_data.build_action_list(vnode, "Execute on Birth");
+ Action &on_birth_action = vtree_data.build_action_list(collector, vnode, "Execute on Birth");
ArrayRef<std::string> system_names = vtree_data.find_target_system_names(
vnode->output(1, "Explode System"));
@@ -284,7 +291,8 @@ static std::unique_ptr<Action> ACTION_explode(VTreeData &vtree_data,
return std::unique_ptr<Action>(action);
}
-static std::unique_ptr<Action> ACTION_condition(VTreeData &vtree_data,
+static std::unique_ptr<Action> ACTION_condition(InfluencesCollector &collector,
+ VTreeData &vtree_data,
VirtualSocket *execute_vsocket)
{
VirtualNode *vnode = execute_vsocket->vnode();
@@ -294,14 +302,15 @@ static std::unique_ptr<Action> ACTION_condition(VTreeData &vtree_data,
return {};
}
- Action &action_true = vtree_data.build_action_list(vnode, "Execute If True");
- Action &action_false = vtree_data.build_action_list(vnode, "Execute If False");
+ Action &action_true = vtree_data.build_action_list(collector, vnode, "Execute If True");
+ Action &action_false = vtree_data.build_action_list(collector, vnode, "Execute If False");
Action *action = new ConditionAction(inputs_fn, action_true, action_false);
return std::unique_ptr<Action>(action);
}
-static std::unique_ptr<Action> ACTION_change_color(VTreeData &vtree_data,
+static std::unique_ptr<Action> ACTION_change_color(InfluencesCollector &UNUSED(collector),
+ VTreeData &vtree_data,
VirtualSocket *execute_vsocket)
{
VirtualNode *vnode = execute_vsocket->vnode();
@@ -315,7 +324,8 @@ static std::unique_ptr<Action> ACTION_change_color(VTreeData &vtree_data,
return std::unique_ptr<Action>(action);
}
-static std::unique_ptr<Action> ACTION_change_size(VTreeData &vtree_data,
+static std::unique_ptr<Action> ACTION_change_size(InfluencesCollector &UNUSED(collector),
+ VTreeData &vtree_data,
VirtualSocket *execute_vsocket)
{
VirtualNode *vnode = execute_vsocket->vnode();
@@ -329,7 +339,8 @@ static std::unique_ptr<Action> ACTION_change_size(VTreeData &vtree_data,
return std::unique_ptr<Action>(action);
}
-static std::unique_ptr<Action> ACTION_change_position(VTreeData &vtree_data,
+static std::unique_ptr<Action> ACTION_change_position(InfluencesCollector &UNUSED(collector),
+ VTreeData &vtree_data,
VirtualSocket *execute_vsocket)
{
VirtualNode *vnode = execute_vsocket->vnode();
@@ -371,7 +382,7 @@ static void PARSE_point_emitter(InfluencesCollector &collector,
return;
}
- Action &action = vtree_data.build_action_list(vnode, "Execute on Birth");
+ Action &action = vtree_data.build_action_list(collector, vnode, "Execute on Birth");
ArrayRef<std::string> system_names = vtree_data.find_target_system_names(
vnode->output(0, "Emitter"));
@@ -448,7 +459,7 @@ static void PARSE_mesh_emitter(InfluencesCollector &collector,
return;
}
- Action &on_birth_action = vtree_data.build_action_list(vnode, "Execute on Birth");
+ Action &on_birth_action = vtree_data.build_action_list(collector, vnode, "Execute on Birth");
Object *object = inputs->relocate_out<ObjectW>(0, "Object").ptr();
if (object == nullptr || object->type != OB_MESH) {
@@ -507,7 +518,7 @@ static void PARSE_age_reached_event(InfluencesCollector &collector,
ArrayRef<std::string> system_names = vtree_data.find_target_system_names(
vnode->output(0, "Event"));
- Action &action = vtree_data.build_action_list(vnode, "Execute on Event");
+ Action &action = vtree_data.build_action_list(collector, vnode, "Execute on Event");
std::string is_triggered_attribute = vnode->name();
@@ -533,7 +544,7 @@ static void PARSE_trails(InfluencesCollector &collector,
return;
}
- Action &action = vtree_data.build_action_list(vnode, "Execute on Birth");
+ Action &action = vtree_data.build_action_list(collector, vnode, "Execute on Birth");
for (const std::string &main_type : main_system_names) {
OffsetHandler *offset_handler = new CreateTrailHandler(trail_system_names, inputs_fn, action);
@@ -551,7 +562,7 @@ static void PARSE_initial_grid_emitter(InfluencesCollector &collector,
return;
}
- Action &action = vtree_data.build_action_list(vnode, "Execute on Birth");
+ Action &action = vtree_data.build_action_list(collector, vnode, "Execute on Birth");
ArrayRef<std::string> system_names = vtree_data.find_target_system_names(
vnode->output(0, "Emitter"));
@@ -639,7 +650,7 @@ static void PARSE_mesh_collision(InfluencesCollector &collector,
ArrayRef<std::string> system_names = vtree_data.find_target_system_names(
vnode->output(0, "Event"));
- Action &action = vtree_data.build_action_list(vnode, "Execute on Event");
+ Action &action = vtree_data.build_action_list(collector, vnode, "Execute on Event");
float4x4 local_to_world_end = object->obmat;
float4x4 local_to_world_begin =
@@ -713,7 +724,7 @@ static void PARSE_custom_event(InfluencesCollector &collector,
ArrayRef<std::string> system_names = vtree_data.find_target_system_names(
vnode->output(0, "Event"));
- Action &action = vtree_data.build_action_list(vnode, "Execute on Event");
+ Action &action = vtree_data.build_action_list(collector, vnode, "Execute on Event");
std::string is_triggered_attribute = vnode->name();
@@ -731,7 +742,7 @@ static void PARSE_always_execute(InfluencesCollector &collector,
{
ArrayRef<std::string> system_names = vtree_data.find_target_system_names(
vnode->output(0, "Influence"));
- Action &action = vtree_data.build_action_list(vnode, "Execute");
+ Action &action = vtree_data.build_action_list(collector, vnode, "Execute");
for (const std::string &system_name : system_names) {
OffsetHandler *handler = new AlwaysExecuteHandler(action);
More information about the Bf-blender-cvs
mailing list