[Bf-blender-cvs] [f228a08d027] blender2.8: merge from master

Gaia Clary noreply at git.blender.org
Mon Feb 26 22:55:36 CET 2018


Commit: f228a08d027ef700344d35f1ba958249afa93222
Author: Gaia Clary
Date:   Mon Feb 26 22:49:30 2018 +0100
Branches: blender2.8
https://developer.blender.org/rBf228a08d027ef700344d35f1ba958249afa93222

merge from master

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



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

diff --cc source/blender/collada/AnimationExporter.cpp
index 24e5ecb8d10,8c0733374a1..a1497a0ab44
--- a/source/blender/collada/AnimationExporter.cpp
+++ b/source/blender/collada/AnimationExporter.cpp
@@@ -34,7 -34,7 +34,7 @@@ void forEachObjectInExportSet(Scene *sc
  	}
  }
  
- bool AnimationExporter::exportAnimations(const struct EvaluationContext *eval_ctx, Scene *sce)
 -bool AnimationExporter::exportAnimations(Scene *sce)
++bool AnimationExporter::exportAnimations(EvaluationContext *eval_ctx, Scene *sce)
  {
  	bool has_animations = hasAnimations(sce);
  	if (has_animations) {
@@@ -171,6 -195,45 +196,45 @@@ void AnimationExporter::export_keyframe
   * Also keyframed animation exports tend to break when negative scales are involved.
   */
  void AnimationExporter::export_sampled_animation_set(Object *ob)
+ {
+ 	std::vector<float>ctimes;
+ 	find_sampleframes(ob, ctimes);
+ 	if (ctimes.size() > 0) {
+ 		if (this->export_settings->export_transformation_type == BC_TRANSFORMATION_TYPE_MATRIX)
+ 			export_sampled_matrix_animation(ob, ctimes);
+ 		else
+ 			export_sampled_transrotloc_animation(ob, ctimes);
+ 	}
+ }
+ 
+ void AnimationExporter::export_sampled_matrix_animation(Object *ob, std::vector<float> &ctimes)
+ {
+ 	UnitConverter converter;
+ 
+ 	std::vector<float> values;
+ 
+ 	for (std::vector<float>::iterator ctime = ctimes.begin(); ctime != ctimes.end(); ++ctime) {
+ 		float fmat[4][4];
+ 		float outmat[4][4];
+ 
 -		bc_update_scene(scene, *ctime);
++		bc_update_scene(eval_ctx, scene, *ctime);
+ 		BKE_object_matrix_local_get(ob, fmat);
+ 		converter.mat4_to_dae(outmat, fmat);
+ 
+ 		if (this->export_settings->limit_precision)
+ 			bc_sanitize_mat(outmat, 6);
+ 
+ 		for (int i = 0; i < 4; i++)
+ 			for (int j = 0; j < 4; j++)
+ 				values.push_back(outmat[j][i]);
+ 	}
+ 
+ 	std::string ob_name = id_name(ob);
+ 
+ 	create_sampled_animation(16, ctimes, values, ob_name, "transform", "", false);
+ }
+ 
+ void AnimationExporter::export_sampled_transrotloc_animation(Object *ob, std::vector<float> &ctimes)
  {
  	static int LOC   = 0;
  	static int EULX  = 1;
@@@ -193,7 -250,7 +251,7 @@@
  		float fsize[3];
  		float feul[3];
  
- 		evaluate_anim_with_constraints(ob, *ctime); // set object transforms to the frame
 -		bc_update_scene(scene, *ctime);
++		bc_update_scene(eval_ctx, scene, *ctime);
  
  		BKE_object_matrix_local_get(ob, fmat);
  		mat4_decompose(floc, fquat, fsize, fmat);
@@@ -1224,12 -1323,9 +1324,10 @@@ std::string AnimationExporter::create_4
  		float mat[4][4], ipar[4][4];
  		float frame = *it;
  
- 		float ctime = BKE_scene_frame_get_from_ctime(scene, *it);
- 		CFRA = BKE_scene_frame_get_from_ctime(scene, *it);
- 		//BKE_scene_graph_update_for_newframe(G.main->eval_ctx, depsgraph, G.main,scene);
- 		BKE_animsys_evaluate_animdata(scene, &ob->id, ob->adt, ctime, ADT_RECALC_ALL);
- 				
- 		if (bone) {
+ 		float ctime = BKE_scene_frame_get_from_ctime(scene, frame);
 -		bc_update_scene(scene, ctime);
++		bc_update_scene(eval_ctx, scene, ctime);
+ 		if (is_bone_animation) {
++
  			if (pchan->flag & POSE_CHAIN) {
  				enable_fcurves(ob->adt->action, NULL);
  				BKE_animsys_evaluate_animdata(scene, &ob->id, ob->adt, ctime, ADT_RECALC_ALL);
diff --cc source/blender/collada/AnimationExporter.h
index 3bb510e51d6,52b46353528..1e0f434ca13
--- a/source/blender/collada/AnimationExporter.h
+++ b/source/blender/collada/AnimationExporter.h
@@@ -85,7 -85,6 +85,7 @@@ class AnimationExporter: COLLADASW::Lib
  {
  private:
  	Scene *scene;
- 	const struct EvaluationContext *eval_ctx;
++	EvaluationContext *eval_ctx;
  	COLLADASW::StreamWriter *sw;
  
  public:
@@@ -97,7 -96,7 +97,7 @@@
  		this->sw = sw;
  	}
  
- 	bool exportAnimations(const struct EvaluationContext *eval_ctx, Scene *sce);
 -	bool exportAnimations(Scene *sce);
++	bool exportAnimations(EvaluationContext *eval_ctx, Scene *sce);
  
  	// called for each exported object
  	void operator() (Object *ob); 
diff --cc source/blender/collada/DocumentExporter.cpp
index 1741312af5f,2b5d5692871..0e020c9011b
--- a/source/blender/collada/DocumentExporter.cpp
+++ b/source/blender/collada/DocumentExporter.cpp
@@@ -300,30 -302,12 +300,12 @@@ int DocumentExporter::exportCurrentScen
  
  	SceneExporter se(writer, &arm_exporter, this->export_settings);
  
- 	// <library_animations>
- 	AnimationExporter ae(writer, this->export_settings);
- 
- #if 0
- 	bool has_animations = ae.exportAnimations(eval_ctx, sce);
- 	/* The following code seems to be an obsolete workaround
- 	Comment out until it proofs correct that we no longer need it.
- 	*/
- 	if (has_animations && this->export_settings->export_transformation_type == BC_TRANSFORMATION_TYPE_MATRIX) {
- 		// channels adressing <matrix> objects is not (yet) supported
- 		// So we force usage of <location>, <translation> and <scale>
- 		fprintf(stdout, 
- 			"For animated Ojects we must use decomposed <matrix> elements,\n" \
- 			"Forcing usage of TransLocRot transformation type.");
- 		se.setExportTransformationType(BC_TRANSFORMATION_TYPE_TRANSROTLOC);
+ 	if (this->export_settings->include_animations) {
+ 		// <library_animations>
+ 		AnimationExporter ae(writer, this->export_settings);
 -		ae.exportAnimations(sce);
++		ae.exportAnimations(eval_ctx, sce);
  	}
- 	else {
- 		se.setExportTransformationType(this->export_settings->export_transformation_type);
- 	}
- #else
- 	ae.exportAnimations(eval_ctx, sce);
- 	se.setExportTransformationType(this->export_settings->export_transformation_type);
- #endif
 -	se.exportScene(sce);
 +	se.exportScene(eval_ctx, sce);
  	
  	// <scene>
  	std::string scene_name(translate_id(id_name(sce)));
diff --cc source/blender/collada/SceneExporter.cpp
index c375c09d869,5a0badf8d3a..3a6386a8721
--- a/source/blender/collada/SceneExporter.cpp
+++ b/source/blender/collada/SceneExporter.cpp
@@@ -39,12 -38,7 +39,7 @@@ SceneExporter::SceneExporter(COLLADASW:
  {
  }
  
- void SceneExporter::setExportTransformationType(BC_export_transformation_type transformation_type)
- {
- 	this->transformation_type = transformation_type;
- }
- 
 -void SceneExporter::exportScene(Scene *sce)
 +void SceneExporter::exportScene(const EvaluationContext *eval_ctx, Scene *sce)
  {
  	// <library_visual_scenes> <visual_scene>
  	std::string id_naming = id_name(sce);
diff --cc source/blender/collada/SceneExporter.h
index ded48983bd9,b896b9abd8d..3e3c15b836f
--- a/source/blender/collada/SceneExporter.h
+++ b/source/blender/collada/SceneExporter.h
@@@ -96,15 -96,12 +96,12 @@@ class SceneExporter: COLLADASW::Library
  {
  public:
  	SceneExporter(COLLADASW::StreamWriter *sw, ArmatureExporter *arm, const ExportSettings *export_settings);
- 	void exportScene(const struct EvaluationContext *eval_ctx, Scene *sce);
- 	void setExportTransformationType(BC_export_transformation_type transformation_type);
 -	void exportScene(Scene *sce);
++	void exportScene(const EvaluationContext *eval_ctx, Scene *sce);
  
  private:
- 	BC_export_transformation_type transformation_type;
- 	// required for writeNodes() for bone-parented objects
  	friend class ArmatureExporter;
 -	void exportHierarchy(Scene *sce);
 -	void writeNodes(Object *ob, Scene *sce);
 +	void exportHierarchy(const struct EvaluationContext *eval_ctx, Scene *sce);
 +	void writeNodes(const struct EvaluationContext *eval_ctx, Object *ob, Scene *sce);
  	
  	ArmatureExporter *arm_exporter;
  	const ExportSettings *export_settings;
diff --cc source/blender/collada/collada.cpp
index 286444882e4,7f723aae710..04b828d35f9
--- a/source/blender/collada/collada.cpp
+++ b/source/blender/collada/collada.cpp
@@@ -32,6 -32,6 +32,7 @@@
  #include "DocumentImporter.h"
  #include "ExportSettings.h"
  #include "ImportSettings.h"
++#include "collada.h"
  
  extern "C"
  {
@@@ -68,39 -67,36 +69,39 @@@ int collada_import(bContext *C
  	return 0;
  }
  
- int collada_export(bContext *C,
 -int collada_export(EvaluationContext *eval_ctx,
 -                   Scene *sce,
--                   const char *filepath,
--
--                   int apply_modifiers,
--				   BC_export_mesh_type export_mesh_type,
--
--                   int selected,
--                   int include_children,
--                   int include_armatures,
--				   int include_shapekeys,
--                   int deform_bones_only,
 -				   int include_animations,
--                   int sampling_rate,
--
--				   int active_uv_only,
- 				   int include_material_textures,
 -				   BC_export_texture_type export_texture_type,
--				   int use_texture_copies,
--
--                   int triangulate,
--				   int use_object_instantiation,
--				   int use_blender_profile,
--				   int sort_by_name,
--				   BC_export_transformation_type export_transformation_type,
--				   int open_sim,
--				   int limit_precision,
--				   int keep_bind_info)
++int collada_export(
++	EvaluationContext *eval_ctx,
++	Scene *sce,
++	const char *filepath,
++
++	int apply_modifiers,
++	BC_export_mesh_type export_mesh_type,
++
++	int selected,
++	int include_children,
++	int include_armatures,
++	int include_shapekeys,
++	int deform_bones_only,
++	int include_animations,
++	int sampling_rate,
++
++	int active_uv_only,
++	int include_material_textures,
++	int use_texture_copies,
++
++	int triangulate,
++	int use_object_instantiation,
++	int use_blender_profile,
++	int sort_by_name,
++	BC_export_transformation_type export_transformation_type,
++	int open_sim,
++	int limit_precision,
++	int keep_bind_info)
  {
  	ExportSettings export_settings;
  
- 	EvaluationContext eval_ctx;
- 	CTX_data_eval_ctx(C, &eval_ctx);
- 	Scene *sce = CTX_data_scene(C);
- 	ViewLayer *view_layer = CTX_data_view_layer(C);
++	ViewLayer *view_layer = eval_ctx->view_layer;
 +
  	export_settings.filepath                 = (char *)filepath;
  
  	export_settings.apply_modifiers          = apply_modifiers != 0;
@@@ -110,10 -106,11 +111,11 @@@
  	export_settings.include_armatures        = include_armatures != 0;
  	export_settings.include_shapekeys        = include_shapekeys != 0;
  	export_settings.deform_bones_only        = deform_bones_only != 0;
- 	export_settings.sampling_rate            = sampling_rate;
+ 	export_settings.include_animations       = include_animations;
+ 	export_settings.sampling_rate = sampling_rate;
  
  	expor

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list