diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-10-10 10:19:55 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-10-10 14:04:51 +0300 |
commit | 2abfcebb0eb7989e3d1e7d03f37ecf5c088210af (patch) | |
tree | e7a1ad5912b4661d4ece743f4f7fd86e6bf4d3c4 /source/blender/io/collada | |
parent | c735aca42e9f5961fec7e5d5fc196b5bd6b85f56 (diff) |
Cleanup: use C comments for descriptive text
Follow our code style guide by using C-comments for text descriptions.
Diffstat (limited to 'source/blender/io/collada')
32 files changed, 302 insertions, 298 deletions
diff --git a/source/blender/io/collada/AnimationExporter.h b/source/blender/io/collada/AnimationExporter.h index 2d38a541347..fd691184e8b 100644 --- a/source/blender/io/collada/AnimationExporter.h +++ b/source/blender/io/collada/AnimationExporter.h @@ -39,7 +39,7 @@ #include "BLI_utildefines.h" #include "BIK_api.h" -#include "BKE_action.h" // pose functions +#include "BKE_action.h" /* pose functions */ #include "BKE_armature.h" #include "BKE_constraint.h" #include "BKE_fcurve.h" @@ -69,7 +69,7 @@ #include "IK_solver.h" -#include <algorithm> // std::find +#include <algorithm> /* std::find */ #include <map> #include <vector> @@ -100,7 +100,7 @@ class AnimationExporter : COLLADASW::LibraryAnimations { bool exportAnimations(); - // called for each exported object + /* called for each exported object */ void operator()(Object *ob); protected: @@ -129,8 +129,8 @@ class AnimationExporter : COLLADASW::LibraryAnimations { Object *ob_arm, bPoseChannel *pChan); - // dae_bone_animation -> add_bone_animation - // (blend this into dae_bone_animation) + /* dae_bone_animation -> add_bone_animation + * (blend this into dae_bone_animation) */ void dae_bone_animation(std::vector<float> &fra, float *v, int tm_type, diff --git a/source/blender/io/collada/AnimationImporter.h b/source/blender/io/collada/AnimationImporter.h index 5c6f9400286..44001366adc 100644 --- a/source/blender/io/collada/AnimationImporter.h +++ b/source/blender/io/collada/AnimationImporter.h @@ -52,7 +52,7 @@ class ArmatureImporter; class AnimationImporterBase { public: - // virtual void change_eul_to_quat(Object *ob, bAction *act) = 0; + /* virtual void change_eul_to_quat(Object *ob, bAction *act) = 0; */ }; class AnimationImporter : private TransformReader, public AnimationImporterBase { @@ -75,7 +75,7 @@ class AnimationImporter : private TransformReader, public AnimationImporterBase float value, eBezTriple_Interpolation ipo = BEZT_IPO_LIN); - // create one or several fcurves depending on the number of parameters being animated + /* create one or several fcurves depending on the number of parameters being animated */ void animation_to_fcurves(COLLADAFW::AnimationCurve *curve); void fcurve_deg_to_rad(FCurve *cu); @@ -143,7 +143,7 @@ class AnimationImporter : private TransformReader, public AnimationImporterBase void set_import_from_version(std::string import_from_version); bool write_animation(const COLLADAFW::Animation *anim); - // called on post-process stage after writeVisualScenes + /* called on post-process stage after writeVisualScenes */ bool write_animation_list(const COLLADAFW::AnimationList *animlist); void read_node_transform(COLLADAFW::Node *node, Object *ob); @@ -199,9 +199,9 @@ class AnimationImporter : private TransformReader, public AnimationImporterBase int array_index, int scale = 1); void unused_fcurve(std::vector<FCurve *> *curves); - // prerequisites: - // animlist_map - map animlist id -> animlist - // curve_map - map anim id -> curve(s) + /* prerequisites: + * animlist_map - map animlist id -> animlist + * curve_map - map anim id -> curve(s) */ Object *translate_animation_OLD(COLLADAFW::Node *node, std::map<COLLADAFW::UniqueId, Object *> &object_map, std::map<COLLADAFW::UniqueId, COLLADAFW::Node *> &root_map, @@ -212,21 +212,21 @@ class AnimationImporter : private TransformReader, public AnimationImporterBase void find_frames_old(std::vector<float> *frames, COLLADAFW::Node *node, COLLADAFW::Transformation::TransformationType tm_type); - // internal, better make it private - // warning: evaluates only rotation - // prerequisites: animlist_map, curve_map + /* internal, better make it private + * warning: evaluates only rotation + * prerequisites: animlist_map, curve_map */ void evaluate_transform_at_frame(float mat[4][4], COLLADAFW::Node *node, float fra); - // return true to indicate that mat contains a sane value + /* return true to indicate that mat contains a sane value */ bool evaluate_animation(COLLADAFW::Transformation *tm, float mat[4][4], float fra, const char *node_id); - // gives a world-space mat of joint at rest position + /* gives a world-space mat of joint at rest position */ void get_joint_rest_mat(float mat[4][4], COLLADAFW::Node *root, COLLADAFW::Node *node); - // gives a world-space mat, end's mat not included + /* gives a world-space mat, end's mat not included */ bool calc_joint_parent_mat_rest(float mat[4][4], float par[4][4], COLLADAFW::Node *node, @@ -239,8 +239,8 @@ class AnimationImporter : private TransformReader, public AnimationImporterBase #endif #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 + /* 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); #endif diff --git a/source/blender/io/collada/ArmatureExporter.cpp b/source/blender/io/collada/ArmatureExporter.cpp index fc697e1617b..ed043096c7e 100644 --- a/source/blender/io/collada/ArmatureExporter.cpp +++ b/source/blender/io/collada/ArmatureExporter.cpp @@ -40,14 +40,14 @@ #include "GeometryExporter.h" #include "SceneExporter.h" -// write bone nodes +/* write bone nodes */ void ArmatureExporter::add_armature_bones(Object *ob_arm, ViewLayer *view_layer, SceneExporter *se, std::vector<Object *> &child_objects) { - // write bone nodes + /* write bone nodes */ bArmature *armature = (bArmature *)ob_arm->data; bool is_edited = armature->edbo != NULL; @@ -95,7 +95,7 @@ bool ArmatureExporter::add_instance_controller(Object *ob) return false; } - // write root bone URLs + /* write root bone URLs */ Bone *bone; for (bone = (Bone *)arm->bonebase.first; bone; bone = bone->next) { write_bone_URLs(ins, ob_arm, bone); @@ -144,7 +144,7 @@ void ArmatureExporter::find_objects_using_armature(Object *ob_arm, } #endif -// parent_mat is armature-space +/* parent_mat is armature-space */ void ArmatureExporter::add_bone_node(Bone *bone, Object *ob_arm, SceneExporter *se, @@ -197,7 +197,7 @@ void ArmatureExporter::add_bone_node(Bone *bone, add_bone_transform(ob_arm, bone, node); - // Write nodes of childobjects, remove written objects from list + /* Write nodes of childobjects, remove written objects from list */ std::vector<Object *>::iterator iter = child_objects.begin(); while (iter != child_objects.end()) { @@ -206,20 +206,20 @@ void ArmatureExporter::add_bone_node(Bone *bone, float backup_parinv[4][4]; copy_m4_m4(backup_parinv, ob->parentinv); - // crude, temporary change to parentinv - // so transform gets exported correctly. + /* Crude, temporary change to parentinv + * so transform gets exported correctly. */ - // Add bone tail- translation... don't know why - // bone parenting is against the tail of a bone - // and not it's head, seems arbitrary. + /* Add bone tail- translation... don't know why + * bone parenting is against the tail of a bone + * and not it's head, seems arbitrary. */ ob->parentinv[3][1] += bone->length; - // OPEN_SIM_COMPATIBILITY - // TODO: when such objects are animated as - // single matrix the tweak must be applied - // to the result. + /* OPEN_SIM_COMPATIBILITY + * TODO: when such objects are animated as + * single matrix the tweak must be applied + * to the result. */ if (export_settings.get_open_sim()) { - // tweak objects parentinverse to match compatibility + /* Tweak objects parentinverse to match compatibility. */ float temp[4][4]; copy_m4_m4(temp, bone->arm_mat); @@ -289,11 +289,11 @@ void ArmatureExporter::add_bone_transform(Object *ob_arm, Bone *bone, COLLADASW: mul_m4_m4m4(mat, parent_inverse, bone_rest_mat); } - // OPEN_SIM_COMPATIBILITY + /* OPEN_SIM_COMPATIBILITY */ if (export_settings.get_open_sim()) { - // Remove rotations vs armature from transform - // parent_rest_rot * mat * irest_rot + /* Remove rotations vs armature from transform + * parent_rest_rot * mat * irest_rot */ Matrix workmat; copy_m4_m4(workmat, bone_rest_mat); diff --git a/source/blender/io/collada/ArmatureExporter.h b/source/blender/io/collada/ArmatureExporter.h index 193dc9cde3a..b994741f342 100644 --- a/source/blender/io/collada/ArmatureExporter.h +++ b/source/blender/io/collada/ArmatureExporter.h @@ -22,7 +22,7 @@ #include <list> #include <string> -//#include <vector> +// #include <vector> #include "COLLADASWInputList.h" #include "COLLADASWLibraryControllers.h" @@ -43,16 +43,16 @@ class SceneExporter; -// 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? +/* 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? */ class ArmatureExporter : public COLLADASW::LibraryControllers, protected TransformWriter, protected InstanceWriter { public: - // 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? + /* 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, BCExportSettings &export_settings) @@ -83,8 +83,8 @@ class ArmatureExporter : public COLLADASW::LibraryControllers, void find_objects_using_armature(Object *ob_arm, std::vector<Object *> &objects, Scene *sce); #endif - // Scene, SceneExporter and the list of child_objects - // are required for writing bone parented objects + /* Scene, SceneExporter and the list of child_objects + * are required for writing bone parented objects */ void add_bone_node(Bone *bone, Object *ob_arm, SceneExporter *se, diff --git a/source/blender/io/collada/ArmatureImporter.cpp b/source/blender/io/collada/ArmatureImporter.cpp index dbb0ad328f5..af6558da3b4 100644 --- a/source/blender/io/collada/ArmatureImporter.cpp +++ b/source/blender/io/collada/ArmatureImporter.cpp @@ -153,7 +153,7 @@ int ArmatureImporter::create_bone(SkinInfo *skin, if (layer) { bone->layer = layer; } - arm->layer |= layer; // ensure that all populated bone layers are visible after import + arm->layer |= layer; /* ensure that all populated bone layers are visible after import */ float *tail = be.get_tail(); int use_connect = be.get_use_connect(); @@ -504,7 +504,7 @@ void ArmatureImporter::create_armature_bones(Main *bmain, std::vector<Object *> } ED_armature_to_edit(armature); - armature->layer = 0; // layer is set according to imported bone set in create_bone() + armature->layer = 0; /* layer is set according to imported bone set in create_bone() */ create_bone(NULL, node, NULL, node->getChildNodes().getCount(), NULL, armature, layer_labels); if (this->import_settings->find_chains) { @@ -623,7 +623,7 @@ Object *ArmatureImporter::create_armature_bones(Main *bmain, SkinInfo &skin) ob_arm = skin.set_armature(shared); } else { - ob_arm = skin.create_armature(m_bmain, scene, view_layer); // once for every armature + ob_arm = skin.create_armature(m_bmain, scene, view_layer); /* once for every armature */ } /* enter armature edit mode */ @@ -631,7 +631,7 @@ Object *ArmatureImporter::create_armature_bones(Main *bmain, SkinInfo &skin) ED_armature_to_edit(armature); totbone = 0; - // bone_direction_row = 1; // TODO: don't default to Y but use asset and based on it decide on + // bone_direction_row = 1; /* TODO: don't default to Y but use asset and based on it decide on */ /* default row */ /* create bones */ diff --git a/source/blender/io/collada/ArmatureImporter.h b/source/blender/io/collada/ArmatureImporter.h index a1c4a25b80f..16265e66a8e 100644 --- a/source/blender/io/collada/ArmatureImporter.h +++ b/source/blender/io/collada/ArmatureImporter.h @@ -61,11 +61,11 @@ class ArmatureImporter : private TransformReader { // std::map<int, JointData> joint_index_to_joint_info_map; // std::map<COLLADAFW::UniqueId, int> joint_id_to_joint_index_map; BoneExtensionManager bone_extension_manager; - // int bone_direction_row; // XXX not used + // int bone_direction_row; /* XXX not used */ float leaf_bone_length; int totbone; - // XXX not used - // float min_angle; // minimum angle between bone head-tail and a row of bone matrix + /* XXX not used */ + // float min_angle; /* minimum angle between bone head-tail and a row of bone matrix */ #if 0 struct ArmatureJoints { @@ -75,10 +75,10 @@ class ArmatureImporter : private TransformReader { std::vector<ArmatureJoints> armature_joints; #endif - Object *empty; // empty for leaf bones + Object *empty; /* empty for leaf bones */ std::map<COLLADAFW::UniqueId, COLLADAFW::UniqueId> geom_uid_by_controller_uid; - std::map<COLLADAFW::UniqueId, COLLADAFW::Node *> joint_by_uid; // contains all joints + std::map<COLLADAFW::UniqueId, COLLADAFW::Node *> joint_by_uid; /* contains all joints */ std::vector<COLLADAFW::Node *> root_joints; std::vector<COLLADAFW::Node *> finished_joints; std::vector<COLLADAFW::MorphController *> morph_controllers; @@ -87,11 +87,12 @@ class ArmatureImporter : private TransformReader { MeshImporterBase *mesh_importer; - // This is used to store data passed in write_controller_data. - // Arrays from COLLADAFW::SkinControllerData lose ownership, so do this class members - // so that arrays don't get freed until we free them explicitly. + /* This is used to store data passed in write_controller_data. + * Arrays from COLLADAFW::SkinControllerData lose ownership, so do this class members + * so that arrays don't get freed until we free them explicitly. */ - std::map<COLLADAFW::UniqueId, SkinInfo> skin_by_data_uid; // data UID = skin controller data UID + std::map<COLLADAFW::UniqueId, SkinInfo> + skin_by_data_uid; /* data UID = skin controller data UID */ #if 0 JointData *get_joint_data(COLLADAFW::Node *node); #endif @@ -153,13 +154,13 @@ class ArmatureImporter : private TransformReader { void add_root_joint(COLLADAFW::Node *node, Object *parent); - // here we add bones to armatures, having armatures previously created in write_controller + /* here we add bones to armatures, having armatures previously created in write_controller */ void make_armatures(bContext *C, std::vector<Object *> &objects_to_scale); void make_shape_keys(bContext *C); #if 0 - // link with meshes, create vertex groups, assign weights + /* 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); @@ -175,7 +176,7 @@ class ArmatureImporter : private TransformReader { void get_rna_path_for_joint(COLLADAFW::Node *node, char *joint_path, size_t count); - // gives a world-space mat + /* gives a world-space mat */ bool get_joint_bind_mat(float m[4][4], COLLADAFW::Node *joint); void set_tags_map(TagsMap &tags_map); diff --git a/source/blender/io/collada/BCAnimationCurve.cpp b/source/blender/io/collada/BCAnimationCurve.cpp index 559a17eda9f..46439bb3556 100644 --- a/source/blender/io/collada/BCAnimationCurve.cpp +++ b/source/blender/io/collada/BCAnimationCurve.cpp @@ -230,7 +230,7 @@ int BCAnimationCurve::closest_index_above(const float sample_frame, const int st return -1; } - const int cframe = fcurve->bezt[start_at].vec[1][0]; // inaccurate! + const int cframe = fcurve->bezt[start_at].vec[1][0]; /* inaccurate! */ if (fabs(cframe - sample_frame) < 0.00001) { return start_at; @@ -252,7 +252,7 @@ int BCAnimationCurve::closest_index_below(const float sample_frame) const for (int fcu_index = 0; fcu_index < fcurve->totvert; fcu_index++) { upper_index = fcu_index; - const int cframe = fcurve->bezt[fcu_index].vec[1][0]; // inaccurate! + const int cframe = fcurve->bezt[fcu_index].vec[1][0]; /* inaccurate! */ if (cframe <= sample_frame) { lower_frame = cframe; lower_index = fcu_index; @@ -347,7 +347,7 @@ float BCAnimationCurve::get_value(const float frame) if (fcurve) { return evaluate_fcurve(fcurve, frame); } - return 0; // TODO: handle case where neither sample nor fcu exist + return 0; /* TODO: handle case where neither sample nor fcu exist */ } void BCAnimationCurve::update_range(float val) diff --git a/source/blender/io/collada/BCAnimationCurve.h b/source/blender/io/collada/BCAnimationCurve.h index 3f7bcf9a13f..27856dd55f4 100644 --- a/source/blender/io/collada/BCAnimationCurve.h +++ b/source/blender/io/collada/BCAnimationCurve.h @@ -119,7 +119,7 @@ class BCAnimationCurve { std::string get_animation_name(Object *ob) const; /* xxx: this is collada specific */ std::string get_channel_target() const; std::string get_channel_type() const; - std::string get_channel_posebone() const; // returns "" if channel is not a bone channel + std::string get_channel_posebone() const; /* returns "" if channel is not a bone channel */ int get_channel_index() const; int get_subindex() const; diff --git a/source/blender/io/collada/BCAnimationSampler.cpp b/source/blender/io/collada/BCAnimationSampler.cpp index b8df98e8acb..6bada9950b9 100644 --- a/source/blender/io/collada/BCAnimationSampler.cpp +++ b/source/blender/io/collada/BCAnimationSampler.cpp @@ -17,7 +17,7 @@ * All rights reserved. */ -#include <algorithm> // std::find +#include <algorithm> /* std::find */ #include <map> #include <vector> @@ -92,7 +92,7 @@ static void get_sample_frames(BCFrameSet &sample_frames, sample_frames.clear(); if (sampling_rate < 1) { - return; // no sample frames in this case + return; /* no sample frames in this case */ } float sfra = scene->r.sfra; @@ -584,7 +584,7 @@ BCSampleFrame *BCSampleFrameContainer::get_frame(int frame_index) /* Return a list of all frames that need to be sampled */ int BCSampleFrameContainer::get_frames(std::vector<int> &frames) const { - frames.clear(); // safety; + frames.clear(); /* safety; */ BCSampleFrameMap::const_iterator it; for (it = sample_frames.begin(); it != sample_frames.end(); ++it) { frames.push_back(it->first); @@ -594,7 +594,7 @@ int BCSampleFrameContainer::get_frames(std::vector<int> &frames) const int BCSampleFrameContainer::get_frames(Object *ob, BCFrames &frames) const { - frames.clear(); // safety; + frames.clear(); /* safety; */ BCSampleFrameMap::const_iterator it; for (it = sample_frames.begin(); it != sample_frames.end(); ++it) { const BCSampleFrame &frame = it->second; @@ -607,7 +607,7 @@ int BCSampleFrameContainer::get_frames(Object *ob, BCFrames &frames) const int BCSampleFrameContainer::get_frames(Object *ob, Bone *bone, BCFrames &frames) const { - frames.clear(); // safety; + frames.clear(); /* safety; */ BCSampleFrameMap::const_iterator it; for (it = sample_frames.begin(); it != sample_frames.end(); ++it) { const BCSampleFrame &frame = it->second; @@ -620,7 +620,7 @@ int BCSampleFrameContainer::get_frames(Object *ob, Bone *bone, BCFrames &frames) int BCSampleFrameContainer::get_samples(Object *ob, BCFrameSampleMap &samples) const { - samples.clear(); // safety; + samples.clear(); /* safety; */ BCSampleFrameMap::const_iterator it; for (it = sample_frames.begin(); it != sample_frames.end(); ++it) { const BCSampleFrame &frame = it->second; @@ -634,7 +634,7 @@ int BCSampleFrameContainer::get_samples(Object *ob, BCFrameSampleMap &samples) c int BCSampleFrameContainer::get_matrices(Object *ob, BCMatrixSampleMap &samples) const { - samples.clear(); // safety; + samples.clear(); /* safety; */ BCSampleFrameMap::const_iterator it; for (it = sample_frames.begin(); it != sample_frames.end(); ++it) { const BCSampleFrame &frame = it->second; @@ -648,7 +648,7 @@ int BCSampleFrameContainer::get_matrices(Object *ob, BCMatrixSampleMap &samples) int BCSampleFrameContainer::get_matrices(Object *ob, Bone *bone, BCMatrixSampleMap &samples) const { - samples.clear(); // safety; + samples.clear(); /* safety; */ BCSampleFrameMap::const_iterator it; for (it = sample_frames.begin(); it != sample_frames.end(); ++it) { const BCSampleFrame &frame = it->second; diff --git a/source/blender/io/collada/BCAnimationSampler.h b/source/blender/io/collada/BCAnimationSampler.h index f7f2464a637..52c0c8aa29e 100644 --- a/source/blender/io/collada/BCAnimationSampler.h +++ b/source/blender/io/collada/BCAnimationSampler.h @@ -134,7 +134,7 @@ class BCSampleFrameContainer { } BCSample &add(Object *ob, int frame_index); - BCSampleFrame *get_frame(int frame_index); // returns NULL if frame does not exist + BCSampleFrame *get_frame(int frame_index); /* returns NULL if frame does not exist */ int get_frames(std::vector<int> &frames) const; int get_frames(Object *ob, BCFrames &frames) const; diff --git a/source/blender/io/collada/BCMath.cpp b/source/blender/io/collada/BCMath.cpp index 85d4c212141..8a3fbf3c92c 100644 --- a/source/blender/io/collada/BCMath.cpp +++ b/source/blender/io/collada/BCMath.cpp @@ -67,7 +67,8 @@ BCMatrix::BCMatrix(BC_global_forward_axis global_forward_axis, BC_global_up_axis mat3_from_axis_conversion( BC_DEFAULT_FORWARD, BC_DEFAULT_UP, global_forward_axis, global_up_axis, mrot); - transpose_m3(mrot); // TODO: Verify that mat3_from_axis_conversion() returns a transposed matrix + transpose_m3( + mrot); /* TODO: Verify that mat3_from_axis_conversion() returns a transposed matrix */ copy_m4_m3(mat, mrot); set_transform(mat); } diff --git a/source/blender/io/collada/BCSampleData.h b/source/blender/io/collada/BCSampleData.h index 463c90ec00b..06d234e2c3e 100644 --- a/source/blender/io/collada/BCSampleData.h +++ b/source/blender/io/collada/BCSampleData.h @@ -55,7 +55,7 @@ class BCSample { bool get_value(std::string channel_target, const int array_index, float *val) const; const BCMatrix &get_matrix() const; - const BCMatrix *get_matrix(Bone *bone) const; // returns NULL if bone is not animated + const BCMatrix *get_matrix(Bone *bone) const; /* returns NULL if bone is not animated */ }; typedef std::map<Object *, BCSample *> BCSampleMap; diff --git a/source/blender/io/collada/BlenderContext.cpp b/source/blender/io/collada/BlenderContext.cpp index 1d3bffacb79..defa875882f 100644 --- a/source/blender/io/collada/BlenderContext.cpp +++ b/source/blender/io/collada/BlenderContext.cpp @@ -112,7 +112,7 @@ BlenderContext::BlenderContext(bContext *C) main = CTX_data_main(C); scene = CTX_data_scene(C); view_layer = CTX_data_view_layer(C); - depsgraph = nullptr; // create only when needed + depsgraph = nullptr; /* create only when needed */ } bContext *BlenderContext::get_context() diff --git a/source/blender/io/collada/ControllerExporter.cpp b/source/blender/io/collada/ControllerExporter.cpp index 1b8c859f443..1d8d0f2b389 100644 --- a/source/blender/io/collada/ControllerExporter.cpp +++ b/source/blender/io/collada/ControllerExporter.cpp @@ -305,7 +305,7 @@ void ControllerExporter::export_morph_controller(Object *ob, Key *key) COLLADASW::InputList &input = targets.getInputList(); input.push_back(COLLADASW::Input( - COLLADASW::InputSemantic::MORPH_TARGET, // constant declared in COLLADASWInputList.h + COLLADASW::InputSemantic::MORPH_TARGET, /* constant declared in COLLADASWInputList.h */ COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, targets_id))); input.push_back( COLLADASW::Input(COLLADASW::InputSemantic::MORPH_WEIGHT, @@ -400,7 +400,7 @@ void ControllerExporter::add_joints_element(ListBase *defbase, COLLADASW::InputList &input = joints.getInputList(); input.push_back(COLLADASW::Input( - COLLADASW::InputSemantic::JOINT, // constant declared in COLLADASWInputList.h + COLLADASW::InputSemantic::JOINT, /* constant declared in COLLADASWInputList.h */ COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, joints_source_id))); input.push_back( COLLADASW::Input(COLLADASW::InputSemantic::BINDMATRIX, @@ -415,7 +415,7 @@ void ControllerExporter::add_bind_shape_mat(Object *ob) BKE_object_matrix_local_get(ob, f_obmat); if (export_settings.get_apply_global_orientation()) { - // do nothing, rotation is going to be applied to the Data + /* do nothing, rotation is going to be applied to the Data */ } else { bc_add_global_transform(f_obmat, export_settings.get_global_transform()); @@ -615,7 +615,7 @@ void ControllerExporter::add_vertex_weights_element(const std::string &weights_s int offset = 0; input.push_back(COLLADASW::Input( - COLLADASW::InputSemantic::JOINT, // constant declared in COLLADASWInputList.h + COLLADASW::InputSemantic::JOINT, /* constant declared in COLLADASWInputList.h */ COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, joints_source_id), offset++)); input.push_back( diff --git a/source/blender/io/collada/ControllerExporter.h b/source/blender/io/collada/ControllerExporter.h index 753538d8e98..6a377a4119e 100644 --- a/source/blender/io/collada/ControllerExporter.h +++ b/source/blender/io/collada/ControllerExporter.h @@ -56,9 +56,9 @@ class ControllerExporter : public COLLADASW::LibraryControllers, BCExportSettings export_settings; public: - // 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? + /* 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, BCExportSettings &export_settings) @@ -91,8 +91,8 @@ class ControllerExporter : public COLLADASW::LibraryControllers, std::string get_controller_id(Key *key, Object *ob); - // ob should be of type OB_MESH - // both args are required + /* ob should be of type OB_MESH + * both args are required */ void export_skin_controller(Object *ob, Object *ob_arm); void export_morph_controller(Object *ob, Key *key); diff --git a/source/blender/io/collada/DocumentExporter.cpp b/source/blender/io/collada/DocumentExporter.cpp index 6be441a9e27..65c71b0edef 100644 --- a/source/blender/io/collada/DocumentExporter.cpp +++ b/source/blender/io/collada/DocumentExporter.cpp @@ -18,7 +18,7 @@ * \ingroup collada */ -#include <algorithm> // std::find +#include <algorithm> /* std::find */ #include <math.h> #include <stdio.h> #include <stdlib.h> @@ -79,7 +79,7 @@ #include "BLI_string.h" #include "BLI_utildefines.h" -#include "BKE_action.h" // pose functions +#include "BKE_action.h" /* pose functions */ #include "BKE_animsys.h" #include "BKE_appdir.h" #include "BKE_armature.h" @@ -106,7 +106,7 @@ extern "C" char build_hash[]; #include "collada_internal.h" #include "collada_utils.h" -// can probably go after refactor is complete +/* can probably go after refactor is complete */ #include "InstanceWriter.h" #include "TransformWriter.h" @@ -170,9 +170,9 @@ static COLLADABU::NativeString make_temp_filepath(const char *name, const char * return native_filename; } -// TODO: it would be better to instantiate animations rather than create a new one per object -// COLLADA allows this through multiple <channel>s in <animation>. -// For this to work, we need to know objects that use a certain action. +/* TODO: it would be better to instantiate animations rather than create a new one per object + * COLLADA allows this through multiple <channel>s in <animation>. + * For this to work, we need to know objects that use a certain action. */ int DocumentExporter::exportCurrentScene() { @@ -187,10 +187,10 @@ int DocumentExporter::exportCurrentScene() COLLADABU::NativeString native_filename = make_temp_filepath(NULL, ".dae"); COLLADASW::StreamWriter *writer = new COLLADASW::StreamWriter(native_filename); - // open <collada> + /* open <collada> */ writer->startDocument(); - // <asset> + /* <asset> */ COLLADASW::Asset asset(writer); RNA_id_pointer_create(&(sce->id), &sceneptr); @@ -254,37 +254,37 @@ int DocumentExporter::exportCurrentScene() asset.add(); LinkNode *export_set = this->export_settings.get_export_set(); - // <library_cameras> + /* <library_cameras> */ if (bc_has_object_type(export_set, OB_CAMERA)) { CamerasExporter ce(writer, this->export_settings); ce.exportCameras(sce); } - // <library_lights> + /* <library_lights> */ if (bc_has_object_type(export_set, OB_LAMP)) { LightsExporter le(writer, this->export_settings); le.exportLights(sce); } - // <library_effects> + /* <library_effects> */ EffectsExporter ee(writer, this->export_settings, key_image_map); ee.exportEffects(C, sce); - // <library_images> + /* <library_images> */ ImagesExporter ie(writer, this->export_settings, key_image_map); ie.exportImages(sce); - // <library_materials> + /* <library_materials> */ MaterialsExporter me(writer, this->export_settings); me.exportMaterials(sce); - // <library_geometries> + /* <library_geometries> */ if (bc_has_object_type(export_set, OB_MESH)) { GeometryExporter ge(blender_context, writer, this->export_settings); ge.exportGeom(); } - // <library_controllers> + /* <library_controllers> */ ArmatureExporter arm_exporter(blender_context, writer, this->export_settings); ControllerExporter controller_exporter(blender_context, writer, this->export_settings); if (bc_has_object_type(export_set, OB_ARMATURE) || @@ -292,28 +292,28 @@ int DocumentExporter::exportCurrentScene() controller_exporter.export_controllers(); } - // <library_visual_scenes> + /* <library_visual_scenes> */ SceneExporter se(blender_context, writer, &arm_exporter, this->export_settings); if (this->export_settings.get_include_animations()) { - // <library_animations> + /* <library_animations> */ AnimationExporter ae(writer, this->export_settings); ae.exportAnimations(); } se.exportScene(); - // <scene> + /* <scene> */ std::string scene_name(translate_id(id_name(sce))); COLLADASW::Scene scene(writer, COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, scene_name)); scene.add(); - // close <Collada> + /* close <Collada> */ writer->endDocument(); delete writer; - // Finally move the created document into place + /* Finally move the created document into place */ fprintf(stdout, "Collada export to: %s\n", this->export_settings.get_filepath()); int status = BLI_rename(native_filename.c_str(), this->export_settings.get_filepath()); if (status != 0) { diff --git a/source/blender/io/collada/DocumentImporter.cpp b/source/blender/io/collada/DocumentImporter.cpp index 083d7258d0a..b9f132d04dd 100644 --- a/source/blender/io/collada/DocumentImporter.cpp +++ b/source/blender/io/collada/DocumentImporter.cpp @@ -22,7 +22,7 @@ * * name imported objects * * import object rotation as euler */ -#include <algorithm> // sort() +#include <algorithm> /* sort() */ #include <map> #include <string> @@ -90,7 +90,7 @@ */ // #define COLLADA_DEBUG -// creates empties for each imported bone on layer 2, for debugging +/* creates empties for each imported bone on layer 2, for debugging */ // #define ARMATURE_TEST DocumentImporter::DocumentImporter(bContext *C, const ImportSettings *import_settings) @@ -429,7 +429,7 @@ Object *DocumentImporter::create_instance_node(Object *source_ob, if (source_node) { COLLADABU::Math::Matrix4 mat4 = source_node->getTransformationMatrix(); COLLADABU::Math::Matrix4 bmat4 = - mat4.transpose(); // transpose to get blender row-major order + mat4.transpose(); /* transpose to get blender row-major order */ float mat[4][4]; for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { @@ -457,7 +457,7 @@ Object *DocumentImporter::create_instance_node(Object *source_ob, } COLLADAFW::InstanceNodePointerArray &inodes = child_node->getInstanceNodes(); Object *new_child = NULL; - if (inodes.getCount()) { // \todo loop through instance nodes + if (inodes.getCount()) { /* \todo loop through instance nodes */ const COLLADAFW::UniqueId &id = inodes[0]->getInstanciatedObjectId(); fprintf(stderr, "Doing %d child nodes\n", (int)node_map.count(id)); new_child = create_instance_node( @@ -678,7 +678,7 @@ std::vector<Object *> *DocumentImporter::write_node(COLLADAFW::Node *node, } } - // create_constraints(et,ob); + /* create_constraints(et,ob); */ } for (std::vector<Object *>::iterator it = objects_done->begin(); it != objects_done->end(); @@ -686,7 +686,7 @@ std::vector<Object *> *DocumentImporter::write_node(COLLADAFW::Node *node, ob = *it; if (read_transform) { - anim_importer.read_node_transform(node, ob); // overwrites location set earlier + anim_importer.read_node_transform(node, ob); /* overwrites location set earlier */ } if (!is_joint) { @@ -815,7 +815,7 @@ void DocumentImporter::write_profile_COMMON(COLLADAFW::EffectCommon *ef, Materia /* following mapping still needs to be verified */ #if 0 - // needs rework to be done for 2.81 + /* needs rework to be done for 2.81 */ matNode.set_shininess(ef->getShininess()); #endif matNode.set_reflectivity(ef->getReflectivity()); @@ -1127,7 +1127,7 @@ bool DocumentImporter::writeLight(const COLLADAFW::Light *light) switch (light->getLightType()) { case COLLADAFW::Light::AMBIENT_LIGHT: { - lamp->type = LA_SUN; // TODO needs more thoughts + lamp->type = LA_SUN; /* TODO needs more thoughts */ } break; case COLLADAFW::Light::SPOT_LIGHT: { lamp->type = LA_SPOT; diff --git a/source/blender/io/collada/DocumentImporter.h b/source/blender/io/collada/DocumentImporter.h index e382a44c3c2..a23e983940e 100644 --- a/source/blender/io/collada/DocumentImporter.h +++ b/source/blender/io/collada/DocumentImporter.h @@ -46,7 +46,7 @@ struct bContext; /** Importer class. */ class DocumentImporter : COLLADAFW::IWriter { public: - //! Enumeration to denote the stage of import + /** Enumeration to denote the stage of import */ enum ImportStage { Fetching_Scene_data, /* First pass to collect all data except controller */ Fetching_Controller_data, /* Second pass to collect controller data */ @@ -98,7 +98,8 @@ class DocumentImporter : COLLADAFW::IWriter { bool writeAnimationList(const COLLADAFW::AnimationList *); #if WITH_OPENCOLLADA_ANIMATION_CLIP - // Please enable this when building with Collada 1.6.65 or newer (also in DocumentImporter.cpp) + /* Please enable this when building with Collada 1.6.65 or newer (also in DocumentImporter.cpp) + */ bool writeAnimationClip(const COLLADAFW::AnimationClip *animationClip); #endif @@ -160,7 +161,8 @@ class DocumentImporter : COLLADAFW::IWriter { std::vector<Object *> libnode_ob; std::map<COLLADAFW::UniqueId, COLLADAFW::Node *> - root_map; // find root joint by child joint uid, for bone tree evaluation during resampling + root_map; /* find root joint by child joint uid, for bone tree evaluation during resampling + */ std::map<COLLADAFW::UniqueId, const COLLADAFW::Object *> FW_object_map; std::string import_from_version; diff --git a/source/blender/io/collada/EffectExporter.cpp b/source/blender/io/collada/EffectExporter.cpp index 7f6d3cbdc6f..4108472d1df 100644 --- a/source/blender/io/collada/EffectExporter.cpp +++ b/source/blender/io/collada/EffectExporter.cpp @@ -65,7 +65,7 @@ bool EffectsExporter::hasEffects(Scene *sce) for (a = 0; a < ob->totcol; a++) { Material *ma = BKE_object_material_get(ob, a + 1); - // no material, but check all of the slots + /* no material, but check all of the slots */ if (!ma) { continue; } @@ -101,7 +101,7 @@ void EffectsExporter::set_transparency(COLLADASW::EffectProfile &ep, Material *m { double alpha = bc_get_alpha(ma); if (alpha < 1) { - // workaround use <transparent> to avoid wrong handling of <transparency> by other tools + /* workaround use <transparent> to avoid wrong handling of <transparency> by other tools */ COLLADASW::ColorOrTexture cot = bc_get_cot(0, 0, 0, alpha); ep.setTransparent(cot, false, "alpha"); ep.setOpaque(COLLADASW::EffectProfile::A_ONE); @@ -209,7 +209,7 @@ void EffectsExporter::operator()(Material *ma, Object *ob) COLLADASW::EffectProfile ep(mSW); ep.setProfileType(COLLADASW::EffectProfile::COMMON); ep.openProfile(); - set_shader_type(ep, ma); // creates a Lambert Shader for now + set_shader_type(ep, ma); /* creates a Lambert Shader for now */ COLLADASW::ColorOrTexture cot; @@ -234,7 +234,7 @@ void EffectsExporter::operator()(Material *ma, Object *ob) MTex *t = ma->mtex[tex_indices[a]]; Image *ima = t->tex->ima; - // Image not set for texture + /* Image not set for texture */ if (!ima) { continue; } @@ -242,17 +242,17 @@ void EffectsExporter::operator()(Material *ma, Object *ob) std::string key(id_name(ima)); key = translate_id(key); - // create only one <sampler>/<surface> pair for each unique image + /* create only one <sampler>/<surface> pair for each unique image */ if (im_samp_map.find(key) == im_samp_map.end()) { - //<newparam> <sampler> <source> + /* <newparam> <sampler> <source> */ 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 + /* copy values to arrays since they will live longer */ samplers[a] = sampler; - // store pointers so they can be used later when we create <texture>s + /* store pointers so they can be used later when we create <texture>s */ samp_surf[b] = &samplers[a]; //samp_surf[b][1] = &surfaces[a]; @@ -274,12 +274,12 @@ void EffectsExporter::operator()(Material *ma, Object *ob) 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 uninitialized memory ... + samp_surf[i]; /* possibly uninitialized memory ... */ writeTextures(ep, key, sampler, t, ima, uvname); } #endif - // performs the actual writing + /* performs the actual writing */ ep.addProfileElements(); ep.addExtraTechniques(mSW); diff --git a/source/blender/io/collada/ErrorHandler.h b/source/blender/io/collada/ErrorHandler.h index 60253a08cda..1da17dbed42 100644 --- a/source/blender/io/collada/ErrorHandler.h +++ b/source/blender/io/collada/ErrorHandler.h @@ -20,7 +20,7 @@ #pragma once -#include <algorithm> // sort() +#include <algorithm> /* sort() */ #include <map> #include <string> #include <vector> diff --git a/source/blender/io/collada/ExtraHandler.h b/source/blender/io/collada/ExtraHandler.h index 8f98e1dec1b..4b13aaca2aa 100644 --- a/source/blender/io/collada/ExtraHandler.h +++ b/source/blender/io/collada/ExtraHandler.h @@ -20,7 +20,7 @@ #pragma once -#include <algorithm> // sort() +#include <algorithm> /* sort() */ #include <map> #include <string> #include <vector> diff --git a/source/blender/io/collada/GeometryExporter.cpp b/source/blender/io/collada/GeometryExporter.cpp index c7fcc51d42f..332390845c7 100644 --- a/source/blender/io/collada/GeometryExporter.cpp +++ b/source/blender/io/collada/GeometryExporter.cpp @@ -386,7 +386,7 @@ void GeometryExporter::create_mesh_primitive_list(short material_index, COLLADASW::Input texcoord_input( COLLADASW::InputSemantic::TEXCOORD, makeUrl(makeTexcoordSourceId(geom_id, i, this->export_settings.get_active_uv_only())), - 2, // this is only until we have optimized UV sets + 2, /* this is only until we have optimized UV sets */ (this->export_settings.get_active_uv_only()) ? 0 : layer_index - 1 /* set (0,1,2,...) */ ); til.push_back(texcoord_input); @@ -401,8 +401,8 @@ void GeometryExporter::create_mesh_primitive_list(short material_index, char *layer_name = bc_CustomData_get_layer_name(&me->ldata, CD_MLOOPCOL, a); COLLADASW::Input input4(COLLADASW::InputSemantic::COLOR, makeUrl(makeVertexColorSourceId(geom_id, layer_name)), - (has_uvs) ? 3 : 2, // all color layers have same index order - map_index // set number equals color map index + (has_uvs) ? 3 : 2, /* all color layers have same index order */ + map_index /* set number equals color map index */ ); til.push_back(input4); map_index++; diff --git a/source/blender/io/collada/LightExporter.cpp b/source/blender/io/collada/LightExporter.cpp index 463981ceefa..2f50a603ca3 100644 --- a/source/blender/io/collada/LightExporter.cpp +++ b/source/blender/io/collada/LightExporter.cpp @@ -76,7 +76,7 @@ void LightsExporter::operator()(Object *ob) quadatt = 1.0f / (d * d); } - // sun + /* sun */ if (la->type == LA_SUN) { COLLADASW::DirectionalLight cla(mSW, la_id, la_name); cla.setColor(col, false, "color"); @@ -85,7 +85,7 @@ void LightsExporter::operator()(Object *ob) addLight(cla); } - // spot + /* spot */ else if (la->type == LA_SPOT) { COLLADASW::SpotLight cla(mSW, la_id, la_name); cla.setColor(col, false, "color"); @@ -97,7 +97,7 @@ void LightsExporter::operator()(Object *ob) exportBlenderProfile(cla, la); addLight(cla); } - // lamp + /* lamp */ else if (la->type == LA_LOCAL) { COLLADASW::PointLight cla(mSW, la_id, la_name); cla.setColor(col, false, "color"); @@ -107,8 +107,8 @@ void LightsExporter::operator()(Object *ob) exportBlenderProfile(cla, la); addLight(cla); } - // area light is not supported - // it will be exported as a local lamp + /* area light is not supported + * it will be exported as a local lamp */ else { COLLADASW::PointLight cla(mSW, la_id, la_name); cla.setColor(col, false, "color"); @@ -138,7 +138,7 @@ bool LightsExporter::exportBlenderProfile(COLLADASW::Light &cla, Light *la) cla.addExtraTechniqueParameter("blender", "spotblend", la->spotblend); cla.addExtraTechniqueParameter("blender", "att1", la->att1); cla.addExtraTechniqueParameter("blender", "att2", la->att2); - // \todo figure out how we can have falloff curve supported here + /* \todo figure out how we can have falloff curve supported here */ cla.addExtraTechniqueParameter("blender", "falloff_type", la->falloff_type); cla.addExtraTechniqueParameter("blender", "clipsta", la->clipsta); cla.addExtraTechniqueParameter("blender", "clipend", la->clipend); diff --git a/source/blender/io/collada/MaterialExporter.cpp b/source/blender/io/collada/MaterialExporter.cpp index 488d1833e48..72669e9d8d2 100644 --- a/source/blender/io/collada/MaterialExporter.cpp +++ b/source/blender/io/collada/MaterialExporter.cpp @@ -51,7 +51,7 @@ bool MaterialsExporter::hasMaterials(Scene *sce) for (a = 0; a < ob->totcol; a++) { Material *ma = BKE_object_material_get(ob, a + 1); - // no material, but check all of the slots + /* no material, but check all of the slots */ if (!ma) { continue; } diff --git a/source/blender/io/collada/MaterialExporter.h b/source/blender/io/collada/MaterialExporter.h index 7d40347097c..c684e96be19 100644 --- a/source/blender/io/collada/MaterialExporter.h +++ b/source/blender/io/collada/MaterialExporter.h @@ -51,7 +51,7 @@ class MaterialsExporter : COLLADASW::LibraryMaterials { // used in forEachMaterialInScene template<class Functor> class ForEachMaterialFunctor { std::vector<std::string> - mMat; // contains list of material names, to avoid duplicate calling of f + mMat; /* contains list of material names, to avoid duplicate calling of f */ Functor *f; public: @@ -81,8 +81,8 @@ template<class Functor> class ForEachMaterialFunctor { }; struct MaterialFunctor { - // calls f for each unique material linked to each object in sce - // f should have + /* calls f for each unique material linked to each object in sce + * f should have */ // void operator()(Material *ma) template<class Functor> void forEachMaterialInExportSet(Scene *sce, Functor &f, LinkNode *export_set) diff --git a/source/blender/io/collada/Materials.cpp b/source/blender/io/collada/Materials.cpp index 1e02e151d97..a97b7dfcfd6 100644 --- a/source/blender/io/collada/Materials.cpp +++ b/source/blender/io/collada/Materials.cpp @@ -53,7 +53,7 @@ MaterialNode::MaterialNode(bContext *C, add_link(ntree, nmap["transparent"], 0, nmap["mix"], 2); add_link(ntree, nmap["mix"], 0, nmap["out"], 0); - // experimental, probably not used. + /* experimental, probably not used. */ make_group(C, ntree, nmap); #else shader_node = add_node(SH_NODE_BSDF_PRINCIPLED, 0, 300, ""); @@ -66,24 +66,24 @@ void MaterialNode::setShaderType() { #if 0 COLLADAFW::EffectCommon::ShaderType shader = ef->getShaderType(); - // Currently we only support PBR based shaders - // TODO: simulate the effects with PBR + /* Currently we only support PBR based shaders */ + /* TODO: simulate the effects with PBR */ - // blinn + /* blinn */ if (shader == COLLADAFW::EffectCommon::SHADER_BLINN) { ma->spec_shader = MA_SPEC_BLINN; ma->spec = ef->getShininess().getFloatValue(); } - // phong + /* phong */ else if (shader == COLLADAFW::EffectCommon::SHADER_PHONG) { ma->spec_shader = MA_SPEC_PHONG; ma->har = ef->getShininess().getFloatValue(); } - // lambert + /* lambert */ else if (shader == COLLADAFW::EffectCommon::SHADER_LAMBERT) { ma->diff_shader = MA_DIFF_LAMBERT; } - // default - lambert + /* default - lambert */ else { ma->diff_shader = MA_DIFF_LAMBERT; fprintf(stderr, "Current shader type is not supported, default to lambert.\n"); @@ -91,7 +91,7 @@ void MaterialNode::setShaderType() #endif } -// returns null if material already has a node tree +/* returns null if material already has a node tree */ bNodeTree *MaterialNode::prepare_material_nodetree() { if (material->nodetree) { @@ -139,7 +139,7 @@ void MaterialNode::set_reflectivity(COLLADAFW::FloatOrParam &val) } #if 0 -// needs rework to be done for 2.81 +/* needs rework to be done for 2.81 */ void MaterialNode::set_shininess(COLLADAFW::FloatOrParam &val) { float roughness = val.getFloatValue(); @@ -177,7 +177,7 @@ void MaterialNode::set_alpha(COLLADAFW::EffectCommon::OpaqueMode mode, } if (cot.isColor() || !cot.isValid()) { - // transparent_cot is either a color or not defined + /* transparent_cot is either a color or not defined */ float transparent_alpha; if (cot.isValid()) { @@ -185,14 +185,14 @@ void MaterialNode::set_alpha(COLLADAFW::EffectCommon::OpaqueMode mode, transparent_alpha = col.getAlpha(); } else { - // no transparent color defined + /* no transparent color defined */ transparent_alpha = 1; } float transparency_alpha = val.getFloatValue(); if (transparency_alpha < 0) { - // transparency is not defined - transparency_alpha = 1; // set to opaque + /* transparency is not defined */ + transparency_alpha = 1; /* set to opaque */ } float alpha = transparent_alpha * transparency_alpha; @@ -279,12 +279,12 @@ void MaterialNode::set_ambient(COLLADAFW::ColorOrTexture &cot) COLLADAFW::Color col = cot.getColor(); bNode *node = add_node(SH_NODE_RGB, -300, locy, "Ambient"); set_color(node, col); - // TODO: Connect node + /* TODO: Connect node */ } - // texture + /* texture */ else if (cot.isTexture()) { add_texture_node(cot, -300, locy, "Ambient"); - // TODO: Connect node + /* TODO: Connect node */ } } @@ -295,12 +295,12 @@ void MaterialNode::set_reflective(COLLADAFW::ColorOrTexture &cot) COLLADAFW::Color col = cot.getColor(); bNode *node = add_node(SH_NODE_RGB, -300, locy, "Reflective"); set_color(node, col); - // TODO: Connect node + /* TODO: Connect node */ } - // texture + /* texture */ else if (cot.isTexture()) { add_texture_node(cot, -300, locy, "Reflective"); - // TODO: Connect node + /* TODO: Connect node */ } } @@ -343,16 +343,16 @@ void MaterialNode::set_opacity(COLLADAFW::ColorOrTexture &cot) float alpha = effect->getTransparency().getFloatValue(); if (col.isValid()) { - alpha *= col.getAlpha(); // Assuming A_ONE opaque mode + alpha *= col.getAlpha(); /* Assuming A_ONE opaque mode */ } bNodeSocket *socket = nodeFindSocket(shader_node, SOCK_IN, "Alpha"); ((bNodeSocketValueFloat *)socket->default_value)->value = alpha; } - // texture + /* texture */ else if (cot.isTexture()) { add_texture_node(cot, -300, locy, "Alpha"); - // TODO: Connect node + /* TODO: Connect node */ } } @@ -363,12 +363,12 @@ void MaterialNode::set_specular(COLLADAFW::ColorOrTexture &cot) COLLADAFW::Color col = cot.getColor(); bNode *node = add_node(SH_NODE_RGB, -300, locy, "Specular"); set_color(node, col); - // TODO: Connect node + /* TODO: Connect node */ } - // texture + /* texture */ else if (cot.isTexture()) { add_texture_node(cot, -300, locy, "Specular"); - // TODO: Connect node + /* TODO: Connect node */ } } diff --git a/source/blender/io/collada/MeshImporter.cpp b/source/blender/io/collada/MeshImporter.cpp index 3d9c4d3ad6f..b0e3270a899 100644 --- a/source/blender/io/collada/MeshImporter.cpp +++ b/source/blender/io/collada/MeshImporter.cpp @@ -47,7 +47,7 @@ #include "MeshImporter.h" #include "collada_utils.h" -// get node name, or fall back to original id if not present (name is optional) +/* get node name, or fall back to original id if not present (name is optional) */ template<class T> static std::string bc_get_dae_name(T *node) { return node->getName().empty() ? node->getOriginalId() : node->getName(); @@ -170,7 +170,7 @@ void VCOLDataWrapper::get_vcol(int v_index, MLoopCol *mloopcol) case COLLADAFW::MeshVertexData::DATA_TYPE_FLOAT: { COLLADAFW::ArrayPrimitiveType<float> *values = mVData->getFloatValues(); if (values->empty() || values->getCount() <= (v_index * stride + 2)) { - return; // xxx need to create an error instead + return; /* xxx need to create an error instead */ } mloopcol->r = unit_float_to_uchar_clamp((*values)[v_index * stride]); @@ -181,7 +181,7 @@ void VCOLDataWrapper::get_vcol(int v_index, MLoopCol *mloopcol) case COLLADAFW::MeshVertexData::DATA_TYPE_DOUBLE: { COLLADAFW::ArrayPrimitiveType<double> *values = mVData->getDoubleValues(); if (values->empty() || values->getCount() <= (v_index * stride + 2)) { - return; // xxx need to create an error instead + return; /* xxx need to create an error instead */ } mloopcol->r = unit_float_to_uchar_clamp((*values)[v_index * stride]); @@ -216,7 +216,7 @@ bool MeshImporter::set_poly_indices( if (!broken_loop) { for (int i = 0; i < index; i++) { if (indices[i] == indices[index]) { - // duplicate index -> not good + /* duplicate index -> not good */ broken_loop = true; } } @@ -247,7 +247,7 @@ void MeshImporter::set_face_uv(MLoopUV *mloopuv, COLLADAFW::IndexList &index_list, int count) { - // per face vertex indices, this means for quad we have 4 indices, not 8 + /* per face vertex indices, this means for quad we have 4 indices, not 8 */ COLLADAFW::UIntValuesArray &indices = index_list.getIndices(); for (int index = 0; index < count; index++) { @@ -281,7 +281,7 @@ bool MeshImporter::is_nice_mesh(COLLADAFW::Mesh *mesh) const char *type_str = bc_primTypeToStr(type); - // OpenCollada passes POLYGONS type for <polylist> + /* OpenCollada passes POLYGONS type for <polylist> */ if (type == COLLADAFW::MeshPrimitive::POLYLIST || type == COLLADAFW::MeshPrimitive::POLYGONS) { COLLADAFW::Polygons *mpvc = (COLLADAFW::Polygons *)mp; @@ -319,7 +319,7 @@ bool MeshImporter::is_nice_mesh(COLLADAFW::Mesh *mesh) } else if (type == COLLADAFW::MeshPrimitive::LINES) { - // TODO: Add Checker for line syntax here + /* TODO: Add Checker for line syntax here */ } else if (type != COLLADAFW::MeshPrimitive::TRIANGLES && @@ -334,7 +334,7 @@ bool MeshImporter::is_nice_mesh(COLLADAFW::Mesh *mesh) void MeshImporter::read_vertices(COLLADAFW::Mesh *mesh, Mesh *me) { - // vertices + /* vertices */ COLLADAFW::MeshVertexData &pos = mesh->getPositions(); if (pos.empty()) { return; @@ -356,12 +356,12 @@ void MeshImporter::read_vertices(COLLADAFW::Mesh *mesh, Mesh *me) } } -// ===================================================================== -// condition 1: The Primitive has normals -// condition 2: The number of normals equals the number of faces. -// return true if both conditions apply. -// return false otherwise. -// ===================================================================== +/* ===================================================================== + * condition 1: The Primitive has normals + * condition 2: The number of normals equals the number of faces. + * return true if both conditions apply. + * return false otherwise. + * ===================================================================== */ bool MeshImporter::primitive_has_useable_normals(COLLADAFW::MeshPrimitive *mp) { @@ -385,10 +385,10 @@ bool MeshImporter::primitive_has_useable_normals(COLLADAFW::MeshPrimitive *mp) return has_useable_normals; } -// ===================================================================== -// Assume that only TRIANGLES, TRIANGLE_FANS, POLYLIST and POLYGONS -// have faces. (to be verified) -// ===================================================================== +/* ===================================================================== + * Assume that only TRIANGLES, TRIANGLE_FANS, POLYLIST and POLYGONS + * have faces. (to be verified) + * ===================================================================== */ bool MeshImporter::primitive_has_faces(COLLADAFW::MeshPrimitive *mp) { @@ -420,19 +420,19 @@ static std::string extract_vcolname(const COLLADAFW::String &collada_id) return colname; } -// ================================================================= -// Return the number of faces by summing up -// the facecounts of the parts. -// hint: This is done because mesh->getFacesCount() does -// count loose edges as extra faces, which is not what we want here. -// ================================================================= +/* ================================================================= + * Return the number of faces by summing up + * the facecounts of the parts. + * hint: This is done because mesh->getFacesCount() does + * count loose edges as extra faces, which is not what we want here. + * ================================================================= */ void MeshImporter::allocate_poly_data(COLLADAFW::Mesh *collada_mesh, Mesh *me) { COLLADAFW::MeshPrimitiveArray &prim_arr = collada_mesh->getMeshPrimitives(); int total_poly_count = 0; int total_loop_count = 0; - // collect edge_count and face_count from all parts + /* collect edge_count and face_count from all parts */ for (int i = 0; i < prim_arr.getCount(); i++) { COLLADAFW::MeshPrimitive *mp = prim_arr[i]; int type = mp->getPrimitiveType(); @@ -452,7 +452,7 @@ void MeshImporter::allocate_poly_data(COLLADAFW::Mesh *collada_mesh, Mesh *me) total_poly_count++; } else { - // TODO: this is a hole and not another polygon! + /* TODO: this is a hole and not another polygon! */ } } @@ -465,7 +465,7 @@ void MeshImporter::allocate_poly_data(COLLADAFW::Mesh *collada_mesh, Mesh *me) } } - // Add the data containers + /* Add the data containers */ if (total_poly_count > 0) { me->totpoly = total_poly_count; me->totloop = total_loop_count; @@ -485,11 +485,11 @@ void MeshImporter::allocate_poly_data(COLLADAFW::Mesh *collada_mesh, Mesh *me) COLLADAFW::MeshVertexData::InputInfos *info = collada_mesh->getUVCoords().getInputInfosArray()[i]; COLLADAFW::String &uvname = info->mName; - // Allocate space for UV_data + /* Allocate space for UV_data */ CustomData_add_layer_named( &me->ldata, CD_MLOOPUV, CD_DEFAULT, NULL, me->totloop, uvname.c_str()); } - // activate the first uv map + /* activate the first uv map */ me->mloopuv = (MLoopUV *)CustomData_get_layer_n(&me->ldata, CD_MLOOPUV, 0); } @@ -535,7 +535,7 @@ unsigned int MeshImporter::get_loose_edge_count(COLLADAFW::Mesh *mesh) COLLADAFW::MeshPrimitiveArray &prim_arr = mesh->getMeshPrimitives(); int loose_edge_count = 0; - // collect edge_count and face_count from all parts + /* collect edge_count and face_count from all parts */ for (int i = 0; i < prim_arr.getCount(); i++) { COLLADAFW::MeshPrimitive *mp = prim_arr[i]; int type = mp->getPrimitiveType(); @@ -552,13 +552,13 @@ unsigned int MeshImporter::get_loose_edge_count(COLLADAFW::Mesh *mesh) return loose_edge_count; } -// ================================================================= -// This function is copied from source/blender/editors/mesh/mesh_data.c -// -// TODO: (As discussed with sergey-) : -// Maybe move this function to blenderkernel/intern/mesh.c -// and add definition to BKE_mesh.c -// ================================================================= +/* ================================================================= + * This function is copied from source/blender/editors/mesh/mesh_data.c + * + * TODO: (As discussed with sergey-) : + * Maybe move this function to blenderkernel/intern/mesh.c + * and add definition to BKE_mesh.c + * ================================================================= */ void MeshImporter::mesh_add_edges(Mesh *mesh, int len) { CustomData edata; @@ -592,12 +592,12 @@ void MeshImporter::mesh_add_edges(Mesh *mesh, int len) mesh->totedge = totedge; } -// ================================================================= -// Read all loose edges. -// Important: This function assumes that all edges from existing -// faces have already been generated and added to me->medge -// So this function MUST be called after read_faces() (see below) -// ================================================================= +/* ================================================================= + * Read all loose edges. + * Important: This function assumes that all edges from existing + * faces have already been generated and added to me->medge + * So this function MUST be called after read_faces() (see below) + * ================================================================= */ void MeshImporter::read_lines(COLLADAFW::Mesh *mesh, Mesh *me) { unsigned int loose_edge_count = get_loose_edge_count(mesh); @@ -631,13 +631,13 @@ void MeshImporter::read_lines(COLLADAFW::Mesh *mesh, Mesh *me) } } -// ======================================================================= -// Read all faces from TRIANGLES, TRIANGLE_FANS, POLYLIST, POLYGON -// Important: This function MUST be called before read_lines() -// Otherwise we will loose all edges from faces (see read_lines() above) -// -// TODO: import uv set names -// ======================================================================== +/* ======================================================================= + * Read all faces from TRIANGLES, TRIANGLE_FANS, POLYLIST, POLYGON + * Important: This function MUST be called before read_lines() + * Otherwise we will loose all edges from faces (see read_lines() above) + * + * TODO: import uv set names + * ======================================================================== */ void MeshImporter::read_polys(COLLADAFW::Mesh *collada_mesh, Mesh *me) { unsigned int i; @@ -660,7 +660,7 @@ void MeshImporter::read_polys(COLLADAFW::Mesh *collada_mesh, Mesh *me) COLLADAFW::MeshPrimitive *mp = prim_arr[i]; - // faces + /* faces */ size_t prim_totpoly = mp->getFaceCount(); unsigned int *position_indices = mp->getPositionIndices().getData(); unsigned int *normal_indices = mp->getNormalIndices().getData(); @@ -670,28 +670,28 @@ void MeshImporter::read_polys(COLLADAFW::Mesh *collada_mesh, Mesh *me) int collada_meshtype = mp->getPrimitiveType(); - // since we cannot set mpoly->mat_nr here, we store a portion of me->mpoly in Primitive + /* since we cannot set mpoly->mat_nr here, we store a portion of me->mpoly in Primitive */ Primitive prim = {mpoly, 0}; - // If MeshPrimitive is TRIANGLE_FANS we split it into triangles - // The first trifan vertex will be the first vertex in every triangle - // XXX The proper function of TRIANGLE_FANS is not tested!!! - // XXX In particular the handling of the normal_indices looks very wrong to me + /* If MeshPrimitive is TRIANGLE_FANS we split it into triangles + * The first trifan vertex will be the first vertex in every triangle + * XXX The proper function of TRIANGLE_FANS is not tested!!! + * XXX In particular the handling of the normal_indices looks very wrong to me */ if (collada_meshtype == COLLADAFW::MeshPrimitive::TRIANGLE_FANS) { unsigned int grouped_vertex_count = mp->getGroupedVertexElementsCount(); for (unsigned int group_index = 0; group_index < grouped_vertex_count; group_index++) { - unsigned int first_vertex = position_indices[0]; // Store first trifan vertex - unsigned int first_normal = normal_indices[0]; // Store first trifan vertex normal + unsigned int first_vertex = position_indices[0]; /* Store first trifan vertex */ + unsigned int first_normal = normal_indices[0]; /* Store first trifan vertex normal */ unsigned int vertex_count = mp->getGroupedVerticesVertexCount(group_index); for (unsigned int vertex_index = 0; vertex_index < vertex_count - 2; vertex_index++) { - // For each triangle store indices of its 3 vertices + /* For each triangle store indices of its 3 vertices */ unsigned int triangle_vertex_indices[3] = { first_vertex, position_indices[1], position_indices[2]}; set_poly_indices(mpoly, mloop, loop_index, triangle_vertex_indices, 3); - if (mp_has_normals) { // vertex normals, same implementation as for the triangles - // the same for vertces normals + if (mp_has_normals) { /* vertex normals, same implementation as for the triangles */ + /* the same for vertces normals */ unsigned int vertex_normal_indices[3] = { first_normal, normal_indices[1], normal_indices[2]}; if (!is_flat_face(vertex_normal_indices, nor, 3)) { @@ -706,7 +706,7 @@ void MeshImporter::read_polys(COLLADAFW::Mesh *collada_mesh, Mesh *me) prim.totpoly++; } - // Moving cursor to the next triangle fan. + /* Moving cursor to the next triangle fan. */ if (mp_has_normals) { normal_indices += 2; } @@ -727,10 +727,10 @@ void MeshImporter::read_polys(COLLADAFW::Mesh *collada_mesh, Mesh *me) int invalid_loop_holes = 0; for (unsigned int j = 0; j < prim_totpoly; j++) { - // Vertices in polygon: + /* Vertices in polygon: */ int vcount = get_vertex_count(mpvc, j); if (vcount < 0) { - continue; // TODO: add support for holes + continue; /* TODO: add support for holes */ } bool broken_loop = set_poly_indices(mpoly, mloop, loop_index, position_indices, vcount); @@ -740,7 +740,7 @@ void MeshImporter::read_polys(COLLADAFW::Mesh *collada_mesh, Mesh *me) for (unsigned int uvset_index = 0; uvset_index < index_list_array_uvcoord.getCount(); uvset_index++) { - // get mtface by face index and uv set index + /* get mtface by face index and uv set index */ COLLADAFW::IndexList &index_list = *index_list_array_uvcoord[uvset_index]; MLoopUV *mloopuv = (MLoopUV *)CustomData_get_layer_named( &me->ldata, CD_MLOOPUV, index_list.getName().c_str()); @@ -808,7 +808,7 @@ void MeshImporter::read_polys(COLLADAFW::Mesh *collada_mesh, Mesh *me) } else if (collada_meshtype == COLLADAFW::MeshPrimitive::LINES) { - continue; // read the lines later after all the rest is done + continue; /* read the lines later after all the rest is done */ } if (mp_has_faces) { @@ -915,21 +915,21 @@ std::string *MeshImporter::get_geometry_name(const std::string &mesh_name) static bool bc_has_same_material_configuration(Object *ob1, Object *ob2) { if (ob1->totcol != ob2->totcol) { - return false; // not same number of materials + return false; /* not same number of materials */ } if (ob1->totcol == 0) { - return false; // no material at all + return false; /* no material at all */ } for (int index = 0; index < ob1->totcol; index++) { if (ob1->matbits[index] != ob2->matbits[index]) { - return false; // shouldn't happen + return false; /* shouldn't happen */ } if (ob1->matbits[index] == 0) { - return false; // shouldn't happen + return false; /* shouldn't happen */ } if (ob1->mat[index] != ob2->mat[index]) { - return false; // different material assignment + return false; /* different material assignment */ } } return true; @@ -1055,28 +1055,28 @@ void MeshImporter::assign_material_to_geom( { const COLLADAFW::UniqueId &ma_uid = cmaterial.getReferencedMaterial(); - // do we know this material? + /* do we know this material? */ if (uid_material_map.find(ma_uid) == uid_material_map.end()) { fprintf(stderr, "Cannot find material by UID.\n"); return; } - // first time we get geom_uid, ma_uid pair. Save for later check. + /* first time we get geom_uid, ma_uid pair. Save for later check. */ materials_mapped_to_geom.insert( std::pair<COLLADAFW::UniqueId, COLLADAFW::UniqueId>(*geom_uid, ma_uid)); Material *ma = uid_material_map[ma_uid]; - // Attention! This temporarily assigns material to object on purpose! - // See note above. + /* Attention! This temporarily assigns material to object on purpose! + * See note above. */ ob->actcol = 0; BKE_object_material_assign(m_bmain, ob, ma, mat_index + 1, BKE_MAT_ASSIGN_OBJECT); MaterialIdPrimitiveArrayMap &mat_prim_map = geom_uid_mat_mapping_map[*geom_uid]; COLLADAFW::MaterialId mat_id = cmaterial.getMaterialId(); - // assign material indices to mesh faces + /* assign material indices to mesh faces */ if (mat_prim_map.find(mat_id) != mat_prim_map.end()) { std::vector<Primitive> &prims = mat_prim_map[mat_id]; @@ -1102,7 +1102,7 @@ Object *MeshImporter::create_mesh_object( { const COLLADAFW::UniqueId *geom_uid = &geom->getInstanciatedObjectId(); - // check if node instantiates controller or geometry + /* check if node instantiates controller or geometry */ if (isController) { geom_uid = armature_importer->get_geometry_uid(*geom_uid); @@ -1115,8 +1115,8 @@ Object *MeshImporter::create_mesh_object( else { if (uid_mesh_map.find(*geom_uid) == uid_mesh_map.end()) { - // this could happen if a mesh was not created - // (e.g. if it contains unsupported geometry) + /* this could happen if a mesh was not created + * (e.g. if it contains unsupported geometry) */ fprintf(stderr, "Couldn't find a mesh by UID.\n"); return NULL; } @@ -1125,19 +1125,19 @@ Object *MeshImporter::create_mesh_object( return NULL; } - // name Object + /* name Object */ const std::string &id = node->getName().empty() ? node->getOriginalId() : node->getName(); const char *name = (id.length()) ? id.c_str() : NULL; - // add object + /* add object */ Object *ob = bc_add_object(m_bmain, scene, view_layer, OB_MESH, name); - bc_set_mark(ob); // used later for material assignment optimization + bc_set_mark(ob); /* used later for material assignment optimization */ - // store object pointer for ArmatureImporter + /* store object pointer for ArmatureImporter */ uid_object_map[*geom_uid] = ob; imported_objects.push_back(ob); - // replace ob->data freeing the old one + /* replace ob->data freeing the old one */ Mesh *old_mesh = (Mesh *)ob->data; Mesh *new_mesh = uid_mesh_map[*geom_uid]; @@ -1151,7 +1151,7 @@ Object *MeshImporter::create_mesh_object( COLLADAFW::MaterialBindingArray &mat_array = geom->getMaterialBindings(); - // loop through geom's materials + /* loop through geom's materials */ for (unsigned int i = 0; i < mat_array.getCount(); i++) { if (mat_array[i].getReferencedMaterial().isValid()) { @@ -1162,18 +1162,18 @@ Object *MeshImporter::create_mesh_object( } } - // clean up the mesh + /* clean up the mesh */ BKE_mesh_validate((Mesh *)ob->data, false, false); return ob; } -// create a mesh storing a pointer in a map so it can be retrieved later by geometry UID +/* create a mesh storing a pointer in a map so it can be retrieved later by geometry UID */ bool MeshImporter::write_geometry(const COLLADAFW::Geometry *geom) { if (geom->getType() != COLLADAFW::Geometry::GEO_TYPE_MESH) { - // TODO: report warning + /* TODO: report warning */ fprintf(stderr, "Mesh type %s is not supported\n", bc_geomTypeToStr(geom->getType())); return true; } @@ -1188,18 +1188,18 @@ bool MeshImporter::write_geometry(const COLLADAFW::Geometry *geom) const std::string &str_geom_id = mesh->getName().empty() ? mesh->getOriginalId() : mesh->getName(); Mesh *me = BKE_mesh_add(m_bmain, (char *)str_geom_id.c_str()); - id_us_min(&me->id); // is already 1 here, but will be set later in BKE_mesh_assign_object + id_us_min(&me->id); /* is already 1 here, but will be set later in BKE_mesh_assign_object */ - // store the Mesh pointer to link it later with an Object - // mesh_geom_map needed to map mesh to its geometry name (for shape key naming) + /* store the Mesh pointer to link it later with an Object + * mesh_geom_map needed to map mesh to its geometry name (for shape key naming) */ this->uid_mesh_map[mesh->getUniqueId()] = me; this->mesh_geom_map[std::string(me->id.name)] = str_geom_id; read_vertices(mesh, me); read_polys(mesh, me); BKE_mesh_calc_edges(me, false, false); - // read_lines() must be called after the face edges have been generated. - // Otherwise the loose edges will be silently deleted again. + /* read_lines() must be called after the face edges have been generated. + * Otherwise the loose edges will be silently deleted again. */ read_lines(mesh, me); return true; diff --git a/source/blender/io/collada/SkinInfo.h b/source/blender/io/collada/SkinInfo.h index 3b94e403b6d..7ce66b22a5f 100644 --- a/source/blender/io/collada/SkinInfo.h +++ b/source/blender/io/collada/SkinInfo.h @@ -35,28 +35,28 @@ #include "TransformReader.h" #include "collada_internal.h" -// This is used to store data passed in write_controller_data. -// Arrays from COLLADAFW::SkinControllerData lose ownership, so do this class members -// so that arrays don't get freed until we free them explicitly. +/* This is used to store data passed in write_controller_data. + * Arrays from COLLADAFW::SkinControllerData lose ownership, so do this class members + * so that arrays don't get freed until we free them explicitly. */ class SkinInfo { private: - // to build armature bones from inverse bind matrices + /* to build armature bones from inverse bind matrices */ struct JointData { - float inv_bind_mat[4][4]; // joint inverse bind matrix - COLLADAFW::UniqueId joint_uid; // joint node UID - // Object *ob_arm; // armature object + float inv_bind_mat[4][4]; /* joint inverse bind matrix */ + COLLADAFW::UniqueId joint_uid; /* joint node UID */ + // Object *ob_arm; /* armature object */ }; float bind_shape_matrix[4][4]; - // data from COLLADAFW::SkinControllerData, each array should be freed + /* data from COLLADAFW::SkinControllerData, each array should be freed */ COLLADAFW::UIntValuesArray joints_per_vertex; COLLADAFW::UIntValuesArray weight_indices; COLLADAFW::IntValuesArray joint_indices; - // COLLADAFW::FloatOrDoubleArray weights; + /* COLLADAFW::FloatOrDoubleArray weights; */ std::vector<float> weights; - std::vector<JointData> joint_data; // index to this vector is joint index + std::vector<JointData> joint_data; /* index to this vector is joint index */ UnitConverter *unit_converter; @@ -69,10 +69,10 @@ class SkinInfo { SkinInfo(const SkinInfo &skin); SkinInfo(UnitConverter *conv); - // nobody owns the data after this, so it should be freed manually with releaseMemory + /* nobody owns the data after this, so it should be freed manually with releaseMemory */ template<typename T> void transfer_array_data(T &src, T &dest); - // when src is const we cannot src.yieldOwnerShip, this is used by copy constructor + /* when src is const we cannot src.yieldOwnerShip, this is used by copy constructor */ void transfer_int_array_data_const(const COLLADAFW::IntValuesArray &src, COLLADAFW::IntValuesArray &dest); @@ -83,14 +83,14 @@ class SkinInfo { void free(); - // using inverse bind matrices to construct armature - // it is safe to invert them to get the original matrices - // because if they are inverse matrices, they can be inverted + /* using inverse bind matrices to construct armature + * it is safe to invert them to get the original matrices + * because if they are inverse matrices, they can be inverted */ void add_joint(const COLLADABU::Math::Matrix4 &matrix); void set_controller(const COLLADAFW::SkinController *co); - // called from write_controller + /* called from write_controller */ Object *create_armature(Main *bmain, Scene *scene, ViewLayer *view_layer); Object *set_armature(Object *ob_arm); @@ -101,11 +101,11 @@ class SkinInfo { const COLLADAFW::UniqueId &get_controller_uid(); - // check if this skin controller references a joint or any descendant of it - // - // some nodes may not be referenced by SkinController, - // in this case to determine if the node belongs to this armature, - // we need to search down the tree + /* check if this skin controller references a joint or any descendant of it + * + * some nodes may not be referenced by SkinController, + * in this case to determine if the node belongs to this armature, + * we need to search down the tree */ bool uses_joint_or_descendant(COLLADAFW::Node *node); void link_armature(bContext *C, diff --git a/source/blender/io/collada/TransformReader.cpp b/source/blender/io/collada/TransformReader.cpp index 87b8763fb6a..393393be65b 100644 --- a/source/blender/io/collada/TransformReader.cpp +++ b/source/blender/io/collada/TransformReader.cpp @@ -54,9 +54,9 @@ void TransformReader::get_node_mat(float mat[4][4], switch (type) { case COLLADAFW::Transformation::MATRIX: - // When matrix AND Trans/Rot/Scale are defined for a node, - // then this is considered as redundant information. - // So if we find a Matrix we use that and return. + /* When matrix AND Trans/Rot/Scale are defined for a node, + * then this is considered as redundant information. + * So if we find a Matrix we use that and return. */ dae_matrix_to_mat4(tm, mat); if (parent_mat) { mul_m4_m4m4(mat, parent_mat, mat); @@ -83,10 +83,10 @@ void TransformReader::get_node_mat(float mat[4][4], mul_m4_m4m4(mat, copy, cur); if (animation_map) { - // AnimationList that drives this Transformation + /* AnimationList that drives this Transformation */ const COLLADAFW::UniqueId &anim_list_id = tm->getAnimationList(); - // store this so later we can link animation data with ob + /* store this so later we can link animation data with ob */ Animation anim = {ob, node, tm}; (*animation_map)[anim_list_id] = anim; } diff --git a/source/blender/io/collada/TransformReader.h b/source/blender/io/collada/TransformReader.h index f8a73ce3912..9b87f56699e 100644 --- a/source/blender/io/collada/TransformReader.h +++ b/source/blender/io/collada/TransformReader.h @@ -44,7 +44,7 @@ class TransformReader { struct Animation { Object *ob; COLLADAFW::Node *node; - COLLADAFW::Transformation *tm; // which transform is animated by an AnimationList->id + COLLADAFW::Transformation *tm; /* which transform is animated by an AnimationList->id */ }; TransformReader(UnitConverter *conv); diff --git a/source/blender/io/collada/collada_internal.cpp b/source/blender/io/collada/collada_internal.cpp index 66810685979..091bd2cd7c2 100644 --- a/source/blender/io/collada/collada_internal.cpp +++ b/source/blender/io/collada/collada_internal.cpp @@ -71,12 +71,12 @@ void UnitConverter::convertVector3(COLLADABU::Math::Vector3 &vec, float *v) v[2] = vec.z; } -// TODO need also for angle conversion, time conversion... +/* TODO need also for angle conversion, time conversion... */ void UnitConverter::dae_matrix_to_mat4_(float out[4][4], const COLLADABU::Math::Matrix4 &in) { - // in DAE, matrices use columns vectors, (see comments in COLLADABUMathMatrix4.h) - // so here, to make a blender matrix, we swap columns and rows + /* in DAE, matrices use columns vectors, (see comments in COLLADABUMathMatrix4.h) + * so here, to make a blender matrix, we swap columns and rows. */ for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { out[i][j] = in[j][i]; @@ -138,7 +138,7 @@ void UnitConverter::calculate_scale(Scene &sce) switch (type) { case USER_UNIT_NONE: - bl_scale = 1.0; // map 1 Blender unit to 1 Meter + bl_scale = 1.0; /* map 1 Blender unit to 1 Meter. */ break; case USER_UNIT_METRIC: @@ -147,8 +147,8 @@ void UnitConverter::calculate_scale(Scene &sce) default: bl_scale = RNA_property_float_get(&unit_settings, scale_ptr); - // it looks like the conversion to Imperial is done implicitly. - // So nothing to do here. + /* It looks like the conversion to Imperial is done implicitly. + * So nothing to do here. */ break; } @@ -231,9 +231,9 @@ std::string translate_id(const std::string &id) for (unsigned int i = 1; i < id_translated.size(); i++) { id_translated[i] = translate_name_map[(unsigned int)id_translated[i]]; } - // It's so much workload now, the if () should speed up things. + /* It's so much workload now, the if () should speed up things. */ if (id_translated != id) { - // Search duplicates + /* Search duplicates. */ map_string_list::iterator iter = global_id_map.find(id_translated); if (iter != global_id_map.end()) { unsigned int i = 0; diff --git a/source/blender/io/collada/collada_internal.h b/source/blender/io/collada/collada_internal.h index de4e1d7e0d4..1d2ed11bfe6 100644 --- a/source/blender/io/collada/collada_internal.h +++ b/source/blender/io/collada/collada_internal.h @@ -51,7 +51,7 @@ class UnitConverter { Imperial, }; - // Initialize with Z_UP, since Blender uses right-handed, z-up + /* Initialize with Z_UP, since Blender uses right-handed, z-up */ UnitConverter(); void read_asset(const COLLADAFW::FileInfo *asset); @@ -62,7 +62,7 @@ class UnitConverter { float getLinearMeter(void); - // TODO need also for angle conversion, time conversion... + /* TODO need also for angle conversion, time conversion... */ static void dae_matrix_to_mat4_(float out[4][4], const COLLADABU::Math::Matrix4 &in); static void mat4_to_dae(float out[4][4], float in[4][4]); |