diff --git a/godot/astream/brush.ini b/godot/astream/brush.ini new file mode 100644 index 0000000..6fab611 --- /dev/null +++ b/godot/astream/brush.ini @@ -0,0 +1,13 @@ +[brushes/0] + +curve=[ Vector2( 0, 2 ), 0.0, 0.0, 0, 0, Vector2( 1, -0.0338984 ), 0.0, 0.0, 0, 0 ] +radius=2.0 +strength=1.0 +flags=0 + +[brushes/1] + +curve=[ ] +radius=1.0 +strength=1.0 +flags=0 diff --git a/godot/main/editor.tscn b/godot/main/editor.tscn index 81203e9..c1e143f 100644 --- a/godot/main/editor.tscn +++ b/godot/main/editor.tscn @@ -71,13 +71,13 @@ focus_mode = 2 unique_name_in_owner = true margin_top = 52.0 margin_right = 248.0 -margin_bottom = 128.0 +margin_bottom = 190.0 [node name="v_terrain" type="VBoxContainer" parent="VBoxContainer"] unique_name_in_owner = true -margin_top = 132.0 +margin_top = 194.0 margin_right = 248.0 -margin_bottom = 132.0 +margin_bottom = 194.0 [node name="v_buildings" type="VBoxContainer" parent="VBoxContainer"] unique_name_in_owner = true @@ -550,6 +550,5 @@ mesh = SubResource( 14 ) material/0 = SubResource( 11 ) [node name="mi2" type="MeshInstance" parent="terrain_cursor"] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 30, 0 ) mesh = SubResource( 15 ) material/0 = SubResource( 11 ) diff --git a/godot/terrain/terrain_draw.png b/godot/terrain/terrain_draw.png index d7b5b56..b051f9e 100644 Binary files a/godot/terrain/terrain_draw.png and b/godot/terrain/terrain_draw.png differ diff --git a/src/modules/stream/signal_handler.h b/src/modules/stream/signal_handler.h index 7c0eee9..81740b1 100644 --- a/src/modules/stream/signal_handler.h +++ b/src/modules/stream/signal_handler.h @@ -86,9 +86,14 @@ obj_name, sig_name, hdecl, hargs, hbind) \ typedef _GODOT_HANDLER_CONCAT2(class_name, __LINE__) class_name; -GODOT_HANDLER_METHOD(BrushSelectHandler, OptionButton, item_selected, - brush_select, (int id), (id), D_METHOD("handler", "id")) +//GODOT_HANDLER_METHOD(BrushSelectHandler, OptionButton, item_selected, +// brush_select, (int id), (id), D_METHOD("handler", "id")) GODOT_HANDLER_EVENT_METHOD(OptionButtonHandler, OptionButton, item_selected, (int id), (id), D_METHOD("handler", "id")) +GODOT_HANDLER_EVENT_METHOD(ButtonPressHandler, Button, pressed, (), (), + D_METHOD("handler")) +GODOT_HANDLER_EVENT_METHOD(LineEditString, LineEdit, text_changed, + (const String &text), (text), + D_METHOD("handler", "text")) #endif // SIGNAL_HANDLER_H_ \ No newline at end of file diff --git a/src/modules/stream/terrain_editor.cpp b/src/modules/stream/terrain_editor.cpp index 198b568..9369200 100644 --- a/src/modules/stream/terrain_editor.cpp +++ b/src/modules/stream/terrain_editor.cpp @@ -3,11 +3,18 @@ #include #include #include +#include +#include +#include +#include +#include +#include #include #include #include "editor_event.h" #include "world_editor.h" +#include "signal_handler.h" #include "terrain_editor.h" void TerrainEditor::exit() @@ -82,6 +89,8 @@ void TerrainEditor::activate() ib++; } assert(brushes.size() > 0); + EditorEvent::get_singleton()->event.emit("terrain_load_data", + varray(brushes)); EditorEvent::get_singleton()->event.emit("terrain_update_brushes", varray(brushes)); active = true; @@ -162,6 +171,9 @@ end:; brush_curves[id].instance(); brush_curves[id]->set_min_value(-2); brush_curves[id]->set_max_value(2); + brush_radius[id] = 1.0f; + brush_strength[id] = 1.0f; + brush_flags[id] = 0; } if (!ob->get_parent()->has_meta("brush_editor")) { BrushCurveEditor *curve_edit = memnew(BrushCurveEditor); @@ -176,6 +188,131 @@ end:; "brush_editor")); curve_edit->set_curve(brush_curves[id]); } + if (!ob->get_parent()->has_meta("brush_radius_label")) { + Label *radius_label = memnew(Label); + radius_label->set_text("Radius"); + ob->get_parent()->call_deferred("add_child", + radius_label); + ob->get_parent()->set_meta("brush_radius_label", + radius_label); + } else { + Label *radius_label = Object::cast_to