From ed094d52a9a281fc0735f633b02adc7f2cf11cf8 Mon Sep 17 00:00:00 2001
From: MarianoGNU
Date: Sun, 24 Jul 2016 16:16:02 -0300
Subject: expose bottom panel button to EditorPlugin scripts
---
tools/editor/editor_plugin.cpp | 4 ++--
tools/editor/editor_plugin.h | 3 ++-
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/tools/editor/editor_plugin.cpp b/tools/editor/editor_plugin.cpp
index 01e6b613c..2bdd4caeb 100644
--- a/tools/editor/editor_plugin.cpp
+++ b/tools/editor/editor_plugin.cpp
@@ -44,9 +44,9 @@ void EditorPlugin::remove_custom_type(const String& p_type){
}
-void EditorPlugin::add_control_to_bottom_panel(Control *p_control, const String &p_title) {
+ToolButton * EditorPlugin::add_control_to_bottom_panel(Control *p_control, const String &p_title) {
- EditorNode::get_singleton()->add_bottom_panel_item(p_title,p_control);
+ return EditorNode::get_singleton()->add_bottom_panel_item(p_title,p_control);
}
void EditorPlugin::add_control_to_dock(DockSlot p_slot,Control *p_control) {
diff --git a/tools/editor/editor_plugin.h b/tools/editor/editor_plugin.h
index b93b6624d..b960a7d5a 100644
--- a/tools/editor/editor_plugin.h
+++ b/tools/editor/editor_plugin.h
@@ -29,6 +29,7 @@
#ifndef EDITOR_PLUGIN_H
#define EDITOR_PLUGIN_H
+#include "scene/gui/tool_button.h"
#include "scene/main/node.h"
#include "scene/resources/texture.h"
#include "undo_redo.h"
@@ -92,7 +93,7 @@ public:
//TODO: send a resoucre for editing to the editor node?
void add_control_to_container(CustomControlContainer p_location, Control *p_control);
- void add_control_to_bottom_panel(Control *p_control, const String &p_title);
+ ToolButton *add_control_to_bottom_panel(Control *p_control, const String &p_title);
void add_control_to_dock(DockSlot p_slot,Control *p_control);
void remove_control_from_docks(Control *p_control);
void remove_control_from_bottom_panel(Control *p_control);
--
cgit v1.3.1
From 23a20791d1f0c0760c0e22d51c0450b58b0e05f1 Mon Sep 17 00:00:00 2001
From: MarianoGNU
Date: Sun, 24 Jul 2016 18:05:05 -0300
Subject: Update documentation.
---
doc/base/classes.xml | 2 +-
tools/editor/editor_plugin.cpp | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/doc/base/classes.xml b/doc/base/classes.xml
index 4c2a0fe7b..d70b11b5a 100644
--- a/doc/base/classes.xml
+++ b/doc/base/classes.xml
@@ -11281,7 +11281,7 @@
- Add a control to the bottom panel (together with Output, Debug, Animation, etc). If your plugin is being removed, also make sure to remove your control by calling [method remove_control_from_bottom_panel].
+ Add a control to the bottom panel (together with Output, Debug, Animation, etc). Returns a reference to the button added. It's up to you to hide/show the button when needed. If your plugin is being removed, also make sure to remove your control by calling [method remove_control_from_bottom_panel].
diff --git a/tools/editor/editor_plugin.cpp b/tools/editor/editor_plugin.cpp
index 2bdd4caeb..0d162cbe5 100644
--- a/tools/editor/editor_plugin.cpp
+++ b/tools/editor/editor_plugin.cpp
@@ -284,7 +284,7 @@ Control *EditorPlugin::get_base_control() {
void EditorPlugin::_bind_methods() {
ObjectTypeDB::bind_method(_MD("add_control_to_container","container","control:Control"),&EditorPlugin::add_control_to_container);
- ObjectTypeDB::bind_method(_MD("add_control_to_bottom_panel","control:Control","title"),&EditorPlugin::add_control_to_bottom_panel);
+ ObjectTypeDB::bind_method(_MD("add_control_to_bottom_panel:ToolButton","control:Control","title"),&EditorPlugin::add_control_to_bottom_panel);
ObjectTypeDB::bind_method(_MD("add_control_to_dock","slot","control:Control"),&EditorPlugin::add_control_to_dock);
ObjectTypeDB::bind_method(_MD("remove_control_from_docks","control:Control"),&EditorPlugin::remove_control_from_docks);
ObjectTypeDB::bind_method(_MD("remove_control_from_bottom_panel","control:Control"),&EditorPlugin::remove_control_from_bottom_panel);
--
cgit v1.3.1