diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 09:24:14 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 09:24:14 +0300 |
commit | 41d4a1986548e66a652221e4a68c52900474eeff (patch) | |
tree | 26acf937ea0b762977f89adcc4e74a3ec9ecee62 /source/blender/collada | |
parent | 108045faa01849115c54190ebed788faf36dcb56 (diff) |
ClangFormat: format '#if 0' code in source/
Diffstat (limited to 'source/blender/collada')
-rw-r--r-- | source/blender/collada/AnimationImporter.cpp | 31 | ||||
-rw-r--r-- | source/blender/collada/AnimationImporter.h | 3 | ||||
-rw-r--r-- | source/blender/collada/ArmatureExporter.cpp | 10 | ||||
-rw-r--r-- | source/blender/collada/ArmatureExporter.h | 2 | ||||
-rw-r--r-- | source/blender/collada/ArmatureImporter.cpp | 29 | ||||
-rw-r--r-- | source/blender/collada/ArmatureImporter.h | 8 | ||||
-rw-r--r-- | source/blender/collada/BCAnimationSampler.cpp | 7 | ||||
-rw-r--r-- | source/blender/collada/ControllerExporter.cpp | 13 | ||||
-rw-r--r-- | source/blender/collada/ControllerExporter.h | 2 | ||||
-rw-r--r-- | source/blender/collada/DocumentImporter.cpp | 8 | ||||
-rw-r--r-- | source/blender/collada/EffectExporter.cpp | 13 | ||||
-rw-r--r-- | source/blender/collada/collada_utils.cpp | 25 | ||||
-rw-r--r-- | source/blender/collada/collada_utils.h | 5 |
13 files changed, 87 insertions, 69 deletions
diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp index f6695db1d0a..e7a48ee27da 100644 --- a/source/blender/collada/AnimationImporter.cpp +++ b/source/blender/collada/AnimationImporter.cpp @@ -351,7 +351,8 @@ virtual void AnimationImporter::change_eul_to_quat(Object *ob, bAction *act) std::vector<FCurve *> &rot_fcurves = fcurves_actionGroup_map[grp]; - if (rot_fcurves.size() > 3) continue; + if (rot_fcurves.size() > 3) + continue; for (i = 0; i < rot_fcurves.size(); i++) eulcu[rot_fcurves[i]->array_index] = rot_fcurves[i]; @@ -366,7 +367,7 @@ virtual void AnimationImporter::change_eul_to_quat(Object *ob, bAction *act) create_fcurve(0, rna_path), create_fcurve(1, rna_path), create_fcurve(2, rna_path), - create_fcurve(3, rna_path) + create_fcurve(3, rna_path), }; bPoseChannel *chan = BKE_pose_channel_find_name(ob->pose, grp->name); @@ -379,7 +380,8 @@ virtual void AnimationImporter::change_eul_to_quat(Object *ob, bAction *act) FCurve *cu = eulcu[i]; - if (!cu) continue; + if (!cu) + continue; for (int j = 0; j < cu->totvert; j++) { float frame = cu->bezt[j].vec[1][0]; @@ -387,7 +389,7 @@ virtual void AnimationImporter::change_eul_to_quat(Object *ob, bAction *act) float eul[3] = { eulcu[0] ? evaluate_fcurve(eulcu[0], frame) : 0.0f, eulcu[1] ? evaluate_fcurve(eulcu[1], frame) : 0.0f, - eulcu[2] ? evaluate_fcurve(eulcu[2], frame) : 0.0f + eulcu[2] ? evaluate_fcurve(eulcu[2], frame) : 0.0f, }; // make eul relative to bone rest pose @@ -410,7 +412,8 @@ virtual void AnimationImporter::change_eul_to_quat(Object *ob, bAction *act) // now replace old Euler curves for (i = 0; i < 3; i++) { - if (!eulcu[i]) continue; + if (!eulcu[i]) + continue; action_groups_remove_channel(act, eulcu[i]); free_fcurve(eulcu[i]); @@ -574,14 +577,13 @@ void AnimationImporter::Assign_transform_animations( case COLLADAFW::Transformation::MATRIX: #if 0 - { - COLLADAFW::Matrix *mat = (COLLADAFW::Matrix*)transform; - COLLADABU::Math::Matrix4 mat4 = mat->getMatrix(); - switch (binding->animationClass) { - case COLLADAFW::AnimationList::TRANSFORM: - - } + { + COLLADAFW::Matrix *mat = (COLLADAFW::Matrix *)transform; + COLLADABU::Math::Matrix4 mat4 = mat->getMatrix(); + switch (binding->animationClass) { + case COLLADAFW::AnimationList::TRANSFORM: } + } #endif unused_fcurve(curves); break; @@ -2045,7 +2047,8 @@ Object *AnimationImporter::get_joint_object(COLLADAFW::Node *root, #if 0 // recursively evaluates joint tree until end is found, mat then is world-space matrix of end // mat must be identity on enter, node must be root -bool AnimationImporter::evaluate_joint_world_transform_at_frame(float mat[4][4], float par[4][4], COLLADAFW::Node *node, COLLADAFW::Node *end, float fra) +bool AnimationImporter::evaluate_joint_world_transform_at_frame( + float mat[4][4], float par[4][4], COLLADAFW::Node *node, COLLADAFW::Node *end, float fra) { float m[4][4]; if (par) { @@ -2062,7 +2065,7 @@ bool AnimationImporter::evaluate_joint_world_transform_at_frame(float mat[4][4], return true; } else { - COLLADAFW::NodePointerArray& children = node->getChildNodes(); + COLLADAFW::NodePointerArray &children = node->getChildNodes(); for (int i = 0; i < children.getCount(); i++) { if (evaluate_joint_world_transform_at_frame(mat, m, children[i], end, fra)) return true; diff --git a/source/blender/collada/AnimationImporter.h b/source/blender/collada/AnimationImporter.h index 65e9974aec1..f15c02183c7 100644 --- a/source/blender/collada/AnimationImporter.h +++ b/source/blender/collada/AnimationImporter.h @@ -238,7 +238,8 @@ class AnimationImporter : private TransformReader, public AnimationImporterBase #if 0 // recursively evaluates joint tree until end is found, mat then is world-space matrix of end // mat must be identity on enter, node must be root - bool evaluate_joint_world_transform_at_frame(float mat[4][4], float par[4][4], COLLADAFW::Node *node, COLLADAFW::Node *end, float fra); + bool evaluate_joint_world_transform_at_frame( + float mat[4][4], float par[4][4], COLLADAFW::Node *node, COLLADAFW::Node *end, float fra); #endif void add_bone_fcurve(Object *ob, COLLADAFW::Node *node, FCurve *fcu); diff --git a/source/blender/collada/ArmatureExporter.cpp b/source/blender/collada/ArmatureExporter.cpp index ea1e98caf58..5abe0998470 100644 --- a/source/blender/collada/ArmatureExporter.cpp +++ b/source/blender/collada/ArmatureExporter.cpp @@ -119,12 +119,12 @@ bool ArmatureExporter::add_instance_controller(Object *ob) void ArmatureExporter::operator()(Object *ob) { Object *ob_arm = bc_get_assigned_armature(ob); - } bool ArmatureExporter::already_written(Object *ob_arm) { - return std::find(written_armatures.begin(), written_armatures.end(), ob_arm) != written_armatures.end(); + return std::find(written_armatures.begin(), written_armatures.end(), ob_arm) != + written_armatures.end(); } void ArmatureExporter::wrote(Object *ob_arm) @@ -132,11 +132,13 @@ void ArmatureExporter::wrote(Object *ob_arm) written_armatures.push_back(ob_arm); } -void ArmatureExporter::find_objects_using_armature(Object *ob_arm, std::vector<Object *>& objects, Scene *sce) +void ArmatureExporter::find_objects_using_armature(Object *ob_arm, + std::vector<Object *> &objects, + Scene *sce) { objects.clear(); - Base *base = (Base *) sce->base.first; + Base *base = (Base *)sce->base.first; while (base) { Object *ob = base->object; diff --git a/source/blender/collada/ArmatureExporter.h b/source/blender/collada/ArmatureExporter.h index f0da8680476..6ef6007960e 100644 --- a/source/blender/collada/ArmatureExporter.h +++ b/source/blender/collada/ArmatureExporter.h @@ -81,7 +81,7 @@ class ArmatureExporter : public COLLADASW::LibraryControllers, void wrote(Object *ob_arm); - void find_objects_using_armature(Object *ob_arm, std::vector<Object *>& objects, Scene *sce); + void find_objects_using_armature(Object *ob_arm, std::vector<Object *> &objects, Scene *sce); #endif // Scene, SceneExporter and the list of child_objects diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp index 038dbd0c30d..315ae91e643 100644 --- a/source/blender/collada/ArmatureImporter.cpp +++ b/source/blender/collada/ArmatureImporter.cpp @@ -75,11 +75,11 @@ ArmatureImporter::~ArmatureImporter() #if 0 JointData *ArmatureImporter::get_joint_data(COLLADAFW::Node *node); { - const COLLADAFW::UniqueId& joint_id = node->getUniqueId(); + const COLLADAFW::UniqueId &joint_id = node->getUniqueId(); if (joint_id_to_joint_index_map.find(joint_id) == joint_id_to_joint_index_map.end()) { - fprintf(stderr, "Cannot find a joint index by joint id for %s.\n", - node->getOriginalId().c_str()); + fprintf( + stderr, "Cannot find a joint index by joint id for %s.\n", node->getOriginalId().c_str()); return NULL; } @@ -371,7 +371,7 @@ void ArmatureImporter::set_leaf_bone_shapes(Object *ob_arm) std::vector<LeafBone>::iterator it; for (it = leaf_bones.begin(); it != leaf_bones.end(); it++) { - LeafBone& leaf = *it; + LeafBone &leaf = *it; bPoseChannel *pchan = BKE_pose_channel_find_name(pose, leaf.name); if (pchan) { @@ -396,7 +396,7 @@ void ArmatureImporter::set_euler_rotmode() std::map<COLLADAFW::UniqueId, SkinInfo>::iterator sit; for (sit = skin_by_data_uid.begin(); sit != skin_by_data_uid.end(); sit++) { - SkinInfo& skin = sit->second; + SkinInfo &skin = sit->second; if (skin.uses_joint_or_descendant(joint)) { bPoseChannel *pchan = skin.get_pose_channel_from_node(joint); @@ -430,23 +430,26 @@ Object *ArmatureImporter::get_empty_for_leaves() Object *ArmatureImporter::find_armature(COLLADAFW::Node *node) { JointData *jd = get_joint_data(node); - if (jd) return jd->ob_arm; + if (jd) + return jd->ob_arm; - COLLADAFW::NodePointerArray& children = node->getChildNodes(); + COLLADAFW::NodePointerArray &children = node->getChildNodes(); for (int i = 0; i < children.getCount(); i++) { Object *ob_arm = find_armature(children[i]); - if (ob_arm) return ob_arm; + if (ob_arm) + return ob_arm; } return NULL; } -ArmatureJoints& ArmatureImporter::get_armature_joints(Object *ob_arm) +ArmatureJoints &ArmatureImporter::get_armature_joints(Object *ob_arm) { // try finding it std::vector<ArmatureJoints>::iterator it; for (it = armature_joints.begin(); it != armature_joints.end(); it++) { - if ((*it).ob_arm == ob_arm) return *it; + if ((*it).ob_arm == ob_arm) + return *it; } // not found, create one @@ -800,7 +803,9 @@ void ArmatureImporter::make_armatures(bContext *C, std::vector<Object *> &object #if 0 // link with meshes, create vertex groups, assign weights -void ArmatureImporter::link_armature(Object *ob_arm, const COLLADAFW::UniqueId& geom_id, const COLLADAFW::UniqueId& controller_data_id) +void ArmatureImporter::link_armature(Object *ob_arm, + const COLLADAFW::UniqueId &geom_id, + const COLLADAFW::UniqueId &controller_data_id) { Object *ob = mesh_importer->get_object_by_geom_uid(geom_id); @@ -814,7 +819,7 @@ void ArmatureImporter::link_armature(Object *ob_arm, const COLLADAFW::UniqueId& return; } - SkinInfo& skin = skin_by_data_uid[conroller_data_id]; + SkinInfo &skin = skin_by_data_uid[conroller_data_id]; // create vertex groups } diff --git a/source/blender/collada/ArmatureImporter.h b/source/blender/collada/ArmatureImporter.h index cfcd9501790..19f053c61fb 100644 --- a/source/blender/collada/ArmatureImporter.h +++ b/source/blender/collada/ArmatureImporter.h @@ -73,7 +73,7 @@ class ArmatureImporter : private TransformReader { #if 0 struct ArmatureJoints { Object *ob_arm; - std::vector<COLLADAFW::Node*> root_joints; + std::vector<COLLADAFW::Node *> root_joints; }; std::vector<ArmatureJoints> armature_joints; #endif @@ -133,7 +133,7 @@ class ArmatureImporter : private TransformReader { #if 0 Object *find_armature(COLLADAFW::Node *node); - ArmatureJoints& get_armature_joints(Object *ob_arm); + ArmatureJoints &get_armature_joints(Object *ob_arm); #endif Object *create_armature_bones(Main *bmain, SkinInfo &skin); @@ -161,7 +161,9 @@ class ArmatureImporter : private TransformReader { #if 0 // link with meshes, create vertex groups, assign weights - void link_armature(Object *ob_arm, const COLLADAFW::UniqueId& geom_id, const COLLADAFW::UniqueId& controller_data_id); + void link_armature(Object *ob_arm, + const COLLADAFW::UniqueId &geom_id, + const COLLADAFW::UniqueId &controller_data_id); #endif bool write_skin_controller_data(const COLLADAFW::SkinControllerData *data); diff --git a/source/blender/collada/BCAnimationSampler.cpp b/source/blender/collada/BCAnimationSampler.cpp index 9a281e2218b..e8b1015e1c3 100644 --- a/source/blender/collada/BCAnimationSampler.cpp +++ b/source/blender/collada/BCAnimationSampler.cpp @@ -332,10 +332,9 @@ bool BCAnimationSampler::get_object_samples(BCMatrixSampleMap &samples, Object * animation_type BC_ANIMATION_EXPORT_KEYS: Only take data from matrices for keyframes */ -void BCAnimationSampler::add_value_set( - BCAnimationCurve &curve, - BCFrameSampleMap &samples, - BC_export_animation_type animation_type) +void BCAnimationSampler::add_value_set(BCAnimationCurve &curve, + BCFrameSampleMap &samples, + BC_export_animation_type animation_type) { int array_index = curve.get_array_index(); const BC_animation_transform_type tm_type = curve.get_transform_type(); diff --git a/source/blender/collada/ControllerExporter.cpp b/source/blender/collada/ControllerExporter.cpp index dc9a701192f..0c9ca400dd2 100644 --- a/source/blender/collada/ControllerExporter.cpp +++ b/source/blender/collada/ControllerExporter.cpp @@ -123,7 +123,8 @@ void ControllerExporter::operator()(Object *ob) bool ArmatureExporter::already_written(Object *ob_arm) { - return std::find(written_armatures.begin(), written_armatures.end(), ob_arm) != written_armatures.end(); + return std::find(written_armatures.begin(), written_armatures.end(), ob_arm) != + written_armatures.end(); } void ArmatureExporter::wrote(Object *ob_arm) @@ -131,11 +132,13 @@ void ArmatureExporter::wrote(Object *ob_arm) written_armatures.push_back(ob_arm); } -void ArmatureExporter::find_objects_using_armature(Object *ob_arm, std::vector<Object *>& objects, Scene *sce) +void ArmatureExporter::find_objects_using_armature(Object *ob_arm, + std::vector<Object *> &objects, + Scene *sce) { objects.clear(); - Base *base = (Base *) sce->base.first; + Base *base = (Base *)sce->base.first; while (base) { Object *ob = base->object; @@ -174,10 +177,10 @@ void ControllerExporter::export_skin_controller(Object *ob, Object *ob_arm) #if 0 me->dvert : - typedef struct MDeformVert { + typedef struct MDeformVert { struct MDeformWeight *dw; int totweight; - int flag; // flag only in use for weightpaint now + int flag; // flag only in use for weightpaint now } MDeformVert; typedef struct MDeformWeight { diff --git a/source/blender/collada/ControllerExporter.h b/source/blender/collada/ControllerExporter.h index 50056df9f39..38d85cb7ebc 100644 --- a/source/blender/collada/ControllerExporter.h +++ b/source/blender/collada/ControllerExporter.h @@ -85,7 +85,7 @@ class ControllerExporter : public COLLADASW::LibraryControllers, void wrote(Object *ob_arm); - void find_objects_using_armature(Object *ob_arm, std::vector<Object *>& objects, Scene *sce); + void find_objects_using_armature(Object *ob_arm, std::vector<Object *> &objects, Scene *sce); #endif std::string get_controller_id(Object *ob_arm, Object *ob); diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index d21e71bb37b..428678180f6 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -294,10 +294,10 @@ void DocumentImporter::translate_anim_recursive(COLLADAFW::Node *node, #if 0 COLLADAFW::Transformation::TransformationType types[] = { - COLLADAFW::Transformation::ROTATE, - COLLADAFW::Transformation::SCALE, - COLLADAFW::Transformation::TRANSLATE, - COLLADAFW::Transformation::MATRIX, + COLLADAFW::Transformation::ROTATE, + COLLADAFW::Transformation::SCALE, + COLLADAFW::Transformation::TRANSLATE, + COLLADAFW::Transformation::MATRIX, }; Object *ob; diff --git a/source/blender/collada/EffectExporter.cpp b/source/blender/collada/EffectExporter.cpp index 58435c4551f..280a0c4b860 100644 --- a/source/blender/collada/EffectExporter.cpp +++ b/source/blender/collada/EffectExporter.cpp @@ -198,7 +198,8 @@ void EffectsExporter::operator()(Material *ma, Object *ob) Image *ima = t->tex->ima; // Image not set for texture - if (!ima) continue; + if (!ima) + continue; std::string key(id_name(ima)); key = translate_id(key); @@ -206,10 +207,9 @@ void EffectsExporter::operator()(Material *ma, Object *ob) // create only one <sampler>/<surface> pair for each unique image if (im_samp_map.find(key) == im_samp_map.end()) { //<newparam> <sampler> <source> - COLLADASW::Sampler sampler( - COLLADASW::Sampler::SAMPLER_TYPE_2D, - key + COLLADASW::Sampler::SAMPLER_SID_SUFFIX, - key + COLLADASW::Sampler::SURFACE_SID_SUFFIX); + COLLADASW::Sampler sampler(COLLADASW::Sampler::SAMPLER_TYPE_2D, + key + COLLADASW::Sampler::SAMPLER_SID_SUFFIX, + key + COLLADASW::Sampler::SURFACE_SID_SUFFIX); sampler.setImageId(key); // copy values to arrays since they will live longer samplers[a] = sampler; @@ -235,7 +235,8 @@ void EffectsExporter::operator()(Material *ma, Object *ob) key = translate_id(key); int i = im_samp_map[key]; std::string uvname = strlen(t->uvname) ? t->uvname : active_uv; - COLLADASW::Sampler *sampler = (COLLADASW::Sampler *)samp_surf[i]; // possibly uninitialised memory ... + COLLADASW::Sampler *sampler = (COLLADASW::Sampler *) + samp_surf[i]; // possibly uninitialised memory ... writeTextures(ep, key, sampler, t, ima, uvname); } #endif diff --git a/source/blender/collada/collada_utils.cpp b/source/blender/collada/collada_utils.cpp index 2e964bbf108..9ce6b399daa 100644 --- a/source/blender/collada/collada_utils.cpp +++ b/source/blender/collada/collada_utils.cpp @@ -264,13 +264,11 @@ Mesh *bc_get_mesh_copy(BlenderContext &blender_context, if (apply_modifiers) { #if 0 /* Not supported by new system currently... */ switch (export_mesh_type) { - case BC_MESH_TYPE_VIEW: - { + case BC_MESH_TYPE_VIEW: { dm = mesh_create_derived_view(depsgraph, scene, ob, &mask); break; } - case BC_MESH_TYPE_RENDER: - { + case BC_MESH_TYPE_RENDER: { dm = mesh_create_derived_render(depsgraph, scene, ob, &mask); break; } @@ -826,18 +824,16 @@ void bc_set_IDPropertyMatrix(EditBone *ebone, const char *key, float mat[4][4]) */ static void bc_set_IDProperty(EditBone *ebone, const char *key, float value) { - if (ebone->prop == NULL) - { - IDPropertyTemplate val = { 0 }; + if (ebone->prop == NULL) { + IDPropertyTemplate val = {0}; ebone->prop = IDP_New(IDP_GROUP, &val, "RNA_EditBone ID properties"); } IDProperty *pgroup = (IDProperty *)ebone->prop; - IDPropertyTemplate val = { 0 }; + IDPropertyTemplate val = {0}; IDProperty *prop = IDP_New(IDP_FLOAT, &val, key); IDP_Float(prop) = value; IDP_AddToGroup(pgroup, prop); - } #endif @@ -1262,7 +1258,10 @@ bNode *bc_add_node(bContext *C, bNodeTree *ntree, int node_type, int locx, int l #if 0 // experimental, probably not used -static bNodeSocket *bc_group_add_input_socket(bNodeTree *ntree, bNode *to_node, int to_index, std::string label) +static bNodeSocket *bc_group_add_input_socket(bNodeTree *ntree, + bNode *to_node, + int to_index, + std::string label) { bNodeSocket *to_socket = (bNodeSocket *)BLI_findlink(&to_node->inputs, to_index); @@ -1278,7 +1277,10 @@ static bNodeSocket *bc_group_add_input_socket(bNodeTree *ntree, bNode *to_node, return newsock; } -static bNodeSocket *bc_group_add_output_socket(bNodeTree *ntree, bNode *from_node, int from_index, std::string label) +static bNodeSocket *bc_group_add_output_socket(bNodeTree *ntree, + bNode *from_node, + int from_index, + std::string label) { bNodeSocket *from_socket = (bNodeSocket *)BLI_findlink(&from_node->outputs, from_index); @@ -1294,7 +1296,6 @@ static bNodeSocket *bc_group_add_output_socket(bNodeTree *ntree, bNode *from_nod return newsock; } - void bc_make_group(bContext *C, bNodeTree *ntree, std::map<std::string, bNode *> nmap) { bNode *gnode = node_group_make_from_selected(C, ntree, "ShaderNodeGroup", "ShaderNodeTree"); diff --git a/source/blender/collada/collada_utils.h b/source/blender/collada/collada_utils.h index 61b5e306623..dfd5519be31 100644 --- a/source/blender/collada/collada_utils.h +++ b/source/blender/collada/collada_utils.h @@ -181,9 +181,10 @@ inline bool bc_startswith(std::string const &value, std::string const &starting) } #if 0 /* UNUSED */ -inline bool bc_endswith(std::string const & value, std::string const & ending) +inline bool bc_endswith(std::string const &value, std::string const &ending) { - if (ending.size() > value.size()) return false; + if (ending.size() > value.size()) + return false; return std::equal(ending.rbegin(), ending.rend(), value.rbegin()); } #endif |