-wip on addon editor
-fixes instantiable subclasses not working, as reported in #3871
This commit is contained in:
parent
445d38b728
commit
210d332def
|
@ -1712,6 +1712,8 @@ Error GDCompiler::_parse_class(GDScript *p_script,GDScript *p_owner,const GDPars
|
|||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
p_script->valid=true;
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -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() {
|
||||
|
||||
}
|
|
@ -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
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue