mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-02-06 16:16:06 +01:00
Converted the widget code for mat_maker_gd to cpp and added it in.
This commit is contained in:
parent
96ed3b53a3
commit
4c2ec0ffd9
@ -0,0 +1,44 @@
|
|||||||
|
|
||||||
|
#include "color_picker_button.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//tool;
|
||||||
|
|
||||||
|
void ColorPickerButton::get_drag_data(const Variant &_position) {
|
||||||
|
Variant = ColorRect.new();
|
||||||
|
preview.color = color;
|
||||||
|
preview.rect_min_size = Vector2(32, 32);
|
||||||
|
set_drag_preview(preview);
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool ColorPickerButton::can_drop_data(const Variant &_position, const Variant & data) {
|
||||||
|
return typeof(data) == TYPE_COLOR;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ColorPickerButton::drop_data(const Variant &_position, const Variant & data) {
|
||||||
|
color = data;
|
||||||
|
emit_signal("color_changed", color);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ColorPickerButton::ColorPickerButton() {
|
||||||
|
}
|
||||||
|
|
||||||
|
ColorPickerButton::~ColorPickerButton() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void ColorPickerButton::_bind_methods() {
|
||||||
|
ClassDB::bind_method(D_METHOD("get_drag_data", "_position"), &ColorPickerButton::get_drag_data);
|
||||||
|
ClassDB::bind_method(D_METHOD("can_drop_data", "_position", " data"), &ColorPickerButton::can_drop_data);
|
||||||
|
ClassDB::bind_method(D_METHOD("drop_data", "_position", " data"), &ColorPickerButton::drop_data);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,24 @@
|
|||||||
|
#ifndef COLOR_PICKER_BUTTON_H
|
||||||
|
#define COLOR_PICKER_BUTTON_H
|
||||||
|
|
||||||
|
|
||||||
|
class ColorPickerButton : public ColorPickerButton {
|
||||||
|
GDCLASS(ColorPickerButton, ColorPickerButton);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
void get_drag_data(const Variant &_position);
|
||||||
|
bool can_drop_data(const Variant &_position, const Variant & data);
|
||||||
|
void drop_data(const Variant &_position, const Variant & data);
|
||||||
|
|
||||||
|
ColorPickerButton();
|
||||||
|
~ColorPickerButton();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
static void _bind_methods();
|
||||||
|
|
||||||
|
//tool
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,798 @@
|
|||||||
|
|
||||||
|
void construct() {
|
||||||
|
|
||||||
|
PopupPanel *colorpickerpopup = memnew(PopupPanel);
|
||||||
|
colorpickerpopup->set_name("ColorPickerPopup");
|
||||||
|
|
||||||
|
colorpickerpopup->set_name("ColorPickerPopup");
|
||||||
|
//colorpickerpopup->set("name", ColorPickerPopup));
|
||||||
|
|
||||||
|
colorpickerpopup->set_filename("res://addons/mat_maker_gd/widgets/color_picker_popup/color_picker_popup.tscn");
|
||||||
|
//colorpickerpopup->set("filename", "res://addons/mat_maker_gd/widgets/color_picker_popup/color_picker_popup.tscn");
|
||||||
|
|
||||||
|
colorpickerpopup->set_margin_right(316);
|
||||||
|
//colorpickerpopup->set("margin_right", 316);
|
||||||
|
|
||||||
|
colorpickerpopup->set_margin_bottom(470);
|
||||||
|
//colorpickerpopup->set("margin_bottom", 470);
|
||||||
|
|
||||||
|
colorpickerpopup->set_rect_size(Vector2(316, 470));
|
||||||
|
//colorpickerpopup->set("rect_size", Vector2(316, 470));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ColorPicker *colorpicker_colorpickerpopup = memnew(ColorPicker);
|
||||||
|
colorpicker_colorpickerpopup->set_name("ColorPicker");
|
||||||
|
colorpickerpopup->add_child(colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
colorpicker_colorpickerpopup->set_name("ColorPicker");
|
||||||
|
//colorpicker_colorpickerpopup->set("name", ColorPicker));
|
||||||
|
|
||||||
|
//colorpicker_colorpickerpopup property owner TYPE_OBJECT value: ColorPickerPopup:[PopupPanel:62683]
|
||||||
|
|
||||||
|
colorpicker_colorpickerpopup->set_margin_left(8);
|
||||||
|
//colorpicker_colorpickerpopup->set("margin_left", 8);
|
||||||
|
|
||||||
|
colorpicker_colorpickerpopup->set_margin_top(8);
|
||||||
|
//colorpicker_colorpickerpopup->set("margin_top", 8);
|
||||||
|
|
||||||
|
colorpicker_colorpickerpopup->set_margin_right(316);
|
||||||
|
//colorpicker_colorpickerpopup->set("margin_right", 316);
|
||||||
|
|
||||||
|
colorpicker_colorpickerpopup->set_margin_bottom(470);
|
||||||
|
//colorpicker_colorpickerpopup->set("margin_bottom", 470);
|
||||||
|
|
||||||
|
colorpicker_colorpickerpopup->set_rect_position(Vector2(8, 8));
|
||||||
|
//colorpicker_colorpickerpopup->set("rect_position", Vector2(8, 8));
|
||||||
|
|
||||||
|
colorpicker_colorpickerpopup->set_rect_global_position(Vector2(8, 8));
|
||||||
|
//colorpicker_colorpickerpopup->set("rect_global_position", Vector2(8, 8));
|
||||||
|
|
||||||
|
colorpicker_colorpickerpopup->set_rect_size(Vector2(308, 462));
|
||||||
|
//colorpicker_colorpickerpopup->set("rect_size", Vector2(308, 462));
|
||||||
|
|
||||||
|
//colorpicker_colorpickerpopup property __meta__ TYPE_DICTIONARY value: {_edit_use_anchors_:False}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
HBoxContainer *hboxcontainer_colorpicker_colorpickerpopup = memnew(HBoxContainer);
|
||||||
|
hboxcontainer_colorpicker_colorpickerpopup->set_name("HBoxContainer");
|
||||||
|
colorpicker_colorpickerpopup->add_child(hboxcontainer_colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
hboxcontainer_colorpicker_colorpickerpopup->set_name("HBoxContainer");
|
||||||
|
//hboxcontainer_colorpicker_colorpickerpopup->set("name", HBoxContainer));
|
||||||
|
|
||||||
|
hboxcontainer_colorpicker_colorpickerpopup->set_size_flags_vertical(3);
|
||||||
|
//hboxcontainer_colorpicker_colorpickerpopup->set("size_flags_vertical", 3);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Control *control_hboxcontainer_colorpicker_colorpickerpopup = memnew(Control);
|
||||||
|
control_hboxcontainer_colorpicker_colorpickerpopup->set_name("Control");
|
||||||
|
hboxcontainer_colorpicker_colorpickerpopup->add_child(control_hboxcontainer_colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
control_hboxcontainer_colorpicker_colorpickerpopup->set_name("Control");
|
||||||
|
//control_hboxcontainer_colorpicker_colorpickerpopup->set("name", Control));
|
||||||
|
|
||||||
|
control_hboxcontainer_colorpicker_colorpickerpopup->set_rect_min_size(Vector2(256, 256));
|
||||||
|
//control_hboxcontainer_colorpicker_colorpickerpopup->set("rect_min_size", Vector2(256, 256));
|
||||||
|
|
||||||
|
control_hboxcontainer_colorpicker_colorpickerpopup->set_mouse_filter(1);
|
||||||
|
//control_hboxcontainer_colorpicker_colorpickerpopup->set("mouse_filter", 1);
|
||||||
|
|
||||||
|
control_hboxcontainer_colorpicker_colorpickerpopup->set_size_flags_horizontal(3);
|
||||||
|
//control_hboxcontainer_colorpicker_colorpickerpopup->set("size_flags_horizontal", 3);
|
||||||
|
|
||||||
|
control_hboxcontainer_colorpicker_colorpickerpopup->set_size_flags_vertical(3);
|
||||||
|
//control_hboxcontainer_colorpicker_colorpickerpopup->set("size_flags_vertical", 3);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Control *control2_hboxcontainer_colorpicker_colorpickerpopup = memnew(Control);
|
||||||
|
control2_hboxcontainer_colorpicker_colorpickerpopup->set_name("Control2");
|
||||||
|
hboxcontainer_colorpicker_colorpickerpopup->add_child(control2_hboxcontainer_colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
control2_hboxcontainer_colorpicker_colorpickerpopup->set_name("Control2");
|
||||||
|
//control2_hboxcontainer_colorpicker_colorpickerpopup->set("name", Control2));
|
||||||
|
|
||||||
|
control2_hboxcontainer_colorpicker_colorpickerpopup->set_rect_min_size(Vector2(30, 0));
|
||||||
|
//control2_hboxcontainer_colorpicker_colorpickerpopup->set("rect_min_size", Vector2(30, 0));
|
||||||
|
|
||||||
|
control2_hboxcontainer_colorpicker_colorpickerpopup->set_size_flags_vertical(3);
|
||||||
|
//control2_hboxcontainer_colorpicker_colorpickerpopup->set("size_flags_vertical", 3);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
HBoxContainer *hboxcontainer2_colorpicker_colorpickerpopup = memnew(HBoxContainer);
|
||||||
|
hboxcontainer2_colorpicker_colorpickerpopup->set_name("HBoxContainer2");
|
||||||
|
colorpicker_colorpickerpopup->add_child(hboxcontainer2_colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
hboxcontainer2_colorpicker_colorpickerpopup->set_name("HBoxContainer2");
|
||||||
|
//hboxcontainer2_colorpicker_colorpickerpopup->set("name", HBoxContainer2));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
TextureRect *texturerect_hboxcontainer2_colorpicker_colorpickerpopup = memnew(TextureRect);
|
||||||
|
texturerect_hboxcontainer2_colorpicker_colorpickerpopup->set_name("TextureRect");
|
||||||
|
hboxcontainer2_colorpicker_colorpickerpopup->add_child(texturerect_hboxcontainer2_colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
texturerect_hboxcontainer2_colorpicker_colorpickerpopup->set_name("TextureRect");
|
||||||
|
//texturerect_hboxcontainer2_colorpicker_colorpickerpopup->set("name", TextureRect));
|
||||||
|
|
||||||
|
texturerect_hboxcontainer2_colorpicker_colorpickerpopup->set_size_flags_horizontal(3);
|
||||||
|
//texturerect_hboxcontainer2_colorpicker_colorpickerpopup->set("size_flags_horizontal", 3);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ToolButton *toolbutton_hboxcontainer2_colorpicker_colorpickerpopup = memnew(ToolButton);
|
||||||
|
toolbutton_hboxcontainer2_colorpicker_colorpickerpopup->set_name("ToolButton");
|
||||||
|
hboxcontainer2_colorpicker_colorpickerpopup->add_child(toolbutton_hboxcontainer2_colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
toolbutton_hboxcontainer2_colorpicker_colorpickerpopup->set_name("ToolButton");
|
||||||
|
//toolbutton_hboxcontainer2_colorpicker_colorpickerpopup->set("name", ToolButton));
|
||||||
|
|
||||||
|
toolbutton_hboxcontainer2_colorpicker_colorpickerpopup->set_hint_tooltip("Pick a color from the editor window.");
|
||||||
|
//toolbutton_hboxcontainer2_colorpicker_colorpickerpopup->set("hint_tooltip", "Pick a color from the editor window.");
|
||||||
|
|
||||||
|
toolbutton_hboxcontainer2_colorpicker_colorpickerpopup->set_toggle_mode(True);
|
||||||
|
//toolbutton_hboxcontainer2_colorpicker_colorpickerpopup->set("toggle_mode", True);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
VBoxContainer *vboxcontainer_colorpicker_colorpickerpopup = memnew(VBoxContainer);
|
||||||
|
vboxcontainer_colorpicker_colorpickerpopup->set_name("VBoxContainer");
|
||||||
|
colorpicker_colorpickerpopup->add_child(vboxcontainer_colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
vboxcontainer_colorpicker_colorpickerpopup->set_name("VBoxContainer");
|
||||||
|
//vboxcontainer_colorpicker_colorpickerpopup->set("name", VBoxContainer));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
HSeparator *hseparator_colorpicker_colorpickerpopup = memnew(HSeparator);
|
||||||
|
hseparator_colorpicker_colorpickerpopup->set_name("HSeparator");
|
||||||
|
colorpicker_colorpickerpopup->add_child(hseparator_colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
hseparator_colorpicker_colorpickerpopup->set_name("HSeparator");
|
||||||
|
//hseparator_colorpicker_colorpickerpopup->set("name", HSeparator));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
VBoxContainer *vboxcontainer2_colorpicker_colorpickerpopup = memnew(VBoxContainer);
|
||||||
|
vboxcontainer2_colorpicker_colorpickerpopup->set_name("VBoxContainer2");
|
||||||
|
colorpicker_colorpickerpopup->add_child(vboxcontainer2_colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
vboxcontainer2_colorpicker_colorpickerpopup->set_name("VBoxContainer2");
|
||||||
|
//vboxcontainer2_colorpicker_colorpickerpopup->set("name", VBoxContainer2));
|
||||||
|
|
||||||
|
vboxcontainer2_colorpicker_colorpickerpopup->set_size_flags_horizontal(3);
|
||||||
|
//vboxcontainer2_colorpicker_colorpickerpopup->set("size_flags_horizontal", 3);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
HBoxContainer *hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup = memnew(HBoxContainer);
|
||||||
|
hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->set_name("HBoxContainer");
|
||||||
|
vboxcontainer2_colorpicker_colorpickerpopup->add_child(hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->set_name("HBoxContainer");
|
||||||
|
//hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->set("name", HBoxContainer));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Label *label_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup = memnew(Label);
|
||||||
|
label_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->set_name("Label");
|
||||||
|
hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->add_child(label_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
label_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->set_name("Label");
|
||||||
|
//label_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->set("name", Label));
|
||||||
|
|
||||||
|
label_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->set_rect_min_size(Vector2(10, 0));
|
||||||
|
//label_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->set("rect_min_size", Vector2(10, 0));
|
||||||
|
|
||||||
|
label_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->set_text("R");
|
||||||
|
//label_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->set("text", "R");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
HSlider *hslider_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup = memnew(HSlider);
|
||||||
|
hslider_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->set_name("HSlider");
|
||||||
|
hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->add_child(hslider_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
hslider_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->set_name("HSlider");
|
||||||
|
//hslider_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->set("name", HSlider));
|
||||||
|
|
||||||
|
hslider_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->set_focus_mode(0);
|
||||||
|
//hslider_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->set("focus_mode", 0);
|
||||||
|
|
||||||
|
hslider_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->set_size_flags_horizontal(3);
|
||||||
|
//hslider_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->set("size_flags_horizontal", 3);
|
||||||
|
|
||||||
|
hslider_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->set_size_flags_vertical(4);
|
||||||
|
//hslider_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->set("size_flags_vertical", 4);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
SpinBox *spinbox_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup = memnew(SpinBox);
|
||||||
|
spinbox_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->set_name("SpinBox");
|
||||||
|
hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->add_child(spinbox_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
spinbox_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->set_name("SpinBox");
|
||||||
|
//spinbox_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->set("name", SpinBox));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
LineEdit *lineedit_spinbox_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup = memnew(LineEdit);
|
||||||
|
lineedit_spinbox_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->set_name("LineEdit");
|
||||||
|
spinbox_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->add_child(lineedit_spinbox_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
lineedit_spinbox_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->set_name("LineEdit");
|
||||||
|
//lineedit_spinbox_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->set("name", LineEdit));
|
||||||
|
|
||||||
|
lineedit_spinbox_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->set_anchor_right(1);
|
||||||
|
//lineedit_spinbox_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->set("anchor_right", 1);
|
||||||
|
|
||||||
|
lineedit_spinbox_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->set_anchor_bottom(1);
|
||||||
|
//lineedit_spinbox_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->set("anchor_bottom", 1);
|
||||||
|
|
||||||
|
lineedit_spinbox_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->set_rect_size(Vector2(58, 24));
|
||||||
|
//lineedit_spinbox_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->set("rect_size", Vector2(58, 24));
|
||||||
|
|
||||||
|
lineedit_spinbox_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->set_mouse_filter(1);
|
||||||
|
//lineedit_spinbox_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->set("mouse_filter", 1);
|
||||||
|
|
||||||
|
lineedit_spinbox_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->set_text("0");
|
||||||
|
//lineedit_spinbox_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->set("text", "0");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Timer *timer_lineedit_spinbox_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup = memnew(Timer);
|
||||||
|
timer_lineedit_spinbox_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->set_name("Timer");
|
||||||
|
lineedit_spinbox_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->add_child(timer_lineedit_spinbox_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
timer_lineedit_spinbox_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->set_name("Timer");
|
||||||
|
//timer_lineedit_spinbox_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->set("name", Timer));
|
||||||
|
|
||||||
|
timer_lineedit_spinbox_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->set_wait_time(0.65);
|
||||||
|
//timer_lineedit_spinbox_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->set("wait_time", 0.65);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
PopupMenu *popupmenu_lineedit_spinbox_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup = memnew(PopupMenu);
|
||||||
|
popupmenu_lineedit_spinbox_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->set_name("PopupMenu");
|
||||||
|
lineedit_spinbox_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->add_child(popupmenu_lineedit_spinbox_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
popupmenu_lineedit_spinbox_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->set_name("PopupMenu");
|
||||||
|
//popupmenu_lineedit_spinbox_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->set("name", PopupMenu));
|
||||||
|
|
||||||
|
//popupmenu_lineedit_spinbox_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup property items TYPE_ARRAY value: [Cut, [Object:null], 0, False, False, 0, 268435544, Null, , False, Copy, [Object:null], 0, False, False, 1, 268435523, Null, , False, Paste, [Object:null], 0, False, False, 2, 268435542, Null, , False, , [Object:null], 0, False, False, -1, 0, Null, , True, Select All, [Object:null], 0, False, False, 4, 268435521, Null, , False, Clear, [Object:null], 0, False, False, 3, 0, Null, , False, , [Object:null], 0, False, False, -1, 0, Null, , True, Undo, [Object:null], 0, False, False, 5, 268435546, Null, , False, Redo, [Object:null], 0, False, False, 6, 301989978, Null, , False]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Timer *timer_popupmenu_lineedit_spinbox_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup = memnew(Timer);
|
||||||
|
timer_popupmenu_lineedit_spinbox_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->set_name("Timer");
|
||||||
|
popupmenu_lineedit_spinbox_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->add_child(timer_popupmenu_lineedit_spinbox_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
timer_popupmenu_lineedit_spinbox_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->set_name("Timer");
|
||||||
|
//timer_popupmenu_lineedit_spinbox_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->set("name", Timer));
|
||||||
|
|
||||||
|
timer_popupmenu_lineedit_spinbox_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->set_wait_time(0.3);
|
||||||
|
//timer_popupmenu_lineedit_spinbox_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->set("wait_time", 0.3);
|
||||||
|
|
||||||
|
timer_popupmenu_lineedit_spinbox_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->set_one_shot(True);
|
||||||
|
//timer_popupmenu_lineedit_spinbox_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->set("one_shot", True);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Timer *timer_spinbox_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup = memnew(Timer);
|
||||||
|
timer_spinbox_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->set_name("Timer");
|
||||||
|
spinbox_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->add_child(timer_spinbox_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
timer_spinbox_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->set_name("Timer");
|
||||||
|
//timer_spinbox_hboxcontainer_vboxcontainer2_colorpicker_colorpickerpopup->set("name", Timer));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
HBoxContainer *hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup = memnew(HBoxContainer);
|
||||||
|
hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->set_name("HBoxContainer2");
|
||||||
|
vboxcontainer2_colorpicker_colorpickerpopup->add_child(hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->set_name("HBoxContainer2");
|
||||||
|
//hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->set("name", HBoxContainer2));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Label *label_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup = memnew(Label);
|
||||||
|
label_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->set_name("Label");
|
||||||
|
hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->add_child(label_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
label_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->set_name("Label");
|
||||||
|
//label_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->set("name", Label));
|
||||||
|
|
||||||
|
label_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->set_rect_min_size(Vector2(10, 0));
|
||||||
|
//label_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->set("rect_min_size", Vector2(10, 0));
|
||||||
|
|
||||||
|
label_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->set_text("G");
|
||||||
|
//label_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->set("text", "G");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
HSlider *hslider_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup = memnew(HSlider);
|
||||||
|
hslider_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->set_name("HSlider");
|
||||||
|
hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->add_child(hslider_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
hslider_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->set_name("HSlider");
|
||||||
|
//hslider_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->set("name", HSlider));
|
||||||
|
|
||||||
|
hslider_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->set_focus_mode(0);
|
||||||
|
//hslider_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->set("focus_mode", 0);
|
||||||
|
|
||||||
|
hslider_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->set_size_flags_horizontal(3);
|
||||||
|
//hslider_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->set("size_flags_horizontal", 3);
|
||||||
|
|
||||||
|
hslider_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->set_size_flags_vertical(4);
|
||||||
|
//hslider_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->set("size_flags_vertical", 4);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
SpinBox *spinbox_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup = memnew(SpinBox);
|
||||||
|
spinbox_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->set_name("SpinBox");
|
||||||
|
hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->add_child(spinbox_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
spinbox_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->set_name("SpinBox");
|
||||||
|
//spinbox_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->set("name", SpinBox));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
LineEdit *lineedit_spinbox_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup = memnew(LineEdit);
|
||||||
|
lineedit_spinbox_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->set_name("LineEdit");
|
||||||
|
spinbox_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->add_child(lineedit_spinbox_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
lineedit_spinbox_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->set_name("LineEdit");
|
||||||
|
//lineedit_spinbox_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->set("name", LineEdit));
|
||||||
|
|
||||||
|
lineedit_spinbox_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->set_anchor_right(1);
|
||||||
|
//lineedit_spinbox_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->set("anchor_right", 1);
|
||||||
|
|
||||||
|
lineedit_spinbox_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->set_anchor_bottom(1);
|
||||||
|
//lineedit_spinbox_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->set("anchor_bottom", 1);
|
||||||
|
|
||||||
|
lineedit_spinbox_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->set_rect_size(Vector2(58, 24));
|
||||||
|
//lineedit_spinbox_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->set("rect_size", Vector2(58, 24));
|
||||||
|
|
||||||
|
lineedit_spinbox_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->set_mouse_filter(1);
|
||||||
|
//lineedit_spinbox_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->set("mouse_filter", 1);
|
||||||
|
|
||||||
|
lineedit_spinbox_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->set_text("0");
|
||||||
|
//lineedit_spinbox_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->set("text", "0");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Timer *timer_lineedit_spinbox_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup = memnew(Timer);
|
||||||
|
timer_lineedit_spinbox_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->set_name("Timer");
|
||||||
|
lineedit_spinbox_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->add_child(timer_lineedit_spinbox_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
timer_lineedit_spinbox_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->set_name("Timer");
|
||||||
|
//timer_lineedit_spinbox_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->set("name", Timer));
|
||||||
|
|
||||||
|
timer_lineedit_spinbox_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->set_wait_time(0.65);
|
||||||
|
//timer_lineedit_spinbox_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->set("wait_time", 0.65);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
PopupMenu *popupmenu_lineedit_spinbox_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup = memnew(PopupMenu);
|
||||||
|
popupmenu_lineedit_spinbox_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->set_name("PopupMenu");
|
||||||
|
lineedit_spinbox_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->add_child(popupmenu_lineedit_spinbox_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
popupmenu_lineedit_spinbox_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->set_name("PopupMenu");
|
||||||
|
//popupmenu_lineedit_spinbox_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->set("name", PopupMenu));
|
||||||
|
|
||||||
|
//popupmenu_lineedit_spinbox_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup property items TYPE_ARRAY value: [Cut, [Object:null], 0, False, False, 0, 268435544, Null, , False, Copy, [Object:null], 0, False, False, 1, 268435523, Null, , False, Paste, [Object:null], 0, False, False, 2, 268435542, Null, , False, , [Object:null], 0, False, False, -1, 0, Null, , True, Select All, [Object:null], 0, False, False, 4, 268435521, Null, , False, Clear, [Object:null], 0, False, False, 3, 0, Null, , False, , [Object:null], 0, False, False, -1, 0, Null, , True, Undo, [Object:null], 0, False, False, 5, 268435546, Null, , False, Redo, [Object:null], 0, False, False, 6, 301989978, Null, , False]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Timer *timer_popupmenu_lineedit_spinbox_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup = memnew(Timer);
|
||||||
|
timer_popupmenu_lineedit_spinbox_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->set_name("Timer");
|
||||||
|
popupmenu_lineedit_spinbox_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->add_child(timer_popupmenu_lineedit_spinbox_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
timer_popupmenu_lineedit_spinbox_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->set_name("Timer");
|
||||||
|
//timer_popupmenu_lineedit_spinbox_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->set("name", Timer));
|
||||||
|
|
||||||
|
timer_popupmenu_lineedit_spinbox_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->set_wait_time(0.3);
|
||||||
|
//timer_popupmenu_lineedit_spinbox_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->set("wait_time", 0.3);
|
||||||
|
|
||||||
|
timer_popupmenu_lineedit_spinbox_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->set_one_shot(True);
|
||||||
|
//timer_popupmenu_lineedit_spinbox_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->set("one_shot", True);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Timer *timer_spinbox_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup = memnew(Timer);
|
||||||
|
timer_spinbox_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->set_name("Timer");
|
||||||
|
spinbox_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->add_child(timer_spinbox_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
timer_spinbox_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->set_name("Timer");
|
||||||
|
//timer_spinbox_hboxcontainer2_vboxcontainer2_colorpicker_colorpickerpopup->set("name", Timer));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
HBoxContainer *hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup = memnew(HBoxContainer);
|
||||||
|
hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->set_name("HBoxContainer3");
|
||||||
|
vboxcontainer2_colorpicker_colorpickerpopup->add_child(hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->set_name("HBoxContainer3");
|
||||||
|
//hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->set("name", HBoxContainer3));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Label *label_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup = memnew(Label);
|
||||||
|
label_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->set_name("Label");
|
||||||
|
hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->add_child(label_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
label_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->set_name("Label");
|
||||||
|
//label_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->set("name", Label));
|
||||||
|
|
||||||
|
label_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->set_rect_min_size(Vector2(10, 0));
|
||||||
|
//label_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->set("rect_min_size", Vector2(10, 0));
|
||||||
|
|
||||||
|
label_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->set_text("B");
|
||||||
|
//label_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->set("text", "B");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
HSlider *hslider_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup = memnew(HSlider);
|
||||||
|
hslider_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->set_name("HSlider");
|
||||||
|
hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->add_child(hslider_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
hslider_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->set_name("HSlider");
|
||||||
|
//hslider_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->set("name", HSlider));
|
||||||
|
|
||||||
|
hslider_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->set_focus_mode(0);
|
||||||
|
//hslider_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->set("focus_mode", 0);
|
||||||
|
|
||||||
|
hslider_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->set_size_flags_horizontal(3);
|
||||||
|
//hslider_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->set("size_flags_horizontal", 3);
|
||||||
|
|
||||||
|
hslider_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->set_size_flags_vertical(4);
|
||||||
|
//hslider_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->set("size_flags_vertical", 4);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
SpinBox *spinbox_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup = memnew(SpinBox);
|
||||||
|
spinbox_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->set_name("SpinBox");
|
||||||
|
hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->add_child(spinbox_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
spinbox_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->set_name("SpinBox");
|
||||||
|
//spinbox_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->set("name", SpinBox));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
LineEdit *lineedit_spinbox_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup = memnew(LineEdit);
|
||||||
|
lineedit_spinbox_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->set_name("LineEdit");
|
||||||
|
spinbox_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->add_child(lineedit_spinbox_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
lineedit_spinbox_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->set_name("LineEdit");
|
||||||
|
//lineedit_spinbox_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->set("name", LineEdit));
|
||||||
|
|
||||||
|
lineedit_spinbox_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->set_anchor_right(1);
|
||||||
|
//lineedit_spinbox_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->set("anchor_right", 1);
|
||||||
|
|
||||||
|
lineedit_spinbox_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->set_anchor_bottom(1);
|
||||||
|
//lineedit_spinbox_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->set("anchor_bottom", 1);
|
||||||
|
|
||||||
|
lineedit_spinbox_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->set_rect_size(Vector2(58, 24));
|
||||||
|
//lineedit_spinbox_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->set("rect_size", Vector2(58, 24));
|
||||||
|
|
||||||
|
lineedit_spinbox_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->set_mouse_filter(1);
|
||||||
|
//lineedit_spinbox_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->set("mouse_filter", 1);
|
||||||
|
|
||||||
|
lineedit_spinbox_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->set_text("0");
|
||||||
|
//lineedit_spinbox_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->set("text", "0");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Timer *timer_lineedit_spinbox_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup = memnew(Timer);
|
||||||
|
timer_lineedit_spinbox_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->set_name("Timer");
|
||||||
|
lineedit_spinbox_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->add_child(timer_lineedit_spinbox_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
timer_lineedit_spinbox_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->set_name("Timer");
|
||||||
|
//timer_lineedit_spinbox_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->set("name", Timer));
|
||||||
|
|
||||||
|
timer_lineedit_spinbox_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->set_wait_time(0.65);
|
||||||
|
//timer_lineedit_spinbox_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->set("wait_time", 0.65);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
PopupMenu *popupmenu_lineedit_spinbox_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup = memnew(PopupMenu);
|
||||||
|
popupmenu_lineedit_spinbox_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->set_name("PopupMenu");
|
||||||
|
lineedit_spinbox_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->add_child(popupmenu_lineedit_spinbox_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
popupmenu_lineedit_spinbox_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->set_name("PopupMenu");
|
||||||
|
//popupmenu_lineedit_spinbox_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->set("name", PopupMenu));
|
||||||
|
|
||||||
|
//popupmenu_lineedit_spinbox_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup property items TYPE_ARRAY value: [Cut, [Object:null], 0, False, False, 0, 268435544, Null, , False, Copy, [Object:null], 0, False, False, 1, 268435523, Null, , False, Paste, [Object:null], 0, False, False, 2, 268435542, Null, , False, , [Object:null], 0, False, False, -1, 0, Null, , True, Select All, [Object:null], 0, False, False, 4, 268435521, Null, , False, Clear, [Object:null], 0, False, False, 3, 0, Null, , False, , [Object:null], 0, False, False, -1, 0, Null, , True, Undo, [Object:null], 0, False, False, 5, 268435546, Null, , False, Redo, [Object:null], 0, False, False, 6, 301989978, Null, , False]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Timer *timer_popupmenu_lineedit_spinbox_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup = memnew(Timer);
|
||||||
|
timer_popupmenu_lineedit_spinbox_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->set_name("Timer");
|
||||||
|
popupmenu_lineedit_spinbox_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->add_child(timer_popupmenu_lineedit_spinbox_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
timer_popupmenu_lineedit_spinbox_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->set_name("Timer");
|
||||||
|
//timer_popupmenu_lineedit_spinbox_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->set("name", Timer));
|
||||||
|
|
||||||
|
timer_popupmenu_lineedit_spinbox_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->set_wait_time(0.3);
|
||||||
|
//timer_popupmenu_lineedit_spinbox_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->set("wait_time", 0.3);
|
||||||
|
|
||||||
|
timer_popupmenu_lineedit_spinbox_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->set_one_shot(True);
|
||||||
|
//timer_popupmenu_lineedit_spinbox_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->set("one_shot", True);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Timer *timer_spinbox_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup = memnew(Timer);
|
||||||
|
timer_spinbox_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->set_name("Timer");
|
||||||
|
spinbox_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->add_child(timer_spinbox_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
timer_spinbox_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->set_name("Timer");
|
||||||
|
//timer_spinbox_hboxcontainer3_vboxcontainer2_colorpicker_colorpickerpopup->set("name", Timer));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
HBoxContainer *hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup = memnew(HBoxContainer);
|
||||||
|
hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->set_name("HBoxContainer4");
|
||||||
|
vboxcontainer2_colorpicker_colorpickerpopup->add_child(hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->set_name("HBoxContainer4");
|
||||||
|
//hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->set("name", HBoxContainer4));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Label *label_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup = memnew(Label);
|
||||||
|
label_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->set_name("Label");
|
||||||
|
hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->add_child(label_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
label_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->set_name("Label");
|
||||||
|
//label_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->set("name", Label));
|
||||||
|
|
||||||
|
label_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->set_rect_min_size(Vector2(10, 0));
|
||||||
|
//label_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->set("rect_min_size", Vector2(10, 0));
|
||||||
|
|
||||||
|
label_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->set_text("A");
|
||||||
|
//label_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->set("text", "A");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
HSlider *hslider_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup = memnew(HSlider);
|
||||||
|
hslider_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->set_name("HSlider");
|
||||||
|
hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->add_child(hslider_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
hslider_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->set_name("HSlider");
|
||||||
|
//hslider_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->set("name", HSlider));
|
||||||
|
|
||||||
|
hslider_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->set_focus_mode(0);
|
||||||
|
//hslider_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->set("focus_mode", 0);
|
||||||
|
|
||||||
|
hslider_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->set_size_flags_horizontal(3);
|
||||||
|
//hslider_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->set("size_flags_horizontal", 3);
|
||||||
|
|
||||||
|
hslider_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->set_size_flags_vertical(4);
|
||||||
|
//hslider_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->set("size_flags_vertical", 4);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
SpinBox *spinbox_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup = memnew(SpinBox);
|
||||||
|
spinbox_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->set_name("SpinBox");
|
||||||
|
hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->add_child(spinbox_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
spinbox_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->set_name("SpinBox");
|
||||||
|
//spinbox_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->set("name", SpinBox));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
LineEdit *lineedit_spinbox_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup = memnew(LineEdit);
|
||||||
|
lineedit_spinbox_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->set_name("LineEdit");
|
||||||
|
spinbox_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->add_child(lineedit_spinbox_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
lineedit_spinbox_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->set_name("LineEdit");
|
||||||
|
//lineedit_spinbox_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->set("name", LineEdit));
|
||||||
|
|
||||||
|
lineedit_spinbox_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->set_anchor_right(1);
|
||||||
|
//lineedit_spinbox_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->set("anchor_right", 1);
|
||||||
|
|
||||||
|
lineedit_spinbox_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->set_anchor_bottom(1);
|
||||||
|
//lineedit_spinbox_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->set("anchor_bottom", 1);
|
||||||
|
|
||||||
|
lineedit_spinbox_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->set_rect_size(Vector2(58, 24));
|
||||||
|
//lineedit_spinbox_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->set("rect_size", Vector2(58, 24));
|
||||||
|
|
||||||
|
lineedit_spinbox_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->set_mouse_filter(1);
|
||||||
|
//lineedit_spinbox_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->set("mouse_filter", 1);
|
||||||
|
|
||||||
|
lineedit_spinbox_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->set_text("0");
|
||||||
|
//lineedit_spinbox_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->set("text", "0");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Timer *timer_lineedit_spinbox_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup = memnew(Timer);
|
||||||
|
timer_lineedit_spinbox_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->set_name("Timer");
|
||||||
|
lineedit_spinbox_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->add_child(timer_lineedit_spinbox_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
timer_lineedit_spinbox_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->set_name("Timer");
|
||||||
|
//timer_lineedit_spinbox_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->set("name", Timer));
|
||||||
|
|
||||||
|
timer_lineedit_spinbox_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->set_wait_time(0.65);
|
||||||
|
//timer_lineedit_spinbox_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->set("wait_time", 0.65);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
PopupMenu *popupmenu_lineedit_spinbox_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup = memnew(PopupMenu);
|
||||||
|
popupmenu_lineedit_spinbox_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->set_name("PopupMenu");
|
||||||
|
lineedit_spinbox_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->add_child(popupmenu_lineedit_spinbox_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
popupmenu_lineedit_spinbox_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->set_name("PopupMenu");
|
||||||
|
//popupmenu_lineedit_spinbox_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->set("name", PopupMenu));
|
||||||
|
|
||||||
|
//popupmenu_lineedit_spinbox_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup property items TYPE_ARRAY value: [Cut, [Object:null], 0, False, False, 0, 268435544, Null, , False, Copy, [Object:null], 0, False, False, 1, 268435523, Null, , False, Paste, [Object:null], 0, False, False, 2, 268435542, Null, , False, , [Object:null], 0, False, False, -1, 0, Null, , True, Select All, [Object:null], 0, False, False, 4, 268435521, Null, , False, Clear, [Object:null], 0, False, False, 3, 0, Null, , False, , [Object:null], 0, False, False, -1, 0, Null, , True, Undo, [Object:null], 0, False, False, 5, 268435546, Null, , False, Redo, [Object:null], 0, False, False, 6, 301989978, Null, , False]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Timer *timer_popupmenu_lineedit_spinbox_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup = memnew(Timer);
|
||||||
|
timer_popupmenu_lineedit_spinbox_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->set_name("Timer");
|
||||||
|
popupmenu_lineedit_spinbox_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->add_child(timer_popupmenu_lineedit_spinbox_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
timer_popupmenu_lineedit_spinbox_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->set_name("Timer");
|
||||||
|
//timer_popupmenu_lineedit_spinbox_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->set("name", Timer));
|
||||||
|
|
||||||
|
timer_popupmenu_lineedit_spinbox_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->set_wait_time(0.3);
|
||||||
|
//timer_popupmenu_lineedit_spinbox_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->set("wait_time", 0.3);
|
||||||
|
|
||||||
|
timer_popupmenu_lineedit_spinbox_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->set_one_shot(True);
|
||||||
|
//timer_popupmenu_lineedit_spinbox_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->set("one_shot", True);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Timer *timer_spinbox_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup = memnew(Timer);
|
||||||
|
timer_spinbox_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->set_name("Timer");
|
||||||
|
spinbox_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->add_child(timer_spinbox_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
timer_spinbox_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->set_name("Timer");
|
||||||
|
//timer_spinbox_hboxcontainer4_vboxcontainer2_colorpicker_colorpickerpopup->set("name", Timer));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
HBoxContainer *hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup = memnew(HBoxContainer);
|
||||||
|
hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup->set_name("HBoxContainer5");
|
||||||
|
vboxcontainer2_colorpicker_colorpickerpopup->add_child(hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup->set_name("HBoxContainer5");
|
||||||
|
//hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup->set("name", HBoxContainer5));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CheckButton *checkbutton_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup = memnew(CheckButton);
|
||||||
|
checkbutton_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup->set_name("CheckButton");
|
||||||
|
hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup->add_child(checkbutton_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
checkbutton_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup->set_name("CheckButton");
|
||||||
|
//checkbutton_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup->set("name", CheckButton));
|
||||||
|
|
||||||
|
checkbutton_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup->set_text("HSV");
|
||||||
|
//checkbutton_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup->set("text", "HSV");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CheckButton *checkbutton2_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup = memnew(CheckButton);
|
||||||
|
checkbutton2_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup->set_name("CheckButton2");
|
||||||
|
hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup->add_child(checkbutton2_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
checkbutton2_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup->set_name("CheckButton2");
|
||||||
|
//checkbutton2_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup->set("name", CheckButton2));
|
||||||
|
|
||||||
|
checkbutton2_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup->set_text("Raw");
|
||||||
|
//checkbutton2_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup->set("text", "Raw");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Button *button_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup = memnew(Button);
|
||||||
|
button_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup->set_name("Button");
|
||||||
|
hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup->add_child(button_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
button_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup->set_name("Button");
|
||||||
|
//button_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup->set("name", Button));
|
||||||
|
|
||||||
|
button_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup->set_rect_min_size(Vector2(28, 0));
|
||||||
|
//button_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup->set("rect_min_size", Vector2(28, 0));
|
||||||
|
|
||||||
|
button_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup->set_hint_tooltip("Switch between hexadecimal and code values.");
|
||||||
|
//button_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup->set("hint_tooltip", "Switch between hexadecimal and code values.");
|
||||||
|
|
||||||
|
button_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup->set_text("#");
|
||||||
|
//button_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup->set("text", "#");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
LineEdit *lineedit_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup = memnew(LineEdit);
|
||||||
|
lineedit_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup->set_name("LineEdit");
|
||||||
|
hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup->add_child(lineedit_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
lineedit_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup->set_name("LineEdit");
|
||||||
|
//lineedit_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup->set("name", LineEdit));
|
||||||
|
|
||||||
|
lineedit_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup->set_size_flags_horizontal(3);
|
||||||
|
//lineedit_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup->set("size_flags_horizontal", 3);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Timer *timer_lineedit_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup = memnew(Timer);
|
||||||
|
timer_lineedit_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup->set_name("Timer");
|
||||||
|
lineedit_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup->add_child(timer_lineedit_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
timer_lineedit_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup->set_name("Timer");
|
||||||
|
//timer_lineedit_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup->set("name", Timer));
|
||||||
|
|
||||||
|
timer_lineedit_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup->set_wait_time(0.65);
|
||||||
|
//timer_lineedit_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup->set("wait_time", 0.65);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
PopupMenu *popupmenu_lineedit_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup = memnew(PopupMenu);
|
||||||
|
popupmenu_lineedit_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup->set_name("PopupMenu");
|
||||||
|
lineedit_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup->add_child(popupmenu_lineedit_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
popupmenu_lineedit_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup->set_name("PopupMenu");
|
||||||
|
//popupmenu_lineedit_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup->set("name", PopupMenu));
|
||||||
|
|
||||||
|
//popupmenu_lineedit_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup property items TYPE_ARRAY value: [Cut, [Object:null], 0, False, False, 0, 268435544, Null, , False, Copy, [Object:null], 0, False, False, 1, 268435523, Null, , False, Paste, [Object:null], 0, False, False, 2, 268435542, Null, , False, , [Object:null], 0, False, False, -1, 0, Null, , True, Select All, [Object:null], 0, False, False, 4, 268435521, Null, , False, Clear, [Object:null], 0, False, False, 3, 0, Null, , False, , [Object:null], 0, False, False, -1, 0, Null, , True, Undo, [Object:null], 0, False, False, 5, 268435546, Null, , False, Redo, [Object:null], 0, False, False, 6, 301989978, Null, , False]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Timer *timer_popupmenu_lineedit_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup = memnew(Timer);
|
||||||
|
timer_popupmenu_lineedit_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup->set_name("Timer");
|
||||||
|
popupmenu_lineedit_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup->add_child(timer_popupmenu_lineedit_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
timer_popupmenu_lineedit_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup->set_name("Timer");
|
||||||
|
//timer_popupmenu_lineedit_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup->set("name", Timer));
|
||||||
|
|
||||||
|
timer_popupmenu_lineedit_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup->set_wait_time(0.3);
|
||||||
|
//timer_popupmenu_lineedit_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup->set("wait_time", 0.3);
|
||||||
|
|
||||||
|
timer_popupmenu_lineedit_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup->set_one_shot(True);
|
||||||
|
//timer_popupmenu_lineedit_hboxcontainer5_vboxcontainer2_colorpicker_colorpickerpopup->set("one_shot", True);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
HSeparator *hseparator2_colorpicker_colorpickerpopup = memnew(HSeparator);
|
||||||
|
hseparator2_colorpicker_colorpickerpopup->set_name("HSeparator2");
|
||||||
|
colorpicker_colorpickerpopup->add_child(hseparator2_colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
hseparator2_colorpicker_colorpickerpopup->set_name("HSeparator2");
|
||||||
|
//hseparator2_colorpicker_colorpickerpopup->set("name", HSeparator2));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
GridContainer *gridcontainer_colorpicker_colorpickerpopup = memnew(GridContainer);
|
||||||
|
gridcontainer_colorpicker_colorpickerpopup->set_name("GridContainer");
|
||||||
|
colorpicker_colorpickerpopup->add_child(gridcontainer_colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
gridcontainer_colorpicker_colorpickerpopup->set_name("GridContainer");
|
||||||
|
//gridcontainer_colorpicker_colorpickerpopup->set("name", GridContainer));
|
||||||
|
|
||||||
|
gridcontainer_colorpicker_colorpickerpopup->set_size_flags_horizontal(3);
|
||||||
|
//gridcontainer_colorpicker_colorpickerpopup->set("size_flags_horizontal", 3);
|
||||||
|
|
||||||
|
gridcontainer_colorpicker_colorpickerpopup->set_columns(10);
|
||||||
|
//gridcontainer_colorpicker_colorpickerpopup->set("columns", 10);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Button *button_gridcontainer_colorpicker_colorpickerpopup = memnew(Button);
|
||||||
|
button_gridcontainer_colorpicker_colorpickerpopup->set_name("Button");
|
||||||
|
gridcontainer_colorpicker_colorpickerpopup->add_child(button_gridcontainer_colorpicker_colorpickerpopup);
|
||||||
|
|
||||||
|
button_gridcontainer_colorpicker_colorpickerpopup->set_name("Button");
|
||||||
|
//button_gridcontainer_colorpicker_colorpickerpopup->set("name", Button));
|
||||||
|
|
||||||
|
button_gridcontainer_colorpicker_colorpickerpopup->set_hint_tooltip("Add current color as a preset.");
|
||||||
|
//button_gridcontainer_colorpicker_colorpickerpopup->set("hint_tooltip", "Add current color as a preset.");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,233 @@
|
|||||||
|
|
||||||
|
#include "control_point.h"
|
||||||
|
|
||||||
|
|
||||||
|
Variant ControlPoint::get_Variant() {
|
||||||
|
return Variant;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ControlPoint::set_Variant(const Variant &val) {
|
||||||
|
Variant = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool ControlPoint::get_moving() const {
|
||||||
|
return moving;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ControlPoint::set_moving(const bool val) {
|
||||||
|
moving = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
float ControlPoint::get_min_x() const {
|
||||||
|
return min_x;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ControlPoint::set_min_x(const float val) {
|
||||||
|
min_x = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
float ControlPoint::get_max_x() const {
|
||||||
|
return max_x;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ControlPoint::set_max_x(const float val) {
|
||||||
|
max_x = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
float ControlPoint::get_min_y() const {
|
||||||
|
return min_y;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ControlPoint::set_min_y(const float val) {
|
||||||
|
min_y = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
float ControlPoint::get_max_y() const {
|
||||||
|
return max_y;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ControlPoint::set_max_y(const float val) {
|
||||||
|
max_y = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//tool;
|
||||||
|
//var MMCurve = preload("res://addons/mat_maker_gd/nodes/bases/curve_base.gd");
|
||||||
|
bool moving = false;
|
||||||
|
float min_x = ;
|
||||||
|
float max_x = ;
|
||||||
|
float min_y = ;
|
||||||
|
float max_y = ;
|
||||||
|
const OFFSET : Vector2 = Vector2(3, 3);
|
||||||
|
signal moved(index);
|
||||||
|
signal removed(index);
|
||||||
|
|
||||||
|
void ControlPoint::_ready() {
|
||||||
|
// Replace with function body.;
|
||||||
|
pass;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ControlPoint::_draw() {
|
||||||
|
// var current_theme : Theme = get_node("/root/MainWindow").theme;
|
||||||
|
// var color : Color = current_theme.get_color("font_color", "Label");
|
||||||
|
Color color = Color(1, 1, 1, 1);
|
||||||
|
|
||||||
|
for (c in get_children()) {
|
||||||
|
|
||||||
|
if (c.visible) {
|
||||||
|
draw_line(OFFSET, c.rect_position+OFFSET, color);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
draw_rect(Rect2(0, 0, 7, 7), color);
|
||||||
|
}
|
||||||
|
|
||||||
|
//p : MMCurve.Point;
|
||||||
|
|
||||||
|
void ControlPoint::initialize(const Variant &p) {
|
||||||
|
rect_position = get_parent().transform_point(p.p)-OFFSET;
|
||||||
|
|
||||||
|
if (p.ls != INF) {
|
||||||
|
$LeftSlope.rect_position = $LeftSlope.distance*(get_parent().rect_size*Vector2(1.0, -p.ls)).normalized();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (p.rs != INF) {
|
||||||
|
$RightSlope.rect_position = $RightSlope.distance*(get_parent().rect_size*Vector2(1.0, -p.rs)).normalized();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ControlPoint::set_constraint(const float x, const float X, const float y, const float Y) {
|
||||||
|
min_x = x;
|
||||||
|
max_x = X;
|
||||||
|
min_y = y;
|
||||||
|
max_y = Y;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ControlPoint::_on_ControlPoint_gui_input(const Variant &event) {
|
||||||
|
|
||||||
|
if (event is InputEventMouseButton) {
|
||||||
|
|
||||||
|
if (event.button_index == BUTTON_LEFT) {
|
||||||
|
|
||||||
|
if (event.pressed) {
|
||||||
|
moving = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
else {
|
||||||
|
moving = false;
|
||||||
|
get_parent().update_controls();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
else if (event.button_index == BUTTON_RIGHT && event.pressed) {
|
||||||
|
emit_signal("removed", get_index());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
else if (moving && event is InputEventMouseMotion) {
|
||||||
|
rect_position += event.relative;
|
||||||
|
|
||||||
|
if (rect_position.x < min_x) {
|
||||||
|
rect_position.x = min_x;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
else if (rect_position.x > max_x) {
|
||||||
|
rect_position.x = max_x;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (rect_position.y < min_y) {
|
||||||
|
rect_position.y = min_y;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
else if (rect_position.y > max_y) {
|
||||||
|
rect_position.y = max_y;
|
||||||
|
}
|
||||||
|
|
||||||
|
emit_signal("moved", get_index());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ControlPoint::update_tangents() {
|
||||||
|
update();
|
||||||
|
emit_signal("moved", get_index());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ControlPoint::ControlPoint() {
|
||||||
|
//var MMCurve = preload("res://addons/mat_maker_gd/nodes/bases/curve_base.gd");
|
||||||
|
moving = false;
|
||||||
|
min_x = ;
|
||||||
|
max_x = ;
|
||||||
|
min_y = ;
|
||||||
|
max_y = ;
|
||||||
|
}
|
||||||
|
|
||||||
|
ControlPoint::~ControlPoint() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void ControlPoint::_bind_methods() {
|
||||||
|
ClassDB::bind_method(D_METHOD("get_Variant"), &ControlPoint::get_Variant);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_Variant", "value"), &ControlPoint::set_Variant);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "Variant", PROPERTY_HINT_RESOURCE_TYPE, "Variant"), "set_Variant", "get_Variant");
|
||||||
|
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_moving"), &ControlPoint::get_moving);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_moving", "value"), &ControlPoint::set_moving);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "moving"), "set_moving", "get_moving");
|
||||||
|
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_min_x"), &ControlPoint::get_min_x);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_min_x", "value"), &ControlPoint::set_min_x);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::REAL, "min_x"), "set_min_x", "get_min_x");
|
||||||
|
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_max_x"), &ControlPoint::get_max_x);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_max_x", "value"), &ControlPoint::set_max_x);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::REAL, "max_x"), "set_max_x", "get_max_x");
|
||||||
|
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_min_y"), &ControlPoint::get_min_y);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_min_y", "value"), &ControlPoint::set_min_y);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::REAL, "min_y"), "set_min_y", "get_min_y");
|
||||||
|
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_max_y"), &ControlPoint::get_max_y);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_max_y", "value"), &ControlPoint::set_max_y);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::REAL, "max_y"), "set_max_y", "get_max_y");
|
||||||
|
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("_ready"), &ControlPoint::_ready);
|
||||||
|
ClassDB::bind_method(D_METHOD("_draw"), &ControlPoint::_draw);
|
||||||
|
ClassDB::bind_method(D_METHOD("initialize", "p"), &ControlPoint::initialize);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_constraint", "x", "X", "y", "Y"), &ControlPoint::set_constraint);
|
||||||
|
ClassDB::bind_method(D_METHOD("_on_ControlPoint_gui_input", "event"), &ControlPoint::_on_ControlPoint_gui_input);
|
||||||
|
ClassDB::bind_method(D_METHOD("update_tangents"), &ControlPoint::update_tangents);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,116 @@
|
|||||||
|
|
||||||
|
void construct() {
|
||||||
|
|
||||||
|
//Script: res://addons/mat_maker_gd/widgets/curve_edit/control_point.gd
|
||||||
|
Control *controlpoint = memnew(Control);
|
||||||
|
controlpoint->set_name("ControlPoint");
|
||||||
|
|
||||||
|
controlpoint->set_name("ControlPoint");
|
||||||
|
//controlpoint->set("name", ControlPoint));
|
||||||
|
|
||||||
|
controlpoint->set_filename("res://addons/mat_maker_gd/widgets/curve_edit/control_point.tscn");
|
||||||
|
//controlpoint->set("filename", "res://addons/mat_maker_gd/widgets/curve_edit/control_point.tscn");
|
||||||
|
|
||||||
|
controlpoint->set_margin_left(56.986401);
|
||||||
|
//controlpoint->set("margin_left", 56.986401);
|
||||||
|
|
||||||
|
controlpoint->set_margin_top(33.8615);
|
||||||
|
//controlpoint->set("margin_top", 33.8615);
|
||||||
|
|
||||||
|
controlpoint->set_margin_right(63.986401);
|
||||||
|
//controlpoint->set("margin_right", 63.986401);
|
||||||
|
|
||||||
|
controlpoint->set_margin_bottom(40.8615);
|
||||||
|
//controlpoint->set("margin_bottom", 40.8615);
|
||||||
|
|
||||||
|
controlpoint->set_rect_position(Vector2(56.986401, 33.8615));
|
||||||
|
//controlpoint->set("rect_position", Vector2(56.986401, 33.8615));
|
||||||
|
|
||||||
|
controlpoint->set_rect_global_position(Vector2(56.986401, 33.8615));
|
||||||
|
//controlpoint->set("rect_global_position", Vector2(56.986401, 33.8615));
|
||||||
|
|
||||||
|
controlpoint->set_rect_size(Vector2(7, 7));
|
||||||
|
//controlpoint->set("rect_size", Vector2(7, 7));
|
||||||
|
|
||||||
|
controlpoint->set_rect_min_size(Vector2(7, 7));
|
||||||
|
//controlpoint->set("rect_min_size", Vector2(7, 7));
|
||||||
|
|
||||||
|
//controlpoint property __meta__ TYPE_DICTIONARY value: {_edit_use_anchors_:False}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//Script: res://addons/mat_maker_gd/widgets/curve_edit/slope_point.gd
|
||||||
|
Control *leftslope_controlpoint = memnew(Control);
|
||||||
|
leftslope_controlpoint->set_name("LeftSlope");
|
||||||
|
controlpoint->add_child(leftslope_controlpoint);
|
||||||
|
|
||||||
|
leftslope_controlpoint->set_name("LeftSlope");
|
||||||
|
//leftslope_controlpoint->set("name", LeftSlope));
|
||||||
|
|
||||||
|
//leftslope_controlpoint property owner TYPE_OBJECT value: ControlPoint:[Control:59789]
|
||||||
|
|
||||||
|
leftslope_controlpoint->set_margin_left(-18.5235);
|
||||||
|
//leftslope_controlpoint->set("margin_left", -18.5235);
|
||||||
|
|
||||||
|
leftslope_controlpoint->set_margin_right(-11.5235);
|
||||||
|
//leftslope_controlpoint->set("margin_right", -11.5235);
|
||||||
|
|
||||||
|
leftslope_controlpoint->set_margin_bottom(7);
|
||||||
|
//leftslope_controlpoint->set("margin_bottom", 7);
|
||||||
|
|
||||||
|
leftslope_controlpoint->set_rect_position(Vector2(-18.5235, 0));
|
||||||
|
//leftslope_controlpoint->set("rect_position", Vector2(-18.5235, 0));
|
||||||
|
|
||||||
|
leftslope_controlpoint->set_rect_global_position(Vector2(-18.5235, 0));
|
||||||
|
//leftslope_controlpoint->set("rect_global_position", Vector2(-18.5235, 0));
|
||||||
|
|
||||||
|
leftslope_controlpoint->set_rect_size(Vector2(7, 7));
|
||||||
|
//leftslope_controlpoint->set("rect_size", Vector2(7, 7));
|
||||||
|
|
||||||
|
leftslope_controlpoint->set_rect_min_size(Vector2(7, 7));
|
||||||
|
//leftslope_controlpoint->set("rect_min_size", Vector2(7, 7));
|
||||||
|
|
||||||
|
//leftslope_controlpoint property __meta__ TYPE_DICTIONARY value: {_edit_use_anchors_:False}
|
||||||
|
|
||||||
|
leftslope_controlpoint->set_distance(-30);
|
||||||
|
//leftslope_controlpoint->set("distance", -30);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//Script: res://addons/mat_maker_gd/widgets/curve_edit/slope_point.gd
|
||||||
|
Control *rightslope_controlpoint = memnew(Control);
|
||||||
|
rightslope_controlpoint->set_name("RightSlope");
|
||||||
|
controlpoint->add_child(rightslope_controlpoint);
|
||||||
|
|
||||||
|
rightslope_controlpoint->set_name("RightSlope");
|
||||||
|
//rightslope_controlpoint->set("name", RightSlope));
|
||||||
|
|
||||||
|
//rightslope_controlpoint property owner TYPE_OBJECT value: ControlPoint:[Control:59789]
|
||||||
|
|
||||||
|
rightslope_controlpoint->set_margin_left(15.6919);
|
||||||
|
//rightslope_controlpoint->set("margin_left", 15.6919);
|
||||||
|
|
||||||
|
rightslope_controlpoint->set_margin_right(22.6919);
|
||||||
|
//rightslope_controlpoint->set("margin_right", 22.6919);
|
||||||
|
|
||||||
|
rightslope_controlpoint->set_margin_bottom(7);
|
||||||
|
//rightslope_controlpoint->set("margin_bottom", 7);
|
||||||
|
|
||||||
|
rightslope_controlpoint->set_rect_position(Vector2(15.6919, 0));
|
||||||
|
//rightslope_controlpoint->set("rect_position", Vector2(15.6919, 0));
|
||||||
|
|
||||||
|
rightslope_controlpoint->set_rect_global_position(Vector2(15.6919, 0));
|
||||||
|
//rightslope_controlpoint->set("rect_global_position", Vector2(15.6919, 0));
|
||||||
|
|
||||||
|
rightslope_controlpoint->set_rect_size(Vector2(7, 7));
|
||||||
|
//rightslope_controlpoint->set("rect_size", Vector2(7, 7));
|
||||||
|
|
||||||
|
//rightslope_controlpoint property __meta__ TYPE_DICTIONARY value: {_edit_use_anchors_:False}
|
||||||
|
|
||||||
|
rightslope_controlpoint->set_distance(30);
|
||||||
|
//rightslope_controlpoint->set("distance", 30);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,55 @@
|
|||||||
|
#ifndef CONTROL_POINT_H
|
||||||
|
#define CONTROL_POINT_H
|
||||||
|
|
||||||
|
|
||||||
|
class ControlPoint : public Control {
|
||||||
|
GDCLASS(ControlPoint, Control);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
Variant get_Variant();
|
||||||
|
void set_Variant(const Variant &val);
|
||||||
|
|
||||||
|
bool get_moving() const;
|
||||||
|
void set_moving(const bool val);
|
||||||
|
|
||||||
|
float get_min_x() const;
|
||||||
|
void set_min_x(const float val);
|
||||||
|
|
||||||
|
float get_max_x() const;
|
||||||
|
void set_max_x(const float val);
|
||||||
|
|
||||||
|
float get_min_y() const;
|
||||||
|
void set_min_y(const float val);
|
||||||
|
|
||||||
|
float get_max_y() const;
|
||||||
|
void set_max_y(const float val);
|
||||||
|
|
||||||
|
void _ready();
|
||||||
|
void _draw();
|
||||||
|
void initialize(const Variant &p);
|
||||||
|
void set_constraint(const float x, const float X, const float y, const float Y);
|
||||||
|
void _on_ControlPoint_gui_input(const Variant &event);
|
||||||
|
void update_tangents();
|
||||||
|
|
||||||
|
ControlPoint();
|
||||||
|
~ControlPoint();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
static void _bind_methods();
|
||||||
|
|
||||||
|
//tool
|
||||||
|
Variant = preload("res://addons/mat_maker_gd/nodes/bases/curve_base.gd");
|
||||||
|
bool moving = false;
|
||||||
|
float min_x = ;
|
||||||
|
float max_x = ;
|
||||||
|
float min_y = ;
|
||||||
|
float max_y = ;
|
||||||
|
const OFFSET : Vector2 = Vector2(3, 3);
|
||||||
|
signal moved(index);
|
||||||
|
signal removed(index);
|
||||||
|
//p : MMCurve.Point
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,115 @@
|
|||||||
|
|
||||||
|
#include "curve_dialog.h"
|
||||||
|
|
||||||
|
|
||||||
|
Variant CurveDialog::get_Variant() {
|
||||||
|
return Variant;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CurveDialog::set_Variant(const Variant &val) {
|
||||||
|
Variant = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Array CurveDialog::get_previous_points() {
|
||||||
|
return previous_points;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CurveDialog::set_previous_points(const Array &val) {
|
||||||
|
previous_points = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Variant CurveDialog::get_Variant() {
|
||||||
|
return Variant;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CurveDialog::set_Variant(const Variant &val) {
|
||||||
|
Variant = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//tool;
|
||||||
|
//var MMCurve = preload("res://addons/mat_maker_gd/nodes/bases/curve_base.gd");
|
||||||
|
Array previous_points = ;
|
||||||
|
Variant ;
|
||||||
|
signal curve_changed(curve);
|
||||||
|
// Called when the node enters the scene tree for the first time.;
|
||||||
|
|
||||||
|
void CurveDialog::_ready() {
|
||||||
|
// Replace with function body.;
|
||||||
|
pass;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CurveDialog::_on_CurveDialog_popup_hide() {
|
||||||
|
queue_free();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CurveDialog::_on_OK_pressed() {
|
||||||
|
emit_signal("curve_changed", curve);
|
||||||
|
curve.curve_changed();
|
||||||
|
queue_free();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CurveDialog::_on_Cancel_pressed() {
|
||||||
|
curve.set_points(previous_points);
|
||||||
|
emit_signal("curve_changed", curve);
|
||||||
|
queue_free();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CurveDialog::edit_curve(const Variant &c) {
|
||||||
|
curve = c;
|
||||||
|
previous_points = curve.get_points();
|
||||||
|
$VBoxContainer/EditorContainer/CurveEditor.set_curve(curve);
|
||||||
|
popup_centered();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CurveDialog::_on_CurveEditor_value_changed(const Variant &value) {
|
||||||
|
emit_signal("curve_changed", value);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CurveDialog::CurveDialog() {
|
||||||
|
//var MMCurve = preload("res://addons/mat_maker_gd/nodes/bases/curve_base.gd");
|
||||||
|
previous_points = ;
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
CurveDialog::~CurveDialog() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void CurveDialog::_bind_methods() {
|
||||||
|
ClassDB::bind_method(D_METHOD("get_Variant"), &CurveDialog::get_Variant);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_Variant", "value"), &CurveDialog::set_Variant);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "Variant", PROPERTY_HINT_RESOURCE_TYPE, "Variant"), "set_Variant", "get_Variant");
|
||||||
|
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_previous_points"), &CurveDialog::get_previous_points);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_previous_points", "value"), &CurveDialog::set_previous_points);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "previous_points"), "set_previous_points", "get_previous_points");
|
||||||
|
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_Variant"), &CurveDialog::get_Variant);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_Variant", "value"), &CurveDialog::set_Variant);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "Variant", PROPERTY_HINT_RESOURCE_TYPE, "Variant"), "set_Variant", "get_Variant");
|
||||||
|
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("_ready"), &CurveDialog::_ready);
|
||||||
|
ClassDB::bind_method(D_METHOD("_on_CurveDialog_popup_hide"), &CurveDialog::_on_CurveDialog_popup_hide);
|
||||||
|
ClassDB::bind_method(D_METHOD("_on_OK_pressed"), &CurveDialog::_on_OK_pressed);
|
||||||
|
ClassDB::bind_method(D_METHOD("_on_Cancel_pressed"), &CurveDialog::_on_Cancel_pressed);
|
||||||
|
ClassDB::bind_method(D_METHOD("edit_curve", "c"), &CurveDialog::edit_curve);
|
||||||
|
ClassDB::bind_method(D_METHOD("_on_CurveEditor_value_changed", "value"), &CurveDialog::_on_CurveEditor_value_changed);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,328 @@
|
|||||||
|
|
||||||
|
void construct() {
|
||||||
|
|
||||||
|
//Script: res://addons/mat_maker_gd/widgets/curve_edit/curve_dialog.gd
|
||||||
|
WindowDialog *curvedialog = memnew(WindowDialog);
|
||||||
|
curvedialog->set_name("CurveDialog");
|
||||||
|
|
||||||
|
curvedialog->set_name("CurveDialog");
|
||||||
|
//curvedialog->set("name", CurveDialog));
|
||||||
|
|
||||||
|
curvedialog->set_filename("res://addons/mat_maker_gd/widgets/curve_edit/curve_dialog.tscn");
|
||||||
|
//curvedialog->set("filename", "res://addons/mat_maker_gd/widgets/curve_edit/curve_dialog.tscn");
|
||||||
|
|
||||||
|
curvedialog->set_anchor_right(1);
|
||||||
|
//curvedialog->set("anchor_right", 1);
|
||||||
|
|
||||||
|
curvedialog->set_anchor_bottom(1);
|
||||||
|
//curvedialog->set("anchor_bottom", 1);
|
||||||
|
|
||||||
|
curvedialog->set_margin_left(307);
|
||||||
|
//curvedialog->set("margin_left", 307);
|
||||||
|
|
||||||
|
curvedialog->set_margin_top(151);
|
||||||
|
//curvedialog->set("margin_top", 151);
|
||||||
|
|
||||||
|
curvedialog->set_margin_right(-347);
|
||||||
|
//curvedialog->set("margin_right", -347);
|
||||||
|
|
||||||
|
curvedialog->set_margin_bottom(-174);
|
||||||
|
//curvedialog->set("margin_bottom", -174);
|
||||||
|
|
||||||
|
curvedialog->set_rect_position(Vector2(307, 151));
|
||||||
|
//curvedialog->set("rect_position", Vector2(307, 151));
|
||||||
|
|
||||||
|
curvedialog->set_rect_global_position(Vector2(307, 151));
|
||||||
|
//curvedialog->set("rect_global_position", Vector2(307, 151));
|
||||||
|
|
||||||
|
curvedialog->set_rect_size(Vector2(0, 1));
|
||||||
|
//curvedialog->set("rect_size", Vector2(0, 1));
|
||||||
|
|
||||||
|
curvedialog->set_window_title("Edit curve");
|
||||||
|
//curvedialog->set("window_title", "Edit curve");
|
||||||
|
|
||||||
|
//curvedialog property __meta__ TYPE_DICTIONARY value: {_edit_use_anchors_:False}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
TextureButton *texturebutton_curvedialog = memnew(TextureButton);
|
||||||
|
texturebutton_curvedialog->set_name("TextureButton");
|
||||||
|
curvedialog->add_child(texturebutton_curvedialog);
|
||||||
|
|
||||||
|
texturebutton_curvedialog->set_name("TextureButton");
|
||||||
|
//texturebutton_curvedialog->set("name", TextureButton));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
VBoxContainer *vboxcontainer_curvedialog = memnew(VBoxContainer);
|
||||||
|
vboxcontainer_curvedialog->set_name("VBoxContainer");
|
||||||
|
curvedialog->add_child(vboxcontainer_curvedialog);
|
||||||
|
|
||||||
|
vboxcontainer_curvedialog->set_name("VBoxContainer");
|
||||||
|
//vboxcontainer_curvedialog->set("name", VBoxContainer));
|
||||||
|
|
||||||
|
//vboxcontainer_curvedialog property owner TYPE_OBJECT value: CurveDialog:[WindowDialog:59762]
|
||||||
|
|
||||||
|
vboxcontainer_curvedialog->set_anchor_right(1);
|
||||||
|
//vboxcontainer_curvedialog->set("anchor_right", 1);
|
||||||
|
|
||||||
|
vboxcontainer_curvedialog->set_anchor_bottom(1);
|
||||||
|
//vboxcontainer_curvedialog->set("anchor_bottom", 1);
|
||||||
|
|
||||||
|
vboxcontainer_curvedialog->set_margin_left(5);
|
||||||
|
//vboxcontainer_curvedialog->set("margin_left", 5);
|
||||||
|
|
||||||
|
vboxcontainer_curvedialog->set_margin_top(5);
|
||||||
|
//vboxcontainer_curvedialog->set("margin_top", 5);
|
||||||
|
|
||||||
|
vboxcontainer_curvedialog->set_margin_right(-5);
|
||||||
|
//vboxcontainer_curvedialog->set("margin_right", -5);
|
||||||
|
|
||||||
|
vboxcontainer_curvedialog->set_margin_bottom(-5);
|
||||||
|
//vboxcontainer_curvedialog->set("margin_bottom", -5);
|
||||||
|
|
||||||
|
vboxcontainer_curvedialog->set_rect_position(Vector2(5, 5));
|
||||||
|
//vboxcontainer_curvedialog->set("rect_position", Vector2(5, 5));
|
||||||
|
|
||||||
|
vboxcontainer_curvedialog->set_rect_global_position(Vector2(5, 5));
|
||||||
|
//vboxcontainer_curvedialog->set("rect_global_position", Vector2(5, 5));
|
||||||
|
|
||||||
|
//vboxcontainer_curvedialog property __meta__ TYPE_DICTIONARY value: {_edit_use_anchors_:False}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
MarginContainer *editorcontainer_vboxcontainer_curvedialog = memnew(MarginContainer);
|
||||||
|
editorcontainer_vboxcontainer_curvedialog->set_name("EditorContainer");
|
||||||
|
vboxcontainer_curvedialog->add_child(editorcontainer_vboxcontainer_curvedialog);
|
||||||
|
|
||||||
|
editorcontainer_vboxcontainer_curvedialog->set_name("EditorContainer");
|
||||||
|
//editorcontainer_vboxcontainer_curvedialog->set("name", EditorContainer));
|
||||||
|
|
||||||
|
//editorcontainer_vboxcontainer_curvedialog property owner TYPE_OBJECT value: CurveDialog:[WindowDialog:59762]
|
||||||
|
|
||||||
|
editorcontainer_vboxcontainer_curvedialog->set_margin_right(616);
|
||||||
|
//editorcontainer_vboxcontainer_curvedialog->set("margin_right", 616);
|
||||||
|
|
||||||
|
editorcontainer_vboxcontainer_curvedialog->set_margin_bottom(353);
|
||||||
|
//editorcontainer_vboxcontainer_curvedialog->set("margin_bottom", 353);
|
||||||
|
|
||||||
|
editorcontainer_vboxcontainer_curvedialog->set_rect_size(Vector2(616, 353));
|
||||||
|
//editorcontainer_vboxcontainer_curvedialog->set("rect_size", Vector2(616, 353));
|
||||||
|
|
||||||
|
editorcontainer_vboxcontainer_curvedialog->set_rect_clip_content(True);
|
||||||
|
//editorcontainer_vboxcontainer_curvedialog->set("rect_clip_content", True);
|
||||||
|
|
||||||
|
editorcontainer_vboxcontainer_curvedialog->set_size_flags_horizontal(3);
|
||||||
|
//editorcontainer_vboxcontainer_curvedialog->set("size_flags_horizontal", 3);
|
||||||
|
|
||||||
|
editorcontainer_vboxcontainer_curvedialog->set_size_flags_vertical(3);
|
||||||
|
//editorcontainer_vboxcontainer_curvedialog->set("size_flags_vertical", 3);
|
||||||
|
|
||||||
|
editorcontainer_vboxcontainer_curvedialog->set_custom_constants/margin_right(4);
|
||||||
|
//editorcontainer_vboxcontainer_curvedialog->set("custom_constants/margin_right", 4);
|
||||||
|
|
||||||
|
editorcontainer_vboxcontainer_curvedialog->set_custom_constants/margin_top(4);
|
||||||
|
//editorcontainer_vboxcontainer_curvedialog->set("custom_constants/margin_top", 4);
|
||||||
|
|
||||||
|
editorcontainer_vboxcontainer_curvedialog->set_custom_constants/margin_left(4);
|
||||||
|
//editorcontainer_vboxcontainer_curvedialog->set("custom_constants/margin_left", 4);
|
||||||
|
|
||||||
|
editorcontainer_vboxcontainer_curvedialog->set_custom_constants/margin_bottom(4);
|
||||||
|
//editorcontainer_vboxcontainer_curvedialog->set("custom_constants/margin_bottom", 4);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//Script: res://addons/mat_maker_gd/widgets/curve_edit/curve_editor.gd
|
||||||
|
Control *curveeditor_editorcontainer_vboxcontainer_curvedialog = memnew(Control);
|
||||||
|
curveeditor_editorcontainer_vboxcontainer_curvedialog->set_name("CurveEditor");
|
||||||
|
editorcontainer_vboxcontainer_curvedialog->add_child(curveeditor_editorcontainer_vboxcontainer_curvedialog);
|
||||||
|
|
||||||
|
curveeditor_editorcontainer_vboxcontainer_curvedialog->set_name("CurveEditor");
|
||||||
|
//curveeditor_editorcontainer_vboxcontainer_curvedialog->set("name", CurveEditor));
|
||||||
|
|
||||||
|
curveeditor_editorcontainer_vboxcontainer_curvedialog->set_filename("res://addons/mat_maker_gd/widgets/curve_edit/curve_editor.tscn");
|
||||||
|
//curveeditor_editorcontainer_vboxcontainer_curvedialog->set("filename", "res://addons/mat_maker_gd/widgets/curve_edit/curve_editor.tscn");
|
||||||
|
|
||||||
|
//curveeditor_editorcontainer_vboxcontainer_curvedialog property owner TYPE_OBJECT value: CurveDialog:[WindowDialog:59762]
|
||||||
|
|
||||||
|
curveeditor_editorcontainer_vboxcontainer_curvedialog->set_margin_left(4);
|
||||||
|
//curveeditor_editorcontainer_vboxcontainer_curvedialog->set("margin_left", 4);
|
||||||
|
|
||||||
|
curveeditor_editorcontainer_vboxcontainer_curvedialog->set_margin_top(4);
|
||||||
|
//curveeditor_editorcontainer_vboxcontainer_curvedialog->set("margin_top", 4);
|
||||||
|
|
||||||
|
curveeditor_editorcontainer_vboxcontainer_curvedialog->set_margin_right(612);
|
||||||
|
//curveeditor_editorcontainer_vboxcontainer_curvedialog->set("margin_right", 612);
|
||||||
|
|
||||||
|
curveeditor_editorcontainer_vboxcontainer_curvedialog->set_margin_bottom(349);
|
||||||
|
//curveeditor_editorcontainer_vboxcontainer_curvedialog->set("margin_bottom", 349);
|
||||||
|
|
||||||
|
curveeditor_editorcontainer_vboxcontainer_curvedialog->set_rect_position(Vector2(4, 4));
|
||||||
|
//curveeditor_editorcontainer_vboxcontainer_curvedialog->set("rect_position", Vector2(4, 4));
|
||||||
|
|
||||||
|
curveeditor_editorcontainer_vboxcontainer_curvedialog->set_rect_global_position(Vector2(4, 4));
|
||||||
|
//curveeditor_editorcontainer_vboxcontainer_curvedialog->set("rect_global_position", Vector2(4, 4));
|
||||||
|
|
||||||
|
curveeditor_editorcontainer_vboxcontainer_curvedialog->set_rect_size(Vector2(608, 345));
|
||||||
|
//curveeditor_editorcontainer_vboxcontainer_curvedialog->set("rect_size", Vector2(608, 345));
|
||||||
|
|
||||||
|
curveeditor_editorcontainer_vboxcontainer_curvedialog->set_size_flags_vertical(3);
|
||||||
|
//curveeditor_editorcontainer_vboxcontainer_curvedialog->set("size_flags_vertical", 3);
|
||||||
|
|
||||||
|
//curveeditor_editorcontainer_vboxcontainer_curvedialog property __meta__ TYPE_DICTIONARY value: {_edit_use_anchors_:False}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
HSeparator *hseparator_vboxcontainer_curvedialog = memnew(HSeparator);
|
||||||
|
hseparator_vboxcontainer_curvedialog->set_name("HSeparator");
|
||||||
|
vboxcontainer_curvedialog->add_child(hseparator_vboxcontainer_curvedialog);
|
||||||
|
|
||||||
|
hseparator_vboxcontainer_curvedialog->set_name("HSeparator");
|
||||||
|
//hseparator_vboxcontainer_curvedialog->set("name", HSeparator));
|
||||||
|
|
||||||
|
//hseparator_vboxcontainer_curvedialog property owner TYPE_OBJECT value: CurveDialog:[WindowDialog:59762]
|
||||||
|
|
||||||
|
hseparator_vboxcontainer_curvedialog->set_margin_top(357);
|
||||||
|
//hseparator_vboxcontainer_curvedialog->set("margin_top", 357);
|
||||||
|
|
||||||
|
hseparator_vboxcontainer_curvedialog->set_margin_right(616);
|
||||||
|
//hseparator_vboxcontainer_curvedialog->set("margin_right", 616);
|
||||||
|
|
||||||
|
hseparator_vboxcontainer_curvedialog->set_margin_bottom(361);
|
||||||
|
//hseparator_vboxcontainer_curvedialog->set("margin_bottom", 361);
|
||||||
|
|
||||||
|
hseparator_vboxcontainer_curvedialog->set_rect_position(Vector2(0, 357));
|
||||||
|
//hseparator_vboxcontainer_curvedialog->set("rect_position", Vector2(0, 357));
|
||||||
|
|
||||||
|
hseparator_vboxcontainer_curvedialog->set_rect_global_position(Vector2(0, 357));
|
||||||
|
//hseparator_vboxcontainer_curvedialog->set("rect_global_position", Vector2(0, 357));
|
||||||
|
|
||||||
|
hseparator_vboxcontainer_curvedialog->set_rect_size(Vector2(616, 4));
|
||||||
|
//hseparator_vboxcontainer_curvedialog->set("rect_size", Vector2(616, 4));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
HBoxContainer *hboxcontainer_vboxcontainer_curvedialog = memnew(HBoxContainer);
|
||||||
|
hboxcontainer_vboxcontainer_curvedialog->set_name("HBoxContainer");
|
||||||
|
vboxcontainer_curvedialog->add_child(hboxcontainer_vboxcontainer_curvedialog);
|
||||||
|
|
||||||
|
hboxcontainer_vboxcontainer_curvedialog->set_name("HBoxContainer");
|
||||||
|
//hboxcontainer_vboxcontainer_curvedialog->set("name", HBoxContainer));
|
||||||
|
|
||||||
|
//hboxcontainer_vboxcontainer_curvedialog property owner TYPE_OBJECT value: CurveDialog:[WindowDialog:59762]
|
||||||
|
|
||||||
|
hboxcontainer_vboxcontainer_curvedialog->set_margin_top(365);
|
||||||
|
//hboxcontainer_vboxcontainer_curvedialog->set("margin_top", 365);
|
||||||
|
|
||||||
|
hboxcontainer_vboxcontainer_curvedialog->set_margin_right(616);
|
||||||
|
//hboxcontainer_vboxcontainer_curvedialog->set("margin_right", 616);
|
||||||
|
|
||||||
|
hboxcontainer_vboxcontainer_curvedialog->set_margin_bottom(385);
|
||||||
|
//hboxcontainer_vboxcontainer_curvedialog->set("margin_bottom", 385);
|
||||||
|
|
||||||
|
hboxcontainer_vboxcontainer_curvedialog->set_rect_position(Vector2(0, 365));
|
||||||
|
//hboxcontainer_vboxcontainer_curvedialog->set("rect_position", Vector2(0, 365));
|
||||||
|
|
||||||
|
hboxcontainer_vboxcontainer_curvedialog->set_rect_global_position(Vector2(0, 365));
|
||||||
|
//hboxcontainer_vboxcontainer_curvedialog->set("rect_global_position", Vector2(0, 365));
|
||||||
|
|
||||||
|
hboxcontainer_vboxcontainer_curvedialog->set_rect_size(Vector2(616, 20));
|
||||||
|
//hboxcontainer_vboxcontainer_curvedialog->set("rect_size", Vector2(616, 20));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Control *control_hboxcontainer_vboxcontainer_curvedialog = memnew(Control);
|
||||||
|
control_hboxcontainer_vboxcontainer_curvedialog->set_name("Control");
|
||||||
|
hboxcontainer_vboxcontainer_curvedialog->add_child(control_hboxcontainer_vboxcontainer_curvedialog);
|
||||||
|
|
||||||
|
control_hboxcontainer_vboxcontainer_curvedialog->set_name("Control");
|
||||||
|
//control_hboxcontainer_vboxcontainer_curvedialog->set("name", Control));
|
||||||
|
|
||||||
|
//control_hboxcontainer_vboxcontainer_curvedialog property owner TYPE_OBJECT value: CurveDialog:[WindowDialog:59762]
|
||||||
|
|
||||||
|
control_hboxcontainer_vboxcontainer_curvedialog->set_margin_right(488);
|
||||||
|
//control_hboxcontainer_vboxcontainer_curvedialog->set("margin_right", 488);
|
||||||
|
|
||||||
|
control_hboxcontainer_vboxcontainer_curvedialog->set_margin_bottom(20);
|
||||||
|
//control_hboxcontainer_vboxcontainer_curvedialog->set("margin_bottom", 20);
|
||||||
|
|
||||||
|
control_hboxcontainer_vboxcontainer_curvedialog->set_rect_size(Vector2(488, 20));
|
||||||
|
//control_hboxcontainer_vboxcontainer_curvedialog->set("rect_size", Vector2(488, 20));
|
||||||
|
|
||||||
|
control_hboxcontainer_vboxcontainer_curvedialog->set_size_flags_horizontal(3);
|
||||||
|
//control_hboxcontainer_vboxcontainer_curvedialog->set("size_flags_horizontal", 3);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Button *ok_hboxcontainer_vboxcontainer_curvedialog = memnew(Button);
|
||||||
|
ok_hboxcontainer_vboxcontainer_curvedialog->set_name("OK");
|
||||||
|
hboxcontainer_vboxcontainer_curvedialog->add_child(ok_hboxcontainer_vboxcontainer_curvedialog);
|
||||||
|
|
||||||
|
ok_hboxcontainer_vboxcontainer_curvedialog->set_name("OK");
|
||||||
|
//ok_hboxcontainer_vboxcontainer_curvedialog->set("name", OK));
|
||||||
|
|
||||||
|
//ok_hboxcontainer_vboxcontainer_curvedialog property owner TYPE_OBJECT value: CurveDialog:[WindowDialog:59762]
|
||||||
|
|
||||||
|
ok_hboxcontainer_vboxcontainer_curvedialog->set_margin_left(492);
|
||||||
|
//ok_hboxcontainer_vboxcontainer_curvedialog->set("margin_left", 492);
|
||||||
|
|
||||||
|
ok_hboxcontainer_vboxcontainer_curvedialog->set_margin_right(552);
|
||||||
|
//ok_hboxcontainer_vboxcontainer_curvedialog->set("margin_right", 552);
|
||||||
|
|
||||||
|
ok_hboxcontainer_vboxcontainer_curvedialog->set_margin_bottom(20);
|
||||||
|
//ok_hboxcontainer_vboxcontainer_curvedialog->set("margin_bottom", 20);
|
||||||
|
|
||||||
|
ok_hboxcontainer_vboxcontainer_curvedialog->set_rect_position(Vector2(492, 0));
|
||||||
|
//ok_hboxcontainer_vboxcontainer_curvedialog->set("rect_position", Vector2(492, 0));
|
||||||
|
|
||||||
|
ok_hboxcontainer_vboxcontainer_curvedialog->set_rect_global_position(Vector2(492, 0));
|
||||||
|
//ok_hboxcontainer_vboxcontainer_curvedialog->set("rect_global_position", Vector2(492, 0));
|
||||||
|
|
||||||
|
ok_hboxcontainer_vboxcontainer_curvedialog->set_rect_size(Vector2(60, 20));
|
||||||
|
//ok_hboxcontainer_vboxcontainer_curvedialog->set("rect_size", Vector2(60, 20));
|
||||||
|
|
||||||
|
ok_hboxcontainer_vboxcontainer_curvedialog->set_rect_min_size(Vector2(60, 0));
|
||||||
|
//ok_hboxcontainer_vboxcontainer_curvedialog->set("rect_min_size", Vector2(60, 0));
|
||||||
|
|
||||||
|
ok_hboxcontainer_vboxcontainer_curvedialog->set_text("OK");
|
||||||
|
//ok_hboxcontainer_vboxcontainer_curvedialog->set("text", "OK");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Button *cancel_hboxcontainer_vboxcontainer_curvedialog = memnew(Button);
|
||||||
|
cancel_hboxcontainer_vboxcontainer_curvedialog->set_name("Cancel");
|
||||||
|
hboxcontainer_vboxcontainer_curvedialog->add_child(cancel_hboxcontainer_vboxcontainer_curvedialog);
|
||||||
|
|
||||||
|
cancel_hboxcontainer_vboxcontainer_curvedialog->set_name("Cancel");
|
||||||
|
//cancel_hboxcontainer_vboxcontainer_curvedialog->set("name", Cancel));
|
||||||
|
|
||||||
|
//cancel_hboxcontainer_vboxcontainer_curvedialog property owner TYPE_OBJECT value: CurveDialog:[WindowDialog:59762]
|
||||||
|
|
||||||
|
cancel_hboxcontainer_vboxcontainer_curvedialog->set_margin_left(556);
|
||||||
|
//cancel_hboxcontainer_vboxcontainer_curvedialog->set("margin_left", 556);
|
||||||
|
|
||||||
|
cancel_hboxcontainer_vboxcontainer_curvedialog->set_margin_right(616);
|
||||||
|
//cancel_hboxcontainer_vboxcontainer_curvedialog->set("margin_right", 616);
|
||||||
|
|
||||||
|
cancel_hboxcontainer_vboxcontainer_curvedialog->set_margin_bottom(20);
|
||||||
|
//cancel_hboxcontainer_vboxcontainer_curvedialog->set("margin_bottom", 20);
|
||||||
|
|
||||||
|
cancel_hboxcontainer_vboxcontainer_curvedialog->set_rect_position(Vector2(556, 0));
|
||||||
|
//cancel_hboxcontainer_vboxcontainer_curvedialog->set("rect_position", Vector2(556, 0));
|
||||||
|
|
||||||
|
cancel_hboxcontainer_vboxcontainer_curvedialog->set_rect_global_position(Vector2(556, 0));
|
||||||
|
//cancel_hboxcontainer_vboxcontainer_curvedialog->set("rect_global_position", Vector2(556, 0));
|
||||||
|
|
||||||
|
cancel_hboxcontainer_vboxcontainer_curvedialog->set_rect_size(Vector2(60, 20));
|
||||||
|
//cancel_hboxcontainer_vboxcontainer_curvedialog->set("rect_size", Vector2(60, 20));
|
||||||
|
|
||||||
|
cancel_hboxcontainer_vboxcontainer_curvedialog->set_rect_min_size(Vector2(60, 0));
|
||||||
|
//cancel_hboxcontainer_vboxcontainer_curvedialog->set("rect_min_size", Vector2(60, 0));
|
||||||
|
|
||||||
|
cancel_hboxcontainer_vboxcontainer_curvedialog->set_text("Cancel");
|
||||||
|
//cancel_hboxcontainer_vboxcontainer_curvedialog->set("text", "Cancel");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,41 @@
|
|||||||
|
#ifndef CURVE_DIALOG_H
|
||||||
|
#define CURVE_DIALOG_H
|
||||||
|
|
||||||
|
|
||||||
|
class CurveDialog : public WindowDialog {
|
||||||
|
GDCLASS(CurveDialog, WindowDialog);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
Variant get_Variant();
|
||||||
|
void set_Variant(const Variant &val);
|
||||||
|
|
||||||
|
Array get_previous_points();
|
||||||
|
void set_previous_points(const Array &val);
|
||||||
|
|
||||||
|
Variant get_Variant();
|
||||||
|
void set_Variant(const Variant &val);
|
||||||
|
|
||||||
|
void _ready();
|
||||||
|
void _on_CurveDialog_popup_hide();
|
||||||
|
void _on_OK_pressed();
|
||||||
|
void _on_Cancel_pressed();
|
||||||
|
void edit_curve(const Variant &c);
|
||||||
|
void _on_CurveEditor_value_changed(const Variant &value);
|
||||||
|
|
||||||
|
CurveDialog();
|
||||||
|
~CurveDialog();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
static void _bind_methods();
|
||||||
|
|
||||||
|
//tool
|
||||||
|
Variant = preload("res://addons/mat_maker_gd/nodes/bases/curve_base.gd");
|
||||||
|
Array previous_points = ;
|
||||||
|
Variant ;
|
||||||
|
signal curve_changed(curve);
|
||||||
|
// Called when the node enters the scene tree for the first time.
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,80 @@
|
|||||||
|
|
||||||
|
#include "curve_edit.h"
|
||||||
|
|
||||||
|
|
||||||
|
Variant CurveEdit::get_Variant() {
|
||||||
|
return Variant;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CurveEdit::set_Variant(const Variant &val) {
|
||||||
|
Variant = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Variant CurveEdit::get_Variant() {
|
||||||
|
return Variant;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CurveEdit::set_Variant(const Variant &val) {
|
||||||
|
Variant = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//tool;
|
||||||
|
//var MMCurve = preload("res://addons/mat_maker_gd/nodes/bases/curve_base.gd");
|
||||||
|
// setget set_value;
|
||||||
|
Variant = null;
|
||||||
|
signal updated(curve);
|
||||||
|
|
||||||
|
void CurveEdit::set_value(const Variant &v) {
|
||||||
|
value = v;
|
||||||
|
$CurveView.set_curve(value);
|
||||||
|
$CurveView.update();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CurveEdit::_on_CurveEdit_pressed() {
|
||||||
|
//var dialog = preload("res://addons/mat_maker_gd/widgets/curve_edit/curve_dialog.tscn").instance();
|
||||||
|
add_child(dialog);
|
||||||
|
dialog.connect("curve_changed", self, "on_value_changed");
|
||||||
|
dialog.edit_curve(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CurveEdit::on_value_changed(const Variant &v) {
|
||||||
|
//set_value(v);
|
||||||
|
emit_signal("updated", v);
|
||||||
|
$CurveView.update();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CurveEdit::CurveEdit() {
|
||||||
|
//var MMCurve = preload("res://addons/mat_maker_gd/nodes/bases/curve_base.gd");
|
||||||
|
= null;
|
||||||
|
}
|
||||||
|
|
||||||
|
CurveEdit::~CurveEdit() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void CurveEdit::_bind_methods() {
|
||||||
|
ClassDB::bind_method(D_METHOD("get_Variant"), &CurveEdit::get_Variant);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_Variant", "value"), &CurveEdit::set_Variant);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "Variant", PROPERTY_HINT_RESOURCE_TYPE, "Variant"), "set_Variant", "get_Variant");
|
||||||
|
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_Variant"), &CurveEdit::get_Variant);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_Variant", "value"), &CurveEdit::set_Variant);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "Variant", PROPERTY_HINT_RESOURCE_TYPE, "Variant"), "set_Variant", "get_Variant");
|
||||||
|
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("set_value", "v"), &CurveEdit::set_value);
|
||||||
|
ClassDB::bind_method(D_METHOD("_on_CurveEdit_pressed"), &CurveEdit::_on_CurveEdit_pressed);
|
||||||
|
ClassDB::bind_method(D_METHOD("on_value_changed", "v"), &CurveEdit::on_value_changed);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,96 @@
|
|||||||
|
|
||||||
|
void construct() {
|
||||||
|
|
||||||
|
//Script: res://addons/mat_maker_gd/widgets/curve_edit/curve_edit.gd
|
||||||
|
Button *curveedit = memnew(Button);
|
||||||
|
curveedit->set_name("CurveEdit");
|
||||||
|
|
||||||
|
curveedit->set_name("CurveEdit");
|
||||||
|
//curveedit->set("name", CurveEdit));
|
||||||
|
|
||||||
|
curveedit->set_filename("res://addons/mat_maker_gd/widgets/curve_edit/curve_edit.tscn");
|
||||||
|
//curveedit->set("filename", "res://addons/mat_maker_gd/widgets/curve_edit/curve_edit.tscn");
|
||||||
|
|
||||||
|
curveedit->set_anchor_left(1);
|
||||||
|
//curveedit->set("anchor_left", 1);
|
||||||
|
|
||||||
|
curveedit->set_anchor_right(1);
|
||||||
|
//curveedit->set("anchor_right", 1);
|
||||||
|
|
||||||
|
curveedit->set_anchor_bottom(1);
|
||||||
|
//curveedit->set("anchor_bottom", 1);
|
||||||
|
|
||||||
|
curveedit->set_margin_left(-1280);
|
||||||
|
//curveedit->set("margin_left", -1280);
|
||||||
|
|
||||||
|
curveedit->set_margin_right(-1220);
|
||||||
|
//curveedit->set("margin_right", -1220);
|
||||||
|
|
||||||
|
curveedit->set_margin_bottom(-700);
|
||||||
|
//curveedit->set("margin_bottom", -700);
|
||||||
|
|
||||||
|
curveedit->set_rect_position(Vector2(-1280, 0));
|
||||||
|
//curveedit->set("rect_position", Vector2(-1280, 0));
|
||||||
|
|
||||||
|
curveedit->set_rect_global_position(Vector2(-1280, 0));
|
||||||
|
//curveedit->set("rect_global_position", Vector2(-1280, 0));
|
||||||
|
|
||||||
|
curveedit->set_rect_size(Vector2(60, 20));
|
||||||
|
//curveedit->set("rect_size", Vector2(60, 20));
|
||||||
|
|
||||||
|
curveedit->set_rect_min_size(Vector2(60, 20));
|
||||||
|
//curveedit->set("rect_min_size", Vector2(60, 20));
|
||||||
|
|
||||||
|
curveedit->set_focus_mode(1);
|
||||||
|
//curveedit->set("focus_mode", 1);
|
||||||
|
|
||||||
|
//curveedit property __meta__ TYPE_DICTIONARY value: {_edit_use_anchors_:False}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//Script: res://addons/mat_maker_gd/widgets/curve_edit/curve_view.gd
|
||||||
|
Control *curveview_curveedit = memnew(Control);
|
||||||
|
curveview_curveedit->set_name("CurveView");
|
||||||
|
curveedit->add_child(curveview_curveedit);
|
||||||
|
|
||||||
|
curveview_curveedit->set_name("CurveView");
|
||||||
|
//curveview_curveedit->set("name", CurveView));
|
||||||
|
|
||||||
|
curveview_curveedit->set_filename("res://addons/mat_maker_gd/widgets/curve_edit/curve_view.tscn");
|
||||||
|
//curveview_curveedit->set("filename", "res://addons/mat_maker_gd/widgets/curve_edit/curve_view.tscn");
|
||||||
|
|
||||||
|
//curveview_curveedit property owner TYPE_OBJECT value: CurveEdit:[Button:59797]
|
||||||
|
|
||||||
|
curveview_curveedit->set_anchor_right(1);
|
||||||
|
//curveview_curveedit->set("anchor_right", 1);
|
||||||
|
|
||||||
|
curveview_curveedit->set_anchor_bottom(1);
|
||||||
|
//curveview_curveedit->set("anchor_bottom", 1);
|
||||||
|
|
||||||
|
curveview_curveedit->set_margin_left(4);
|
||||||
|
//curveview_curveedit->set("margin_left", 4);
|
||||||
|
|
||||||
|
curveview_curveedit->set_margin_top(4);
|
||||||
|
//curveview_curveedit->set("margin_top", 4);
|
||||||
|
|
||||||
|
curveview_curveedit->set_margin_right(-4);
|
||||||
|
//curveview_curveedit->set("margin_right", -4);
|
||||||
|
|
||||||
|
curveview_curveedit->set_margin_bottom(-4);
|
||||||
|
//curveview_curveedit->set("margin_bottom", -4);
|
||||||
|
|
||||||
|
curveview_curveedit->set_rect_position(Vector2(4, 4));
|
||||||
|
//curveview_curveedit->set("rect_position", Vector2(4, 4));
|
||||||
|
|
||||||
|
curveview_curveedit->set_rect_global_position(Vector2(4, 4));
|
||||||
|
//curveview_curveedit->set("rect_global_position", Vector2(4, 4));
|
||||||
|
|
||||||
|
curveview_curveedit->set_mouse_filter(2);
|
||||||
|
//curveview_curveedit->set("mouse_filter", 2);
|
||||||
|
|
||||||
|
//curveview_curveedit property __meta__ TYPE_DICTIONARY value: {_edit_use_anchors_:False}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
#ifndef CURVE_EDIT_H
|
||||||
|
#define CURVE_EDIT_H
|
||||||
|
|
||||||
|
|
||||||
|
class CurveEdit : public Control {
|
||||||
|
GDCLASS(CurveEdit, Control);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
Variant get_Variant();
|
||||||
|
void set_Variant(const Variant &val);
|
||||||
|
|
||||||
|
Variant get_Variant();
|
||||||
|
void set_Variant(const Variant &val);
|
||||||
|
|
||||||
|
void set_value(const Variant &v);
|
||||||
|
void _on_CurveEdit_pressed();
|
||||||
|
void on_value_changed(const Variant &v);
|
||||||
|
|
||||||
|
CurveEdit();
|
||||||
|
~CurveEdit();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
static void _bind_methods();
|
||||||
|
|
||||||
|
//tool
|
||||||
|
Variant = preload("res://addons/mat_maker_gd/nodes/bases/curve_base.gd");
|
||||||
|
// setget set_value
|
||||||
|
Variant = null;
|
||||||
|
signal updated(curve);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,151 @@
|
|||||||
|
|
||||||
|
#include "curve_editor.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//tool;
|
||||||
|
signal value_changed(value);
|
||||||
|
|
||||||
|
void CurveEditor::_ready() {
|
||||||
|
update_controls();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CurveEditor::set_curve(const Variant &c) {
|
||||||
|
curve = c;
|
||||||
|
update();
|
||||||
|
update_controls();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CurveEditor::update_controls() {
|
||||||
|
|
||||||
|
if (!curve) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
for (c in get_children()) {
|
||||||
|
c.queue_free();
|
||||||
|
}
|
||||||
|
|
||||||
|
Variant = curve.get_points();
|
||||||
|
|
||||||
|
for (i in points.size()) {
|
||||||
|
Variant = points[i];
|
||||||
|
//var control_point = preload("res://addons/mat_maker_gd/widgets/curve_edit/control_point.tscn").instance();
|
||||||
|
add_child(control_point);
|
||||||
|
control_point.initialize(p);
|
||||||
|
control_point.rect_position = transform_point(p.p)-control_point.OFFSET;
|
||||||
|
|
||||||
|
if (i == 0 || i == points.size()-1) {
|
||||||
|
control_point.set_constraint(control_point.rect_position.x, control_point.rect_position.x, -control_point.OFFSET.y, rect_size.y-control_point.OFFSET.y);
|
||||||
|
|
||||||
|
if (i == 0) {
|
||||||
|
control_point.get_child(0).visible = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
else {
|
||||||
|
control_point.get_child(1).visible = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
else {
|
||||||
|
Variant = transform_point(points[i-1].p).x+1;
|
||||||
|
Variant = transform_point(points[i+1].p).x-1;
|
||||||
|
control_point.set_constraint(min_x, max_x, -control_point.OFFSET.y, rect_size.y-control_point.OFFSET.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
control_point.connect("moved", self, "_on_ControlPoint_moved");
|
||||||
|
control_point.connect("removed", self, "_on_ControlPoint_removed");
|
||||||
|
}
|
||||||
|
|
||||||
|
emit_signal("value_changed", curve);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CurveEditor::_on_ControlPoint_moved(const Variant &index) {
|
||||||
|
Array points = curve.get_points();
|
||||||
|
Variant = get_child(index);
|
||||||
|
points[index].p = reverse_transform_point(control_point.rect_position+control_point.OFFSET);
|
||||||
|
|
||||||
|
if (control_point.has_node("LeftSlope")) {
|
||||||
|
Variant = control_point.get_node("LeftSlope").rect_position/rect_size;
|
||||||
|
|
||||||
|
if (slope_vector.x != 0) {
|
||||||
|
points[index].ls = -slope_vector.y / slope_vector.x;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (control_point.has_node("RightSlope")) {
|
||||||
|
Variant = control_point.get_node("RightSlope").rect_position/rect_size;
|
||||||
|
|
||||||
|
if (slope_vector.x != 0) {
|
||||||
|
points[index].rs = -slope_vector.y / slope_vector.x;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
curve.set_points(points, false);
|
||||||
|
update();
|
||||||
|
emit_signal("value_changed", curve);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CurveEditor::_on_ControlPoint_removed(const Variant &index) {
|
||||||
|
|
||||||
|
if (curve.remove_point(index)) {
|
||||||
|
update();
|
||||||
|
update_controls();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CurveEditor::_on_CurveEditor_gui_input(const Variant &event) {
|
||||||
|
|
||||||
|
if (event is InputEventMouseButton) {
|
||||||
|
|
||||||
|
if (event.button_index == BUTTON_LEFT && event.doubleclick) {
|
||||||
|
Variant = reverse_transform_point(get_local_mouse_position());
|
||||||
|
curve.add_point(new_point_position.x, new_point_position.y, 0.0, 0.0);
|
||||||
|
update_controls();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CurveEditor::_on_resize() {
|
||||||
|
._on_resize();
|
||||||
|
update_controls();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CurveEditor::CurveEditor() {
|
||||||
|
}
|
||||||
|
|
||||||
|
CurveEditor::~CurveEditor() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void CurveEditor::_bind_methods() {
|
||||||
|
ClassDB::bind_method(D_METHOD("_ready"), &CurveEditor::_ready);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_curve", "c"), &CurveEditor::set_curve);
|
||||||
|
ClassDB::bind_method(D_METHOD("update_controls"), &CurveEditor::update_controls);
|
||||||
|
ClassDB::bind_method(D_METHOD("_on_ControlPoint_moved", "index"), &CurveEditor::_on_ControlPoint_moved);
|
||||||
|
ClassDB::bind_method(D_METHOD("_on_ControlPoint_removed", "index"), &CurveEditor::_on_ControlPoint_removed);
|
||||||
|
ClassDB::bind_method(D_METHOD("_on_CurveEditor_gui_input", "event"), &CurveEditor::_on_CurveEditor_gui_input);
|
||||||
|
ClassDB::bind_method(D_METHOD("_on_resize"), &CurveEditor::_on_resize);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,43 @@
|
|||||||
|
|
||||||
|
void construct() {
|
||||||
|
|
||||||
|
//Script: res://addons/mat_maker_gd/widgets/curve_edit/curve_editor.gd
|
||||||
|
Control *curveeditor = memnew(Control);
|
||||||
|
curveeditor->set_name("CurveEditor");
|
||||||
|
|
||||||
|
curveeditor->set_name("CurveEditor");
|
||||||
|
//curveeditor->set("name", CurveEditor));
|
||||||
|
|
||||||
|
curveeditor->set_filename("res://addons/mat_maker_gd/widgets/curve_edit/curve_editor.tscn");
|
||||||
|
//curveeditor->set("filename", "res://addons/mat_maker_gd/widgets/curve_edit/curve_editor.tscn");
|
||||||
|
|
||||||
|
curveeditor->set_anchor_right(1);
|
||||||
|
//curveeditor->set("anchor_right", 1);
|
||||||
|
|
||||||
|
curveeditor->set_anchor_bottom(1);
|
||||||
|
//curveeditor->set("anchor_bottom", 1);
|
||||||
|
|
||||||
|
curveeditor->set_margin_left(10);
|
||||||
|
//curveeditor->set("margin_left", 10);
|
||||||
|
|
||||||
|
curveeditor->set_margin_top(10);
|
||||||
|
//curveeditor->set("margin_top", 10);
|
||||||
|
|
||||||
|
curveeditor->set_margin_right(-10);
|
||||||
|
//curveeditor->set("margin_right", -10);
|
||||||
|
|
||||||
|
curveeditor->set_margin_bottom(-10);
|
||||||
|
//curveeditor->set("margin_bottom", -10);
|
||||||
|
|
||||||
|
curveeditor->set_rect_position(Vector2(10, 10));
|
||||||
|
//curveeditor->set("rect_position", Vector2(10, 10));
|
||||||
|
|
||||||
|
curveeditor->set_rect_global_position(Vector2(10, 10));
|
||||||
|
//curveeditor->set("rect_global_position", Vector2(10, 10));
|
||||||
|
|
||||||
|
//curveeditor property __meta__ TYPE_DICTIONARY value: {_edit_use_anchors_:False}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
#ifndef CURVE_EDITOR_H
|
||||||
|
#define CURVE_EDITOR_H
|
||||||
|
|
||||||
|
|
||||||
|
class CurveEditor : public "res://addons/mat_maker_gd/widgets/curve_edit/curve_view.gd" {
|
||||||
|
GDCLASS(CurveEditor, "res://addons/mat_maker_gd/widgets/curve_edit/curve_view.gd");
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
void _ready();
|
||||||
|
void set_curve(const Variant &c);
|
||||||
|
void update_controls();
|
||||||
|
void _on_ControlPoint_moved(const Variant &index);
|
||||||
|
void _on_ControlPoint_removed(const Variant &index);
|
||||||
|
void _on_CurveEditor_gui_input(const Variant &event);
|
||||||
|
void _on_resize();
|
||||||
|
|
||||||
|
CurveEditor();
|
||||||
|
~CurveEditor();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
static void _bind_methods();
|
||||||
|
|
||||||
|
//tool
|
||||||
|
signal value_changed(value);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
160
modules/material_maker/editor/widgets/curve_edit/curve_view.cpp
Normal file
160
modules/material_maker/editor/widgets/curve_edit/curve_view.cpp
Normal file
@ -0,0 +1,160 @@
|
|||||||
|
|
||||||
|
#include "curve_view.h"
|
||||||
|
|
||||||
|
|
||||||
|
Variant CurveView::get_Variant() {
|
||||||
|
return Variant;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CurveView::set_Variant(const Variant &val) {
|
||||||
|
Variant = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool CurveView::get_show_axes() const {
|
||||||
|
return show_axes;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CurveView::set_show_axes(const bool val) {
|
||||||
|
show_axes = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Variant CurveView::get_Variant() {
|
||||||
|
return Variant;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CurveView::set_Variant(const Variant &val) {
|
||||||
|
Variant = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//tool;
|
||||||
|
//var MMCurve = preload("res://addons/mat_maker_gd/nodes/bases/curve_base.gd");
|
||||||
|
//export ;
|
||||||
|
bool show_axes = false;
|
||||||
|
//: MMCurve;
|
||||||
|
Variant ;
|
||||||
|
|
||||||
|
void CurveView::_ready() {
|
||||||
|
// curve = MMCurve.new();
|
||||||
|
connect("resized", self, "_on_resize");
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CurveView::set_curve(const Variant &val) {
|
||||||
|
curve = val;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Vector2 CurveView::transform_point(const Vector2 &p) {
|
||||||
|
return (Vector2(0.0, 1.0)+Vector2(1.0, -1.0)*p)*rect_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Vector2 CurveView::reverse_transform_point(const Vector2 &p) {
|
||||||
|
return Vector2(0.0, 1.0)+Vector2(1.0, -1.0)*p/rect_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CurveView::_draw() {
|
||||||
|
|
||||||
|
if (!curve) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// var current_theme : Theme = get_node("/root/MainWindow").theme;
|
||||||
|
//;
|
||||||
|
// var bg = current_theme.get_stylebox("panel", "Panel").bg_color;
|
||||||
|
// var fg = current_theme.get_color("font_color", "Label");
|
||||||
|
//;
|
||||||
|
// var axes_color : Color = bg.linear_interpolate(fg, 0.25);
|
||||||
|
// var curve_color : Color = bg.linear_interpolate(fg, 0.75);
|
||||||
|
Color axes_color = Color(0.9, 0.9, 0.9, 1);
|
||||||
|
Color curve_color = Color(1, 1, 1, 1);
|
||||||
|
|
||||||
|
if (show_axes) {
|
||||||
|
|
||||||
|
for (int i = 0; i < 5; ++i) { //i in range(5)
|
||||||
|
Variant = transform_point(0.25*Vector2(i, i));
|
||||||
|
draw_line(Vector2(p.x, 0), Vector2(p.x, rect_size.y-1), axes_color);
|
||||||
|
draw_line(Vector2(0, p.y), Vector2(rect_size.x-1, p.y), axes_color);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Variant = curve.get_points();
|
||||||
|
|
||||||
|
for (int i = 0; i < points.size() - 1; ++i) { //i in range(points.size() - 1)
|
||||||
|
Variant = points[i].p;
|
||||||
|
Variant = points[i+1].p;
|
||||||
|
Variant = (p2.x-p1.x)/3.0;
|
||||||
|
Variant = p1.y+d*points[i].rs;
|
||||||
|
Variant = p2.y-d*points[i+1].ls;
|
||||||
|
Variant = transform_point(p1);
|
||||||
|
int count = max(1, int((transform_point(p2).x-p.x/5.0)));
|
||||||
|
|
||||||
|
for (int tt = 0; tt < count; ++tt) { //tt in range(count)
|
||||||
|
Variant = (tt+1.0)/count;
|
||||||
|
Variant = (1.0 - t);
|
||||||
|
Variant = omt * omt;
|
||||||
|
Variant = omt2 * omt;
|
||||||
|
Variant = t * t;
|
||||||
|
Variant = t2 * t;
|
||||||
|
Variant = p1.x+(p2.x-p1.x)*t;
|
||||||
|
Variant = transform_point(Vector2(x, p1.y*omt3 + yac*omt2*t*3.0 + ybc*omt*t2*3.0 + p2.y*t3));
|
||||||
|
draw_line(p, np, curve_color);
|
||||||
|
p = np;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CurveView::_on_resize() {
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CurveView::CurveView() {
|
||||||
|
//var MMCurve = preload("res://addons/mat_maker_gd/nodes/bases/curve_base.gd");
|
||||||
|
show_axes = false;
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
CurveView::~CurveView() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void CurveView::_bind_methods() {
|
||||||
|
ClassDB::bind_method(D_METHOD("get_Variant"), &CurveView::get_Variant);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_Variant", "value"), &CurveView::set_Variant);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "Variant", PROPERTY_HINT_RESOURCE_TYPE, "Variant"), "set_Variant", "get_Variant");
|
||||||
|
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_show_axes"), &CurveView::get_show_axes);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_show_axes", "value"), &CurveView::set_show_axes);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "show_axes"), "set_show_axes", "get_show_axes");
|
||||||
|
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_Variant"), &CurveView::get_Variant);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_Variant", "value"), &CurveView::set_Variant);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "Variant", PROPERTY_HINT_RESOURCE_TYPE, "Variant"), "set_Variant", "get_Variant");
|
||||||
|
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("_ready"), &CurveView::_ready);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_curve", "val"), &CurveView::set_curve);
|
||||||
|
ClassDB::bind_method(D_METHOD("transform_point", "p"), &CurveView::transform_point);
|
||||||
|
ClassDB::bind_method(D_METHOD("reverse_transform_point", "p"), &CurveView::reverse_transform_point);
|
||||||
|
ClassDB::bind_method(D_METHOD("_draw"), &CurveView::_draw);
|
||||||
|
ClassDB::bind_method(D_METHOD("_on_resize"), &CurveView::_on_resize);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,46 @@
|
|||||||
|
|
||||||
|
void construct() {
|
||||||
|
|
||||||
|
//Script: res://addons/mat_maker_gd/widgets/curve_edit/curve_view.gd
|
||||||
|
Control *curveview = memnew(Control);
|
||||||
|
curveview->set_name("CurveView");
|
||||||
|
|
||||||
|
curveview->set_name("CurveView");
|
||||||
|
//curveview->set("name", CurveView));
|
||||||
|
|
||||||
|
curveview->set_filename("res://addons/mat_maker_gd/widgets/curve_edit/curve_view.tscn");
|
||||||
|
//curveview->set("filename", "res://addons/mat_maker_gd/widgets/curve_edit/curve_view.tscn");
|
||||||
|
|
||||||
|
curveview->set_anchor_right(1);
|
||||||
|
//curveview->set("anchor_right", 1);
|
||||||
|
|
||||||
|
curveview->set_anchor_bottom(1);
|
||||||
|
//curveview->set("anchor_bottom", 1);
|
||||||
|
|
||||||
|
curveview->set_margin_left(4);
|
||||||
|
//curveview->set("margin_left", 4);
|
||||||
|
|
||||||
|
curveview->set_margin_top(4);
|
||||||
|
//curveview->set("margin_top", 4);
|
||||||
|
|
||||||
|
curveview->set_margin_right(-4);
|
||||||
|
//curveview->set("margin_right", -4);
|
||||||
|
|
||||||
|
curveview->set_margin_bottom(-4);
|
||||||
|
//curveview->set("margin_bottom", -4);
|
||||||
|
|
||||||
|
curveview->set_rect_position(Vector2(4, 4));
|
||||||
|
//curveview->set("rect_position", Vector2(4, 4));
|
||||||
|
|
||||||
|
curveview->set_rect_global_position(Vector2(4, 4));
|
||||||
|
//curveview->set("rect_global_position", Vector2(4, 4));
|
||||||
|
|
||||||
|
curveview->set_mouse_filter(2);
|
||||||
|
//curveview->set("mouse_filter", 2);
|
||||||
|
|
||||||
|
//curveview property __meta__ TYPE_DICTIONARY value: {_edit_use_anchors_:False}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,41 @@
|
|||||||
|
#ifndef CURVE_VIEW_H
|
||||||
|
#define CURVE_VIEW_H
|
||||||
|
|
||||||
|
|
||||||
|
class CurveView : public Control {
|
||||||
|
GDCLASS(CurveView, Control);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
Variant get_Variant();
|
||||||
|
void set_Variant(const Variant &val);
|
||||||
|
|
||||||
|
bool get_show_axes() const;
|
||||||
|
void set_show_axes(const bool val);
|
||||||
|
|
||||||
|
Variant get_Variant();
|
||||||
|
void set_Variant(const Variant &val);
|
||||||
|
|
||||||
|
void _ready();
|
||||||
|
void set_curve(const Variant &val);
|
||||||
|
Vector2 transform_point(const Vector2 &p);
|
||||||
|
Vector2 reverse_transform_point(const Vector2 &p);
|
||||||
|
void _draw();
|
||||||
|
void _on_resize();
|
||||||
|
|
||||||
|
CurveView();
|
||||||
|
~CurveView();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
static void _bind_methods();
|
||||||
|
|
||||||
|
//tool
|
||||||
|
Variant = preload("res://addons/mat_maker_gd/nodes/bases/curve_base.gd");
|
||||||
|
//export
|
||||||
|
bool show_axes = false;
|
||||||
|
//: MMCurve
|
||||||
|
Variant ;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
136
modules/material_maker/editor/widgets/curve_edit/slope_point.cpp
Normal file
136
modules/material_maker/editor/widgets/curve_edit/slope_point.cpp
Normal file
@ -0,0 +1,136 @@
|
|||||||
|
|
||||||
|
#include "slope_point.h"
|
||||||
|
|
||||||
|
|
||||||
|
float SlopePoint::get_distance() const {
|
||||||
|
return distance;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SlopePoint::set_distance(const float val) {
|
||||||
|
distance = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Variant SlopePoint::get_Variant() {
|
||||||
|
return Variant;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SlopePoint::set_Variant(const Variant &val) {
|
||||||
|
Variant = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//tool;
|
||||||
|
//export ;
|
||||||
|
float distance = ;
|
||||||
|
Variant = false;
|
||||||
|
const OFFSET = -Vector2(0, 0);
|
||||||
|
|
||||||
|
void SlopePoint::_ready() {
|
||||||
|
// Replace with function body.;
|
||||||
|
pass;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SlopePoint::_draw() {
|
||||||
|
// var current_theme : Theme = get_node("/root/MainWindow").theme;
|
||||||
|
// var color : Color = current_theme.get_color("font_color", "Label");
|
||||||
|
Color color = Color(1, 1, 1, 1);
|
||||||
|
draw_circle(Vector2(3.0, 3.0), 3.0, color);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SlopePoint::_on_ControlPoint_gui_input(const Variant &event) {
|
||||||
|
|
||||||
|
if (event is InputEventMouseButton) {
|
||||||
|
|
||||||
|
if (event.button_index == BUTTON_LEFT) {
|
||||||
|
|
||||||
|
if (event.pressed) {
|
||||||
|
|
||||||
|
if (event.doubleclick) {
|
||||||
|
Variant = get_parent();
|
||||||
|
Vector2 vector = ;
|
||||||
|
|
||||||
|
if (get_index() == 0) {
|
||||||
|
vector = parent.rect_position-parent.get_parent().get_child(parent.get_index()-1).rect_position;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
else {
|
||||||
|
vector = parent.get_parent().get_child(parent.get_index()+1).rect_position-parent.rect_position;
|
||||||
|
}
|
||||||
|
|
||||||
|
vector = distance*vector.normalized();
|
||||||
|
rect_position = vector-OFFSET;
|
||||||
|
|
||||||
|
if (event.control) {
|
||||||
|
get_parent().get_child(1-get_index()).rect_position = -vector-OFFSET;
|
||||||
|
}
|
||||||
|
|
||||||
|
get_parent().update_tangents();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
else {
|
||||||
|
moving = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
else {
|
||||||
|
moving = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
else if (moving && event is InputEventMouseMotion) {
|
||||||
|
Variant = get_global_mouse_position()-get_parent().get_global_rect().position+OFFSET;
|
||||||
|
vector *= sign(vector.x);
|
||||||
|
vector = distance*vector.normalized();
|
||||||
|
rect_position = vector-OFFSET;
|
||||||
|
|
||||||
|
if (event.control) {
|
||||||
|
get_parent().get_child(1-get_index()).rect_position = -vector-OFFSET;
|
||||||
|
}
|
||||||
|
|
||||||
|
get_parent().update_tangents();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
SlopePoint::SlopePoint() {
|
||||||
|
distance = ;
|
||||||
|
= false;
|
||||||
|
}
|
||||||
|
|
||||||
|
SlopePoint::~SlopePoint() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void SlopePoint::_bind_methods() {
|
||||||
|
ClassDB::bind_method(D_METHOD("get_distance"), &SlopePoint::get_distance);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_distance", "value"), &SlopePoint::set_distance);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::REAL, "distance"), "set_distance", "get_distance");
|
||||||
|
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_Variant"), &SlopePoint::get_Variant);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_Variant", "value"), &SlopePoint::set_Variant);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "Variant", PROPERTY_HINT_RESOURCE_TYPE, "Variant"), "set_Variant", "get_Variant");
|
||||||
|
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("_ready"), &SlopePoint::_ready);
|
||||||
|
ClassDB::bind_method(D_METHOD("_draw"), &SlopePoint::_draw);
|
||||||
|
ClassDB::bind_method(D_METHOD("_on_ControlPoint_gui_input", "event"), &SlopePoint::_on_ControlPoint_gui_input);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,34 @@
|
|||||||
|
#ifndef SLOPE_POINT_H
|
||||||
|
#define SLOPE_POINT_H
|
||||||
|
|
||||||
|
|
||||||
|
class SlopePoint : public Control {
|
||||||
|
GDCLASS(SlopePoint, Control);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
float get_distance() const;
|
||||||
|
void set_distance(const float val);
|
||||||
|
|
||||||
|
Variant get_Variant();
|
||||||
|
void set_Variant(const Variant &val);
|
||||||
|
|
||||||
|
void _ready();
|
||||||
|
void _draw();
|
||||||
|
void _on_ControlPoint_gui_input(const Variant &event);
|
||||||
|
|
||||||
|
SlopePoint();
|
||||||
|
~SlopePoint();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
static void _bind_methods();
|
||||||
|
|
||||||
|
//tool
|
||||||
|
//export
|
||||||
|
float distance = ;
|
||||||
|
Variant = false;
|
||||||
|
const OFFSET = -Vector2(0, 0);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,36 @@
|
|||||||
|
|
||||||
|
void construct() {
|
||||||
|
|
||||||
|
Button *favbutton = memnew(Button);
|
||||||
|
favbutton->set_name("FavButton");
|
||||||
|
|
||||||
|
favbutton->set_name("FavButton");
|
||||||
|
//favbutton->set("name", FavButton));
|
||||||
|
|
||||||
|
favbutton->set_filename("res://addons/mat_maker_gd/windows/file_dialog/fav_button.tscn");
|
||||||
|
//favbutton->set("filename", "res://addons/mat_maker_gd/windows/file_dialog/fav_button.tscn");
|
||||||
|
|
||||||
|
favbutton->set_margin_right(12);
|
||||||
|
//favbutton->set("margin_right", 12);
|
||||||
|
|
||||||
|
favbutton->set_margin_bottom(20);
|
||||||
|
//favbutton->set("margin_bottom", 20);
|
||||||
|
|
||||||
|
favbutton->set_rect_size(Vector2(12, 20));
|
||||||
|
//favbutton->set("rect_size", Vector2(12, 20));
|
||||||
|
|
||||||
|
//favbutton property icon TYPE_OBJECT value: [AtlasTexture:36836]
|
||||||
|
Ref<AtlasTexture> favbutton_prop_icon;
|
||||||
|
favbutton_prop_icon.instance();
|
||||||
|
favbutton->set_icon(favbutton_prop_icon);
|
||||||
|
//favbutton->set("icon", favbutton_prop_icon);
|
||||||
|
|
||||||
|
favbutton->set_flat(True);
|
||||||
|
//favbutton->set("flat", True);
|
||||||
|
|
||||||
|
//favbutton property __meta__ TYPE_DICTIONARY value: {_edit_use_anchors_:False}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,134 @@
|
|||||||
|
|
||||||
|
#include "file_dialog.h"
|
||||||
|
|
||||||
|
|
||||||
|
Variant FileDialog::get_Variant() {
|
||||||
|
return Variant;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FileDialog::set_Variant(const Variant &val) {
|
||||||
|
Variant = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Variant FileDialog::get_Variant() {
|
||||||
|
return Variant;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FileDialog::set_Variant(const Variant &val) {
|
||||||
|
Variant = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//tool;
|
||||||
|
Variant = null;
|
||||||
|
Variant = null;
|
||||||
|
signal return_paths(path_list);
|
||||||
|
|
||||||
|
void FileDialog::_ready() {
|
||||||
|
Variant = get_child(3);
|
||||||
|
Variant = HSplitContainer.new();
|
||||||
|
add_child(hbox);
|
||||||
|
remove_child(vbox);
|
||||||
|
left_panel = preload("res://addons/mat_maker_gd/windows/file_dialog/left_panel.tscn").instance();
|
||||||
|
hbox.add_child(left_panel);
|
||||||
|
left_panel.connect("open_directory", self, "set_current_dir");
|
||||||
|
hbox.add_child(vbox);
|
||||||
|
vbox.size_flags_horizontal = SIZE_EXPAND_FILL;
|
||||||
|
//var fav_button = preload("res://addons/mat_maker_gd/windows/file_dialog/fav_button.tscn").instance();
|
||||||
|
vbox.get_child(0).add_child(fav_button);
|
||||||
|
fav_button.connect("pressed", self, "add_favorite");
|
||||||
|
|
||||||
|
if (OS.get_name() == "Windows") {
|
||||||
|
volume_option = vbox.get_child(0).get_child(3);
|
||||||
|
|
||||||
|
if (! volume_option is OptionButton) {
|
||||||
|
volume_option = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
String FileDialog::get_full_current_dir() {
|
||||||
|
Variant = "";
|
||||||
|
|
||||||
|
if (volume_option != null && volume_option.visible) {
|
||||||
|
prefix = volume_option.get_item_text(volume_option.selected);
|
||||||
|
}
|
||||||
|
|
||||||
|
return prefix+get_current_dir();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void FileDialog::_on_FileDialog_file_selected(const Variant &path) {
|
||||||
|
left_panel.add_recent(get_full_current_dir());
|
||||||
|
emit_signal("return_paths", [ path ]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void FileDialog::_on_FileDialog_files_selected(const Variant &paths) {
|
||||||
|
left_panel.add_recent(get_full_current_dir());
|
||||||
|
emit_signal("return_paths", paths);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void FileDialog::_on_FileDialog_dir_selected(const Variant &dir) {
|
||||||
|
emit_signal("return_paths", [ dir ]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void FileDialog::_on_FileDialog_popup_hide() {
|
||||||
|
emit_signal("return_paths", [ ]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Array FileDialog::select_files() {
|
||||||
|
popup_centered();
|
||||||
|
Variant = yield(self, "return_paths");
|
||||||
|
queue_free();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void FileDialog::add_favorite() {
|
||||||
|
left_panel.add_favorite(get_full_current_dir());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
FileDialog::FileDialog() {
|
||||||
|
= null;
|
||||||
|
= null;
|
||||||
|
}
|
||||||
|
|
||||||
|
FileDialog::~FileDialog() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void FileDialog::_bind_methods() {
|
||||||
|
ClassDB::bind_method(D_METHOD("get_Variant"), &FileDialog::get_Variant);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_Variant", "value"), &FileDialog::set_Variant);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "Variant", PROPERTY_HINT_RESOURCE_TYPE, "Variant"), "set_Variant", "get_Variant");
|
||||||
|
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_Variant"), &FileDialog::get_Variant);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_Variant", "value"), &FileDialog::set_Variant);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "Variant", PROPERTY_HINT_RESOURCE_TYPE, "Variant"), "set_Variant", "get_Variant");
|
||||||
|
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("_ready"), &FileDialog::_ready);
|
||||||
|
ClassDB::bind_method(D_METHOD("get_full_current_dir"), &FileDialog::get_full_current_dir);
|
||||||
|
ClassDB::bind_method(D_METHOD("_on_FileDialog_file_selected", "path"), &FileDialog::_on_FileDialog_file_selected);
|
||||||
|
ClassDB::bind_method(D_METHOD("_on_FileDialog_files_selected", "paths"), &FileDialog::_on_FileDialog_files_selected);
|
||||||
|
ClassDB::bind_method(D_METHOD("_on_FileDialog_dir_selected", "dir"), &FileDialog::_on_FileDialog_dir_selected);
|
||||||
|
ClassDB::bind_method(D_METHOD("_on_FileDialog_popup_hide"), &FileDialog::_on_FileDialog_popup_hide);
|
||||||
|
ClassDB::bind_method(D_METHOD("select_files"), &FileDialog::select_files);
|
||||||
|
ClassDB::bind_method(D_METHOD("add_favorite"), &FileDialog::add_favorite);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
1250
modules/material_maker/editor/widgets/file_dialog/file_dialog.ctscn
Normal file
1250
modules/material_maker/editor/widgets/file_dialog/file_dialog.ctscn
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,38 @@
|
|||||||
|
#ifndef FILE_DIALOG_H
|
||||||
|
#define FILE_DIALOG_H
|
||||||
|
|
||||||
|
|
||||||
|
class FileDialog : public FileDialog {
|
||||||
|
GDCLASS(FileDialog, FileDialog);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
Variant get_Variant();
|
||||||
|
void set_Variant(const Variant &val);
|
||||||
|
|
||||||
|
Variant get_Variant();
|
||||||
|
void set_Variant(const Variant &val);
|
||||||
|
|
||||||
|
void _ready();
|
||||||
|
String get_full_current_dir();
|
||||||
|
void _on_FileDialog_file_selected(const Variant &path);
|
||||||
|
void _on_FileDialog_files_selected(const Variant &paths);
|
||||||
|
void _on_FileDialog_dir_selected(const Variant &dir);
|
||||||
|
void _on_FileDialog_popup_hide();
|
||||||
|
Array select_files();
|
||||||
|
void add_favorite();
|
||||||
|
|
||||||
|
FileDialog();
|
||||||
|
~FileDialog();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
static void _bind_methods();
|
||||||
|
|
||||||
|
//tool
|
||||||
|
Variant = null;
|
||||||
|
Variant = null;
|
||||||
|
signal return_paths(path_list);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
167
modules/material_maker/editor/widgets/file_dialog/left_panel.cpp
Normal file
167
modules/material_maker/editor/widgets/file_dialog/left_panel.cpp
Normal file
@ -0,0 +1,167 @@
|
|||||||
|
|
||||||
|
#include "left_panel.h"
|
||||||
|
|
||||||
|
|
||||||
|
Array LeftPanel::get_recents() {
|
||||||
|
return recents;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LeftPanel::set_recents(const Array &val) {
|
||||||
|
recents = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Array LeftPanel::get_favorites() {
|
||||||
|
return favorites;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LeftPanel::set_favorites(const Array &val) {
|
||||||
|
favorites = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//tool;
|
||||||
|
Array recents = [];
|
||||||
|
Array favorites = [];
|
||||||
|
signal open_directory(dirpath);
|
||||||
|
//func _ready():;
|
||||||
|
// if get_node("/root/MainWindow") != null:;
|
||||||
|
// var config_cache = get_node("/root/MainWindow").config_cache;
|
||||||
|
// if config_cache.has_section_key("file_dialog", "recents"):;
|
||||||
|
// var parse_result = JSON.parse(config_cache.get_value("file_dialog", "recents"));
|
||||||
|
// if parse_result != null:;
|
||||||
|
// recents = parse_result.result;
|
||||||
|
// if config_cache.has_section_key("file_dialog", "favorites"):;
|
||||||
|
// var parse_result = JSON.parse(config_cache.get_value("file_dialog", "favorites"));
|
||||||
|
// if parse_result != null:;
|
||||||
|
// favorites = parse_result.result;
|
||||||
|
// update_lists();
|
||||||
|
//func _exit_tree():;
|
||||||
|
// if get_node("/root/MainWindow") != null:;
|
||||||
|
// var config_cache = get_node("/root/MainWindow").config_cache;
|
||||||
|
// config_cache.set_value("file_dialog", "recents", JSON.print(recents));
|
||||||
|
// config_cache.set_value("file_dialog", "favorites", JSON.print(favorites));
|
||||||
|
|
||||||
|
void LeftPanel::add_recent(const String &file_path) {
|
||||||
|
|
||||||
|
if (recents.find(file_path) != -1) {
|
||||||
|
recents.erase(file_path);
|
||||||
|
}
|
||||||
|
|
||||||
|
recents.push_front(file_path);
|
||||||
|
update_lists();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void LeftPanel::add_favorite(const String &file_path) {
|
||||||
|
|
||||||
|
if (favorites.find(file_path) == -1) {
|
||||||
|
favorites.push_back(file_path);
|
||||||
|
update_lists();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
String LeftPanel::my_basename(const String &s) {
|
||||||
|
int slash_pos = s.find_last("/");
|
||||||
|
|
||||||
|
if (slash_pos == -1 || slash_pos+1 == s.length()) {
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
return s.right(slash_pos+1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void LeftPanel::update_lists() {
|
||||||
|
$FavList.clear();
|
||||||
|
|
||||||
|
for (d in favorites) {
|
||||||
|
$FavList.add_item(my_basename(d));
|
||||||
|
$FavList.set_item_tooltip($FavList.get_item_count()-1, d);
|
||||||
|
}
|
||||||
|
|
||||||
|
$RecentList.clear();
|
||||||
|
|
||||||
|
for (d in recents) {
|
||||||
|
$RecentList.add_item(my_basename(d));
|
||||||
|
$RecentList.set_item_tooltip($RecentList.get_item_count()-1, d);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void LeftPanel::_on_FavList_item_activated(const Variant &index) {
|
||||||
|
emit_signal("open_directory", $FavList.get_item_tooltip(index));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void LeftPanel::_on_RecentList_item_activated(const Variant &index) {
|
||||||
|
emit_signal("open_directory", $RecentList.get_item_tooltip(index));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void LeftPanel::_on_FavList_gui_input(const Variant &event) {
|
||||||
|
|
||||||
|
if (event is InputEventKey && event.pressed && event.scancode == KEY_DELETE) {
|
||||||
|
|
||||||
|
if (! $FavList.get_selected_items().empty()) {
|
||||||
|
favorites.remove($FavList.get_selected_items()[0]);
|
||||||
|
update_lists();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void LeftPanel::_on_RecentList_gui_input(const Variant &event) {
|
||||||
|
|
||||||
|
if (event is InputEventKey && event.pressed && event.scancode == KEY_DELETE) {
|
||||||
|
|
||||||
|
if (! $RecentList.get_selected_items().empty()) {
|
||||||
|
recents.remove($RecentList.get_selected_items()[0]);
|
||||||
|
update_lists();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
LeftPanel::LeftPanel() {
|
||||||
|
recents = [];
|
||||||
|
favorites = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
LeftPanel::~LeftPanel() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void LeftPanel::_bind_methods() {
|
||||||
|
ClassDB::bind_method(D_METHOD("get_recents"), &LeftPanel::get_recents);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_recents", "value"), &LeftPanel::set_recents);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "recents"), "set_recents", "get_recents");
|
||||||
|
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_favorites"), &LeftPanel::get_favorites);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_favorites", "value"), &LeftPanel::set_favorites);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "favorites"), "set_favorites", "get_favorites");
|
||||||
|
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("add_recent", "file_path"), &LeftPanel::add_recent);
|
||||||
|
ClassDB::bind_method(D_METHOD("add_favorite", "file_path"), &LeftPanel::add_favorite);
|
||||||
|
ClassDB::bind_method(D_METHOD("my_basename", "s"), &LeftPanel::my_basename);
|
||||||
|
ClassDB::bind_method(D_METHOD("update_lists"), &LeftPanel::update_lists);
|
||||||
|
ClassDB::bind_method(D_METHOD("_on_FavList_item_activated", "index"), &LeftPanel::_on_FavList_item_activated);
|
||||||
|
ClassDB::bind_method(D_METHOD("_on_RecentList_item_activated", "index"), &LeftPanel::_on_RecentList_item_activated);
|
||||||
|
ClassDB::bind_method(D_METHOD("_on_FavList_gui_input", "event"), &LeftPanel::_on_FavList_gui_input);
|
||||||
|
ClassDB::bind_method(D_METHOD("_on_RecentList_gui_input", "event"), &LeftPanel::_on_RecentList_gui_input);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,178 @@
|
|||||||
|
|
||||||
|
void construct() {
|
||||||
|
|
||||||
|
//Script: res://addons/mat_maker_gd/windows/file_dialog/left_panel.gd
|
||||||
|
VBoxContainer *leftpanel = memnew(VBoxContainer);
|
||||||
|
leftpanel->set_name("LeftPanel");
|
||||||
|
|
||||||
|
leftpanel->set_name("LeftPanel");
|
||||||
|
//leftpanel->set("name", LeftPanel));
|
||||||
|
|
||||||
|
leftpanel->set_filename("res://addons/mat_maker_gd/windows/file_dialog/left_panel.tscn");
|
||||||
|
//leftpanel->set("filename", "res://addons/mat_maker_gd/windows/file_dialog/left_panel.tscn");
|
||||||
|
|
||||||
|
leftpanel->set_margin_right(40);
|
||||||
|
//leftpanel->set("margin_right", 40);
|
||||||
|
|
||||||
|
leftpanel->set_margin_bottom(40);
|
||||||
|
//leftpanel->set("margin_bottom", 40);
|
||||||
|
|
||||||
|
leftpanel->set_rect_size(Vector2(40, 40));
|
||||||
|
//leftpanel->set("rect_size", Vector2(40, 40));
|
||||||
|
|
||||||
|
leftpanel->set_size_flags_vertical(3);
|
||||||
|
//leftpanel->set("size_flags_vertical", 3);
|
||||||
|
|
||||||
|
//leftpanel property __meta__ TYPE_DICTIONARY value: {_edit_use_anchors_:False}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Label *recentlabel_leftpanel = memnew(Label);
|
||||||
|
recentlabel_leftpanel->set_name("RecentLabel");
|
||||||
|
leftpanel->add_child(recentlabel_leftpanel);
|
||||||
|
|
||||||
|
recentlabel_leftpanel->set_name("RecentLabel");
|
||||||
|
//recentlabel_leftpanel->set("name", RecentLabel));
|
||||||
|
|
||||||
|
//recentlabel_leftpanel property owner TYPE_OBJECT value: LeftPanel:[VBoxContainer:37180]
|
||||||
|
|
||||||
|
recentlabel_leftpanel->set_margin_right(100);
|
||||||
|
//recentlabel_leftpanel->set("margin_right", 100);
|
||||||
|
|
||||||
|
recentlabel_leftpanel->set_margin_bottom(14);
|
||||||
|
//recentlabel_leftpanel->set("margin_bottom", 14);
|
||||||
|
|
||||||
|
recentlabel_leftpanel->set_rect_size(Vector2(100, 14));
|
||||||
|
//recentlabel_leftpanel->set("rect_size", Vector2(100, 14));
|
||||||
|
|
||||||
|
recentlabel_leftpanel->set_text("Recent");
|
||||||
|
//recentlabel_leftpanel->set("text", "Recent");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ItemList *recentlist_leftpanel = memnew(ItemList);
|
||||||
|
recentlist_leftpanel->set_name("RecentList");
|
||||||
|
leftpanel->add_child(recentlist_leftpanel);
|
||||||
|
|
||||||
|
recentlist_leftpanel->set_name("RecentList");
|
||||||
|
//recentlist_leftpanel->set("name", RecentList));
|
||||||
|
|
||||||
|
//recentlist_leftpanel property owner TYPE_OBJECT value: LeftPanel:[VBoxContainer:37180]
|
||||||
|
|
||||||
|
recentlist_leftpanel->set_margin_top(18);
|
||||||
|
//recentlist_leftpanel->set("margin_top", 18);
|
||||||
|
|
||||||
|
recentlist_leftpanel->set_margin_right(100);
|
||||||
|
//recentlist_leftpanel->set("margin_right", 100);
|
||||||
|
|
||||||
|
recentlist_leftpanel->set_margin_bottom(18);
|
||||||
|
//recentlist_leftpanel->set("margin_bottom", 18);
|
||||||
|
|
||||||
|
recentlist_leftpanel->set_rect_position(Vector2(0, 18));
|
||||||
|
//recentlist_leftpanel->set("rect_position", Vector2(0, 18));
|
||||||
|
|
||||||
|
recentlist_leftpanel->set_rect_global_position(Vector2(0, 18));
|
||||||
|
//recentlist_leftpanel->set("rect_global_position", Vector2(0, 18));
|
||||||
|
|
||||||
|
recentlist_leftpanel->set_rect_size(Vector2(100, 0));
|
||||||
|
//recentlist_leftpanel->set("rect_size", Vector2(100, 0));
|
||||||
|
|
||||||
|
recentlist_leftpanel->set_rect_min_size(Vector2(100, 0));
|
||||||
|
//recentlist_leftpanel->set("rect_min_size", Vector2(100, 0));
|
||||||
|
|
||||||
|
recentlist_leftpanel->set_size_flags_vertical(3);
|
||||||
|
//recentlist_leftpanel->set("size_flags_vertical", 3);
|
||||||
|
|
||||||
|
//recentlist_leftpanel property __meta__ TYPE_DICTIONARY value: {_edit_use_anchors_:False}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
VScrollBar *vscrollbar_recentlist_leftpanel = memnew(VScrollBar);
|
||||||
|
vscrollbar_recentlist_leftpanel->set_name("VScrollBar");
|
||||||
|
recentlist_leftpanel->add_child(vscrollbar_recentlist_leftpanel);
|
||||||
|
|
||||||
|
vscrollbar_recentlist_leftpanel->set_name("VScrollBar");
|
||||||
|
//vscrollbar_recentlist_leftpanel->set("name", VScrollBar));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Label *favlabel_leftpanel = memnew(Label);
|
||||||
|
favlabel_leftpanel->set_name("FavLabel");
|
||||||
|
leftpanel->add_child(favlabel_leftpanel);
|
||||||
|
|
||||||
|
favlabel_leftpanel->set_name("FavLabel");
|
||||||
|
//favlabel_leftpanel->set("name", FavLabel));
|
||||||
|
|
||||||
|
//favlabel_leftpanel property owner TYPE_OBJECT value: LeftPanel:[VBoxContainer:37180]
|
||||||
|
|
||||||
|
favlabel_leftpanel->set_margin_top(22);
|
||||||
|
//favlabel_leftpanel->set("margin_top", 22);
|
||||||
|
|
||||||
|
favlabel_leftpanel->set_margin_right(100);
|
||||||
|
//favlabel_leftpanel->set("margin_right", 100);
|
||||||
|
|
||||||
|
favlabel_leftpanel->set_margin_bottom(36);
|
||||||
|
//favlabel_leftpanel->set("margin_bottom", 36);
|
||||||
|
|
||||||
|
favlabel_leftpanel->set_rect_position(Vector2(0, 22));
|
||||||
|
//favlabel_leftpanel->set("rect_position", Vector2(0, 22));
|
||||||
|
|
||||||
|
favlabel_leftpanel->set_rect_global_position(Vector2(0, 22));
|
||||||
|
//favlabel_leftpanel->set("rect_global_position", Vector2(0, 22));
|
||||||
|
|
||||||
|
favlabel_leftpanel->set_rect_size(Vector2(100, 14));
|
||||||
|
//favlabel_leftpanel->set("rect_size", Vector2(100, 14));
|
||||||
|
|
||||||
|
favlabel_leftpanel->set_text("Favorite");
|
||||||
|
//favlabel_leftpanel->set("text", "Favorite");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ItemList *favlist_leftpanel = memnew(ItemList);
|
||||||
|
favlist_leftpanel->set_name("FavList");
|
||||||
|
leftpanel->add_child(favlist_leftpanel);
|
||||||
|
|
||||||
|
favlist_leftpanel->set_name("FavList");
|
||||||
|
//favlist_leftpanel->set("name", FavList));
|
||||||
|
|
||||||
|
//favlist_leftpanel property owner TYPE_OBJECT value: LeftPanel:[VBoxContainer:37180]
|
||||||
|
|
||||||
|
favlist_leftpanel->set_margin_top(40);
|
||||||
|
//favlist_leftpanel->set("margin_top", 40);
|
||||||
|
|
||||||
|
favlist_leftpanel->set_margin_right(100);
|
||||||
|
//favlist_leftpanel->set("margin_right", 100);
|
||||||
|
|
||||||
|
favlist_leftpanel->set_margin_bottom(40);
|
||||||
|
//favlist_leftpanel->set("margin_bottom", 40);
|
||||||
|
|
||||||
|
favlist_leftpanel->set_rect_position(Vector2(0, 40));
|
||||||
|
//favlist_leftpanel->set("rect_position", Vector2(0, 40));
|
||||||
|
|
||||||
|
favlist_leftpanel->set_rect_global_position(Vector2(0, 40));
|
||||||
|
//favlist_leftpanel->set("rect_global_position", Vector2(0, 40));
|
||||||
|
|
||||||
|
favlist_leftpanel->set_rect_size(Vector2(100, 0));
|
||||||
|
//favlist_leftpanel->set("rect_size", Vector2(100, 0));
|
||||||
|
|
||||||
|
favlist_leftpanel->set_rect_min_size(Vector2(100, 0));
|
||||||
|
//favlist_leftpanel->set("rect_min_size", Vector2(100, 0));
|
||||||
|
|
||||||
|
favlist_leftpanel->set_size_flags_vertical(3);
|
||||||
|
//favlist_leftpanel->set("size_flags_vertical", 3);
|
||||||
|
|
||||||
|
//favlist_leftpanel property __meta__ TYPE_DICTIONARY value: {_edit_use_anchors_:False}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
VScrollBar *vscrollbar_favlist_leftpanel = memnew(VScrollBar);
|
||||||
|
vscrollbar_favlist_leftpanel->set_name("VScrollBar");
|
||||||
|
favlist_leftpanel->add_child(vscrollbar_favlist_leftpanel);
|
||||||
|
|
||||||
|
vscrollbar_favlist_leftpanel->set_name("VScrollBar");
|
||||||
|
//vscrollbar_favlist_leftpanel->set("name", VScrollBar));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,55 @@
|
|||||||
|
#ifndef LEFT_PANEL_H
|
||||||
|
#define LEFT_PANEL_H
|
||||||
|
|
||||||
|
|
||||||
|
class LeftPanel : public VBoxContainer {
|
||||||
|
GDCLASS(LeftPanel, VBoxContainer);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
Array get_recents();
|
||||||
|
void set_recents(const Array &val);
|
||||||
|
|
||||||
|
Array get_favorites();
|
||||||
|
void set_favorites(const Array &val);
|
||||||
|
|
||||||
|
void add_recent(const String &file_path);
|
||||||
|
void add_favorite(const String &file_path);
|
||||||
|
String my_basename(const String &s);
|
||||||
|
void update_lists();
|
||||||
|
void _on_FavList_item_activated(const Variant &index);
|
||||||
|
void _on_RecentList_item_activated(const Variant &index);
|
||||||
|
void _on_FavList_gui_input(const Variant &event);
|
||||||
|
void _on_RecentList_gui_input(const Variant &event);
|
||||||
|
|
||||||
|
LeftPanel();
|
||||||
|
~LeftPanel();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
static void _bind_methods();
|
||||||
|
|
||||||
|
//tool
|
||||||
|
Array recents = [];
|
||||||
|
Array favorites = [];
|
||||||
|
signal open_directory(dirpath);
|
||||||
|
//func _ready():
|
||||||
|
// if get_node("/root/MainWindow") != null:
|
||||||
|
// var config_cache = get_node("/root/MainWindow").config_cache
|
||||||
|
// if config_cache.has_section_key("file_dialog", "recents"):
|
||||||
|
// var parse_result = JSON.parse(config_cache.get_value("file_dialog", "recents"))
|
||||||
|
// if parse_result != null:
|
||||||
|
// recents = parse_result.result
|
||||||
|
// if config_cache.has_section_key("file_dialog", "favorites"):
|
||||||
|
// var parse_result = JSON.parse(config_cache.get_value("file_dialog", "favorites"))
|
||||||
|
// if parse_result != null:
|
||||||
|
// favorites = parse_result.result
|
||||||
|
// update_lists()
|
||||||
|
//func _exit_tree():
|
||||||
|
// if get_node("/root/MainWindow") != null:
|
||||||
|
// var config_cache = get_node("/root/MainWindow").config_cache
|
||||||
|
// config_cache.set_value("file_dialog", "recents", JSON.print(recents))
|
||||||
|
// config_cache.set_value("file_dialog", "favorites", JSON.print(favorites))
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
469
modules/material_maker/editor/widgets/float_edit/float_edit.cpp
Normal file
469
modules/material_maker/editor/widgets/float_edit/float_edit.cpp
Normal file
@ -0,0 +1,469 @@
|
|||||||
|
|
||||||
|
#include "float_edit.h"
|
||||||
|
|
||||||
|
|
||||||
|
float FloatEdit::get_value() const {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FloatEdit::set_value(const float val) {
|
||||||
|
value = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
float FloatEdit::get_min_value() const {
|
||||||
|
return min_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FloatEdit::set_min_value(const float val) {
|
||||||
|
min_value = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
float FloatEdit::get_max_value() const {
|
||||||
|
return max_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FloatEdit::set_max_value(const float val) {
|
||||||
|
max_value = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
float FloatEdit::get_step() const {
|
||||||
|
return step;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FloatEdit::set_step(const float val) {
|
||||||
|
step = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool FloatEdit::get_float_only() const {
|
||||||
|
return float_only;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FloatEdit::set_float_only(const bool val) {
|
||||||
|
float_only = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool FloatEdit::get_sliding() const {
|
||||||
|
return sliding;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FloatEdit::set_sliding(const bool val) {
|
||||||
|
sliding = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
float FloatEdit::get_start_position() const {
|
||||||
|
return start_position;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FloatEdit::set_start_position(const float val) {
|
||||||
|
start_position = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
float FloatEdit::get_last_position() const {
|
||||||
|
return last_position;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FloatEdit::set_last_position(const float val) {
|
||||||
|
last_position = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
float FloatEdit::get_start_value() const {
|
||||||
|
return start_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FloatEdit::set_start_value(const float val) {
|
||||||
|
start_value = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int FloatEdit::get_modifiers() const {
|
||||||
|
return modifiers;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FloatEdit::set_modifiers(const int val) {
|
||||||
|
modifiers = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool FloatEdit::get_from_lower_bound() const {
|
||||||
|
return from_lower_bound;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FloatEdit::set_from_lower_bound(const bool val) {
|
||||||
|
from_lower_bound = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool FloatEdit::get_from_upper_bound() const {
|
||||||
|
return from_upper_bound;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FloatEdit::set_from_upper_bound(const bool val) {
|
||||||
|
from_upper_bound = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//tool;
|
||||||
|
//export ;
|
||||||
|
// setget set_value;
|
||||||
|
float value = 0.5;
|
||||||
|
//export ;
|
||||||
|
// setget set_min_value;
|
||||||
|
float min_value = 0.0;
|
||||||
|
//export ;
|
||||||
|
// setget set_max_value;
|
||||||
|
float max_value = 1.0;
|
||||||
|
//export ;
|
||||||
|
// setget set_step;
|
||||||
|
float step = 0.0;
|
||||||
|
//export ;
|
||||||
|
bool float_only = false;
|
||||||
|
bool sliding = false;
|
||||||
|
float start_position = ;
|
||||||
|
float last_position = ;
|
||||||
|
float start_value = ;
|
||||||
|
int modifiers = ;
|
||||||
|
bool from_lower_bound = false;
|
||||||
|
bool from_upper_bound = false;
|
||||||
|
onready var slider = $Slider;
|
||||||
|
onready var cursor = $Slider/Cursor;
|
||||||
|
signal value_changed(value);
|
||||||
|
|
||||||
|
void FloatEdit::_ready() {
|
||||||
|
do_update();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void FloatEdit::set_value(const Variant &v) {
|
||||||
|
|
||||||
|
if (v is float) {
|
||||||
|
value = v;
|
||||||
|
do_update();
|
||||||
|
$Slider.visible = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
else if (v is String && !float_only) {
|
||||||
|
text = v;
|
||||||
|
$Slider.visible = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void FloatEdit::set_min_value(const float v) {
|
||||||
|
min_value = v;
|
||||||
|
do_update();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void FloatEdit::set_max_value(const float v) {
|
||||||
|
max_value = v;
|
||||||
|
do_update();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void FloatEdit::set_step(const float v) {
|
||||||
|
step = v;
|
||||||
|
do_update();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void FloatEdit::do_update(const bool update_text) {
|
||||||
|
|
||||||
|
if (update_text && $Slider.visible) {
|
||||||
|
text = str(value);
|
||||||
|
|
||||||
|
if (cursor != null) {
|
||||||
|
|
||||||
|
if (max_value != min_value) {
|
||||||
|
cursor.rect_position.x = (clamp(value, min_value, max_value)-min_value)*(slider.rect_size.x-cursor.rect_size.x)/(max_value-min_value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
else {
|
||||||
|
cursor.rect_position.x = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void FloatEdit::get_modifiers(const Variant &event) {
|
||||||
|
Variant = 0;
|
||||||
|
|
||||||
|
if (event.shift) {
|
||||||
|
new_modifiers |= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (event.control) {
|
||||||
|
new_modifiers |= 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (event.alt) {
|
||||||
|
new_modifiers |= 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new_modifiers;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void FloatEdit::_on_LineEdit_gui_input(const InputEvent &event) {
|
||||||
|
|
||||||
|
if (!$Slider.visible || !editable) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (event is InputEventMouseButton && event.button_index == BUTTON_LEFT) {
|
||||||
|
|
||||||
|
if (event.is_pressed()) {
|
||||||
|
last_position = event.position.x;
|
||||||
|
start_position = last_position;
|
||||||
|
start_value = value;
|
||||||
|
sliding = true;
|
||||||
|
from_lower_bound = value <= min_value;
|
||||||
|
from_upper_bound = value >= max_value;
|
||||||
|
modifiers = get_modifiers(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
else {
|
||||||
|
sliding = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
else if (sliding && event is InputEventMouseMotion && event.button_mask == BUTTON_MASK_LEFT) {
|
||||||
|
Variant = get_modifiers(event);
|
||||||
|
|
||||||
|
if (new_modifiers != modifiers) {
|
||||||
|
start_position = last_position;
|
||||||
|
start_value = value;
|
||||||
|
modifiers = new_modifiers;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
else {
|
||||||
|
last_position = event.position.x;
|
||||||
|
float delta = last_position-start_position;
|
||||||
|
Variant = step;
|
||||||
|
|
||||||
|
if (event.control) {
|
||||||
|
delta *= 0.2;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
else if (event.shift) {
|
||||||
|
delta *= 5.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (event.alt) {
|
||||||
|
current_step *= 0.01;
|
||||||
|
}
|
||||||
|
|
||||||
|
float v = start_value+sign(delta)*pow(abs(delta)*0.005, 2)*abs(max_value - min_value);
|
||||||
|
|
||||||
|
if (current_step != 0) {
|
||||||
|
v = min_value+floor((v - min_value)/current_step)*current_step;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!from_lower_bound && v < min_value) {
|
||||||
|
v = min_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!from_upper_bound && v > max_value) {
|
||||||
|
v = max_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
set_value(v);
|
||||||
|
select(0, 0);
|
||||||
|
emit_signal("value_changed", value);
|
||||||
|
release_focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
else if (event is InputEventKey && !event.echo) {
|
||||||
|
|
||||||
|
{
|
||||||
|
|
||||||
|
{
|
||||||
|
start_position = last_position;
|
||||||
|
start_value = value;
|
||||||
|
modifiers = get_modifiers(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void FloatEdit::_on_LineEdit_text_changed(const String &new_text) {
|
||||||
|
|
||||||
|
if (new_text.is_valid_float()) {
|
||||||
|
value = new_text.to_float();
|
||||||
|
do_update(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void FloatEdit::_on_LineEdit_text_entered(const String &new_text, const Variant &release) {
|
||||||
|
|
||||||
|
if (new_text.is_valid_float()) {
|
||||||
|
value = new_text.to_float();
|
||||||
|
do_update();
|
||||||
|
emit_signal("value_changed", value);
|
||||||
|
$Slider.visible = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
else if (float_only) {
|
||||||
|
do_update();
|
||||||
|
emit_signal("value_changed", value);
|
||||||
|
$Slider.visible = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
else {
|
||||||
|
emit_signal("value_changed", new_text);
|
||||||
|
$Slider.visible = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (release) {
|
||||||
|
release_focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void FloatEdit::_on_FloatEdit_focus_entered() {
|
||||||
|
select_all();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void FloatEdit::_on_LineEdit_focus_exited() {
|
||||||
|
_on_LineEdit_text_entered(text, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
FloatEdit::FloatEdit() {
|
||||||
|
value = 0.5;
|
||||||
|
min_value = 0.0;
|
||||||
|
max_value = 1.0;
|
||||||
|
step = 0.0;
|
||||||
|
float_only = false;
|
||||||
|
sliding = false;
|
||||||
|
start_position = ;
|
||||||
|
last_position = ;
|
||||||
|
start_value = ;
|
||||||
|
modifiers = ;
|
||||||
|
from_lower_bound = false;
|
||||||
|
from_upper_bound = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
FloatEdit::~FloatEdit() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void FloatEdit::_bind_methods() {
|
||||||
|
ClassDB::bind_method(D_METHOD("get_value"), &FloatEdit::get_value);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_value", "value"), &FloatEdit::set_value);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::REAL, "value"), "set_value", "get_value");
|
||||||
|
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_min_value"), &FloatEdit::get_min_value);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_min_value", "value"), &FloatEdit::set_min_value);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::REAL, "min_value"), "set_min_value", "get_min_value");
|
||||||
|
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_max_value"), &FloatEdit::get_max_value);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_max_value", "value"), &FloatEdit::set_max_value);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::REAL, "max_value"), "set_max_value", "get_max_value");
|
||||||
|
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_step"), &FloatEdit::get_step);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_step", "value"), &FloatEdit::set_step);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::REAL, "step"), "set_step", "get_step");
|
||||||
|
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_float_only"), &FloatEdit::get_float_only);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_float_only", "value"), &FloatEdit::set_float_only);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "float_only"), "set_float_only", "get_float_only");
|
||||||
|
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_sliding"), &FloatEdit::get_sliding);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_sliding", "value"), &FloatEdit::set_sliding);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "sliding"), "set_sliding", "get_sliding");
|
||||||
|
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_start_position"), &FloatEdit::get_start_position);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_start_position", "value"), &FloatEdit::set_start_position);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::REAL, "start_position"), "set_start_position", "get_start_position");
|
||||||
|
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_last_position"), &FloatEdit::get_last_position);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_last_position", "value"), &FloatEdit::set_last_position);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::REAL, "last_position"), "set_last_position", "get_last_position");
|
||||||
|
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_start_value"), &FloatEdit::get_start_value);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_start_value", "value"), &FloatEdit::set_start_value);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::REAL, "start_value"), "set_start_value", "get_start_value");
|
||||||
|
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_modifiers"), &FloatEdit::get_modifiers);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_modifiers", "value"), &FloatEdit::set_modifiers);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "modifiers"), "set_modifiers", "get_modifiers");
|
||||||
|
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_from_lower_bound"), &FloatEdit::get_from_lower_bound);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_from_lower_bound", "value"), &FloatEdit::set_from_lower_bound);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "from_lower_bound"), "set_from_lower_bound", "get_from_lower_bound");
|
||||||
|
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_from_upper_bound"), &FloatEdit::get_from_upper_bound);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_from_upper_bound", "value"), &FloatEdit::set_from_upper_bound);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "from_upper_bound"), "set_from_upper_bound", "get_from_upper_bound");
|
||||||
|
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("_ready"), &FloatEdit::_ready);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_value", "v"), &FloatEdit::set_value);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_min_value", "v"), &FloatEdit::set_min_value);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_max_value", "v"), &FloatEdit::set_max_value);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_step", "v"), &FloatEdit::set_step);
|
||||||
|
ClassDB::bind_method(D_METHOD("do_update", "update_text"), &FloatEdit::do_update, true);
|
||||||
|
ClassDB::bind_method(D_METHOD("get_modifiers", "event"), &FloatEdit::get_modifiers);
|
||||||
|
ClassDB::bind_method(D_METHOD("_on_LineEdit_gui_input", "event"), &FloatEdit::_on_LineEdit_gui_input);
|
||||||
|
ClassDB::bind_method(D_METHOD("_on_LineEdit_text_changed", "new_text"), &FloatEdit::_on_LineEdit_text_changed);
|
||||||
|
ClassDB::bind_method(D_METHOD("_on_LineEdit_text_entered", "new_text", "release"), &FloatEdit::_on_LineEdit_text_entered, true);
|
||||||
|
ClassDB::bind_method(D_METHOD("_on_FloatEdit_focus_entered"), &FloatEdit::_on_FloatEdit_focus_entered);
|
||||||
|
ClassDB::bind_method(D_METHOD("_on_LineEdit_focus_exited"), &FloatEdit::_on_LineEdit_focus_exited);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,172 @@
|
|||||||
|
|
||||||
|
void construct() {
|
||||||
|
|
||||||
|
//Script: res://addons/mat_maker_gd/widgets/float_edit/float_edit.gd
|
||||||
|
LineEdit *floatedit = memnew(LineEdit);
|
||||||
|
floatedit->set_name("FloatEdit");
|
||||||
|
|
||||||
|
floatedit->set_name("FloatEdit");
|
||||||
|
//floatedit->set("name", FloatEdit));
|
||||||
|
|
||||||
|
floatedit->set_filename("res://addons/mat_maker_gd/widgets/float_edit/float_edit.tscn");
|
||||||
|
//floatedit->set("filename", "res://addons/mat_maker_gd/widgets/float_edit/float_edit.tscn");
|
||||||
|
|
||||||
|
floatedit->set_anchor_left(1);
|
||||||
|
//floatedit->set("anchor_left", 1);
|
||||||
|
|
||||||
|
floatedit->set_anchor_right(1);
|
||||||
|
//floatedit->set("anchor_right", 1);
|
||||||
|
|
||||||
|
floatedit->set_anchor_bottom(1);
|
||||||
|
//floatedit->set("anchor_bottom", 1);
|
||||||
|
|
||||||
|
floatedit->set_margin_left(-1280);
|
||||||
|
//floatedit->set("margin_left", -1280);
|
||||||
|
|
||||||
|
floatedit->set_margin_right(-1222);
|
||||||
|
//floatedit->set("margin_right", -1222);
|
||||||
|
|
||||||
|
floatedit->set_margin_bottom(-696);
|
||||||
|
//floatedit->set("margin_bottom", -696);
|
||||||
|
|
||||||
|
floatedit->set_rect_position(Vector2(-1280, 0));
|
||||||
|
//floatedit->set("rect_position", Vector2(-1280, 0));
|
||||||
|
|
||||||
|
floatedit->set_rect_global_position(Vector2(-1280, 0));
|
||||||
|
//floatedit->set("rect_global_position", Vector2(-1280, 0));
|
||||||
|
|
||||||
|
floatedit->set_rect_size(Vector2(58, 24));
|
||||||
|
//floatedit->set("rect_size", Vector2(58, 24));
|
||||||
|
|
||||||
|
floatedit->set_focus_mode(1);
|
||||||
|
//floatedit->set("focus_mode", 1);
|
||||||
|
|
||||||
|
floatedit->set_text("0.5");
|
||||||
|
//floatedit->set("text", "0.5");
|
||||||
|
|
||||||
|
floatedit->set_max_length(100);
|
||||||
|
//floatedit->set("max_length", 100);
|
||||||
|
|
||||||
|
floatedit->set_context_menu_enabled(False);
|
||||||
|
//floatedit->set("context_menu_enabled", False);
|
||||||
|
|
||||||
|
floatedit->set_caret_blink(True);
|
||||||
|
//floatedit->set("caret_blink", True);
|
||||||
|
|
||||||
|
//floatedit property __meta__ TYPE_DICTIONARY value: {_edit_use_anchors_:False}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Timer *timer_floatedit = memnew(Timer);
|
||||||
|
timer_floatedit->set_name("Timer");
|
||||||
|
floatedit->add_child(timer_floatedit);
|
||||||
|
|
||||||
|
timer_floatedit->set_name("Timer");
|
||||||
|
//timer_floatedit->set("name", Timer));
|
||||||
|
|
||||||
|
timer_floatedit->set_wait_time(0.65);
|
||||||
|
//timer_floatedit->set("wait_time", 0.65);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
PopupMenu *popupmenu_floatedit = memnew(PopupMenu);
|
||||||
|
popupmenu_floatedit->set_name("PopupMenu");
|
||||||
|
floatedit->add_child(popupmenu_floatedit);
|
||||||
|
|
||||||
|
popupmenu_floatedit->set_name("PopupMenu");
|
||||||
|
//popupmenu_floatedit->set("name", PopupMenu));
|
||||||
|
|
||||||
|
//popupmenu_floatedit property items TYPE_ARRAY value: [Cut, [Object:null], 0, False, False, 0, 268435544, Null, , False, Copy, [Object:null], 0, False, False, 1, 268435523, Null, , False, Paste, [Object:null], 0, False, False, 2, 268435542, Null, , False, , [Object:null], 0, False, False, -1, 0, Null, , True, Select All, [Object:null], 0, False, False, 4, 268435521, Null, , False, Clear, [Object:null], 0, False, False, 3, 0, Null, , False, , [Object:null], 0, False, False, -1, 0, Null, , True, Undo, [Object:null], 0, False, False, 5, 268435546, Null, , False, Redo, [Object:null], 0, False, False, 6, 301989978, Null, , False]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Timer *timer_popupmenu_floatedit = memnew(Timer);
|
||||||
|
timer_popupmenu_floatedit->set_name("Timer");
|
||||||
|
popupmenu_floatedit->add_child(timer_popupmenu_floatedit);
|
||||||
|
|
||||||
|
timer_popupmenu_floatedit->set_name("Timer");
|
||||||
|
//timer_popupmenu_floatedit->set("name", Timer));
|
||||||
|
|
||||||
|
timer_popupmenu_floatedit->set_wait_time(0.3);
|
||||||
|
//timer_popupmenu_floatedit->set("wait_time", 0.3);
|
||||||
|
|
||||||
|
timer_popupmenu_floatedit->set_one_shot(True);
|
||||||
|
//timer_popupmenu_floatedit->set("one_shot", True);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ColorRect *slider_floatedit = memnew(ColorRect);
|
||||||
|
slider_floatedit->set_name("Slider");
|
||||||
|
floatedit->add_child(slider_floatedit);
|
||||||
|
|
||||||
|
slider_floatedit->set_name("Slider");
|
||||||
|
//slider_floatedit->set("name", Slider));
|
||||||
|
|
||||||
|
//slider_floatedit property owner TYPE_OBJECT value: FloatEdit:[LineEdit:55206]
|
||||||
|
|
||||||
|
slider_floatedit->set_anchor_top(1);
|
||||||
|
//slider_floatedit->set("anchor_top", 1);
|
||||||
|
|
||||||
|
slider_floatedit->set_anchor_right(1);
|
||||||
|
//slider_floatedit->set("anchor_right", 1);
|
||||||
|
|
||||||
|
slider_floatedit->set_anchor_bottom(1);
|
||||||
|
//slider_floatedit->set("anchor_bottom", 1);
|
||||||
|
|
||||||
|
slider_floatedit->set_margin_left(2);
|
||||||
|
//slider_floatedit->set("margin_left", 2);
|
||||||
|
|
||||||
|
slider_floatedit->set_margin_top(-3);
|
||||||
|
//slider_floatedit->set("margin_top", -3);
|
||||||
|
|
||||||
|
slider_floatedit->set_margin_right(-2);
|
||||||
|
//slider_floatedit->set("margin_right", -2);
|
||||||
|
|
||||||
|
slider_floatedit->set_margin_bottom(-3);
|
||||||
|
//slider_floatedit->set("margin_bottom", -3);
|
||||||
|
|
||||||
|
slider_floatedit->set_rect_position(Vector2(2, -3));
|
||||||
|
//slider_floatedit->set("rect_position", Vector2(2, -3));
|
||||||
|
|
||||||
|
slider_floatedit->set_rect_global_position(Vector2(2, -3));
|
||||||
|
//slider_floatedit->set("rect_global_position", Vector2(2, -3));
|
||||||
|
|
||||||
|
slider_floatedit->set_rect_min_size(Vector2(0, 2));
|
||||||
|
//slider_floatedit->set("rect_min_size", Vector2(0, 2));
|
||||||
|
|
||||||
|
slider_floatedit->set_mouse_filter(2);
|
||||||
|
//slider_floatedit->set("mouse_filter", 2);
|
||||||
|
|
||||||
|
slider_floatedit->set_color(Color(0.501961, 0.501961, 0.501961, 1));
|
||||||
|
//slider_floatedit->set("color", Color(0.501961, 0.501961, 0.501961, 1));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ColorRect *cursor_slider_floatedit = memnew(ColorRect);
|
||||||
|
cursor_slider_floatedit->set_name("Cursor");
|
||||||
|
slider_floatedit->add_child(cursor_slider_floatedit);
|
||||||
|
|
||||||
|
cursor_slider_floatedit->set_name("Cursor");
|
||||||
|
//cursor_slider_floatedit->set("name", Cursor));
|
||||||
|
|
||||||
|
//cursor_slider_floatedit property owner TYPE_OBJECT value: FloatEdit:[LineEdit:55206]
|
||||||
|
|
||||||
|
cursor_slider_floatedit->set_margin_right(3);
|
||||||
|
//cursor_slider_floatedit->set("margin_right", 3);
|
||||||
|
|
||||||
|
cursor_slider_floatedit->set_margin_bottom(1);
|
||||||
|
//cursor_slider_floatedit->set("margin_bottom", 1);
|
||||||
|
|
||||||
|
cursor_slider_floatedit->set_rect_size(Vector2(3, 1));
|
||||||
|
//cursor_slider_floatedit->set("rect_size", Vector2(3, 1));
|
||||||
|
|
||||||
|
cursor_slider_floatedit->set_rect_min_size(Vector2(3, 2));
|
||||||
|
//cursor_slider_floatedit->set("rect_min_size", Vector2(3, 2));
|
||||||
|
|
||||||
|
cursor_slider_floatedit->set_mouse_filter(2);
|
||||||
|
//cursor_slider_floatedit->set("mouse_filter", 2);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,93 @@
|
|||||||
|
#ifndef FLOAT_EDIT_H
|
||||||
|
#define FLOAT_EDIT_H
|
||||||
|
|
||||||
|
|
||||||
|
class FloatEdit : public LineEdit {
|
||||||
|
GDCLASS(FloatEdit, LineEdit);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
float get_value() const;
|
||||||
|
void set_value(const float val);
|
||||||
|
|
||||||
|
float get_min_value() const;
|
||||||
|
void set_min_value(const float val);
|
||||||
|
|
||||||
|
float get_max_value() const;
|
||||||
|
void set_max_value(const float val);
|
||||||
|
|
||||||
|
float get_step() const;
|
||||||
|
void set_step(const float val);
|
||||||
|
|
||||||
|
bool get_float_only() const;
|
||||||
|
void set_float_only(const bool val);
|
||||||
|
|
||||||
|
bool get_sliding() const;
|
||||||
|
void set_sliding(const bool val);
|
||||||
|
|
||||||
|
float get_start_position() const;
|
||||||
|
void set_start_position(const float val);
|
||||||
|
|
||||||
|
float get_last_position() const;
|
||||||
|
void set_last_position(const float val);
|
||||||
|
|
||||||
|
float get_start_value() const;
|
||||||
|
void set_start_value(const float val);
|
||||||
|
|
||||||
|
int get_modifiers() const;
|
||||||
|
void set_modifiers(const int val);
|
||||||
|
|
||||||
|
bool get_from_lower_bound() const;
|
||||||
|
void set_from_lower_bound(const bool val);
|
||||||
|
|
||||||
|
bool get_from_upper_bound() const;
|
||||||
|
void set_from_upper_bound(const bool val);
|
||||||
|
|
||||||
|
void _ready();
|
||||||
|
void set_value(const Variant &v);
|
||||||
|
void set_min_value(const float v);
|
||||||
|
void set_max_value(const float v);
|
||||||
|
void set_step(const float v);
|
||||||
|
void do_update(const bool update_text = true);
|
||||||
|
void get_modifiers(const Variant &event);
|
||||||
|
void _on_LineEdit_gui_input(const InputEvent &event);
|
||||||
|
void _on_LineEdit_text_changed(const String &new_text);
|
||||||
|
void _on_LineEdit_text_entered(const String &new_text, const Variant &release = true);
|
||||||
|
void _on_FloatEdit_focus_entered();
|
||||||
|
void _on_LineEdit_focus_exited();
|
||||||
|
|
||||||
|
FloatEdit();
|
||||||
|
~FloatEdit();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
static void _bind_methods();
|
||||||
|
|
||||||
|
//tool
|
||||||
|
//export
|
||||||
|
// setget set_value
|
||||||
|
float value = 0.5;
|
||||||
|
//export
|
||||||
|
// setget set_min_value
|
||||||
|
float min_value = 0.0;
|
||||||
|
//export
|
||||||
|
// setget set_max_value
|
||||||
|
float max_value = 1.0;
|
||||||
|
//export
|
||||||
|
// setget set_step
|
||||||
|
float step = 0.0;
|
||||||
|
//export
|
||||||
|
bool float_only = false;
|
||||||
|
bool sliding = false;
|
||||||
|
float start_position = ;
|
||||||
|
float last_position = ;
|
||||||
|
float start_value = ;
|
||||||
|
int modifiers = ;
|
||||||
|
bool from_lower_bound = false;
|
||||||
|
bool from_upper_bound = false;
|
||||||
|
onready var slider = $Slider;
|
||||||
|
onready var cursor = $Slider/Cursor;
|
||||||
|
signal value_changed(value);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,555 @@
|
|||||||
|
|
||||||
|
#include "gradient_editor.h"
|
||||||
|
|
||||||
|
|
||||||
|
Variant GradientEditor::get_Variant() {
|
||||||
|
return Variant;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GradientEditor::set_Variant(const Variant &val) {
|
||||||
|
Variant = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Variant GradientEditor::get_Variant() {
|
||||||
|
return Variant;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GradientEditor::set_Variant(const Variant &val) {
|
||||||
|
Variant = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool GradientEditor::get_embedded() const {
|
||||||
|
return embedded;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GradientEditor::set_embedded(const bool val) {
|
||||||
|
embedded = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
UndoRedo GradientEditor::get_*_undo_redo() {
|
||||||
|
return *_undo_redo;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GradientEditor::set_*_undo_redo(const UndoRedo &val) {
|
||||||
|
*_undo_redo = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PoolRealArray GradientEditor::get__saved_points() {
|
||||||
|
return _saved_points;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GradientEditor::set__saved_points(const PoolRealArray &val) {
|
||||||
|
_saved_points = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Variant GradientEditor::get_Variant() {
|
||||||
|
return Variant;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GradientEditor::set_Variant(const Variant &val) {
|
||||||
|
Variant = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//tool;
|
||||||
|
|
||||||
|
Color GradientCursor::get_color() {
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GradientCursor::set_color(const Color &val) {
|
||||||
|
color = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool GradientCursor::get_sliding() const {
|
||||||
|
return sliding;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GradientCursor::set_sliding(const bool val) {
|
||||||
|
sliding = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
extends Control;
|
||||||
|
Color color = ;
|
||||||
|
bool sliding = false;
|
||||||
|
onready var label : Label = get_parent().get_node("Value");
|
||||||
|
const WIDTH : int = 10;
|
||||||
|
|
||||||
|
void GradientCursor::_ready() {
|
||||||
|
rect_position = Vector2(0, 15);
|
||||||
|
rect_size = Vector2(WIDTH, 15);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GradientCursor::_draw() {
|
||||||
|
// warning-ignore:integer_division;
|
||||||
|
PoolVector2Array polygon = PoolVector2Array([Vector2(0, 5), Vector2(WIDTH/2, 0), Vector2(WIDTH, 5), Vector2(WIDTH, 15), Vector2(0, 15), Vector2(0, 5)]);
|
||||||
|
Variant = color;
|
||||||
|
c.a = 1.0;
|
||||||
|
draw_colored_polygon(polygon, c);
|
||||||
|
draw_polyline(polygon, Color(0.0, 0.0, 0.0) if color.v > 0.5 else Color(1.0, 1.0, 1.0));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GradientCursor::_gui_input(const Variant &ev) {
|
||||||
|
|
||||||
|
if (ev is InputEventMouseButton) {
|
||||||
|
|
||||||
|
if (ev.button_index == BUTTON_LEFT) {
|
||||||
|
|
||||||
|
if (ev.doubleclick) {
|
||||||
|
get_parent().save_color_state();
|
||||||
|
get_parent().select_color(self, ev.global_position);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
else if (ev.pressed) {
|
||||||
|
get_parent().save_color_state();
|
||||||
|
sliding = true;
|
||||||
|
label.visible = true;
|
||||||
|
label.text = "%.03f" % get_cursor_position();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
else {
|
||||||
|
|
||||||
|
if (sliding) {
|
||||||
|
get_parent().undo_redo_save_color_state();
|
||||||
|
}
|
||||||
|
|
||||||
|
sliding = false;
|
||||||
|
label.visible = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
else if (ev.button_index == BUTTON_RIGHT && get_parent().get_sorted_cursors().size() > 2) {
|
||||||
|
Variant = get_parent();
|
||||||
|
parent.save_color_state();
|
||||||
|
parent.remove_child(self);
|
||||||
|
parent.update_value();
|
||||||
|
parent.undo_redo_save_color_state();
|
||||||
|
queue_free();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
else if (ev is InputEventMouseMotion && (ev.button_mask & BUTTON_MASK_LEFT) != 0 && sliding) {
|
||||||
|
rect_position.x += get_local_mouse_position().x;
|
||||||
|
|
||||||
|
if (ev.control) {
|
||||||
|
rect_position.x = round(get_cursor_position()*20.0)*0.05*(get_parent().rect_size.x - WIDTH);
|
||||||
|
}
|
||||||
|
|
||||||
|
rect_position.x = min(max(0, rect_position.x), get_parent().rect_size.x-rect_size.x);
|
||||||
|
get_parent().update_value();
|
||||||
|
label.text = "%.03f" % get_cursor_position();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
float GradientCursor::get_cursor_position() {
|
||||||
|
return rect_position.x / (get_parent().rect_size.x - WIDTH);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GradientCursor::set_color(const Variant &c) {
|
||||||
|
color = c;
|
||||||
|
get_parent().update_value();
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool GradientCursor::sort(const Variant &a, const Variant & b) {
|
||||||
|
return a.get_position() < b.get_position();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool GradientCursor::can_drop_data(const Variant &_position, const Variant & data) {
|
||||||
|
return typeof(data) == TYPE_COLOR;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GradientCursor::drop_data(const Variant &_position, const Variant & data) {
|
||||||
|
set_color(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
GradientCursor::GradientCursor() {
|
||||||
|
color = ;
|
||||||
|
sliding = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
GradientCursor::~GradientCursor() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void GradientCursor::_bind_methods() {
|
||||||
|
ClassDB::bind_method(D_METHOD("get_color"), &GradientCursor::get_color);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_color", "value"), &GradientCursor::set_color);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "color"), "set_color", "get_color");
|
||||||
|
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_sliding"), &GradientCursor::get_sliding);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_sliding", "value"), &GradientCursor::set_sliding);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "sliding"), "set_sliding", "get_sliding");
|
||||||
|
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("_ready"), &GradientCursor::_ready);
|
||||||
|
ClassDB::bind_method(D_METHOD("_draw"), &GradientCursor::_draw);
|
||||||
|
ClassDB::bind_method(D_METHOD("_gui_input", "ev"), &GradientCursor::_gui_input);
|
||||||
|
ClassDB::bind_method(D_METHOD("get_cursor_position"), &GradientCursor::get_cursor_position);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_color", "c"), &GradientCursor::set_color);
|
||||||
|
ClassDB::bind_method(D_METHOD("can_drop_data", "_position", " data"), &GradientCursor::can_drop_data);
|
||||||
|
ClassDB::bind_method(D_METHOD("drop_data", "_position", " data"), &GradientCursor::drop_data);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Variant = null;
|
||||||
|
// setget set_value;
|
||||||
|
Variant = null;
|
||||||
|
//export ;
|
||||||
|
bool embedded = true;
|
||||||
|
UndoRedo *_undo_redo = null;
|
||||||
|
signal updated(value);
|
||||||
|
PoolRealArray _saved_points = PoolRealArray();
|
||||||
|
|
||||||
|
void GradientEditor::_init() {
|
||||||
|
connect("resized", self, "on_resized");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GradientEditor::ignore_changes(const Variant &val) {
|
||||||
|
graph_node.ignore_changes(val);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GradientEditor::save_color_state() {
|
||||||
|
PoolRealArray p = value.points;
|
||||||
|
_saved_points.resize(0);
|
||||||
|
|
||||||
|
for (v in p) {
|
||||||
|
_saved_points.push_back(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
ignore_changes(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GradientEditor::undo_redo_save_color_state() {
|
||||||
|
PoolRealArray op = ;
|
||||||
|
PoolRealArray np = ;
|
||||||
|
|
||||||
|
for (v in _saved_points) {
|
||||||
|
op.push_back(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
for (v in value.get_points()) {
|
||||||
|
np.push_back(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
_undo_redo.create_action("MMGD: gradient colors changed");
|
||||||
|
_undo_redo.add_do_method(value, "set_points", np);
|
||||||
|
_undo_redo.add_undo_method(value, "set_points", op);
|
||||||
|
_undo_redo.commit_action();
|
||||||
|
ignore_changes(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GradientEditor::set_undo_redo(const UndoRedo &ur) {
|
||||||
|
_undo_redo = ur;
|
||||||
|
}
|
||||||
|
|
||||||
|
//func get_gradient_from_data(data):;
|
||||||
|
// if typeof(data) == TYPE_ARRAY:;
|
||||||
|
// return data;
|
||||||
|
// elif typeof(data) == TYPE_DICTIONARY:;
|
||||||
|
// if data.has("parameters") and data.parameters.has("gradient"):;
|
||||||
|
// return data.parameters.gradient;
|
||||||
|
// if data.has("type") and data.type == "Gradient":;
|
||||||
|
// return data;
|
||||||
|
// return null;
|
||||||
|
//func get_drag_data(_position : Vector2):;
|
||||||
|
// var data = 0//MMType.serialize_value(value);
|
||||||
|
// var preview = ColorRect.new();
|
||||||
|
// preview.rect_size = Vector2(64, 24);
|
||||||
|
// preview.material = $Gradient.material;
|
||||||
|
// set_drag_preview(preview);
|
||||||
|
// return data;
|
||||||
|
//;
|
||||||
|
//func can_drop_data(_position : Vector2, data) -> bool:;
|
||||||
|
// return get_gradient_from_data(data) != null;
|
||||||
|
//;
|
||||||
|
//func drop_data(_position : Vector2, data) -> void:;
|
||||||
|
// var gradient = get_gradient_from_data(data);
|
||||||
|
// //if gradient != null:;
|
||||||
|
// //set_value(MMType.deserialize_value(gradient));
|
||||||
|
|
||||||
|
void GradientEditor::set_value(const Variant &v) {
|
||||||
|
value = v;
|
||||||
|
update_preview();
|
||||||
|
call_deferred("update_cursors");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GradientEditor::update_cursors() {
|
||||||
|
|
||||||
|
for (c in get_children()) {
|
||||||
|
|
||||||
|
if (c is GradientCursor) {
|
||||||
|
remove_child(c);
|
||||||
|
c.free();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int vs = value.get_point_count();
|
||||||
|
|
||||||
|
for (int i = 0; i < vs; ++i) { //i in range(vs)
|
||||||
|
add_cursor(value.get_point_value(i) * (rect_size.x-GradientCursor.WIDTH), value.get_point_color(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
$Interpolation.selected = value.interpolation_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GradientEditor::update_value() {
|
||||||
|
value.clear();
|
||||||
|
Array sc = get_sorted_cursors();
|
||||||
|
PoolRealArray points = PoolRealArray();
|
||||||
|
|
||||||
|
for (c in sc) {
|
||||||
|
points.push_back(c.rect_position.x/(rect_size.x-GradientCursor.WIDTH));
|
||||||
|
Color color = c.color;
|
||||||
|
points.push_back(color.r);
|
||||||
|
points.push_back(color.g);
|
||||||
|
points.push_back(color.b);
|
||||||
|
points.push_back(color.a);
|
||||||
|
}
|
||||||
|
|
||||||
|
value.set_points(points);
|
||||||
|
update_preview();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GradientEditor::add_cursor(const Variant &x, const Variant & color) {
|
||||||
|
Variant = GradientCursor.new();
|
||||||
|
add_child(cursor);
|
||||||
|
cursor.rect_position.x = x;
|
||||||
|
cursor.color = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GradientEditor::_gui_input(const Variant &ev) {
|
||||||
|
|
||||||
|
if (ev is InputEventMouseButton && ev.button_index == 1 && ev.doubleclick) {
|
||||||
|
|
||||||
|
if (ev.position.y > 15) {
|
||||||
|
Variant = clamp(ev.position.x, 0, rect_size.x-GradientCursor.WIDTH);
|
||||||
|
save_color_state();
|
||||||
|
add_cursor(p, get_gradient_color(p));
|
||||||
|
update_value();
|
||||||
|
undo_redo_save_color_state();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
else if (embedded) {
|
||||||
|
Variant = load("res://addons/mat_maker_gd/widgets/gradient_editor/gradient_popup.tscn").instance();
|
||||||
|
add_child(popup);
|
||||||
|
Variant = popup.rect_size;
|
||||||
|
popup.popup(Rect2(ev.global_position, Vector2(0, 0)));
|
||||||
|
popup.set_global_position(ev.global_position-Vector2(popup_size.x / 2, popup_size.y));
|
||||||
|
popup.init(value, graph_node, _undo_redo);
|
||||||
|
popup.connect("updated", self, "set_value");
|
||||||
|
popup.connect("popup_hide", popup, "queue_free");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Showing a color picker popup to change a cursor's color;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Variant ;
|
||||||
|
|
||||||
|
void GradientEditor::select_color(const Variant &cursor, const Variant & position) {
|
||||||
|
active_cursor = cursor;
|
||||||
|
//var color_picker_popup = preload("res://addons/mat_maker_gd/widgets/color_picker_popup/color_picker_popup.tscn").instance();
|
||||||
|
add_child(color_picker_popup);
|
||||||
|
Variant = color_picker_popup.get_node("ColorPicker");
|
||||||
|
color_picker.color = cursor.color;
|
||||||
|
color_picker.connect("color_changed", cursor, "set_color");
|
||||||
|
color_picker_popup.rect_position = position;
|
||||||
|
color_picker_popup.connect("popup_hide", self, "undo_redo_save_color_state");
|
||||||
|
color_picker_popup.connect("popup_hide", color_picker_popup, "queue_free");
|
||||||
|
color_picker_popup.popup();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculating a color from the gradient and generating the shader;
|
||||||
|
|
||||||
|
Array GradientEditor::get_sorted_cursors() {
|
||||||
|
Variant = [];
|
||||||
|
|
||||||
|
for (c in get_children()) {
|
||||||
|
|
||||||
|
if (c is GradientCursor) {
|
||||||
|
array.append(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
array.sort_custom(GradientCursor, "sort");
|
||||||
|
return array;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GradientEditor::generate_preview_image() {
|
||||||
|
Ref<ImageTexture> tex = $Gradient.texture;
|
||||||
|
|
||||||
|
if (!tex) {
|
||||||
|
tex = ImageTexture.new();
|
||||||
|
$Gradient.texture = tex;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ref<Image> img = tex.get_data();
|
||||||
|
float w = $Gradient.rect_size.x;
|
||||||
|
float h = $Gradient.rect_size.y;
|
||||||
|
|
||||||
|
if (!img) {
|
||||||
|
img = Image.new();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (img.get_size().x != w || img.get_size().y != h) {
|
||||||
|
img.create(w, h, false, Image.FORMAT_RGBA8);
|
||||||
|
}
|
||||||
|
|
||||||
|
img.lock();
|
||||||
|
|
||||||
|
for (int i = 0; i < w; ++i) { //i in range(w)
|
||||||
|
float x = float(i) / float(w);
|
||||||
|
Color col = value.get_gradient_color(x);
|
||||||
|
|
||||||
|
for (int j = 0; j < h; ++j) { //j in range(h)
|
||||||
|
img.set_pixel(i, j, col);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
img.unlock();
|
||||||
|
tex.create_from_image(img, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Color GradientEditor::get_gradient_color(const Variant &x) {
|
||||||
|
return value.get_gradient_color(x / (rect_size.x - GradientCursor.WIDTH));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GradientEditor::update_preview() {
|
||||||
|
call_deferred("generate_preview_image");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GradientEditor::_on_Interpolation_item_selected(const Variant &ID) {
|
||||||
|
ignore_changes(true);
|
||||||
|
_undo_redo.create_action("MMGD: gradient interpolation_type changed");
|
||||||
|
_undo_redo.add_do_method(value, "set_interpolation_type", ID);
|
||||||
|
_undo_redo.add_undo_method(value, "set_interpolation_type", value.interpolation_type);
|
||||||
|
_undo_redo.commit_action();
|
||||||
|
ignore_changes(false);
|
||||||
|
update_preview();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GradientEditor::on_resized() {
|
||||||
|
|
||||||
|
if (value) {
|
||||||
|
update_preview();
|
||||||
|
call_deferred("update_cursors");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
GradientEditor::GradientEditor() {
|
||||||
|
= null;
|
||||||
|
= null;
|
||||||
|
embedded = true;
|
||||||
|
*_undo_redo = null;
|
||||||
|
_saved_points = PoolRealArray();
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
GradientEditor::~GradientEditor() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void GradientEditor::_bind_methods() {
|
||||||
|
ClassDB::bind_method(D_METHOD("get_Variant"), &GradientEditor::get_Variant);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_Variant", "value"), &GradientEditor::set_Variant);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "Variant", PROPERTY_HINT_RESOURCE_TYPE, "Variant"), "set_Variant", "get_Variant");
|
||||||
|
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_Variant"), &GradientEditor::get_Variant);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_Variant", "value"), &GradientEditor::set_Variant);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "Variant", PROPERTY_HINT_RESOURCE_TYPE, "Variant"), "set_Variant", "get_Variant");
|
||||||
|
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_embedded"), &GradientEditor::get_embedded);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_embedded", "value"), &GradientEditor::set_embedded);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "embedded"), "set_embedded", "get_embedded");
|
||||||
|
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_*_undo_redo"), &GradientEditor::get_*_undo_redo);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_*_undo_redo", "value"), &GradientEditor::set_*_undo_redo);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "*_undo_redo", PROPERTY_HINT_RESOURCE_TYPE, "UndoRedo"), "set_*_undo_redo", "get_*_undo_redo");
|
||||||
|
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get__saved_points"), &GradientEditor::get__saved_points);
|
||||||
|
ClassDB::bind_method(D_METHOD("set__saved_points", "value"), &GradientEditor::set__saved_points);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::POOL_REAL_ARRAY, "_saved_points"), "set__saved_points", "get__saved_points");
|
||||||
|
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_Variant"), &GradientEditor::get_Variant);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_Variant", "value"), &GradientEditor::set_Variant);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "Variant", PROPERTY_HINT_RESOURCE_TYPE, "Variant"), "set_Variant", "get_Variant");
|
||||||
|
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("_init"), &GradientEditor::_init);
|
||||||
|
ClassDB::bind_method(D_METHOD("ignore_changes", "val"), &GradientEditor::ignore_changes);
|
||||||
|
ClassDB::bind_method(D_METHOD("save_color_state"), &GradientEditor::save_color_state);
|
||||||
|
ClassDB::bind_method(D_METHOD("undo_redo_save_color_state"), &GradientEditor::undo_redo_save_color_state);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_undo_redo", "ur"), &GradientEditor::set_undo_redo);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_value", "v"), &GradientEditor::set_value);
|
||||||
|
ClassDB::bind_method(D_METHOD("update_cursors"), &GradientEditor::update_cursors);
|
||||||
|
ClassDB::bind_method(D_METHOD("update_value"), &GradientEditor::update_value);
|
||||||
|
ClassDB::bind_method(D_METHOD("add_cursor", "x", " color"), &GradientEditor::add_cursor);
|
||||||
|
ClassDB::bind_method(D_METHOD("_gui_input", "ev"), &GradientEditor::_gui_input);
|
||||||
|
ClassDB::bind_method(D_METHOD("select_color", "cursor", " position"), &GradientEditor::select_color);
|
||||||
|
ClassDB::bind_method(D_METHOD("get_sorted_cursors"), &GradientEditor::get_sorted_cursors);
|
||||||
|
ClassDB::bind_method(D_METHOD("generate_preview_image"), &GradientEditor::generate_preview_image);
|
||||||
|
ClassDB::bind_method(D_METHOD("get_gradient_color", "x"), &GradientEditor::get_gradient_color);
|
||||||
|
ClassDB::bind_method(D_METHOD("update_preview"), &GradientEditor::update_preview);
|
||||||
|
ClassDB::bind_method(D_METHOD("_on_Interpolation_item_selected", "ID"), &GradientEditor::_on_Interpolation_item_selected);
|
||||||
|
ClassDB::bind_method(D_METHOD("on_resized"), &GradientEditor::on_resized);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,251 @@
|
|||||||
|
|
||||||
|
void construct() {
|
||||||
|
|
||||||
|
//Script: res://addons/mat_maker_gd/widgets/gradient_editor/gradient_editor.gd
|
||||||
|
Control *control = memnew(Control);
|
||||||
|
control->set_name("Control");
|
||||||
|
|
||||||
|
control->set_name("Control");
|
||||||
|
//control->set("name", Control));
|
||||||
|
|
||||||
|
control->set_filename("res://addons/mat_maker_gd/widgets/gradient_editor/gradient_editor.tscn");
|
||||||
|
//control->set("filename", "res://addons/mat_maker_gd/widgets/gradient_editor/gradient_editor.tscn");
|
||||||
|
|
||||||
|
control->set_margin_right(120);
|
||||||
|
//control->set("margin_right", 120);
|
||||||
|
|
||||||
|
control->set_margin_bottom(30);
|
||||||
|
//control->set("margin_bottom", 30);
|
||||||
|
|
||||||
|
control->set_rect_size(Vector2(120, 30));
|
||||||
|
//control->set("rect_size", Vector2(120, 30));
|
||||||
|
|
||||||
|
control->set_rect_min_size(Vector2(120, 32));
|
||||||
|
//control->set("rect_min_size", Vector2(120, 32));
|
||||||
|
|
||||||
|
control->set_focus_mode(1);
|
||||||
|
//control->set("focus_mode", 1);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ColorRect *background_control = memnew(ColorRect);
|
||||||
|
background_control->set_name("Background");
|
||||||
|
control->add_child(background_control);
|
||||||
|
|
||||||
|
background_control->set_name("Background");
|
||||||
|
//background_control->set("name", Background));
|
||||||
|
|
||||||
|
//background_control property owner TYPE_OBJECT value: Control:[Control:51414]
|
||||||
|
|
||||||
|
//background_control property material TYPE_OBJECT value: [ShaderMaterial:19166]
|
||||||
|
Ref<ShaderMaterial> background_control_prop_material;
|
||||||
|
background_control_prop_material.instance();
|
||||||
|
background_control->set_material(background_control_prop_material);
|
||||||
|
//background_control->set("material", background_control_prop_material);
|
||||||
|
|
||||||
|
background_control->set_anchor_right(1);
|
||||||
|
//background_control->set("anchor_right", 1);
|
||||||
|
|
||||||
|
background_control->set_margin_left(4);
|
||||||
|
//background_control->set("margin_left", 4);
|
||||||
|
|
||||||
|
background_control->set_margin_right(-4);
|
||||||
|
//background_control->set("margin_right", -4);
|
||||||
|
|
||||||
|
background_control->set_margin_bottom(15);
|
||||||
|
//background_control->set("margin_bottom", 15);
|
||||||
|
|
||||||
|
background_control->set_rect_position(Vector2(4, 0));
|
||||||
|
//background_control->set("rect_position", Vector2(4, 0));
|
||||||
|
|
||||||
|
background_control->set_rect_global_position(Vector2(4, 0));
|
||||||
|
//background_control->set("rect_global_position", Vector2(4, 0));
|
||||||
|
|
||||||
|
background_control->set_rect_size(Vector2(0, 15));
|
||||||
|
//background_control->set("rect_size", Vector2(0, 15));
|
||||||
|
|
||||||
|
background_control->set_rect_min_size(Vector2(112, 17));
|
||||||
|
//background_control->set("rect_min_size", Vector2(112, 17));
|
||||||
|
|
||||||
|
background_control->set_mouse_filter(2);
|
||||||
|
//background_control->set("mouse_filter", 2);
|
||||||
|
|
||||||
|
//background_control property __meta__ TYPE_DICTIONARY value: {_edit_use_anchors_:False}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
TextureRect *gradient_control = memnew(TextureRect);
|
||||||
|
gradient_control->set_name("Gradient");
|
||||||
|
control->add_child(gradient_control);
|
||||||
|
|
||||||
|
gradient_control->set_name("Gradient");
|
||||||
|
//gradient_control->set("name", Gradient));
|
||||||
|
|
||||||
|
//gradient_control property owner TYPE_OBJECT value: Control:[Control:51414]
|
||||||
|
|
||||||
|
gradient_control->set_anchor_right(1);
|
||||||
|
//gradient_control->set("anchor_right", 1);
|
||||||
|
|
||||||
|
gradient_control->set_margin_left(4);
|
||||||
|
//gradient_control->set("margin_left", 4);
|
||||||
|
|
||||||
|
gradient_control->set_margin_right(-4);
|
||||||
|
//gradient_control->set("margin_right", -4);
|
||||||
|
|
||||||
|
gradient_control->set_margin_bottom(15);
|
||||||
|
//gradient_control->set("margin_bottom", 15);
|
||||||
|
|
||||||
|
gradient_control->set_rect_position(Vector2(4, 0));
|
||||||
|
//gradient_control->set("rect_position", Vector2(4, 0));
|
||||||
|
|
||||||
|
gradient_control->set_rect_global_position(Vector2(4, 0));
|
||||||
|
//gradient_control->set("rect_global_position", Vector2(4, 0));
|
||||||
|
|
||||||
|
gradient_control->set_rect_size(Vector2(0, 15));
|
||||||
|
//gradient_control->set("rect_size", Vector2(0, 15));
|
||||||
|
|
||||||
|
gradient_control->set_rect_min_size(Vector2(112, 17));
|
||||||
|
//gradient_control->set("rect_min_size", Vector2(112, 17));
|
||||||
|
|
||||||
|
gradient_control->set_mouse_filter(2);
|
||||||
|
//gradient_control->set("mouse_filter", 2);
|
||||||
|
|
||||||
|
//gradient_control property theme TYPE_OBJECT value: [Theme:19167]
|
||||||
|
Ref<Theme> gradient_control_prop_theme;
|
||||||
|
gradient_control_prop_theme.instance();
|
||||||
|
gradient_control->set_theme(gradient_control_prop_theme);
|
||||||
|
//gradient_control->set("theme", gradient_control_prop_theme);
|
||||||
|
|
||||||
|
//gradient_control property __meta__ TYPE_DICTIONARY value: {_edit_use_anchors_:False}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
OptionButton *interpolation_control = memnew(OptionButton);
|
||||||
|
interpolation_control->set_name("Interpolation");
|
||||||
|
control->add_child(interpolation_control);
|
||||||
|
|
||||||
|
interpolation_control->set_name("Interpolation");
|
||||||
|
//interpolation_control->set("name", Interpolation));
|
||||||
|
|
||||||
|
//interpolation_control property owner TYPE_OBJECT value: Control:[Control:51414]
|
||||||
|
|
||||||
|
interpolation_control->set_margin_left(0.418457);
|
||||||
|
//interpolation_control->set("margin_left", 0.418457);
|
||||||
|
|
||||||
|
interpolation_control->set_margin_top(-2.90374);
|
||||||
|
//interpolation_control->set("margin_top", -2.90374);
|
||||||
|
|
||||||
|
interpolation_control->set_margin_right(73.418503);
|
||||||
|
//interpolation_control->set("margin_right", 73.418503);
|
||||||
|
|
||||||
|
interpolation_control->set_margin_bottom(19.0963);
|
||||||
|
//interpolation_control->set("margin_bottom", 19.0963);
|
||||||
|
|
||||||
|
interpolation_control->set_rect_position(Vector2(0.418457, -2.90374));
|
||||||
|
//interpolation_control->set("rect_position", Vector2(0.418457, -2.90374));
|
||||||
|
|
||||||
|
interpolation_control->set_rect_global_position(Vector2(0.418457, -2.90374));
|
||||||
|
//interpolation_control->set("rect_global_position", Vector2(0.418457, -2.90374));
|
||||||
|
|
||||||
|
interpolation_control->set_rect_size(Vector2(73.000046, 22.00004));
|
||||||
|
//interpolation_control->set("rect_size", Vector2(73.000046, 22.00004));
|
||||||
|
|
||||||
|
interpolation_control->set_rect_scale(Vector2(0.5, 0.5));
|
||||||
|
//interpolation_control->set("rect_scale", Vector2(0.5, 0.5));
|
||||||
|
|
||||||
|
//interpolation_control property icon TYPE_OBJECT value: [AtlasTexture:19168]
|
||||||
|
Ref<AtlasTexture> interpolation_control_prop_icon;
|
||||||
|
interpolation_control_prop_icon.instance();
|
||||||
|
interpolation_control->set_icon(interpolation_control_prop_icon);
|
||||||
|
//interpolation_control->set("icon", interpolation_control_prop_icon);
|
||||||
|
|
||||||
|
//interpolation_control property items TYPE_ARRAY value: [, [AtlasTexture:19169], False, 0, Null, , [AtlasTexture:19168], False, 1, Null, , [AtlasTexture:19170], False, 2, Null, , [AtlasTexture:19171], False, 3, Null]
|
||||||
|
|
||||||
|
interpolation_control->set_selected(1);
|
||||||
|
//interpolation_control->set("selected", 1);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
PopupMenu *popupmenu_interpolation_control = memnew(PopupMenu);
|
||||||
|
popupmenu_interpolation_control->set_name("PopupMenu");
|
||||||
|
interpolation_control->add_child(popupmenu_interpolation_control);
|
||||||
|
|
||||||
|
popupmenu_interpolation_control->set_name("PopupMenu");
|
||||||
|
//popupmenu_interpolation_control->set("name", PopupMenu));
|
||||||
|
|
||||||
|
popupmenu_interpolation_control->set_input_pass_on_modal_close_click(False);
|
||||||
|
//popupmenu_interpolation_control->set("input_pass_on_modal_close_click", False);
|
||||||
|
|
||||||
|
//popupmenu_interpolation_control property items TYPE_ARRAY value: [, [AtlasTexture:19169], 2, False, False, 0, 0, Null, , False, , [AtlasTexture:19168], 2, True, False, 1, 0, Null, , False, , [AtlasTexture:19170], 2, False, False, 2, 0, Null, , False, , [AtlasTexture:19171], 2, False, False, 3, 0, Null, , False]
|
||||||
|
|
||||||
|
popupmenu_interpolation_control->set_allow_search(True);
|
||||||
|
//popupmenu_interpolation_control->set("allow_search", True);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Timer *timer_popupmenu_interpolation_control = memnew(Timer);
|
||||||
|
timer_popupmenu_interpolation_control->set_name("Timer");
|
||||||
|
popupmenu_interpolation_control->add_child(timer_popupmenu_interpolation_control);
|
||||||
|
|
||||||
|
timer_popupmenu_interpolation_control->set_name("Timer");
|
||||||
|
//timer_popupmenu_interpolation_control->set("name", Timer));
|
||||||
|
|
||||||
|
timer_popupmenu_interpolation_control->set_wait_time(0.3);
|
||||||
|
//timer_popupmenu_interpolation_control->set("wait_time", 0.3);
|
||||||
|
|
||||||
|
timer_popupmenu_interpolation_control->set_one_shot(True);
|
||||||
|
//timer_popupmenu_interpolation_control->set("one_shot", True);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Label *value_control = memnew(Label);
|
||||||
|
value_control->set_name("Value");
|
||||||
|
control->add_child(value_control);
|
||||||
|
|
||||||
|
value_control->set_name("Value");
|
||||||
|
//value_control->set("name", Value));
|
||||||
|
|
||||||
|
//value_control property owner TYPE_OBJECT value: Control:[Control:51414]
|
||||||
|
|
||||||
|
value_control->set_anchor_right(1);
|
||||||
|
//value_control->set("anchor_right", 1);
|
||||||
|
|
||||||
|
value_control->set_margin_top(-1);
|
||||||
|
//value_control->set("margin_top", -1);
|
||||||
|
|
||||||
|
value_control->set_margin_bottom(14);
|
||||||
|
//value_control->set("margin_bottom", 14);
|
||||||
|
|
||||||
|
value_control->set_rect_position(Vector2(0, -1));
|
||||||
|
//value_control->set("rect_position", Vector2(0, -1));
|
||||||
|
|
||||||
|
value_control->set_rect_global_position(Vector2(0, -1));
|
||||||
|
//value_control->set("rect_global_position", Vector2(0, -1));
|
||||||
|
|
||||||
|
value_control->set_rect_size(Vector2(0, 15));
|
||||||
|
//value_control->set("rect_size", Vector2(0, 15));
|
||||||
|
|
||||||
|
value_control->set_custom_colors/font_color(Color(1, 1, 1, 1));
|
||||||
|
//value_control->set("custom_colors/font_color", Color(1, 1, 1, 1));
|
||||||
|
|
||||||
|
value_control->set_custom_colors/font_color_shadow(Color(0, 0, 0, 1));
|
||||||
|
//value_control->set("custom_colors/font_color_shadow", Color(0, 0, 0, 1));
|
||||||
|
|
||||||
|
value_control->set_custom_constants/shadow_offset_x(1);
|
||||||
|
//value_control->set("custom_constants/shadow_offset_x", 1);
|
||||||
|
|
||||||
|
value_control->set_custom_constants/shadow_offset_y(1);
|
||||||
|
//value_control->set("custom_constants/shadow_offset_y", 1);
|
||||||
|
|
||||||
|
value_control->set_custom_constants/shadow_as_outline(1);
|
||||||
|
//value_control->set("custom_constants/shadow_as_outline", 1);
|
||||||
|
|
||||||
|
value_control->set_align(1);
|
||||||
|
//value_control->set("align", 1);
|
||||||
|
|
||||||
|
//value_control property __meta__ TYPE_DICTIONARY value: {_edit_use_anchors_:False}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,121 @@
|
|||||||
|
#ifndef GRADIENT_EDITOR_H
|
||||||
|
#define GRADIENT_EDITOR_H
|
||||||
|
|
||||||
|
|
||||||
|
class GradientEditor : public Control {
|
||||||
|
GDCLASS(GradientEditor, Control);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
Variant get_Variant();
|
||||||
|
void set_Variant(const Variant &val);
|
||||||
|
|
||||||
|
Variant get_Variant();
|
||||||
|
void set_Variant(const Variant &val);
|
||||||
|
|
||||||
|
bool get_embedded() const;
|
||||||
|
void set_embedded(const bool val);
|
||||||
|
|
||||||
|
UndoRedo get_*_undo_redo();
|
||||||
|
void set_*_undo_redo(const UndoRedo &val);
|
||||||
|
|
||||||
|
PoolRealArray get__saved_points();
|
||||||
|
void set__saved_points(const PoolRealArray &val);
|
||||||
|
|
||||||
|
Variant get_Variant();
|
||||||
|
void set_Variant(const Variant &val);
|
||||||
|
|
||||||
|
class GradientCursor {
|
||||||
|
public:
|
||||||
|
|
||||||
|
Color get_color();
|
||||||
|
void set_color(const Color &val);
|
||||||
|
|
||||||
|
bool get_sliding() const;
|
||||||
|
void set_sliding(const bool val);
|
||||||
|
|
||||||
|
void _ready();
|
||||||
|
void _draw();
|
||||||
|
void _gui_input(const Variant &ev);
|
||||||
|
float get_cursor_position();
|
||||||
|
void set_color(const Variant &c);
|
||||||
|
static bool sort(const Variant &a, const Variant & b);
|
||||||
|
bool can_drop_data(const Variant &_position, const Variant & data);
|
||||||
|
void drop_data(const Variant &_position, const Variant & data);
|
||||||
|
|
||||||
|
GradientCursor();
|
||||||
|
~GradientCursor();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
static void _bind_methods();
|
||||||
|
|
||||||
|
extends Control;
|
||||||
|
Color color = ;
|
||||||
|
bool sliding = false;
|
||||||
|
onready var label : Label = get_parent().get_node("Value");
|
||||||
|
const WIDTH : int = 10;
|
||||||
|
};
|
||||||
|
|
||||||
|
void _init();
|
||||||
|
void ignore_changes(const Variant &val);
|
||||||
|
void save_color_state();
|
||||||
|
void undo_redo_save_color_state();
|
||||||
|
void set_undo_redo(const UndoRedo &ur);
|
||||||
|
void set_value(const Variant &v);
|
||||||
|
void update_cursors();
|
||||||
|
void update_value();
|
||||||
|
void add_cursor(const Variant &x, const Variant & color);
|
||||||
|
void _gui_input(const Variant &ev);
|
||||||
|
void select_color(const Variant &cursor, const Variant & position);
|
||||||
|
Array get_sorted_cursors();
|
||||||
|
void generate_preview_image();
|
||||||
|
Color get_gradient_color(const Variant &x);
|
||||||
|
void update_preview();
|
||||||
|
void _on_Interpolation_item_selected(const Variant &ID);
|
||||||
|
void on_resized();
|
||||||
|
|
||||||
|
GradientEditor();
|
||||||
|
~GradientEditor();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
static void _bind_methods();
|
||||||
|
|
||||||
|
//tool
|
||||||
|
Variant = null;
|
||||||
|
// setget set_value
|
||||||
|
Variant = null;
|
||||||
|
//export
|
||||||
|
bool embedded = true;
|
||||||
|
UndoRedo *_undo_redo = null;
|
||||||
|
signal updated(value);
|
||||||
|
PoolRealArray _saved_points = PoolRealArray();
|
||||||
|
//func get_gradient_from_data(data):
|
||||||
|
// if typeof(data) == TYPE_ARRAY:
|
||||||
|
// return data
|
||||||
|
// elif typeof(data) == TYPE_DICTIONARY:
|
||||||
|
// if data.has("parameters") and data.parameters.has("gradient"):
|
||||||
|
// return data.parameters.gradient
|
||||||
|
// if data.has("type") and data.type == "Gradient":
|
||||||
|
// return data
|
||||||
|
// return null
|
||||||
|
//func get_drag_data(_position : Vector2):
|
||||||
|
// var data = 0//MMType.serialize_value(value)
|
||||||
|
// var preview = ColorRect.new()
|
||||||
|
// preview.rect_size = Vector2(64, 24)
|
||||||
|
// preview.material = $Gradient.material
|
||||||
|
// set_drag_preview(preview)
|
||||||
|
// return data
|
||||||
|
//
|
||||||
|
//func can_drop_data(_position : Vector2, data) -> bool:
|
||||||
|
// return get_gradient_from_data(data) != null
|
||||||
|
//
|
||||||
|
//func drop_data(_position : Vector2, data) -> void:
|
||||||
|
// var gradient = get_gradient_from_data(data)
|
||||||
|
// //if gradient != null:
|
||||||
|
// //set_value(MMType.deserialize_value(gradient))
|
||||||
|
Variant ;
|
||||||
|
// Calculating a color from the gradient and generating the shader
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,42 @@
|
|||||||
|
|
||||||
|
#include "gradient_popup.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//tool;
|
||||||
|
signal updated(value);
|
||||||
|
|
||||||
|
void GradientPopup::init(const Variant &value, const Variant & graph_node, const Variant & undo_redo) {
|
||||||
|
$Panel/Control.set_undo_redo(undo_redo);
|
||||||
|
$Panel/Control.graph_node = graph_node;
|
||||||
|
$Panel/Control.set_value(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GradientPopup::_on_Control_updated(const Variant &value) {
|
||||||
|
emit_signal("updated", value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GradientPopup::_on_GradientPopup_popup_hide() {
|
||||||
|
queue_free();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
GradientPopup::GradientPopup() {
|
||||||
|
}
|
||||||
|
|
||||||
|
GradientPopup::~GradientPopup() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void GradientPopup::_bind_methods() {
|
||||||
|
ClassDB::bind_method(D_METHOD("init", "value", " graph_node", " undo_redo"), &GradientPopup::init);
|
||||||
|
ClassDB::bind_method(D_METHOD("_on_Control_updated", "value"), &GradientPopup::_on_Control_updated);
|
||||||
|
ClassDB::bind_method(D_METHOD("_on_GradientPopup_popup_hide"), &GradientPopup::_on_GradientPopup_popup_hide);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,325 @@
|
|||||||
|
|
||||||
|
void construct() {
|
||||||
|
|
||||||
|
//Script: res://addons/mat_maker_gd/widgets/gradient_editor/gradient_popup.gd
|
||||||
|
Popup *gradientpopup = memnew(Popup);
|
||||||
|
gradientpopup->set_name("GradientPopup");
|
||||||
|
|
||||||
|
gradientpopup->set_name("GradientPopup");
|
||||||
|
//gradientpopup->set("name", GradientPopup));
|
||||||
|
|
||||||
|
gradientpopup->set_filename("res://addons/mat_maker_gd/widgets/gradient_editor/gradient_popup.tscn");
|
||||||
|
//gradientpopup->set("filename", "res://addons/mat_maker_gd/widgets/gradient_editor/gradient_popup.tscn");
|
||||||
|
|
||||||
|
gradientpopup->set_margin_right(632);
|
||||||
|
//gradientpopup->set("margin_right", 632);
|
||||||
|
|
||||||
|
gradientpopup->set_margin_bottom(49);
|
||||||
|
//gradientpopup->set("margin_bottom", 49);
|
||||||
|
|
||||||
|
gradientpopup->set_rect_size(Vector2(632, 49));
|
||||||
|
//gradientpopup->set("rect_size", Vector2(632, 49));
|
||||||
|
|
||||||
|
gradientpopup->set_size_flags_horizontal(0);
|
||||||
|
//gradientpopup->set("size_flags_horizontal", 0);
|
||||||
|
|
||||||
|
gradientpopup->set_size_flags_vertical(0);
|
||||||
|
//gradientpopup->set("size_flags_vertical", 0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Panel *panel_gradientpopup = memnew(Panel);
|
||||||
|
panel_gradientpopup->set_name("Panel");
|
||||||
|
gradientpopup->add_child(panel_gradientpopup);
|
||||||
|
|
||||||
|
panel_gradientpopup->set_name("Panel");
|
||||||
|
//panel_gradientpopup->set("name", Panel));
|
||||||
|
|
||||||
|
//panel_gradientpopup property owner TYPE_OBJECT value: GradientPopup:[Popup:51440]
|
||||||
|
|
||||||
|
panel_gradientpopup->set_margin_right(632);
|
||||||
|
//panel_gradientpopup->set("margin_right", 632);
|
||||||
|
|
||||||
|
panel_gradientpopup->set_margin_bottom(49);
|
||||||
|
//panel_gradientpopup->set("margin_bottom", 49);
|
||||||
|
|
||||||
|
panel_gradientpopup->set_rect_size(Vector2(632, 49));
|
||||||
|
//panel_gradientpopup->set("rect_size", Vector2(632, 49));
|
||||||
|
|
||||||
|
//panel_gradientpopup property custom_styles/panel TYPE_OBJECT value: [StyleBoxFlat:51436]
|
||||||
|
Ref<StyleBoxFlat> panel_gradientpopup_prop_custom_styles/panel;
|
||||||
|
panel_gradientpopup_prop_custom_styles/panel.instance();
|
||||||
|
panel_gradientpopup->set_custom_styles/panel(panel_gradientpopup_prop_custom_styles/panel);
|
||||||
|
//panel_gradientpopup->set("custom_styles/panel", panel_gradientpopup_prop_custom_styles/panel);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//Script: res://addons/mat_maker_gd/widgets/gradient_editor/gradient_editor.gd
|
||||||
|
Control *control_panel_gradientpopup = memnew(Control);
|
||||||
|
control_panel_gradientpopup->set_name("Control");
|
||||||
|
panel_gradientpopup->add_child(control_panel_gradientpopup);
|
||||||
|
|
||||||
|
control_panel_gradientpopup->set_name("Control");
|
||||||
|
//control_panel_gradientpopup->set("name", Control));
|
||||||
|
|
||||||
|
control_panel_gradientpopup->set_filename("res://addons/mat_maker_gd/widgets/gradient_editor/gradient_editor.tscn");
|
||||||
|
//control_panel_gradientpopup->set("filename", "res://addons/mat_maker_gd/widgets/gradient_editor/gradient_editor.tscn");
|
||||||
|
|
||||||
|
//control_panel_gradientpopup property owner TYPE_OBJECT value: GradientPopup:[Popup:51440]
|
||||||
|
|
||||||
|
control_panel_gradientpopup->set_anchor_right(1);
|
||||||
|
//control_panel_gradientpopup->set("anchor_right", 1);
|
||||||
|
|
||||||
|
control_panel_gradientpopup->set_anchor_bottom(1);
|
||||||
|
//control_panel_gradientpopup->set("anchor_bottom", 1);
|
||||||
|
|
||||||
|
control_panel_gradientpopup->set_margin_left(10);
|
||||||
|
//control_panel_gradientpopup->set("margin_left", 10);
|
||||||
|
|
||||||
|
control_panel_gradientpopup->set_margin_top(10);
|
||||||
|
//control_panel_gradientpopup->set("margin_top", 10);
|
||||||
|
|
||||||
|
control_panel_gradientpopup->set_margin_right(-10);
|
||||||
|
//control_panel_gradientpopup->set("margin_right", -10);
|
||||||
|
|
||||||
|
control_panel_gradientpopup->set_margin_bottom(-10);
|
||||||
|
//control_panel_gradientpopup->set("margin_bottom", -10);
|
||||||
|
|
||||||
|
control_panel_gradientpopup->set_rect_position(Vector2(10, 10));
|
||||||
|
//control_panel_gradientpopup->set("rect_position", Vector2(10, 10));
|
||||||
|
|
||||||
|
control_panel_gradientpopup->set_rect_global_position(Vector2(10, 10));
|
||||||
|
//control_panel_gradientpopup->set("rect_global_position", Vector2(10, 10));
|
||||||
|
|
||||||
|
control_panel_gradientpopup->set_rect_min_size(Vector2(120, 32));
|
||||||
|
//control_panel_gradientpopup->set("rect_min_size", Vector2(120, 32));
|
||||||
|
|
||||||
|
control_panel_gradientpopup->set_focus_mode(1);
|
||||||
|
//control_panel_gradientpopup->set("focus_mode", 1);
|
||||||
|
|
||||||
|
control_panel_gradientpopup->set_embedded(False);
|
||||||
|
//control_panel_gradientpopup->set("embedded", False);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ColorRect *background_control_panel_gradientpopup = memnew(ColorRect);
|
||||||
|
background_control_panel_gradientpopup->set_name("Background");
|
||||||
|
control_panel_gradientpopup->add_child(background_control_panel_gradientpopup);
|
||||||
|
|
||||||
|
background_control_panel_gradientpopup->set_name("Background");
|
||||||
|
//background_control_panel_gradientpopup->set("name", Background));
|
||||||
|
|
||||||
|
//background_control_panel_gradientpopup property owner TYPE_OBJECT value: Control:[Control:51442]
|
||||||
|
|
||||||
|
//background_control_panel_gradientpopup property material TYPE_OBJECT value: [ShaderMaterial:19166]
|
||||||
|
Ref<ShaderMaterial> background_control_panel_gradientpopup_prop_material;
|
||||||
|
background_control_panel_gradientpopup_prop_material.instance();
|
||||||
|
background_control_panel_gradientpopup->set_material(background_control_panel_gradientpopup_prop_material);
|
||||||
|
//background_control_panel_gradientpopup->set("material", background_control_panel_gradientpopup_prop_material);
|
||||||
|
|
||||||
|
background_control_panel_gradientpopup->set_anchor_right(1);
|
||||||
|
//background_control_panel_gradientpopup->set("anchor_right", 1);
|
||||||
|
|
||||||
|
background_control_panel_gradientpopup->set_margin_left(4);
|
||||||
|
//background_control_panel_gradientpopup->set("margin_left", 4);
|
||||||
|
|
||||||
|
background_control_panel_gradientpopup->set_margin_right(-4);
|
||||||
|
//background_control_panel_gradientpopup->set("margin_right", -4);
|
||||||
|
|
||||||
|
background_control_panel_gradientpopup->set_margin_bottom(15);
|
||||||
|
//background_control_panel_gradientpopup->set("margin_bottom", 15);
|
||||||
|
|
||||||
|
background_control_panel_gradientpopup->set_rect_position(Vector2(4, 0));
|
||||||
|
//background_control_panel_gradientpopup->set("rect_position", Vector2(4, 0));
|
||||||
|
|
||||||
|
background_control_panel_gradientpopup->set_rect_global_position(Vector2(4, 0));
|
||||||
|
//background_control_panel_gradientpopup->set("rect_global_position", Vector2(4, 0));
|
||||||
|
|
||||||
|
background_control_panel_gradientpopup->set_rect_size(Vector2(0, 15));
|
||||||
|
//background_control_panel_gradientpopup->set("rect_size", Vector2(0, 15));
|
||||||
|
|
||||||
|
background_control_panel_gradientpopup->set_rect_min_size(Vector2(112, 17));
|
||||||
|
//background_control_panel_gradientpopup->set("rect_min_size", Vector2(112, 17));
|
||||||
|
|
||||||
|
background_control_panel_gradientpopup->set_mouse_filter(2);
|
||||||
|
//background_control_panel_gradientpopup->set("mouse_filter", 2);
|
||||||
|
|
||||||
|
//background_control_panel_gradientpopup property __meta__ TYPE_DICTIONARY value: {_edit_use_anchors_:False}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
TextureRect *gradient_control_panel_gradientpopup = memnew(TextureRect);
|
||||||
|
gradient_control_panel_gradientpopup->set_name("Gradient");
|
||||||
|
control_panel_gradientpopup->add_child(gradient_control_panel_gradientpopup);
|
||||||
|
|
||||||
|
gradient_control_panel_gradientpopup->set_name("Gradient");
|
||||||
|
//gradient_control_panel_gradientpopup->set("name", Gradient));
|
||||||
|
|
||||||
|
//gradient_control_panel_gradientpopup property owner TYPE_OBJECT value: Control:[Control:51442]
|
||||||
|
|
||||||
|
gradient_control_panel_gradientpopup->set_anchor_right(1);
|
||||||
|
//gradient_control_panel_gradientpopup->set("anchor_right", 1);
|
||||||
|
|
||||||
|
gradient_control_panel_gradientpopup->set_margin_left(4);
|
||||||
|
//gradient_control_panel_gradientpopup->set("margin_left", 4);
|
||||||
|
|
||||||
|
gradient_control_panel_gradientpopup->set_margin_right(-4);
|
||||||
|
//gradient_control_panel_gradientpopup->set("margin_right", -4);
|
||||||
|
|
||||||
|
gradient_control_panel_gradientpopup->set_margin_bottom(15);
|
||||||
|
//gradient_control_panel_gradientpopup->set("margin_bottom", 15);
|
||||||
|
|
||||||
|
gradient_control_panel_gradientpopup->set_rect_position(Vector2(4, 0));
|
||||||
|
//gradient_control_panel_gradientpopup->set("rect_position", Vector2(4, 0));
|
||||||
|
|
||||||
|
gradient_control_panel_gradientpopup->set_rect_global_position(Vector2(4, 0));
|
||||||
|
//gradient_control_panel_gradientpopup->set("rect_global_position", Vector2(4, 0));
|
||||||
|
|
||||||
|
gradient_control_panel_gradientpopup->set_rect_size(Vector2(0, 15));
|
||||||
|
//gradient_control_panel_gradientpopup->set("rect_size", Vector2(0, 15));
|
||||||
|
|
||||||
|
gradient_control_panel_gradientpopup->set_rect_min_size(Vector2(112, 17));
|
||||||
|
//gradient_control_panel_gradientpopup->set("rect_min_size", Vector2(112, 17));
|
||||||
|
|
||||||
|
gradient_control_panel_gradientpopup->set_mouse_filter(2);
|
||||||
|
//gradient_control_panel_gradientpopup->set("mouse_filter", 2);
|
||||||
|
|
||||||
|
//gradient_control_panel_gradientpopup property theme TYPE_OBJECT value: [Theme:19167]
|
||||||
|
Ref<Theme> gradient_control_panel_gradientpopup_prop_theme;
|
||||||
|
gradient_control_panel_gradientpopup_prop_theme.instance();
|
||||||
|
gradient_control_panel_gradientpopup->set_theme(gradient_control_panel_gradientpopup_prop_theme);
|
||||||
|
//gradient_control_panel_gradientpopup->set("theme", gradient_control_panel_gradientpopup_prop_theme);
|
||||||
|
|
||||||
|
//gradient_control_panel_gradientpopup property __meta__ TYPE_DICTIONARY value: {_edit_use_anchors_:False}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
OptionButton *interpolation_control_panel_gradientpopup = memnew(OptionButton);
|
||||||
|
interpolation_control_panel_gradientpopup->set_name("Interpolation");
|
||||||
|
control_panel_gradientpopup->add_child(interpolation_control_panel_gradientpopup);
|
||||||
|
|
||||||
|
interpolation_control_panel_gradientpopup->set_name("Interpolation");
|
||||||
|
//interpolation_control_panel_gradientpopup->set("name", Interpolation));
|
||||||
|
|
||||||
|
//interpolation_control_panel_gradientpopup property owner TYPE_OBJECT value: Control:[Control:51442]
|
||||||
|
|
||||||
|
interpolation_control_panel_gradientpopup->set_margin_left(0.418457);
|
||||||
|
//interpolation_control_panel_gradientpopup->set("margin_left", 0.418457);
|
||||||
|
|
||||||
|
interpolation_control_panel_gradientpopup->set_margin_top(-2.90374);
|
||||||
|
//interpolation_control_panel_gradientpopup->set("margin_top", -2.90374);
|
||||||
|
|
||||||
|
interpolation_control_panel_gradientpopup->set_margin_right(73.418503);
|
||||||
|
//interpolation_control_panel_gradientpopup->set("margin_right", 73.418503);
|
||||||
|
|
||||||
|
interpolation_control_panel_gradientpopup->set_margin_bottom(19.0963);
|
||||||
|
//interpolation_control_panel_gradientpopup->set("margin_bottom", 19.0963);
|
||||||
|
|
||||||
|
interpolation_control_panel_gradientpopup->set_rect_position(Vector2(0.418457, -2.90374));
|
||||||
|
//interpolation_control_panel_gradientpopup->set("rect_position", Vector2(0.418457, -2.90374));
|
||||||
|
|
||||||
|
interpolation_control_panel_gradientpopup->set_rect_global_position(Vector2(0.418457, -2.90374));
|
||||||
|
//interpolation_control_panel_gradientpopup->set("rect_global_position", Vector2(0.418457, -2.90374));
|
||||||
|
|
||||||
|
interpolation_control_panel_gradientpopup->set_rect_size(Vector2(73.000046, 22.00004));
|
||||||
|
//interpolation_control_panel_gradientpopup->set("rect_size", Vector2(73.000046, 22.00004));
|
||||||
|
|
||||||
|
interpolation_control_panel_gradientpopup->set_rect_scale(Vector2(0.5, 0.5));
|
||||||
|
//interpolation_control_panel_gradientpopup->set("rect_scale", Vector2(0.5, 0.5));
|
||||||
|
|
||||||
|
//interpolation_control_panel_gradientpopup property icon TYPE_OBJECT value: [AtlasTexture:19168]
|
||||||
|
Ref<AtlasTexture> interpolation_control_panel_gradientpopup_prop_icon;
|
||||||
|
interpolation_control_panel_gradientpopup_prop_icon.instance();
|
||||||
|
interpolation_control_panel_gradientpopup->set_icon(interpolation_control_panel_gradientpopup_prop_icon);
|
||||||
|
//interpolation_control_panel_gradientpopup->set("icon", interpolation_control_panel_gradientpopup_prop_icon);
|
||||||
|
|
||||||
|
//interpolation_control_panel_gradientpopup property items TYPE_ARRAY value: [, [AtlasTexture:19169], False, 0, Null, , [AtlasTexture:19168], False, 1, Null, , [AtlasTexture:19170], False, 2, Null, , [AtlasTexture:19171], False, 3, Null]
|
||||||
|
|
||||||
|
interpolation_control_panel_gradientpopup->set_selected(1);
|
||||||
|
//interpolation_control_panel_gradientpopup->set("selected", 1);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
PopupMenu *popupmenu_interpolation_control_panel_gradientpopup = memnew(PopupMenu);
|
||||||
|
popupmenu_interpolation_control_panel_gradientpopup->set_name("PopupMenu");
|
||||||
|
interpolation_control_panel_gradientpopup->add_child(popupmenu_interpolation_control_panel_gradientpopup);
|
||||||
|
|
||||||
|
popupmenu_interpolation_control_panel_gradientpopup->set_name("PopupMenu");
|
||||||
|
//popupmenu_interpolation_control_panel_gradientpopup->set("name", PopupMenu));
|
||||||
|
|
||||||
|
popupmenu_interpolation_control_panel_gradientpopup->set_input_pass_on_modal_close_click(False);
|
||||||
|
//popupmenu_interpolation_control_panel_gradientpopup->set("input_pass_on_modal_close_click", False);
|
||||||
|
|
||||||
|
//popupmenu_interpolation_control_panel_gradientpopup property items TYPE_ARRAY value: [, [AtlasTexture:19169], 2, False, False, 0, 0, Null, , False, , [AtlasTexture:19168], 2, True, False, 1, 0, Null, , False, , [AtlasTexture:19170], 2, False, False, 2, 0, Null, , False, , [AtlasTexture:19171], 2, False, False, 3, 0, Null, , False]
|
||||||
|
|
||||||
|
popupmenu_interpolation_control_panel_gradientpopup->set_allow_search(True);
|
||||||
|
//popupmenu_interpolation_control_panel_gradientpopup->set("allow_search", True);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Timer *timer_popupmenu_interpolation_control_panel_gradientpopup = memnew(Timer);
|
||||||
|
timer_popupmenu_interpolation_control_panel_gradientpopup->set_name("Timer");
|
||||||
|
popupmenu_interpolation_control_panel_gradientpopup->add_child(timer_popupmenu_interpolation_control_panel_gradientpopup);
|
||||||
|
|
||||||
|
timer_popupmenu_interpolation_control_panel_gradientpopup->set_name("Timer");
|
||||||
|
//timer_popupmenu_interpolation_control_panel_gradientpopup->set("name", Timer));
|
||||||
|
|
||||||
|
timer_popupmenu_interpolation_control_panel_gradientpopup->set_wait_time(0.3);
|
||||||
|
//timer_popupmenu_interpolation_control_panel_gradientpopup->set("wait_time", 0.3);
|
||||||
|
|
||||||
|
timer_popupmenu_interpolation_control_panel_gradientpopup->set_one_shot(True);
|
||||||
|
//timer_popupmenu_interpolation_control_panel_gradientpopup->set("one_shot", True);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Label *value_control_panel_gradientpopup = memnew(Label);
|
||||||
|
value_control_panel_gradientpopup->set_name("Value");
|
||||||
|
control_panel_gradientpopup->add_child(value_control_panel_gradientpopup);
|
||||||
|
|
||||||
|
value_control_panel_gradientpopup->set_name("Value");
|
||||||
|
//value_control_panel_gradientpopup->set("name", Value));
|
||||||
|
|
||||||
|
//value_control_panel_gradientpopup property owner TYPE_OBJECT value: Control:[Control:51442]
|
||||||
|
|
||||||
|
value_control_panel_gradientpopup->set_anchor_right(1);
|
||||||
|
//value_control_panel_gradientpopup->set("anchor_right", 1);
|
||||||
|
|
||||||
|
value_control_panel_gradientpopup->set_margin_top(-1);
|
||||||
|
//value_control_panel_gradientpopup->set("margin_top", -1);
|
||||||
|
|
||||||
|
value_control_panel_gradientpopup->set_margin_bottom(14);
|
||||||
|
//value_control_panel_gradientpopup->set("margin_bottom", 14);
|
||||||
|
|
||||||
|
value_control_panel_gradientpopup->set_rect_position(Vector2(0, -1));
|
||||||
|
//value_control_panel_gradientpopup->set("rect_position", Vector2(0, -1));
|
||||||
|
|
||||||
|
value_control_panel_gradientpopup->set_rect_global_position(Vector2(0, -1));
|
||||||
|
//value_control_panel_gradientpopup->set("rect_global_position", Vector2(0, -1));
|
||||||
|
|
||||||
|
value_control_panel_gradientpopup->set_rect_size(Vector2(0, 15));
|
||||||
|
//value_control_panel_gradientpopup->set("rect_size", Vector2(0, 15));
|
||||||
|
|
||||||
|
value_control_panel_gradientpopup->set_custom_colors/font_color(Color(1, 1, 1, 1));
|
||||||
|
//value_control_panel_gradientpopup->set("custom_colors/font_color", Color(1, 1, 1, 1));
|
||||||
|
|
||||||
|
value_control_panel_gradientpopup->set_custom_colors/font_color_shadow(Color(0, 0, 0, 1));
|
||||||
|
//value_control_panel_gradientpopup->set("custom_colors/font_color_shadow", Color(0, 0, 0, 1));
|
||||||
|
|
||||||
|
value_control_panel_gradientpopup->set_custom_constants/shadow_offset_x(1);
|
||||||
|
//value_control_panel_gradientpopup->set("custom_constants/shadow_offset_x", 1);
|
||||||
|
|
||||||
|
value_control_panel_gradientpopup->set_custom_constants/shadow_offset_y(1);
|
||||||
|
//value_control_panel_gradientpopup->set("custom_constants/shadow_offset_y", 1);
|
||||||
|
|
||||||
|
value_control_panel_gradientpopup->set_custom_constants/shadow_as_outline(1);
|
||||||
|
//value_control_panel_gradientpopup->set("custom_constants/shadow_as_outline", 1);
|
||||||
|
|
||||||
|
value_control_panel_gradientpopup->set_align(1);
|
||||||
|
//value_control_panel_gradientpopup->set("align", 1);
|
||||||
|
|
||||||
|
//value_control_panel_gradientpopup property __meta__ TYPE_DICTIONARY value: {_edit_use_anchors_:False}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
#ifndef GRADIENT_POPUP_H
|
||||||
|
#define GRADIENT_POPUP_H
|
||||||
|
|
||||||
|
|
||||||
|
class GradientPopup : public Popup {
|
||||||
|
GDCLASS(GradientPopup, Popup);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
void init(const Variant &value, const Variant & graph_node, const Variant & undo_redo);
|
||||||
|
void _on_Control_updated(const Variant &value);
|
||||||
|
void _on_GradientPopup_popup_hide();
|
||||||
|
|
||||||
|
GradientPopup();
|
||||||
|
~GradientPopup();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
static void _bind_methods();
|
||||||
|
|
||||||
|
//tool
|
||||||
|
signal updated(value);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,98 @@
|
|||||||
|
|
||||||
|
#include "image_picker_button.h"
|
||||||
|
|
||||||
|
|
||||||
|
Variant ImagePickerButton::get_Variant() {
|
||||||
|
return Variant;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImagePickerButton::set_Variant(const Variant &val) {
|
||||||
|
Variant = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//tool;
|
||||||
|
Variant = "";
|
||||||
|
signal on_file_selected(f);
|
||||||
|
|
||||||
|
void ImagePickerButton::_ready() {
|
||||||
|
texture_normal = ImageTexture.new();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ImagePickerButton::do_set_image_path(const Variant &path) {
|
||||||
|
|
||||||
|
if (path == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
image_path = path;
|
||||||
|
texture_normal.load(image_path);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ImagePickerButton::set_image_path(const Variant &path) {
|
||||||
|
do_set_image_path(path);
|
||||||
|
emit_signal("on_file_selected", path);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ImagePickerButton::_on_ImagePicker_pressed() {
|
||||||
|
//var dialog = preload("res://addons/mat_maker_gd/windows/file_dialog/file_dialog.tscn").instance();
|
||||||
|
add_child(dialog);
|
||||||
|
dialog.rect_min_size = Vector2(500, 500);
|
||||||
|
dialog.access = FileDialog.ACCESS_FILESYSTEM;
|
||||||
|
dialog.mode = FileDialog.MODE_OPEN_FILE;
|
||||||
|
dialog.add_filter("*.bmp;BMP Image");
|
||||||
|
dialog.add_filter("*.exr;EXR Image");
|
||||||
|
dialog.add_filter("*.hdr;Radiance HDR Image");
|
||||||
|
dialog.add_filter("*.jpg,*.jpeg;JPEG Image");
|
||||||
|
dialog.add_filter("*.png;PNG Image");
|
||||||
|
dialog.add_filter("*.svg;SVG Image");
|
||||||
|
dialog.add_filter("*.tga;TGA Image");
|
||||||
|
dialog.add_filter("*.webp;WebP Image");
|
||||||
|
Variant = dialog.select_files();
|
||||||
|
|
||||||
|
while (files is GDScriptFunctionState) {
|
||||||
|
files = yield(files, "completed");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (files.size() > 0) {
|
||||||
|
set_image_path(files[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ImagePickerButton::on_drop_image_file(const String &file_name) {
|
||||||
|
set_image_path(file_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ImagePickerButton::ImagePickerButton() {
|
||||||
|
= "";
|
||||||
|
}
|
||||||
|
|
||||||
|
ImagePickerButton::~ImagePickerButton() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void ImagePickerButton::_bind_methods() {
|
||||||
|
ClassDB::bind_method(D_METHOD("get_Variant"), &ImagePickerButton::get_Variant);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_Variant", "value"), &ImagePickerButton::set_Variant);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "Variant", PROPERTY_HINT_RESOURCE_TYPE, "Variant"), "set_Variant", "get_Variant");
|
||||||
|
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("_ready"), &ImagePickerButton::_ready);
|
||||||
|
ClassDB::bind_method(D_METHOD("do_set_image_path", "path"), &ImagePickerButton::do_set_image_path);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_image_path", "path"), &ImagePickerButton::set_image_path);
|
||||||
|
ClassDB::bind_method(D_METHOD("_on_ImagePicker_pressed"), &ImagePickerButton::_on_ImagePicker_pressed);
|
||||||
|
ClassDB::bind_method(D_METHOD("on_drop_image_file", "file_name"), &ImagePickerButton::on_drop_image_file);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,46 @@
|
|||||||
|
|
||||||
|
void construct() {
|
||||||
|
|
||||||
|
//Script: res://addons/mat_maker_gd/widgets/image_picker_button/image_picker_button.gd
|
||||||
|
TextureButton *imagepicker = memnew(TextureButton);
|
||||||
|
imagepicker->set_name("ImagePicker");
|
||||||
|
|
||||||
|
imagepicker->set_name("ImagePicker");
|
||||||
|
//imagepicker->set("name", ImagePicker));
|
||||||
|
|
||||||
|
imagepicker->set_filename("res://addons/mat_maker_gd/widgets/image_picker_button/image_picker_button.tscn");
|
||||||
|
//imagepicker->set("filename", "res://addons/mat_maker_gd/widgets/image_picker_button/image_picker_button.tscn");
|
||||||
|
|
||||||
|
imagepicker->set_margin_right(64);
|
||||||
|
//imagepicker->set("margin_right", 64);
|
||||||
|
|
||||||
|
imagepicker->set_margin_bottom(64);
|
||||||
|
//imagepicker->set("margin_bottom", 64);
|
||||||
|
|
||||||
|
imagepicker->set_rect_size(Vector2(64, 64));
|
||||||
|
//imagepicker->set("rect_size", Vector2(64, 64));
|
||||||
|
|
||||||
|
imagepicker->set_rect_min_size(Vector2(64, 64));
|
||||||
|
//imagepicker->set("rect_min_size", Vector2(64, 64));
|
||||||
|
|
||||||
|
imagepicker->set_rect_clip_content(True);
|
||||||
|
//imagepicker->set("rect_clip_content", True);
|
||||||
|
|
||||||
|
//imagepicker property texture_normal TYPE_OBJECT value: [ImageTexture:46513]
|
||||||
|
Ref<ImageTexture> imagepicker_prop_texture_normal;
|
||||||
|
imagepicker_prop_texture_normal.instance();
|
||||||
|
imagepicker->set_texture_normal(imagepicker_prop_texture_normal);
|
||||||
|
//imagepicker->set("texture_normal", imagepicker_prop_texture_normal);
|
||||||
|
|
||||||
|
imagepicker->set_expand(True);
|
||||||
|
//imagepicker->set("expand", True);
|
||||||
|
|
||||||
|
imagepicker->set_stretch_mode(5);
|
||||||
|
//imagepicker->set("stretch_mode", 5);
|
||||||
|
|
||||||
|
//imagepicker property __meta__ TYPE_DICTIONARY value: {_edit_use_anchors_:False}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,31 @@
|
|||||||
|
#ifndef IMAGE_PICKER_BUTTON_H
|
||||||
|
#define IMAGE_PICKER_BUTTON_H
|
||||||
|
|
||||||
|
|
||||||
|
class ImagePickerButton : public TextureButton {
|
||||||
|
GDCLASS(ImagePickerButton, TextureButton);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
Variant get_Variant();
|
||||||
|
void set_Variant(const Variant &val);
|
||||||
|
|
||||||
|
void _ready();
|
||||||
|
void do_set_image_path(const Variant &path);
|
||||||
|
void set_image_path(const Variant &path);
|
||||||
|
void _on_ImagePicker_pressed();
|
||||||
|
void on_drop_image_file(const String &file_name);
|
||||||
|
|
||||||
|
ImagePickerButton();
|
||||||
|
~ImagePickerButton();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
static void _bind_methods();
|
||||||
|
|
||||||
|
//tool
|
||||||
|
Variant = "";
|
||||||
|
signal on_file_selected(f);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,90 @@
|
|||||||
|
|
||||||
|
#include "control_point.h"
|
||||||
|
|
||||||
|
|
||||||
|
bool ControlPoint::get_moving() const {
|
||||||
|
return moving;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ControlPoint::set_moving(const bool val) {
|
||||||
|
moving = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//tool;
|
||||||
|
bool moving = false;
|
||||||
|
const OFFSET : Vector2 = Vector2(3, 3);
|
||||||
|
signal moved(index);
|
||||||
|
signal removed(index);
|
||||||
|
|
||||||
|
void ControlPoint::_draw() {
|
||||||
|
// var current_theme : Theme = get_node("/root/MainWindow").theme;
|
||||||
|
// var color : Color = current_theme.get_color("font_color", "Label");
|
||||||
|
Color color = Color(1, 1, 1, 1);
|
||||||
|
draw_rect(Rect2(0, 0, 7, 7), color);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ControlPoint::initialize(const Vector2 &p) {
|
||||||
|
rect_position = get_parent().transform_point(p) - OFFSET;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ControlPoint::_on_ControlPoint_gui_input(const Variant &event) {
|
||||||
|
|
||||||
|
if (event is InputEventMouseButton) {
|
||||||
|
|
||||||
|
if (event.button_index == BUTTON_LEFT) {
|
||||||
|
|
||||||
|
if (event.pressed) {
|
||||||
|
moving = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
else {
|
||||||
|
moving = false;
|
||||||
|
get_parent().update_controls();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
else if (event.button_index == BUTTON_RIGHT && event.pressed) {
|
||||||
|
emit_signal("removed", get_index());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
else if (moving && event is InputEventMouseMotion) {
|
||||||
|
rect_position += event.relative;
|
||||||
|
emit_signal("moved", get_index());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ControlPoint::ControlPoint() {
|
||||||
|
moving = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
ControlPoint::~ControlPoint() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void ControlPoint::_bind_methods() {
|
||||||
|
ClassDB::bind_method(D_METHOD("get_moving"), &ControlPoint::get_moving);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_moving", "value"), &ControlPoint::set_moving);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "moving"), "set_moving", "get_moving");
|
||||||
|
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("_draw"), &ControlPoint::_draw);
|
||||||
|
ClassDB::bind_method(D_METHOD("initialize", "p"), &ControlPoint::initialize);
|
||||||
|
ClassDB::bind_method(D_METHOD("_on_ControlPoint_gui_input", "event"), &ControlPoint::_on_ControlPoint_gui_input);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,43 @@
|
|||||||
|
|
||||||
|
void construct() {
|
||||||
|
|
||||||
|
//Script: res://addons/mat_maker_gd/widgets/polygon_edit/control_point.gd
|
||||||
|
Control *controlpoint = memnew(Control);
|
||||||
|
controlpoint->set_name("ControlPoint");
|
||||||
|
|
||||||
|
controlpoint->set_name("ControlPoint");
|
||||||
|
//controlpoint->set("name", ControlPoint));
|
||||||
|
|
||||||
|
controlpoint->set_filename("res://addons/mat_maker_gd/widgets/polygon_edit/control_point.tscn");
|
||||||
|
//controlpoint->set("filename", "res://addons/mat_maker_gd/widgets/polygon_edit/control_point.tscn");
|
||||||
|
|
||||||
|
controlpoint->set_margin_left(56.986401);
|
||||||
|
//controlpoint->set("margin_left", 56.986401);
|
||||||
|
|
||||||
|
controlpoint->set_margin_top(33.8615);
|
||||||
|
//controlpoint->set("margin_top", 33.8615);
|
||||||
|
|
||||||
|
controlpoint->set_margin_right(63.986401);
|
||||||
|
//controlpoint->set("margin_right", 63.986401);
|
||||||
|
|
||||||
|
controlpoint->set_margin_bottom(40.8615);
|
||||||
|
//controlpoint->set("margin_bottom", 40.8615);
|
||||||
|
|
||||||
|
controlpoint->set_rect_position(Vector2(56.986401, 33.8615));
|
||||||
|
//controlpoint->set("rect_position", Vector2(56.986401, 33.8615));
|
||||||
|
|
||||||
|
controlpoint->set_rect_global_position(Vector2(56.986401, 33.8615));
|
||||||
|
//controlpoint->set("rect_global_position", Vector2(56.986401, 33.8615));
|
||||||
|
|
||||||
|
controlpoint->set_rect_size(Vector2(7, 7));
|
||||||
|
//controlpoint->set("rect_size", Vector2(7, 7));
|
||||||
|
|
||||||
|
controlpoint->set_rect_min_size(Vector2(7, 7));
|
||||||
|
//controlpoint->set("rect_min_size", Vector2(7, 7));
|
||||||
|
|
||||||
|
//controlpoint property __meta__ TYPE_DICTIONARY value: {_edit_use_anchors_:False}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,31 @@
|
|||||||
|
#ifndef CONTROL_POINT_H
|
||||||
|
#define CONTROL_POINT_H
|
||||||
|
|
||||||
|
|
||||||
|
class ControlPoint : public Control {
|
||||||
|
GDCLASS(ControlPoint, Control);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
bool get_moving() const;
|
||||||
|
void set_moving(const bool val);
|
||||||
|
|
||||||
|
void _draw();
|
||||||
|
void initialize(const Vector2 &p);
|
||||||
|
void _on_ControlPoint_gui_input(const Variant &event);
|
||||||
|
|
||||||
|
ControlPoint();
|
||||||
|
~ControlPoint();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
static void _bind_methods();
|
||||||
|
|
||||||
|
//tool
|
||||||
|
bool moving = false;
|
||||||
|
const OFFSET : Vector2 = Vector2(3, 3);
|
||||||
|
signal moved(index);
|
||||||
|
signal removed(index);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,122 @@
|
|||||||
|
|
||||||
|
#include "polygon_dialog.h"
|
||||||
|
|
||||||
|
|
||||||
|
bool PolygonDialog::get_closed() const {
|
||||||
|
return closed;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PolygonDialog::set_closed(const bool val) {
|
||||||
|
closed = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PoolVector2Array PolygonDialog::get_previous_points() {
|
||||||
|
return previous_points;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PolygonDialog::set_previous_points(const PoolVector2Array &val) {
|
||||||
|
previous_points = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Variant PolygonDialog::get_Variant() {
|
||||||
|
return Variant;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PolygonDialog::set_Variant(const Variant &val) {
|
||||||
|
Variant = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//tool;
|
||||||
|
//export ;
|
||||||
|
// setget set_closed;
|
||||||
|
bool closed = true;
|
||||||
|
PoolVector2Array previous_points = ;
|
||||||
|
Variant ;
|
||||||
|
signal polygon_changed(polygon);
|
||||||
|
|
||||||
|
void PolygonDialog::set_closed(const bool c) {
|
||||||
|
closed = c;
|
||||||
|
window_title = "Edit polygon" if closed else "Edit polyline";
|
||||||
|
$VBoxContainer/EditorContainer/PolygonEditor.set_closed(closed);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PolygonDialog::_on_CurveDialog_popup_hide() {
|
||||||
|
// emit_signal("return_polygon", null);
|
||||||
|
queue_free();
|
||||||
|
pass;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PolygonDialog::_on_OK_pressed() {
|
||||||
|
emit_signal("polygon_changed", polygon);
|
||||||
|
polygon.polygon_changed();
|
||||||
|
queue_free();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PolygonDialog::_on_Cancel_pressed() {
|
||||||
|
polygon.set_points(previous_points);
|
||||||
|
emit_signal("polygon_changed", polygon);
|
||||||
|
queue_free();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PolygonDialog::edit_polygon(const Variant &poly) {
|
||||||
|
polygon = poly;
|
||||||
|
previous_points = polygon.points;
|
||||||
|
$VBoxContainer/EditorContainer/PolygonEditor.set_polygon(polygon);
|
||||||
|
popup_centered();
|
||||||
|
}
|
||||||
|
|
||||||
|
//var result = yield(self, "return_polygon");
|
||||||
|
//queue_free();
|
||||||
|
//return result;
|
||||||
|
|
||||||
|
void PolygonDialog::_on_PolygonEditor_value_changed(const Variant &value) {
|
||||||
|
emit_signal("polygon_changed", value);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
PolygonDialog::PolygonDialog() {
|
||||||
|
closed = true;
|
||||||
|
previous_points = ;
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
PolygonDialog::~PolygonDialog() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void PolygonDialog::_bind_methods() {
|
||||||
|
ClassDB::bind_method(D_METHOD("get_closed"), &PolygonDialog::get_closed);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_closed", "value"), &PolygonDialog::set_closed);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "closed"), "set_closed", "get_closed");
|
||||||
|
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_previous_points"), &PolygonDialog::get_previous_points);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_previous_points", "value"), &PolygonDialog::set_previous_points);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR2_ARRAY, "previous_points"), "set_previous_points", "get_previous_points");
|
||||||
|
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_Variant"), &PolygonDialog::get_Variant);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_Variant", "value"), &PolygonDialog::set_Variant);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "Variant", PROPERTY_HINT_RESOURCE_TYPE, "Variant"), "set_Variant", "get_Variant");
|
||||||
|
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("set_closed", "c"), &PolygonDialog::set_closed, true);
|
||||||
|
ClassDB::bind_method(D_METHOD("_on_CurveDialog_popup_hide"), &PolygonDialog::_on_CurveDialog_popup_hide);
|
||||||
|
ClassDB::bind_method(D_METHOD("_on_OK_pressed"), &PolygonDialog::_on_OK_pressed);
|
||||||
|
ClassDB::bind_method(D_METHOD("_on_Cancel_pressed"), &PolygonDialog::_on_Cancel_pressed);
|
||||||
|
ClassDB::bind_method(D_METHOD("edit_polygon", "poly"), &PolygonDialog::edit_polygon);
|
||||||
|
ClassDB::bind_method(D_METHOD("_on_PolygonEditor_value_changed", "value"), &PolygonDialog::_on_PolygonEditor_value_changed);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,325 @@
|
|||||||
|
|
||||||
|
void construct() {
|
||||||
|
|
||||||
|
//Script: res://addons/mat_maker_gd/widgets/polygon_edit/polygon_dialog.gd
|
||||||
|
WindowDialog *polygondialog = memnew(WindowDialog);
|
||||||
|
polygondialog->set_name("PolygonDialog");
|
||||||
|
|
||||||
|
polygondialog->set_name("PolygonDialog");
|
||||||
|
//polygondialog->set("name", PolygonDialog));
|
||||||
|
|
||||||
|
polygondialog->set_filename("res://addons/mat_maker_gd/widgets/polygon_edit/polygon_dialog.tscn");
|
||||||
|
//polygondialog->set("filename", "res://addons/mat_maker_gd/widgets/polygon_edit/polygon_dialog.tscn");
|
||||||
|
|
||||||
|
polygondialog->set_anchor_right(1);
|
||||||
|
//polygondialog->set("anchor_right", 1);
|
||||||
|
|
||||||
|
polygondialog->set_anchor_bottom(1);
|
||||||
|
//polygondialog->set("anchor_bottom", 1);
|
||||||
|
|
||||||
|
polygondialog->set_margin_left(307);
|
||||||
|
//polygondialog->set("margin_left", 307);
|
||||||
|
|
||||||
|
polygondialog->set_margin_top(151);
|
||||||
|
//polygondialog->set("margin_top", 151);
|
||||||
|
|
||||||
|
polygondialog->set_margin_right(-508);
|
||||||
|
//polygondialog->set("margin_right", -508);
|
||||||
|
|
||||||
|
polygondialog->set_margin_bottom(-70);
|
||||||
|
//polygondialog->set("margin_bottom", -70);
|
||||||
|
|
||||||
|
polygondialog->set_rect_position(Vector2(307, 151));
|
||||||
|
//polygondialog->set("rect_position", Vector2(307, 151));
|
||||||
|
|
||||||
|
polygondialog->set_rect_global_position(Vector2(307, 151));
|
||||||
|
//polygondialog->set("rect_global_position", Vector2(307, 151));
|
||||||
|
|
||||||
|
polygondialog->set_rect_size(Vector2(0, 1));
|
||||||
|
//polygondialog->set("rect_size", Vector2(0, 1));
|
||||||
|
|
||||||
|
polygondialog->set_window_title("Edit polygon");
|
||||||
|
//polygondialog->set("window_title", "Edit polygon");
|
||||||
|
|
||||||
|
//polygondialog property __meta__ TYPE_DICTIONARY value: {_edit_use_anchors_:False}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
TextureButton *texturebutton_polygondialog = memnew(TextureButton);
|
||||||
|
texturebutton_polygondialog->set_name("TextureButton");
|
||||||
|
polygondialog->add_child(texturebutton_polygondialog);
|
||||||
|
|
||||||
|
texturebutton_polygondialog->set_name("TextureButton");
|
||||||
|
//texturebutton_polygondialog->set("name", TextureButton));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
VBoxContainer *vboxcontainer_polygondialog = memnew(VBoxContainer);
|
||||||
|
vboxcontainer_polygondialog->set_name("VBoxContainer");
|
||||||
|
polygondialog->add_child(vboxcontainer_polygondialog);
|
||||||
|
|
||||||
|
vboxcontainer_polygondialog->set_name("VBoxContainer");
|
||||||
|
//vboxcontainer_polygondialog->set("name", VBoxContainer));
|
||||||
|
|
||||||
|
//vboxcontainer_polygondialog property owner TYPE_OBJECT value: PolygonDialog:[WindowDialog:42399]
|
||||||
|
|
||||||
|
vboxcontainer_polygondialog->set_anchor_right(1);
|
||||||
|
//vboxcontainer_polygondialog->set("anchor_right", 1);
|
||||||
|
|
||||||
|
vboxcontainer_polygondialog->set_anchor_bottom(1);
|
||||||
|
//vboxcontainer_polygondialog->set("anchor_bottom", 1);
|
||||||
|
|
||||||
|
vboxcontainer_polygondialog->set_margin_left(5);
|
||||||
|
//vboxcontainer_polygondialog->set("margin_left", 5);
|
||||||
|
|
||||||
|
vboxcontainer_polygondialog->set_margin_top(5);
|
||||||
|
//vboxcontainer_polygondialog->set("margin_top", 5);
|
||||||
|
|
||||||
|
vboxcontainer_polygondialog->set_margin_right(-5);
|
||||||
|
//vboxcontainer_polygondialog->set("margin_right", -5);
|
||||||
|
|
||||||
|
vboxcontainer_polygondialog->set_margin_bottom(-5);
|
||||||
|
//vboxcontainer_polygondialog->set("margin_bottom", -5);
|
||||||
|
|
||||||
|
vboxcontainer_polygondialog->set_rect_position(Vector2(5, 5));
|
||||||
|
//vboxcontainer_polygondialog->set("rect_position", Vector2(5, 5));
|
||||||
|
|
||||||
|
vboxcontainer_polygondialog->set_rect_global_position(Vector2(5, 5));
|
||||||
|
//vboxcontainer_polygondialog->set("rect_global_position", Vector2(5, 5));
|
||||||
|
|
||||||
|
//vboxcontainer_polygondialog property __meta__ TYPE_DICTIONARY value: {_edit_use_anchors_:False}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
MarginContainer *editorcontainer_vboxcontainer_polygondialog = memnew(MarginContainer);
|
||||||
|
editorcontainer_vboxcontainer_polygondialog->set_name("EditorContainer");
|
||||||
|
vboxcontainer_polygondialog->add_child(editorcontainer_vboxcontainer_polygondialog);
|
||||||
|
|
||||||
|
editorcontainer_vboxcontainer_polygondialog->set_name("EditorContainer");
|
||||||
|
//editorcontainer_vboxcontainer_polygondialog->set("name", EditorContainer));
|
||||||
|
|
||||||
|
//editorcontainer_vboxcontainer_polygondialog property owner TYPE_OBJECT value: PolygonDialog:[WindowDialog:42399]
|
||||||
|
|
||||||
|
editorcontainer_vboxcontainer_polygondialog->set_margin_right(455);
|
||||||
|
//editorcontainer_vboxcontainer_polygondialog->set("margin_right", 455);
|
||||||
|
|
||||||
|
editorcontainer_vboxcontainer_polygondialog->set_margin_bottom(457);
|
||||||
|
//editorcontainer_vboxcontainer_polygondialog->set("margin_bottom", 457);
|
||||||
|
|
||||||
|
editorcontainer_vboxcontainer_polygondialog->set_rect_size(Vector2(455, 457));
|
||||||
|
//editorcontainer_vboxcontainer_polygondialog->set("rect_size", Vector2(455, 457));
|
||||||
|
|
||||||
|
editorcontainer_vboxcontainer_polygondialog->set_rect_clip_content(True);
|
||||||
|
//editorcontainer_vboxcontainer_polygondialog->set("rect_clip_content", True);
|
||||||
|
|
||||||
|
editorcontainer_vboxcontainer_polygondialog->set_size_flags_horizontal(3);
|
||||||
|
//editorcontainer_vboxcontainer_polygondialog->set("size_flags_horizontal", 3);
|
||||||
|
|
||||||
|
editorcontainer_vboxcontainer_polygondialog->set_size_flags_vertical(3);
|
||||||
|
//editorcontainer_vboxcontainer_polygondialog->set("size_flags_vertical", 3);
|
||||||
|
|
||||||
|
editorcontainer_vboxcontainer_polygondialog->set_custom_constants/margin_right(4);
|
||||||
|
//editorcontainer_vboxcontainer_polygondialog->set("custom_constants/margin_right", 4);
|
||||||
|
|
||||||
|
editorcontainer_vboxcontainer_polygondialog->set_custom_constants/margin_top(4);
|
||||||
|
//editorcontainer_vboxcontainer_polygondialog->set("custom_constants/margin_top", 4);
|
||||||
|
|
||||||
|
editorcontainer_vboxcontainer_polygondialog->set_custom_constants/margin_left(4);
|
||||||
|
//editorcontainer_vboxcontainer_polygondialog->set("custom_constants/margin_left", 4);
|
||||||
|
|
||||||
|
editorcontainer_vboxcontainer_polygondialog->set_custom_constants/margin_bottom(4);
|
||||||
|
//editorcontainer_vboxcontainer_polygondialog->set("custom_constants/margin_bottom", 4);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//Script: res://addons/mat_maker_gd/widgets/polygon_edit/polygon_editor.gd
|
||||||
|
Control *polygoneditor_editorcontainer_vboxcontainer_polygondialog = memnew(Control);
|
||||||
|
polygoneditor_editorcontainer_vboxcontainer_polygondialog->set_name("PolygonEditor");
|
||||||
|
editorcontainer_vboxcontainer_polygondialog->add_child(polygoneditor_editorcontainer_vboxcontainer_polygondialog);
|
||||||
|
|
||||||
|
polygoneditor_editorcontainer_vboxcontainer_polygondialog->set_name("PolygonEditor");
|
||||||
|
//polygoneditor_editorcontainer_vboxcontainer_polygondialog->set("name", PolygonEditor));
|
||||||
|
|
||||||
|
polygoneditor_editorcontainer_vboxcontainer_polygondialog->set_filename("res://addons/mat_maker_gd/widgets/polygon_edit/polygon_editor.tscn");
|
||||||
|
//polygoneditor_editorcontainer_vboxcontainer_polygondialog->set("filename", "res://addons/mat_maker_gd/widgets/polygon_edit/polygon_editor.tscn");
|
||||||
|
|
||||||
|
//polygoneditor_editorcontainer_vboxcontainer_polygondialog property owner TYPE_OBJECT value: PolygonDialog:[WindowDialog:42399]
|
||||||
|
|
||||||
|
polygoneditor_editorcontainer_vboxcontainer_polygondialog->set_margin_left(4);
|
||||||
|
//polygoneditor_editorcontainer_vboxcontainer_polygondialog->set("margin_left", 4);
|
||||||
|
|
||||||
|
polygoneditor_editorcontainer_vboxcontainer_polygondialog->set_margin_top(4);
|
||||||
|
//polygoneditor_editorcontainer_vboxcontainer_polygondialog->set("margin_top", 4);
|
||||||
|
|
||||||
|
polygoneditor_editorcontainer_vboxcontainer_polygondialog->set_margin_right(451);
|
||||||
|
//polygoneditor_editorcontainer_vboxcontainer_polygondialog->set("margin_right", 451);
|
||||||
|
|
||||||
|
polygoneditor_editorcontainer_vboxcontainer_polygondialog->set_margin_bottom(453);
|
||||||
|
//polygoneditor_editorcontainer_vboxcontainer_polygondialog->set("margin_bottom", 453);
|
||||||
|
|
||||||
|
polygoneditor_editorcontainer_vboxcontainer_polygondialog->set_rect_position(Vector2(4, 4));
|
||||||
|
//polygoneditor_editorcontainer_vboxcontainer_polygondialog->set("rect_position", Vector2(4, 4));
|
||||||
|
|
||||||
|
polygoneditor_editorcontainer_vboxcontainer_polygondialog->set_rect_global_position(Vector2(4, 4));
|
||||||
|
//polygoneditor_editorcontainer_vboxcontainer_polygondialog->set("rect_global_position", Vector2(4, 4));
|
||||||
|
|
||||||
|
polygoneditor_editorcontainer_vboxcontainer_polygondialog->set_rect_size(Vector2(447, 449));
|
||||||
|
//polygoneditor_editorcontainer_vboxcontainer_polygondialog->set("rect_size", Vector2(447, 449));
|
||||||
|
|
||||||
|
//polygoneditor_editorcontainer_vboxcontainer_polygondialog property __meta__ TYPE_DICTIONARY value: {_edit_use_anchors_:False}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
HSeparator *hseparator_vboxcontainer_polygondialog = memnew(HSeparator);
|
||||||
|
hseparator_vboxcontainer_polygondialog->set_name("HSeparator");
|
||||||
|
vboxcontainer_polygondialog->add_child(hseparator_vboxcontainer_polygondialog);
|
||||||
|
|
||||||
|
hseparator_vboxcontainer_polygondialog->set_name("HSeparator");
|
||||||
|
//hseparator_vboxcontainer_polygondialog->set("name", HSeparator));
|
||||||
|
|
||||||
|
//hseparator_vboxcontainer_polygondialog property owner TYPE_OBJECT value: PolygonDialog:[WindowDialog:42399]
|
||||||
|
|
||||||
|
hseparator_vboxcontainer_polygondialog->set_margin_top(461);
|
||||||
|
//hseparator_vboxcontainer_polygondialog->set("margin_top", 461);
|
||||||
|
|
||||||
|
hseparator_vboxcontainer_polygondialog->set_margin_right(455);
|
||||||
|
//hseparator_vboxcontainer_polygondialog->set("margin_right", 455);
|
||||||
|
|
||||||
|
hseparator_vboxcontainer_polygondialog->set_margin_bottom(465);
|
||||||
|
//hseparator_vboxcontainer_polygondialog->set("margin_bottom", 465);
|
||||||
|
|
||||||
|
hseparator_vboxcontainer_polygondialog->set_rect_position(Vector2(0, 461));
|
||||||
|
//hseparator_vboxcontainer_polygondialog->set("rect_position", Vector2(0, 461));
|
||||||
|
|
||||||
|
hseparator_vboxcontainer_polygondialog->set_rect_global_position(Vector2(0, 461));
|
||||||
|
//hseparator_vboxcontainer_polygondialog->set("rect_global_position", Vector2(0, 461));
|
||||||
|
|
||||||
|
hseparator_vboxcontainer_polygondialog->set_rect_size(Vector2(455, 4));
|
||||||
|
//hseparator_vboxcontainer_polygondialog->set("rect_size", Vector2(455, 4));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
HBoxContainer *hboxcontainer_vboxcontainer_polygondialog = memnew(HBoxContainer);
|
||||||
|
hboxcontainer_vboxcontainer_polygondialog->set_name("HBoxContainer");
|
||||||
|
vboxcontainer_polygondialog->add_child(hboxcontainer_vboxcontainer_polygondialog);
|
||||||
|
|
||||||
|
hboxcontainer_vboxcontainer_polygondialog->set_name("HBoxContainer");
|
||||||
|
//hboxcontainer_vboxcontainer_polygondialog->set("name", HBoxContainer));
|
||||||
|
|
||||||
|
//hboxcontainer_vboxcontainer_polygondialog property owner TYPE_OBJECT value: PolygonDialog:[WindowDialog:42399]
|
||||||
|
|
||||||
|
hboxcontainer_vboxcontainer_polygondialog->set_margin_top(469);
|
||||||
|
//hboxcontainer_vboxcontainer_polygondialog->set("margin_top", 469);
|
||||||
|
|
||||||
|
hboxcontainer_vboxcontainer_polygondialog->set_margin_right(455);
|
||||||
|
//hboxcontainer_vboxcontainer_polygondialog->set("margin_right", 455);
|
||||||
|
|
||||||
|
hboxcontainer_vboxcontainer_polygondialog->set_margin_bottom(489);
|
||||||
|
//hboxcontainer_vboxcontainer_polygondialog->set("margin_bottom", 489);
|
||||||
|
|
||||||
|
hboxcontainer_vboxcontainer_polygondialog->set_rect_position(Vector2(0, 469));
|
||||||
|
//hboxcontainer_vboxcontainer_polygondialog->set("rect_position", Vector2(0, 469));
|
||||||
|
|
||||||
|
hboxcontainer_vboxcontainer_polygondialog->set_rect_global_position(Vector2(0, 469));
|
||||||
|
//hboxcontainer_vboxcontainer_polygondialog->set("rect_global_position", Vector2(0, 469));
|
||||||
|
|
||||||
|
hboxcontainer_vboxcontainer_polygondialog->set_rect_size(Vector2(455, 20));
|
||||||
|
//hboxcontainer_vboxcontainer_polygondialog->set("rect_size", Vector2(455, 20));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Control *control_hboxcontainer_vboxcontainer_polygondialog = memnew(Control);
|
||||||
|
control_hboxcontainer_vboxcontainer_polygondialog->set_name("Control");
|
||||||
|
hboxcontainer_vboxcontainer_polygondialog->add_child(control_hboxcontainer_vboxcontainer_polygondialog);
|
||||||
|
|
||||||
|
control_hboxcontainer_vboxcontainer_polygondialog->set_name("Control");
|
||||||
|
//control_hboxcontainer_vboxcontainer_polygondialog->set("name", Control));
|
||||||
|
|
||||||
|
//control_hboxcontainer_vboxcontainer_polygondialog property owner TYPE_OBJECT value: PolygonDialog:[WindowDialog:42399]
|
||||||
|
|
||||||
|
control_hboxcontainer_vboxcontainer_polygondialog->set_margin_right(327);
|
||||||
|
//control_hboxcontainer_vboxcontainer_polygondialog->set("margin_right", 327);
|
||||||
|
|
||||||
|
control_hboxcontainer_vboxcontainer_polygondialog->set_margin_bottom(20);
|
||||||
|
//control_hboxcontainer_vboxcontainer_polygondialog->set("margin_bottom", 20);
|
||||||
|
|
||||||
|
control_hboxcontainer_vboxcontainer_polygondialog->set_rect_size(Vector2(327, 20));
|
||||||
|
//control_hboxcontainer_vboxcontainer_polygondialog->set("rect_size", Vector2(327, 20));
|
||||||
|
|
||||||
|
control_hboxcontainer_vboxcontainer_polygondialog->set_size_flags_horizontal(3);
|
||||||
|
//control_hboxcontainer_vboxcontainer_polygondialog->set("size_flags_horizontal", 3);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Button *ok_hboxcontainer_vboxcontainer_polygondialog = memnew(Button);
|
||||||
|
ok_hboxcontainer_vboxcontainer_polygondialog->set_name("OK");
|
||||||
|
hboxcontainer_vboxcontainer_polygondialog->add_child(ok_hboxcontainer_vboxcontainer_polygondialog);
|
||||||
|
|
||||||
|
ok_hboxcontainer_vboxcontainer_polygondialog->set_name("OK");
|
||||||
|
//ok_hboxcontainer_vboxcontainer_polygondialog->set("name", OK));
|
||||||
|
|
||||||
|
//ok_hboxcontainer_vboxcontainer_polygondialog property owner TYPE_OBJECT value: PolygonDialog:[WindowDialog:42399]
|
||||||
|
|
||||||
|
ok_hboxcontainer_vboxcontainer_polygondialog->set_margin_left(331);
|
||||||
|
//ok_hboxcontainer_vboxcontainer_polygondialog->set("margin_left", 331);
|
||||||
|
|
||||||
|
ok_hboxcontainer_vboxcontainer_polygondialog->set_margin_right(391);
|
||||||
|
//ok_hboxcontainer_vboxcontainer_polygondialog->set("margin_right", 391);
|
||||||
|
|
||||||
|
ok_hboxcontainer_vboxcontainer_polygondialog->set_margin_bottom(20);
|
||||||
|
//ok_hboxcontainer_vboxcontainer_polygondialog->set("margin_bottom", 20);
|
||||||
|
|
||||||
|
ok_hboxcontainer_vboxcontainer_polygondialog->set_rect_position(Vector2(331, 0));
|
||||||
|
//ok_hboxcontainer_vboxcontainer_polygondialog->set("rect_position", Vector2(331, 0));
|
||||||
|
|
||||||
|
ok_hboxcontainer_vboxcontainer_polygondialog->set_rect_global_position(Vector2(331, 0));
|
||||||
|
//ok_hboxcontainer_vboxcontainer_polygondialog->set("rect_global_position", Vector2(331, 0));
|
||||||
|
|
||||||
|
ok_hboxcontainer_vboxcontainer_polygondialog->set_rect_size(Vector2(60, 20));
|
||||||
|
//ok_hboxcontainer_vboxcontainer_polygondialog->set("rect_size", Vector2(60, 20));
|
||||||
|
|
||||||
|
ok_hboxcontainer_vboxcontainer_polygondialog->set_rect_min_size(Vector2(60, 0));
|
||||||
|
//ok_hboxcontainer_vboxcontainer_polygondialog->set("rect_min_size", Vector2(60, 0));
|
||||||
|
|
||||||
|
ok_hboxcontainer_vboxcontainer_polygondialog->set_text("OK");
|
||||||
|
//ok_hboxcontainer_vboxcontainer_polygondialog->set("text", "OK");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Button *cancel_hboxcontainer_vboxcontainer_polygondialog = memnew(Button);
|
||||||
|
cancel_hboxcontainer_vboxcontainer_polygondialog->set_name("Cancel");
|
||||||
|
hboxcontainer_vboxcontainer_polygondialog->add_child(cancel_hboxcontainer_vboxcontainer_polygondialog);
|
||||||
|
|
||||||
|
cancel_hboxcontainer_vboxcontainer_polygondialog->set_name("Cancel");
|
||||||
|
//cancel_hboxcontainer_vboxcontainer_polygondialog->set("name", Cancel));
|
||||||
|
|
||||||
|
//cancel_hboxcontainer_vboxcontainer_polygondialog property owner TYPE_OBJECT value: PolygonDialog:[WindowDialog:42399]
|
||||||
|
|
||||||
|
cancel_hboxcontainer_vboxcontainer_polygondialog->set_margin_left(395);
|
||||||
|
//cancel_hboxcontainer_vboxcontainer_polygondialog->set("margin_left", 395);
|
||||||
|
|
||||||
|
cancel_hboxcontainer_vboxcontainer_polygondialog->set_margin_right(455);
|
||||||
|
//cancel_hboxcontainer_vboxcontainer_polygondialog->set("margin_right", 455);
|
||||||
|
|
||||||
|
cancel_hboxcontainer_vboxcontainer_polygondialog->set_margin_bottom(20);
|
||||||
|
//cancel_hboxcontainer_vboxcontainer_polygondialog->set("margin_bottom", 20);
|
||||||
|
|
||||||
|
cancel_hboxcontainer_vboxcontainer_polygondialog->set_rect_position(Vector2(395, 0));
|
||||||
|
//cancel_hboxcontainer_vboxcontainer_polygondialog->set("rect_position", Vector2(395, 0));
|
||||||
|
|
||||||
|
cancel_hboxcontainer_vboxcontainer_polygondialog->set_rect_global_position(Vector2(395, 0));
|
||||||
|
//cancel_hboxcontainer_vboxcontainer_polygondialog->set("rect_global_position", Vector2(395, 0));
|
||||||
|
|
||||||
|
cancel_hboxcontainer_vboxcontainer_polygondialog->set_rect_size(Vector2(60, 20));
|
||||||
|
//cancel_hboxcontainer_vboxcontainer_polygondialog->set("rect_size", Vector2(60, 20));
|
||||||
|
|
||||||
|
cancel_hboxcontainer_vboxcontainer_polygondialog->set_rect_min_size(Vector2(60, 0));
|
||||||
|
//cancel_hboxcontainer_vboxcontainer_polygondialog->set("rect_min_size", Vector2(60, 0));
|
||||||
|
|
||||||
|
cancel_hboxcontainer_vboxcontainer_polygondialog->set_text("Cancel");
|
||||||
|
//cancel_hboxcontainer_vboxcontainer_polygondialog->set("text", "Cancel");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,45 @@
|
|||||||
|
#ifndef POLYGON_DIALOG_H
|
||||||
|
#define POLYGON_DIALOG_H
|
||||||
|
|
||||||
|
|
||||||
|
class PolygonDialog : public WindowDialog {
|
||||||
|
GDCLASS(PolygonDialog, WindowDialog);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
bool get_closed() const;
|
||||||
|
void set_closed(const bool val);
|
||||||
|
|
||||||
|
PoolVector2Array get_previous_points();
|
||||||
|
void set_previous_points(const PoolVector2Array &val);
|
||||||
|
|
||||||
|
Variant get_Variant();
|
||||||
|
void set_Variant(const Variant &val);
|
||||||
|
|
||||||
|
void set_closed(const bool c = true);
|
||||||
|
void _on_CurveDialog_popup_hide();
|
||||||
|
void _on_OK_pressed();
|
||||||
|
void _on_Cancel_pressed();
|
||||||
|
void edit_polygon(const Variant &poly);
|
||||||
|
void _on_PolygonEditor_value_changed(const Variant &value);
|
||||||
|
|
||||||
|
PolygonDialog();
|
||||||
|
~PolygonDialog();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
static void _bind_methods();
|
||||||
|
|
||||||
|
//tool
|
||||||
|
//export
|
||||||
|
// setget set_closed
|
||||||
|
bool closed = true;
|
||||||
|
PoolVector2Array previous_points = ;
|
||||||
|
Variant ;
|
||||||
|
signal polygon_changed(polygon);
|
||||||
|
//var result = yield(self, "return_polygon")
|
||||||
|
//queue_free()
|
||||||
|
//return result
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,106 @@
|
|||||||
|
|
||||||
|
#include "polygon_edit.h"
|
||||||
|
|
||||||
|
|
||||||
|
Variant PolygonEdit::get_Variant() {
|
||||||
|
return Variant;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PolygonEdit::set_Variant(const Variant &val) {
|
||||||
|
Variant = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool PolygonEdit::get_closed() const {
|
||||||
|
return closed;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PolygonEdit::set_closed(const bool val) {
|
||||||
|
closed = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Variant PolygonEdit::get_Variant() {
|
||||||
|
return Variant;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PolygonEdit::set_Variant(const Variant &val) {
|
||||||
|
Variant = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//tool;
|
||||||
|
//var MMPolygon = preload("res://addons/mat_maker_gd/nodes/bases/polygon_base.gd");
|
||||||
|
//export ;
|
||||||
|
// setget set_closed;
|
||||||
|
bool closed = true;
|
||||||
|
// setget set_value;
|
||||||
|
Variant = null;
|
||||||
|
signal updated(polygon);
|
||||||
|
|
||||||
|
void PolygonEdit::set_closed(const bool c) {
|
||||||
|
closed = c;
|
||||||
|
$PolygonView.set_closed(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PolygonEdit::set_value(const Variant &v) {
|
||||||
|
value = v;
|
||||||
|
$PolygonView.set_polygon(value);
|
||||||
|
$PolygonView.update();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PolygonEdit::_on_PolygonEdit_pressed() {
|
||||||
|
//var dialog = preload("res://addons/mat_maker_gd/widgets/polygon_edit/polygon_dialog.tscn").instance();
|
||||||
|
dialog.set_closed(closed);
|
||||||
|
add_child(dialog);
|
||||||
|
dialog.connect("polygon_changed", self, "on_value_changed");
|
||||||
|
dialog.edit_polygon(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PolygonEdit::on_value_changed(const Variant &v) {
|
||||||
|
//set_value(v);
|
||||||
|
emit_signal("updated", v);
|
||||||
|
$PolygonView.update();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
PolygonEdit::PolygonEdit() {
|
||||||
|
//var MMPolygon = preload("res://addons/mat_maker_gd/nodes/bases/polygon_base.gd");
|
||||||
|
closed = true;
|
||||||
|
= null;
|
||||||
|
}
|
||||||
|
|
||||||
|
PolygonEdit::~PolygonEdit() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void PolygonEdit::_bind_methods() {
|
||||||
|
ClassDB::bind_method(D_METHOD("get_Variant"), &PolygonEdit::get_Variant);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_Variant", "value"), &PolygonEdit::set_Variant);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "Variant", PROPERTY_HINT_RESOURCE_TYPE, "Variant"), "set_Variant", "get_Variant");
|
||||||
|
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_closed"), &PolygonEdit::get_closed);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_closed", "value"), &PolygonEdit::set_closed);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "closed"), "set_closed", "get_closed");
|
||||||
|
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_Variant"), &PolygonEdit::get_Variant);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_Variant", "value"), &PolygonEdit::set_Variant);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "Variant", PROPERTY_HINT_RESOURCE_TYPE, "Variant"), "set_Variant", "get_Variant");
|
||||||
|
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("set_closed", "c"), &PolygonEdit::set_closed, true);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_value", "v"), &PolygonEdit::set_value);
|
||||||
|
ClassDB::bind_method(D_METHOD("_on_PolygonEdit_pressed"), &PolygonEdit::_on_PolygonEdit_pressed);
|
||||||
|
ClassDB::bind_method(D_METHOD("on_value_changed", "v"), &PolygonEdit::on_value_changed);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,78 @@
|
|||||||
|
|
||||||
|
void construct() {
|
||||||
|
|
||||||
|
//Script: res://addons/mat_maker_gd/widgets/polygon_edit/polygon_edit.gd
|
||||||
|
Button *polygonedit = memnew(Button);
|
||||||
|
polygonedit->set_name("PolygonEdit");
|
||||||
|
|
||||||
|
polygonedit->set_name("PolygonEdit");
|
||||||
|
//polygonedit->set("name", PolygonEdit));
|
||||||
|
|
||||||
|
polygonedit->set_filename("res://addons/mat_maker_gd/widgets/polygon_edit/polygon_edit.tscn");
|
||||||
|
//polygonedit->set("filename", "res://addons/mat_maker_gd/widgets/polygon_edit/polygon_edit.tscn");
|
||||||
|
|
||||||
|
polygonedit->set_anchor_left(1);
|
||||||
|
//polygonedit->set("anchor_left", 1);
|
||||||
|
|
||||||
|
polygonedit->set_anchor_right(1);
|
||||||
|
//polygonedit->set("anchor_right", 1);
|
||||||
|
|
||||||
|
polygonedit->set_anchor_bottom(1);
|
||||||
|
//polygonedit->set("anchor_bottom", 1);
|
||||||
|
|
||||||
|
polygonedit->set_margin_left(-1280);
|
||||||
|
//polygonedit->set("margin_left", -1280);
|
||||||
|
|
||||||
|
polygonedit->set_margin_right(-1248);
|
||||||
|
//polygonedit->set("margin_right", -1248);
|
||||||
|
|
||||||
|
polygonedit->set_margin_bottom(-688);
|
||||||
|
//polygonedit->set("margin_bottom", -688);
|
||||||
|
|
||||||
|
polygonedit->set_rect_position(Vector2(-1280, 0));
|
||||||
|
//polygonedit->set("rect_position", Vector2(-1280, 0));
|
||||||
|
|
||||||
|
polygonedit->set_rect_global_position(Vector2(-1280, 0));
|
||||||
|
//polygonedit->set("rect_global_position", Vector2(-1280, 0));
|
||||||
|
|
||||||
|
polygonedit->set_rect_size(Vector2(32, 20));
|
||||||
|
//polygonedit->set("rect_size", Vector2(32, 20));
|
||||||
|
|
||||||
|
polygonedit->set_rect_min_size(Vector2(32, 32));
|
||||||
|
//polygonedit->set("rect_min_size", Vector2(32, 32));
|
||||||
|
|
||||||
|
polygonedit->set_focus_mode(1);
|
||||||
|
//polygonedit->set("focus_mode", 1);
|
||||||
|
|
||||||
|
//polygonedit property __meta__ TYPE_DICTIONARY value: {_edit_use_anchors_:False}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//Script: res://addons/mat_maker_gd/widgets/polygon_edit/polygon_view.gd
|
||||||
|
Control *polygonview_polygonedit = memnew(Control);
|
||||||
|
polygonview_polygonedit->set_name("PolygonView");
|
||||||
|
polygonedit->add_child(polygonview_polygonedit);
|
||||||
|
|
||||||
|
polygonview_polygonedit->set_name("PolygonView");
|
||||||
|
//polygonview_polygonedit->set("name", PolygonView));
|
||||||
|
|
||||||
|
polygonview_polygonedit->set_filename("res://addons/mat_maker_gd/widgets/polygon_edit/polygon_view.tscn");
|
||||||
|
//polygonview_polygonedit->set("filename", "res://addons/mat_maker_gd/widgets/polygon_edit/polygon_view.tscn");
|
||||||
|
|
||||||
|
//polygonview_polygonedit property owner TYPE_OBJECT value: PolygonEdit:[Button:42430]
|
||||||
|
|
||||||
|
polygonview_polygonedit->set_anchor_right(1);
|
||||||
|
//polygonview_polygonedit->set("anchor_right", 1);
|
||||||
|
|
||||||
|
polygonview_polygonedit->set_anchor_bottom(1);
|
||||||
|
//polygonview_polygonedit->set("anchor_bottom", 1);
|
||||||
|
|
||||||
|
polygonview_polygonedit->set_mouse_filter(2);
|
||||||
|
//polygonview_polygonedit->set("mouse_filter", 2);
|
||||||
|
|
||||||
|
//polygonview_polygonedit property __meta__ TYPE_DICTIONARY value: {_edit_use_anchors_:False}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,41 @@
|
|||||||
|
#ifndef POLYGON_EDIT_H
|
||||||
|
#define POLYGON_EDIT_H
|
||||||
|
|
||||||
|
|
||||||
|
class PolygonEdit : public Control {
|
||||||
|
GDCLASS(PolygonEdit, Control);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
Variant get_Variant();
|
||||||
|
void set_Variant(const Variant &val);
|
||||||
|
|
||||||
|
bool get_closed() const;
|
||||||
|
void set_closed(const bool val);
|
||||||
|
|
||||||
|
Variant get_Variant();
|
||||||
|
void set_Variant(const Variant &val);
|
||||||
|
|
||||||
|
void set_closed(const bool c = true);
|
||||||
|
void set_value(const Variant &v);
|
||||||
|
void _on_PolygonEdit_pressed();
|
||||||
|
void on_value_changed(const Variant &v);
|
||||||
|
|
||||||
|
PolygonEdit();
|
||||||
|
~PolygonEdit();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
static void _bind_methods();
|
||||||
|
|
||||||
|
//tool
|
||||||
|
Variant = preload("res://addons/mat_maker_gd/nodes/bases/polygon_base.gd");
|
||||||
|
//export
|
||||||
|
// setget set_closed
|
||||||
|
bool closed = true;
|
||||||
|
// setget set_value
|
||||||
|
Variant = null;
|
||||||
|
signal updated(polygon);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,111 @@
|
|||||||
|
|
||||||
|
#include "polygon_editor.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//tool;
|
||||||
|
signal value_changed(value);
|
||||||
|
|
||||||
|
void PolygonEditor::_ready() {
|
||||||
|
update_controls();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PolygonEditor::set_polygon(const Variant &p) {
|
||||||
|
polygon = p;
|
||||||
|
update();
|
||||||
|
update_controls();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PolygonEditor::update_controls() {
|
||||||
|
|
||||||
|
for (c in get_children()) {
|
||||||
|
c.queue_free();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!polygon) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
for (i in polygon.points.size()) {
|
||||||
|
Variant = polygon.points[i];
|
||||||
|
//var control_point = preload("res://addons/mat_maker_gd/widgets/polygon_edit/control_point.tscn").instance();
|
||||||
|
add_child(control_point);
|
||||||
|
control_point.initialize(p);
|
||||||
|
control_point.rect_position = transform_point(p)-control_point.OFFSET;
|
||||||
|
control_point.connect("moved", self, "_on_ControlPoint_moved");
|
||||||
|
control_point.connect("removed", self, "_on_ControlPoint_removed");
|
||||||
|
}
|
||||||
|
|
||||||
|
emit_signal("value_changed", polygon);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PolygonEditor::_on_ControlPoint_moved(const Variant &index) {
|
||||||
|
Variant = get_child(index);
|
||||||
|
polygon.points[index] = reverse_transform_point(control_point.rect_position+control_point.OFFSET);
|
||||||
|
update();
|
||||||
|
emit_signal("value_changed", polygon);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PolygonEditor::_on_ControlPoint_removed(const Variant &index) {
|
||||||
|
|
||||||
|
if (polygon.remove_point(index)) {
|
||||||
|
update();
|
||||||
|
update_controls();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PolygonEditor::_on_PolygonEditor_gui_input(const Variant &event) {
|
||||||
|
|
||||||
|
if (!polygon) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (event is InputEventMouseButton) {
|
||||||
|
|
||||||
|
if (event.button_index == BUTTON_LEFT && event.doubleclick) {
|
||||||
|
Variant = reverse_transform_point(get_local_mouse_position());
|
||||||
|
polygon.add_point(new_point_position.x, new_point_position.y, closed);
|
||||||
|
update_controls();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PolygonEditor::_on_resize() {
|
||||||
|
._on_resize();
|
||||||
|
update_controls();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
PolygonEditor::PolygonEditor() {
|
||||||
|
}
|
||||||
|
|
||||||
|
PolygonEditor::~PolygonEditor() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void PolygonEditor::_bind_methods() {
|
||||||
|
ClassDB::bind_method(D_METHOD("_ready"), &PolygonEditor::_ready);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_polygon", "p"), &PolygonEditor::set_polygon);
|
||||||
|
ClassDB::bind_method(D_METHOD("update_controls"), &PolygonEditor::update_controls);
|
||||||
|
ClassDB::bind_method(D_METHOD("_on_ControlPoint_moved", "index"), &PolygonEditor::_on_ControlPoint_moved);
|
||||||
|
ClassDB::bind_method(D_METHOD("_on_ControlPoint_removed", "index"), &PolygonEditor::_on_ControlPoint_removed);
|
||||||
|
ClassDB::bind_method(D_METHOD("_on_PolygonEditor_gui_input", "event"), &PolygonEditor::_on_PolygonEditor_gui_input);
|
||||||
|
ClassDB::bind_method(D_METHOD("_on_resize"), &PolygonEditor::_on_resize);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,43 @@
|
|||||||
|
|
||||||
|
void construct() {
|
||||||
|
|
||||||
|
//Script: res://addons/mat_maker_gd/widgets/polygon_edit/polygon_editor.gd
|
||||||
|
Control *polygoneditor = memnew(Control);
|
||||||
|
polygoneditor->set_name("PolygonEditor");
|
||||||
|
|
||||||
|
polygoneditor->set_name("PolygonEditor");
|
||||||
|
//polygoneditor->set("name", PolygonEditor));
|
||||||
|
|
||||||
|
polygoneditor->set_filename("res://addons/mat_maker_gd/widgets/polygon_edit/polygon_editor.tscn");
|
||||||
|
//polygoneditor->set("filename", "res://addons/mat_maker_gd/widgets/polygon_edit/polygon_editor.tscn");
|
||||||
|
|
||||||
|
polygoneditor->set_anchor_right(1);
|
||||||
|
//polygoneditor->set("anchor_right", 1);
|
||||||
|
|
||||||
|
polygoneditor->set_anchor_bottom(1);
|
||||||
|
//polygoneditor->set("anchor_bottom", 1);
|
||||||
|
|
||||||
|
polygoneditor->set_margin_left(10);
|
||||||
|
//polygoneditor->set("margin_left", 10);
|
||||||
|
|
||||||
|
polygoneditor->set_margin_top(10);
|
||||||
|
//polygoneditor->set("margin_top", 10);
|
||||||
|
|
||||||
|
polygoneditor->set_margin_right(-10);
|
||||||
|
//polygoneditor->set("margin_right", -10);
|
||||||
|
|
||||||
|
polygoneditor->set_margin_bottom(-10);
|
||||||
|
//polygoneditor->set("margin_bottom", -10);
|
||||||
|
|
||||||
|
polygoneditor->set_rect_position(Vector2(10, 10));
|
||||||
|
//polygoneditor->set("rect_position", Vector2(10, 10));
|
||||||
|
|
||||||
|
polygoneditor->set_rect_global_position(Vector2(10, 10));
|
||||||
|
//polygoneditor->set("rect_global_position", Vector2(10, 10));
|
||||||
|
|
||||||
|
//polygoneditor property __meta__ TYPE_DICTIONARY value: {_edit_use_anchors_:False}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
#ifndef POLYGON_EDITOR_H
|
||||||
|
#define POLYGON_EDITOR_H
|
||||||
|
|
||||||
|
|
||||||
|
class PolygonEditor : public "res://addons/mat_maker_gd/widgets/polygon_edit/polygon_view.gd" {
|
||||||
|
GDCLASS(PolygonEditor, "res://addons/mat_maker_gd/widgets/polygon_edit/polygon_view.gd");
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
void _ready();
|
||||||
|
void set_polygon(const Variant &p);
|
||||||
|
void update_controls();
|
||||||
|
void _on_ControlPoint_moved(const Variant &index);
|
||||||
|
void _on_ControlPoint_removed(const Variant &index);
|
||||||
|
void _on_PolygonEditor_gui_input(const Variant &event);
|
||||||
|
void _on_resize();
|
||||||
|
|
||||||
|
PolygonEditor();
|
||||||
|
~PolygonEditor();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
static void _bind_methods();
|
||||||
|
|
||||||
|
//tool
|
||||||
|
signal value_changed(value);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,171 @@
|
|||||||
|
|
||||||
|
#include "polygon_view.h"
|
||||||
|
|
||||||
|
|
||||||
|
Variant PolygonView::get_Variant() {
|
||||||
|
return Variant;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PolygonView::set_Variant(const Variant &val) {
|
||||||
|
Variant = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Variant PolygonView::get_Variant() {
|
||||||
|
return Variant;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PolygonView::set_Variant(const Variant &val) {
|
||||||
|
Variant = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Vector2 PolygonView::get_draw_size() {
|
||||||
|
return draw_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PolygonView::set_draw_size(const Vector2 &val) {
|
||||||
|
draw_size = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Vector2 PolygonView::get_draw_offset() {
|
||||||
|
return draw_offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PolygonView::set_draw_offset(const Vector2 &val) {
|
||||||
|
draw_offset = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool PolygonView::get_closed() const {
|
||||||
|
return closed;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PolygonView::set_closed(const bool val) {
|
||||||
|
closed = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//tool;
|
||||||
|
//var MMPolygon = preload("res://addons/mat_maker_gd/nodes/bases/polygon_base.gd");
|
||||||
|
//: MMPolygon;
|
||||||
|
Variant ;
|
||||||
|
Vector2 draw_size = Vector2(1, 1);
|
||||||
|
Vector2 draw_offset = Vector2(0, 0);
|
||||||
|
bool closed = true;
|
||||||
|
|
||||||
|
void PolygonView::set_closed(const bool c) {
|
||||||
|
closed = c;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PolygonView::_ready() {
|
||||||
|
// polygon = MMPolygon.new();
|
||||||
|
connect("resized", self, "_on_resize");
|
||||||
|
_on_resize();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Vector2 PolygonView::transform_point(const Vector2 &p) {
|
||||||
|
return draw_offset+p*draw_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Vector2 PolygonView::reverse_transform_point(const Vector2 &p) {
|
||||||
|
return (p-draw_offset)/draw_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PolygonView::set_polygon(const Variant &val) {
|
||||||
|
polygon = val;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PolygonView::_draw() {
|
||||||
|
|
||||||
|
if (!polygon) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// var current_theme : Theme = get_node("/root/MainWindow").theme;
|
||||||
|
// var bg = current_theme.get_stylebox("panel", "Panel").bg_color;
|
||||||
|
// var fg = current_theme.get_color("font_color", "Label");
|
||||||
|
// var axes_color : Color = bg.linear_interpolate(fg, 0.25);
|
||||||
|
// var curve_color : Color = bg.linear_interpolate(fg, 0.75);
|
||||||
|
Color axes_color = Color(0.9, 0.9, 0.9, 1);
|
||||||
|
Color curve_color = Color(1, 1, 1, 1);
|
||||||
|
draw_rect(Rect2(draw_offset, draw_size), axes_color, false);
|
||||||
|
Vector2 tp = transform_point(polygon.points[polygon.points.size()-1 if closed else 0]);
|
||||||
|
|
||||||
|
for (p in polygon.points) {
|
||||||
|
Variant = transform_point(p);
|
||||||
|
draw_line(tp, tnp, curve_color);
|
||||||
|
tp = tnp;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PolygonView::_on_resize() {
|
||||||
|
float ds = min(rect_size.x, rect_size.y);
|
||||||
|
draw_size = Vector2(ds, ds);
|
||||||
|
draw_offset = 0.5*(rect_size-draw_size);
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
PolygonView::PolygonView() {
|
||||||
|
//var MMPolygon = preload("res://addons/mat_maker_gd/nodes/bases/polygon_base.gd");
|
||||||
|
;
|
||||||
|
draw_size = Vector2(1, 1);
|
||||||
|
draw_offset = Vector2(0, 0);
|
||||||
|
closed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
PolygonView::~PolygonView() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void PolygonView::_bind_methods() {
|
||||||
|
ClassDB::bind_method(D_METHOD("get_Variant"), &PolygonView::get_Variant);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_Variant", "value"), &PolygonView::set_Variant);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "Variant", PROPERTY_HINT_RESOURCE_TYPE, "Variant"), "set_Variant", "get_Variant");
|
||||||
|
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_Variant"), &PolygonView::get_Variant);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_Variant", "value"), &PolygonView::set_Variant);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "Variant", PROPERTY_HINT_RESOURCE_TYPE, "Variant"), "set_Variant", "get_Variant");
|
||||||
|
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_draw_size"), &PolygonView::get_draw_size);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_draw_size", "value"), &PolygonView::set_draw_size);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "draw_size"), "set_draw_size", "get_draw_size");
|
||||||
|
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_draw_offset"), &PolygonView::get_draw_offset);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_draw_offset", "value"), &PolygonView::set_draw_offset);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "draw_offset"), "set_draw_offset", "get_draw_offset");
|
||||||
|
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_closed"), &PolygonView::get_closed);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_closed", "value"), &PolygonView::set_closed);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "closed"), "set_closed", "get_closed");
|
||||||
|
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("set_closed", "c"), &PolygonView::set_closed, true);
|
||||||
|
ClassDB::bind_method(D_METHOD("_ready"), &PolygonView::_ready);
|
||||||
|
ClassDB::bind_method(D_METHOD("transform_point", "p"), &PolygonView::transform_point);
|
||||||
|
ClassDB::bind_method(D_METHOD("reverse_transform_point", "p"), &PolygonView::reverse_transform_point);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_polygon", "val"), &PolygonView::set_polygon);
|
||||||
|
ClassDB::bind_method(D_METHOD("_draw"), &PolygonView::_draw);
|
||||||
|
ClassDB::bind_method(D_METHOD("_on_resize"), &PolygonView::_on_resize);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,31 @@
|
|||||||
|
|
||||||
|
void construct() {
|
||||||
|
|
||||||
|
//Script: res://addons/mat_maker_gd/widgets/polygon_edit/polygon_view.gd
|
||||||
|
Control *polygonview = memnew(Control);
|
||||||
|
polygonview->set_name("PolygonView");
|
||||||
|
|
||||||
|
polygonview->set_name("PolygonView");
|
||||||
|
//polygonview->set("name", PolygonView));
|
||||||
|
|
||||||
|
polygonview->set_filename("res://addons/mat_maker_gd/widgets/polygon_edit/polygon_view.tscn");
|
||||||
|
//polygonview->set("filename", "res://addons/mat_maker_gd/widgets/polygon_edit/polygon_view.tscn");
|
||||||
|
|
||||||
|
polygonview->set_margin_right(64);
|
||||||
|
//polygonview->set("margin_right", 64);
|
||||||
|
|
||||||
|
polygonview->set_margin_bottom(64);
|
||||||
|
//polygonview->set("margin_bottom", 64);
|
||||||
|
|
||||||
|
polygonview->set_rect_size(Vector2(64, 64));
|
||||||
|
//polygonview->set("rect_size", Vector2(64, 64));
|
||||||
|
|
||||||
|
polygonview->set_mouse_filter(2);
|
||||||
|
//polygonview->set("mouse_filter", 2);
|
||||||
|
|
||||||
|
//polygonview property __meta__ TYPE_DICTIONARY value: {_edit_use_anchors_:False}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,49 @@
|
|||||||
|
#ifndef POLYGON_VIEW_H
|
||||||
|
#define POLYGON_VIEW_H
|
||||||
|
|
||||||
|
|
||||||
|
class PolygonView : public Control {
|
||||||
|
GDCLASS(PolygonView, Control);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
Variant get_Variant();
|
||||||
|
void set_Variant(const Variant &val);
|
||||||
|
|
||||||
|
Variant get_Variant();
|
||||||
|
void set_Variant(const Variant &val);
|
||||||
|
|
||||||
|
Vector2 get_draw_size();
|
||||||
|
void set_draw_size(const Vector2 &val);
|
||||||
|
|
||||||
|
Vector2 get_draw_offset();
|
||||||
|
void set_draw_offset(const Vector2 &val);
|
||||||
|
|
||||||
|
bool get_closed() const;
|
||||||
|
void set_closed(const bool val);
|
||||||
|
|
||||||
|
void set_closed(const bool c = true);
|
||||||
|
void _ready();
|
||||||
|
Vector2 transform_point(const Vector2 &p);
|
||||||
|
Vector2 reverse_transform_point(const Vector2 &p);
|
||||||
|
void set_polygon(const Variant &val);
|
||||||
|
void _draw();
|
||||||
|
void _on_resize();
|
||||||
|
|
||||||
|
PolygonView();
|
||||||
|
~PolygonView();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
static void _bind_methods();
|
||||||
|
|
||||||
|
//tool
|
||||||
|
Variant = preload("res://addons/mat_maker_gd/nodes/bases/polygon_base.gd");
|
||||||
|
//: MMPolygon
|
||||||
|
Variant ;
|
||||||
|
Vector2 draw_size = Vector2(1, 1);
|
||||||
|
Vector2 draw_offset = Vector2(0, 0);
|
||||||
|
bool closed = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in New Issue
Block a user