[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [58678] branches/soc-2013-cycles_mblur/ intern/cycles/blender: More work toward getting export to work.

Gavin Howard gavin.d.howard at gmail.com
Sat Jul 27 22:54:53 CEST 2013


Revision: 58678
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=58678
Author:   gdh
Date:     2013-07-27 20:54:52 +0000 (Sat, 27 Jul 2013)
Log Message:
-----------
More work toward getting export to work.

This commit changes things so that the debug output is only ouput on the 
last pass. Currently, the debug output shows that every vertex is at 
0,0,0. That is obviously incorrect, but I am having trouble figuring out 
why. I do know that the floats are pulled out correctly. They are also 
inserted into the Attribute correctly.

Brecht, Stuart, and DingTo, do you know what could be wrong?

Modified Paths:
--------------
    branches/soc-2013-cycles_mblur/intern/cycles/blender/blender_mesh.cpp
    branches/soc-2013-cycles_mblur/intern/cycles/blender/blender_object.cpp
    branches/soc-2013-cycles_mblur/intern/cycles/blender/blender_sync.h

Modified: branches/soc-2013-cycles_mblur/intern/cycles/blender/blender_mesh.cpp
===================================================================
--- branches/soc-2013-cycles_mblur/intern/cycles/blender/blender_mesh.cpp	2013-07-27 20:42:43 UTC (rev 58677)
+++ branches/soc-2013-cycles_mblur/intern/cycles/blender/blender_mesh.cpp	2013-07-27 20:54:52 UTC (rev 58678)
@@ -534,10 +534,7 @@
 
 void BlenderSync::sync_mesh_motion(BL::Object b_ob, Mesh *mesh)
 {
-	/* TODO: If I am correct, this will actually be called once per
-	 * export step. I need to make sure the attribute is only created
-	 * the first time. gdh */
-	
+
 	/* todo: displacement, subdivision */
 	size_t size = mesh->verts.size();
 
@@ -555,21 +552,8 @@
 		Attribute *attr_M = mesh->attributes.find(std);
 		size_t i = 0;
 
-		for(b_mesh.vertices.begin(v); v != b_mesh.vertices.end() && i < size; ++v, i++)
+		for(b_mesh.vertices.begin(v); v != b_mesh.vertices.end() && i < size; ++v, i++) {
 			attr_M->add(get_float3(v->co()));
-		
-		uint steps = mesh->mblur_steps;
-		uint numverts = mesh->verts.size();
-		Attribute *attr = mesh->attributes.find(ATTR_STD_DMOTION);
-		float3 *verts = attr->data_float3();
-		float3 item;
-		for(uint i = 0; i < steps - 1; ++i) {
-			cout << "\nStep " << (i + 1) << ":\n";
-			for(uint j = 0; j < numverts; ++j) {
-				item = verts[i * numverts + j];
-				cout << "Vert " << (j + 1) << ": " << item[0] << "," << item[1] << "," << item[2] << endl;
-			}
-			cout << endl;
 		}
 
 		/* free derived mesh */

Modified: branches/soc-2013-cycles_mblur/intern/cycles/blender/blender_object.cpp
===================================================================
--- branches/soc-2013-cycles_mblur/intern/cycles/blender/blender_object.cpp	2013-07-27 20:42:43 UTC (rev 58677)
+++ branches/soc-2013-cycles_mblur/intern/cycles/blender/blender_object.cpp	2013-07-27 20:54:52 UTC (rev 58678)
@@ -263,7 +263,7 @@
 /* Object */
 
 Object *BlenderSync::sync_object(BL::Object b_parent, int persistent_id[OBJECT_PERSISTENT_ID_SIZE], BL::DupliObject b_dupli_ob,
-                                 Transform& tfm, uint layer_flag, float export_time, bool motion, bool hide_tris)
+                                 Transform& tfm, uint layer_flag, float export_time, bool motion, bool hide_tris, bool display)
 {
 	BL::Object b_ob = (b_dupli_ob ? b_dupli_ob.object() : b_parent);
 	
@@ -298,8 +298,25 @@
 
 			/* mesh deformation blur not supported yet
 			 * but we're working on it :) */
-			if(object->use_motion && object->use_deform_mblur)
+			if(object->use_motion && object->use_deform_mblur) {
 				sync_mesh_motion(b_ob, object->mesh);
+			
+				if (display) {
+					uint steps = object->mesh->mblur_steps;
+					uint size = object->mesh->verts.size();
+					Attribute *attr = object->mesh->attributes.find(ATTR_STD_DMOTION);
+					float3 *verts = attr->data_float3();
+					float3 item;
+					for(uint i = 0; i < steps - 1; ++i) {
+						cout << "\nStep " << (i + 1) << ":\n";
+						for(uint j = 0; j < size; ++j) {
+							item = verts[i * size+ j];
+							cout << "Vert " << (j + 1) << ": " << item[0] << "," << item[1] << "," << item[2] << endl;
+						}
+						cout << endl;
+					}
+				}
+			}
 		}
 
 		return object;
@@ -490,7 +507,7 @@
 
 /* Object Loop */
 
-void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, std::set<float> *export_times, float export_time, bool motion)
+void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, std::set<float> *export_times, float export_time, bool motion, bool display)
 {
 	/* layer data */
 	uint scene_layer = render_layer.scene_layer;
@@ -542,7 +559,7 @@
 
 							/* sync object and mesh or light data */
 							Object *object = sync_object(*b_ob, persistent_id.data, *b_dup, tfm,
-							                             ob_layer, export_time, motion, hide_tris);
+							                             ob_layer, export_time, motion, hide_tris, display);
 							
 							/* Make sure the object exists (I was getting null objects). */
 							if (object && !motion) {
@@ -578,7 +595,7 @@
 					/* object itself */
 					Transform tfm = get_transform(b_ob->matrix_world());
 					Object *object = sync_object(*b_ob, NULL, PointerRNA_NULL, tfm,
-					                             ob_layer, export_time, motion, hide_tris);
+					                             ob_layer, export_time, motion, hide_tris, display);
 					
 					/* Make sure the object exists (I was getting null objects). */
 					if (object && !motion) {
@@ -640,13 +657,14 @@
 	set<float>::iterator i;
 	int frame;
 	float subframe;
-	for(i = export_times->begin(); i != export_times->end(); i++) {
+	int index = 0;
+	for(i = export_times->begin(); i != export_times->end(); i++, index++) {
 
 		/*Get the frame and subframe. */
 		frame = static_cast<int>(*i);
 		subframe = *i - frame;
 		b_scene.frame_set(frame, subframe);
-		sync_objects(b_v3d, NULL, *i, true);
+		sync_objects(b_v3d, NULL, *i, true, index == (export_times->size() - 1));
 	}
 
 //	for(int motion = -1; motion <= 1; motion += 2) {

Modified: branches/soc-2013-cycles_mblur/intern/cycles/blender/blender_sync.h
===================================================================
--- branches/soc-2013-cycles_mblur/intern/cycles/blender/blender_sync.h	2013-07-27 20:42:43 UTC (rev 58677)
+++ branches/soc-2013-cycles_mblur/intern/cycles/blender/blender_sync.h	2013-07-27 20:54:52 UTC (rev 58678)
@@ -73,7 +73,7 @@
 	/* sync */
 	void sync_lamps(bool update_all);
 	void sync_materials(bool update_all);
-	void sync_objects(BL::SpaceView3D b_v3d, std::set<float> *export_times, float export_time = 0.0f, bool motion = false);
+	void sync_objects(BL::SpaceView3D b_v3d, std::set<float> *export_times, float export_time = 0.0f, bool motion = false, bool display = false);
 	void sync_motion(BL::SpaceView3D b_v3d, BL::Object b_override, std::set<float> *export_times);
 	void sync_film();
 	void sync_view();
@@ -85,7 +85,7 @@
 	Mesh *sync_mesh(BL::Object b_ob, bool object_updated, bool hide_tris, uint mblur_steps);
 	void sync_curves(Mesh *mesh, BL::Mesh b_mesh, BL::Object b_ob, bool object_updated);
 	Object *sync_object(BL::Object b_parent, int persistent_id[OBJECT_PERSISTENT_ID_SIZE], BL::DupliObject b_dupli_ob,
-	                                 Transform& tfm, uint layer_flag, float export_time, bool motion, bool hide_tris);
+	                                 Transform& tfm, uint layer_flag, float export_time, bool motion, bool hide_tris, bool display);
 	void sync_light(BL::Object b_parent, int persistent_id[OBJECT_PERSISTENT_ID_SIZE], BL::Object b_ob, Transform& tfm);
 	void sync_background_light();
 	void sync_mesh_motion(BL::Object b_ob, Mesh *mesh);




More information about the Bf-blender-cvs mailing list