[Bf-blender-cvs] [64fbd50e4cc] master: Refactor: Collada: remove param, changed order of params in Function call

Gaia Clary noreply at git.blender.org
Sat Mar 17 14:22:42 CET 2018


Commit: 64fbd50e4cc23dfb6f8ab5014e1e924136522079
Author: Gaia Clary
Date:   Sat Mar 17 14:16:19 2018 +0100
Branches: master
https://developer.blender.org/rB64fbd50e4cc23dfb6f8ab5014e1e924136522079

Refactor: Collada: remove param, changed order of params in Function call

* In the Collada Module parameters are typically ordered
  in a similar way. I changed this to:

    extern std::string get_joint_id(Object *ob, Bone *bone);

* The Object parameter was not used in get_joint_sid().
  I changed this to:

	extern std::string get_joint_sid(Bone *bone);

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

M	source/blender/collada/AnimationExporter.cpp
M	source/blender/collada/ArmatureExporter.cpp
M	source/blender/collada/ControllerExporter.cpp
M	source/blender/collada/collada_internal.cpp
M	source/blender/collada/collada_internal.h

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

diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp
index 5492fcbb625..a59665f897f 100644
--- a/source/blender/collada/AnimationExporter.cpp
+++ b/source/blender/collada/AnimationExporter.cpp
@@ -771,7 +771,7 @@ void AnimationExporter::dae_baked_animation(std::vector<float> &fra, Object *ob_
 
 	addSampler(sampler);
 
-	std::string target = get_joint_id(bone, ob_arm) + "/transform";
+	std::string target = get_joint_id(ob_arm, bone) + "/transform";
 	addChannel(COLLADABU::URI(empty, sampler_id), target);
 
 	closeAnimation();
diff --git a/source/blender/collada/ArmatureExporter.cpp b/source/blender/collada/ArmatureExporter.cpp
index d2495a8cb9f..92ec8b470a8 100644
--- a/source/blender/collada/ArmatureExporter.cpp
+++ b/source/blender/collada/ArmatureExporter.cpp
@@ -89,7 +89,7 @@ void ArmatureExporter::add_armature_bones(Object *ob_arm, Scene *sce,
 void ArmatureExporter::write_bone_URLs(COLLADASW::InstanceController &ins, Object *ob_arm, Bone *bone)
 {
 	if (bc_is_root_bone(bone, this->export_settings->deform_bones_only))
-		ins.addSkeleton(COLLADABU::URI(COLLADABU::Utils::EMPTY_STRING, get_joint_id(bone, ob_arm)));
+		ins.addSkeleton(COLLADABU::URI(COLLADABU::Utils::EMPTY_STRING, get_joint_id(ob_arm, bone)));
 	else {
 		for (Bone *child = (Bone *)bone->childbase.first; child; child = child->next) {
 			write_bone_URLs(ins, ob_arm, child);
@@ -165,9 +165,9 @@ void ArmatureExporter::add_bone_node(Bone *bone, Object *ob_arm, Scene *sce,
                                      std::list<Object *>& child_objects)
 {
 	if (!(this->export_settings->deform_bones_only && bone->flag & BONE_NO_DEFORM)) {
-		std::string node_id = get_joint_id(bone, ob_arm);
+		std::string node_id = get_joint_id(ob_arm, bone);
 		std::string node_name = std::string(bone->name);
-		std::string node_sid = get_joint_sid(bone, ob_arm);
+		std::string node_sid = get_joint_sid(bone);
 
 		COLLADASW::Node node(mSW);
 
diff --git a/source/blender/collada/ControllerExporter.cpp b/source/blender/collada/ControllerExporter.cpp
index 4afe71f47ba..14e8e0323a8 100644
--- a/source/blender/collada/ControllerExporter.cpp
+++ b/source/blender/collada/ControllerExporter.cpp
@@ -71,7 +71,7 @@ bool ControllerExporter::is_skinned_mesh(Object *ob)
 void ControllerExporter::write_bone_URLs(COLLADASW::InstanceController &ins, Object *ob_arm, Bone *bone)
 {
 	if (bc_is_root_bone(bone, this->export_settings->deform_bones_only))
-		ins.addSkeleton(COLLADABU::URI(COLLADABU::Utils::EMPTY_STRING, get_joint_id(bone, ob_arm)));
+		ins.addSkeleton(COLLADABU::URI(COLLADABU::Utils::EMPTY_STRING, get_joint_id(ob_arm, bone)));
 	else {
 		for (Bone *child = (Bone *)bone->childbase.first; child; child = child->next) {
 			write_bone_URLs(ins, ob_arm, child);
@@ -458,7 +458,7 @@ std::string ControllerExporter::add_joints_source(Object *ob_arm, ListBase *defb
 	for (def = (bDeformGroup *)defbase->first; def; def = def->next) {
 		Bone *bone = get_bone_from_defgroup(ob_arm, def);
 		if (bone)
-			source.appendValues(get_joint_sid(bone, ob_arm));
+			source.appendValues(get_joint_sid(bone));
 	}
 
 	source.finish();
diff --git a/source/blender/collada/collada_internal.cpp b/source/blender/collada/collada_internal.cpp
index 8974acb3460..f2cc56777d8 100644
--- a/source/blender/collada/collada_internal.cpp
+++ b/source/blender/collada/collada_internal.cpp
@@ -327,12 +327,12 @@ std::string get_light_id(Object *ob)
 	return translate_id(id_name(ob)) + "-light";
 }
 
-std::string get_joint_id(Bone *bone, Object *ob_arm)
+std::string get_joint_id(Object *ob, Bone *bone)
 {
-	return translate_id(id_name(ob_arm) + "_" + bone->name);
+	return translate_id(id_name(ob) + "_" + bone->name);
 }
 
-std::string get_joint_sid(Bone *bone, Object *ob_arm)
+std::string get_joint_sid(Bone *bone)
 {
 	return translate_id(bone->name);
 }
diff --git a/source/blender/collada/collada_internal.h b/source/blender/collada/collada_internal.h
index 5f3fa34edc1..fc848100b79 100644
--- a/source/blender/collada/collada_internal.h
+++ b/source/blender/collada/collada_internal.h
@@ -97,8 +97,8 @@ extern std::string get_geometry_id(Object *ob, bool use_instantiation);
 
 extern std::string get_light_id(Object *ob);
 
-extern std::string get_joint_id(Bone *bone, Object *ob_arm);
-extern std::string get_joint_sid(Bone *bone, Object *ob_arm);
+extern std::string get_joint_id(Object *ob, Bone *bone);
+extern std::string get_joint_sid(Bone *bone);
 
 extern std::string get_camera_id(Object *ob);



More information about the Bf-blender-cvs mailing list