feat: UI elements for key combinations

This commit is contained in:
Sara Gerretsen 2025-12-16 15:46:21 +01:00
parent ab300878cf
commit c668771696
15 changed files with 415 additions and 33 deletions

View file

@ -0,0 +1,94 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="16.933332mm"
height="16.933332mm"
viewBox="0 0 16.933332 16.933332"
version="1.1"
id="svg1"
inkscape:version="1.4.2 (ebf0e940d0, 2025-05-08)"
sodipodi:docname="kenney_icons.svg"
inkscape:export-batch-path="../../project/assets/icons"
inkscape:export-batch-name=""
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview1"
pagecolor="#000000"
bordercolor="#484848"
borderopacity="1"
inkscape:showpageshadow="2"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#2b2b2b"
inkscape:document-units="mm"
inkscape:zoom="3.9054994"
inkscape:cx="227.37169"
inkscape:cy="45.320708"
inkscape:current-layer="layer1">
<inkscape:page
x="0"
y="0"
width="16.933332"
height="16.933332"
id="page1"
margin="0"
bleed="0"
inkscape:label="save" />
<inkscape:page
x="26.933332"
y="0"
width="16.933332"
height="16.933332"
id="page2"
margin="0"
bleed="0"
inkscape:label="delete" />
<inkscape:page
x="53.866665"
y="0"
width="16.933332"
height="16.933332"
id="page3"
margin="0"
bleed="0"
inkscape:label="undo" />
<inkscape:page
x="80.799995"
y="0"
width="16.933332"
height="16.933332"
id="page4"
margin="0"
bleed="0"
inkscape:label="redo" />
</sodipodi:namedview>
<defs
id="defs1" />
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<path
d="M 11.972139,3.2084645 H 4.9611927 V 6.7139381 H 11.972139 V 3.2084645 M 9.3430387,5.8375655 V 4.0848371 H 11.095767 V 5.8375655 H 9.3430387 M 15.477596,4.961193 V 15.477596 H 1.4557358 V 1.4557361 H 11.972139 L 15.477596,4.961193 M 3.2084643,13.724868 H 13.724868 V 8.4666665 H 3.2084643 v 5.2582015"
style="fill:#ffffff;stroke:none;stroke-width:0.264582"
id="path1"
sodipodi:nodetypes="ccccccccccccccccccccc" />
<path
d="M 30.406741,3.7096566 C 30.512731,3.4976918 30.6717,3.3652103 30.883665,3.3122201 l 1.927568,-0.5166676 -0.07949,-0.357693 C 32.665497,2.2126442 32.685371,2.0073047 32.79136,1.821833 32.89735,1.6231146 33.062941,1.4972584 33.288157,1.4442682 l 2.305132,-0.61602676 c 0.198719,-0.0529904 0.397436,-0.0198716 0.596155,0.0993594 0.185471,0.092734 0.304702,0.24508716 0.357693,0.45705196 l 0.09936,0.3775648 1.927567,-0.4967957 c 0.198719,-0.066241 0.404062,-0.039743 0.616027,0.079488 0.185471,0.1059837 0.304702,0.2649589 0.357692,0.4769239 l 0.59616,2.2653882 -9.200656,2.4641067 -0.596155,-2.2455166 c -0.05299,-0.2252155 -0.03311,-0.4239337 0.05962,-0.5961549 m 0.53654,11.6250188 V 7.3462013 h 9.538478 v 7.9884747 c 0,0.225215 -0.07949,0.417308 -0.238462,0.576284 -0.158974,0.14572 -0.344447,0.218588 -0.556411,0.218588 h -7.948731 c -0.225216,0 -0.417309,-0.07287 -0.576283,-0.218588 -0.145721,-0.158976 -0.218591,-0.351069 -0.218591,-0.576284"
style="fill:#ffffff;stroke:none;stroke-width:0.264583"
id="path1-0"
sodipodi:nodetypes="ccccccccccccccccccccscsscc" />
<path
d="m 68.066484,4.9852099 0.465721,0.864913 0.02218,0.044357 c 0.931446,1.8481071 0.850129,3.7331757 -0.24395,5.6552051 -1.094081,2.010739 -2.727806,3.053071 -4.901178,3.126996 -0.177418,0.01477 -0.340054,-0.03695 -0.487901,-0.15524 -0.133055,-0.118281 -0.206989,-0.273521 -0.221772,-0.465723 -0.162642,-1.064509 -0.229166,-1.848108 -0.199594,-2.350792 0.01475,-0.177418 0.07393,-0.332659 0.177418,-0.465722 0.118286,-0.133064 0.273522,-0.199595 0.465723,-0.199595 0.901874,-0.07393 1.58198,-0.495294 2.040309,-1.2641063 l -0.02218,0.022177 C 65.604803,9.0584361 65.663942,8.3191964 65.338676,7.5799524 64.909915,6.5745812 64.185459,6.0423266 63.165303,5.9831886 h -0.02218 c -0.724456,-0.014769 -1.34542,0.2365561 -1.86289,0.7540273 0.724456,0.4139744 1.234533,0.7540274 1.530231,1.0201548 0.118286,0.1034921 0.192201,0.2291667 0.221773,0.3770136 l -0.02218,0.4435455 -0.310482,0.3326592 -6.165284,3.570542 -0.487899,0.06653 c -0.162629,-0.01477 -0.303091,-0.08871 -0.421372,-0.221774 l -0.155235,-0.443545 0.02218,-7.229794 0.08872,-0.377014 0.266128,-0.2661273 0.02218,-0.022179 0.33266,-0.088715 0.332658,0.088715 1.55241,0.8870915 C 58.648548,4.1202913 59.2769,3.5436827 59.971789,3.1444917 v -0.022179 c 1.404563,-0.8427376 2.868262,-1.0719038 4.391101,-0.6874953 1.4637,0.3548353 2.676057,1.1827889 3.637073,2.4838539 l 0.06654,0.066536"
style="fill:#ffffff;stroke:none;stroke-width:0.264582"
id="path1-9" />
<path
d="m 83.533512,4.9852096 -0.465721,0.864913 -0.02218,0.044357 c -0.931446,1.8481071 -0.850129,3.7331753 0.24395,5.6552054 1.094081,2.010739 2.727806,3.053071 4.901178,3.126996 0.177418,0.01477 0.340054,-0.03695 0.487901,-0.15524 0.133055,-0.118281 0.206989,-0.273521 0.221772,-0.465723 0.162642,-1.064509 0.229166,-1.848108 0.199594,-2.350792 -0.01475,-0.177418 -0.07393,-0.332659 -0.177418,-0.465722 -0.118286,-0.133064 -0.273522,-0.199595 -0.465723,-0.199595 -0.901874,-0.07393 -1.58198,-0.495294 -2.040309,-1.2641061 l 0.02218,0.02218 C 85.995193,9.0584358 85.936054,8.3191961 86.26132,7.5799521 86.690081,6.5745809 87.414537,6.0423263 88.434693,5.9831883 h 0.02218 c 0.724456,-0.014769 1.34542,0.2365561 1.86289,0.7540273 C 89.595307,7.15119 89.08523,7.491243 88.789532,7.7573704 88.671246,7.8608625 88.597331,7.9865371 88.567759,8.134384 l 0.02218,0.4435455 0.310482,0.3326592 6.165284,3.5705423 0.487899,0.06653 c 0.162629,-0.01477 0.303091,-0.08871 0.421372,-0.221774 l 0.155235,-0.443545 -0.02218,-7.2297943 -0.08872,-0.377014 -0.266128,-0.2661273 -0.02218,-0.022179 -0.33266,-0.088715 -0.332658,0.088715 -1.55241,0.8870915 C 92.951448,4.120291 92.323096,3.5436824 91.628207,3.1444914 V 3.1223124 C 90.223644,2.2795748 88.759945,2.0504086 87.237106,2.4348171 85.773406,2.7896524 84.561049,3.617606 83.600033,4.918671 l -0.06654,0.066536"
style="fill:#ffffff;stroke:none;stroke-width:0.264582"
id="path1-9-7" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 6.3 KiB

