MCPcopy Create free account
hub / github.com/BoomingTech/Piccolo / onFileContentItemClicked

Method onFileContentItemClicked

engine/source/editor/source/editor_ui.cpp:827–849  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

825 }
826
827 void EditorUI::onFileContentItemClicked(EditorFileNode* node)
828 {
829 if (node->m_file_type != "object")
830 return;
831
832 std::shared_ptr<Level> level = g_runtime_global_context.m_world_manager->getCurrentActiveLevel().lock();
833 if (level == nullptr)
834 return;
835
836 const unsigned int new_object_index = ++m_new_object_index_map[node->m_file_name];
837
838 ObjectInstanceRes new_object_instance_res;
839 new_object_instance_res.m_name =
840 "New_" + Path::getFilePureName(node->m_file_name) + "_" + std::to_string(new_object_index);
841 new_object_instance_res.m_definition =
842 g_runtime_global_context.m_asset_manager->getFullPath(node->m_file_path).generic_string();
843
844 size_t new_gobject_id = level->createObject(new_object_instance_res);
845 if (new_gobject_id != k_invalid_gobject_id)
846 {
847 g_editor_global_context.m_scene_manager->onGObjectSelected(new_gobject_id);
848 }
849 }
850
851 inline void windowContentScaleUpdate(float scale)
852 {

Callers

nothing calls this directly

Calls 6

getCurrentActiveLevelMethod · 0.80
getFullPathMethod · 0.80
createObjectMethod · 0.80
onGObjectSelectedMethod · 0.80
to_stringFunction · 0.50
lockMethod · 0.45

Tested by

no test coverage detected