diff --git a/tools/editor/editor_data.cpp b/tools/editor/editor_data.cpp index c872b1c3ca7..aa10d6c86ff 100644 --- a/tools/editor/editor_data.cpp +++ b/tools/editor/editor_data.cpp @@ -791,6 +791,8 @@ void EditorSelection::_node_removed(Node *p_node) { void EditorSelection::add_node(Node *p_node) { + ERR_FAIL_NULL(p_node); + if (selection.has(p_node)) return; @@ -814,6 +816,8 @@ void EditorSelection::add_node(Node *p_node) { void EditorSelection::remove_node(Node *p_node) { + ERR_FAIL_NULL(p_node); + if (!selection.has(p_node)) return; @@ -832,12 +836,25 @@ bool EditorSelection::is_selected(Node * p_node) const { } +Array EditorSelection::_get_selected_nodes() { + + Array ret; + + for (List::Element *E=selected_node_list.front();E;E=E->next()) { + + ret.push_back(E->get()); + } + + return ret; +} void EditorSelection::_bind_methods() { ObjectTypeDB::bind_method(_MD("_node_removed"),&EditorSelection::_node_removed); ObjectTypeDB::bind_method(_MD("clear"),&EditorSelection::clear); - ObjectTypeDB::bind_method(_MD("add_node"),&EditorSelection::add_node); + ObjectTypeDB::bind_method(_MD("add_node","node"),&EditorSelection::add_node); + ObjectTypeDB::bind_method(_MD("remove_node","node"),&EditorSelection::remove_node); + ObjectTypeDB::bind_method(_MD("get_selected_nodes"),&EditorSelection::_get_selected_nodes); ADD_SIGNAL( MethodInfo("selection_changed") ); } diff --git a/tools/editor/editor_data.h b/tools/editor/editor_data.h index fcc8ccef064..9e46d6ec32d 100644 --- a/tools/editor/editor_data.h +++ b/tools/editor/editor_data.h @@ -228,6 +228,7 @@ public: List selected_node_list; void _update_nl(); + Array _get_selected_nodes(); protected: static void _bind_methods(); diff --git a/tools/editor/editor_import_export.cpp b/tools/editor/editor_import_export.cpp index b845eba66b4..7dfae9cf40c 100644 --- a/tools/editor/editor_import_export.cpp +++ b/tools/editor/editor_import_export.cpp @@ -68,7 +68,7 @@ void EditorImportPlugin::_bind_methods() { ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo(Variant::STRING,"get_name")); ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo(Variant::STRING,"get_visible_name")); ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo("import_dialog",PropertyInfo(Variant::STRING,"from"))); - ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo(Variant::INT,"import",PropertyInfo(Variant::STRING,"path"),PropertyInfo(Variant::OBJECT,"from",PROPERTY_HINT_RESOURCE_TYPE,"ResourceImportMetaData"))); + ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo(Variant::INT,"import",PropertyInfo(Variant::STRING,"path"),PropertyInfo(Variant::OBJECT,"from",PROPERTY_HINT_RESOURCE_TYPE,"ResourceImportMetadata"))); ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo(Variant::RAW_ARRAY,"custom_export",PropertyInfo(Variant::STRING,"path"))); } @@ -114,7 +114,7 @@ Error EditorImportPlugin::import(const String& p_path, const Ref EditorImportPlugin::custom_export(const String& p_path, const Ref &p_platform) { if (get_script_instance() && get_script_instance()->has_method("custom_export")) { - get_script_instance()->call("custom_export",p_path); + get_script_instance()->call("custom_export",p_path,p_platform); } return Vector(); @@ -130,7 +130,10 @@ EditorImportPlugin::EditorImportPlugin() { void EditorExportPlugin::_bind_methods() { - BIND_VMETHOD( MethodInfo("custom_export:Dictionary",PropertyInfo(Variant::STRING,"name",PROPERTY_HINT_RESOURCE_TYPE,"EditorExportPlatformPC")) ); + MethodInfo mi = MethodInfo("custom_export",PropertyInfo(Variant::STRING,"name"),PropertyInfo(Variant::OBJECT,"platform",PROPERTY_HINT_RESOURCE_TYPE,"EditorExportPlatform")); + mi.return_val.type=Variant::RAW_ARRAY; + + BIND_VMETHOD( mi ); } @@ -1458,6 +1461,11 @@ void EditorImportExport::add_export_plugin(const Ref& p_plug export_plugins.push_back(p_plugin); } +void EditorImportExport::remove_export_plugin(const Ref& p_plugin) { + + export_plugins.erase(p_plugin); +} + int EditorImportExport::get_export_plugin_count() const{ return export_plugins.size(); @@ -2068,9 +2076,61 @@ bool EditorImportExport::sample_get_trim() const{ return sample_action_trim; } +DVector EditorImportExport::_get_export_file_list() { + + DVector fl; + for (Map::Element *E=files.front();E;E=E->next()) { + + fl.push_back(E->key()); + } + + return fl; +} + +DVector EditorImportExport::_get_export_platforms() { + + DVector ep; + for (Map >::Element *E=exporters.front();E;E=E->next()) { + + ep.push_back(E->key()); + } + + return ep; + +} void EditorImportExport::_bind_methods() { + ObjectTypeDB::bind_method(_MD("add_import_plugin","plugin:EditorImportPlugin"),&EditorImportExport::add_import_plugin); + ObjectTypeDB::bind_method(_MD("remove_import_plugin","plugin:EditorImportPlugin"),&EditorImportExport::remove_import_plugin); + ObjectTypeDB::bind_method(_MD("get_import_plugin_count"),&EditorImportExport::get_import_plugin_count); + ObjectTypeDB::bind_method(_MD("get_import_plugin:EditorImportPlugin","idx"),&EditorImportExport::get_import_plugin); + ObjectTypeDB::bind_method(_MD("get_import_plugin_by_name:EditorImportPlugin","name"),&EditorImportExport::get_import_plugin_by_name); + + ObjectTypeDB::bind_method(_MD("add_export_plugin","plugin:EditorExportPlugin"),&EditorImportExport::add_export_plugin); + ObjectTypeDB::bind_method(_MD("remove_export_plugin","plugin:EditorExportPlugin"),&EditorImportExport::remove_export_plugin); + ObjectTypeDB::bind_method(_MD("get_export_plugin_count"),&EditorImportExport::get_export_plugin_count); + ObjectTypeDB::bind_method(_MD("get_export_plugin:EditorExportPlugin","idx"),&EditorImportExport::get_export_plugin); + + ObjectTypeDB::bind_method(_MD("set_export_file_action","file","action"),&EditorImportExport::set_export_file_action); + ObjectTypeDB::bind_method(_MD("get_export_file_action","file"),&EditorImportExport::get_export_file_action); + ObjectTypeDB::bind_method(_MD("get_export_file_list"),&EditorImportExport::_get_export_file_list); + + ObjectTypeDB::bind_method(_MD("add_export_platform","platform:EditorExportplatform"),&EditorImportExport::add_export_platform); + //ObjectTypeDB::bind_method(_MD("remove_export_platform","platform:EditorExportplatform"),&EditorImportExport::add_export_platform); + ObjectTypeDB::bind_method(_MD("get_export_platform:EditorExportPlatform","name"),&EditorImportExport::get_export_platform); + ObjectTypeDB::bind_method(_MD("get_export_platforms"),&EditorImportExport::_get_export_platforms); + + ObjectTypeDB::bind_method(_MD("set_export_filter","filter"),&EditorImportExport::set_export_filter); + ObjectTypeDB::bind_method(_MD("get_export_filter"),&EditorImportExport::get_export_filter); + + ObjectTypeDB::bind_method(_MD("set_export_custom_filter","filter"),&EditorImportExport::set_export_custom_filter); + ObjectTypeDB::bind_method(_MD("get_export_custom_filter"),&EditorImportExport::get_export_custom_filter); + + ObjectTypeDB::bind_method(_MD("set_export_custom_filter_exclude","filter_exclude"),&EditorImportExport::set_export_custom_filter_exclude); + ObjectTypeDB::bind_method(_MD("get_export_custom_filter_exclude"),&EditorImportExport::get_export_custom_filter_exclude); + + ObjectTypeDB::bind_method(_MD("image_export_group_create"),&EditorImportExport::image_export_group_create); ObjectTypeDB::bind_method(_MD("image_export_group_remove"),&EditorImportExport::image_export_group_remove); ObjectTypeDB::bind_method(_MD("image_export_group_set_image_action"),&EditorImportExport::image_export_group_set_image_action); @@ -2085,7 +2145,27 @@ void EditorImportExport::_bind_methods() { ObjectTypeDB::bind_method(_MD("script_get_action"),&EditorImportExport::script_get_action); ObjectTypeDB::bind_method(_MD("script_get_encryption_key"),&EditorImportExport::script_get_encryption_key); -} + + + BIND_CONSTANT( ACTION_NONE ); + BIND_CONSTANT( ACTION_COPY ); + BIND_CONSTANT( ACTION_BUNDLE ); + + BIND_CONSTANT( EXPORT_SELECTED ); + BIND_CONSTANT( EXPORT_RESOURCES ); + BIND_CONSTANT( EXPORT_ALL ); + + BIND_CONSTANT( IMAGE_ACTION_NONE ); + BIND_CONSTANT( IMAGE_ACTION_COMPRESS_DISK ); + BIND_CONSTANT( IMAGE_ACTION_COMPRESS_RAM ); + BIND_CONSTANT( IMAGE_ACTION_KEEP ); + + BIND_CONSTANT( SCRIPT_ACTION_NONE ); + BIND_CONSTANT( SCRIPT_ACTION_COMPILE ); + BIND_CONSTANT( SCRIPT_ACTION_ENCRYPT ); +}; + + EditorImportExport::EditorImportExport() { diff --git a/tools/editor/editor_import_export.h b/tools/editor/editor_import_export.h index 60b7f919d86..e74a6d82771 100644 --- a/tools/editor/editor_import_export.h +++ b/tools/editor/editor_import_export.h @@ -303,6 +303,9 @@ protected: static EditorImportExport* singleton; + DVector _get_export_file_list(); + DVector _get_export_platforms(); + static void _bind_methods(); public: @@ -315,6 +318,7 @@ public: Ref get_import_plugin_by_name(const String& p_string) const; void add_export_plugin(const Ref& p_plugin); + void remove_export_plugin(const Ref& p_plugin); int get_export_plugin_count() const; Ref get_export_plugin(int p_idx) const; @@ -391,7 +395,10 @@ public: ~EditorImportExport(); }; +VARIANT_ENUM_CAST(EditorImportExport::FileAction); +VARIANT_ENUM_CAST(EditorImportExport::ExportFilter); VARIANT_ENUM_CAST(EditorImportExport::ImageAction); VARIANT_ENUM_CAST(EditorImportExport::ScriptAction); +VARIANT_ENUM_CAST(EditorImportExport::SampleAction); #endif // EDITOR_IMPORT_EXPORT_H diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index ea887fe18bb..9bf8ece8781 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -3950,9 +3950,13 @@ void EditorNode::register_editor_types() { ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); + ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); + ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); + ObjectTypeDB::register_type(); + ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); diff --git a/tools/editor/editor_plugin.cpp b/tools/editor/editor_plugin.cpp index b7ccb452e92..6b5533f6e5c 100644 --- a/tools/editor/editor_plugin.cpp +++ b/tools/editor/editor_plugin.cpp @@ -29,6 +29,8 @@ #include "editor_plugin.h" #include "plugins/canvas_item_editor_plugin.h" #include "plugins/spatial_editor_plugin.h" +#include "tools/editor/editor_node.h" +#include "tools/editor/editor_settings.h" void EditorPlugin::add_custom_type(const String& p_type, const String& p_base,const Ref