File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -142,6 +142,24 @@ void triangulateMeshIndices(
142142 }
143143}
144144
145+ DataPtr newMatchingData ( const Data *source )
146+ {
147+ return dispatch ( source,
148+ []( const auto *typedSource ) -> DataPtr
149+ {
150+ using DataType = typename std::remove_const_t < std::remove_pointer_t < decltype ( typedSource ) > >;
151+ typename DataType::Ptr result = new DataType ();
152+
153+ if constexpr ( TypeTraits::IsGeometricTypedData< DataType >::value )
154+ {
155+ result->setInterpretation ( typedSource->getInterpretation () );
156+ }
157+
158+ return result;
159+ }
160+ );
161+ }
162+
145163
146164// / A functor for use with despatchTypedData, which copies elements from another vector, as specified by an array of indices into that data
147165struct TriangleDataRemap
@@ -243,7 +261,7 @@ struct TriangulateFn
243261 }
244262
245263 const Data *inputData = it->second .indices ? it->second .indices .get () : it->second .data .get ();
246- DataPtr result = inputData-> copy ( );
264+ DataPtr result = newMatchingData ( inputData );
247265 remap->m_other = inputData;
248266
249267 // \todo - using this to reindex data is a waste of time and memory. If there are no indices,
You can’t perform that action at this time.
0 commit comments