Disabled the paint sidebar, as I found a better way of handling this using custom property inspectors.

This commit is contained in:
Relintai 2022-11-16 23:48:45 +01:00
parent 25968b2803
commit ef3110d4d1
2 changed files with 13 additions and 7 deletions

View File

@ -32,21 +32,22 @@ SOFTWARE.
#include "nodes/paint_node.h" #include "nodes/paint_node.h"
PaintSidebar *PaintEditorPlugin::get_sidebar() { PaintSidebar *PaintEditorPlugin::get_sidebar() {
return _sidebar; //return _sidebar;
return NULL;
} }
void PaintEditorPlugin::make_visible(const bool visible) { void PaintEditorPlugin::make_visible(const bool visible) {
_sidebar->set_visible(visible); //_sidebar->set_visible(visible);
} }
String PaintEditorPlugin::get_name() const { String PaintEditorPlugin::get_name() const {
return "Paint"; return "PaintNodeEditor";
} }
void PaintEditorPlugin::edit(Object *p_object) { void PaintEditorPlugin::edit(Object *p_object) {
_active_node = Object::cast_to<PaintNode>(p_object); _active_node = Object::cast_to<PaintNode>(p_object);
_sidebar->on_paint_node_selected(_active_node); //_sidebar->on_paint_node_selected(_active_node);
} }
bool PaintEditorPlugin::handles(Object *p_object) const { bool PaintEditorPlugin::handles(Object *p_object) const {
return p_object->is_class("PaintNode"); return p_object->is_class("PaintNode");
@ -76,6 +77,7 @@ PaintEditorPlugin::PaintEditorPlugin(EditorNode *p_node) {
editor = p_node; editor = p_node;
/*
EDITOR_DEF("editors/paint/editor_side", 0); EDITOR_DEF("editors/paint/editor_side", 0);
EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::INT, "editors/paint/editor_side", PROPERTY_HINT_ENUM, "Left,Right")); EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::INT, "editors/paint/editor_side", PROPERTY_HINT_ENUM, "Left,Right"));
@ -95,10 +97,11 @@ PaintEditorPlugin::PaintEditorPlugin(EditorNode *p_node) {
make_visible(false); make_visible(false);
Engine::get_singleton()->add_global("PaintEditorPlugin", this); Engine::get_singleton()->add_global("PaintEditorPlugin", this);
*/
} }
PaintEditorPlugin::~PaintEditorPlugin() { PaintEditorPlugin::~PaintEditorPlugin() {
Engine::get_singleton()->remove_global("PaintEditorPlugin"); //Engine::get_singleton()->remove_global("PaintEditorPlugin");
} }
void PaintEditorPlugin::on_node_removed(Node *node) { void PaintEditorPlugin::on_node_removed(Node *node) {
@ -108,6 +111,7 @@ void PaintEditorPlugin::on_node_removed(Node *node) {
} }
void PaintEditorPlugin::_notification(int p_what) { void PaintEditorPlugin::_notification(int p_what) {
/*
if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) { if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
switch ((int)EditorSettings::get_singleton()->get("editors/paint/editor_side")) { switch ((int)EditorSettings::get_singleton()->get("editors/paint/editor_side")) {
case 0: { // Left. case 0: { // Left.
@ -117,7 +121,9 @@ void PaintEditorPlugin::_notification(int p_what) {
CanvasItemEditor::get_singleton()->move_control_to_right_panel(_sidebar); CanvasItemEditor::get_singleton()->move_control_to_right_panel(_sidebar);
} break; } break;
} }
} else if (p_what == NOTIFICATION_READY) { } else
*/
if (p_what == NOTIFICATION_READY) {
if (!get_tree()->is_connected("node_removed", this, "on_node_removed")) { if (!get_tree()->is_connected("node_removed", this, "on_node_removed")) {
get_tree()->connect("node_removed", this, "on_node_removed"); get_tree()->connect("node_removed", this, "on_node_removed");
} }

View File

@ -60,7 +60,7 @@ protected:
static void _bind_methods(); static void _bind_methods();
PaintSidebar *_sidebar; //PaintSidebar *_sidebar;
PaintNode *_active_node; PaintNode *_active_node;
}; };