mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-01-23 17:47:17 +01:00
PaintColorGrid now inherits from PaintSidebarModule. It is also added to the new sidebar by the paint plugin.
This commit is contained in:
parent
abe142b090
commit
e044b007f6
@ -25,7 +25,7 @@ module_env.add_source_files(env.modules_sources,"deprecated/dialogs/paint_load_f
|
|||||||
module_env.add_source_files(env.modules_sources,"deprecated/dialogs/paint_save_file_dialog.cpp")
|
module_env.add_source_files(env.modules_sources,"deprecated/dialogs/paint_save_file_dialog.cpp")
|
||||||
|
|
||||||
module_env.add_source_files(env.modules_sources,"ui/paint_canvas_outline.cpp")
|
module_env.add_source_files(env.modules_sources,"ui/paint_canvas_outline.cpp")
|
||||||
module_env.add_source_files(env.modules_sources,"ui/paint_color_grid.cpp")
|
module_env.add_source_files(env.modules_sources,"ui/sidebar_modules/paint_color_grid.cpp")
|
||||||
module_env.add_source_files(env.modules_sources,"ui/paint_canvas_background.cpp")
|
module_env.add_source_files(env.modules_sources,"ui/paint_canvas_background.cpp")
|
||||||
module_env.add_source_files(env.modules_sources,"ui/paint_selection_box.cpp")
|
module_env.add_source_files(env.modules_sources,"ui/paint_selection_box.cpp")
|
||||||
module_env.add_source_files(env.modules_sources,"ui/paint_visual_grid.cpp")
|
module_env.add_source_files(env.modules_sources,"ui/paint_visual_grid.cpp")
|
||||||
|
@ -43,7 +43,7 @@ SOFTWARE.
|
|||||||
#include "paint_canvas.h"
|
#include "paint_canvas.h"
|
||||||
#include "../ui/paint_canvas_background.h"
|
#include "../ui/paint_canvas_background.h"
|
||||||
#include "paint_canvas_layer.h"
|
#include "paint_canvas_layer.h"
|
||||||
#include "../ui/paint_color_grid.h"
|
#include "../ui/sidebar_modules/paint_color_grid.h"
|
||||||
#include "paint_layer_button.h"
|
#include "paint_layer_button.h"
|
||||||
#include "paint_navbar.h"
|
#include "paint_navbar.h"
|
||||||
#include "../paint_utilities.h"
|
#include "../paint_utilities.h"
|
||||||
@ -60,6 +60,7 @@ SOFTWARE.
|
|||||||
#include "scene/gui/slider.h"
|
#include "scene/gui/slider.h"
|
||||||
#include "scene/gui/texture_button.h"
|
#include "scene/gui/texture_button.h"
|
||||||
#include "scene/gui/texture_rect.h"
|
#include "scene/gui/texture_rect.h"
|
||||||
|
#include "scene/gui/grid_container.h"
|
||||||
|
|
||||||
#include "dialogs/paint_canvas_dialog.h"
|
#include "dialogs/paint_canvas_dialog.h"
|
||||||
#include "dialogs/paint_change_grid_size_dialog.h"
|
#include "dialogs/paint_change_grid_size_dialog.h"
|
||||||
@ -1322,7 +1323,7 @@ PaintWindow::PaintWindow() {
|
|||||||
left_main_vbox_container->add_child(left_color_scroll_container);
|
left_main_vbox_container->add_child(left_color_scroll_container);
|
||||||
|
|
||||||
color_grid = memnew(PaintColorGrid);
|
color_grid = memnew(PaintColorGrid);
|
||||||
color_grid->set_columns(4);
|
//color_grid->set_columns(4);
|
||||||
color_grid->set_custom_minimum_size(Size2(0, 145));
|
color_grid->set_custom_minimum_size(Size2(0, 145));
|
||||||
color_grid->set_h_size_flags(SIZE_EXPAND_FILL);
|
color_grid->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||||
color_grid->set_v_size_flags(SIZE_EXPAND_FILL);
|
color_grid->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||||
|
@ -27,6 +27,7 @@ SOFTWARE.
|
|||||||
#include "editor/plugins/canvas_item_editor_plugin.h"
|
#include "editor/plugins/canvas_item_editor_plugin.h"
|
||||||
|
|
||||||
#include "ui/paint_sidebar.h"
|
#include "ui/paint_sidebar.h"
|
||||||
|
#include "ui/sidebar_modules/paint_color_grid.h"
|
||||||
|
|
||||||
PaintSidebar *PaintEditorPlugin::get_sidebar() {
|
PaintSidebar *PaintEditorPlugin::get_sidebar() {
|
||||||
return _sidebar;
|
return _sidebar;
|
||||||
@ -56,6 +57,9 @@ PaintEditorPlugin::PaintEditorPlugin(EditorNode *p_node) {
|
|||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PaintColorGrid *paint_color_grid = memnew(PaintColorGrid);
|
||||||
|
_sidebar->add_module(paint_color_grid);
|
||||||
|
|
||||||
make_visible(false);
|
make_visible(false);
|
||||||
|
|
||||||
Engine::get_singleton()->add_global("PaintEditorPlugin", this);
|
Engine::get_singleton()->add_global("PaintEditorPlugin", this);
|
||||||
|
@ -40,7 +40,7 @@ SOFTWARE.
|
|||||||
|
|
||||||
#include "ui/paint_canvas_background.h"
|
#include "ui/paint_canvas_background.h"
|
||||||
#include "ui/paint_canvas_outline.h"
|
#include "ui/paint_canvas_outline.h"
|
||||||
#include "ui/paint_color_grid.h"
|
#include "ui/sidebar_modules/paint_color_grid.h"
|
||||||
#include "ui/paint_selection_box.h"
|
#include "ui/paint_selection_box.h"
|
||||||
#include "ui/paint_visual_grid.h"
|
#include "ui/paint_visual_grid.h"
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@ SOFTWARE.
|
|||||||
#include "paint_color_grid.h"
|
#include "paint_color_grid.h"
|
||||||
|
|
||||||
#include "scene/gui/button.h"
|
#include "scene/gui/button.h"
|
||||||
|
#include "scene/gui/grid_container.h"
|
||||||
#include "scene/resources/style_box.h"
|
#include "scene/resources/style_box.h"
|
||||||
|
|
||||||
void PaintColorGrid::change_color_to(const Color &color) {
|
void PaintColorGrid::change_color_to(const Color &color) {
|
||||||
@ -32,13 +33,13 @@ void PaintColorGrid::change_color_to(const Color &color) {
|
|||||||
}
|
}
|
||||||
void PaintColorGrid::add_color_prefab(const Color &color) {
|
void PaintColorGrid::add_color_prefab(const Color &color) {
|
||||||
Button *button = memnew(Button);
|
Button *button = memnew(Button);
|
||||||
|
|
||||||
button->set_custom_minimum_size(Size2(25, 25));
|
button->set_custom_minimum_size(Size2(25, 25));
|
||||||
button->set_h_size_flags(SIZE_EXPAND_FILL);
|
button->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||||
button->set_v_size_flags(SIZE_EXPAND_FILL);
|
button->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||||
|
|
||||||
add_child(button);
|
_grid->add_child(button);
|
||||||
move_child(button, 0);
|
_grid->move_child(button, 0);
|
||||||
|
|
||||||
Ref<StyleBoxFlat> style_box;
|
Ref<StyleBoxFlat> style_box;
|
||||||
style_box.instance();
|
style_box.instance();
|
||||||
@ -53,9 +54,18 @@ void PaintColorGrid::add_color_prefab(const Color &color) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
PaintColorGrid::PaintColorGrid() {
|
PaintColorGrid::PaintColorGrid() {
|
||||||
|
_grid = memnew(GridContainer);
|
||||||
|
add_child(_grid);
|
||||||
|
|
||||||
|
_grid->set_columns(4);
|
||||||
|
//color_grid->set_custom_minimum_size(Size2(0, 145));
|
||||||
|
//color_grid->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||||
|
//color_grid->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||||
|
|
||||||
for (int i = 0; i < 24; ++i) {
|
for (int i = 0; i < 24; ++i) {
|
||||||
add_color_prefab(Color(Math::randf(), Math::randf(), Math::randf()));
|
add_color_prefab(Color(Math::randf(), Math::randf(), Math::randf()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PaintColorGrid::~PaintColorGrid() {
|
PaintColorGrid::~PaintColorGrid() {
|
@ -25,10 +25,12 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "scene/gui/grid_container.h"
|
#include "../paint_sidebar_module.h"
|
||||||
|
|
||||||
class PaintColorGrid : public GridContainer {
|
class GridContainer;
|
||||||
GDCLASS(PaintColorGrid, GridContainer);
|
|
||||||
|
class PaintColorGrid : public PaintSidebarModule {
|
||||||
|
GDCLASS(PaintColorGrid, PaintSidebarModule);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void change_color_to(const Color &color);
|
void change_color_to(const Color &color);
|
||||||
@ -39,6 +41,8 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
|
|
||||||
|
GridContainer *_grid;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
Reference in New Issue
Block a user