[Bf-blender-cvs] [001ba5b] master: Code refactor: nodify object and mesh, but not used for XML yet.

Brecht Van Lommel noreply at git.blender.org
Sat May 28 19:13:06 CEST 2016


Commit: 001ba5bdf5975906f294cc7bde258409be7444b0
Author: Brecht Van Lommel
Date:   Sat May 7 21:44:17 2016 +0200
Branches: master
https://developer.blender.org/rB001ba5bdf5975906f294cc7bde258409be7444b0

Code refactor: nodify object and mesh, but not used for XML yet.

Differential Revision: https://developer.blender.org/D2016

===================================================================

M	intern/cycles/render/mesh.cpp
M	intern/cycles/render/mesh.h
M	intern/cycles/render/object.cpp
M	intern/cycles/render/object.h

===================================================================

diff --git a/intern/cycles/render/mesh.cpp b/intern/cycles/render/mesh.cpp
index 722632b..00b8e02 100644
--- a/intern/cycles/render/mesh.cpp
+++ b/intern/cycles/render/mesh.cpp
@@ -75,19 +75,42 @@ void Mesh::Curve::bounds_grow(const int k, const float3 *curve_keys, const float
 
 /* Mesh */
 
+NODE_DEFINE(Mesh)
+{
+	NodeType* type = NodeType::add("mesh", create);
+
+	static NodeEnum displacement_method_enum;
+	displacement_method_enum.insert("bump", DISPLACE_BUMP);
+	displacement_method_enum.insert("true", DISPLACE_TRUE);
+	displacement_method_enum.insert("both", DISPLACE_BOTH);
+	SOCKET_ENUM(displacement_method, "Displacement Method", displacement_method_enum, DISPLACE_BUMP);
+
+	SOCKET_INT(motion_steps, "Motion Steps", 3);
+	SOCKET_BOOLEAN(use_motion_blur, "Use Motion Blur", false);
+
+	SOCKET_INT_ARRAY(triangles, "Triangles", array<int>());
+	SOCKET_POINT_ARRAY(verts, "Vertices", array<float3>());
+	SOCKET_INT_ARRAY(shader, "Shader", array<int>());
+	SOCKET_BOOLEAN_ARRAY(smooth, "Smooth", array<bool>());
+
+	SOCKET_POINT_ARRAY(curve_keys, "Curve Keys", array<float3>());
+	SOCKET_FLOAT_ARRAY(curve_radius, "Curve Radius", array<float>());
+	SOCKET_INT_ARRAY(curve_first_key, "Curve First Key", array<int>());
+	SOCKET_INT_ARRAY(curve_shader, "Curve Shader", array<int>());
+
+	return type;
+}
+
 Mesh::Mesh()
+: Node(node_type)
 {
 	need_update = true;
 	need_update_rebuild = false;
 	transform_applied = false;
 	transform_negative_scaled = false;
 	transform_normal = transform_identity();
-	displacement_method = DISPLACE_BUMP;
 	bounds = BoundBox::empty;
 
-	motion_steps = 3;
-	use_motion_blur = false;
-
 	bvh = NULL;
 
 	tri_offset = 0;
diff --git a/intern/cycles/render/mesh.h b/intern/cycles/render/mesh.h
index 2d1f3e3..7556b7c 100644
--- a/intern/cycles/render/mesh.h
+++ b/intern/cycles/render/mesh.h
@@ -18,6 +18,7 @@
 #define __MESH_H__
 
 #include "attribute.h"
+#include "node.h"
 #include "shader.h"
 
 #include "util_boundbox.h"
@@ -42,8 +43,10 @@ class DiagSplit;
 
 /* Mesh */
 
-class Mesh {
+class Mesh : public Node {
 public:
+	NODE_DECLARE;
+
 	/* Mesh Triangle */
 	struct Triangle {
 		int v[3];
@@ -95,8 +98,6 @@ public:
 		DISPLACE_NUM_METHODS,
 	};
 
-	ustring name;
-
 	/* Mesh Data */
 	enum GeometryFlags {
 		GEOMETRY_NONE      = 0,
diff --git a/intern/cycles/render/object.cpp b/intern/cycles/render/object.cpp
index 4e74940..9ee1a9e 100644
--- a/intern/cycles/render/object.cpp
+++ b/intern/cycles/render/object.cpp
@@ -33,14 +33,25 @@ CCL_NAMESPACE_BEGIN
 
 /* Object */
 
+NODE_DEFINE(Object)
+{
+	NodeType* type = NodeType::add("object", create);
+
+	SOCKET_NODE(mesh, "Mesh", &Mesh::node_type);
+	SOCKET_TRANSFORM(tfm, "Transform", transform_identity());
+	SOCKET_INT(visibility, "Visibility", ~0);
+	SOCKET_INT(random_id, "Random ID", 0);
+	SOCKET_INT(pass_id, "Pass ID", 0);
+	SOCKET_BOOLEAN(use_holdout, "Use Holdout", false);
+	SOCKET_POINT(dupli_generated, "Dupli Generated", make_float3(0.0f, 0.0f, 0.0f));
+	SOCKET_POINT2(dupli_uv, "Dupli UV", make_float2(0.0f, 0.0f));
+
+	return type;
+}
+
 Object::Object()
+: Node(node_type)
 {
-	name = "";
-	mesh = NULL;
-	tfm = transform_identity();
-	visibility = ~0;
-	random_id = 0;
-	pass_id = 0;
 	particle_system = NULL;
 	particle_index = 0;
 	bounds = BoundBox::empty;
@@ -48,9 +59,6 @@ Object::Object()
 	motion.mid = transform_identity();
 	motion.post = transform_identity();
 	use_motion = false;
-	use_holdout = false;
-	dupli_generated = make_float3(0.0f, 0.0f, 0.0f);
-	dupli_uv = make_float2(0.0f, 0.0f);
 }
 
 Object::~Object()
diff --git a/intern/cycles/render/object.h b/intern/cycles/render/object.h
index c2a79ca..57614c9 100644
--- a/intern/cycles/render/object.h
+++ b/intern/cycles/render/object.h
@@ -17,6 +17,7 @@
 #ifndef __OBJECT_H__
 #define __OBJECT_H__
 
+#include "node.h"
 #include "scene.h"
 
 #include "util_boundbox.h"
@@ -37,12 +38,13 @@ struct Transform;
 
 /* Object */
 
-class Object {
+class Object : public Node {
 public:
+	NODE_DECLARE;
+
 	Mesh *mesh;
 	Transform tfm;
 	BoundBox bounds;
-	ustring name;
 	uint random_id;
 	int pass_id;
 	vector<ParamValue> attributes;




More information about the Bf-blender-cvs mailing list