[Bf-blender-cvs] [965cae5] object_nodes: Removed unused code.
Lukas Tönne
noreply at git.blender.org
Tue Nov 24 09:43:48 CET 2015
Commit: 965cae5a7b487f8a24e712d8c23bfe3d9acbf60c
Author: Lukas Tönne
Date: Mon Nov 2 14:27:22 2015 +0100
Branches: object_nodes
https://developer.blender.org/rB965cae5a7b487f8a24e712d8c23bfe3d9acbf60c
Removed unused code.
===================================================================
M source/blender/blenvm/intern/bvm_api.cc
===================================================================
diff --git a/source/blender/blenvm/intern/bvm_api.cc b/source/blender/blenvm/intern/bvm_api.cc
index 110ab64..eb5b53d 100644
--- a/source/blender/blenvm/intern/bvm_api.cc
+++ b/source/blender/blenvm/intern/bvm_api.cc
@@ -370,195 +370,6 @@ int BVM_compile_get_object_index(BVMCompileContext *context, Object *ob)
return _COMP(context)->get_object_index(ob);
}
-static void binary_math_node(bvm::bNodeCompiler *comp, const bvm::string &type)
-{
- bvm::NodeInstance *node = comp->add_node(type, comp->current_node()->name);
- comp->map_input_socket(0, node, "value_a");
- comp->map_input_socket(1, node, "value_b");
- comp->map_output_socket(0, node, "value");
-}
-
-static void unary_math_node(bvm::bNodeCompiler *comp, const bvm::string &type)
-{
- bvm::NodeInstance *node = comp->add_node(type, comp->current_node()->name);
- bNodeSocket *sock0 = (bNodeSocket *)BLI_findlink(&comp->current_node()->inputs, 0);
- bNodeSocket *sock1 = (bNodeSocket *)BLI_findlink(&comp->current_node()->inputs, 1);
- bool sock0_linked = !nodeSocketIsHidden(sock0) && (sock0->flag & SOCK_IN_USE);
- bool sock1_linked = !nodeSocketIsHidden(sock1) && (sock1->flag & SOCK_IN_USE);
- if (sock0_linked || !sock1_linked)
- comp->map_input_socket(0, node, "value");
- else
- comp->map_input_socket(1, node, "value");
- comp->map_output_socket(0, node, "value");
-}
-
-struct ForceFieldNodeParser : public bNodeParser {
- typedef std::map<struct Object *, int> ObjectPtrMap;
-
- struct Object *effob;
- ObjectPtrMap obmap;
-
- ForceFieldNodeParser(const bvm::EvalGlobals *globals, struct Object *effob) :
- effob(effob)
- {
- for (int i = 0; i < globals->objects.size(); ++i) {
- obmap[globals->objects[i]] = i;
- }
- }
-
- void parse(bvm::bNodeCompiler *comp, PointerRNA *bnode_ptr) const
- {
- bNode *bnode = (bNode *)bnode_ptr->data;
- bvm::string type = bvm::string(bnode->typeinfo->idname);
- if (type == "ForceOutputNode") {
- {
- bvm::NodeInstance *node = comp->add_node("PASS_FLOAT3", "RET_FORCE_" + bvm::string(comp->current_node()->name));
- comp->map_input_socket(0, node, "value");
- comp->map_output_socket(0, node, "value");
-
- comp->set_graph_output("force", node, "value");
- }
-
- {
- bvm::NodeInstance *node = comp->add_node("PASS_FLOAT3", "RET_IMPULSE_" + bvm::string(comp->current_node()->name));
- comp->map_input_socket(1, node, "value");
- comp->map_output_socket(0, node, "value");
-
- comp->set_graph_output("impulse", node, "value");
- }
- }
- else if (type == "ObjectSeparateVectorNode") {
- {
- bvm::NodeInstance *node = comp->add_node("GET_ELEM_FLOAT3", "GET_ELEM0_" + bvm::string(comp->current_node()->name));
- node->set_input_value("index", 0);
- comp->map_input_socket(0, node, "value");
- comp->map_output_socket(0, node, "value");
- }
- {
- bvm::NodeInstance *node = comp->add_node("GET_ELEM_FLOAT3", "GET_ELEM1_" + bvm::string(comp->current_node()->name));
- node->set_input_value("index", 1);
- comp->map_input_socket(0, node, "value");
- comp->map_output_socket(1, node, "value");
- }
- {
- bvm::NodeInstance *node = comp->add_node("GET_ELEM_FLOAT3", "GET_ELEM2_" + bvm::string(comp->current_node()->name));
- node->set_input_value("index", 2);
- comp->map_input_socket(0, node, "value");
- comp->map_output_socket(2, node, "value");
- }
- }
- else if (type == "ObjectCombineVectorNode") {
- bvm::NodeInstance *node = comp->add_node("SET_FLOAT3", bvm::string(comp->current_node()->name));
- comp->map_input_socket(0, node, "value_x");
- comp->map_input_socket(1, node, "value_y");
- comp->map_input_socket(2, node, "value_z");
- comp->map_output_socket(0, node, "value");
- }
- else if (type == "ForcePointDataNode") {
- {
- bvm::NodeInstance *node = comp->add_node("POINT_POSITION", "POINT_POS" + bvm::string(comp->current_node()->name));
- comp->map_output_socket(0, node, "value");
- }
- {
- bvm::NodeInstance *node = comp->add_node("POINT_VELOCITY", "POINT_VEL" + bvm::string(comp->current_node()->name));
- comp->map_output_socket(1, node, "value");
- }
- }
- else if (type == "ObjectMathNode") {
- int mode = RNA_enum_get(bnode_ptr, "mode");
- switch (mode) {
- case 0: binary_math_node(comp, "ADD_FLOAT"); break;
- case 1: binary_math_node(comp, "SUB_FLOAT"); break;
- case 2: binary_math_node(comp, "MUL_FLOAT"); break;
- case 3: binary_math_node(comp, "DIV_FLOAT"); break;
- case 4: unary_math_node(comp, "SINE"); break;
- case 5: unary_math_node(comp, "COSINE"); break;
- case 6: unary_math_node(comp, "TANGENT"); break;
- case 7: unary_math_node(comp, "ARCSINE"); break;
- case 8: unary_math_node(comp, "ARCCOSINE"); break;
- case 9: unary_math_node(comp, "ARCTANGENT"); break;
- case 10: binary_math_node(comp, "POWER"); break;
- case 11: binary_math_node(comp, "LOGARITHM"); break;
- case 12: binary_math_node(comp, "MINIMUM"); break;
- case 13: binary_math_node(comp, "MAXIMUM"); break;
- case 14: unary_math_node(comp, "ROUND"); break;
- case 15: binary_math_node(comp, "LESS_THAN"); break;
- case 16: binary_math_node(comp, "GREATER_THAN"); break;
- case 17: binary_math_node(comp, "MODULO"); break;
- case 18: unary_math_node(comp, "ABSOLUTE"); break;
- case 19: unary_math_node(comp, "CLAMP"); break;
- }
- }
- else if (type == "ObjectVectorMathNode") {
- int mode = RNA_enum_get(bnode_ptr, "mode");
- switch (mode) {
- case 0: {
- bvm::NodeInstance *node = comp->add_node("ADD_FLOAT3", comp->current_node()->name);
- comp->map_input_socket(0, node, "value_a");
- comp->map_input_socket(1, node, "value_b");
- comp->map_output_socket(0, node, "value");
- break;
- }
- case 1: {
- bvm::NodeInstance *node = comp->add_node("SUB_FLOAT3", comp->current_node()->name);
- comp->map_input_socket(0, node, "value_a");
- comp->map_input_socket(1, node, "value_b");
- comp->map_output_socket(0, node, "value");
- break;
- }
- case 2: {
- bvm::NodeInstance *node = comp->add_node("AVERAGE_FLOAT3", comp->current_node()->name);
- comp->map_input_socket(0, node, "value_a");
- comp->map_input_socket(1, node, "value_b");
- comp->map_output_socket(0, node, "value");
- break;
- }
- case 3: {
- bvm::NodeInstance *node = comp->add_node("DOT_FLOAT3", comp->current_node()->name);
- comp->map_input_socket(0, node, "value_a");
- comp->map_input_socket(1, node, "value_b");
- comp->map_output_socket(1, node, "value");
- break;
- }
- case 4: {
- bvm::NodeInstance *node = comp->add_node("CROSS_FLOAT3", comp->current_node()->name);
- comp->map_input_socket(0, node, "value_a");
- comp->map_input_socket(1, node, "value_b");
- comp->map_output_socket(0, node, "value");
- break;
- }
- case 5: {
- bvm::NodeInstance *node = comp->add_node("NORMALIZE_FLOAT3", comp->current_node()->name);
- bNodeSocket *sock0 = (bNodeSocket *)BLI_findlink(&bnode->inputs, 0);
- bNodeSocket *sock1 = (bNodeSocket *)BLI_findlink(&bnode->inputs, 1);
- bool sock0_linked = !nodeSocketIsHidden(sock0) && (sock0->flag & SOCK_IN_USE);
- bool sock1_linked = !nodeSocketIsHidden(sock1) && (sock1->flag & SOCK_IN_USE);
- if (sock0_linked || !sock1_linked)
- comp->map_input_socket(0, node, "value");
- else
- comp->map_input_socket(1, node, "value");
- comp->map_output_socket(0, node, "vector");
- comp->map_output_socket(1, node, "value");
- break;
- }
- }
- }
- else if (type == "ForceClosestPointNode") {
- bvm::NodeInstance *node = comp->add_node("EFFECTOR_CLOSEST_POINT", comp->current_node()->name);
- Object *object = effob;
- ObjectPtrMap::const_iterator it = obmap.find(object);
- if (it != obmap.end()) {
- int object_index = it->second;
- node->set_input_value("object", object_index);
- comp->map_input_socket(0, node, "vector");
- comp->map_output_socket(0, node, "position");
- comp->map_output_socket(1, node, "normal");
- comp->map_output_socket(2, node, "tangent");
- }
- }
- }
-};
-
struct BVMExpression *BVM_gen_forcefield_expression(const struct BVMEvalGlobals *globals, bNodeTree *btree)
{
using namespace bvm;
@@ -572,8 +383,6 @@ struct BVMExpression *BVM_gen_forcefield_expression(const struct BVMEvalGlobals
CompileContext comp(_GLOBALS(globals));
comp.parse_nodes(btree, &graph);
-// ForceFieldNodeParser parser(_GLOBALS(globals), effob);
-// gen_nodegraph(btree, graph, parser);
BVMCompiler compiler;
Expression *expr = compiler.codegen_expression(graph);
More information about the Bf-blender-cvs
mailing list