|
@@ -30,7 +30,6 @@
|
|
|
|
|
|
#include "io/resource_loader.h"
|
|
|
|
|
|
-
|
|
|
bool ItemListPlugin::_set(const StringName& p_name, const Variant& p_value) {
|
|
|
|
|
|
String name = p_name;
|
|
@@ -45,12 +44,10 @@ bool ItemListPlugin::_set(const StringName& p_name, const Variant& p_value) {
|
|
|
set_item_checkable(idx,p_value);
|
|
|
else if (what=="checked")
|
|
|
set_item_checked(idx,p_value);
|
|
|
- else if (what=="enabled")
|
|
|
- set_item_enabled(idx,p_value);
|
|
|
- else if (what=="accel")
|
|
|
- set_item_accel(idx,p_value);
|
|
|
else if (what=="id")
|
|
|
set_item_id(idx,p_value);
|
|
|
+ else if (what=="enabled")
|
|
|
+ set_item_enabled(idx,p_value);
|
|
|
else if (what=="separator")
|
|
|
set_item_separator(idx,p_value);
|
|
|
else
|
|
@@ -60,6 +57,7 @@ bool ItemListPlugin::_set(const StringName& p_name, const Variant& p_value) {
|
|
|
}
|
|
|
|
|
|
bool ItemListPlugin::_get(const StringName& p_name,Variant &r_ret) const {
|
|
|
+
|
|
|
String name = p_name;
|
|
|
int idx = name.get_slice("/",0).to_int();
|
|
|
String what=name.get_slice("/",1);
|
|
@@ -72,12 +70,10 @@ bool ItemListPlugin::_get(const StringName& p_name,Variant &r_ret) const {
|
|
|
r_ret=is_item_checkable(idx);
|
|
|
else if (what=="checked")
|
|
|
r_ret=is_item_checked(idx);
|
|
|
- else if (what=="enabled")
|
|
|
- r_ret=is_item_enabled(idx);
|
|
|
- else if (what=="accel")
|
|
|
- r_ret=get_item_accel(idx);
|
|
|
else if (what=="id")
|
|
|
r_ret=get_item_id(idx);
|
|
|
+ else if (what=="enabled")
|
|
|
+ r_ret=is_item_enabled(idx);
|
|
|
else if (what=="separator")
|
|
|
r_ret=is_item_separator(idx);
|
|
|
else
|
|
@@ -93,66 +89,119 @@ void ItemListPlugin::_get_property_list( List<PropertyInfo> *p_list) const {
|
|
|
|
|
|
p_list->push_back( PropertyInfo(Variant::STRING,base+"text") );
|
|
|
p_list->push_back( PropertyInfo(Variant::OBJECT,base+"icon",PROPERTY_HINT_RESOURCE_TYPE,"Texture") );
|
|
|
- if (get_flags()&FLAG_CHECKABLE) {
|
|
|
|
|
|
+ int flags = get_flags();
|
|
|
+
|
|
|
+ if (flags&FLAG_CHECKABLE) {
|
|
|
p_list->push_back( PropertyInfo(Variant::BOOL,base+"checkable") );
|
|
|
p_list->push_back( PropertyInfo(Variant::BOOL,base+"checked") );
|
|
|
-
|
|
|
}
|
|
|
- if (get_flags()&FLAG_ENABLE) {
|
|
|
|
|
|
+ if (flags&FLAG_ID)
|
|
|
+ p_list->push_back( PropertyInfo(Variant::INT,base+"id",PROPERTY_HINT_RANGE,"-1,4096") );
|
|
|
+
|
|
|
+ if (flags&FLAG_ENABLE)
|
|
|
p_list->push_back( PropertyInfo(Variant::BOOL,base+"enabled") );
|
|
|
|
|
|
- }
|
|
|
- if (get_flags()&FLAG_ACCEL) {
|
|
|
+ if (flags&FLAG_SEPARATOR)
|
|
|
+ p_list->push_back( PropertyInfo(Variant::BOOL,base+"separator") );
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
- p_list->push_back( PropertyInfo(Variant::INT,base+"accel",PROPERTY_HINT_KEY_ACCEL) );
|
|
|
+///////////////////////////////////////////////////////////////
|
|
|
+///////////////////////// PLUGINS /////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////
|
|
|
|
|
|
- }
|
|
|
- if (get_flags()&FLAG_ID) {
|
|
|
+void ItemListOptionButtonPlugin::set_object(Object *p_object) {
|
|
|
|
|
|
- p_list->push_back( PropertyInfo(Variant::INT,base+"id",PROPERTY_HINT_RANGE,"-1,4096") );
|
|
|
+ ob = p_object->cast_to<OptionButton>();
|
|
|
+}
|
|
|
|
|
|
- }
|
|
|
- if (get_flags()&FLAG_SEPARATOR) {
|
|
|
+bool ItemListOptionButtonPlugin::handles(Object *p_object) const {
|
|
|
|
|
|
- p_list->push_back( PropertyInfo(Variant::BOOL,base+"separator") );
|
|
|
+ return p_object->is_type("OptionButton");
|
|
|
+}
|
|
|
|
|
|
- }
|
|
|
- }
|
|
|
+int ItemListOptionButtonPlugin::get_flags() const {
|
|
|
+
|
|
|
+ return FLAG_ICON|FLAG_ID|FLAG_ENABLE;
|
|
|
}
|
|
|
|
|
|
-void ItemListEditor::_node_removed(Node *p_node) {
|
|
|
+void ItemListOptionButtonPlugin::add_item() {
|
|
|
|
|
|
- if(p_node==item_list) {
|
|
|
- item_list=NULL;
|
|
|
- hide();
|
|
|
- dialog->hide();
|
|
|
- }
|
|
|
+ ob->add_item( "Item "+itos(ob->get_item_count()));
|
|
|
+ _change_notify();
|
|
|
+}
|
|
|
|
|
|
+int ItemListOptionButtonPlugin::get_item_count() const {
|
|
|
|
|
|
+ return ob->get_item_count();
|
|
|
}
|
|
|
|
|
|
-void ItemListEditor::_delete_pressed() {
|
|
|
+void ItemListOptionButtonPlugin::erase(int p_idx) {
|
|
|
|
|
|
- String p = prop_editor->get_selected_path();
|
|
|
+ ob->remove_item(p_idx);
|
|
|
+ _change_notify();
|
|
|
+}
|
|
|
|
|
|
- if (p.find("/")!=-1) {
|
|
|
+ItemListOptionButtonPlugin::ItemListOptionButtonPlugin() {
|
|
|
|
|
|
- if (selected_idx<0 || selected_idx>=item_plugins.size())
|
|
|
- return;
|
|
|
+ ob=NULL;
|
|
|
+}
|
|
|
|
|
|
- item_plugins[selected_idx]->erase(p.get_slice("/",0).to_int());;
|
|
|
- }
|
|
|
+///////////////////////////////////////////////////////////////
|
|
|
+
|
|
|
+void ItemListPopupMenuPlugin::set_object(Object *p_object) {
|
|
|
|
|
|
+ if (p_object->is_type("MenuButton"))
|
|
|
+ pp = p_object->cast_to<MenuButton>()->get_popup();
|
|
|
+ else
|
|
|
+ pp = p_object->cast_to<PopupMenu>();
|
|
|
}
|
|
|
|
|
|
-void ItemListEditor::_add_pressed() {
|
|
|
+bool ItemListPopupMenuPlugin::handles(Object *p_object) const {
|
|
|
|
|
|
- if (selected_idx<0 || selected_idx>=item_plugins.size())
|
|
|
- return;
|
|
|
+ return p_object->is_type("PopupMenu") || p_object->is_type("MenuButton");
|
|
|
+}
|
|
|
|
|
|
- item_plugins[selected_idx]->add_item();
|
|
|
+int ItemListPopupMenuPlugin::get_flags() const {
|
|
|
+
|
|
|
+ return FLAG_ICON|FLAG_CHECKABLE|FLAG_ID|FLAG_ENABLE|FLAG_SEPARATOR;
|
|
|
+}
|
|
|
+
|
|
|
+void ItemListPopupMenuPlugin::add_item() {
|
|
|
+
|
|
|
+ pp->add_item( "Item "+itos(pp->get_item_count()));
|
|
|
+ _change_notify();
|
|
|
+}
|
|
|
+
|
|
|
+int ItemListPopupMenuPlugin::get_item_count() const {
|
|
|
+
|
|
|
+ return pp->get_item_count();
|
|
|
+}
|
|
|
+
|
|
|
+void ItemListPopupMenuPlugin::erase(int p_idx) {
|
|
|
+
|
|
|
+ pp->remove_item(p_idx);
|
|
|
+ _change_notify();
|
|
|
+}
|
|
|
+
|
|
|
+ItemListPopupMenuPlugin::ItemListPopupMenuPlugin() {
|
|
|
+
|
|
|
+ pp=NULL;
|
|
|
+}
|
|
|
+
|
|
|
+///////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////
|
|
|
+///////////////////////////////////////////////////////////////
|
|
|
+
|
|
|
+void ItemListEditor::_node_removed(Node *p_node) {
|
|
|
+
|
|
|
+ if(p_node==item_list) {
|
|
|
+ item_list=NULL;
|
|
|
+ hide();
|
|
|
+ dialog->hide();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
void ItemListEditor::_notification(int p_notification) {
|
|
@@ -160,57 +209,73 @@ void ItemListEditor::_notification(int p_notification) {
|
|
|
if (p_notification==NOTIFICATION_ENTER_TREE) {
|
|
|
|
|
|
add_button->set_icon(get_icon("Add","EditorIcons"));
|
|
|
- del_button->set_icon(get_icon("Del","EditorIcons"));
|
|
|
+ del_button->set_icon(get_icon("Remove","EditorIcons"));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+void ItemListEditor::_add_pressed() {
|
|
|
|
|
|
-void ItemListEditor::_menu_option(int p_option) {
|
|
|
+ if (selected_idx==-1)
|
|
|
+ return;
|
|
|
|
|
|
+ item_plugins[selected_idx]->add_item();
|
|
|
+}
|
|
|
|
|
|
- switch(p_option) {
|
|
|
+void ItemListEditor::_delete_pressed() {
|
|
|
|
|
|
- case MENU_EDIT_ITEMS: {
|
|
|
+ TreeItem *ti = tree->get_selected();
|
|
|
|
|
|
- dialog->popup_centered_ratio();
|
|
|
- } break;
|
|
|
- }
|
|
|
+ if (!ti)
|
|
|
+ return;
|
|
|
+
|
|
|
+ if (ti->get_parent()!=tree->get_root())
|
|
|
+ return;
|
|
|
+
|
|
|
+ int idx = ti->get_text(0).to_int();
|
|
|
+
|
|
|
+ if (selected_idx==-1)
|
|
|
+ return;
|
|
|
+
|
|
|
+ item_plugins[selected_idx]->erase(idx);
|
|
|
}
|
|
|
|
|
|
+void ItemListEditor::_edit_items() {
|
|
|
+
|
|
|
+ dialog->popup_centered(Vector2(300, 400));
|
|
|
+}
|
|
|
|
|
|
void ItemListEditor::edit(Node *p_item_list) {
|
|
|
|
|
|
item_list=p_item_list;
|
|
|
|
|
|
+ if (!item_list) {
|
|
|
+ selected_idx=-1;
|
|
|
+ property_editor->edit(NULL);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
for(int i=0;i<item_plugins.size();i++) {
|
|
|
if (item_plugins[i]->handles(p_item_list)) {
|
|
|
|
|
|
item_plugins[i]->set_object(p_item_list);
|
|
|
- prop_editor->edit(item_plugins[i]);
|
|
|
+ property_editor->edit(item_plugins[i]);
|
|
|
+
|
|
|
+ if (has_icon(item_list->get_type(), "EditorIcons"))
|
|
|
+ toolbar_button->set_icon(get_icon(item_list->get_type(), "EditorIcons"));
|
|
|
+ else
|
|
|
+ toolbar_button->set_icon(Ref<Texture>());
|
|
|
+
|
|
|
selected_idx=i;
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
selected_idx=-1;
|
|
|
-
|
|
|
- prop_editor->edit(NULL);
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-void ItemListEditor::_bind_methods() {
|
|
|
-
|
|
|
- ObjectTypeDB::bind_method("_menu_option",&ItemListEditor::_menu_option);
|
|
|
- ObjectTypeDB::bind_method("_add_button",&ItemListEditor::_add_pressed);
|
|
|
- ObjectTypeDB::bind_method("_delete_button",&ItemListEditor::_delete_pressed);
|
|
|
-
|
|
|
- //ObjectTypeDB::bind_method("_populate",&ItemListEditor::_populate);
|
|
|
-
|
|
|
+ property_editor->edit(NULL);
|
|
|
}
|
|
|
|
|
|
bool ItemListEditor::handles(Object *p_object) const {
|
|
|
- return false;
|
|
|
+
|
|
|
for(int i=0;i<item_plugins.size();i++) {
|
|
|
if (item_plugins[i]->handles(p_object)) {
|
|
|
return true;
|
|
@@ -218,57 +283,65 @@ bool ItemListEditor::handles(Object *p_object) const {
|
|
|
}
|
|
|
|
|
|
return false;
|
|
|
+}
|
|
|
|
|
|
+void ItemListEditor::_bind_methods() {
|
|
|
+
|
|
|
+ ObjectTypeDB::bind_method("_edit_items",&ItemListEditor::_edit_items);
|
|
|
+ ObjectTypeDB::bind_method("_add_button",&ItemListEditor::_add_pressed);
|
|
|
+ ObjectTypeDB::bind_method("_delete_button",&ItemListEditor::_delete_pressed);
|
|
|
}
|
|
|
+
|
|
|
ItemListEditor::ItemListEditor() {
|
|
|
|
|
|
selected_idx=-1;
|
|
|
- options = memnew( MenuButton );
|
|
|
- add_child(options);
|
|
|
- options->set_area_as_parent_rect();
|
|
|
|
|
|
- options->set_text("Items");
|
|
|
- options->get_popup()->add_item("Edit Items",MENU_EDIT_ITEMS);
|
|
|
- //options->get_popup()->add_item("Clear",MENU_CLEAR);
|
|
|
+ add_child( memnew( VSeparator ) );
|
|
|
|
|
|
- options->get_popup()->connect("item_pressed", this,"_menu_option");
|
|
|
+ toolbar_button = memnew( ToolButton );
|
|
|
+ toolbar_button->set_text("Items");
|
|
|
+ add_child(toolbar_button);
|
|
|
+ toolbar_button->connect("pressed",this,"_edit_items");
|
|
|
|
|
|
dialog = memnew( AcceptDialog );
|
|
|
+ dialog->set_title("Item List Editor");
|
|
|
add_child( dialog );
|
|
|
|
|
|
-
|
|
|
+ VBoxContainer *vbc = memnew( VBoxContainer );
|
|
|
+ dialog->add_child(vbc);
|
|
|
+ dialog->set_child_rect(vbc);
|
|
|
|
|
|
HBoxContainer *hbc = memnew( HBoxContainer );
|
|
|
-
|
|
|
- dialog->add_child(hbc);
|
|
|
- dialog->set_child_rect(hbc);
|
|
|
-
|
|
|
- prop_editor = memnew( PropertyEditor );
|
|
|
-
|
|
|
- hbc->add_child(prop_editor);
|
|
|
- prop_editor->set_h_size_flags(SIZE_EXPAND_FILL);
|
|
|
-
|
|
|
- VBoxContainer *vbc = memnew( VBoxContainer );
|
|
|
- hbc->add_child(vbc);
|
|
|
+ hbc->set_h_size_flags(SIZE_EXPAND_FILL);
|
|
|
+ vbc->add_child(hbc);
|
|
|
|
|
|
add_button = memnew( Button );
|
|
|
- //add_button->set_text("Add");
|
|
|
+ add_button->set_text("Add");
|
|
|
+ hbc->add_child(add_button);
|
|
|
add_button->connect("pressed",this,"_add_button");
|
|
|
- vbc->add_child(add_button);
|
|
|
+
|
|
|
+ hbc->add_spacer();
|
|
|
|
|
|
del_button = memnew( Button );
|
|
|
- //del_button->set_text("Del");
|
|
|
+ del_button->set_text("Delete");
|
|
|
+ hbc->add_child(del_button);
|
|
|
del_button->connect("pressed",this,"_delete_button");
|
|
|
- vbc->add_child(del_button);
|
|
|
|
|
|
- dialog->set_title("Item List");
|
|
|
- prop_editor->hide_top_label();
|
|
|
+ property_editor = memnew( PropertyEditor );
|
|
|
+ property_editor->hide_top_label();
|
|
|
+ property_editor->set_subsection_selectable(true);
|
|
|
+ vbc->add_child(property_editor);
|
|
|
+ property_editor->set_v_size_flags(SIZE_EXPAND_FILL);
|
|
|
|
|
|
+ tree = property_editor->get_scene_tree();
|
|
|
+}
|
|
|
|
|
|
+ItemListEditor::~ItemListEditor() {
|
|
|
|
|
|
+ for(int i=0;i<item_plugins.size();i++)
|
|
|
+ memdelete( item_plugins[i] );
|
|
|
}
|
|
|
|
|
|
-
|
|
|
void ItemListEditorPlugin::edit(Object *p_object) {
|
|
|
|
|
|
item_list_editor->edit(p_object->cast_to<Node>());
|
|
@@ -288,127 +361,19 @@ void ItemListEditorPlugin::make_visible(bool p_visible) {
|
|
|
item_list_editor->hide();
|
|
|
item_list_editor->edit(NULL);
|
|
|
}
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-ItemListEditor::~ItemListEditor() {
|
|
|
-
|
|
|
- for(int i=0;i<item_plugins.size();i++)
|
|
|
- memdelete( item_plugins[i] );
|
|
|
}
|
|
|
|
|
|
-///////////////////////// PLUGINS /////////////////////////////
|
|
|
-///////////////////////// PLUGINS /////////////////////////////
|
|
|
-///////////////////////// PLUGINS /////////////////////////////
|
|
|
-///////////////////////// PLUGINS /////////////////////////////
|
|
|
-///////////////////////// PLUGINS /////////////////////////////
|
|
|
-
|
|
|
-
|
|
|
-class ItemListOptionButtonPlugin : public ItemListPlugin {
|
|
|
-
|
|
|
- OBJ_TYPE(ItemListOptionButtonPlugin,ItemListPlugin);
|
|
|
-
|
|
|
- OptionButton *ob;
|
|
|
-public:
|
|
|
-
|
|
|
- virtual void set_object(Object *p_object) { ob = p_object->cast_to<OptionButton>(); }
|
|
|
-
|
|
|
- virtual bool handles(Object *p_object) const { return p_object->cast_to<OptionButton>()!=NULL; }
|
|
|
-
|
|
|
- virtual int get_flags() const { return FLAG_ICON|FLAG_ID|FLAG_ENABLE; }
|
|
|
-
|
|
|
- virtual void set_item_text(int p_idx,const String& p_text){ ob->set_item_text(p_idx,p_text);}
|
|
|
- virtual void set_item_icon(int p_idx,const Ref<Texture>& p_tex){ ob->set_item_icon(p_idx,p_tex);}
|
|
|
- virtual void set_item_enabled(int p_idx,int p_enabled){ ob->set_item_disabled(p_idx,!p_enabled);}
|
|
|
- virtual void set_item_id(int p_idx,int p_id){ ob->set_item_ID(p_idx,p_id);}
|
|
|
-
|
|
|
-
|
|
|
- virtual String get_item_text(int p_idx) const{ return ob->get_item_text(p_idx); };
|
|
|
- virtual Ref<Texture> get_item_icon(int p_idx) const{ return ob->get_item_icon(p_idx); };
|
|
|
- virtual bool is_item_enabled(int p_idx) const{ return !ob->is_item_disabled(p_idx); };
|
|
|
- virtual int get_item_id(int p_idx) const{ return ob->get_item_ID(p_idx); };
|
|
|
-
|
|
|
- virtual void add_item() { ob->add_item( "New Item "+itos(ob->get_item_count())); _change_notify();}
|
|
|
- virtual int get_item_count() const { return ob->get_item_count(); }
|
|
|
- virtual void erase(int p_idx) { ob->remove_item(p_idx); _change_notify();}
|
|
|
-
|
|
|
-
|
|
|
- ItemListOptionButtonPlugin() { ob=NULL; }
|
|
|
-};
|
|
|
-
|
|
|
-class ItemListPopupMenuPlugin : public ItemListPlugin {
|
|
|
-
|
|
|
- OBJ_TYPE(ItemListPopupMenuPlugin,ItemListPlugin);
|
|
|
-
|
|
|
- PopupMenu *pp;
|
|
|
-public:
|
|
|
-
|
|
|
- virtual void set_object(Object *p_object) {
|
|
|
- if (p_object->cast_to<MenuButton>())
|
|
|
- pp = p_object->cast_to<MenuButton>()->get_popup();
|
|
|
- else
|
|
|
- pp = p_object->cast_to<PopupMenu>();
|
|
|
- }
|
|
|
-
|
|
|
- virtual bool handles(Object *p_object) const { return p_object->cast_to<PopupMenu>()!=NULL || p_object->cast_to<MenuButton>()!=NULL; }
|
|
|
-
|
|
|
- virtual int get_flags() const { return FLAG_ICON|FLAG_ID|FLAG_ENABLE|FLAG_CHECKABLE|FLAG_SEPARATOR|FLAG_ACCEL; }
|
|
|
-
|
|
|
- virtual void set_item_text(int p_idx,const String& p_text){ pp->set_item_text(p_idx,p_text); }
|
|
|
- virtual void set_item_icon(int p_idx,const Ref<Texture>& p_tex){ pp->set_item_icon(p_idx,p_tex);}
|
|
|
- virtual void set_item_checkable(int p_idx,bool p_check){ pp->set_item_as_checkable(p_idx,p_check);}
|
|
|
- virtual void set_item_checked(int p_idx,bool p_checked){ pp->set_item_checked(p_idx,p_checked);}
|
|
|
- virtual void set_item_accel(int p_idx,int p_accel){ pp->set_item_accelerator(p_idx,p_accel);}
|
|
|
- virtual void set_item_enabled(int p_idx,int p_enabled){ pp->set_item_disabled(p_idx,!p_enabled);}
|
|
|
- virtual void set_item_id(int p_idx,int p_id){ pp->set_item_ID(p_idx,p_idx);}
|
|
|
- virtual void set_item_separator(int p_idx,bool p_separator){ pp->set_item_as_separator(p_idx,p_separator);}
|
|
|
-
|
|
|
-
|
|
|
- virtual String get_item_text(int p_idx) const{ return pp->get_item_text(p_idx); };
|
|
|
- virtual Ref<Texture> get_item_icon(int p_idx) const{ return pp->get_item_icon(p_idx); };
|
|
|
- virtual bool is_item_checkable(int p_idx) const{ return pp->is_item_checkable(p_idx); };
|
|
|
- virtual bool is_item_checked(int p_idx) const{ return pp->is_item_checked(p_idx); };
|
|
|
- virtual int get_item_accel(int p_idx) const{ return pp->get_item_accelerator(p_idx); };
|
|
|
- virtual bool is_item_enabled(int p_idx) const{ return !pp->is_item_disabled(p_idx); };
|
|
|
- virtual int get_item_id(int p_idx) const{ return pp->get_item_ID(p_idx); };
|
|
|
- virtual bool is_item_separator(int p_idx) const{ return pp->is_item_separator(p_idx); };
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- virtual void add_item() { pp->add_item( "New Item "+itos(pp->get_item_count())); _change_notify();}
|
|
|
- virtual int get_item_count() const { return pp->get_item_count(); }
|
|
|
- virtual void erase(int p_idx) { pp->remove_item(p_idx); _change_notify();}
|
|
|
-
|
|
|
-
|
|
|
- ItemListPopupMenuPlugin() { pp=NULL; }
|
|
|
-};
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
ItemListEditorPlugin::ItemListEditorPlugin(EditorNode *p_node) {
|
|
|
|
|
|
editor=p_node;
|
|
|
item_list_editor = memnew( ItemListEditor );
|
|
|
- editor->get_viewport()->add_child(item_list_editor);
|
|
|
-
|
|
|
-// item_list_editor->set_anchor(MARGIN_LEFT,Control::ANCHOR_END);
|
|
|
-// item_list_editor->set_anchor(MARGIN_RIGHT,Control::ANCHOR_END);
|
|
|
- item_list_editor->set_margin(MARGIN_LEFT,180);
|
|
|
- item_list_editor->set_margin(MARGIN_RIGHT,230);
|
|
|
- item_list_editor->set_margin(MARGIN_TOP,0);
|
|
|
- item_list_editor->set_margin(MARGIN_BOTTOM,10);
|
|
|
-
|
|
|
+ CanvasItemEditor::get_singleton()->add_control_to_menu_panel(item_list_editor);
|
|
|
|
|
|
item_list_editor->hide();
|
|
|
- item_list_editor->add_plugin( memnew( ItemListOptionButtonPlugin) );
|
|
|
- item_list_editor->add_plugin( memnew( ItemListPopupMenuPlugin) );
|
|
|
+ item_list_editor->add_plugin( memnew( ItemListOptionButtonPlugin ) );
|
|
|
+ item_list_editor->add_plugin( memnew( ItemListPopupMenuPlugin ) );
|
|
|
}
|
|
|
|
|
|
-
|
|
|
ItemListEditorPlugin::~ItemListEditorPlugin()
|
|
|
{
|
|
|
}
|