[Bf-blender-cvs] [da90b8e] object_nodes: Added a 'PASS_MESH' node.
Lukas Tönne
noreply at git.blender.org
Tue Nov 24 09:44:34 CET 2015
Commit: da90b8ef79fd4da040ed2bab25baad2112609cba
Author: Lukas Tönne
Date: Thu Nov 19 17:19:43 2015 +0100
Branches: object_nodes
https://developer.blender.org/rBda90b8ef79fd4da040ed2bab25baad2112609cba
Added a 'PASS_MESH' node.
===================================================================
M release/scripts/startup/bl_operators/object_nodes.py
M source/blender/blenvm/bvm/bvm_eval.cc
M source/blender/blenvm/bvm/bvm_opcode.h
M source/blender/blenvm/compile/bvm_nodegraph.cc
===================================================================
diff --git a/release/scripts/startup/bl_operators/object_nodes.py b/release/scripts/startup/bl_operators/object_nodes.py
index f226f8b..3c30368 100644
--- a/release/scripts/startup/bl_operators/object_nodes.py
+++ b/release/scripts/startup/bl_operators/object_nodes.py
@@ -255,7 +255,9 @@ class GeometryOutputNode(GeometryNodeBase, ObjectNode):
self.inputs.new('GeometrySocket', "")
def compile(self, compiler):
- pass
+ node = compiler.add_node("PASS_MESH", self.name)
+ compiler.map_input(0, node, "value")
+ compiler.set_output("mesh", node, "value")
class GeometryMeshNode(GeometryNodeBase, ObjectNode):
@@ -267,7 +269,8 @@ class GeometryMeshNode(GeometryNodeBase, ObjectNode):
self.outputs.new('GeometrySocket', "")
def compile(self, compiler):
- pass
+ node = compiler.add_node("MESH_LOAD", self.name)
+ compiler.map_output(0, node, "mesh")
###############################################################################
diff --git a/source/blender/blenvm/bvm/bvm_eval.cc b/source/blender/blenvm/bvm/bvm_eval.cc
index a44b702..098002b 100644
--- a/source/blender/blenvm/bvm/bvm_eval.cc
+++ b/source/blender/blenvm/bvm/bvm_eval.cc
@@ -146,6 +146,12 @@ static void eval_op_pass_pointer(float *stack, StackIndex offset_from, StackInde
stack_store_pointer(stack, offset_to, p);
}
+static void eval_op_pass_mesh(float *stack, StackIndex offset_from, StackIndex offset_to)
+{
+ mesh_ptr p = stack_load_mesh(stack, offset_from);
+ stack_store_mesh(stack, offset_to, p);
+}
+
static void eval_op_set_float3(float *stack, StackIndex offset_x, StackIndex offset_y, StackIndex offset_z, StackIndex offset_to)
{
float x = stack_load_float(stack, offset_x);
@@ -565,6 +571,12 @@ void EvalContext::eval_instructions(const EvalGlobals *globals, const EvalData *
eval_op_pass_pointer(stack, offset_from, offset_to);
break;
}
+ case OP_PASS_MESH: {
+ StackIndex offset_from = fn->read_stack_index(&instr);
+ StackIndex offset_to = fn->read_stack_index(&instr);
+ eval_op_pass_mesh(stack, offset_from, offset_to);
+ break;
+ }
case OP_SET_FLOAT3: {
StackIndex offset_x = fn->read_stack_index(&instr);
StackIndex offset_y = fn->read_stack_index(&instr);
diff --git a/source/blender/blenvm/bvm/bvm_opcode.h b/source/blender/blenvm/bvm/bvm_opcode.h
index 7d65040..0f18b54 100644
--- a/source/blender/blenvm/bvm/bvm_opcode.h
+++ b/source/blender/blenvm/bvm/bvm_opcode.h
@@ -51,6 +51,7 @@ enum OpCode {
OP_PASS_INT,
OP_PASS_MATRIX44,
OP_PASS_POINTER,
+ OP_PASS_MESH,
OP_SET_FLOAT3,
OP_GET_ELEM_FLOAT3,
OP_SET_FLOAT4,
diff --git a/source/blender/blenvm/compile/bvm_nodegraph.cc b/source/blender/blenvm/compile/bvm_nodegraph.cc
index ae54858..2617f27 100644
--- a/source/blender/blenvm/compile/bvm_nodegraph.cc
+++ b/source/blender/blenvm/compile/bvm_nodegraph.cc
@@ -746,6 +746,7 @@ OpCode get_opcode_from_node_type(const string &node)
NODETYPE(PASS_INT);
NODETYPE(PASS_MATRIX44);
NODETYPE(PASS_POINTER);
+ NODETYPE(PASS_MESH);
NODETYPE(SET_FLOAT3);
NODETYPE(GET_ELEM_FLOAT3);
NODETYPE(SET_FLOAT4);
@@ -840,6 +841,10 @@ void register_opcode_node_types()
nt->add_input("value", BVM_POINTER, PointerRNA_NULL);
nt->add_output("value", BVM_POINTER, PointerRNA_NULL);
+ nt = NodeGraph::add_node_type("PASS_MESH");
+ nt->add_input("value", BVM_MESH, __empty_mesh__);
+ nt->add_output("value", BVM_MESH, __empty_mesh__);
+
nt = NodeGraph::add_node_type("GET_ELEM_FLOAT3");
nt->add_input("index", BVM_INT, 0, true);
nt->add_input("value", BVM_FLOAT3, float3(0.0f, 0.0f, 0.0f));
More information about the Bf-blender-cvs
mailing list