[Bf-blender-cvs] [ac0da72a60a] blender2.8: Fix compilation error with Collada enabled

Sergey Sharybin noreply at git.blender.org
Fri Jul 21 17:44:26 CEST 2017


Commit: ac0da72a60aa5d57e69aa4187a2d71ba8cacaa82
Author: Sergey Sharybin
Date:   Fri Jul 21 17:44:11 2017 +0200
Branches: blender2.8
https://developer.blender.org/rBac0da72a60aa5d57e69aa4187a2d71ba8cacaa82

Fix compilation error with Collada enabled

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

M	source/blender/collada/AnimationExporter.cpp
M	source/blender/collada/AnimationExporter.h
M	source/blender/collada/ControllerExporter.cpp
M	source/blender/collada/ControllerExporter.h
M	source/blender/collada/DocumentExporter.cpp
M	source/blender/collada/GeometryExporter.cpp
M	source/blender/collada/GeometryExporter.h
M	source/blender/collada/SceneExporter.cpp
M	source/blender/collada/SkinInfo.cpp
M	source/blender/collada/collada_utils.cpp
M	source/blender/collada/collada_utils.h
M	source/blender/editors/io/CMakeLists.txt
M	source/blender/editors/io/io_collada.c

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

diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp
index 881662bd0b8..42dde0be266 100644
--- a/source/blender/collada/AnimationExporter.cpp
+++ b/source/blender/collada/AnimationExporter.cpp
@@ -34,10 +34,11 @@ void forEachObjectInExportSet(Scene *sce, Functor &f, LinkNode *export_set)
 	}
 }
 
