[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48356] branches/soc-2012-bratwurst/source /blender/collada: Constraint export modification.

Sukhitha Jayathilake pr.jayathilake at gmail.com
Thu Jun 28 07:33:23 CEST 2012


Revision: 48356
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48356
Author:   phabtar
Date:     2012-06-28 05:33:09 +0000 (Thu, 28 Jun 2012)
Log Message:
-----------
Constraint export modification.

Modified Paths:
--------------
    branches/soc-2012-bratwurst/source/blender/collada/AnimationExporter.cpp
    branches/soc-2012-bratwurst/source/blender/collada/DocumentImporter.cpp
    branches/soc-2012-bratwurst/source/blender/collada/DocumentImporter.h

Modified: branches/soc-2012-bratwurst/source/blender/collada/AnimationExporter.cpp
===================================================================
--- branches/soc-2012-bratwurst/source/blender/collada/AnimationExporter.cpp	2012-06-28 04:06:44 UTC (rev 48355)
+++ branches/soc-2012-bratwurst/source/blender/collada/AnimationExporter.cpp	2012-06-28 05:33:09 UTC (rev 48356)
@@ -145,6 +145,7 @@
     //Takes frames of target animations
 	make_anim_frames_from_targets(ob, fra);
     
+	if (fra.size())
 	dae_baked_object_animation(fra, ob);
 }
 

Modified: branches/soc-2012-bratwurst/source/blender/collada/DocumentImporter.cpp
===================================================================
--- branches/soc-2012-bratwurst/source/blender/collada/DocumentImporter.cpp	2012-06-28 04:06:44 UTC (rev 48355)
+++ branches/soc-2012-bratwurst/source/blender/collada/DocumentImporter.cpp	2012-06-28 05:33:09 UTC (rev 48356)
@@ -402,7 +402,17 @@
 	return obn;
 }
 
-void DocumentImporter::create_constraints(ExtraTags *et){}
+// to create constraints off node <extra> tags. Assumes only constraint data in
+// current <extra> with blender profile.
+void DocumentImporter::create_constraints(ExtraTags *et, Object *ob){
+	if ( et && et->isProfile("blender")){
+		std::string name;
+		short* type = 0;
+		et->setData("type", type);
+		bConstraint * con = add_ob_constraint(ob, "Test_con", *type);
+		
+	}
+}
 
 void DocumentImporter::write_node(COLLADAFW::Node *node, COLLADAFW::Node *parent_node, Scene *sce, Object *par, bool is_library_node)
 {
@@ -416,8 +426,6 @@
 
 	std::vector<Object *> *objects_done = new std::vector<Object *>();
     
-	create_constraints(et);
-
 	if (is_joint) {
 		if (par) {
 			Object *empty = par;
@@ -506,6 +514,8 @@
 				libnode_ob.push_back(ob);
 		}
 
+		//create_constraints(et,ob);
+
 	}
 
 	for (std::vector<Object *>::iterator it = objects_done->begin(); it != objects_done->end(); ++it) {

Modified: branches/soc-2012-bratwurst/source/blender/collada/DocumentImporter.h
===================================================================
--- branches/soc-2012-bratwurst/source/blender/collada/DocumentImporter.h	2012-06-28 04:06:44 UTC (rev 48355)
+++ branches/soc-2012-bratwurst/source/blender/collada/DocumentImporter.h	2012-06-28 05:33:09 UTC (rev 48356)
@@ -40,6 +40,7 @@
 
 
 #include "BKE_object.h"
+#include "BKE_constraint.h"
 
 #include "TransformReader.h"
 #include "AnimationImporter.h"
@@ -73,7 +74,7 @@
 	Object* create_camera_object(COLLADAFW::InstanceCamera*, Scene*);
 	Object* create_lamp_object(COLLADAFW::InstanceLight*, Scene*);
 	Object* create_instance_node(Object*, COLLADAFW::Node*, COLLADAFW::Node*, Scene*, bool);
-	void create_constraints(ExtraTags *et);
+	void create_constraints(ExtraTags *et, Object *ob);
 	void write_node(COLLADAFW::Node*, COLLADAFW::Node*, Scene*, Object*, bool);
 	MTex* create_texture(COLLADAFW::EffectCommon*, COLLADAFW::Texture&, Material*, int, TexIndexTextureArrayMap&);
 	void write_profile_COMMON(COLLADAFW::EffectCommon*, Material*);




More information about the Bf-blender-cvs mailing list