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

Method drop_data_fw

editor/export/project_export.cpp:847–921  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

845}
846
847void ProjectExportDialog::drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) {
848 if (p_from == presets) {
849 Dictionary d = p_data;
850 int from_pos = d["preset"];
851
852 int to_pos = -1;
853
854 int pos = -1;
855 bool end = true;
856 if (p_point == Vector2(Math::INF, Math::INF)) {
857 if (presets->is_anything_selected()) {
858 pos = presets->get_selected_items()[0];
859 }
860 } else {
861 pos = presets->get_item_at_position(p_point, true);
862 end = presets->is_pos_at_end_of_items(p_point);
863 }
864
865 if (pos >= 0) {
866 to_pos = pos;
867 }
868
869 if (to_pos == -1 && !end) {
870 return;
871 }
872
873 if (to_pos == from_pos) {
874 return;
875 } else if (to_pos > from_pos) {
876 to_pos--;
877 }
878
879 Ref<EditorExportPreset> preset = EditorExport::get_singleton()->get_export_preset(from_pos);
880 EditorExport::get_singleton()->remove_export_preset(from_pos);
881 EditorExport::get_singleton()->add_export_preset(preset, to_pos);
882
883 _update_presets();
884 if (to_pos >= 0) {
885 _edit_preset(to_pos);
886 } else {
887 _edit_preset(presets->get_item_count() - 1);
888 }
889 } else if (p_from == patches) {
890 Dictionary d = p_data;
891 int from_pos = d["patch"];
892
893 TreeItem *item = (p_point == Vector2(Math::INF, Math::INF)) ? patches->get_selected() : patches->get_item_at_position(p_point);
894 if (!item) {
895 return;
896 }
897
898 int to_pos = item->get_metadata(0);
899
900 int pos = -1;
901 if (p_point == Vector2(Math::INF, Math::INF)) {
902 pos = patches->get_drop_section_at_position(patches->get_item_rect(item).position);
903 } else {
904 pos = patches->get_drop_section_at_position(p_point);

Callers

nothing calls this directly

Calls 15

get_selected_itemsMethod · 0.80
remove_export_presetMethod · 0.80
add_export_presetMethod · 0.80
get_metadataMethod · 0.80
get_patchMethod · 0.80
remove_patchMethod · 0.80
add_patchMethod · 0.80
Vector2Function · 0.50
is_anything_selectedMethod · 0.45
get_item_at_positionMethod · 0.45

Tested by

no test coverage detected