From 0b2d1badecc48b5cbff5ec088b29c6e9acc5e1d0 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 8 Sep 2019 00:12:26 +1000 Subject: Cleanup: use post increment/decrement When the result isn't used, prefer post increment/decrement (already used nearly everywhere in Blender). --- source/blender/collada/AnimationExporter.cpp | 8 ++++---- source/blender/collada/BCAnimationCurve.cpp | 4 ++-- source/blender/collada/BCAnimationSampler.cpp | 28 +++++++++++++-------------- source/blender/collada/BCAnimationSampler.h | 4 ++-- source/blender/collada/BCSampleData.cpp | 4 ++-- source/blender/collada/ControllerExporter.cpp | 6 +++--- source/blender/collada/DocumentImporter.cpp | 12 ++++++------ source/blender/collada/SceneExporter.cpp | 2 +- source/blender/collada/collada_utils.cpp | 4 ++-- 9 files changed, 36 insertions(+), 36 deletions(-) (limited to 'source/blender/collada') diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp index a15c215d2e2..c2ba397131c 100644 --- a/source/blender/collada/AnimationExporter.cpp +++ b/source/blender/collada/AnimationExporter.cpp @@ -100,7 +100,7 @@ bool AnimationExporter::exportAnimations() openLibrary(); BCObjectSet::iterator it; - for (it = animated_subset.begin(); it != animated_subset.end(); ++it) { + for (it = animated_subset.begin(); it != animated_subset.end(); it++) { Object *ob = *it; exportAnimation(ob, animation_sampler); } @@ -183,7 +183,7 @@ void AnimationExporter::export_curve_animation_set(Object *ob, bool keep_flat_curves = this->export_settings.get_keep_flat_curves(); BCAnimationCurveMap::iterator it; - for (it = curves->begin(); it != curves->end(); ++it) { + for (it = curves->begin(); it != curves->end(); it++) { BCAnimationCurve &curve = *it->second; std::string channel_type = curve.get_channel_type(); if (channel_type == "rotation_quaternion") { @@ -310,7 +310,7 @@ BCAnimationCurve *AnimationExporter::get_modified_export_curve(Object *ob, } BCValueMap::const_iterator vit; - for (vit = lens_values.begin(); vit != lens_values.end(); ++vit) { + for (vit = lens_values.begin(); vit != lens_values.end(); vit++) { int frame = vit->first; float lens_value = vit->second; @@ -594,7 +594,7 @@ std::string AnimationExporter::collada_tangent_from_curve( const FCurve *fcu = curve.get_fcurve(); int tangent = (semantic == COLLADASW::InputSemantic::IN_TANGENT) ? 0 : 2; - for (int i = 0; i < fcu->totvert; ++i) { + for (int i = 0; i < fcu->totvert; i++) { BezTriple &bezt = fcu->bezt[i]; float sampled_time = bezt.vec[tangent][0]; diff --git a/source/blender/collada/BCAnimationCurve.cpp b/source/blender/collada/BCAnimationCurve.cpp index b494c749fe3..bf32ec9148c 100644 --- a/source/blender/collada/BCAnimationCurve.cpp +++ b/source/blender/collada/BCAnimationCurve.cpp @@ -249,7 +249,7 @@ const int BCAnimationCurve::closest_index_below(const float sample_frame) const int lower_index = 0; int upper_index = 0; - for (int fcu_index = 0; fcu_index < fcurve->totvert; ++fcu_index) { + 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]; // inacurate! @@ -537,7 +537,7 @@ bool BCAnimationCurve::is_keyframe(int frame) return false; } - for (int i = 0; i < fcurve->totvert; ++i) { + for (int i = 0; i < fcurve->totvert; i++) { const int cframe = nearbyint(fcurve->bezt[i].vec[1][0]); if (cframe == frame) { return true; diff --git a/source/blender/collada/BCAnimationSampler.cpp b/source/blender/collada/BCAnimationSampler.cpp index 49d87f92fda..d1f59125790 100644 --- a/source/blender/collada/BCAnimationSampler.cpp +++ b/source/blender/collada/BCAnimationSampler.cpp @@ -49,7 +49,7 @@ BCAnimationSampler::BCAnimationSampler(BCExportSettings &export_settings, BCObje : export_settings(export_settings) { BCObjectSet::iterator it; - for (it = object_set.begin(); it != object_set.end(); ++it) { + for (it = object_set.begin(); it != object_set.end(); it++) { Object *ob = *it; add_object(ob); } @@ -58,7 +58,7 @@ BCAnimationSampler::BCAnimationSampler(BCExportSettings &export_settings, BCObje BCAnimationSampler::~BCAnimationSampler() { BCAnimationObjectMap::iterator it; - for (it = objects.begin(); it != objects.end(); ++it) { + for (it = objects.begin(); it != objects.end(); it++) { BCAnimation *animation = it->second; delete animation; } @@ -129,7 +129,7 @@ static void add_keyframes_from(bAction *action, BCFrameSet &frameset) void BCAnimationSampler::check_property_is_animated( BCAnimation &animation, float *ref, float *val, std::string data_path, int length) { - for (int array_index = 0; array_index < length; ++array_index) { + for (int array_index = 0; array_index < length; array_index++) { if (!bc_in_range(ref[length], val[length], 0.00001)) { BCCurveKey key(BC_ANIMATION_TYPE_OBJECT, data_path, array_index); BCAnimationCurveMap::iterator it = animation.curve_map.find(key); @@ -146,7 +146,7 @@ void BCAnimationSampler::update_animation_curves(BCAnimation &animation, int frame) { BCAnimationCurveMap::iterator it; - for (it = animation.curve_map.begin(); it != animation.curve_map.end(); ++it) { + for (it = animation.curve_map.begin(); it != animation.curve_map.end(); it++) { BCAnimationCurve *curve = it->second; if (curve->is_transform_curve()) { curve->add_value_from_matrix(sample, frame); @@ -195,7 +195,7 @@ void BCAnimationSampler::sample_scene(BCExportSettings &export_settings, bool ke int startframe = scene->r.sfra; int endframe = scene->r.efra; - for (int frame_index = startframe; frame_index <= endframe; ++frame_index) { + for (int frame_index = startframe; frame_index <= endframe; frame_index++) { /* Loop over all frames and decide for each frame if sampling is necessary */ bool is_scene_sample_frame = false; bool needs_update = true; @@ -212,7 +212,7 @@ void BCAnimationSampler::sample_scene(BCExportSettings &export_settings, bool ke } BCAnimationObjectMap::iterator obit; - for (obit = objects.begin(); obit != objects.end(); ++obit) { + for (obit = objects.begin(); obit != objects.end(); obit++) { Object *ob = obit->first; BCAnimation *animation = obit->second; BCFrameSet &object_keyframes = animation->frame_set; @@ -268,7 +268,7 @@ void BCAnimationSampler::find_depending_animated(std::set &animated_ob do { found_more = false; std::set::iterator it; - for (it = candidates.begin(); it != candidates.end(); ++it) { + for (it = candidates.begin(); it != candidates.end(); it++) { Object *cob = *it; ListBase *conlist = get_active_constraints(cob); if (is_animated_by_constraint(cob, conlist, animated_objects)) { @@ -353,7 +353,7 @@ void BCAnimationSampler::add_value_set(BCAnimationCurve &curve, const BC_animation_transform_type tm_type = curve.get_transform_type(); BCFrameSampleMap::iterator it; - for (it = samples.begin(); it != samples.end(); ++it) { + for (it = samples.begin(); it != samples.end(); it++) { const int frame_index = nearbyint(it->first); if (animation_type == BC_ANIMATION_EXPORT_SAMPLES || curve.is_keyframe(frame_index)) { @@ -585,7 +585,7 @@ const int BCSampleFrameContainer::get_frames(std::vector &frames) const { frames.clear(); // safety; BCSampleFrameMap::const_iterator it; - for (it = sample_frames.begin(); it != sample_frames.end(); ++it) { + for (it = sample_frames.begin(); it != sample_frames.end(); it++) { frames.push_back(it->first); } return frames.size(); @@ -595,7 +595,7 @@ const int BCSampleFrameContainer::get_frames(Object *ob, BCFrames &frames) const { frames.clear(); // safety; BCSampleFrameMap::const_iterator it; - for (it = sample_frames.begin(); it != sample_frames.end(); ++it) { + for (it = sample_frames.begin(); it != sample_frames.end(); it++) { const BCSampleFrame &frame = it->second; if (frame.has_sample_for(ob)) { frames.push_back(it->first); @@ -608,7 +608,7 @@ const int BCSampleFrameContainer::get_frames(Object *ob, Bone *bone, BCFrames &f { frames.clear(); // safety; BCSampleFrameMap::const_iterator it; - for (it = sample_frames.begin(); it != sample_frames.end(); ++it) { + for (it = sample_frames.begin(); it != sample_frames.end(); it++) { const BCSampleFrame &frame = it->second; if (frame.has_sample_for(ob, bone)) { frames.push_back(it->first); @@ -621,7 +621,7 @@ const int BCSampleFrameContainer::get_samples(Object *ob, BCFrameSampleMap &samp { samples.clear(); // safety; BCSampleFrameMap::const_iterator it; - for (it = sample_frames.begin(); it != sample_frames.end(); ++it) { + for (it = sample_frames.begin(); it != sample_frames.end(); it++) { const BCSampleFrame &frame = it->second; const BCSample *sample = frame.get_sample(ob); if (sample) { @@ -635,7 +635,7 @@ const int BCSampleFrameContainer::get_matrices(Object *ob, BCMatrixSampleMap &sa { samples.clear(); // safety; BCSampleFrameMap::const_iterator it; - for (it = sample_frames.begin(); it != sample_frames.end(); ++it) { + for (it = sample_frames.begin(); it != sample_frames.end(); it++) { const BCSampleFrame &frame = it->second; const BCMatrix *matrix = frame.get_sample_matrix(ob); if (matrix) { @@ -651,7 +651,7 @@ const int BCSampleFrameContainer::get_matrices(Object *ob, { samples.clear(); // safety; BCSampleFrameMap::const_iterator it; - for (it = sample_frames.begin(); it != sample_frames.end(); ++it) { + for (it = sample_frames.begin(); it != sample_frames.end(); it++) { const BCSampleFrame &frame = it->second; const BCMatrix *sample = frame.get_sample_matrix(ob, bone); if (sample) { diff --git a/source/blender/collada/BCAnimationSampler.h b/source/blender/collada/BCAnimationSampler.h index e8d2ab56ae7..3d156134260 100644 --- a/source/blender/collada/BCAnimationSampler.h +++ b/source/blender/collada/BCAnimationSampler.h @@ -47,7 +47,7 @@ class BCAnimation { ~BCAnimation() { BCAnimationCurveMap::iterator it; - for (it = curve_map.begin(); it != curve_map.end(); ++it) { + for (it = curve_map.begin(); it != curve_map.end(); it++) { delete it->second; } @@ -79,7 +79,7 @@ class BCSampleFrame { ~BCSampleFrame() { BCSampleMap::iterator it; - for (it = sampleMap.begin(); it != sampleMap.end(); ++it) { + for (it = sampleMap.begin(); it != sampleMap.end(); it++) { BCSample *sample = it->second; delete sample; } diff --git a/source/blender/collada/BCSampleData.cpp b/source/blender/collada/BCSampleData.cpp index 7e23a2de00f..4ef13621c97 100644 --- a/source/blender/collada/BCSampleData.cpp +++ b/source/blender/collada/BCSampleData.cpp @@ -23,7 +23,7 @@ BCSample::~BCSample() { BCBoneMatrixMap::iterator it; - for (it = bonemats.begin(); it != bonemats.end(); ++it) { + for (it = bonemats.begin(); it != bonemats.end(); it++) { delete it->second; } } @@ -50,7 +50,7 @@ const bool BCSample::get_value(std::string channel_target, const int array_index bname = bname.substr(2); bname = bc_string_before(bname, "\""); BCBoneMatrixMap::const_iterator it; - for (it = bonemats.begin(); it != bonemats.end(); ++it) { + for (it = bonemats.begin(); it != bonemats.end(); it++) { Bone *bone = it->first; if (bname == bone->name) { matrix = it->second; diff --git a/source/blender/collada/ControllerExporter.cpp b/source/blender/collada/ControllerExporter.cpp index bfec387a199..61835f448ee 100644 --- a/source/blender/collada/ControllerExporter.cpp +++ b/source/blender/collada/ControllerExporter.cpp @@ -265,7 +265,7 @@ void ControllerExporter::export_skin_controller(Object *ob, Object *ob_arm) if (sumw > 0.0f) { float invsumw = 1.0f / sumw; vcounts.push_back(jw.size()); - for (std::map::iterator m = jw.begin(); m != jw.end(); ++m) { + for (std::map::iterator m = jw.begin(); m != jw.end(); m++) { joints.push_back((*m).first); weights.push_back(invsumw * (*m).second); } @@ -616,7 +616,7 @@ std::string ControllerExporter::add_weights_source(Mesh *me, source.prepareToAppendValues(); - for (std::list::const_iterator i = weights.begin(); i != weights.end(); ++i) { + for (std::list::const_iterator i = weights.begin(); i != weights.end(); i++) { source.appendValues(*i); } @@ -658,7 +658,7 @@ void ControllerExporter::add_vertex_weights_element(const std::string &weights_s /* write deformer index - weight index pairs */ int weight_index = 0; - for (std::list::const_iterator i = joints.begin(); i != joints.end(); ++i) { + for (std::list::const_iterator i = joints.begin(); i != joints.end(); i++) { weightselem.appendValues(*i, weight_index++); } diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index 98b166716c3..9d838406101 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -333,7 +333,7 @@ std::string DocumentImporter::get_import_version(const COLLADAFW::FileInfo *asse const char AUTORING_TOOL[] = "authoring_tool"; const std::string BLENDER("Blender "); const COLLADAFW::FileInfo::ValuePairPointerArray &valuePairs = asset->getValuePairArray(); - for (size_t i = 0, count = valuePairs.getCount(); i < count; ++i) { + for (size_t i = 0, count = valuePairs.getCount(); i < count; i++) { const COLLADAFW::FileInfo::ValuePair *valuePair = valuePairs[i]; const COLLADAFW::String &key = valuePair->first; const COLLADAFW::String &value = valuePair->second; @@ -567,7 +567,7 @@ std::vector *DocumentImporter::write_node(COLLADAFW::Node *node, root_objects->push_back(ob); } } - ++geom_done; + geom_done++; } while (camera_done < camera.getCount()) { ob = create_camera_object(camera[camera_done], sce); @@ -580,7 +580,7 @@ std::vector *DocumentImporter::write_node(COLLADAFW::Node *node, root_objects->push_back(ob); } } - ++camera_done; + camera_done++; } while (lamp_done < lamp.getCount()) { ob = create_light_object(lamp[lamp_done], sce); @@ -593,7 +593,7 @@ std::vector *DocumentImporter::write_node(COLLADAFW::Node *node, root_objects->push_back(ob); } } - ++lamp_done; + lamp_done++; } while (controller_done < controller.getCount()) { COLLADAFW::InstanceGeometry *geometry = (COLLADAFW::InstanceGeometry *) @@ -608,7 +608,7 @@ std::vector *DocumentImporter::write_node(COLLADAFW::Node *node, root_objects->push_back(ob); } } - ++controller_done; + controller_done++; } /* XXX instance_node is not supported yet */ while (inst_done < inst_node.getCount()) { @@ -635,7 +635,7 @@ std::vector *DocumentImporter::write_node(COLLADAFW::Node *node, } } } - ++inst_done; + inst_done++; read_transform = false; } diff --git a/source/blender/collada/SceneExporter.cpp b/source/blender/collada/SceneExporter.cpp index 01854bef328..24449de0ddd 100644 --- a/source/blender/collada/SceneExporter.cpp +++ b/source/blender/collada/SceneExporter.cpp @@ -88,7 +88,7 @@ void SceneExporter::writeNodeList(std::vector &child_objects, Object * * I really prefer to enforce the export of hidden * elements in an object hierarchy. When the children of * the hidden elements are exported as well. */ - for (int i = 0; i < child_objects.size(); ++i) { + for (int i = 0; i < child_objects.size(); i++) { Object *child = child_objects[i]; writeNode(child); if (bc_is_marked(child)) { diff --git a/source/blender/collada/collada_utils.cpp b/source/blender/collada/collada_utils.cpp index dd5611c4bef..f740fcee664 100644 --- a/source/blender/collada/collada_utils.cpp +++ b/source/blender/collada/collada_utils.cpp @@ -525,7 +525,7 @@ BoneExtensionMap &BoneExtensionManager::getExtensionMap(bArmature *armature) BoneExtensionManager::~BoneExtensionManager() { std::map::iterator map_it; - for (map_it = extended_bone_maps.begin(); map_it != extended_bone_maps.end(); ++map_it) { + for (map_it = extended_bone_maps.begin(); map_it != extended_bone_maps.end(); map_it++) { BoneExtensionMap *extended_bones = map_it->second; for (BoneExtensionMap::iterator ext_it = extended_bones->begin(); ext_it != extended_bones->end(); @@ -916,7 +916,7 @@ bool bc_is_animated(BCMatrixSampleMap &values) BCMatrixSampleMap::iterator it; const BCMatrix *refmat = NULL; - for (it = values.begin(); it != values.end(); ++it) { + for (it = values.begin(); it != values.end(); it++) { const BCMatrix *matrix = it->second; if (refmat == NULL) { -- cgit v1.2.3