View file

@ -30,3 +30,8 @@ void EditHistory::redo() {
this->undo_count--;
}
}
void EditHistory::clear_history() {
this->history.clear();
this->undo_count = 0;
}

View file

@ -20,6 +20,7 @@ public:
void push_action(Callable do_action, Callable undo_action);
void undo();
void redo();
void clear_history();
private:
size_t undo_count{ 0 };

View file

@ -40,13 +40,15 @@ String const TerrainMeshEditor::sig_selection_changed{ "selection_changed" };
void TerrainMeshEditor::_bind_methods() {
BIND_HPROPERTY(Variant::OBJECT, point_primitive_object, PROPERTY_HINT_RESOURCE_TYPE, "PackedScene");
ClassDB::bind_method(D_METHOD("save_data"), &self_type::save_data);
ClassDB::bind_method(D_METHOD("save_data_as"), &self_type::save_data_as);
BIND_HPROPERTY(Variant::OBJECT, current_selected, PROPERTY_HINT_RESOURCE_TYPE, "TerrainPrimitive");
BIND_HPROPERTY(Variant::OBJECT, new_file_data, PROPERTY_HINT_RESOURCE_TYPE, "SaveData");
ADD_SIGNAL(MethodInfo(sig_selection_changed, PropertyInfo(Variant::OBJECT, "new_selection", PROPERTY_HINT_RESOURCE_TYPE, "TerrainPrimitive")));
}
void TerrainMeshEditor::ready() {
connect(sig_primitive_list_changed, callable_mp(this, &self_type::on_primitive_list_changed));
on_primitive_list_changed(get_primitives());
load_new();
if (FileDialog * dialog{ memnew(FileDialog) }) {
this->file_dialog = dialog;
add_child(dialog);
@ -96,6 +98,13 @@ void TerrainMeshEditor::on_save_file_selected(String path) {
}
}
void TerrainMeshEditor::load_new() {
this->data = this->new_file_data->duplicate(true);
this->set_primitives(this->data->get_primitives().duplicate(true));
this->data->set_save_path("");
EditHistory::get_singleton()->clear_history();
}
void TerrainMeshEditor::_notification(int what) {
if (Engine::get_singleton()->is_editor_hint()) {
return;
@ -121,9 +130,7 @@ void TerrainMeshEditor::unhandled_input(Ref<InputEvent> const &event) {
case Key::S:
if (key->is_shift_pressed() && key->is_command_or_control_pressed()) {
get_viewport()->set_input_as_handled();
this->file_dialog->set_file_mode(FileDialog::FILE_MODE_SAVE_FILE);
this->file_dialog->set_ok_button_text("Save");
this->file_dialog->popup_file_dialog();
save_data_as();
} else if (key->is_command_or_control_pressed()) {
get_viewport()->set_input_as_handled();
save_data();
@ -146,6 +153,12 @@ void TerrainMeshEditor::unhandled_input(Ref<InputEvent> const &event) {
EditHistory::get_singleton()->undo();
}
break;
case Key::N:
if (key->is_command_or_control_pressed()) {
get_viewport()->set_input_as_handled();
load_new();
}
break;
}
}
@ -155,15 +168,27 @@ void TerrainMeshEditor::save_data() {
return;
}
if (this->data->get_save_path().is_empty()) {
this->file_dialog->set_file_mode(FileDialog::FILE_MODE_SAVE_FILE);
this->file_dialog->set_ok_button_text("Save");
this->file_dialog->popup_file_dialog();
save_data_as();
} else {
this->data->set_primitives(get_primitives());
this->data->write_to_file();
}
}
void TerrainMeshEditor::save_data_as() {
this->file_dialog->set_file_mode(FileDialog::FILE_MODE_SAVE_FILE);
this->file_dialog->set_ok_button_text("Save");
this->file_dialog->popup_file_dialog();
}
void TerrainMeshEditor::set_new_file_data(Ref<SaveData> data) {
this->new_file_data = data;
}
Ref<SaveData> TerrainMeshEditor::get_new_file_data() const {
return this->new_file_data;
}
void TerrainMeshEditor::set_current_selected(Ref<TerrainPrimitive> primitive) {
this->current_selected = primitive;
emit_signal(sig_selection_changed, primitive);

View file

@ -28,6 +28,7 @@ class TerrainMeshEditor : public TerrainMeshGenerator {
void on_primitive_list_changed(Array primitives);
void on_primitive_node_removed();
void on_save_file_selected(String path);
void load_new();
protected:
void _notification(int what);
@ -35,12 +36,16 @@ protected:
public:
void save_data();
void save_data_as();
void set_new_file_data(Ref<SaveData> data);
Ref<SaveData> get_new_file_data() const;
void set_current_selected(Ref<TerrainPrimitive>);
Ref<TerrainPrimitive> get_current_selected() const;
void set_point_primitive_object(Ref<PackedScene> scene);
Ref<PackedScene> get_point_primitive_object() const;
private:
Ref<SaveData> new_file_data{};
Ref<SaveData> data{ memnew(SaveData) };
Ref<TerrainPrimitive> current_selected{};
FileDialog *file_dialog{};

View file

@ -12,19 +12,11 @@
<defs
id="defs1" />
<g
id="layer1">
id="layer1"
transform="translate(-26.933333)">
<path
d="m 4.4006052,4.8168325 c -0.2167261,0 -0.3909619,0.1742357 -0.3909619,0.3909618 V 15.568873 c 0,0.216726 0.1742358,0.390963 0.3909619,0.390963 h 8.1321208 c 0.216726,0 0.390962,-0.174237 0.390962,-0.390963 V 5.2077943 c 0,-0.2167261 -0.174236,-0.3909618 -0.390962,-0.3909618 z M 6.0127134,6.5791597 H 6.696517 c 0.1925686,0 0.3473831,0.1548145 0.3473831,0.3473831 v 7.2178792 c 0,0.19257 -0.1548145,0.347384 -0.3473831,0.347384 H 6.0127134 c -0.1925686,0 -0.3473831,-0.154814 -0.3473831,-0.347384 V 6.9265428 c 0,-0.1925686 0.1548145,-0.3473831 0.3473831,-0.3473831 z m 2.0959471,0 h 0.6838036 c 0.1925686,0 0.3473831,0.1548145 0.3473831,0.3473831 v 7.2178792 c 0,0.19257 -0.1548145,0.347384 -0.3473831,0.347384 H 8.1086605 c -0.1925688,0 -0.3473831,-0.154814 -0.3473831,-0.347384 V 6.9265428 c 0,-0.1925686 0.1548143,-0.3473831 0.3473831,-0.3473831 z m 1.9376715,0 h 0.683119 c 0.192568,0 0.347382,0.1548145 0.347382,0.3473831 v 7.2178792 c 0,0.19257 -0.154814,0.347384 -0.347382,0.347384 h -0.683119 c -0.1925684,0 -0.3480681,-0.154814 -0.3480681,-0.347384 V 6.9265428 c 0,-0.1925686 0.1554997,-0.3473831 0.3480681,-0.3473831 z"
style="fill:#969696;stroke-width:4.99999;stroke-linecap:round;paint-order:fill markers stroke"
id="path4" />
<rect
style="fill:#969696;fill-opacity:1;stroke:none;stroke-width:4.99999;stroke-linecap:round;paint-order:fill markers stroke"
id="rect2"
width="2.7221162"
height="10.311472"
x="1.8568949"
y="-13.622402"
ry="0.34995934"
transform="rotate(90)" />
d="M 30.406741,3.7096566 C 30.512731,3.4976918 30.6717,3.3652103 30.883665,3.3122201 l 1.927568,-0.5166676 -0.07949,-0.357693 C 32.665497,2.2126442 32.685371,2.0073047 32.79136,1.821833 32.89735,1.6231146 33.062941,1.4972584 33.288157,1.4442682 l 2.305132,-0.61602676 c 0.198719,-0.0529904 0.397436,-0.0198716 0.596155,0.0993594 0.185471,0.092734 0.304702,0.24508716 0.357693,0.45705196 l 0.09936,0.3775648 1.927567,-0.4967957 c 0.198719,-0.066241 0.404062,-0.039743 0.616027,0.079488 0.185471,0.1059837 0.304702,0.2649589 0.357692,0.4769239 l 0.59616,2.2653882 -9.200656,2.4641067 -0.596155,-2.2455166 c -0.05299,-0.2252155 -0.03311,-0.4239337 0.05962,-0.5961549 m 0.53654,11.6250188 V 7.3462013 h 9.538478 v 7.9884747 c 0,0.225215 -0.07949,0.417308 -0.238462,0.576284 -0.158974,0.14572 -0.344447,0.218588 -0.556411,0.218588 h -7.948731 c -0.225216,0 -0.417309,-0.07287 -0.576283,-0.218588 -0.145721,-0.158976 -0.218591,-0.351069 -0.218591,-0.576284"
style="fill:#ffffff;stroke:none;stroke-width:0.264583"
id="path1-0" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="16.933332mm"
height="16.933332mm"
viewBox="0 0 16.933332 16.933332"
version="1.1"
id="svg1"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs1" />
<g
id="layer1"
transform="translate(-80.799995)">
<path
d="m 83.533512,4.9852096 -0.465721,0.864913 -0.02218,0.044357 c -0.931446,1.8481071 -0.850129,3.7331753 0.24395,5.6552054 1.094081,2.010739 2.727806,3.053071 4.901178,3.126996 0.177418,0.01477 0.340054,-0.03695 0.487901,-0.15524 0.133055,-0.118281 0.206989,-0.273521 0.221772,-0.465723 0.162642,-1.064509 0.229166,-1.848108 0.199594,-2.350792 -0.01475,-0.177418 -0.07393,-0.332659 -0.177418,-0.465722 -0.118286,-0.133064 -0.273522,-0.199595 -0.465723,-0.199595 -0.901874,-0.07393 -1.58198,-0.495294 -2.040309,-1.2641061 l 0.02218,0.02218 C 85.995193,9.0584358 85.936054,8.3191961 86.26132,7.5799521 86.690081,6.5745809 87.414537,6.0423263 88.434693,5.9831883 h 0.02218 c 0.724456,-0.014769 1.34542,0.2365561 1.86289,0.7540273 C 89.595307,7.15119 89.08523,7.491243 88.789532,7.7573704 88.671246,7.8608625 88.597331,7.9865371 88.567759,8.134384 l 0.02218,0.4435455 0.310482,0.3326592 6.165284,3.5705423 0.487899,0.06653 c 0.162629,-0.01477 0.303091,-0.08871 0.421372,-0.221774 l 0.155235,-0.443545 -0.02218,-7.2297943 -0.08872,-0.377014 -0.266128,-0.2661273 -0.02218,-0.022179 -0.33266,-0.088715 -0.332658,0.088715 -1.55241,0.8870915 C 92.951448,4.120291 92.323096,3.5436824 91.628207,3.1444914 V 3.1223124 C 90.223644,2.2795748 88.759945,2.0504086 87.237106,2.4348171 85.773406,2.7896524 84.561049,3.617606 83.600033,4.918671 l -0.06654,0.066536"
style="fill:#ffffff;stroke:none;stroke-width:0.264582"
id="path1-9-7" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

View file

@ -0,0 +1,43 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://fpnyca6s1f1y"
path="res://.godot/imported/redo.svg-3f978da4a242cfabee4c9d3cfb8b5e18.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/icons/redo.svg"
dest_files=["res://.godot/imported/redo.svg-3f978da4a242cfabee4c9d3cfb8b5e18.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

View file

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="16.933332mm"
height="16.933332mm"
viewBox="0 0 16.933332 16.933332"
version="1.1"
id="svg1"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs1" />
<g
id="layer1">
<path
d="M 11.972139,3.2084645 H 4.9611927 V 6.7139381 H 11.972139 V 3.2084645 M 9.3430387,5.8375655 V 4.0848371 H 11.095767 V 5.8375655 H 9.3430387 M 15.477596,4.961193 V 15.477596 H 1.4557358 V 1.4557361 H 11.972139 L 15.477596,4.961193 M 3.2084643,13.724868 H 13.724868 V 8.4666665 H 3.2084643 v 5.2582015"
style="fill:#ffffff;stroke:none;stroke-width:0.264582"
id="path1" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 782 B

View file

@ -0,0 +1,43 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cwl3no6dbtjrf"
path="res://.godot/imported/save.svg-4436a386e8aa6786c3b87b76d11469d6.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/icons/save.svg"
dest_files=["res://.godot/imported/save.svg-4436a386e8aa6786c3b87b76d11469d6.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="16.933332mm"
height="16.933332mm"
viewBox="0 0 16.933332 16.933332"
version="1.1"
id="svg1"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs1" />
<g
id="layer1"
transform="translate(-53.866666)">
<path
d="m 68.066484,4.9852099 0.465721,0.864913 0.02218,0.044357 c 0.931446,1.8481071 0.850129,3.7331757 -0.24395,5.6552051 -1.094081,2.010739 -2.727806,3.053071 -4.901178,3.126996 -0.177418,0.01477 -0.340054,-0.03695 -0.487901,-0.15524 -0.133055,-0.118281 -0.206989,-0.273521 -0.221772,-0.465723 -0.162642,-1.064509 -0.229166,-1.848108 -0.199594,-2.350792 0.01475,-0.177418 0.07393,-0.332659 0.177418,-0.465722 0.118286,-0.133064 0.273522,-0.199595 0.465723,-0.199595 0.901874,-0.07393 1.58198,-0.495294 2.040309,-1.2641063 l -0.02218,0.022177 C 65.604803,9.0584361 65.663942,8.3191964 65.338676,7.5799524 64.909915,6.5745812 64.185459,6.0423266 63.165303,5.9831886 h -0.02218 c -0.724456,-0.014769 -1.34542,0.2365561 -1.86289,0.7540273 0.724456,0.4139744 1.234533,0.7540274 1.530231,1.0201548 0.118286,0.1034921 0.192201,0.2291667 0.221773,0.3770136 l -0.02218,0.4435455 -0.310482,0.3326592 -6.165284,3.570542 -0.487899,0.06653 c -0.162629,-0.01477 -0.303091,-0.08871 -0.421372,-0.221774 l -0.155235,-0.443545 0.02218,-7.229794 0.08872,-0.377014 0.266128,-0.2661273 0.02218,-0.022179 0.33266,-0.088715 0.332658,0.088715 1.55241,0.8870915 C 58.648548,4.1202913 59.2769,3.5436827 59.971789,3.1444917 v -0.022179 c 1.404563,-0.8427376 2.868262,-1.0719038 4.391101,-0.6874953 1.4637,0.3548353 2.676057,1.1827889 3.637073,2.4838539 l 0.06654,0.066536"
style="fill:#ffffff;stroke:none;stroke-width:0.264582"
id="path1-9" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

View file

@ -0,0 +1,43 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c1nd3r8w1yj1o"
path="res://.godot/imported/undo.svg-8e39613a5ed2624e54d767b85e6b7dc0.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/icons/undo.svg"
dest_files=["res://.godot/imported/undo.svg-8e39613a5ed2624e54d767b85e6b7dc0.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

View file

@ -0,0 +1,8 @@
[gd_resource type="SaveData" format=3 uid="uid://djlwnfbjmjb6a"]
[sub_resource type="PlanePrimitive" id="PlanePrimitive_b8mx7"]
blend_range = 1.0
baseline = 0.0
[resource]
primitives = [SubResource("PlanePrimitive_b8mx7")]

View file

@ -2,19 +2,19 @@
[ext_resource type="PackedScene" uid="uid://cnux2fqne284i" path="res://objects/primitive_nodes/point_primitive_node.tscn" id="1_b1cmn"]
[ext_resource type="PackedScene" uid="uid://wkqhvjnxs2mx" path="res://objects/terrain_chunk.tscn" id="1_pxqd5"]
[ext_resource type="SaveData" uid="uid://djlwnfbjmjb6a" path="res://default_file.tres" id="3_78fwb"]
[ext_resource type="Theme" uid="uid://dh5hqcu3vyhrh" path="res://editor_theme.tres" id="3_ba0ut"]
[ext_resource type="Texture2D" uid="uid://b8hetdn3d3ysr" path="res://assets/icons/point.svg" id="4_5lcyj"]
[ext_resource type="Texture2D" uid="uid://bb0mnjwx58nt3" path="res://assets/icons/plus.svg" id="4_q68jb"]
[ext_resource type="Texture2D" uid="uid://bl3gn6qruuy8w" path="res://assets/icons/plane.svg" id="4_xg7d5"]
[ext_resource type="Texture2D" uid="uid://cwl3no6dbtjrf" path="res://assets/icons/save.svg" id="5_74j0u"]
[ext_resource type="Texture2D" uid="uid://d1te42w7wpkrx" path="res://assets/icons/noise.svg" id="5_eqbpn"]
[ext_resource type="PackedScene" uid="uid://bsvvhue5x4rb" path="res://ui/primitive_inspectors/point_primitive_inspector.tscn" id="8_5tm2q"]
[ext_resource type="PackedScene" uid="uid://c5desl3kt72c7" path="res://ui/primitive_inspectors/noise_primitive_inspector.tscn" id="9_3vi5u"]
[ext_resource type="PackedScene" uid="uid://bl16us512blpp" path="res://ui/primitive_inspectors/base_primitive_inspector.tscn" id="9_j8y2p"]
[ext_resource type="PackedScene" uid="uid://cq25h75v1bnn1" path="res://ui/primitive_inspectors/plane_primitive_inspector.tscn" id="9_o435n"]
[sub_resource type="PlanePrimitive" id="PlanePrimitive_ba0ut"]
blend_range = 1.0
baseline = 0.0
[ext_resource type="Texture2D" uid="uid://c1nd3r8w1yj1o" path="res://assets/icons/undo.svg" id="10_2w0at"]
[ext_resource type="Texture2D" uid="uid://fpnyca6s1f1y" path="res://assets/icons/redo.svg" id="11_5tdu1"]
[sub_resource type="Gradient" id="Gradient_b1cmn"]
interpolation_mode = 2
@ -109,21 +109,51 @@ domain_warp_fractal_gain = 0.662
[sub_resource type="NoisePrimitive" id="NoisePrimitive_5lcyj"]
noise = SubResource("FastNoiseLite_3vi5u")
[sub_resource type="GDScript" id="GDScript_74j0u"]
resource_name = "SaveButton"
script/source = "extends Button
@onready var editor : TerrainMeshEditor = %TerrainMeshEditor
func _pressed():
if Input.is_key_pressed(KEY_SHIFT):
editor.save_data_as()
else:
editor.save_data()
"
[sub_resource type="GDScript" id="GDScript_2w0at"]
resource_name = "UndoButton"
script/source = "extends Button
func _pressed():
EditHistory.undo_last()
"
[sub_resource type="GDScript" id="GDScript_5tdu1"]
resource_name = "RedoButton"
script/source = "extends Button
func _pressed():
EditHistory.redo_last()
"
[node name="Editor" type="Node3D" unique_id=1027707839]
[node name="TerrainMeshEditor" type="TerrainMeshEditor" parent="." unique_id=1382595562]
primitives = [SubResource("PlanePrimitive_ba0ut")]
unique_name_in_owner = true
vertex_color_gradient = SubResource("Gradient_b1cmn")
color_gradient_end_height = 100.0
chunk_count = 8
chunk_scene = ExtResource("1_pxqd5")
point_primitive_object = ExtResource("1_b1cmn")
new_file_data = ExtResource("3_78fwb")
[node name="WorldEnvironment" type="WorldEnvironment" parent="." unique_id=1468550752]
environment = SubResource("Environment_pxqd5")
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="." unique_id=978399107]
transform = Transform3D(-0.750999, -0.305988, 0.585126, -1.29815e-08, 0.886147, 0.463404, -0.660305, 0.348015, -0.665494, 0, 0, 0)
transform = Transform3D(-0.750999, -0.44822368, 0.48486787, -1.4901161e-08, 0.73431087, 0.678813, -0.66030496, 0.50978696, -0.55146533, 0, 0, 0)
light_color = Color(0.89, 0.82948, 0.7387, 1)
shadow_enabled = true
shadow_reverse_cull_face = true
@ -149,6 +179,7 @@ anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
size_flags_vertical = 3
drag_area_highlight_in_editor = true
[node name="Layers" type="TabContainer" parent="LeftPanel/VBoxContainer" unique_id=2095156888]
@ -156,22 +187,22 @@ layout_mode = 2
size_flags_vertical = 3
current_tab = 0
[node name="Layers" type="VBoxContainer" parent="LeftPanel/VBoxContainer/Layers" unique_id=138865385]
[node name="File" type="VBoxContainer" parent="LeftPanel/VBoxContainer/Layers" unique_id=138865385]
layout_mode = 2
metadata/_tab_index = 0
[node name="HBoxContainer" type="HBoxContainer" parent="LeftPanel/VBoxContainer/Layers/Layers" unique_id=702489990]
[node name="HBoxContainer" type="HBoxContainer" parent="LeftPanel/VBoxContainer/Layers/File" unique_id=702489990]
layout_mode = 2
size_flags_vertical = 8
[node name="TextureRect" type="TextureRect" parent="LeftPanel/VBoxContainer/Layers/Layers/HBoxContainer" unique_id=1669840346]
[node name="TextureRect" type="TextureRect" parent="LeftPanel/VBoxContainer/Layers/File/HBoxContainer" unique_id=1669840346]
custom_minimum_size = Vector2(32, 32)
layout_mode = 2
texture = ExtResource("4_q68jb")
expand_mode = 2
stretch_mode = 4
[node name="AddPointPrimitive" type="AddPrimitiveButton" parent="LeftPanel/VBoxContainer/Layers/Layers/HBoxContainer" unique_id=255935272 node_paths=PackedStringArray("terrain")]
[node name="AddPointPrimitive" type="AddPrimitiveButton" parent="LeftPanel/VBoxContainer/Layers/File/HBoxContainer" unique_id=255935272 node_paths=PackedStringArray("terrain")]
custom_minimum_size = Vector2(32, 32)
layout_mode = 2
icon = SubResource("CompressedTexture2D_xg7d5")
@ -179,7 +210,7 @@ expand_icon = true
primitive_blueprint = SubResource("PointPrimitive_5lcyj")
terrain = NodePath("../../../../../../TerrainMeshEditor")
[node name="AddPlanePrimitive" type="AddPrimitiveButton" parent="LeftPanel/VBoxContainer/Layers/Layers/HBoxContainer" unique_id=850669113 node_paths=PackedStringArray("terrain")]
[node name="AddPlanePrimitive" type="AddPrimitiveButton" parent="LeftPanel/VBoxContainer/Layers/File/HBoxContainer" unique_id=850669113 node_paths=PackedStringArray("terrain")]
custom_minimum_size = Vector2(32, 32)
layout_mode = 2
icon = ExtResource("4_xg7d5")
@ -187,7 +218,7 @@ expand_icon = true
primitive_blueprint = SubResource("PlanePrimitive_5lcyj")
terrain = NodePath("../../../../../../TerrainMeshEditor")
[node name="AddNoisePrimitive" type="AddPrimitiveButton" parent="LeftPanel/VBoxContainer/Layers/Layers/HBoxContainer" unique_id=761062556 node_paths=PackedStringArray("terrain")]
[node name="AddNoisePrimitive" type="AddPrimitiveButton" parent="LeftPanel/VBoxContainer/Layers/File/HBoxContainer" unique_id=761062556 node_paths=PackedStringArray("terrain")]
custom_minimum_size = Vector2(32, 32)
layout_mode = 2
icon = ExtResource("5_eqbpn")
@ -195,7 +226,7 @@ expand_icon = true
primitive_blueprint = SubResource("NoisePrimitive_5lcyj")
terrain = NodePath("../../../../../../TerrainMeshEditor")
[node name="Tree" type="PrimitiveLayerList" parent="LeftPanel/VBoxContainer/Layers/Layers" unique_id=797700186 node_paths=PackedStringArray("terrain")]
[node name="Tree" type="PrimitiveLayerList" parent="LeftPanel/VBoxContainer/Layers/File" unique_id=797700186 node_paths=PackedStringArray("terrain")]
layout_mode = 2
size_flags_vertical = 3
hide_root = true
@ -209,6 +240,33 @@ icons = {
&"PointPrimitive": ExtResource("4_5lcyj")
}
[node name="HBoxContainer2" type="HBoxContainer" parent="LeftPanel/VBoxContainer/Layers/File" unique_id=20324709]
layout_mode = 2
[node name="SaveButton" type="Button" parent="LeftPanel/VBoxContainer/Layers/File/HBoxContainer2" unique_id=2060569358]
custom_minimum_size = Vector2(32, 32)
layout_mode = 2
tooltip_text = "Save file: Ctrl-S/Cmd-S(mac)"
icon = ExtResource("5_74j0u")
expand_icon = true
script = SubResource("GDScript_74j0u")
[node name="Undo" type="Button" parent="LeftPanel/VBoxContainer/Layers/File/HBoxContainer2" unique_id=133676321]
custom_minimum_size = Vector2(32, 32)
layout_mode = 2
tooltip_text = "Undo: Ctrl-Z/Cmd-Z(mac)"
icon = ExtResource("10_2w0at")
expand_icon = true
script = SubResource("GDScript_2w0at")
[node name="Redo" type="Button" parent="LeftPanel/VBoxContainer/Layers/File/HBoxContainer2" unique_id=946837272]
custom_minimum_size = Vector2(32, 32)
layout_mode = 2
tooltip_text = "Redo: Ctrl-Shift-Z/Cmd-Shift-Z(mac)"
icon = ExtResource("11_5tdu1")
expand_icon = true
script = SubResource("GDScript_5tdu1")
[node name="Inspector" type="LayerEditor" parent="LeftPanel/VBoxContainer" unique_id=833878161 node_paths=PackedStringArray("terrain")]
layout_mode = 2
size_flags_vertical = 3

Binary file not shown.