[Bf-blender-cvs] [0c8b0771f26] blender2.8: refactor: Collada reorganize class constructors
Gaia Clary
noreply at git.blender.org
Sat Nov 24 14:39:10 CET 2018
Commit: 0c8b0771f26120d557c80df1a30905c8228fd702
Author: Gaia Clary
Date: Sat Nov 24 14:24:36 2018 +0100
Branches: blender2.8
https://developer.blender.org/rB0c8b0771f26120d557c80df1a30905c8228fd702
refactor: Collada reorganize class constructors
- Class constructors without body (only attribute initialisations)
can safely be kept in the class header files
- Constructor variables should be initialized in the order of their
definition in the header files
This change is also aimed to remove a couple of
build warnings from the linux builds.
===================================================================
M source/blender/collada/AnimationClipExporter.h
M source/blender/collada/AnimationExporter.h
M source/blender/collada/AnimationImporter.cpp
M source/blender/collada/AnimationImporter.h
M source/blender/collada/ArmatureExporter.cpp
M source/blender/collada/ArmatureExporter.h
M source/blender/collada/ControllerExporter.cpp
M source/blender/collada/ControllerExporter.h
M source/blender/collada/GeometryExporter.cpp
M source/blender/collada/GeometryExporter.h
M source/blender/collada/Materials.cpp
M source/blender/collada/Materials.h
M source/blender/collada/SceneExporter.cpp
M source/blender/collada/SceneExporter.h
M source/blender/collada/collada_internal.h
===================================================================
diff --git a/source/blender/collada/AnimationClipExporter.h b/source/blender/collada/AnimationClipExporter.h
index d76a3fa1380..8a9394ce88a 100644
--- a/source/blender/collada/AnimationClipExporter.h
+++ b/source/blender/collada/AnimationClipExporter.h
@@ -38,13 +38,13 @@ private:
public:
AnimationClipExporter(Depsgraph *depsgraph , COLLADASW::StreamWriter *sw, const ExportSettings *export_settings, std::vector<std::vector<std::string>> anim_meta) :
- depsgraph(depsgraph),
COLLADASW::LibraryAnimationClips(sw),
+ depsgraph(depsgraph),
+ scene(nullptr),
+ sw(sw),
export_settings(export_settings),
anim_meta(anim_meta)
- {
- this->sw = sw;
- }
+ {}
void exportAnimationClips(Scene *sce);
};
diff --git a/source/blender/collada/AnimationExporter.h b/source/blender/collada/AnimationExporter.h
index a5d3780af63..2240449f7ba 100644
--- a/source/blender/collada/AnimationExporter.h
+++ b/source/blender/collada/AnimationExporter.h
@@ -98,16 +98,16 @@ class AnimationExporter: COLLADASW::LibraryAnimations
private:
BlenderContext &blender_context;
COLLADASW::StreamWriter *sw;
+ const ExportSettings *export_settings;
public:
AnimationExporter(BlenderContext &blender_context, COLLADASW::StreamWriter *sw, const ExportSettings *export_settings):
- blender_context(blender_context),
COLLADASW::LibraryAnimations(sw),
+ blender_context(blender_context),
+ sw(sw),
export_settings(export_settings)
- {
- this->sw = sw;
- }
+ {}
bool exportAnimations();
@@ -115,7 +115,6 @@ public:
void operator() (Object *ob);
protected:
- const ExportSettings *export_settings;
void export_object_constraint_animation(Object *ob);
diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp
index b581c6647ba..e3a8e517352 100644
--- a/source/blender/collada/AnimationImporter.cpp
+++ b/source/blender/collada/AnimationImporter.cpp
@@ -244,11 +244,6 @@ void AnimationImporter::add_fcurves_to_object(Main *bmain, Object *ob, std::vect
}
}
-AnimationImporter::AnimationImporter(bContext *C, UnitConverter *conv, ArmatureImporter *arm, Scene *scene) :
- mContext(C),
- TransformReader(conv), armature_importer(arm), scene(scene) {
-}
-
AnimationImporter::~AnimationImporter()
{
// free unused FCurves
diff --git a/source/blender/collada/AnimationImporter.h b/source/blender/collada/AnimationImporter.h
index 2e9f69ea8cb..d6d5ad03a88 100644
--- a/source/blender/collada/AnimationImporter.h
+++ b/source/blender/collada/AnimationImporter.h
@@ -139,7 +139,11 @@ private:
};
public:
- AnimationImporter(bContext *C, UnitConverter *conv, ArmatureImporter *arm, Scene *scene);
+ AnimationImporter(bContext *C, UnitConverter *conv, ArmatureImporter *arm, Scene *scene) :
+ TransformReader(conv),
+ mContext(C),
+ armature_importer(arm),
+ scene(scene) {}
~AnimationImporter();
diff --git a/source/blender/collada/ArmatureExporter.cpp b/source/blender/collada/ArmatureExporter.cpp
index efeca5aec35..2aa7b483110 100644
--- a/source/blender/collada/ArmatureExporter.cpp
+++ b/source/blender/collada/ArmatureExporter.cpp
@@ -53,15 +53,6 @@ extern "C" {
#include "collada_utils.h"
-// XXX exporter writes wrong data for shared armatures. A separate
-// controller should be written for each armature-mesh binding how do
-// we make controller ids then?
-ArmatureExporter::ArmatureExporter(BlenderContext &blender_context, COLLADASW::StreamWriter *sw, const ExportSettings *export_settings) :
- blender_context(blender_context),
- COLLADASW::LibraryControllers(sw), export_settings(export_settings)
-{
-}
-
// write bone nodes
void ArmatureExporter::add_armature_bones(
Object *ob_arm,
diff --git a/source/blender/collada/ArmatureExporter.h b/source/blender/collada/ArmatureExporter.h
index 977a8b9b4a5..1a8080ad613 100644
--- a/source/blender/collada/ArmatureExporter.h
+++ b/source/blender/collada/ArmatureExporter.h
@@ -57,7 +57,15 @@ class SceneExporter;
class ArmatureExporter : public COLLADASW::LibraryControllers, protected TransformWriter, protected InstanceWriter
{
public:
- ArmatureExporter(BlenderContext &blender_context, COLLADASW::StreamWriter *sw, const ExportSettings *export_settings);
+
+ // XXX exporter writes wrong data for shared armatures. A separate
+ // controller should be written for each armature-mesh binding how do
+ // we make controller ids then?
+ ArmatureExporter(BlenderContext &blender_context, COLLADASW::StreamWriter *sw, const ExportSettings *export_settings) :
+ COLLADASW::LibraryControllers(sw),
+ blender_context(blender_context),
+ export_settings(export_settings)
+ {}
void add_armature_bones(
Object *ob_arm,
@@ -68,9 +76,8 @@ public:
bool add_instance_controller(Object *ob);
private:
- UnitConverter converter;
- const ExportSettings *export_settings;
BlenderContext &blender_context;
+ const ExportSettings *export_settings;
#if 0
std::vector<Object *> written_armatures;
diff --git a/source/blender/collada/ControllerExporter.cpp b/source/blender/collada/ControllerExporter.cpp
index 0aed3440620..7685a2b09a0 100644
--- a/source/blender/collada/ControllerExporter.cpp
+++ b/source/blender/collada/ControllerExporter.cpp
@@ -55,13 +55,6 @@ extern "C" {
#include "collada_utils.h"
-// XXX exporter writes wrong data for shared armatures. A separate
-// controller should be written for each armature-mesh binding how do
-// we make controller ids then?
-ControllerExporter::ControllerExporter(BlenderContext &blender_context, COLLADASW::StreamWriter *sw, const ExportSettings *export_settings) :
- blender_context(blender_context),
- COLLADASW::LibraryControllers(sw), export_settings(export_settings) {
-}
bool ControllerExporter::is_skinned_mesh(Object *ob)
{
@@ -428,8 +421,7 @@ void ControllerExporter::add_joints_element(ListBase *defbase,
void ControllerExporter::add_bind_shape_mat(Object *ob)
{
double bind_mat[4][4];
-
- converter.mat4_to_dae_double(bind_mat, ob->obmat);
+ UnitConverter::mat4_to_dae_double(bind_mat, ob->obmat);
addBindShapeTransform(bind_mat);
}
@@ -539,7 +531,7 @@ std::string ControllerExporter::add_inv_bind_mats_source(Object *ob_arm, ListBas
mul_m4_m4m4(world, ob_arm->obmat, bind_mat);
invert_m4_m4(mat, world);
- converter.mat4_to_dae(inv_bind_mat, mat);
+ UnitConverter::mat4_to_dae(inv_bind_mat, mat);
if (this->export_settings->limit_precision)
bc_sanitize_mat(inv_bind_mat, 6);
source.appendValues(inv_bind_mat);
diff --git a/source/blender/collada/ControllerExporter.h b/source/blender/collada/ControllerExporter.h
index 6a3ea7cc023..309bdbd37f0 100644
--- a/source/blender/collada/ControllerExporter.h
+++ b/source/blender/collada/ControllerExporter.h
@@ -60,7 +60,14 @@ class SceneExporter;
class ControllerExporter : public COLLADASW::LibraryControllers, protected TransformWriter, protected InstanceWriter
{
public:
- ControllerExporter(BlenderContext &blender_context, COLLADASW::StreamWriter *sw, const ExportSettings *export_settings);
+ // XXX exporter writes wrong data for shared armatures. A separate
+ // controller should be written for each armature-mesh binding how do
+ // we make controller ids then?
+ ControllerExporter(BlenderContext &blender_context, COLLADASW::StreamWriter *sw, const ExportSettings *export_settings) :
+ COLLADASW::LibraryControllers(sw),
+ blender_context(blender_context),
+ export_settings(export_settings) {
+ }
bool is_skinned_mesh(Object *ob);
@@ -72,7 +79,6 @@ public:
private:
BlenderContext &blender_context;
- UnitConverter converter;
const ExportSettings *export_settings;
#if 0
diff --git a/source/blender/collada/GeometryExporter.cpp b/source/blender/collada/GeometryExporter.cpp
index f4ea82044a3..8b4302f3470 100644
--- a/source/blender/collada/GeometryExporter.cpp
+++ b/source/blender/collada/GeometryExporter.cpp
@@ -50,12 +50,6 @@ extern "C" {
#include "collada_internal.h"
#include "collada_utils.h"
-// TODO: optimize UV sets by making indexed list with duplicates removed
-GeometryExporter::GeometryExporter(BlenderContext &blender_context, COLLADASW::StreamWriter *sw, const ExportSettings *export_settings) :
- blender_context(blender_context),
- COLLADASW::LibraryGeometries(sw), export_settings(export_settings)
-{
-}
void GeometryExporter::exportGeom()
{
diff --git a/source/blender/collada/GeometryExporter.h b/source/blender/collada/GeometryExporter.h
index a48319d778c..bd629946d01 100644
--- a/source/blender/collada/GeometryExporter.h
+++ b/source/blender/collada/GeometryExporter.h
@@ -75,7 +75,13 @@ class GeometryExporter : COLLADASW::LibraryGeometries
Normal n;
public:
- GeometryExporter(BlenderContext &blender_context, COLLADASW::StreamWriter *sw, const ExportSettings *export_settings);
+
+ // TODO: optimize UV sets by making indexed list with duplicates removed
+ GeometryExporter(BlenderContext &blender_context, COLLADASW::StreamWriter *sw, const ExportSettings *export_settings) :
+ COLLADASW::LibraryGeometries(sw),
+ blender_context(blender_context),
+ export_settings(export_settings)
+ {}
void exportGeom();
diff --git a/source/blender/collada/Materials.cpp b/source/blender/collada/Materials.cpp
index de0405da93a..3173c2592c4 100644
--- a/source/blender/collada/Materials.cpp
+++ b/source/blender/collada/Materials.cpp
@@ -24,8 +24,8 @@
MaterialNode::MaterialNode(bContext *C, Material *ma, KeyImageMap &key_image_map) :
mContext(C),
- effect(nullptr),
material(ma),
+ effect(nullptr),
key_image_map(&key_image_map)
{
ntree = prepare_material_nodetree();
@@ -34,8 +34,8 @@ MaterialNode::MaterialNode(bContext *C, Material *ma, KeyImageMap &key_image_map
MaterialNode::MaterialNode(bContext *C, COLLADAFW::EffectCommon *ef, Material *ma, UidImageMap &uid_image_map) :
mContext(C),
- effect(ef),
material(ma),
+ effect(ef),
uid_image_map(&uid_image_map)
{
ntree = prepare_material_nodetree();
diff --git a/source/blender/collada/Materials.h b/source/blender/collada/Materials.h
index 68a75db3481..69f64a6280d 100644
--- a/source/blender/collada/Materials.h
+++ b/source/blender/collada/Materials.h
@@ -53,6 +53,7 @@ private:
COLLADAFW::EffectCommon *effect;
UidImageMap *uid_image_map = nullptr;
KeyImag
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list