summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/editor/editor_data.cpp19
-rw-r--r--tools/editor/editor_data.h1
-rw-r--r--tools/editor/editor_import_export.cpp88
-rw-r--r--tools/editor/editor_import_export.h7
-rw-r--r--tools/editor/editor_node.cpp4
-rw-r--r--tools/editor/editor_plugin.cpp30
-rw-r--r--tools/editor/editor_plugin.h11
-rw-r--r--tools/editor/editor_settings.cpp10
-rw-r--r--tools/editor/editor_settings.h2
-rw-r--r--tools/editor/plugins/baked_light_editor_plugin.cpp2
-rw-r--r--tools/editor/plugins/color_ramp_editor_plugin.cpp4
-rw-r--r--tools/editor/plugins/shader_editor_plugin.cpp4
12 files changed, 167 insertions, 15 deletions
diff --git a/tools/editor/editor_data.cpp b/tools/editor/editor_data.cpp
index c872b1c3ca..aa10d6c86f 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<Node*>::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 fcc8ccef06..9e46d6ec32 100644
--- a/tools/editor/editor_data.h
+++ b/tools/editor/editor_data.h
@@ -228,6 +228,7 @@ public:
List<Node*> 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 b845eba66b..7dfae9cf40 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<ResourceImportM
Vector<uint8_t> EditorImportPlugin::custom_export(const String& p_path, const Ref<EditorExportPlatform> &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<uint8_t>();
@@ -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<EditorExportPlugin>& p_plug
export_plugins.push_back(p_plugin);
}
+void EditorImportExport::remove_export_plugin(const Ref<EditorExportPlugin>& 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<String> EditorImportExport::_get_export_file_list() {
+
+ DVector<String> fl;
+ for (Map<StringName,FileAction>::Element *E=files.front();E;E=E->next()) {
+
+ fl.push_back(E->key());
+ }
+
+ return fl;
+}
+
+DVector<String> EditorImportExport::_get_export_platforms() {
+
+ DVector<String> ep;
+ for (Map<StringName,Ref<EditorExportPlatform> >::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 60b7f919d8..e74a6d8277 100644
--- a/tools/editor/editor_import_export.h
+++ b/tools/editor/editor_import_export.h
@@ -303,6 +303,9 @@ protected:
static EditorImportExport* singleton;
+ DVector<String> _get_export_file_list();
+ DVector<String> _get_export_platforms();
+
static void _bind_methods();
public:
@@ -315,6 +318,7 @@ public:
Ref<EditorImportPlugin> get_import_plugin_by_name(const String& p_string) const;
void add_export_plugin(const Ref<EditorExportPlugin>& p_plugin);
+ void remove_export_plugin(const Ref<EditorExportPlugin>& p_plugin);
int get_export_plugin_count() const;
Ref<EditorExportPlugin> 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 ea887fe18b..9bf8ece878 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<EditorPlugin>();
ObjectTypeDB::register_type<EditorImportPlugin>();
+ ObjectTypeDB::register_type<EditorExportPlugin>();
ObjectTypeDB::register_type<EditorScenePostImport>();
ObjectTypeDB::register_type<EditorScript>();
+ ObjectTypeDB::register_type<EditorSelection>();
ObjectTypeDB::register_type<EditorFileDialog>();
+ ObjectTypeDB::register_type<EditorImportExport>();
+ ObjectTypeDB::register_type<EditorSettings>();
ObjectTypeDB::register_type<UndoRedo>();
diff --git a/tools/editor/editor_plugin.cpp b/tools/editor/editor_plugin.cpp
index b7ccb452e9..6b5533f6e5 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<Script>& p_script, const Ref<Texture>& p_icon) {
@@ -41,8 +43,13 @@ void EditorPlugin::remove_custom_type(const String& p_type){
}
+void EditorPlugin::add_control_to_bottom_dock(Control *p_control, const String &p_title) {
-void EditorPlugin::add_custom_control(CustomControlContainer p_location,Control *p_control) {
+ EditorNode::get_singleton()->add_bottom_panel_item(p_title,p_control);
+}
+
+
+void EditorPlugin::add_control_to_container(CustomControlContainer p_location,Control *p_control) {
switch(p_location) {
@@ -50,6 +57,7 @@ void EditorPlugin::add_custom_control(CustomControlContainer p_location,Control
EditorNode::get_menu_hb()->add_child(p_control);
} break;
+
case CONTAINER_SPATIAL_EDITOR_MENU: {
SpatialEditor::get_singleton()->add_control_to_menu_panel(p_control);
@@ -206,12 +214,28 @@ void EditorPlugin::get_window_layout(Ref<ConfigFile> p_layout){
}
+EditorSelection* EditorPlugin::get_selection() {
+ return EditorNode::get_singleton()->get_editor_selection();
+}
+
+EditorImportExport *EditorPlugin::get_import_export() {
+ return EditorImportExport::get_singleton();
+}
+
+EditorSettings *EditorPlugin::get_editor_settings() {
+ return EditorSettings::get_singleton();
+}
+
void EditorPlugin::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("get_undo_redo"),&EditorPlugin::_get_undo_redo);
- ObjectTypeDB::bind_method(_MD("add_custom_control","container","control"),&EditorPlugin::add_custom_control);
+ ObjectTypeDB::bind_method(_MD("add_control_to_container","container","control:Control"),&EditorPlugin::add_control_to_container);
+ ObjectTypeDB::bind_method(_MD("add_control_to_bottom_dock","control:Control","title"),&EditorPlugin::add_control_to_bottom_dock);
ObjectTypeDB::bind_method(_MD("add_custom_type","type","base","script:Script","icon:Texture"),&EditorPlugin::add_custom_type);
ObjectTypeDB::bind_method(_MD("remove_custom_type","type"),&EditorPlugin::remove_custom_type);
+ ObjectTypeDB::bind_method(_MD("get_undo_redo:UndoRedo"),&EditorPlugin::_get_undo_redo);
+ ObjectTypeDB::bind_method(_MD("get_selection:EditorSelection"),&EditorPlugin::get_selection);
+ ObjectTypeDB::bind_method(_MD("get_import_export:EditorImportExport"),&EditorPlugin::get_import_export);
+ ObjectTypeDB::bind_method(_MD("get_editor_settings:EditorSettings"),&EditorPlugin::get_import_export);
ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo(Variant::BOOL,"forward_input_event",PropertyInfo(Variant::INPUT_EVENT,"event")));
ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo(Variant::BOOL,"forward_spatial_input_event",PropertyInfo(Variant::OBJECT,"camera",PROPERTY_HINT_RESOURCE_TYPE,"Camera"),PropertyInfo(Variant::INPUT_EVENT,"event")));
diff --git a/tools/editor/editor_plugin.h b/tools/editor/editor_plugin.h
index bf1e185a37..df03d37be4 100644
--- a/tools/editor/editor_plugin.h
+++ b/tools/editor/editor_plugin.h
@@ -40,6 +40,9 @@
class EditorNode;
class Spatial;
class Camera;
+class EditorSelection;
+class EditorImportExport;
+class EditorSettings;
class EditorPlugin : public Node {
@@ -72,7 +75,8 @@ public:
//TODO: send a resoucre for editing to the editor node?
- void add_custom_control(CustomControlContainer p_location,Control *p_control);
+ void add_control_to_container(CustomControlContainer p_location, Control *p_control);
+ void add_control_to_bottom_dock(Control *p_control, const String &p_title);
virtual bool create_spatial_gizmo(Spatial* p_spatial);
virtual bool forward_input_event(const InputEvent& p_event);
@@ -94,6 +98,11 @@ public:
virtual void get_window_layout(Ref<ConfigFile> p_layout);
virtual void edited_scene_changed(){}; // if changes are pending in editor, apply them
+
+ EditorSelection* get_selection();
+ EditorImportExport *get_import_export();
+ EditorSettings *get_editor_settings();
+
virtual void restore_global_state();
virtual void save_global_state();
diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp
index 78fde9950d..83071a2e15 100644
--- a/tools/editor/editor_settings.cpp
+++ b/tools/editor/editor_settings.cpp
@@ -818,6 +818,16 @@ void EditorSettings::load_favorites() {
void EditorSettings::_bind_methods() {
+ ObjectTypeDB::bind_method(_MD("erase","property"),&EditorSettings::erase);
+ ObjectTypeDB::bind_method(_MD("get_settings_path"),&EditorSettings::get_settings_path);
+ ObjectTypeDB::bind_method(_MD("get_project_settings_path"),&EditorSettings::get_project_settings_path);
+
+ ObjectTypeDB::bind_method(_MD("set_favorite_dirs","dirs"),&EditorSettings::set_favorite_dirs);
+ ObjectTypeDB::bind_method(_MD("get_favorite_dirs"),&EditorSettings::get_favorite_dirs);
+
+ ObjectTypeDB::bind_method(_MD("set_recent_dirs","dirs"),&EditorSettings::set_recent_dirs);
+ ObjectTypeDB::bind_method(_MD("get_recent_dirs"),&EditorSettings::get_recent_dirs);
+
ADD_SIGNAL(MethodInfo("settings_changed"));
}
diff --git a/tools/editor/editor_settings.h b/tools/editor/editor_settings.h
index 40aa00015e..d189403dc1 100644
--- a/tools/editor/editor_settings.h
+++ b/tools/editor/editor_settings.h
@@ -108,7 +108,7 @@ public:
static EditorSettings *get_singleton();
void erase(String p_var);
String get_settings_path() const;
- String get_global_settings_path() const;
+ //String get_global_settings_path() const;
String get_project_settings_path() const;
const Map<String,Plugin>& get_plugins() const { return plugins; }
diff --git a/tools/editor/plugins/baked_light_editor_plugin.cpp b/tools/editor/plugins/baked_light_editor_plugin.cpp
index 26524b2437..22a188bce4 100644
--- a/tools/editor/plugins/baked_light_editor_plugin.cpp
+++ b/tools/editor/plugins/baked_light_editor_plugin.cpp
@@ -332,7 +332,7 @@ BakedLightEditorPlugin::BakedLightEditorPlugin(EditorNode *p_node) {
editor=p_node;
baked_light_editor = memnew( BakedLightEditor );
editor->get_viewport()->add_child(baked_light_editor);
- add_custom_control(CONTAINER_SPATIAL_EDITOR_MENU,baked_light_editor->bake_hbox);
+ add_control_to_container(CONTAINER_SPATIAL_EDITOR_MENU,baked_light_editor->bake_hbox);
baked_light_editor->hide();
baked_light_editor->bake_hbox->hide();
}
diff --git a/tools/editor/plugins/color_ramp_editor_plugin.cpp b/tools/editor/plugins/color_ramp_editor_plugin.cpp
index 42ff1b1de9..133775115d 100644
--- a/tools/editor/plugins/color_ramp_editor_plugin.cpp
+++ b/tools/editor/plugins/color_ramp_editor_plugin.cpp
@@ -13,9 +13,9 @@ ColorRampEditorPlugin::ColorRampEditorPlugin(EditorNode *p_node, bool p_2d) {
_2d=p_2d;
if (p_2d)
- add_custom_control(CONTAINER_CANVAS_EDITOR_BOTTOM,ramp_editor);
+ add_control_to_container(CONTAINER_CANVAS_EDITOR_BOTTOM,ramp_editor);
else
- add_custom_control(CONTAINER_SPATIAL_EDITOR_BOTTOM,ramp_editor);
+ add_control_to_container(CONTAINER_SPATIAL_EDITOR_BOTTOM,ramp_editor);
ramp_editor->set_custom_minimum_size(Size2(100, 48));
ramp_editor->hide();
diff --git a/tools/editor/plugins/shader_editor_plugin.cpp b/tools/editor/plugins/shader_editor_plugin.cpp
index 18d8f5efc0..7161033111 100644
--- a/tools/editor/plugins/shader_editor_plugin.cpp
+++ b/tools/editor/plugins/shader_editor_plugin.cpp
@@ -578,9 +578,9 @@ ShaderEditorPlugin::ShaderEditorPlugin(EditorNode *p_node, bool p_2d) {
shader_editor = memnew( ShaderEditor );
_2d=p_2d;
if (p_2d)
- add_custom_control(CONTAINER_CANVAS_EDITOR_BOTTOM,shader_editor);
+ add_control_to_container(CONTAINER_CANVAS_EDITOR_BOTTOM,shader_editor);
else
- add_custom_control(CONTAINER_SPATIAL_EDITOR_BOTTOM,shader_editor);
+ add_control_to_container(CONTAINER_SPATIAL_EDITOR_BOTTOM,shader_editor);
// editor->get_viewport()->add_child(shader_editor);
// shader_editor->set_area_as_parent_rect();