MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / edit

Method edit

modules/gridmap/editor/grid_map_editor_plugin.cpp:1019–1062  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1017}
1018
1019void GridMapEditor::edit(GridMap *p_gridmap) {
1020 if (node) {
1021 node->disconnect(SNAME("cell_size_changed"), callable_mp(this, &GridMapEditor::_draw_grids));
1022 node->disconnect(CoreStringName(changed), callable_mp(this, &GridMapEditor::_update_mesh_library));
1023 if (mesh_library.is_valid()) {
1024 mesh_library->disconnect_changed(callable_mp(this, &GridMapEditor::update_palette));
1025 mesh_library = Ref<MeshLibrary>();
1026 }
1027 }
1028
1029 node = p_gridmap;
1030
1031 input_action = INPUT_NONE;
1032 selection.active = false;
1033 _update_selection_transform();
1034 _update_paste_indicator();
1035
1036 spatial_editor = Object::cast_to<Node3DEditorPlugin>(EditorNode::get_singleton()->get_editor_main_screen()->get_selected_plugin());
1037
1038 if (!node) {
1039 set_process(false);
1040 for (int i = 0; i < 3; i++) {
1041 RenderingServer::get_singleton()->instance_set_visible(grid_instance[i], false);
1042 }
1043
1044 if (cursor_instance.is_valid()) {
1045 RenderingServer::get_singleton()->instance_set_visible(cursor_instance, false);
1046 }
1047
1048 return;
1049 }
1050
1051 update_palette();
1052 _update_cursor_instance();
1053
1054 set_process(true);
1055
1056 _draw_grids(node->get_cell_size());
1057 update_grid();
1058
1059 node->connect(SNAME("cell_size_changed"), callable_mp(this, &GridMapEditor::_draw_grids));
1060 node->connect(CoreStringName(changed), callable_mp(this, &GridMapEditor::_update_mesh_library));
1061 _update_mesh_library();
1062}
1063
1064void GridMapEditor::update_grid() {
1065 grid_xform.origin.x -= 1; /// @todo Force update in hackish way.

Callers 1

Calls 8

disconnect_changedMethod · 0.80
get_selected_pluginMethod · 0.80
instance_set_visibleMethod · 0.80
disconnectMethod · 0.65
connectMethod · 0.65
is_validMethod · 0.45
get_cell_sizeMethod · 0.45

Tested by

no test coverage detected