-bool AnimationExporter::exportAnimations(Scene *sce)
+bool AnimationExporter::exportAnimations(struct EvaluationContext *eval_ctx, Scene *sce)
 {
 	bool has_animations = hasAnimations(sce);
 	if (has_animations) {
+		this->eval_ctx = eval_ctx;
 		this->scene = sce;
 
 		openLibrary();
@@ -480,7 +481,7 @@ void AnimationExporter::sample_and_write_bone_animation_matrix(Object *ob_arm, B
 
 	if (flag & ARM_RESTPOS) {
 		arm->flag &= ~ARM_RESTPOS;
-		BKE_pose_where_is(scene, ob_arm);
+		BKE_pose_where_is(eval_ctx, scene, ob_arm);
 	}
 
 	if (fra.size()) {
@@ -489,7 +490,7 @@ void AnimationExporter::sample_and_write_bone_animation_matrix(Object *ob_arm, B
 
 	if (flag & ARM_RESTPOS) 
 		arm->flag = flag;
-	BKE_pose_where_is(scene, ob_arm);
+	BKE_pose_where_is(eval_ctx, scene, ob_arm);
 }
 
 void AnimationExporter::dae_baked_animation(std::vector<float> &fra, Object *ob_arm, Bone *bone)
@@ -945,10 +946,10 @@ std::string AnimationExporter::create_4x4_source(std::vector<float> &frames, Obj
 			if (pchan->flag & POSE_CHAIN) {
 				enable_fcurves(ob->adt->action, NULL);
 				BKE_animsys_evaluate_animdata(scene, &ob->id, ob->adt, ctime, ADT_RECALC_ALL);
-				BKE_pose_where_is(scene, ob);
+				BKE_pose_where_is(eval_ctx, scene, ob);
 			}
 			else {
-				BKE_pose_where_is_bone(scene, ob, pchan, ctime, 1);
+				BKE_pose_where_is_bone(eval_ctx, scene, ob, pchan, ctime, 1);
 			}
 			
 			// compute bone local mat
@@ -1438,7 +1439,7 @@ void AnimationExporter::sample_and_write_bone_animation(Object *ob_arm, Bone *bo
 	// exit rest position
 	if (flag & ARM_RESTPOS) {
 		arm->flag &= ~ARM_RESTPOS;
-		BKE_pose_where_is(scene, ob_arm);
+		BKE_pose_where_is(eval_ctx, scene, ob_arm);
 	}
 	//v array will hold all values which will be exported. 
 	if (fra.size()) {
@@ -1468,7 +1469,7 @@ void AnimationExporter::sample_and_write_bone_animation(Object *ob_arm, Bone *bo
 	// restore restpos
 	if (flag & ARM_RESTPOS) 
 		arm->flag = flag;
-	BKE_pose_where_is(scene, ob_arm);
+	BKE_pose_where_is(eval_ctx, scene, ob_arm);
 }
 
 void AnimationExporter::sample_animation(float *v, std::vector<float> &frames, int type, Bone *bone, Object *ob_arm, bPoseChannel *pchan)
@@ -1493,7 +1494,7 @@ void AnimationExporter::sample_animation(float *v, std::vector<float> &frames, i
 
 
 		BKE_animsys_evaluate_animdata(scene, &ob_arm->id, ob_arm->adt, ctime, ADT_RECALC_ANIM);
-		BKE_pose_where_is_bone(scene, ob_arm, pchan, ctime, 1);
+		BKE_pose_where_is_bone(eval_ctx, scene, ob_arm, pchan, ctime, 1);
 
 		// compute bone local mat
 		if (bone->parent) {
@@ -1554,7 +1555,7 @@ void AnimationExporter::calc_ob_mat_at_time(Object *ob, float ctime , float mat[
 
 				if (obtar) {
 					BKE_animsys_evaluate_animdata(scene, &obtar->id, obtar->adt, ctime, ADT_RECALC_ANIM);
-					BKE_object_where_is_calc_time(scene, obtar, ctime);
+					BKE_object_where_is_calc_time(eval_ctx, scene, obtar, ctime);
 				}
 			}
 
@@ -1562,7 +1563,7 @@ void AnimationExporter::calc_ob_mat_at_time(Object *ob, float ctime , float mat[
 				cti->flush_constraint_targets(con, &targets, 1);
 		}
 	}
-	BKE_object_where_is_calc_time(scene, ob, ctime);
+	BKE_object_where_is_calc_time(eval_ctx, scene, ob, ctime);
 	copy_m4_m4(mat, ob->obmat);
 }
 
diff --git a/source/blender/collada/AnimationExporter.h b/source/blender/collada/AnimationExporter.h
index 4736361ad13..d21f3a74ceb 100644
--- a/source/blender/collada/AnimationExporter.h
+++ b/source/blender/collada/AnimationExporter.h
@@ -79,12 +79,13 @@ extern "C"
 #include <vector>
 #include <algorithm> // std::find
 
-
+struct EvaluationContext;
 
 class AnimationExporter: COLLADASW::LibraryAnimations
 {
 private:
 	Scene *scene;
+	struct EvaluationContext *eval_ctx;
 	COLLADASW::StreamWriter *sw;
 
 public:
@@ -94,7 +95,7 @@ public:
 			{ this->sw = sw; }
 	
 
-	bool exportAnimations(Scene *sce);
+	bool exportAnimations(struct EvaluationContext *eval_ctx, Scene *sce);
 
 	// called for each exported object
 	void operator() (Object *ob); 
diff --git a/source/blender/collada/ControllerExporter.cpp b/source/blender/collada/ControllerExporter.cpp
index 1c2642e8313..3dd2490edfc 100644
--- a/source/blender/collada/ControllerExporter.cpp
+++ b/source/blender/collada/ControllerExporter.cpp
@@ -104,8 +104,9 @@ bool ControllerExporter::add_instance_controller(Object *ob)
 	return true;
 }
 
-void ControllerExporter::export_controllers(Scene *sce)
+void ControllerExporter::export_controllers(struct EvaluationContext *eval_ctx, Scene *sce)
 {
+	this->eval_ctx = eval_ctx;
 	scene = sce;
 
 	openLibrary();
@@ -197,7 +198,7 @@ void ControllerExporter::export_skin_controller(Object *ob, Object *ob_arm)
 	bool use_instantiation = this->export_settings->use_object_instantiation;
 	Mesh *me;
 
-	me = bc_get_mesh_copy(scene,
+	me = bc_get_mesh_copy(eval_ctx, scene,
 				ob,
 				this->export_settings->export_mesh_type,
 				this->export_settings->apply_modifiers,
@@ -299,7 +300,7 @@ void ControllerExporter::export_morph_controller(Object *ob, Key *key)
 	bool use_instantiation = this->export_settings->use_object_instantiation;
 	Mesh *me;
 
-	me = bc_get_mesh_copy(scene,
+	me = bc_get_mesh_copy(eval_ctx, scene,
 				ob,
 				this->export_settings->export_mesh_type,
 				this->export_settings->apply_modifiers,
@@ -494,7 +495,7 @@ std::string ControllerExporter::add_inv_bind_mats_source(Object *ob_arm, ListBas
 	// put armature in rest position
 	if (!(arm->flag & ARM_RESTPOS)) {
 		arm->flag |= ARM_RESTPOS;
-		BKE_pose_where_is(scene, ob_arm);
+		BKE_pose_where_is(eval_ctx, scene, ob_arm);
 	}
 
 	for (bDeformGroup *def = (bDeformGroup *)defbase->first; def; def = def->next) {
@@ -542,7 +543,7 @@ std::string ControllerExporter::add_inv_bind_mats_source(Object *ob_arm, ListBas
 	// back from rest positon
 	if (!(flag & ARM_RESTPOS)) {
 		arm->flag = flag;
-		BKE_pose_where_is(scene, ob_arm);
+		BKE_pose_where_is(eval_ctx, scene, ob_arm);
 	}
 
 	source.finish();
diff --git a/source/blender/collada/ControllerExporter.h b/source/blender/collada/ControllerExporter.h
index 80b858ca6dd..c96015c7817 100644
--- a/source/blender/collada/ControllerExporter.h
+++ b/source/blender/collada/ControllerExporter.h
@@ -54,6 +54,7 @@
 
 #include "BKE_key.h"
 
+struct EvaluationContext;
 class SceneExporter;
 
 class ControllerExporter : public COLLADASW::LibraryControllers, protected TransformWriter, protected InstanceWriter
@@ -65,11 +66,12 @@ public:
 
 	bool add_instance_controller(Object *ob);
 
-	void export_controllers(Scene *sce);
+	void export_controllers(struct EvaluationContext *eval_ctx, Scene *sce);
 
 	void operator()(Object *ob);
 
 private:
+	struct EvaluationContext *eval_ctx;
 	Scene *scene;
 	UnitConverter converter;
 	const ExportSettings *export_settings;
diff --git a/source/blender/collada/DocumentExporter.cpp b/source/blender/collada/DocumentExporter.cpp
index 6d894d6afd6..46628ed028e 100644
--- a/source/blender/collada/DocumentExporter.cpp
+++ b/source/blender/collada/DocumentExporter.cpp
@@ -285,19 +285,19 @@ int DocumentExporter::exportCurrentScene(EvaluationContext *eval_ctx, Scene *sce
 	// <library_geometries>
 	if (bc_has_object_type(export_set, OB_MESH)) {
 		GeometryExporter ge(writer, this->export_settings);
-		ge.exportGeom(sce);
+		ge.exportGeom(eval_ctx, sce);
 	}
 
 	// <library_animations>
 	AnimationExporter ae(writer, this->export_settings);
-	bool has_animations = ae.exportAnimations(sce);
+	bool has_animations = ae.exportAnimations(eval_ctx, sce);
 
 	// <library_controllers>
 	ArmatureExporter arm_exporter(writer, this->export_settings);
 	ControllerExporter controller_exporter(writer, this->export_settings);
 	if (bc_has_object_type(export_set, OB_ARMATURE) || this->export_settings->include_shapekeys) 
 	{
-		controller_exporter.export_controllers(sce);
+		controller_exporter.export_controllers(eval_ctx, sce);
 	}
 
 	// <library_visual_scenes>
diff --git a/source/blender/collada/GeometryExporter.cpp b/source/blender/collada/GeometryExporter.cpp
index 7c7c57f3305..715f0ab5370 100644
--- a/source/blender/collada/GeometryExporter.cpp
+++ b/source/blender/collada/GeometryExporter.cpp
@@ -57,10 +57,11 @@ GeometryExporter::GeometryExporter(COLLADASW::StreamWriter *sw, const ExportSett
 {
 }
 
-void GeometryExporter::exportGeom(Scene *sce)
+void GeometryExporter::exportGeom(struct EvaluationContext *eval_ctx, Scene *sce)
 {
 	openLibrary();
 
+	mEvalCtx = eval_ctx;
 	mScene = sce;
 	GeometryFunctor gf;
 	gf.forEachMeshObjectInExportSet<GeometryExporter>(sce, *this, this->export_settings->export_set);
@@ -76,7 +77,7 @@ void GeometryExporter::operator()(Object *ob)
 #endif
 
 	bool use_instantiation = this->export_settings->use_object_instantiation;
-	Mesh *me = bc_get_mesh_copy( mScene, 
+	Mesh *me = bc_get_mesh_copy(mEvalCtx, mScene, 
 					ob,
 					this->export_settings->export_mesh_type,
 					this->export_settings->apply_modifiers,
diff --git a/source/blender/collada/GeometryExporter.h b/source/blender/collada/GeometryExporter.h
index 69d1067e6f4..91062ef8f19 100644
--- a/source/blender/collada/GeometryExporter.h
+++ b/source/blender/collada/GeometryExporter.h
@@ -46,6 +46,8 @@
 
 #include "BKE_key.h"
 
+struct EvaluationContext;
+
 extern Object *bc_get_highest_selected_ancestor_or_self(Object *ob);
 
 class Normal
@@ -72,12 +74,13 @@ class GeometryExporter : COLLADASW::LibraryGeometries
 
 	Normal n;
 
+	struct EvaluationContext *mEvalCtx;
 	Scene *mScene;
 
 public:
 	GeometryExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings);
 
-	void exportGeom(Scene *sce);
+	void exportGeom(struct EvaluationContext *eval_ctx, Scene *sce);
 
 	void operator()(Object *ob);
 
diff --git a/source/blender/collada/SceneExporter.cpp b/source/blender/collada/SceneExporter.cpp
index d4f0eeb6fae..1447cd7f72f 100644
--- a/source/blender/collada/SceneExporter.cpp
+++ b/source/blender/collada/SceneExporter.cpp
@@ -237,7 +237,7 @@ voi

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list