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>2021-08-19 14:15:11 +0300
committerJacques Lucke <jacques@blender.org>2021-08-19 14:15:11 +0300
commitecf7c90840881f564a5da15f0f59fe65a8699763 (patch)
tree1e9e90bf070ba3b673f5c5b066e26dc6991b9e4a /source/blender
parentd78a530af18df4b14a9978bf2e1a9c21594bbb0f (diff)
remove redundant utilties
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/functions/FN_multi_function_procedure.hh7
-rw-r--r--source/blender/functions/FN_multi_function_procedure_builder.hh6
-rw-r--r--source/blender/functions/intern/multi_function_network_to_procedure.cc14
-rw-r--r--source/blender/functions/intern/multi_function_procedure.cc30
4 files changed, 16 insertions, 41 deletions
diff --git a/source/blender/functions/FN_multi_function_procedure.hh b/source/blender/functions/FN_multi_function_procedure.hh
index 0495a5d8ada..8b3e28d2b16 100644
--- a/source/blender/functions/FN_multi_function_procedure.hh
+++ b/source/blender/functions/FN_multi_function_procedure.hh
@@ -151,11 +151,8 @@ class MFProcedure : NonCopyable, NonMovable {
MFVariable &new_variable(MFDataType data_type, std::string name = "");
MFCallInstruction &new_call_instruction(const MultiFunction &fn);
- MFCallInstruction &new_call_instruction(const MultiFunction &fn,
- Span<MFVariable *> param_variables);
- MFBranchInstruction &new_branch_instruction(MFVariable *condition_variable = nullptr);
- MFDestructInstruction &new_destruct_instruction(MFVariable *variable = nullptr);
- DestructInstructionChain new_destruct_instructions(Span<MFVariable *> variables);
+ MFBranchInstruction &new_branch_instruction();
+ MFDestructInstruction &new_destruct_instruction();
void add_parameter(MFParamType::InterfaceType interface_type, MFVariable &variable);
diff --git a/source/blender/functions/FN_multi_function_procedure_builder.hh b/source/blender/functions/FN_multi_function_procedure_builder.hh
index d8cc84a23ab..0bd4841c6c6 100644
--- a/source/blender/functions/FN_multi_function_procedure_builder.hh
+++ b/source/blender/functions/FN_multi_function_procedure_builder.hh
@@ -135,7 +135,8 @@ class MFProcedureBuilder {
void insert_destruct(MFVariable &variable)
{
- MFDestructInstruction &instruction = procedure_->new_destruct_instruction(&variable);
+ MFDestructInstruction &instruction = procedure_->new_destruct_instruction();
+ instruction.set_variable(&variable);
this->insert_at_cursors(&instruction);
cursors_ = {MFInstructionCursor{instruction}};
}
@@ -264,7 +265,8 @@ void MFProcedureBuilder::set_cursor_after_branch(MFProcedureBuilderBranch &branc
MFProcedureBuilderBranch MFProcedureBuilder::insert_branch(MFVariable &condition)
{
- MFBranchInstruction &instruction = procedure_->new_branch_instruction(&condition);
+ MFBranchInstruction &instruction = procedure_->new_branch_instruction();
+ instruction.set_condition(&condition);
this->insert_at_cursors(&instruction);
MFProcedureBuilderBranch branch{*procedure_, *procedure_};
diff --git a/source/blender/functions/intern/multi_function_network_to_procedure.cc b/source/blender/functions/intern/multi_function_network_to_procedure.cc
index 3cb980acf1d..badf3d1ce55 100644
--- a/source/blender/functions/intern/multi_function_network_to_procedure.cc
+++ b/source/blender/functions/intern/multi_function_network_to_procedure.cc
@@ -84,8 +84,8 @@ static void add_instructions_to_compute_socket(const MFSocket &socket, Conversio
socket.name());
const MultiFunction &copy_fn = context.scope.construct<CopyMultiFunction>(
"copy function", variable.data_type());
- MFCallInstruction &copy_instruction = context.procedure.new_call_instruction(
- copy_fn, {&variable, &copied_variable});
+ MFCallInstruction &copy_instruction = context.procedure.new_call_instruction(copy_fn);
+ copy_instruction.set_params({&variable, &copied_variable});
context.ordered_instructions.append(&copy_instruction);
context.socket_variables.add_new(&socket, &copied_variable);
}
@@ -113,8 +113,8 @@ static void add_instructions_to_compute_socket(const MFSocket &socket, Conversio
output_socket.name());
const MultiFunction &copy_fn = context.scope.construct<CopyMultiFunction>(
"copy function", input_variable->data_type());
- MFCallInstruction &copy_instruction = context.procedure.new_call_instruction(
- copy_fn, {input_variable, &mutable_variable});
+ MFCallInstruction &copy_instruction = context.procedure.new_call_instruction(copy_fn);
+ copy_instruction.set_params({input_variable, &mutable_variable});
context.ordered_instructions.append(&copy_instruction);
context.socket_variables.add_new(&output_socket, &mutable_variable);
variables.append(&mutable_variable);
@@ -130,7 +130,8 @@ static void add_instructions_to_compute_socket(const MFSocket &socket, Conversio
}
}
}
- MFCallInstruction &call_fn_instruction = context.procedure.new_call_instruction(fn, variables);
+ MFCallInstruction &call_fn_instruction = context.procedure.new_call_instruction(fn);
+ call_fn_instruction.set_params(variables);
context.ordered_instructions.append(&call_fn_instruction);
}
}
@@ -157,7 +158,8 @@ MFProcedure &network_to_procedure(Span<const MFSocket *> inputs,
}
for (MFVariable *variable : procedure.variables()) {
if (!param_variables.contains(variable)) {
- MFDestructInstruction &destruct_instr = procedure.new_destruct_instruction(variable);
+ MFDestructInstruction &destruct_instr = procedure.new_destruct_instruction();
+ destruct_instr.set_variable(variable);
context.ordered_instructions.append(&destruct_instr);
}
}
diff --git a/source/blender/functions/intern/multi_function_procedure.cc b/source/blender/functions/intern/multi_function_procedure.cc
index 5741d6bdfe3..7c6d24941a2 100644
--- a/source/blender/functions/intern/multi_function_procedure.cc
+++ b/source/blender/functions/intern/multi_function_procedure.cc
@@ -132,48 +132,22 @@ MFCallInstruction &MFProcedure::new_call_instruction(const MultiFunction &fn)
return instruction;
}
-MFCallInstruction &MFProcedure::new_call_instruction(const MultiFunction &fn,
- Span<MFVariable *> param_variables)
-{
- MFCallInstruction &instruction = this->new_call_instruction(fn);
- instruction.set_params(param_variables);
- return instruction;
-}
-
-MFBranchInstruction &MFProcedure::new_branch_instruction(MFVariable *condition_variable)
+MFBranchInstruction &MFProcedure::new_branch_instruction()
{
MFBranchInstruction &instruction = *allocator_.construct<MFBranchInstruction>().release();
instruction.type_ = MFInstructionType::Branch;
branch_instructions_.append(&instruction);
- instruction.set_condition(condition_variable);
return instruction;
}
-MFDestructInstruction &MFProcedure::new_destruct_instruction(MFVariable *variable)
+MFDestructInstruction &MFProcedure::new_destruct_instruction()
{
MFDestructInstruction &instruction = *allocator_.construct<MFDestructInstruction>().release();
instruction.type_ = MFInstructionType::Destruct;
destruct_instructions_.append(&instruction);
- instruction.set_variable(variable);
return instruction;
}
-DestructInstructionChain MFProcedure::new_destruct_instructions(Span<MFVariable *> variables)
-{
- DestructInstructionChain chain;
- for (MFVariable *variable : variables) {
- MFDestructInstruction &instruction = this->new_destruct_instruction(variable);
- if (chain.first == nullptr) {
- chain.first = chain.last = &instruction;
- }
- else {
- chain.last->set_next(&instruction);
- chain.last = &instruction;
- }
- }
- return chain;
-}
-
void MFProcedure::add_parameter(MFParamType::InterfaceType interface_type, MFVariable &variable)
{
params_.append({interface_type, &variable});