summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2016-02-29 09:56:36 -0300
committerJuan Linietsky <reduzio@gmail.com>2016-02-29 09:57:38 -0300
commit210d332defffb5528da6c6aff3b28fb8732bf007 (patch)
treebb38c77cf1b059f31e0c5da8b1ac060f2e5d36e8
parent445d38b7280b25caec1b9728f68d0aa0f69917b6 (diff)
-wip on addon editor
-fixes instantiable subclasses not working, as reported in #3871
-rw-r--r--modules/gdscript/gd_compiler.cpp2
-rw-r--r--tools/editor/addon_editor_plugin.cpp67
-rw-r--r--tools/editor/addon_editor_plugin.h50
-rw-r--r--tools/editor/editor_node.cpp2
4 files changed, 121 insertions, 0 deletions
diff --git a/modules/gdscript/gd_compiler.cpp b/modules/gdscript/gd_compiler.cpp
index 53519030fc..403af8eb04 100644
--- a/modules/gdscript/gd_compiler.cpp
+++ b/modules/gdscript/gd_compiler.cpp
@@ -1712,6 +1712,8 @@ Error GDCompiler::_parse_class(GDScript *p_script,GDScript *p_owner,const GDPars
}
}
#endif
+
+ p_script->valid=true;
return OK;
}
diff --git a/tools/editor/addon_editor_plugin.cpp b/tools/editor/addon_editor_plugin.cpp
new file mode 100644
index 0000000000..8c25ec4057
--- /dev/null
+++ b/tools/editor/addon_editor_plugin.cpp
@@ -0,0 +1,67 @@
+#include "addon_editor_plugin.h"
+#include "editor_node.h"
+EditorAddonLibrary::EditorAddonLibrary() {
+
+ tabs = memnew( TabContainer );
+ tabs->set_v_size_flags(SIZE_EXPAND_FILL);
+ add_child(tabs);
+
+ installed = memnew( EditorPluginSettings );
+ installed->set_name("Installed");
+ tabs->add_child(installed);
+
+ library = memnew( VBoxContainer );
+ library->set_name("Online");
+ tabs->add_child(library);
+
+ HBoxContainer *search_hb = memnew( HBoxContainer );
+
+ library->add_child(search_hb);
+
+ search_hb->add_child( memnew( Label("Search: ")));
+ filter =memnew( LineEdit );
+ search_hb->add_child(filter);
+ filter->set_h_size_flags(SIZE_EXPAND_FILL);
+
+ categories = memnew( OptionButton );
+ categories->add_item("All Categories");
+ search_hb->add_child(categories);
+
+ search = memnew( Button("Search"));
+ search_hb->add_child(search);
+
+
+
+
+}
+
+
+///////
+
+
+void AddonEditorPlugin::make_visible(bool p_visible) {
+
+ if (p_visible) {
+
+ addon_library->show();
+ } else {
+
+ addon_library->hide();
+ }
+
+}
+
+AddonEditorPlugin::AddonEditorPlugin(EditorNode *p_node) {
+
+ editor=p_node;
+ addon_library = memnew( EditorAddonLibrary );
+ addon_library->set_v_size_flags(Control::SIZE_EXPAND_FILL);
+ editor->get_viewport()->add_child(addon_library);
+ addon_library->set_area_as_parent_rect();
+ addon_library->hide();
+
+}
+
+AddonEditorPlugin::~AddonEditorPlugin() {
+
+}
diff --git a/tools/editor/addon_editor_plugin.h b/tools/editor/addon_editor_plugin.h
new file mode 100644
index 0000000000..3a4086d07c
--- /dev/null
+++ b/tools/editor/addon_editor_plugin.h
@@ -0,0 +1,50 @@
+#ifndef ADDON_EDITOR_PLUGIN_H
+#define ADDON_EDITOR_PLUGIN_H
+
+
+#include "editor_plugin.h"
+#include "scene/gui/box_container.h"
+#include "scene/gui/line_edit.h"
+#include "scene/gui/option_button.h"
+#include "scene/gui/tab_container.h"
+#include "editor_plugin_settings.h"
+
+class EditorAddonLibrary : public VBoxContainer {
+ OBJ_TYPE(EditorAddonLibrary,VBoxContainer);
+
+ TabContainer *tabs;
+ EditorPluginSettings *installed;
+ VBoxContainer *library;
+ LineEdit *filter;
+ OptionButton *categories;
+ Button *search;
+
+
+public:
+ EditorAddonLibrary();
+};
+
+class AddonEditorPlugin : public EditorPlugin {
+
+ OBJ_TYPE( AddonEditorPlugin, EditorPlugin );
+
+ EditorAddonLibrary *addon_library;
+ EditorNode *editor;
+
+public:
+
+ virtual String get_name() const { return "Addons"; }
+ bool has_main_screen() const { return true; }
+ virtual void edit(Object *p_object) {}
+ virtual bool handles(Object *p_object) const { return false; }
+ virtual void make_visible(bool p_visible);
+ //virtual bool get_remove_list(List<Node*> *p_list) { return canvas_item_editor->get_remove_list(p_list); }
+ //virtual Dictionary get_state() const;
+ //virtual void set_state(const Dictionary& p_state);
+
+ AddonEditorPlugin(EditorNode *p_node);
+ ~AddonEditorPlugin();
+
+};
+
+#endif // EDITORASSETLIBRARY_H
diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp
index c10f1e97fb..61d6d74d1e 100644
--- a/tools/editor/editor_node.cpp
+++ b/tools/editor/editor_node.cpp
@@ -61,6 +61,7 @@
#include "plugins/sprite_frames_editor_plugin.h"
#include "plugins/sprite_region_editor_plugin.h"
#include "plugins/canvas_item_editor_plugin.h"
+#include "addon_editor_plugin.h"
#include "plugins/spatial_editor_plugin.h"
#include "plugins/sample_editor_plugin.h"
#include "plugins/sample_library_editor_plugin.h"
@@ -6093,6 +6094,7 @@ EditorNode::EditorNode() {
add_editor_plugin( memnew( CanvasItemEditorPlugin(this) ) );
add_editor_plugin( memnew( SpatialEditorPlugin(this) ) );
add_editor_plugin( memnew( ScriptEditorPlugin(this) ) );
+ //add_editor_plugin( memnew( AddonEditorPlugin(this) ) );
//more visually meaningful to have this later
raise_bottom_panel_item(AnimationPlayerEditor::singleton);