From fc3ef2fddd1f5e79f4fa880ce11de916f256e93c Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 26 Feb 2020 14:52:17 -0500 Subject: [PATCH] SpecBase: Flatten loop within flattenDependenciesBlend() We can use insert() with make_move_iterator() to perform the same behavior, minus unnecessary copies. While we're at it, we can collapse the code within the Area case, since it's the exact same as the Mesh code. --- DataSpec/SpecBase.cpp | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/DataSpec/SpecBase.cpp b/DataSpec/SpecBase.cpp index 675daa1fd..99c262349 100644 --- a/DataSpec/SpecBase.cpp +++ b/DataSpec/SpecBase.cpp @@ -283,11 +283,11 @@ void SpecBase::flattenDependenciesBlend(const hecl::ProjectPath& in, std::vector if (!conn.openBlend(in)) return; switch (conn.getBlendType()) { - case hecl::blender::BlendType::Mesh: { + case hecl::blender::BlendType::Mesh: + case hecl::blender::BlendType::Area: { hecl::blender::DataStream ds = conn.beginData(); std::vector texs = ds.getTextures(); - for (const hecl::ProjectPath& tex : texs) - pathsOut.push_back(tex); + pathsOut.insert(pathsOut.end(), std::make_move_iterator(texs.begin()), std::make_move_iterator(texs.end())); break; } case hecl::blender::BlendType::Actor: { @@ -379,13 +379,6 @@ void SpecBase::flattenDependenciesBlend(const hecl::ProjectPath& in, std::vector pathsOut.push_back(asGlob); return; } - case hecl::blender::BlendType::Area: { - hecl::blender::DataStream ds = conn.beginData(); - std::vector texs = ds.getTextures(); - for (const hecl::ProjectPath& tex : texs) - pathsOut.push_back(tex); - break; - } default: break; }