MCPcopy Create free account
hub / github.com/MeshInspector/MeshLib / pythonModifySelectedMesh

Function pythonModifySelectedMesh

source/mrviewerpy/MRPythonScene.cpp:170–182  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

168}
169
170void pythonModifySelectedMesh( MR::Mesh mesh )
171{
172 MR::CommandLoop::runCommandFromGUIThread( [&]
173 {
174 auto selected = MR::getAllObjectsInTree<MR::ObjectMesh>( &MR::SceneRoot::get(), MR::ObjectSelectivityType::Selected );
175 if ( selected.size() != 1 )
176 throw std::runtime_error( fmt::format( "Exactly one mesh must be selected, but have {}.", selected.size() ) );
177 if ( !selected[0] )
178 throw std::runtime_error( "Internal error (the object is null?)." );
179 selected[0]->setMesh( std::make_shared<MR::Mesh>( std::move( mesh ) ) );
180 selected[0]->setDirtyFlags( MR::DIRTY_ALL );
181 } );
182}
183
184template <typename T, auto M>
185auto pythonGetSelectedBitset()

Callers

nothing calls this directly

Calls 4

setMeshMethod · 0.80
getFunction · 0.50
sizeMethod · 0.45
setDirtyFlagsMethod · 0.45

Tested by

no test coverage detected