mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-01-11 13:21:10 +01:00
Also ported the settings dialog.
This commit is contained in:
parent
bd42d11629
commit
cc217b7eea
@ -24,102 +24,72 @@ SOFTWARE.
|
|||||||
|
|
||||||
#include "paint_settings.h"
|
#include "paint_settings.h"
|
||||||
|
|
||||||
void PaintSettings::_enter_tree() {
|
#include "paint_canvas_outline.h"
|
||||||
/*
|
|
||||||
canvas_outline = get_parent().find_node("CanvasOutline")
|
#include "scene/gui/box_container.h"
|
||||||
editor = get_parent()
|
#include "scene/gui/check_button.h"
|
||||||
*/
|
#include "scene/gui/color_picker.h"
|
||||||
}
|
#include "scene/gui/label.h"
|
||||||
|
#include "scene/gui/spin_box.h"
|
||||||
|
|
||||||
void PaintSettings::_on_ColorPickerButton_color_changed(const Color &color) {
|
void PaintSettings::_on_ColorPickerButton_color_changed(const Color &color) {
|
||||||
/*
|
canvas_outline->color = color;
|
||||||
canvas_outline.color = color
|
canvas_outline->update();
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
void PaintSettings::_on_CheckButton_toggled(const bool button_pressed) {
|
void PaintSettings::_on_CheckButton_toggled(const bool button_pressed) {
|
||||||
/*
|
canvas_outline->set_visible(button_pressed);
|
||||||
canvas_outline.visible = button_pressed
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
void PaintSettings::_on_Ok_pressed() {
|
|
||||||
/*
|
|
||||||
hide()
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PaintSettings::PaintSettings() {
|
PaintSettings::PaintSettings() {
|
||||||
/*
|
set_resizable(true);
|
||||||
|
set_title("Settings");
|
||||||
|
|
||||||
[gd_scene load_steps=2 format=2]
|
VBoxContainer *main_box_container = memnew(VBoxContainer);
|
||||||
|
add_child(main_box_container);
|
||||||
|
|
||||||
[ext_resource path="res://addons/Godoxel/Settings.gd" type="Script" id=1]
|
HBoxContainer *outline_container = memnew(HBoxContainer);
|
||||||
|
outline_container->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||||
|
outline_container->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||||
|
main_box_container->add_child(outline_container);
|
||||||
|
|
||||||
|
Label *outline_label = memnew(Label);
|
||||||
|
outline_label->set_text("Canvas Outline:");
|
||||||
|
outline_label->set_valign(Label::VALIGN_CENTER);
|
||||||
|
outline_label->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||||
|
outline_label->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||||
|
outline_container->add_child(outline_label);
|
||||||
|
|
||||||
[node name="Settings" type="WindowDialog"]
|
_check_button = memnew(CheckButton);
|
||||||
visible = true
|
_check_button->set_pressed(true);
|
||||||
margin_top = 20.0
|
_check_button->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||||
margin_right = 300.0
|
_check_button->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||||
margin_bottom = 120.0
|
_check_button->connect("toggled", this, "_on_CheckButton_toggled");
|
||||||
window_title = "Settings"
|
outline_container->add_child(_check_button);
|
||||||
script = ExtResource( 1 )
|
|
||||||
|
|
||||||
[node name="Ok" type="Button" parent="."]
|
HBoxContainer *color_picker_container = memnew(HBoxContainer);
|
||||||
margin_left = 210.0
|
color_picker_container->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||||
margin_top = 70.0
|
color_picker_container->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||||
margin_right = 290.0
|
main_box_container->add_child(color_picker_container);
|
||||||
margin_bottom = 90.0
|
|
||||||
text = "Ok"
|
|
||||||
|
|
||||||
[node name="CanvasOutlineToggle" type="Control" parent="."]
|
Label *grid_label = memnew(Label);
|
||||||
margin_left = 10.0
|
grid_label->set_text("Canvas Outline Color:");
|
||||||
margin_top = 10.0
|
grid_label->set_valign(Label::VALIGN_CENTER);
|
||||||
margin_right = 290.0
|
grid_label->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||||
margin_bottom = 30.0
|
grid_label->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||||
__meta__ = {
|
color_picker_container->add_child(grid_label);
|
||||||
"_edit_group_": true
|
|
||||||
}
|
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="CanvasOutlineToggle"]
|
_color_picker_button = memnew(ColorPickerButton);
|
||||||
margin_right = 130.0
|
_color_picker_button->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||||
margin_bottom = 20.0
|
_color_picker_button->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||||
text = "Canvas Outline:"
|
_color_picker_button->set_custom_minimum_size(Size2(100, 0));
|
||||||
valign = 1
|
_color_picker_button->connect("color_changed", this, "_on_ColorPickerButton_color_changed");
|
||||||
|
color_picker_container->add_child(_color_picker_button);
|
||||||
[node name="CheckButton" type="CheckButton" parent="CanvasOutlineToggle"]
|
|
||||||
margin_left = 210.0
|
|
||||||
margin_top = -10.0
|
|
||||||
margin_right = 286.0
|
|
||||||
margin_bottom = 30.0
|
|
||||||
pressed = true
|
|
||||||
|
|
||||||
[node name="CanvasOutlineColor" type="Control" parent="."]
|
|
||||||
margin_left = 10.0
|
|
||||||
margin_top = 40.0
|
|
||||||
margin_right = 290.0
|
|
||||||
margin_bottom = 60.0
|
|
||||||
__meta__ = {
|
|
||||||
"_edit_group_": true
|
|
||||||
}
|
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="CanvasOutlineColor"]
|
|
||||||
margin_right = 130.0
|
|
||||||
margin_bottom = 20.0
|
|
||||||
text = "Canvas Outline Color:"
|
|
||||||
valign = 1
|
|
||||||
|
|
||||||
[node name="ColorPickerButton" type="ColorPickerButton" parent="CanvasOutlineColor"]
|
|
||||||
margin_left = 170.0
|
|
||||||
margin_right = 280.0
|
|
||||||
margin_bottom = 20.0
|
|
||||||
[connection signal="pressed" from="Ok" to="." method="_on_Ok_pressed"]
|
|
||||||
[connection signal="toggled" from="CanvasOutlineToggle/CheckButton" to="." method="_on_CheckButton_toggled"]
|
|
||||||
[connection signal="color_changed" from="CanvasOutlineColor/ColorPickerButton" to="." method="_on_ColorPickerButton_color_changed"]
|
|
||||||
|
|
||||||
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PaintSettings::~PaintSettings() {
|
PaintSettings::~PaintSettings() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void PaintSettings::_bind_methods() {
|
void PaintSettings::_bind_methods() {
|
||||||
|
ClassDB::bind_method(D_METHOD("_on_ColorPickerButton_color_changed"), &PaintSettings::_on_ColorPickerButton_color_changed);
|
||||||
|
ClassDB::bind_method(D_METHOD("_on_CheckButton_toggled"), &PaintSettings::_on_CheckButton_toggled);
|
||||||
}
|
}
|
||||||
|
@ -27,29 +27,27 @@ SOFTWARE.
|
|||||||
|
|
||||||
#include "scene/gui/dialogs.h"
|
#include "scene/gui/dialogs.h"
|
||||||
|
|
||||||
class PaintSettings : public WindowDialog {
|
class CheckButton;
|
||||||
GDCLASS(PaintSettings, WindowDialog);
|
class ColorPickerButton;
|
||||||
|
class PaintCanvasOutline;
|
||||||
|
|
||||||
|
class PaintSettings : public AcceptDialog {
|
||||||
|
GDCLASS(PaintSettings, AcceptDialog);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void _enter_tree();
|
|
||||||
void _on_ColorPickerButton_color_changed(const Color &color);
|
|
||||||
void _on_CheckButton_toggled(const bool button_pressed);
|
|
||||||
void _on_Ok_pressed();
|
|
||||||
|
|
||||||
PaintSettings();
|
PaintSettings();
|
||||||
~PaintSettings();
|
~PaintSettings();
|
||||||
|
|
||||||
|
PaintCanvasOutline *canvas_outline;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void _on_ColorPickerButton_color_changed(const Color &color);
|
||||||
|
void _on_CheckButton_toggled(const bool button_pressed);
|
||||||
|
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
|
|
||||||
/*
|
CheckButton *_check_button;
|
||||||
|
ColorPickerButton *_color_picker_button;
|
||||||
var editor
|
|
||||||
var canvas_outline
|
|
||||||
var start_time
|
|
||||||
var end_time
|
|
||||||
|
|
||||||
*/
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1443,6 +1443,7 @@ PaintWindow::PaintWindow() {
|
|||||||
|
|
||||||
//PaintSettings
|
//PaintSettings
|
||||||
paint_settings_dialog = memnew(PaintSettings);
|
paint_settings_dialog = memnew(PaintSettings);
|
||||||
|
paint_settings_dialog->canvas_outline = paint_canvas->canvas_outline;
|
||||||
add_child(paint_settings_dialog);
|
add_child(paint_settings_dialog);
|
||||||
|
|
||||||
set_brush(Tools::PAINT);
|
set_brush(Tools::PAINT);
|
||||||
|
Loading…
Reference in New Issue
Block a user