diff options
50 files changed, 2070 insertions, 706 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index 229640ba11..aff047177c 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -55,11 +55,17 @@ bool _ResourceLoader::has(const String &p_path) { return ResourceCache::has(local_path); }; +Ref<ResourceImportMetadata> _ResourceLoader::load_import_metadata(const String& p_path) { + + return ResourceLoader::load_import_metadata(p_path); +} + void _ResourceLoader::_bind_methods() { ObjectTypeDB::bind_method(_MD("load_interactive:ResourceInteractiveLoader","path","type_hint"),&_ResourceLoader::load_interactive,DEFVAL("")); ObjectTypeDB::bind_method(_MD("load:Resource","path","type_hint", "p_no_cache"),&_ResourceLoader::load,DEFVAL(""), DEFVAL(false)); + ObjectTypeDB::bind_method(_MD("load_import_metadata:ResourceImportMetadata","path"),&_ResourceLoader::load_import_metadata); ObjectTypeDB::bind_method(_MD("get_recognized_extensions_for_type","type"),&_ResourceLoader::get_recognized_extensions_for_type); ObjectTypeDB::bind_method(_MD("set_abort_on_missing_resources","abort"),&_ResourceLoader::set_abort_on_missing_resources); ObjectTypeDB::bind_method(_MD("get_dependencies","path"),&_ResourceLoader::get_dependencies); diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h index 4a9bb2a961..2c43390d3c 100644 --- a/core/bind/core_bind.h +++ b/core/bind/core_bind.h @@ -26,6 +26,7 @@ public: void set_abort_on_missing_resources(bool p_abort); StringArray get_dependencies(const String& p_path); bool has(const String& p_path); + Ref<ResourceImportMetadata> load_import_metadata(const String& p_path); _ResourceLoader(); }; diff --git a/core/error_macros.h b/core/error_macros.h index cafbf0c16e..47b1de5df3 100644 --- a/core/error_macros.h +++ b/core/error_macros.h @@ -223,5 +223,10 @@ extern bool _err_error_exists; } \ +#define WARN_PRINTS(m_string) \ + { \ + _err_print_error(FUNCTION_STR,__FILE__,__LINE__,String(m_string).utf8().get_data(),ERR_HANDLER_WARNING); \ + _err_error_exists=false;\ + } \ #endif diff --git a/core/global_constants.cpp b/core/global_constants.cpp index a183255b06..130fca1b2a 100644 --- a/core/global_constants.cpp +++ b/core/global_constants.cpp @@ -432,6 +432,7 @@ static _GlobalConstant _global_constants[]={ BIND_GLOBAL_CONSTANT( ERR_FILE_EOF ), BIND_GLOBAL_CONSTANT( ERR_CANT_OPEN ), ///< Can't open a resource/socket/file BIND_GLOBAL_CONSTANT( ERR_CANT_CREATE ), + BIND_GLOBAL_CONSTANT( ERR_PARSE_ERROR ), BIND_GLOBAL_CONSTANT( ERROR_QUERY_FAILED ), BIND_GLOBAL_CONSTANT( ERR_ALREADY_IN_USE ), BIND_GLOBAL_CONSTANT( ERR_LOCKED ), ///< resource is locked diff --git a/core/register_core_types.cpp b/core/register_core_types.cpp index d977ea3e18..54431cf381 100644 --- a/core/register_core_types.cpp +++ b/core/register_core_types.cpp @@ -51,6 +51,7 @@ #include "packed_data_container.h" #include "func_ref.h" #include "input_map.h" +#include "undo_redo.h" #ifdef XML_ENABLED static ResourceFormatSaverXML *resource_saver_xml=NULL; @@ -128,7 +129,7 @@ void register_core_types() { // ObjectTypeDB::register_type<OptimizedSaver>(); ObjectTypeDB::register_type<Translation>(); ObjectTypeDB::register_type<PHashTranslation>(); - + ObjectTypeDB::register_type<UndoRedo>(); ObjectTypeDB::register_type<HTTPClient>(); ObjectTypeDB::register_virtual_type<ResourceInteractiveLoader>(); diff --git a/demos/plugins/custom_dock/custom_dock.scn b/demos/plugins/custom_dock/custom_dock.scn Binary files differnew file mode 100644 index 0000000000..0e32ece264 --- /dev/null +++ b/demos/plugins/custom_dock/custom_dock.scn diff --git a/demos/plugins/custom_dock/dock_plugin.gd b/demos/plugins/custom_dock/dock_plugin.gd new file mode 100644 index 0000000000..ce8a3bcd09 --- /dev/null +++ b/demos/plugins/custom_dock/dock_plugin.gd @@ -0,0 +1,23 @@ +tool +extends EditorPlugin + +var dock = null + +func _enter_tree(): + # When this plugin node enters tree, add the custom type + + dock = preload("res://addons/custom_dock/custom_dock.scn").instance() + + add_control_to_dock( DOCK_SLOT_LEFT_UL, dock ) + +func _exit_tree(): + + # Remove from docks (must be called so layout is updated and saved) + remove_control_from_docks(dock) + # Remove the node + dock.free() + + + + +
\ No newline at end of file diff --git a/demos/plugins/custom_dock/plugin.cfg b/demos/plugins/custom_dock/plugin.cfg new file mode 100644 index 0000000000..e295384c25 --- /dev/null +++ b/demos/plugins/custom_dock/plugin.cfg @@ -0,0 +1,14 @@ +[plugin] + +name="Custom Dock" +description="Adds a new Customizable Dock" +author="Juan Linietsky" +version="1.0" +script="dock_plugin.gd" + + + + + + + diff --git a/demos/plugins/custom_import_plugin/import_plugin.gd b/demos/plugins/custom_import_plugin/import_plugin.gd new file mode 100644 index 0000000000..2cf8a0302f --- /dev/null +++ b/demos/plugins/custom_import_plugin/import_plugin.gd @@ -0,0 +1,81 @@ +tool + +extends EditorImportPlugin + + +# Simple plugin that imports a text file with extension .mtxt +# which contains 3 integers in format R,G,B (0-255) +# (see example .mtxt in this folder) +# Imported file is converted to a material + +var dialog = null + +func get_name(): + return "silly_material" + +func get_visible_name(): + return "Silly Material" + +func import_dialog(path): + var md = null + if (path!=""): + md = ResourceLoader.load_import_metadata(path) + dialog.configure(self,path,md) + dialog.popup_centered() + +func import(path,metadata): + + assert(metadata.get_source_count() == 1) + + var source = metadata.get_source_path(0) + var use_red_anyway = metadata.get_option("use_red_anyway") + + var f = File.new() + var err = f.open(source,File.READ) + if (err!=OK): + return ERR_CANT_OPEN + + var l = f.get_line() + + f.close() + + var channels = l.split(",") + if (channels.size()!=3): + return ERR_PARSE_ERROR + + var color = Color8(int(channels[0]),int(channels[1]),int(channels[2])) + + var material + + if (ResourceLoader.has(path)): + # Material is in use, update it + material = ResourceLoader.load(path) + else: + # Material not in use, create + material = FixedMaterial.new() + + if (use_red_anyway): + color=Color8(255,0,0) + + material.set_parameter(FixedMaterial.PARAM_DIFFUSE,color) + + # Make sure import metadata links to this plugin + + metadata.set_editor("silly_material") + + # Update the import metadata + + material.set_import_metadata(metadata) + + + # Save + err = ResourceSaver.save(path,material) + + return err + + +func config(base_control): + + dialog = preload("res://addons/custom_import_plugin/material_dialog.tscn").instance() + base_control.add_child(dialog) + diff --git a/demos/plugins/custom_import_plugin/material_dialog.gd b/demos/plugins/custom_import_plugin/material_dialog.gd new file mode 100644 index 0000000000..1022743254 --- /dev/null +++ b/demos/plugins/custom_import_plugin/material_dialog.gd @@ -0,0 +1,67 @@ +tool +extends ConfirmationDialog + +var src_fs +var dst_fs +var import_plugin + +func configure(p_import_plugin,path,metadata): + import_plugin=p_import_plugin + if (metadata): + # metadata from previous import exists, fill in fields + assert( metadata.get_source_count() > 0 ) + # Always expand the source paths + var src_path = import_plugin.expand_source_path( metadata.get_source_path(0) ) + get_node("src_file").set_text(src_path) + get_node("dst_file").set_text(path) + # Fill in from metadata options + get_node("use_red_anyway").set_pressed( metadata.get_option("use_red_anyway") ) + + +func _ready(): + + src_fs = FileDialog.new() + src_fs.set_mode(FileDialog.MODE_OPEN_FILE) + src_fs.set_access(FileDialog.ACCESS_FILESYSTEM) #access all filesystem, not only res:// + src_fs.add_filter("*.mtxt") + src_fs.connect("file_selected",self,"_on_src_selected") + + add_child(src_fs) + + dst_fs = EditorFileDialog.new() + dst_fs.set_mode(EditorFileDialog.MODE_SAVE_FILE) + dst_fs.add_filter("*.mtl") # Use binary extension always, text can't save metadata + dst_fs.connect("file_selected",self,"_on_dst_selected") + + add_child(dst_fs) + + set_hide_on_ok(true) + get_ok().set_text("Import!") + + +func _on_src_browse_pressed(): + src_fs.popup_centered_ratio() + +func _on_dst_browse_pressed(): + dst_fs.popup_centered_ratio() + +func _on_src_selected(path): + get_node("src_file").set_text(path) + +func _on_dst_selected(path): + get_node("dst_file").set_text(path) + +func _on_MaterialImport_confirmed(): + # Create an import metadata + var imd = ResourceImportMetadata.new() + # Add the source files, always validate the source path + imd.add_source( import_plugin.validate_source_path( get_node("src_file").get_text() )) + # Add the options + imd.set_option( "use_red_anyway", get_node("use_red_anyway").is_pressed() ) + # Perform regular import + var err = import_plugin.import( get_node("dst_file").get_text(), imd ) + # Warn if error + if (err!=OK): + get_node("error").set_text("Error Importing!") + get_node("error").popup_centered_minsize() + diff --git a/demos/plugins/custom_import_plugin/material_dialog.tscn b/demos/plugins/custom_import_plugin/material_dialog.tscn new file mode 100644 index 0000000000..9ad6f492fd --- /dev/null +++ b/demos/plugins/custom_import_plugin/material_dialog.tscn @@ -0,0 +1,111 @@ +[gd_scene load_steps=2 format=1] + +[ext_resource path="res://addons/custom_import_plugin/material_dialog.gd" type="Script" id=1] + +[node name="MaterialImport" type="ConfirmationDialog"] + +margin/right = 276.0 +margin/bottom = 154.0 +focus/ignore_mouse = false +focus/stop_mouse = true +size_flags/horizontal = 2 +size_flags/vertical = 2 +popup/exclusive = false +window/title = "Silly Material Import" +dialog/hide_on_ok = true +script/script = ExtResource( 1 ) +__meta__ = { "__editor_plugin_screen__":"Script" } + +[node name="src_file" type="LineEdit" parent="."] + +margin/left = 19.0 +margin/top = 6.0 +margin/right = 190.0 +margin/bottom = 29.0 +focus/ignore_mouse = false +focus/stop_mouse = true +size_flags/horizontal = 2 +size_flags/vertical = 2 +text = "" +max_length = 0 +editable = true +secret = false + +[node name="src_browse" type="Button" parent="."] + +margin/left = 195.0 +margin/top = 7.0 +margin/right = 249.0 +margin/bottom = 29.0 +focus/ignore_mouse = false +focus/stop_mouse = true +size_flags/horizontal = 2 +size_flags/vertical = 2 +toggle_mode = false +text = "browse" +flat = false + +[node name="dst_browse" type="Button" parent="."] + +margin/left = 195.0 +margin/top = 47.0 +margin/right = 249.0 +margin/bottom = 69.0 +focus/ignore_mouse = false +focus/stop_mouse = true +size_flags/horizontal = 2 +size_flags/vertical = 2 +toggle_mode = false +text = "browse" +flat = false + +[node name="dst_file" type="LineEdit" parent="."] + +margin/left = 19.0 +margin/top = 46.0 +margin/right = 190.0 +margin/bottom = 69.0 +focus/ignore_mouse = false +focus/stop_mouse = true +size_flags/horizontal = 2 +size_flags/vertical = 2 +text = "" +max_length = 0 +editable = true +secret = false + +[node name="use_red_anyway" type="CheckBox" parent="."] + +margin/left = 20.0 +margin/top = 84.0 +margin/right = 144.0 +margin/bottom = 106.0 +focus/ignore_mouse = false +focus/stop_mouse = true +size_flags/horizontal = 2 +size_flags/vertical = 2 +toggle_mode = true +text = "Use Red Anyway" +flat = false +align = 0 + +[node name="error" type="AcceptDialog" parent="."] + +visibility/visible = false +margin/right = 40.0 +margin/bottom = 40.0 +focus/ignore_mouse = false +focus/stop_mouse = true +size_flags/horizontal = 2 +size_flags/vertical = 2 +popup/exclusive = false +window/title = "Alert!" +dialog/hide_on_ok = true + +[connection signal="confirmed" from="." to="." method="_on_MaterialImport_confirmed"] + +[connection signal="pressed" from="src_browse" to="." method="_on_src_browse_pressed"] + +[connection signal="pressed" from="dst_browse" to="." method="_on_dst_browse_pressed"] + + diff --git a/demos/plugins/custom_import_plugin/material_import.gd b/demos/plugins/custom_import_plugin/material_import.gd new file mode 100644 index 0000000000..f9859251af --- /dev/null +++ b/demos/plugins/custom_import_plugin/material_import.gd @@ -0,0 +1,22 @@ +tool +extends EditorPlugin + +var import_plugin + +func _enter_tree(): + + import_plugin = preload("res://addons/custom_import_plugin/import_plugin.gd").new() + + # pass the GUI base control, so the dialog has a parent node + import_plugin.config( get_base_control() ) + + add_import_plugin( import_plugin) + +func _exit_tree(): + + remove_import_plugin( import_plugin ) + + + + +
\ No newline at end of file diff --git a/demos/plugins/custom_import_plugin/plugin.cfg b/demos/plugins/custom_import_plugin/plugin.cfg new file mode 100644 index 0000000000..a002ad680d --- /dev/null +++ b/demos/plugins/custom_import_plugin/plugin.cfg @@ -0,0 +1,14 @@ +[plugin] + +name="Silly Material Importer" +description="Imports a 3D Material from an external text file" +author="Juan Linietsky" +version="1.0" +script="material_import.gd" + + + + + + + diff --git a/demos/plugins/custom_import_plugin/test.mtxt b/demos/plugins/custom_import_plugin/test.mtxt new file mode 100644 index 0000000000..546ea2af20 --- /dev/null +++ b/demos/plugins/custom_import_plugin/test.mtxt @@ -0,0 +1 @@ +0,0,255 diff --git a/demos/plugins/custom_node/heart.gd b/demos/plugins/custom_node/heart.gd new file mode 100644 index 0000000000..d53c92d800 --- /dev/null +++ b/demos/plugins/custom_node/heart.gd @@ -0,0 +1,12 @@ +tool +extends Node2D + + +var heart = preload("res://addons/custom_node/heart.png") + +func _draw(): + draw_texture(heart,-heart.get_size()/2) + +func _get_item_rect(): + #override + return Rect2(-heart.get_size()/2,heart.get_size()) diff --git a/demos/plugins/custom_node/heart.png b/demos/plugins/custom_node/heart.png Binary files differnew file mode 100644 index 0000000000..1dfd14a456 --- /dev/null +++ b/demos/plugins/custom_node/heart.png diff --git a/demos/plugins/custom_node/heart_icon.png b/demos/plugins/custom_node/heart_icon.png Binary files differnew file mode 100644 index 0000000000..2eb819aa24 --- /dev/null +++ b/demos/plugins/custom_node/heart_icon.png diff --git a/demos/plugins/custom_node/heart_plugin.gd b/demos/plugins/custom_node/heart_plugin.gd new file mode 100644 index 0000000000..01a6177c9b --- /dev/null +++ b/demos/plugins/custom_node/heart_plugin.gd @@ -0,0 +1,18 @@ +tool +extends EditorPlugin + + +func _enter_tree(): + # When this plugin node enters tree, add the custom type + + add_custom_type("Heart","Node2D",preload("res://addons/custom_node/heart.gd"),preload("res://addons/custom_node/heart_icon.png")) + +func _exit_tree(): + # When the plugin node exits the tree, remove the custom type + + remove_custom_type("Heart") + + + + +
\ No newline at end of file diff --git a/demos/plugins/custom_node/plugin.cfg b/demos/plugins/custom_node/plugin.cfg new file mode 100644 index 0000000000..ebb4b56499 --- /dev/null +++ b/demos/plugins/custom_node/plugin.cfg @@ -0,0 +1,14 @@ +[plugin] + +name="Heart" +description="Adds a new Heart node in 2D" +author="Juan Linietsky" +version="1.0" +script="heart_plugin.gd" + + + + + + + diff --git a/demos/plugins/readme.txt b/demos/plugins/readme.txt new file mode 100644 index 0000000000..963850dcbb --- /dev/null +++ b/demos/plugins/readme.txt @@ -0,0 +1,13 @@ + +To install these, copy each of these folders to a folder: + +addons/ + +inside your projects, example: + +addons/custom_node + +To distribute and install from UI, make a zip that contains the folder, +example: + +zip -r custom_node.zip custom_node/*
\ No newline at end of file diff --git a/doc/base/classes.xml b/doc/base/classes.xml index bfe6bfc3ae..5915805b72 100644 --- a/doc/base/classes.xml +++ b/doc/base/classes.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<doc version="2.0.rc1.custom_build" name="Engine Types"> +<doc version="2.0.stable.custom_build" name="Engine Types"> <class name="@GDScript" category="Core"> <brief_description> Built-in GDScript functions. @@ -1476,6 +1476,8 @@ </constant> <constant name="ERR_CANT_CREATE" value="20"> </constant> + <constant name="ERR_PARSE_ERROR" value="43"> + </constant> <constant name="ERROR_QUERY_FAILED" value="21"> </constant> <constant name="ERR_ALREADY_IN_USE" value="22"> @@ -2227,7 +2229,7 @@ </argument> <argument index="1" name="time" type="float"> </argument> - <argument index="2" name="key" type="var"> + <argument index="2" name="key" type="Variant"> </argument> <argument index="3" name="transition" type="float" default="1"> </argument> @@ -2258,7 +2260,7 @@ </argument> <argument index="1" name="key" type="int"> </argument> - <argument index="2" name="value" type="var"> + <argument index="2" name="value" type="Variant"> </argument> <description> Set the value of an existing key. @@ -6118,7 +6120,7 @@ </description> </method> <method name="edit_set_state"> - <argument index="0" name="state" type="var"> + <argument index="0" name="state" type="Variant"> </argument> <description> Used for editing, returns an opaque value representing the transform state. @@ -6608,7 +6610,7 @@ <method name="set_shader_param"> <argument index="0" name="param" type="String"> </argument> - <argument index="1" name="value" type="var"> + <argument index="1" name="value" type="Variant"> </argument> <description> </description> @@ -8059,7 +8061,7 @@ </argument> <argument index="1" name="key" type="String"> </argument> - <argument index="2" name="value" type="var"> + <argument index="2" name="value" type="Variant"> </argument> <description> </description> @@ -8069,7 +8071,7 @@ </argument> <argument index="1" name="key" type="String"> </argument> - <argument index="2" name="default" type="var" default="NULL"> + <argument index="2" name="default" type="Variant" default="NULL"> </argument> <description> </description> @@ -8208,7 +8210,7 @@ </return> <argument index="0" name="pos" type="Vector2"> </argument> - <argument index="1" name="data" type="var"> + <argument index="1" name="data" type="Variant"> </argument> <description> </description> @@ -8216,7 +8218,7 @@ <method name="drop_data" qualifiers="virtual"> <argument index="0" name="pos" type="Vector2"> </argument> - <argument index="1" name="data" type="var"> + <argument index="1" name="data" type="Variant"> </argument> <description> </description> @@ -8707,7 +8709,7 @@ </description> </method> <method name="force_drag"> - <argument index="0" name="data" type="var"> + <argument index="0" name="data" type="Variant"> </argument> <argument index="1" name="preview" type="Object"> </argument> @@ -9765,6 +9767,47 @@ Returns an empty String "" at the end of the list. <constants> </constants> </class> +<class name="EditorExportPlugin" inherits="Reference" category="Core"> + <brief_description> + Editor plugin to control the export process. + </brief_description> + <description> + This plugin is added into EditorImportExport and allows to modify + the behavior of the export process for individual files. + </description> + <methods> + <method name="custom_export" qualifiers="virtual"> + <return type="Variant"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <argument index="1" name="platform" type="EditorExportPlatform"> + </argument> + <description> + This function is called for each file exported and + depending from the return value one of many things + might happen. + + 1) If returned value is null, the file is exported + as is. + + 2) If the returned value is a RawAray (array of + bytes), the content of that array becomes the new + file being exported. + + 3) If the file must also change it's name when + exported, then a [Dictionary] must be returned with + two fields: 'name' with the new filename and 'data' + with a [RawArray] containing the raw contents of the + file. Even if the name is changed, the run-time will + redirect the old file to the new file automatically + when accessed. + </description> + </method> + </methods> + <constants> + </constants> +</class> <class name="EditorFileDialog" inherits="ConfirmationDialog" category="Core"> <brief_description> </brief_description> @@ -9915,8 +9958,14 @@ Returns an empty String "" at the end of the list. </class> <class name="EditorImportPlugin" inherits="Reference" category="Core"> <brief_description> + Import plugin for editor </brief_description> <description> + Import plugins make it easy to handle importing of external assets + into a project. + + They way they work is not that obvious though, so please make sure + to read the documentation, tutorials and examples. </description> <methods> <method name="custom_export" qualifiers="virtual"> @@ -9924,19 +9973,35 @@ Returns an empty String "" at the end of the list. </return> <argument index="0" name="path" type="String"> </argument> + <argument index="1" name="platform" type="EditorExportPlatform"> + </argument> <description> + Generally, files that are imported stay the same + when exported. The only exception is in some cases + when the file must be re-imported for different + platforms (ie. texture compression). + + If you want to customize the export process, it's + recommended to use [EditorExportPlugin.custom_export] + instead. </description> </method> <method name="get_name" qualifiers="virtual"> <return type="String"> </return> <description> + Get the name of the import plugin, which will be + used to identify content imported by this plugin. + + Try to use lowecase and underscores if possible. </description> </method> <method name="get_visible_name" qualifiers="virtual"> <return type="String"> </return> <description> + Visible name for this plugin, which will be shown on + the import menu. </description> </method> <method name="import" qualifiers="virtual"> @@ -9944,15 +10009,70 @@ Returns an empty String "" at the end of the list. </return> <argument index="0" name="path" type="String"> </argument> - <argument index="1" name="from" type="ResourceImportMetaData"> - </argument> - <description> + <argument index="1" name="from" type="ResourceImportMetadata"> + </argument> + <description> + Perform an import of an external resources into the + project. This function is both called on import + (from the dialog) or re-import + (manual or automatic when external source files + changed). + + An import process generally works like this: + + 1) Check the metadata for source files and options. + Metadata is either generated in the import dialog or + taken from an existing resource upon reimport. + + 2) Perform the import process into a new resource. + Some times the resource being re-imported may be already loaded + and in use, so checking for this by using + [ResourceLoader.has] is recommended. Otherwise + create a new resource. + + 3) Set the metadata from the argument into the existing or new + resource being created using + [Resource.set_import_metadata]. + + 4) Save the resource into 'path' (function argument) </description> </method> <method name="import_dialog" qualifiers="virtual"> <argument index="0" name="from" type="String"> </argument> <description> + This function is called when either the user chooses + to import a resource of this type (Import menu), or + when the user chooses to re-import the resource + (from filesystem). In the later case, the path for + the existing file is supplied in the argument. + + If the path is supplied, it is recommended to read + the import metadata with + [ResourceLoader.load_import_metadata] and fill in + the fields with the values contained there. + + The dialog can be shown in any way (just use a + ConfirmationDialog and pop it up). Upon + confirmation, fill up a ResourceImportMetadata and + call the [EditorImportPlugin.import] function with + this information. + </description> + </method> + <method name="validate_source_path"> + <return type="String"> + </return> + <argument index="0" name="path" type="String"> + </argument> + <description> + </description> + </method> + <method name="expand_source_path"> + <return type="String"> + </return> + <argument index="0" name="path" type="String"> + </argument> + <description> </description> </method> </methods> @@ -9961,22 +10081,52 @@ Returns an empty String "" at the end of the list. </class> <class name="EditorPlugin" inherits="Node" category="Core"> <brief_description> + Used by the editor to extend it's functionality. </brief_description> <description> + Plugins are used by the editor to extend functionality. The most + common types of plugins are those which edit a given node or + resource type, import plugins and export plugins. </description> <methods> <method name="apply_changes" qualifiers="virtual"> <description> + This method is called when the editor is about to + save the project, switch to another tab, etc. It + asks the plugin to apply any pending state changes + to ensure consistency. + + This is used, for example, in shader editors to let + the plugin know that it must apply the shader code + being written by the user to the object. </description> </method> <method name="clear" qualifiers="virtual"> <description> + Clear all the state and reset the object being + edited to zero. This ensures your plugin does not + keep editing a currently existing node, or a node + fromt the wrong scene. + </description> + </method> + <method name="create_spatial_gizmo" qualifiers="virtual"> + <return type="EditorSpatialGizmo"> + </return> + <argument index="0" name="for_spatial" type="Spatial"> + </argument> + <description> + This is used for plugins that create gizmos used by + the spatial editor. Just check that the node passed + in the "for_spatial" argument matches your plugin. </description> </method> <method name="edit" qualifiers="virtual"> <argument index="0" name="object" type="Object"> </argument> <description> + This function is used for plugins that edit specific + object types (nodes or resources). It requests the + editor to edit the given object. </description> </method> <method name="forward_input_event" qualifiers="virtual"> @@ -9985,6 +10135,13 @@ Returns an empty String "" at the end of the list. <argument index="0" name="event" type="InputEvent"> </argument> <description> + This is a low level function for plugins that edit a given + object type derived from CanvasItem to capture the input in the 2D editor + viewport. The function is only being called if your + object is being edited. + + Return true if you want to capture the input, + otherwise false. </description> </method> <method name="forward_spatial_input_event" qualifiers="virtual"> @@ -9995,24 +10152,45 @@ Returns an empty String "" at the end of the list. <argument index="1" name="event" type="InputEvent"> </argument> <description> + This is a low level function for plugins that edit a + given objet type derived from Spatial to capture the + input of the viewport. The function is only being + called if your object is being edited. + + By using the [InputEvent] and the [Camera] arguments + it's pretty easy to do raycasts into space using + Camera functions. + + Return true if you want to capture the input, + otherwise false. </description> </method> <method name="get_breakpoints" qualifiers="virtual"> <return type="StringArray"> </return> <description> + This is for editors that edit script based objects. + You can return a list of breakpoints in the format + (script:line), for example: res://path_to_script.gd:25 </description> </method> <method name="get_name" qualifiers="virtual"> <return type="String"> </return> <description> + Get the name of the editor plugin. For main scren + plugins this is what will appear in the selector + (which by default is 2D, 3D, Script). </description> </method> <method name="get_state" qualifiers="virtual"> <return type="Dictionary"> </return> <description> + Get the state of your plugin editor. This is used + when saving the scene (so state is kept when opening + it again) and for switching tabs (so state can be + restored when the tab returns). </description> </method> <method name="handles" qualifiers="virtual"> @@ -10021,38 +10199,102 @@ Returns an empty String "" at the end of the list. <argument index="0" name="object" type="Object"> </argument> <description> + Implement this function if your plugin edits a + specific type of object (Resource or Node). If you + return true, then you will get the functions + [EditorPlugin.edit] and [EditorPlugin.make_visible] + called when the editor requests them. </description> </method> <method name="has_main_screen" qualifiers="virtual"> <return type="bool"> </return> <description> + Return true if this is a main screen editor plugin + (it goes in the main screen selector together with + 2D, 3D, Script). </description> </method> <method name="make_visible" qualifiers="virtual"> <argument index="0" name="visible" type="bool"> </argument> <description> + This function will be called when the editor is + requested to become visible. It is used for plugins + that edit a specific object type. + + Remember that you have to manage the visibility of + all your editor controls manually. </description> </method> <method name="set_state" qualifiers="virtual"> <argument index="0" name="state" type="Dictionary"> </argument> <description> + Restore the state saved by [EditorPlugin.get_state]. </description> </method> - <method name="get_undo_redo"> - <return type="Object"> - </return> + <method name="add_control_to_container"> + <argument index="0" name="container" type="int"> + </argument> + <argument index="1" name="control" type="Control"> + </argument> <description> + Add a custom control to a container (see + CONTAINER_* enum). There are many locations where + custom controls can be added in the editor UI. + + Please remember that you have to manage the + visibility of your custom controls yourself (and likely + hide it after adding it). + + If your plugin is being removed, also make sure to + remove your custom controls too. </description> </method> - <method name="add_custom_control"> - <argument index="0" name="container" type="int"> + <method name="add_control_to_bottom_dock"> + <argument index="0" name="control" type="Control"> + </argument> + <argument index="1" name="title" type="String"> + </argument> + <description> + Add a control to the bottom dock (together with + Output, Debug, Animation, etc). + + Please remember that you have to manage the + visibility of your custom controls yourself (and likely + hide it after adding it). + + If your plugin is being removed, also make sure to + remove your custom controls too. + </description> + </method> + <method name="add_control_to_dock"> + <argument index="0" name="slot" type="int"> </argument> - <argument index="1" name="control" type="Object"> + <argument index="1" name="control" type="Control"> </argument> <description> + Add the control to a specific dock slot (see DOCK_* + enum for options). + + If the dock is repositioned and as long as the + plugin is active, the editor will save the dock + position on further sessions. + + If your plugin is being removed, also make sure to + remove your control by calling [method + remove_control_from_docks]. + + </description> + </method> + <method name="remove_control_from_docks"> + <argument index="0" name="control" type="Control"> + </argument> + <description> + Remove the control from the dock. Don't forget to + call this if you added one, so the editor can save + the layout and remove it cleanly. </description> </method> <method name="add_custom_type"> @@ -10065,12 +10307,102 @@ Returns an empty String "" at the end of the list. <argument index="3" name="icon" type="Texture"> </argument> <description> + Add a custom type, which will appear in the list of + nodes or resources. An icon can be optionally + passed. + + When given node or resource is selected, the base + type will be instanced (ie, "Spatial", "Control", + "Resource"), then the script will be loaded and set + to this object. + + You can use the [EditorPlugin.handles] to check if + your custom object is being edited by checking the + script or using 'extends' keyword. + + During run-time, this will be a simple object with a + script so this function does not need to be called + then. </description> </method> <method name="remove_custom_type"> <argument index="0" name="type" type="String"> </argument> <description> + Remove a custom type added by + [EditorPlugin.add_custom_type] + </description> + </method> + <method name="add_import_plugin"> + <argument index="0" name="plugin" type="EditorImportPlugin"> + </argument> + <description> + Add an import plugin. These plugins manage importing + external content (from outside the project) into + formats the engine can understand. + + On exit, don't forget to remove the plugin by + calling [method remove_import_plugin] + </description> + </method> + <method name="remove_import_plugin"> + <argument index="0" name="plugin" type="EditorImportPlugin"> + </argument> + <description> + Remove the import plugin, don't forget to call this + on exit. + </description> + </method> + <method name="add_export_plugin"> + <argument index="0" name="plugin" type="EditorExportPlugin"> + </argument> + <description> + Add an export plugin. Plugins of this kind can + change files being exported. On exit don't forget to + call [method remove_export_plugin]. + </description> + </method> + <method name="remove_export_plugin"> + <argument index="0" name="plugin" type="EditorExportPlugin"> + </argument> + <description> + Remove the export plugin, don't forget to call this + on exit. + </description> + </method> + <method name="get_base_control"> + <return type="Control"> + </return> + <description> + Get a base control where it's safe to place dialogs. + Many plugins open dialogs and they need a control as + a base to make sure they use the editor icons and + theme. + </description> + </method> + <method name="get_undo_redo"> + <return type="UndoRedo"> + </return> + <description> + Get the undo/redo object. Most actions in the editor + can be undoable, so use this object to make sure + this happens when it's worth it. + </description> + </method> + <method name="get_selection"> + <return type="EditorSelection"> + </return> + <description> + Get the object that handles the selection of nodes + in the Scene Tree editor. + </description> + </method> + <method name="get_editor_settings"> + <return type="EditorSettings"> + </return> + <description> + Get the general settings for the editor (the same + window that appears in the Settings menu). </description> </method> </methods> @@ -10087,18 +10419,45 @@ Returns an empty String "" at the end of the list. </constant> <constant name="CONTAINER_CANVAS_EDITOR_SIDE" value="5"> </constant> + <constant name="DOCK_SLOT_LEFT_UL" value="0"> + </constant> + <constant name="DOCK_SLOT_LEFT_BL" value="1"> + </constant> + <constant name="DOCK_SLOT_LEFT_UR" value="2"> + </constant> + <constant name="DOCK_SLOT_LEFT_BR" value="3"> + </constant> + <constant name="DOCK_SLOT_RIGHT_UL" value="4"> + </constant> + <constant name="DOCK_SLOT_RIGHT_BL" value="5"> + </constant> + <constant name="DOCK_SLOT_RIGHT_UR" value="6"> + </constant> + <constant name="DOCK_SLOT_RIGHT_BR" value="7"> + </constant> + <constant name="DOCK_SLOT_MAX" value="8"> + </constant> </constants> </class> <class name="EditorScenePostImport" inherits="Reference" category="Core"> <brief_description> + Base script for post-processing scenes being imported. </brief_description> <description> + These scripts can modify scenes after being imported by the 3D Scene + import option of the Import menu. </description> <methods> <method name="post_import" qualifiers="virtual"> <argument index="0" name="scene" type="Object"> </argument> <description> + This function is called upon import with the + imported scene. + + Just do any changes desired to the scene and return + it. If null is returned, import will fail and throw + an error to the user. </description> </method> </methods> @@ -10107,8 +10466,10 @@ Returns an empty String "" at the end of the list. </class> <class name="EditorScript" inherits="Reference" category="Core"> <brief_description> + Simple script to perform changes in the currently edited scene. </brief_description> <description> + This script can be run from the Scene -> Run Script menu option. </description> <methods> <method name="_run" qualifiers="virtual"> @@ -10131,6 +10492,300 @@ Returns an empty String "" at the end of the list. <constants> </constants> </class> +<class name="EditorSelection" inherits="Object" category="Core"> + <brief_description> + Manages the SceneTree selection in the editor. + </brief_description> + <description> + This object manages the SceneTree selection in the editor. + </description> + <methods> + <method name="clear"> + <description> + Clear the selection. + </description> + </method> + <method name="add_node"> + <argument index="0" name="node" type="Node"> + </argument> + <description> + Add a node to the selection. + </description> + </method> + <method name="remove_node"> + <argument index="0" name="node" type="Node"> + </argument> + <description> + Remove a node from the selection. + </description> + </method> + <method name="get_selected_nodes"> + <return type="Array"> + </return> + <description> + Get the list of selectes nodes. + </description> + </method> + </methods> + <signals> + <signal name="selection_changed"> + <description> + Emitted when the selection changes. + </description> + </signal> + </signals> + <constants> + </constants> +</class> +<class name="EditorSettings" inherits="Resource" category="Core"> + <brief_description> + Object that holds the project-independent editor settings. + </brief_description> + <description> + Object that holds the project-independent editor settings. These + settings are generally visible in the Editor Settings menu. + + Accessing the settings is done by using the regular [Object] API, + such as. + + settings.set(prop,value) + + settings.get(prop) + + list_of_settings = settings.get_property_list() + </description> + <methods> + <method name="erase"> + <argument index="0" name="property" type="String"> + </argument> + <description> + Erase a given setting (pass full property path). + </description> + </method> + <method name="get_settings_path" qualifiers="const"> + <return type="String"> + </return> + <description> + Get the global settings path for the engine. Inside + this path you can find some standard paths such as: + + settings/tmp - used for temporary storage of files + + settings/templates - where export templates are + located + </description> + </method> + <method name="get_project_settings_path" qualifiers="const"> + <return type="String"> + </return> + <description> + Get the specific project settings path. Projects all + have an unique sub-directory inside the settings + path where project specific settings are saved. + </description> + </method> + <method name="set_favorite_dirs"> + <argument index="0" name="dirs" type="StringArray"> + </argument> + <description> + Set the list of favorite directories for this + project. + </description> + </method> + <method name="get_favorite_dirs" qualifiers="const"> + <return type="StringArray"> + </return> + <description> + Get the list of favorite directories for this + project. + </description> + </method> + <method name="set_recent_dirs"> + <argument index="0" name="dirs" type="StringArray"> + </argument> + <description> + Set the list of recently visited folders in the file + dialog for this project. + </description> + </method> + <method name="get_recent_dirs" qualifiers="const"> + <return type="StringArray"> + </return> + <description> + Get the list of recently visited folders in the file + dialog for this project. + </description> + </method> + </methods> + <signals> + <signal name="settings_changed"> + <description> + </description> + </signal> + </signals> + <constants> + </constants> +</class> +<class name="EditorSpatialGizmo" inherits="SpatialGizmo" category="Core"> + <brief_description> + Custom gizmo for editing Spatial objects. + </brief_description> + <description> + Custom gizmo that is used for providing custom visualization and + editing (handles) for 3D Spatial objects. These are created by + [method EditorPlugin.create_spatial_gizmo]. + </description> + <methods> + <method name="commit_handle" qualifiers="virtual"> + <argument index="0" name="index" type="int"> + </argument> + <argument index="1" name="restore" type="Variant"> + </argument> + <argument index="2" name="cancel" type="bool"> + </argument> + <description> + Commit a handle being edited (handles must have been + prevously added by [method add_handles]). + + If the cancel parameter is true, an option to + restore the edited value to the original is + provided. + </description> + </method> + <method name="get_handle_name" qualifiers="virtual"> + <return type="String"> + </return> + <argument index="0" name="index" type="int"> + </argument> + <description> + Get the name of an edited handle (handles must have + been previously added by [method add_handles]). + + Handles can be named for reference to the user when editing. + </description> + </method> + <method name="get_handle_value" qualifiers="virtual"> + <return type="Variant"> + </return> + <argument index="0" name="index" type="int"> + </argument> + <description> + Get actual value of a handle. This value can be + anything and used for eventually undoing the motion + when calling [method commit_handle] + </description> + </method> + <method name="redraw" qualifiers="virtual"> + <description> + This function is called when the Spatial this gizmo + refers to changes (the [method Spatial.update_gizmo] + is called). + </description> + </method> + <method name="set_handle" qualifiers="virtual"> + <argument index="0" name="index" type="int"> + </argument> + <argument index="1" name="camera" type="Camera"> + </argument> + <argument index="2" name="point" type="Vector2"> + </argument> + <description> + This function is used when the user drags a gizmo + handle (previously added with [method add_handles]) + in screen coordinates. + + The [Camera] is also provided + so screen coordinates can be converted to raycasts. + </description> + </method> + <method name="add_lines"> + <argument index="0" name="lines" type="Vector3Array"> + </argument> + <argument index="1" name="material" type="Material"> + </argument> + <argument index="2" name="billboard" type="bool" default="false"> + </argument> + <description> + Add lines to the gizmo (as sets of 2 points), with a + given material. The lines are used for visualizing + the gizmo. + + Call this function during [method redraw]. + </description> + </method> + <method name="add_mesh"> + <argument index="0" name="mesh" type="Mesh"> + </argument> + <argument index="1" name="billboard" type="bool" default="false"> + </argument> + <argument index="2" name="skeleton" type="RID" default="RID()"> + </argument> + <description> + Add a mesh to the gizmo, this is used for + visualization. + + Call this function during [method redraw]. + </description> + </method> + <method name="add_collision_segments"> + <argument index="0" name="segments" type="Vector3Array"> + </argument> + <description> + </description> + </method> + <method name="add_collision_triangles"> + <argument index="0" name="triangles" type="TriangleMesh"> + </argument> + <description> + Add collision triangles to the gizmo for picking. A + [TriangleMesh] can be generated from a regular + [Mesh] too. + + Call this function during [method redraw]. + </description> + </method> + <method name="add_unscaled_billboard"> + <argument index="0" name="material" type="Material"> + </argument> + <argument index="1" name="default_scale" type="float" default="1"> + </argument> + <description> + Add an unscaled billboard for visualization. + + Call this function during [method redraw]. + </description> + </method> + <method name="add_handles"> + <argument index="0" name="handles" type="Vector3Array"> + </argument> + <argument index="1" name="billboard" type="bool" default="false"> + </argument> + <argument index="2" name="secondary" type="bool" default="false"> + </argument> + <description> + Add a list of handles (points) which can be used to + deform the object being edited. + + There are virtual functions which will be called + upon editing of these handles. + + Call this function during [method redraw]. + </description> + </method> + <method name="set_spatial_node"> + <argument index="0" name="node" type="Spatial"> + </argument> + <description> + Call this function once and upon creation of the + gizmo, otherwise no other function will work. + + The argument is the node being edited by the gizmo. + </description> + </method> + </methods> + <constants> + </constants> +</class> <class name="Environment" inherits="Resource" category="Core"> <brief_description> </brief_description> @@ -10152,7 +10807,7 @@ Returns an empty String "" at the end of the list. <method name="set_background_param"> <argument index="0" name="param" type="int"> </argument> - <argument index="1" name="value" type="var"> + <argument index="1" name="value" type="Variant"> </argument> <description> </description> @@ -10182,7 +10837,7 @@ Returns an empty String "" at the end of the list. <method name="fx_set_param"> <argument index="0" name="param" type="int"> </argument> - <argument index="1" name="value" type="var"> + <argument index="1" name="value" type="Variant"> </argument> <description> </description> @@ -10782,7 +11437,7 @@ Returns an empty String "" at the end of the list. </description> </method> <method name="store_var"> - <argument index="0" name="value" type="var"> + <argument index="0" name="value" type="Variant"> </argument> <description> </description> @@ -10988,7 +11643,7 @@ Returns an empty String "" at the end of the list. <method name="set_parameter"> <argument index="0" name="param" type="int"> </argument> - <argument index="1" name="value" type="var"> + <argument index="1" name="value" type="Variant"> </argument> <description> Set a parameter, parameters are defined in the PARAM_* enum. The type of each parameter may change, so it's best to check the enum. @@ -11349,25 +12004,25 @@ Returns an empty String "" at the end of the list. </description> <methods> <method name="call_func"> - <argument index="0" name="arg0" type="var" default="NULL"> + <argument index="0" name="arg0" type="Variant" default="NULL"> </argument> - <argument index="1" name="arg1" type="var" default="NULL"> + <argument index="1" name="arg1" type="Variant" default="NULL"> </argument> - <argument index="2" name="arg2" type="var" default="NULL"> + <argument index="2" name="arg2" type="Variant" default="NULL"> </argument> - <argument index="3" name="arg3" type="var" default="NULL"> + <argument index="3" name="arg3" type="Variant" default="NULL"> </argument> - <argument index="4" name="arg4" type="var" default="NULL"> + <argument index="4" name="arg4" type="Variant" default="NULL"> </argument> - <argument index="5" name="arg5" type="var" default="NULL"> + <argument index="5" name="arg5" type="Variant" default="NULL"> </argument> - <argument index="6" name="arg6" type="var" default="NULL"> + <argument index="6" name="arg6" type="Variant" default="NULL"> </argument> - <argument index="7" name="arg7" type="var" default="NULL"> + <argument index="7" name="arg7" type="Variant" default="NULL"> </argument> - <argument index="8" name="arg8" type="var" default="NULL"> + <argument index="8" name="arg8" type="Variant" default="NULL"> </argument> - <argument index="9" name="arg9" type="var" default="NULL"> + <argument index="9" name="arg9" type="Variant" default="NULL"> </argument> <description> </description> @@ -11397,7 +12052,7 @@ Returns an empty String "" at the end of the list. <method name="resume"> <return type="Variant"> </return> - <argument index="0" name="arg" type="var" default="NULL"> + <argument index="0" name="arg" type="Variant" default="NULL"> </argument> <description> </description> @@ -15139,7 +15794,7 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) <method name="set_item_metadata"> <argument index="0" name="idx" type="int"> </argument> - <argument index="1" name="metadata" type="var"> + <argument index="1" name="metadata" type="Variant"> </argument> <description> </description> @@ -16744,7 +17399,7 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) <method name="variant_to_base64"> <return type="String"> </return> - <argument index="0" name="variant" type="var"> + <argument index="0" name="variant" type="Variant"> </argument> <description> </description> @@ -17722,7 +18377,7 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) <method name="set_vertex_meta"> <argument index="0" name="idx" type="int"> </argument> - <argument index="1" name="meta" type="var"> + <argument index="1" name="meta" type="Variant"> </argument> <description> </description> @@ -17770,7 +18425,7 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) <method name="set_edge_meta"> <argument index="0" name="idx" type="int"> </argument> - <argument index="1" name="meta" type="var"> + <argument index="1" name="meta" type="Variant"> </argument> <description> </description> @@ -17804,7 +18459,7 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) <method name="set_face_meta"> <argument index="0" name="idx" type="int"> </argument> - <argument index="1" name="meta" type="var"> + <argument index="1" name="meta" type="Variant"> </argument> <description> </description> @@ -20219,7 +20874,7 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) <method name="_set" qualifiers="virtual"> <argument index="0" name="property" type="String"> </argument> - <argument index="1" name="value" type="var"> + <argument index="1" name="value" type="Variant"> </argument> <description> Set a property. Return true if the property was found. @@ -20248,7 +20903,7 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) <method name="set"> <argument index="0" name="property" type="String"> </argument> - <argument index="1" name="value" type="var"> + <argument index="1" name="value" type="Variant"> </argument> <description> Set property into the object. @@ -20307,7 +20962,7 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) <method name="set_meta"> <argument index="0" name="name" type="String"> </argument> - <argument index="1" name="value" type="var"> + <argument index="1" name="value" type="Variant"> </argument> <description> Set a metadata into the object. Metadata is serialized. Metadata can be [i]anything[/i]. @@ -20356,15 +21011,15 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) <method name="emit_signal"> <argument index="0" name="signal" type="String"> </argument> - <argument index="1" name="arg0" type="var" default="NULL"> + <argument index="1" name="arg0" type="Variant" default="NULL"> </argument> - <argument index="2" name="arg1" type="var" default="NULL"> + <argument index="2" name="arg1" type="Variant" default="NULL"> </argument> - <argument index="3" name="arg2" type="var" default="NULL"> + <argument index="3" name="arg2" type="Variant" default="NULL"> </argument> - <argument index="4" name="arg3" type="var" default="NULL"> + <argument index="4" name="arg3" type="Variant" default="NULL"> </argument> - <argument index="5" name="arg4" type="var" default="NULL"> + <argument index="5" name="arg4" type="Variant" default="NULL"> </argument> <description> Emit a signal. Arguments are passed in an array. @@ -20373,25 +21028,25 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) <method name="call"> <argument index="0" name="method" type="String"> </argument> - <argument index="1" name="arg0" type="var" default="NULL"> + <argument index="1" name="arg0" type="Variant" default="NULL"> </argument> - <argument index="2" name="arg1" type="var" default="NULL"> + <argument index="2" name="arg1" type="Variant" default="NULL"> </argument> - <argument index="3" name="arg2" type="var" default="NULL"> + <argument index="3" name="arg2" type="Variant" default="NULL"> </argument> - <argument index="4" name="arg3" type="var" default="NULL"> + <argument index="4" name="arg3" type="Variant" default="NULL"> </argument> - <argument index="5" name="arg4" type="var" default="NULL"> + <argument index="5" name="arg4" type="Variant" default="NULL"> </argument> - <argument index="6" name="arg5" type="var" default="NULL"> + <argument index="6" name="arg5" type="Variant" default="NULL"> </argument> - <argument index="7" name="arg6" type="var" default="NULL"> + <argument index="7" name="arg6" type="Variant" default="NULL"> </argument> - <argument index="8" name="arg7" type="var" default="NULL"> + <argument index="8" name="arg7" type="Variant" default="NULL"> </argument> - <argument index="9" name="arg8" type="var" default="NULL"> + <argument index="9" name="arg8" type="Variant" default="NULL"> </argument> - <argument index="10" name="arg9" type="var" default="NULL"> + <argument index="10" name="arg9" type="Variant" default="NULL"> </argument> <description> Call a function in the object, result is returned. @@ -20400,15 +21055,15 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) <method name="call_deferred"> <argument index="0" name="method" type="String"> </argument> - <argument index="1" name="arg0" type="var" default="NULL"> + <argument index="1" name="arg0" type="Variant" default="NULL"> </argument> - <argument index="2" name="arg1" type="var" default="NULL"> + <argument index="2" name="arg1" type="Variant" default="NULL"> </argument> - <argument index="3" name="arg2" type="var" default="NULL"> + <argument index="3" name="arg2" type="Variant" default="NULL"> </argument> - <argument index="4" name="arg3" type="var" default="NULL"> + <argument index="4" name="arg3" type="Variant" default="NULL"> </argument> - <argument index="5" name="arg4" type="var" default="NULL"> + <argument index="5" name="arg4" type="Variant" default="NULL"> </argument> <description> Create and store a function in the object. The call will take place on idle time. @@ -20699,7 +21354,7 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) <method name="set_item_metadata"> <argument index="0" name="idx" type="int"> </argument> - <argument index="1" name="metadata" type="var"> + <argument index="1" name="metadata" type="Variant"> </argument> <description> </description> @@ -20898,7 +21553,7 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) <method name="pack"> <return type="Error"> </return> - <argument index="0" name="value" type="var"> + <argument index="0" name="value" type="Variant"> </argument> <description> </description> @@ -22795,7 +23450,7 @@ This method controls whether the position between two cached points is interpola <method name="shape_set_data"> <argument index="0" name="shape" type="RID"> </argument> - <argument index="1" name="data" type="var"> + <argument index="1" name="data" type="Variant"> </argument> <description> </description> @@ -22995,7 +23650,7 @@ This method controls whether the position between two cached points is interpola </argument> <argument index="1" name="param" type="int"> </argument> - <argument index="2" name="value" type="var"> + <argument index="2" name="value" type="Variant"> </argument> <description> </description> @@ -23127,7 +23782,7 @@ This method controls whether the position between two cached points is interpola </argument> <argument index="1" name="shape_idx" type="int"> </argument> - <argument index="2" name="metadata" type="var"> + <argument index="2" name="metadata" type="Variant"> </argument> <description> </description> @@ -23291,7 +23946,7 @@ This method controls whether the position between two cached points is interpola </argument> <argument index="1" name="state" type="int"> </argument> - <argument index="2" name="value" type="var"> + <argument index="2" name="value" type="Variant"> </argument> <description> </description> @@ -23409,7 +24064,7 @@ This method controls whether the position between two cached points is interpola </argument> <argument index="2" name="method" type="String"> </argument> - <argument index="3" name="userdata" type="var" default="NULL"> + <argument index="3" name="userdata" type="Variant" default="NULL"> </argument> <description> </description> @@ -24328,7 +24983,7 @@ This method controls whether the position between two cached points is interpola <method name="shape_set_data"> <argument index="0" name="shape" type="RID"> </argument> - <argument index="1" name="data" type="var"> + <argument index="1" name="data" type="Variant"> </argument> <description> </description> @@ -24512,7 +25167,7 @@ This method controls whether the position between two cached points is interpola </argument> <argument index="1" name="param" type="int"> </argument> - <argument index="2" name="value" type="var"> + <argument index="2" name="value" type="Variant"> </argument> <description> </description> @@ -24754,7 +25409,7 @@ This method controls whether the position between two cached points is interpola </argument> <argument index="1" name="state" type="int"> </argument> - <argument index="2" name="value" type="var"> + <argument index="2" name="value" type="Variant"> </argument> <description> </description> @@ -24856,7 +25511,7 @@ This method controls whether the position between two cached points is interpola </argument> <argument index="2" name="method" type="String"> </argument> - <argument index="3" name="userdata" type="var" default="NULL"> + <argument index="3" name="userdata" type="Variant" default="NULL"> </argument> <description> </description> @@ -26149,7 +26804,7 @@ This method controls whether the position between two cached points is interpola <method name="set_item_metadata"> <argument index="0" name="idx" type="int"> </argument> - <argument index="1" name="metadata" type="var"> + <argument index="1" name="metadata" type="Variant"> </argument> <description> </description> @@ -26536,7 +27191,7 @@ This method controls whether the position between two cached points is interpola <method name="broadcast"> <argument index="0" name="name" type="String"> </argument> - <argument index="1" name="parameters" type="var"> + <argument index="1" name="parameters" type="Variant"> </argument> <description> </description> @@ -27766,7 +28421,7 @@ This method controls whether the position between two cached points is interpola <method name="set_option"> <argument index="0" name="key" type="String"> </argument> - <argument index="1" name="value" type="var"> + <argument index="1" name="value" type="Variant"> </argument> <description> </description> @@ -27864,6 +28519,14 @@ This method controls whether the position between two cached points is interpola <description> </description> </method> + <method name="load_import_metadata"> + <return type="ResourceImportMetadata"> + </return> + <argument index="0" name="path" type="String"> + </argument> + <description> + </description> + </method> <method name="get_recognized_extensions_for_type"> <return type="StringArray"> </return> @@ -28063,7 +28726,7 @@ This method controls whether the position between two cached points is interpola </description> </method> <method name="push_meta"> - <argument index="0" name="data" type="var"> + <argument index="0" name="data" type="Variant"> </argument> <description> </description> @@ -29909,6 +30572,22 @@ This method controls whether the position between two cached points is interpola <description> </description> </method> + <method name="is_node_instance_placeholder" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="idx" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_node_instance_placeholder" qualifiers="const"> + <return type="String"> + </return> + <argument index="0" name="idx" type="int"> + </argument> + <description> + </description> + </method> <method name="get_node_instance" qualifiers="const"> <return type="PackedScene"> </return> @@ -30032,7 +30711,7 @@ This method controls whether the position between two cached points is interpola </argument> <argument index="2" name="property" type="String"> </argument> - <argument index="3" name="value" type="var"> + <argument index="3" name="value" type="Variant"> </argument> <description> </description> @@ -30168,15 +30847,15 @@ This method controls whether the position between two cached points is interpola </argument> <argument index="2" name="method" type="String"> </argument> - <argument index="3" name="arg0" type="var" default="NULL"> + <argument index="3" name="arg0" type="Variant" default="NULL"> </argument> - <argument index="4" name="arg1" type="var" default="NULL"> + <argument index="4" name="arg1" type="Variant" default="NULL"> </argument> - <argument index="5" name="arg2" type="var" default="NULL"> + <argument index="5" name="arg2" type="Variant" default="NULL"> </argument> - <argument index="6" name="arg3" type="var" default="NULL"> + <argument index="6" name="arg3" type="Variant" default="NULL"> </argument> - <argument index="7" name="arg4" type="var" default="NULL"> + <argument index="7" name="arg4" type="Variant" default="NULL"> </argument> <description> </description> @@ -30628,7 +31307,7 @@ This method controls whether the position between two cached points is interpola </argument> <argument index="2" name="param_id" type="int"> </argument> - <argument index="3" name="value" type="var"> + <argument index="3" name="value" type="Variant"> </argument> <description> </description> @@ -31180,7 +31859,7 @@ This method controls whether the position between two cached points is interpola </argument> <argument index="1" name="id" type="int"> </argument> - <argument index="2" name="state" type="var"> + <argument index="2" name="state" type="Variant"> </argument> <description> </description> @@ -32212,6 +32891,16 @@ This method controls whether the position between two cached points is interpola </constant> </constants> </class> +<class name="SpatialGizmo" inherits="Reference" category="Core"> + <brief_description> + </brief_description> + <description> + </description> + <methods> + </methods> + <constants> + </constants> +</class> <class name="SpatialPlayer" inherits="Spatial" category="Core"> <brief_description> </brief_description> @@ -36082,7 +36771,7 @@ This method controls whether the position between two cached points is interpola </argument> <argument index="1" name="method" type="String"> </argument> - <argument index="2" name="userdata" type="var" default="NULL"> + <argument index="2" name="userdata" type="Variant" default="NULL"> </argument> <argument index="3" name="priority" type="int" default="1"> </argument> @@ -37704,7 +38393,7 @@ This method controls whether the position between two cached points is interpola <method name="set_metadata"> <argument index="0" name="column" type="int"> </argument> - <argument index="1" name="meta" type="var"> + <argument index="1" name="meta" type="Variant"> </argument> <description> </description> @@ -38106,9 +38795,9 @@ This method controls whether the position between two cached points is interpola </argument> <argument index="1" name="property" type="String"> </argument> - <argument index="2" name="initial_val" type="var"> + <argument index="2" name="initial_val" type="Variant"> </argument> - <argument index="3" name="final_val" type="var"> + <argument index="3" name="final_val" type="Variant"> </argument> <argument index="4" name="times_in_sec" type="float"> </argument> @@ -38128,9 +38817,9 @@ This method controls whether the position between two cached points is interpola </argument> <argument index="1" name="method" type="String"> </argument> - <argument index="2" name="initial_val" type="var"> + <argument index="2" name="initial_val" type="Variant"> </argument> - <argument index="3" name="final_val" type="var"> + <argument index="3" name="final_val" type="Variant"> </argument> <argument index="4" name="times_in_sec" type="float"> </argument> @@ -38152,15 +38841,15 @@ This method controls whether the position between two cached points is interpola </argument> <argument index="2" name="callback" type="String"> </argument> - <argument index="3" name="arg1" type="var" default="NULL"> + <argument index="3" name="arg1" type="Variant" default="NULL"> </argument> - <argument index="4" name="arg2" type="var" default="NULL"> + <argument index="4" name="arg2" type="Variant" default="NULL"> </argument> - <argument index="5" name="arg3" type="var" default="NULL"> + <argument index="5" name="arg3" type="Variant" default="NULL"> </argument> - <argument index="6" name="arg4" type="var" default="NULL"> + <argument index="6" name="arg4" type="Variant" default="NULL"> </argument> - <argument index="7" name="arg5" type="var" default="NULL"> + <argument index="7" name="arg5" type="Variant" default="NULL"> </argument> <description> </description> @@ -38174,15 +38863,15 @@ This method controls whether the position between two cached points is interpola </argument> <argument index="2" name="callback" type="String"> </argument> - <argument index="3" name="arg1" type="var" default="NULL"> + <argument index="3" name="arg1" type="Variant" default="NULL"> </argument> - <argument index="4" name="arg2" type="var" default="NULL"> + <argument index="4" name="arg2" type="Variant" default="NULL"> </argument> - <argument index="5" name="arg3" type="var" default="NULL"> + <argument index="5" name="arg3" type="Variant" default="NULL"> </argument> - <argument index="6" name="arg4" type="var" default="NULL"> + <argument index="6" name="arg4" type="Variant" default="NULL"> </argument> - <argument index="7" name="arg5" type="var" default="NULL"> + <argument index="7" name="arg5" type="Variant" default="NULL"> </argument> <description> </description> @@ -38194,7 +38883,7 @@ This method controls whether the position between two cached points is interpola </argument> <argument index="1" name="property" type="String"> </argument> - <argument index="2" name="initial_val" type="var"> + <argument index="2" name="initial_val" type="Variant"> </argument> <argument index="3" name="target" type="Object"> </argument> @@ -38218,7 +38907,7 @@ This method controls whether the position between two cached points is interpola </argument> <argument index="1" name="method" type="String"> </argument> - <argument index="2" name="initial_val" type="var"> + <argument index="2" name="initial_val" type="Variant"> </argument> <argument index="3" name="target" type="Object"> </argument> @@ -38246,7 +38935,7 @@ This method controls whether the position between two cached points is interpola </argument> <argument index="3" name="initial_val" type="String"> </argument> - <argument index="4" name="final_val" type="var"> + <argument index="4" name="final_val" type="Variant"> </argument> <argument index="5" name="times_in_sec" type="float"> </argument> @@ -38270,7 +38959,7 @@ This method controls whether the position between two cached points is interpola </argument> <argument index="3" name="initial_method" type="String"> </argument> - <argument index="4" name="final_val" type="var"> + <argument index="4" name="final_val" type="Variant"> </argument> <argument index="5" name="times_in_sec" type="float"> </argument> @@ -38353,8 +39042,14 @@ This method controls whether the position between two cached points is interpola </class> <class name="UndoRedo" inherits="Object" category="Core"> <brief_description> + Helper to manage UndoRedo in the editor or custom tools. </brief_description> <description> + Helper to maange UndoRedo in the editor or custom tools. It works by + storing calls to functions in both 'do' an 'undo' lists. + + Common behavior is to create an action, then add do/undo calls to + functions or property changes, then commiting the action. </description> <methods> <method name="create_action"> @@ -38363,10 +39058,16 @@ This method controls whether the position between two cached points is interpola <argument index="1" name="mergeable" type="bool" default="false"> </argument> <description> + Create a new action. After this is called, do all + your calls to [method add_do_method], + [method add_undo_method], [method add_do_property] + and [method add_undo_property]. </description> </method> <method name="commit_action"> <description> + Commit the action. All 'do' methods/properties are + called/set when this function is called. </description> </method> <method name="add_do_method"> @@ -38374,17 +39075,19 @@ This method controls whether the position between two cached points is interpola </argument> <argument index="1" name="method" type="String"> </argument> - <argument index="2" name="arg0" type="var" default="NULL"> + <argument index="2" name="arg0" type="Variant" default="NULL"> </argument> - <argument index="3" name="arg1" type="var" default="NULL"> + <argument index="3" name="arg1" type="Variant" default="NULL"> </argument> - <argument index="4" name="arg2" type="var" default="NULL"> + <argument index="4" name="arg2" type="Variant" default="NULL"> </argument> - <argument index="5" name="arg3" type="var" default="NULL"> + <argument index="5" name="arg3" type="Variant" default="NULL"> </argument> - <argument index="6" name="arg4" type="var" default="NULL"> + <argument index="6" name="arg4" type="Variant" default="NULL"> </argument> <description> + Add a call to a method in a given object with custom + arguments. </description> </method> <method name="add_undo_method"> @@ -38392,17 +39095,20 @@ This method controls whether the position between two cached points is interpola </argument> <argument index="1" name="method" type="String"> </argument> - <argument index="2" name="arg0" type="var" default="NULL"> + <argument index="2" name="arg0" type="Variant" default="NULL"> </argument> - <argument index="3" name="arg1" type="var" default="NULL"> + <argument index="3" name="arg1" type="Variant" default="NULL"> </argument> - <argument index="4" name="arg2" type="var" default="NULL"> + <argument index="4" name="arg2" type="Variant" default="NULL"> </argument> - <argument index="5" name="arg3" type="var" default="NULL"> + <argument index="5" name="arg3" type="Variant" default="NULL"> </argument> - <argument index="6" name="arg4" type="var" default="NULL"> + <argument index="6" name="arg4" type="Variant" default="NULL"> </argument> <description> + Add a call to an undo method in a given object with + custom arguments. Undo calls are used to revert 'do' + calls. </description> </method> <method name="add_do_property"> @@ -38413,6 +39119,7 @@ This method controls whether the position between two cached points is interpola <argument index="2" name="value" type="Variant"> </argument> <description> + Set a property with a custom value. </description> </method> <method name="add_undo_property"> @@ -38423,34 +39130,51 @@ This method controls whether the position between two cached points is interpola <argument index="2" name="value" type="Variant"> </argument> <description> + Undo setting of a property with a custom value. </description> </method> <method name="add_do_reference"> <argument index="0" name="object" type="Object"> </argument> <description> + Add a 'do' reference that will be erased if the 'do' + history is lost. This is useful mostly for new nodes + created for the 'do' call. Do not use for resources. </description> </method> <method name="add_undo_reference"> <argument index="0" name="object" type="Object"> </argument> <description> + Add an 'undo' reference that will be erased if the + 'undo' history is lost. This is useful mostly for + nodes rmoved with the 'do' call (not the 'undo' + call!). </description> </method> <method name="clear_history"> <description> + Clear the undo/redo history and associated + references. </description> </method> <method name="get_current_action_name" qualifiers="const"> <return type="String"> </return> <description> + Get the name of the current action. </description> </method> <method name="get_version" qualifiers="const"> <return type="int"> </return> <description> + Get the version, each time a new action is commited, + the version number of the UndoRedo is increased + automatically. + + This is useful mostly to check if something changed + from a saved version. </description> </method> </methods> @@ -40175,7 +40899,7 @@ This method controls whether the position between two cached points is interpola </argument> <argument index="1" name="arg1" type="String"> </argument> - <argument index="2" name="arg2" type="var"> + <argument index="2" name="arg2" type="Variant"> </argument> <description> </description> diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp index 1b2ed670ad..c1ee148ef3 100644 --- a/modules/gdscript/gd_script.cpp +++ b/modules/gdscript/gd_script.cpp @@ -1481,6 +1481,11 @@ Variant GDScript::_new(const Variant** p_args,int p_argcount,Variant::CallError& /* STEP 1, CREATE */ + if (!valid) { + r_error.error=Variant::CallError::CALL_ERROR_INVALID_METHOD; + return Variant(); + } + r_error.error=Variant::CallError::CALL_OK; REF ref; Object *owner=NULL; diff --git a/tools/doc/doc_data.cpp b/tools/doc/doc_data.cpp index 3836fa710b..2d0d7617c2 100644 --- a/tools/doc/doc_data.cpp +++ b/tools/doc/doc_data.cpp @@ -190,7 +190,11 @@ void DocData::generate(bool p_basic_types) { #ifdef DEBUG_METHODS_ENABLED if (m && m->get_return_type()!=StringName()) method.return_type=m->get_return_type(); - else if (arginfo.type!=Variant::NIL) // { + else if (method.name.find(":")!=-1) { + method.return_type=method.name.get_slice(":",1); + method.name=method.name.get_slice(":",0); + + } else if (arginfo.type!=Variant::NIL) // { #endif method.return_type=(arginfo.hint==PROPERTY_HINT_RESOURCE_TYPE)?arginfo.hint_string:Variant::get_type_name(arginfo.type); // } @@ -210,7 +214,7 @@ void DocData::generate(bool p_basic_types) { } else if (arginfo.hint==PROPERTY_HINT_RESOURCE_TYPE) { type_name=arginfo.hint_string; } else if (arginfo.type==Variant::NIL) - type_name="var"; + type_name="Variant"; else type_name=Variant::get_type_name(arginfo.type); diff --git a/tools/editor/create_dialog.cpp b/tools/editor/create_dialog.cpp index 0f39d72308..23b8cad9ce 100644 --- a/tools/editor/create_dialog.cpp +++ b/tools/editor/create_dialog.cpp @@ -171,6 +171,7 @@ void CreateDialog::_update_search() { if (EditorNode::get_editor_data().get_custom_types().has(type)) { //there are custom types based on this... cool. + //print_line("there are custom types"); const Vector<EditorData::CustomType> &ct = EditorNode::get_editor_data().get_custom_types()[type]; @@ -259,7 +260,33 @@ Object *CreateDialog::instance_selected() { TreeItem *selected = search_options->get_selected(); if (selected) { - return ObjectTypeDB::instance(selected->get_text(0)); + String custom = selected->get_metadata(0); + if (custom!=String()) { + if (EditorNode::get_editor_data().get_custom_types().has(custom)) { + + for(int i=0;i<EditorNode::get_editor_data().get_custom_types()[custom].size();i++) { + if (EditorNode::get_editor_data().get_custom_types()[custom][i].name==selected->get_text(0)) { + Ref<Texture> icon = EditorNode::get_editor_data().get_custom_types()[custom][i].icon; + Ref<Script> script = EditorNode::get_editor_data().get_custom_types()[custom][i].script; + String name = selected->get_text(0); + + Object *ob = ObjectTypeDB::instance(custom); + ERR_FAIL_COND_V(!ob,NULL); + if (ob->is_type("Node")) { + ob->call("set_name",name); + } + ob->set_script(script.get_ref_ptr()); + if (icon.is_valid()) + ob->set_meta("_editor_icon",icon); + return ob; + + } + } + + } + } else { + return ObjectTypeDB::instance(selected->get_text(0)); + } } return NULL; diff --git a/tools/editor/editor_data.cpp b/tools/editor/editor_data.cpp index aa10d6c86f..6c1fc2ef05 100644 --- a/tools/editor/editor_data.cpp +++ b/tools/editor/editor_data.cpp @@ -422,6 +422,14 @@ void EditorData::add_editor_plugin(EditorPlugin *p_plugin) { editor_plugins.push_back(p_plugin); } +int EditorData::get_editor_plugin_count() const { + return editor_plugins.size(); +} +EditorPlugin *EditorData::get_editor_plugin(int p_idx) { + + ERR_FAIL_INDEX_V(p_idx,editor_plugins.size(),NULL); + return editor_plugins[p_idx]; +} void EditorData::add_custom_type(const String& p_type, const String& p_inherits,const Ref<Script>& p_script,const Ref<Texture>& p_icon ) { @@ -852,8 +860,8 @@ 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","node"),&EditorSelection::add_node); - ObjectTypeDB::bind_method(_MD("remove_node","node"),&EditorSelection::remove_node); + ObjectTypeDB::bind_method(_MD("add_node","node:Node"),&EditorSelection::add_node); + ObjectTypeDB::bind_method(_MD("remove_node","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 9e46d6ec32..5814ae8f5c 100644 --- a/tools/editor/editor_data.h +++ b/tools/editor/editor_data.h @@ -165,6 +165,9 @@ public: void add_editor_plugin(EditorPlugin *p_plugin); void remove_editor_plugin(EditorPlugin *p_plugin); + int get_editor_plugin_count() const; + EditorPlugin *get_editor_plugin(int p_idx); + UndoRedo &get_undo_redo(); void save_editor_global_states(); diff --git a/tools/editor/editor_help.cpp b/tools/editor/editor_help.cpp index ddcb634151..110e06f25b 100644 --- a/tools/editor/editor_help.cpp +++ b/tools/editor/editor_help.cpp @@ -1123,35 +1123,87 @@ void EditorHelp::_add_text(const String& p_bbcode) { class_desc->push_indent(1);*/ int pos = 0; + String bbcode=p_bbcode.replace("\t"," ").replace("\r"," ").strip_edges(); + + //find double newlines, keep them + for(int i=0;i<bbcode.length();i++) { + + //find valid newlines (double) + if (bbcode[i]=='\n') { + bool dnl=false; + int j=i+1; + for(;j<p_bbcode.length();j++) { + if (bbcode[j]==' ') + continue; + if (bbcode[j]=='\n') { + dnl=true; + break; + } + break; + } + + if (dnl) { + bbcode[i]=0xFFFF; + i=j; + } else { + bbcode[i]=' '; + i=j-1; + } + } + } + + //remove double spaces or spaces after newlines + for(int i=0;i<bbcode.length();i++) { + + if (bbcode[i]==' ' || bbcode[i]==0xFFFF) { + + for(int j=i+1;j<p_bbcode.length();j++) { + if (bbcode[j]==' ') { + bbcode.remove(j); + j--; + continue; + } else { + break; + } + } + } + } + + //change newlines to double newlines + + CharType dnls[2]={0xFFFF,0}; + bbcode=bbcode.replace(dnls,"\n"); + + List<String> tag_stack; - while(pos < p_bbcode.length()) { + while(pos < bbcode.length()) { - int brk_pos = p_bbcode.find("[",pos); + int brk_pos = bbcode.find("[",pos); if (brk_pos<0) - brk_pos=p_bbcode.length(); + brk_pos=bbcode.length(); if (brk_pos > pos) { - class_desc->add_text(p_bbcode.substr(pos,brk_pos-pos)); + class_desc->add_text(bbcode.substr(pos,brk_pos-pos)); } - if (brk_pos==p_bbcode.length()) + if (brk_pos==bbcode.length()) break; //nothing else o add - int brk_end = p_bbcode.find("]",brk_pos+1); + int brk_end = bbcode.find("]",brk_pos+1); if (brk_end==-1) { //no close, add the rest - class_desc->add_text(p_bbcode.substr(brk_pos,p_bbcode.length()-brk_pos)); + class_desc->add_text(bbcode.substr(brk_pos,bbcode.length()-brk_pos)); break; } - String tag = p_bbcode.substr(brk_pos+1,brk_end-brk_pos-1); + String tag = bbcode.substr(brk_pos+1,brk_end-brk_pos-1); if (tag.begins_with("/")) { @@ -1234,10 +1286,10 @@ void EditorHelp::_add_text(const String& p_bbcode) { } else if (tag=="url") { //use strikethrough (not supported underline instead) - int end=p_bbcode.find("[",brk_end); + int end=bbcode.find("[",brk_end); if (end==-1) - end=p_bbcode.length(); - String url = p_bbcode.substr(brk_end+1,end-brk_end-1); + end=bbcode.length(); + String url = bbcode.substr(brk_end+1,end-brk_end-1); class_desc->push_meta(url); pos=brk_end+1; @@ -1251,10 +1303,10 @@ void EditorHelp::_add_text(const String& p_bbcode) { } else if (tag=="img") { //use strikethrough (not supported underline instead) - int end=p_bbcode.find("[",brk_end); + int end=bbcode.find("[",brk_end); if (end==-1) - end=p_bbcode.length(); - String image = p_bbcode.substr(brk_end+1,end-brk_end-1); + end=bbcode.length(); + String image = bbcode.substr(brk_end+1,end-brk_end-1); Ref<Texture> texture = ResourceLoader::load(base_path+"/"+image,"Texture"); if (texture.is_valid()) diff --git a/tools/editor/editor_import_export.cpp b/tools/editor/editor_import_export.cpp index 7dfae9cf40..39182bfd69 100644 --- a/tools/editor/editor_import_export.cpp +++ b/tools/editor/editor_import_export.cpp @@ -63,13 +63,30 @@ String EditorImportPlugin::expand_source_path(const String& p_path) { } } + +String EditorImportPlugin::_validate_source_path(const String& p_path) { + + return validate_source_path(p_path); +} + +String EditorImportPlugin::_expand_source_path(const String& p_path) { + + return expand_source_path(p_path); +} + void EditorImportPlugin::_bind_methods() { + + ObjectTypeDB::bind_method(_MD("validate_source_path","path"),&EditorImportPlugin::_validate_source_path); + ObjectTypeDB::bind_method(_MD("expand_source_path","path"),&EditorImportPlugin::_expand_source_path); + 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::RAW_ARRAY,"custom_export",PropertyInfo(Variant::STRING,"path"))); + ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo(Variant::RAW_ARRAY,"custom_export",PropertyInfo(Variant::STRING,"path"),PropertyInfo(Variant::OBJECT,"platform",PROPERTY_HINT_RESOURCE_TYPE,"EditorExportPlatform"))); + +// BIND_VMETHOD( mi ); } String EditorImportPlugin::get_name() const { @@ -113,8 +130,8 @@ 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,p_platform); + if (get_script_instance() && get_script_instance()->has_method("_custom_export")) { + get_script_instance()->call("_custom_export",p_path,p_platform); } return Vector<uint8_t>(); @@ -130,7 +147,7 @@ EditorImportPlugin::EditorImportPlugin() { void EditorExportPlugin::_bind_methods() { - MethodInfo mi = MethodInfo("custom_export",PropertyInfo(Variant::STRING,"name"),PropertyInfo(Variant::OBJECT,"platform",PROPERTY_HINT_RESOURCE_TYPE,"EditorExportPlatform")); + MethodInfo mi = MethodInfo("custom_export:Variant",PropertyInfo(Variant::STRING,"name"),PropertyInfo(Variant::OBJECT,"platform",PROPERTY_HINT_RESOURCE_TYPE,"EditorExportPlatform")); mi.return_val.type=Variant::RAW_ARRAY; BIND_VMETHOD( mi ); @@ -144,6 +161,9 @@ Vector<uint8_t> EditorExportPlugin::custom_export(String& p_path,const Ref<Edito Variant d = get_script_instance()->call("custom_export",p_path,p_platform); if (d.get_type()==Variant::NIL) return Vector<uint8_t>(); + if (d.get_type()==Variant::RAW_ARRAY) + return d; + ERR_FAIL_COND_V(d.get_type()!=Variant::DICTIONARY,Vector<uint8_t>()); Dictionary dict=d; ERR_FAIL_COND_V(!dict.has("name"),Vector<uint8_t>()); @@ -1458,11 +1478,14 @@ Ref<EditorImportPlugin> EditorImportExport::get_import_plugin_by_name(const Stri void EditorImportExport::add_export_plugin(const Ref<EditorExportPlugin>& p_plugin) { + ERR_FAIL_COND( p_plugin.is_null() ); + export_plugins.push_back(p_plugin); } void EditorImportExport::remove_export_plugin(const Ref<EditorExportPlugin>& p_plugin) { + ERR_FAIL_COND( p_plugin.is_null() ); export_plugins.erase(p_plugin); } diff --git a/tools/editor/editor_import_export.h b/tools/editor/editor_import_export.h index e74a6d8277..fc8ad58bd9 100644 --- a/tools/editor/editor_import_export.h +++ b/tools/editor/editor_import_export.h @@ -46,6 +46,10 @@ protected: static void _bind_methods(); + String _validate_source_path(const String& p_path); + String _expand_source_path(const String& p_path); + + public: diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index 9bf8ece878..4666a49655 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -2952,16 +2952,109 @@ void EditorNode::remove_editor_plugin(EditorPlugin *p_editor) { void EditorNode::add_editor_import_plugin(const Ref<EditorImportPlugin>& p_editor_import) { + ERR_FAIL_COND( p_editor_import.is_null() ); editor_import_export->add_import_plugin(p_editor_import); _rebuild_import_menu(); } void EditorNode::remove_editor_import_plugin(const Ref<EditorImportPlugin>& p_editor_import) { + ERR_FAIL_COND( p_editor_import.is_null() ); editor_import_export->remove_import_plugin(p_editor_import); _rebuild_import_menu(); } + +void EditorNode::_update_addon_config() { + + if (_initializing_addons) + return; + + Vector<String> enabled_addons; + + for(Map<String,EditorPlugin*>::Element *E=plugin_addons.front();E;E=E->next()) { + enabled_addons.push_back(E->key()); + } + + if (enabled_addons.size()==0) { + Globals::get_singleton()->set("editor_plugins/enabled",Variant()); + Globals::get_singleton()->set_persisting("editor_plugins/enabled",false); + } else { + Globals::get_singleton()->set("editor_plugins/enabled",enabled_addons); + Globals::get_singleton()->set_persisting("editor_plugins/enabled",true); + } + + project_settings->queue_save(); + +} + +void EditorNode::set_addon_plugin_enabled(const String& p_addon,bool p_enabled) { + + ERR_FAIL_COND(p_enabled && plugin_addons.has(p_addon)); + ERR_FAIL_COND(!p_enabled && !plugin_addons.has(p_addon)); + + if (!p_enabled) { + + EditorPlugin *addon = plugin_addons[p_addon]; + memdelete(addon); //bye + plugin_addons.erase(p_addon); + _update_addon_config(); + return; + } + + + Ref<ConfigFile> cf; + cf.instance(); + String addon_path = "res://addons/"+p_addon+"/plugin.cfg"; + Error err = cf->load(addon_path); + if (err!=OK) { + show_warning("Unable to enable addon plugin at: '"+addon_path+"' parsing of config failed."); + return; + } + + if (!cf->has_section_key("plugin","script")) { + show_warning("Unable to find script field for addon plugin at: 'res://addons/"+p_addon+"''."); + return; + } + + String path = cf->get_value("plugin","script"); + path="res://addons/"+p_addon+"/"+path; + + Ref<Script> script = ResourceLoader::load(path); + + + if (script.is_null()) { + show_warning("Unable to load addon script from path: '"+path+"'."); + return; + } + + //could check inheritance.. + if (String(script->get_instance_base_type())!="EditorPlugin") { + show_warning("Unable to load addon script from path: '"+path+"' Base type is not EditorPlugin."); + return; + } + + if (!script->is_tool()) { + show_warning("Unable to load addon script from path: '"+path+"' Script is does not support tool mode."); + return; + } + + EditorPlugin *ep = memnew( EditorPlugin ); + ep->set_script(script.get_ref_ptr()); + plugin_addons[p_addon]=ep; + add_editor_plugin(ep); + + _update_addon_config(); + + +} + +bool EditorNode::is_addon_plugin_enabled(const String& p_addon) const { + + return plugin_addons.has(p_addon); +} + + void EditorNode::_remove_edited_scene() { int new_index = editor_data.get_edited_scene(); int old_index=new_index; @@ -3955,9 +4048,9 @@ void EditorNode::register_editor_types() { ObjectTypeDB::register_type<EditorScript>(); ObjectTypeDB::register_type<EditorSelection>(); ObjectTypeDB::register_type<EditorFileDialog>(); - ObjectTypeDB::register_type<EditorImportExport>(); + //ObjectTypeDB::register_type<EditorImportExport>(); ObjectTypeDB::register_type<EditorSettings>(); - ObjectTypeDB::register_type<UndoRedo>(); + ObjectTypeDB::register_type<EditorSpatialGizmo>(); //ObjectTypeDB::register_type<EditorImporter>(); @@ -4360,6 +4453,51 @@ void EditorNode::_load_docks() { } + +void EditorNode::_update_dock_slots_visibility() { + + VSplitContainer*splits[DOCK_SLOT_MAX/2]={ + left_l_vsplit, + left_r_vsplit, + right_l_vsplit, + right_r_vsplit, + }; + + + HSplitContainer*h_splits[4]={ + left_l_hsplit, + left_r_hsplit, + main_hsplit, + right_hsplit, + }; + + for(int i=0;i<DOCK_SLOT_MAX;i++) { + + if (dock_slot[i]->get_tab_count()) + dock_slot[i]->show(); + else + dock_slot[i]->hide(); + + } + + + for(int i=0;i<DOCK_SLOT_MAX/2;i++) { + bool in_use = dock_slot[i*2+0]->get_tab_count() || dock_slot[i*2+1]->get_tab_count(); + if (in_use) + splits[i]->show(); + else + splits[i]->hide(); + } + + for(int i=0;i<DOCK_SLOT_MAX;i++) { + + if (!dock_slot[i]->is_hidden() && dock_slot[i]->get_tab_count()) { + dock_slot[i]->set_current_tab(0); + } + } +} + + void EditorNode::_load_docks_from_config(Ref<ConfigFile> p_layout, const String& p_section) { for(int i=0;i<DOCK_SLOT_MAX;i++) { @@ -4697,6 +4835,31 @@ void EditorNode::_bottom_panel_switch(bool p_enable,int p_idx) { } } + +void EditorNode::add_control_to_dock(DockSlot p_slot,Control* p_control) { + ERR_FAIL_INDEX(p_slot,DOCK_SLOT_MAX); + dock_slot[p_slot]->add_child(p_control); + _update_dock_slots_visibility(); + +} + +void EditorNode::remove_control_from_dock(Control* p_control) { + + Control *dock=NULL; + for(int i=0;i<DOCK_SLOT_MAX;i++) { + if (p_control->get_parent()==dock_slot[i]) { + dock=dock_slot[i]; + break; + } + } + + ERR_EXPLAIN("Control was not in dock"); + ERR_FAIL_COND(!dock); + + dock->remove_child(p_control); + _update_dock_slots_visibility(); +} + void EditorNode::_bind_methods() { @@ -4787,6 +4950,7 @@ EditorNode::EditorNode() { EditorHelp::generate_doc(); //before any editor classes are crated SceneState::set_disable_placeholders(true); + InputDefault *id = Input::get_singleton()->cast_to<InputDefault>(); if (id) { @@ -4802,6 +4966,7 @@ EditorNode::EditorNode() { singleton=this; last_checked_version=0; changing_scene=false; + _initializing_addons=false; FileAccess::set_backup_save(true); @@ -6061,7 +6226,7 @@ EditorNode::EditorNode() { } - EditorSettings::get_singleton()->enable_plugins(); + Node::set_human_readable_collision_renaming(true); @@ -6077,6 +6242,19 @@ EditorNode::EditorNode() { editor_data.set_edited_scene(0); _update_scene_tabs(); + { + + _initializing_addons=true; + Vector<String> addons = Globals::get_singleton()->get("editor_plugins/enabled"); + + for(int i=0;i<addons.size();i++) { + set_addon_plugin_enabled(addons[i],true); + } + _initializing_addons=false; + } + + + _load_docks(); diff --git a/tools/editor/editor_node.h b/tools/editor/editor_node.h index a83555d6e8..b5d3e536db 100644 --- a/tools/editor/editor_node.h +++ b/tools/editor/editor_node.h @@ -101,6 +101,19 @@ class EditorNode : public Node { OBJ_TYPE( EditorNode, Node ); +public: + enum DockSlot { + DOCK_SLOT_LEFT_UL, + DOCK_SLOT_LEFT_BL, + DOCK_SLOT_LEFT_UR, + DOCK_SLOT_LEFT_BR, + DOCK_SLOT_RIGHT_UL, + DOCK_SLOT_RIGHT_BL, + DOCK_SLOT_RIGHT_UR, + DOCK_SLOT_RIGHT_BR, + DOCK_SLOT_MAX + }; +private: enum { HISTORY_SIZE=64 }; @@ -182,17 +195,6 @@ class EditorNode : public Node { OBJECT_METHOD_BASE=500 }; - enum DockSlot { - DOCK_SLOT_LEFT_UL, - DOCK_SLOT_LEFT_BL, - DOCK_SLOT_LEFT_UR, - DOCK_SLOT_LEFT_BR, - DOCK_SLOT_RIGHT_UL, - DOCK_SLOT_RIGHT_BL, - DOCK_SLOT_RIGHT_UR, - DOCK_SLOT_RIGHT_BR, - DOCK_SLOT_MAX - }; //Node *edited_scene; //scene being edited @@ -479,6 +481,10 @@ class EditorNode : public Node { Map<String,Ref<Texture> > icon_type_cache; + bool _initializing_addons; + Map<String,EditorPlugin*> plugin_addons; + + static Ref<Texture> _file_dialog_get_icon(const String& p_path); static void _file_dialog_register(FileDialog *p_dialog); static void _file_dialog_unregister(FileDialog *p_dialog); @@ -541,6 +547,8 @@ class EditorNode : public Node { void _load_docks(); void _save_docks_to_config(Ref<ConfigFile> p_layout, const String& p_section); void _load_docks_from_config(Ref<ConfigFile> p_layout, const String& p_section); + void _update_dock_slots_visibility(); + void _update_layouts_menu(); void _layout_menu_option(int p_idx); @@ -549,6 +557,9 @@ class EditorNode : public Node { void _clear_search_box(); void _clear_undo_history(); + void _update_addon_config(); + + protected: void _notification(int p_what); static void _bind_methods(); @@ -570,9 +581,14 @@ public: static void add_editor_plugin(EditorPlugin *p_editor); static void remove_editor_plugin(EditorPlugin *p_editor); + void add_control_to_dock(DockSlot p_slot,Control* p_control); + void remove_control_from_dock(Control* p_control); + void add_editor_import_plugin(const Ref<EditorImportPlugin>& p_editor_import); void remove_editor_import_plugin(const Ref<EditorImportPlugin>& p_editor_import); + void set_addon_plugin_enabled(const String& p_addon,bool p_enabled); + bool is_addon_plugin_enabled(const String &p_addon) const; void edit_node(Node *p_node); void edit_resource(const Ref<Resource>& p_resource); diff --git a/tools/editor/editor_plugin.cpp b/tools/editor/editor_plugin.cpp index 6b5533f6e5..89b9c59287 100644 --- a/tools/editor/editor_plugin.cpp +++ b/tools/editor/editor_plugin.cpp @@ -48,6 +48,19 @@ void EditorPlugin::add_control_to_bottom_dock(Control *p_control, const String & EditorNode::get_singleton()->add_bottom_panel_item(p_title,p_control); } +void EditorPlugin::add_control_to_dock(DockSlot p_slot,Control *p_control) { + + ERR_FAIL_NULL(p_control); + EditorNode::get_singleton()->add_control_to_dock(EditorNode::DockSlot(p_slot),p_control); + +} + +void EditorPlugin::remove_control_from_docks(Control *p_control) { + + ERR_FAIL_NULL(p_control); + EditorNode::get_singleton()->remove_control_from_dock(p_control); + +} void EditorPlugin::add_control_to_container(CustomControlContainer p_location,Control *p_control) { @@ -94,9 +107,13 @@ void EditorPlugin::add_control_to_container(CustomControlContainer p_location,Co } } -bool EditorPlugin::create_spatial_gizmo(Spatial* p_spatial) { +Ref<SpatialEditorGizmo> EditorPlugin::create_spatial_gizmo(Spatial* p_spatial) { //?? - return false; + if (get_script_instance() && get_script_instance()->has_method("create_spatial_gizmo")) { + return get_script_instance()->call("create_spatial_gizmo",p_spatial); + } + + return Ref<SpatialEditorGizmo>(); } bool EditorPlugin::forward_input_event(const InputEvent& p_event) { @@ -218,27 +235,65 @@ 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::add_import_plugin(const Ref<EditorImportPlugin>& p_editor_import) { + + EditorNode::get_singleton()->add_editor_import_plugin(p_editor_import); +} + +void EditorPlugin::remove_import_plugin(const Ref<EditorImportPlugin>& p_editor_import){ + + EditorNode::get_singleton()->remove_editor_import_plugin(p_editor_import); + +} + +void EditorPlugin::add_export_plugin(const Ref<EditorExportPlugin>& p_editor_export){ + + EditorImportExport::get_singleton()->add_export_plugin(p_editor_export); +} +void EditorPlugin::remove_export_plugin(const Ref<EditorExportPlugin>& p_editor_export){ + + EditorImportExport::get_singleton()->remove_export_plugin(p_editor_export); + +} + +Control *EditorPlugin::get_base_control() { + + return EditorNode::get_singleton()->get_gui_base(); +} + + void EditorPlugin::_bind_methods() { 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_control_to_dock","slot","control:Control"),&EditorPlugin::add_control_to_dock); + ObjectTypeDB::bind_method(_MD("remove_control_from_docks","control:Control"),&EditorPlugin::remove_control_from_docks); 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("add_import_plugin","plugin:EditorImportPlugin"),&EditorPlugin::add_import_plugin); + ObjectTypeDB::bind_method(_MD("remove_import_plugin","plugin:EditorImportPlugin"),&EditorPlugin::remove_import_plugin); + + ObjectTypeDB::bind_method(_MD("add_export_plugin","plugin:EditorExportPlugin"),&EditorPlugin::add_export_plugin); + ObjectTypeDB::bind_method(_MD("remove_export_plugin","plugin:EditorExportPlugin"),&EditorPlugin::remove_export_plugin); + + + ObjectTypeDB::bind_method(_MD("get_base_control:Control"),&EditorPlugin::get_base_control); 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::bind_method(_MD("get_editor_settings:EditorSettings"),&EditorPlugin::get_editor_settings); 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"))); + MethodInfo gizmo = MethodInfo(Variant::OBJECT,"create_spatial_gizmo",PropertyInfo(Variant::OBJECT,"for_spatial:Spatial")); + gizmo.return_val.hint=PROPERTY_HINT_RESOURCE_TYPE; + gizmo.return_val.hint_string="EditorSpatialGizmo"; + ObjectTypeDB::add_virtual_method(get_type_static(),gizmo); ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo(Variant::STRING,"get_name")); ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo(Variant::BOOL,"has_main_screen")); ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo("make_visible",PropertyInfo(Variant::BOOL,"visible"))); @@ -257,6 +312,16 @@ void EditorPlugin::_bind_methods() { BIND_CONSTANT( CONTAINER_CANVAS_EDITOR_MENU ); BIND_CONSTANT( CONTAINER_CANVAS_EDITOR_SIDE ); + BIND_CONSTANT( DOCK_SLOT_LEFT_UL ); + BIND_CONSTANT( DOCK_SLOT_LEFT_BL ); + BIND_CONSTANT( DOCK_SLOT_LEFT_UR ); + BIND_CONSTANT( DOCK_SLOT_LEFT_BR ); + BIND_CONSTANT( DOCK_SLOT_RIGHT_UL ); + BIND_CONSTANT( DOCK_SLOT_RIGHT_BL ); + BIND_CONSTANT( DOCK_SLOT_RIGHT_UR ); + BIND_CONSTANT( DOCK_SLOT_RIGHT_BR ); + BIND_CONSTANT( DOCK_SLOT_MAX ); + } EditorPlugin::EditorPlugin() diff --git a/tools/editor/editor_plugin.h b/tools/editor/editor_plugin.h index df03d37be4..75a3b3b26f 100644 --- a/tools/editor/editor_plugin.h +++ b/tools/editor/editor_plugin.h @@ -43,6 +43,9 @@ class Camera; class EditorSelection; class EditorImportExport; class EditorSettings; +class SpatialEditorGizmo; +class EditorImportPlugin; +class EditorExportPlugin; class EditorPlugin : public Node { @@ -73,12 +76,26 @@ public: CONTAINER_CANVAS_EDITOR_BOTTOM }; + enum DockSlot { + DOCK_SLOT_LEFT_UL, + DOCK_SLOT_LEFT_BL, + DOCK_SLOT_LEFT_UR, + DOCK_SLOT_LEFT_BR, + DOCK_SLOT_RIGHT_UL, + DOCK_SLOT_RIGHT_BL, + DOCK_SLOT_RIGHT_UR, + DOCK_SLOT_RIGHT_BR, + DOCK_SLOT_MAX + }; + //TODO: send a resoucre for editing to the editor node? void add_control_to_container(CustomControlContainer p_location, Control *p_control); void add_control_to_bottom_dock(Control *p_control, const String &p_title); + void add_control_to_dock(DockSlot p_slot,Control *p_control); + void remove_control_from_docks(Control *p_control); - virtual bool create_spatial_gizmo(Spatial* p_spatial); + virtual Ref<SpatialEditorGizmo> create_spatial_gizmo(Spatial* p_spatial); virtual bool forward_input_event(const InputEvent& p_event); virtual bool forward_spatial_input_event(Camera* p_camera,const InputEvent& p_event); virtual String get_name() const; @@ -99,8 +116,16 @@ public: virtual void edited_scene_changed(){}; // if changes are pending in editor, apply them + Control *get_base_control(); + + void add_import_plugin(const Ref<EditorImportPlugin>& p_editor_import); + void remove_import_plugin(const Ref<EditorImportPlugin>& p_editor_import); + + void add_export_plugin(const Ref<EditorExportPlugin>& p_editor_export); + void remove_export_plugin(const Ref<EditorExportPlugin>& p_editor_export); + EditorSelection* get_selection(); - EditorImportExport *get_import_export(); + //EditorImportExport *get_import_export(); EditorSettings *get_editor_settings(); virtual void restore_global_state(); @@ -112,6 +137,7 @@ public: }; VARIANT_ENUM_CAST( EditorPlugin::CustomControlContainer ); +VARIANT_ENUM_CAST( EditorPlugin::DockSlot ); typedef EditorPlugin* (*EditorPluginCreateFunc)(EditorNode *); diff --git a/tools/editor/editor_plugin_settings.cpp b/tools/editor/editor_plugin_settings.cpp new file mode 100644 index 0000000000..d78e43c578 --- /dev/null +++ b/tools/editor/editor_plugin_settings.cpp @@ -0,0 +1,188 @@ +#include "editor_plugin_settings.h" +#include "scene/gui/margin_container.h" +#include "io/config_file.h" +#include "os/file_access.h" +#include "os/main_loop.h" +#include "globals.h" +#include "editor_node.h" + +void EditorPluginSettings::_notification(int p_what) { + + if (p_what==MainLoop::NOTIFICATION_WM_FOCUS_IN) { + update_plugins(); + } +} + +void EditorPluginSettings::update_plugins() { + + + plugin_list->clear(); + + DirAccess *da = DirAccess::create(DirAccess::ACCESS_RESOURCES); + Error err = da->change_dir("res://addons"); + if (err!=OK) { + memdelete(da); + return; + } + + updating=true; + + TreeItem *root = plugin_list->create_item(); + + da->list_dir_begin(); + + String d = da->get_next(); + + Vector<String> plugins; + + while(d!=String()) { + + bool dir = da->current_is_dir(); + String path = "res://addons/"+d+"/plugin.cfg"; + + if (dir && FileAccess::exists(path)) { + + plugins.push_back(d); + } + + d = da->get_next(); + } + + da->list_dir_end(); + memdelete(da); + + plugins.sort(); + + Vector<String> active_plugins = Globals::get_singleton()->get("plugins/active"); + + for(int i=0;i<plugins.size();i++) { + + Ref<ConfigFile> cf; + cf.instance(); + String path = "res://addons/"+plugins[i]+"/plugin.cfg"; + + Error err = cf->load(path); + + if (err!=OK) { + WARN_PRINTS("Can't load plugin config: "+path); + } else if (!cf->has_section_key("plugin","name")) { + WARN_PRINTS("Plugin misses plugin/name: "+path); + } else if (!cf->has_section_key("plugin","author")) { + WARN_PRINTS("Plugin misses plugin/author: "+path); + } else if (!cf->has_section_key("plugin","version")) { + WARN_PRINTS("Plugin misses plugin/version: "+path); + } else if (!cf->has_section_key("plugin","description")) { + WARN_PRINTS("Plugin misses plugin/description: "+path); + } else if (!cf->has_section_key("plugin","script")) { + WARN_PRINTS("Plugin misses plugin/script: "+path); + } else { + + String d = plugins[i]; + String name = cf->get_value("plugin","name"); + String author = cf->get_value("plugin","author"); + String version = cf->get_value("plugin","version"); + String description = cf->get_value("plugin","description"); + String script = cf->get_value("plugin","script"); + + TreeItem *item = plugin_list->create_item(root); + item->set_text(0,name); + item->set_tooltip(0,"Name: "+name+"\nPath: "+path+"\nMain Script: "+script); + item->set_metadata(0,d); + item->set_text(1,version); + item->set_metadata(1,script); + item->set_text(2,author); + item->set_metadata(2,description); + item->set_cell_mode(3,TreeItem::CELL_MODE_RANGE); + item->set_range_config(3,0,1,1); + item->set_text(3,"Inactive,Active"); + item->set_editable(3,true); + + if (EditorNode::get_singleton()->is_addon_plugin_enabled(d)) { + item->set_custom_color(3,Color(0.2,1,0.2)); + item->set_range(3,1); + } else { + item->set_custom_color(3,Color(1,0.2,0.2)); + item->set_range(3,0); + } + } + + } + + updating=false; + +} + + +void EditorPluginSettings::_plugin_activity_changed() { + + if (updating) + return; + + TreeItem *ti=plugin_list->get_edited(); + ERR_FAIL_COND(!ti); + bool active = ti->get_range(3); + String name = ti->get_metadata(0); + + EditorNode::get_singleton()->set_addon_plugin_enabled(name,active); + + bool is_active = EditorNode::get_singleton()->is_addon_plugin_enabled(name); + + if (is_active!=active) { + updating=true; + ti->set_range(3,is_active?1:0); + updating=false; + } + + if (is_active) + ti->set_custom_color(3,Color(0.2,1,0.2)); + else + ti->set_custom_color(3,Color(1,0.2,0.2)); + + +} + +void EditorPluginSettings::_bind_methods() { + + ObjectTypeDB::bind_method("update_plugins",&EditorPluginSettings::update_plugins); + ObjectTypeDB::bind_method("_plugin_activity_changed",&EditorPluginSettings::_plugin_activity_changed); +} + +EditorPluginSettings::EditorPluginSettings() { + + HBoxContainer *title_hb = memnew( HBoxContainer ); + title_hb->add_child(memnew( Label("Installed Plugins:"))); + title_hb->add_spacer(); + update_list = memnew( Button("Update") ); + update_list->connect("pressed",this,"update_plugins"); + title_hb->add_child(update_list); + add_child(title_hb); + + plugin_list = memnew( Tree ); + plugin_list->set_v_size_flags(SIZE_EXPAND_FILL); + plugin_list->set_columns(4); + plugin_list->set_column_titles_visible(true); + plugin_list->set_column_title(0,"Name:"); + plugin_list->set_column_title(1,"Version:"); + plugin_list->set_column_title(2,"Author:"); + plugin_list->set_column_title(3,"Status:"); + plugin_list->set_column_expand(0,true); + plugin_list->set_column_expand(1,false); + plugin_list->set_column_expand(2,false); + plugin_list->set_column_expand(3,false); + plugin_list->set_column_min_width(1,100); + plugin_list->set_column_min_width(2,250); + plugin_list->set_column_min_width(3,80); + plugin_list->set_hide_root(true); + plugin_list->connect("item_edited",this,"_plugin_activity_changed"); + + + MarginContainer *mc = memnew( MarginContainer ); + mc->add_child(plugin_list); + mc->set_v_size_flags(SIZE_EXPAND_FILL); + + add_child(mc); + + updating=false; + +} + diff --git a/tools/editor/editor_plugin_settings.h b/tools/editor/editor_plugin_settings.h new file mode 100644 index 0000000000..4f3c5b8268 --- /dev/null +++ b/tools/editor/editor_plugin_settings.h @@ -0,0 +1,35 @@ +#ifndef EDITORPLUGINSETTINGS_H +#define EDITORPLUGINSETTINGS_H + + +#include "scene/gui/dialogs.h" +#include "property_editor.h" +#include "optimized_save_dialog.h" +#include "undo_redo.h" +#include "editor_data.h" + +class EditorPluginSettings : public VBoxContainer { + + OBJ_TYPE(EditorPluginSettings,VBoxContainer); + + Button* update_list; + Tree *plugin_list; + bool updating; + + + void _plugin_activity_changed(); +protected: + + void _notification(int p_what); + + static void _bind_methods(); + + +public: + + void update_plugins(); + + EditorPluginSettings(); +}; + +#endif // EDITORPLUGINSETTINGS_H diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp index d7df661473..47ef87cfb1 100644 --- a/tools/editor/editor_settings.cpp +++ b/tools/editor/editor_settings.cpp @@ -228,13 +228,6 @@ void EditorSettings::create() { dir->change_dir(".."); } - if (dir->change_dir("plugins")!=OK) { - dir->make_dir("plugins"); - } else { - - dir->change_dir(".."); - } - if (dir->change_dir("config")!=OK) { dir->make_dir("config"); } else { @@ -287,7 +280,6 @@ void EditorSettings::create() { singleton->setup_network(); singleton->load_favorites(); - singleton->scan_plugins(); return; @@ -312,7 +304,6 @@ void EditorSettings::create() { singleton->settings_path=config_path+"/"+config_dir; singleton->_load_defaults(extra_config); singleton->setup_network(); - singleton->scan_plugins(); } @@ -323,35 +314,6 @@ String EditorSettings::get_settings_path() const { } -Error EditorSettings::_load_plugin(const String& p_path, Plugin &plugin) { - - if (!FileAccess::exists(p_path)) - return ERR_FILE_NOT_FOUND; - - Ref<ConfigFile> cf = memnew(ConfigFile); - Error err = cf->load(p_path); - ERR_EXPLAIN("Error loading plugin description for: "+p_path); - ERR_FAIL_COND_V(err!=OK,ERR_CANT_OPEN); - - plugin.instance=NULL; - ERR_FAIL_COND_V(!cf->has_section_key("plugin","name"),ERR_INVALID_DATA); - ERR_FAIL_COND_V(!cf->has_section_key("plugin","installs"),ERR_INVALID_DATA); - ERR_FAIL_COND_V(!cf->has_section_key("plugin","author"),ERR_INVALID_DATA); - ERR_FAIL_COND_V(!cf->has_section_key("plugin","version"),ERR_INVALID_DATA); - ERR_FAIL_COND_V(!cf->has_section_key("plugin","script"),ERR_INVALID_DATA); - plugin.name=cf->get_value("plugin","name"); - plugin.author=cf->get_value("plugin","author"); - plugin.version=cf->get_value("plugin","version"); - plugin.script=cf->get_value("plugin","script"); - - if (cf->has_section_key("plugin","description")) - plugin.description=cf->get_value("plugin","description"); - plugin.installs=cf->get_value("plugin","installs"); - if (cf->has_section_key("plugin","install_files")) - plugin.install_files=cf->get_value("plugin","install_files"); - - return OK; -} void EditorSettings::setup_network() { @@ -382,46 +344,6 @@ void EditorSettings::setup_network() { } -void EditorSettings::scan_plugins() { - - Map<String,Plugin> new_plugins; - - new_plugins.clear(); - DirAccess *d = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); - Error err = d->change_dir(get_settings_path().plus_file("plugins")); - if (err!=OK) { - memdelete(d); - ERR_EXPLAIN("Plugin dir does not exist!") - ERR_FAIL_COND(err!=OK); - } - d->list_dir_begin(); - - String base = d->get_current_dir(); - //print_line("list diring on: "+base); - while(true) { - String p = d->get_next(); - if (p=="") - break; - if (!d->current_is_dir() || p.begins_with(".")) - continue; - - String cfpath=d->get_current_dir().plus_file(p+"/plugin.cfg"); - - Plugin plugin; - Error err = _load_plugin(cfpath,plugin); - ERR_CONTINUE(err!=OK); - - if (plugins.has(p)) - plugin.instance=plugins[p].instance; - - new_plugins[p]=plugin; - } - - - plugins=new_plugins; - - memdelete(d); -} void EditorSettings::save() { @@ -623,148 +545,9 @@ void EditorSettings::add_property_hint(const PropertyInfo& p_hint) { } -bool EditorSettings::is_plugin_enabled(const String& p_plugin) { - - if (!has("_plugins/enabled")) - return false; - - StringArray sa=get("_plugins/enabled"); - - for(int i=0;i<sa.size();i++) { - - String plugin = sa[i]; - if (!plugins.has(plugin)) - continue; - if (plugin==p_plugin) - return true; - } - - return false; - -} - -void EditorSettings::enable_plugins() { - - // editor plugins - if (has("_plugins/enabled")) { - StringArray sa=get("_plugins/enabled"); - - for(int i=0;i<sa.size();i++) { - - String plugin = sa[i]; - if (!plugins.has(plugin)) - continue; - if (plugins[plugin].installs) - continue; //not configured here - set_plugin_enabled(plugin,true); - } - } - - // installed plugins - List<PropertyInfo> pi; - Globals::get_singleton()->get_property_list(&pi); - for (List<PropertyInfo>::Element *E=pi.front();E;E=E->next()) { - - String p = E->get().name; - - if (p.begins_with("plugins/")) { - load_installed_plugin(p.replace_first("plugins/","")); - } - } - -} - -void EditorSettings::load_installed_plugin(const String& p_plugin) { - - ERR_FAIL_COND( !Globals::get_singleton()->has("plugins/"+p_plugin) ); - String path = Globals::get_singleton()->get("plugins/"+p_plugin); - - Plugin plugin; - Error err = _load_plugin(path.plus_file("plugin.cfg"),plugin); - - if (err) - return; - - print_line("installing plugin..."); - EditorPlugin *ep=_load_plugin_editor(path.plus_file(plugin.script)); - ERR_FAIL_COND(!ep); - print_line("load!"); - EditorNode::add_editor_plugin(ep); - -} - - -EditorPlugin *EditorSettings::_load_plugin_editor(const String& p_path) { - - Ref<Script> script = ResourceLoader::load(p_path); - ERR_EXPLAIN("Invalid Script for plugin: "+p_path); - ERR_FAIL_COND_V(script.is_null(),NULL); - ERR_EXPLAIN("Script has errors: "+p_path); - ERR_FAIL_COND_V(!script->can_instance(),NULL); - ERR_EXPLAIN("Script does not inherit EditorPlugin: "+p_path); - ERR_FAIL_COND_V(script->get_instance_base_type().operator String()!="EditorPlugin",NULL); - - EditorPlugin *ep = memnew( EditorPlugin ); - ep->set_script(script.get_ref_ptr()); - if (!ep->get_script_instance()) { - memdelete(ep); - ERR_EXPLAIN("Script could't load: "+p_path); - ERR_FAIL_V(NULL); - } - - - return ep; -} - -void EditorSettings::set_plugin_enabled(const String& p_plugin, bool p_enabled) { - - ERR_FAIL_COND(!plugins.has(p_plugin)); - if (p_enabled == (plugins[p_plugin].instance!=NULL)) //already enabled or disabled - return; - - print_line("REQUEST "+p_plugin+" to "+itos(p_enabled)); - StringArray sa; - if (has("_plugins/enabled")) - sa=get("_plugins/enabled"); - - int idx=-1; - for(int i=0;i<sa.size();i++) { - - if (sa[i]==p_plugin) { - idx=i; - break; - } - } - - if (p_enabled) { - - - String ppath = get_settings_path().plus_file("plugins/"+p_plugin+"/"+plugins[p_plugin].script); - EditorPlugin *ep=_load_plugin_editor(ppath); - if (!ep) - return; - plugins[p_plugin].instance=ep; - EditorNode::add_editor_plugin(ep); - if (idx==-1) - sa.push_back(p_plugin); - } else { - - print_line("DISABLING"); - EditorNode::remove_editor_plugin(plugins[p_plugin].instance); - memdelete(plugins[p_plugin].instance); - plugins[p_plugin].instance=NULL; - if (idx!=-1) - sa.remove(idx); - } - if (sa.size()==0) - set("_plugins/enabled",Variant()); - else - set("_plugins/enabled",sa); - -} void EditorSettings::set_favorite_dirs(const Vector<String>& p_favorites) { diff --git a/tools/editor/editor_settings.h b/tools/editor/editor_settings.h index d189403dc1..ae5bbcca89 100644 --- a/tools/editor/editor_settings.h +++ b/tools/editor/editor_settings.h @@ -57,7 +57,6 @@ public: Vector<String> install_files; }; private: - Map<String,Plugin> plugins; struct VariantContainer { int order; @@ -84,9 +83,6 @@ private: Ref<Resource> clipboard; - EditorPlugin *_load_plugin_editor(const String& p_path); - Error _load_plugin(const String& p_path,Plugin& plugin); - void _load_defaults(Ref<ConfigFile> p_extra_config = NULL); String project_config_path; @@ -111,10 +107,7 @@ public: //String get_global_settings_path() const; String get_project_settings_path() const; - const Map<String,Plugin>& get_plugins() const { return plugins; } - void scan_plugins(); - void enable_plugins(); void setup_network(); void raise_order(const String& p_name); @@ -124,11 +117,6 @@ public: void notify_changes(); - void set_plugin_enabled(const String& p_plugin,bool p_enabled); - bool is_plugin_enabled(const String& p_plugin); - - void load_installed_plugin(const String& p_plugin); - void set_resource_clipboard(const Ref<Resource>& p_resource) { clipboard=p_resource; } Ref<Resource> get_resource_clipboard() const { return clipboard; } diff --git a/tools/editor/io_plugins/editor_font_import_plugin.cpp b/tools/editor/io_plugins/editor_font_import_plugin.cpp index 9b4ca246e7..ff126a8e8c 100644 --- a/tools/editor/io_plugins/editor_font_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_font_import_plugin.cpp @@ -540,7 +540,7 @@ class EditorFontImportDialog : public ConfirmationDialog { return; } - //_import_inc(dest->get_line_edit()->get_text()); + _import_inc(dest->get_line_edit()->get_text()); hide(); } diff --git a/tools/editor/io_plugins/editor_scene_import_plugin.cpp b/tools/editor/io_plugins/editor_scene_import_plugin.cpp index a3b6827cd4..322320780d 100644 --- a/tools/editor/io_plugins/editor_scene_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_scene_import_plugin.cpp @@ -57,11 +57,12 @@ void EditorScenePostImport::_bind_methods() { } -Error EditorScenePostImport::post_import(Node* p_scene) { +Node *EditorScenePostImport::post_import(Node* p_scene) { if (get_script_instance()) - return Error(int(get_script_instance()->call("post_import",p_scene))); - return OK; + return get_script_instance()->call("post_import",p_scene); + + return p_scene; } EditorScenePostImport::EditorScenePostImport() { @@ -2748,8 +2749,8 @@ Error EditorSceneImportPlugin::import2(Node *scene, const String& p_dest_path, c if (post_import_script.is_valid()) { - err = post_import_script->post_import(scene); - if (err) { + scene = post_import_script->post_import(scene); + if (!scene) { EditorNode::add_io_error("Error running Post-Import script: '"+post_import_script_path); return err; } diff --git a/tools/editor/io_plugins/editor_scene_import_plugin.h b/tools/editor/io_plugins/editor_scene_import_plugin.h index 1f3b73fe7f..a1a090de7e 100644 --- a/tools/editor/io_plugins/editor_scene_import_plugin.h +++ b/tools/editor/io_plugins/editor_scene_import_plugin.h @@ -87,7 +87,7 @@ protected: static void _bind_methods(); public: - virtual Error post_import(Node* p_scene); + virtual Node* post_import(Node* p_scene); EditorScenePostImport(); }; diff --git a/tools/editor/plugins/path_editor_plugin.cpp b/tools/editor/plugins/path_editor_plugin.cpp index b99e632604..3c4428bdb0 100644 --- a/tools/editor/plugins/path_editor_plugin.cpp +++ b/tools/editor/plugins/path_editor_plugin.cpp @@ -267,17 +267,15 @@ PathSpatialGizmo::PathSpatialGizmo(Path* p_path){ } -bool PathEditorPlugin::create_spatial_gizmo(Spatial* p_spatial) { +Ref<SpatialEditorGizmo> PathEditorPlugin::create_spatial_gizmo(Spatial* p_spatial) { - if (p_spatial->cast_to<Path>()) { + if (p_spatial->cast_to<Path>()) { - Ref<PathSpatialGizmo> psg = memnew( PathSpatialGizmo(p_spatial->cast_to<Path>())); - p_spatial->set_gizmo(psg); - return true; + return memnew( PathSpatialGizmo(p_spatial->cast_to<Path>())); } - return false; + return Ref<SpatialEditorGizmo>(); } bool PathEditorPlugin::forward_spatial_input_event(Camera* p_camera,const InputEvent& p_event) { @@ -538,7 +536,7 @@ PathEditorPlugin::PathEditorPlugin(EditorNode *p_node) { path_thin_material->set_flag(Material::FLAG_DOUBLE_SIDED,true); path_thin_material->set_flag(Material::FLAG_UNSHADED,true); - SpatialEditor::get_singleton()->add_gizmo_plugin(this); +// SpatialEditor::get_singleton()->add_gizmo_plugin(this); sep = memnew( VSeparator); sep->hide(); diff --git a/tools/editor/plugins/path_editor_plugin.h b/tools/editor/plugins/path_editor_plugin.h index 18bad23bd1..0afd957af7 100644 --- a/tools/editor/plugins/path_editor_plugin.h +++ b/tools/editor/plugins/path_editor_plugin.h @@ -32,9 +32,9 @@ #include "tools/editor/spatial_editor_gizmos.h" #include "scene/3d/path.h" -class PathSpatialGizmo : public SpatialGizmoTool { +class PathSpatialGizmo : public EditorSpatialGizmo { - OBJ_TYPE(PathSpatialGizmo,SpatialGizmoTool); + OBJ_TYPE(PathSpatialGizmo,EditorSpatialGizmo); Path* path; mutable Vector3 original; @@ -83,7 +83,7 @@ public: virtual bool forward_spatial_input_event(Camera* p_camera,const InputEvent& p_event); // virtual bool forward_input_event(const InputEvent& p_event) { return collision_polygon_editor->forward_input_event(p_event); } - virtual bool create_spatial_gizmo(Spatial* p_spatial); + virtual Ref<SpatialEditorGizmo> create_spatial_gizmo(Spatial* p_spatial); virtual String get_name() const { return "Path"; } bool has_main_screen() const { return false; } virtual void edit(Object *p_node); diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp index bc57fd7e44..1f264a2337 100644 --- a/tools/editor/plugins/spatial_editor_plugin.cpp +++ b/tools/editor/plugins/spatial_editor_plugin.cpp @@ -3655,35 +3655,32 @@ void SpatialEditor::_request_gizmo(Object* p_obj) { Spatial *sp=p_obj->cast_to<Spatial>(); if (!sp) return; - if (editor->get_edited_scene() && (sp==editor->get_edited_scene() || sp->get_owner()==editor->get_edited_scene())) { + if (editor->get_edited_scene() && (sp==editor->get_edited_scene() || sp->get_owner()==editor->get_edited_scene() || editor->get_edited_scene()->is_editable_instance(sp->get_owner()))) { - Ref<SpatialEditorGizmo> seg = gizmos->get_gizmo(sp); + Ref<SpatialEditorGizmo> seg; - if (seg.is_valid()) { - sp->set_gizmo(seg); - } - - for (List<EditorPlugin*>::Element *E=gizmo_plugins.front();E;E=E->next()) { + for(int i=0;i<EditorNode::get_singleton()->get_editor_data().get_editor_plugin_count();i++) { - if (E->get()->create_spatial_gizmo(sp)) { + seg = EditorNode::get_singleton()->get_editor_data().get_editor_plugin(i)->create_spatial_gizmo(sp); + if (seg.is_valid()) + break; + } - seg = sp->get_gizmo(); - if (sp==selected && seg.is_valid()) { + if (!seg.is_valid()) { + seg = gizmos->get_gizmo(sp); + } - seg->set_selected(true); - selected->update_gizmo(); - } - return; - } + if (seg.is_valid()) { + sp->set_gizmo(seg); } + if (seg.is_valid() && sp==selected) { seg->set_selected(true); selected->update_gizmo(); } } - } void SpatialEditor::_toggle_maximize_view(Object* p_viewport) { diff --git a/tools/editor/plugins/spatial_editor_plugin.h b/tools/editor/plugins/spatial_editor_plugin.h index b0e366b140..af1b6919a2 100644 --- a/tools/editor/plugins/spatial_editor_plugin.h +++ b/tools/editor/plugins/spatial_editor_plugin.h @@ -457,8 +457,6 @@ private: Ref<Environment> viewport_environment; - List<EditorPlugin*> gizmo_plugins; - Spatial *selected; void _request_gizmo(Object* p_obj); @@ -518,8 +516,6 @@ public: UndoRedo *get_undo_redo() { return undo_redo; } - void add_gizmo_plugin(EditorPlugin* p_plugin) { gizmo_plugins.push_back(p_plugin); } - void add_control_to_menu_panel(Control *p_control); VSplitContainer *get_shader_split(); diff --git a/tools/editor/project_settings.cpp b/tools/editor/project_settings.cpp index fd76ea3087..69e09d6053 100644 --- a/tools/editor/project_settings.cpp +++ b/tools/editor/project_settings.cpp @@ -570,6 +570,7 @@ void ProjectSettings::popup_project_settings() { globals_editor->edit(Globals::get_singleton()); _update_translations(); _update_autoload(); + plugin_settings->update_plugins(); } @@ -739,6 +740,10 @@ void ProjectSettings::_settings_changed() { timer->start(); } +void ProjectSettings::queue_save() { + _settings_changed(); +} + void ProjectSettings::_copy_to_platform(int p_which) { @@ -1830,6 +1835,13 @@ ProjectSettings::ProjectSettings(EditorData *p_data) { } + { + + plugin_settings = memnew( EditorPluginSettings ); + plugin_settings->set_name("Plugins"); + tab_container->add_child(plugin_settings); + } + timer = memnew( Timer ); timer->set_wait_time(1.5); timer->connect("timeout",Globals::get_singleton(),"save"); diff --git a/tools/editor/project_settings.h b/tools/editor/project_settings.h index fd56fc1478..922608fb9a 100644 --- a/tools/editor/project_settings.h +++ b/tools/editor/project_settings.h @@ -34,6 +34,9 @@ #include "optimized_save_dialog.h" #include "undo_redo.h" #include "editor_data.h" + +#include "editor_plugin_settings.h" + //#include "project_export_settings.h" class ProjectSettings : public AcceptDialog { @@ -89,6 +92,9 @@ class ProjectSettings : public AcceptDialog { LineEdit *autoload_add_name; LineEdit *autoload_add_path; + + EditorPluginSettings *plugin_settings; + void _update_autoload(); void _autoload_file_callback(const String& p_path); void _autoload_add(); @@ -142,6 +148,8 @@ class ProjectSettings : public AcceptDialog { void _toggle_search_bar(bool p_pressed); void _clear_search_box(); + + ProjectSettings(); @@ -157,6 +165,8 @@ public: static ProjectSettings *get_singleton() { return singleton; } void popup_project_settings(); + void queue_save(); + ProjectSettings(EditorData *p_data); }; diff --git a/tools/editor/settings_config_dialog.cpp b/tools/editor/settings_config_dialog.cpp index 86a3ab7001..6b7c2eb9b7 100644 --- a/tools/editor/settings_config_dialog.cpp +++ b/tools/editor/settings_config_dialog.cpp @@ -80,173 +80,6 @@ void EditorSettingsDialog::popup_edit_settings() { } -void EditorSettingsDialog::_plugin_install() { - - EditorSettings::Plugin plugin = EditorSettings::get_singleton()->get_plugins()[plugin_setting_edit]; - - DirAccess *da = DirAccess::create(DirAccess::ACCESS_RESOURCES); - da->change_dir("res://"); - if (da->change_dir("plugins")!=OK) { - - Error err = da->make_dir("plugins"); - if (err) - memdelete(da); - ERR_FAIL_COND(err!=OK); - err = da->change_dir("plugins"); - if (err) - memdelete(da); - ERR_FAIL_COND(err!=OK); - } - - if (da->change_dir(plugin_setting_edit)!=OK) { - - Error err = da->make_dir(plugin_setting_edit); - if (err) - memdelete(da); - ERR_FAIL_COND(err!=OK); - err = da->change_dir(plugin_setting_edit); - if (err) - memdelete(da); - ERR_FAIL_COND(err!=OK); - } - - Vector<String> ifiles=plugin.install_files; - - if (ifiles.find("plugin.cfg")==-1) { - ifiles.push_back("plugin.cfg"); - } - - if (ifiles.find(plugin.script)==-1) { - ifiles.push_back(plugin.script); - } - - for(int i=0;i<ifiles.size();i++) { - - String target = "res://plugins/"+plugin_setting_edit+"/"+ifiles[i]; - Error err = da->copy(EditorSettings::get_singleton()->get_settings_path().plus_file("plugins/"+plugin_setting_edit+"/"+ifiles[i]),target); - if (err) - memdelete(da); - ERR_EXPLAIN("Error copying to file "+target); - ERR_FAIL_COND(err!=OK); - EditorFileSystem::get_singleton()->update_file(target); - } - - memdelete(da); - - Globals::get_singleton()->set("plugins/"+plugin_setting_edit,"res://plugins/"+plugin_setting_edit); - Globals::get_singleton()->set_persisting("plugins/"+plugin_setting_edit,true); - EditorSettings::get_singleton()->load_installed_plugin(plugin_setting_edit); - Globals::get_singleton()->save(); - - - _update_plugins(); -} - -void EditorSettingsDialog::_rescan_plugins() { - - EditorSettings::get_singleton()->scan_plugins(); - _update_plugins(); -} - -void EditorSettingsDialog::_plugin_edited() { - - if (updating) - return; - - TreeItem *ti=plugins->get_edited(); - if (!ti) - return; - - String plugin = ti->get_metadata(0); - bool enabled = ti->is_checked(0); - - EditorSettings::get_singleton()->set_plugin_enabled(plugin,enabled); -} - -void EditorSettingsDialog::_plugin_settings(Object *p_obj,int p_cell,int p_index) { - - TreeItem *ti=p_obj->cast_to<TreeItem>(); - - EditorSettings::Plugin plugin = EditorSettings::get_singleton()->get_plugins()[ti->get_metadata(0)]; - - plugin_description->clear(); - plugin_description->parse_bbcode(plugin.description); - plugin_setting_edit = ti->get_metadata(0); - if (plugin.installs) { - if (Globals::get_singleton()->has("plugins/"+plugin_setting_edit)) - plugin_setting->get_ok()->set_text("Re-Install to Project"); - else - plugin_setting->get_ok()->set_text("Install to Project"); - plugin_setting->get_ok()->show(); - plugin_setting->get_cancel()->set_text("Close"); - } else { - plugin_setting->get_ok()->hide(); - plugin_setting->get_cancel()->set_text("Close"); - } - - plugin_setting->set_title(plugin.name); - plugin_setting->popup_centered(Size2(300,200)); -} - -void EditorSettingsDialog::_update_plugins() { - - - updating=true; - - plugins->clear(); - TreeItem *root = plugins->create_item(NULL); - plugins->set_hide_root(true); - - Color sc = get_color("prop_subsection","Editor"); - TreeItem *editor = plugins->create_item(root); - editor->set_text(0,"Editor Plugins"); - editor->set_custom_bg_color(0,sc); - editor->set_custom_bg_color(1,sc); - editor->set_custom_bg_color(2,sc); - - TreeItem *install = plugins->create_item(root); - install->set_text(0,"Installable Plugins"); - install->set_custom_bg_color(0,sc); - install->set_custom_bg_color(1,sc); - install->set_custom_bg_color(2,sc); - - for (const Map<String,EditorSettings::Plugin>::Element *E=EditorSettings::get_singleton()->get_plugins().front();E;E=E->next()) { - - - TreeItem *ti = plugins->create_item(E->get().installs?install:editor); - if (!E->get().installs) { - ti->set_cell_mode(0,TreeItem::CELL_MODE_CHECK); - ti->set_editable(0,true); - if (EditorSettings::get_singleton()->is_plugin_enabled(E->key())) - ti->set_checked(0,true); - - ti->set_text(0,E->get().name); - } else { - - if (Globals::get_singleton()->has("plugins/"+E->key())) { - - ti->set_text(0,E->get().name+" (Installed)"); - } else { - ti->set_text(0,E->get().name); - } - } - - - ti->add_button(0,get_icon("Tools","EditorIcons"),0); - ti->set_text(1,E->get().author); - ti->set_text(2,E->get().version); - ti->set_metadata(0,E->key()); - - } - - if (!editor->get_children()) - memdelete(editor); - if (!install->get_children()) - memdelete(install); - - updating=false; - -} void EditorSettingsDialog::_clear_search_box() { @@ -261,9 +94,7 @@ void EditorSettingsDialog::_notification(int p_what) { if (p_what==NOTIFICATION_ENTER_TREE) { - rescan_plugins->set_icon(get_icon("Reload","EditorIcons")); clear_button->set_icon(get_icon("Close","EditorIcons")); - _update_plugins(); } } @@ -271,10 +102,6 @@ void EditorSettingsDialog::_bind_methods() { ObjectTypeDB::bind_method(_MD("_settings_save"),&EditorSettingsDialog::_settings_save); ObjectTypeDB::bind_method(_MD("_settings_changed"),&EditorSettingsDialog::_settings_changed); - ObjectTypeDB::bind_method(_MD("_rescan_plugins"),&EditorSettingsDialog::_rescan_plugins); - ObjectTypeDB::bind_method(_MD("_plugin_settings"),&EditorSettingsDialog::_plugin_settings); - ObjectTypeDB::bind_method(_MD("_plugin_edited"),&EditorSettingsDialog::_plugin_edited); - ObjectTypeDB::bind_method(_MD("_plugin_install"),&EditorSettingsDialog::_plugin_install); ObjectTypeDB::bind_method(_MD("_clear_search_box"),&EditorSettingsDialog::_clear_search_box); } @@ -324,32 +151,6 @@ EditorSettingsDialog::EditorSettingsDialog() { //Button *load = memnew( Button ); //load->set_text("Load.."); //hbc->add_child(load); - Button *rescan = memnew( Button ); - rescan_plugins=rescan; - rescan_plugins->connect("pressed",this,"_rescan_plugins"); - hbc->add_child(rescan); - plugins = memnew( Tree ); - MarginContainer *mc = memnew( MarginContainer); - vbc->add_child(mc); - mc->add_child(plugins); - mc->set_v_size_flags(SIZE_EXPAND_FILL); - plugins->set_columns(3); - plugins->set_column_title(0,"Name"); - plugins->set_column_title(1,"Author"); - plugins->set_column_title(2,"Version"); - plugins->set_column_expand(2,false); - plugins->set_column_min_width(2,100); - plugins->set_column_titles_visible(true); - plugins->connect("button_pressed",this,"_plugin_settings"); - plugins->connect("item_edited",this,"_plugin_edited"); - - plugin_setting = memnew( ConfirmationDialog ); - add_child(plugin_setting); - plugin_description = memnew( RichTextLabel ); - plugin_setting->add_child(plugin_description); - plugin_setting->set_child_rect(plugin_description); - plugin_setting->connect("confirmed",this,"_plugin_install"); - //get_ok()->set_text("Apply"); @@ -363,8 +164,6 @@ EditorSettingsDialog::EditorSettingsDialog() { add_child(timer); EditorSettings::get_singleton()->connect("settings_changed",this,"_settings_changed"); get_ok()->set_text("Close"); - install_confirm = memnew( ConfirmationDialog ); - add_child(install_confirm); updating=false; diff --git a/tools/editor/settings_config_dialog.h b/tools/editor/settings_config_dialog.h index e1c3238a64..5085132108 100644 --- a/tools/editor/settings_config_dialog.h +++ b/tools/editor/settings_config_dialog.h @@ -40,17 +40,10 @@ class EditorSettingsDialog : public AcceptDialog { - ConfirmationDialog *install_confirm; bool updating; - ConfirmationDialog *plugin_setting; - String plugin_setting_edit; - - RichTextLabel *plugin_description; TabContainer *tabs; - Button *rescan_plugins; - Tree *plugins; LineEdit *search_box; ToolButton *clear_button; SectionedPropertyEditor *property_editor; @@ -60,18 +53,11 @@ class EditorSettingsDialog : public AcceptDialog { virtual void cancel_pressed(); virtual void ok_pressed(); - void _plugin_edited(); - - void _plugin_settings(Object *p_obj,int p_cell,int p_index); void _settings_changed(); void _settings_save(); - void _plugin_install(); - void _notification(int p_what); - void _rescan_plugins(); - void _update_plugins(); void _clear_search_box(); diff --git a/tools/editor/spatial_editor_gizmos.cpp b/tools/editor/spatial_editor_gizmos.cpp index 320b0c3a70..de35672278 100644 --- a/tools/editor/spatial_editor_gizmos.cpp +++ b/tools/editor/spatial_editor_gizmos.cpp @@ -43,7 +43,7 @@ #define HANDLE_HALF_SIZE 0.05 -void SpatialGizmoTool::clear() { +void EditorSpatialGizmo::clear() { for(int i=0;i<instances.size();i++) { @@ -61,7 +61,15 @@ void SpatialGizmoTool::clear() { secondary_handles.clear(); } -void SpatialGizmoTool::Instance::create_instance(Spatial *p_base) { +void EditorSpatialGizmo::redraw() { + + if (get_script_instance() && get_script_instance()->has_method("redraw")) + get_script_instance()->call("redraw"); + + +} + +void EditorSpatialGizmo::Instance::create_instance(Spatial *p_base) { instance = VS::get_singleton()->instance_create2(mesh->get_rid(),p_base->get_world()->get_scenario()); VS::get_singleton()->instance_attach_object_instance_ID(instance,p_base->get_instance_ID()); @@ -80,7 +88,7 @@ void SpatialGizmoTool::Instance::create_instance(Spatial *p_base) { -void SpatialGizmoTool::add_mesh(const Ref<Mesh>& p_mesh,bool p_billboard, const RID &p_skeleton) { +void EditorSpatialGizmo::add_mesh(const Ref<Mesh>& p_mesh,bool p_billboard, const RID &p_skeleton) { ERR_FAIL_COND(!spatial_node); Instance ins; @@ -97,7 +105,7 @@ void SpatialGizmoTool::add_mesh(const Ref<Mesh>& p_mesh,bool p_billboard, const } -void SpatialGizmoTool::add_lines(const Vector<Vector3> &p_lines, const Ref<Material> &p_material,bool p_billboard){ +void EditorSpatialGizmo::add_lines(const Vector<Vector3> &p_lines, const Ref<Material> &p_material,bool p_billboard){ ERR_FAIL_COND(!spatial_node); Instance ins; @@ -150,7 +158,7 @@ void SpatialGizmoTool::add_lines(const Vector<Vector3> &p_lines, const Ref<Mater } -void SpatialGizmoTool::add_unscaled_billboard(const Ref<Material>& p_material,float p_scale) { +void EditorSpatialGizmo::add_unscaled_billboard(const Ref<Material>& p_material,float p_scale) { ERR_FAIL_COND(!spatial_node); Instance ins; @@ -201,12 +209,12 @@ void SpatialGizmoTool::add_unscaled_billboard(const Ref<Material>& p_material,fl } -void SpatialGizmoTool::add_collision_triangles(const Ref<TriangleMesh>& p_tmesh) { +void EditorSpatialGizmo::add_collision_triangles(const Ref<TriangleMesh>& p_tmesh) { collision_mesh=p_tmesh; } -void SpatialGizmoTool::add_collision_segments(const Vector<Vector3> &p_lines) { +void EditorSpatialGizmo::add_collision_segments(const Vector<Vector3> &p_lines) { int from=collision_segments.size(); collision_segments.resize(from+p_lines.size()); @@ -217,7 +225,7 @@ void SpatialGizmoTool::add_collision_segments(const Vector<Vector3> &p_lines) { } -void SpatialGizmoTool::add_handles(const Vector<Vector3> &p_handles, bool p_billboard,bool p_secondary){ +void EditorSpatialGizmo::add_handles(const Vector<Vector3> &p_handles, bool p_billboard,bool p_secondary){ billboard_handle=p_billboard; @@ -354,13 +362,14 @@ void SpatialGizmoTool::add_handles(const Vector<Vector3> &p_handles, bool p_bill } -void SpatialGizmoTool::set_spatial_node(Spatial *p_node){ +void EditorSpatialGizmo::set_spatial_node(Spatial *p_node){ + ERR_FAIL_NULL(p_node); spatial_node=p_node; } -bool SpatialGizmoTool::intersect_frustum(const Camera *p_camera,const Vector<Plane> &p_frustum) { +bool EditorSpatialGizmo::intersect_frustum(const Camera *p_camera,const Vector<Plane> &p_frustum) { ERR_FAIL_COND_V(!spatial_node,false); ERR_FAIL_COND_V(!valid,false); @@ -401,7 +410,7 @@ bool SpatialGizmoTool::intersect_frustum(const Camera *p_camera,const Vector<Pla } -bool SpatialGizmoTool::intersect_ray(const Camera *p_camera,const Point2& p_point, Vector3& r_pos, Vector3& r_normal,int *r_gizmo_handle,bool p_sec_first) { +bool EditorSpatialGizmo::intersect_ray(const Camera *p_camera,const Point2& p_point, Vector3& r_pos, Vector3& r_normal,int *r_gizmo_handle,bool p_sec_first) { ERR_FAIL_COND_V(!spatial_node,false); ERR_FAIL_COND_V(!valid,false); @@ -631,7 +640,7 @@ bool SpatialGizmoTool::intersect_ray(const Camera *p_camera,const Point2& p_poin -void SpatialGizmoTool::create() { +void EditorSpatialGizmo::create() { ERR_FAIL_COND(!spatial_node); ERR_FAIL_COND(valid); @@ -646,7 +655,7 @@ void SpatialGizmoTool::create() { } -void SpatialGizmoTool::transform(){ +void EditorSpatialGizmo::transform(){ ERR_FAIL_COND(!spatial_node); ERR_FAIL_COND(!valid); @@ -657,7 +666,7 @@ void SpatialGizmoTool::transform(){ } -void SpatialGizmoTool::free(){ +void EditorSpatialGizmo::free(){ ERR_FAIL_COND(!spatial_node); ERR_FAIL_COND(!valid); @@ -675,19 +684,39 @@ void SpatialGizmoTool::free(){ } +void EditorSpatialGizmo::_bind_methods() { + + ObjectTypeDB::bind_method(_MD("add_lines","lines","material:Material","billboard"),&EditorSpatialGizmo::add_lines,DEFVAL(false)); + ObjectTypeDB::bind_method(_MD("add_mesh","mesh:Mesh","billboard","skeleton"),&EditorSpatialGizmo::add_mesh,DEFVAL(false),DEFVAL(RID())); + ObjectTypeDB::bind_method(_MD("add_collision_segments","segments"),&EditorSpatialGizmo::add_collision_segments); + ObjectTypeDB::bind_method(_MD("add_collision_triangles","triangles:TriangleMesh"),&EditorSpatialGizmo::add_collision_triangles); + ObjectTypeDB::bind_method(_MD("add_unscaled_billboard","material:Material","default_scale"),&EditorSpatialGizmo::add_unscaled_billboard,DEFVAL(1)); + ObjectTypeDB::bind_method(_MD("add_handles","handles","billboard","secondary"),&EditorSpatialGizmo::add_handles,DEFVAL(false),DEFVAL(false)); + ObjectTypeDB::bind_method(_MD("set_spatial_node","node:Spatial"),&EditorSpatialGizmo::_set_spatial_node); + + BIND_VMETHOD( MethodInfo("redraw")); + BIND_VMETHOD( MethodInfo(Variant::STRING,"get_handle_name",PropertyInfo(Variant::INT,"index"))); + { + BIND_VMETHOD( MethodInfo("get_handle_value:Variant",PropertyInfo(Variant::INT,"index"))); + } + BIND_VMETHOD( MethodInfo("set_handle",PropertyInfo(Variant::INT,"index"),PropertyInfo(Variant::OBJECT,"camera:Camera"),PropertyInfo(Variant::VECTOR2,"point"))); + MethodInfo cm = MethodInfo("commit_handle",PropertyInfo(Variant::INT,"index"),PropertyInfo(Variant::NIL,"restore:Variant"),PropertyInfo(Variant::BOOL,"cancel")); + cm.default_arguments.push_back(false); + BIND_VMETHOD( cm ); +} -SpatialGizmoTool::SpatialGizmoTool() { +EditorSpatialGizmo::EditorSpatialGizmo() { valid=false; billboard_handle=false; } -SpatialGizmoTool::~SpatialGizmoTool(){ +EditorSpatialGizmo::~EditorSpatialGizmo(){ clear(); } -Vector3 SpatialGizmoTool::get_handle_pos(int p_idx) const { +Vector3 EditorSpatialGizmo::get_handle_pos(int p_idx) const { ERR_FAIL_INDEX_V(p_idx,handles.size(),Vector3()); diff --git a/tools/editor/spatial_editor_gizmos.h b/tools/editor/spatial_editor_gizmos.h index 669d3e2380..346e360225 100644 --- a/tools/editor/spatial_editor_gizmos.h +++ b/tools/editor/spatial_editor_gizmos.h @@ -52,9 +52,9 @@ class Camera; -class SpatialGizmoTool : public SpatialEditorGizmo { +class EditorSpatialGizmo : public SpatialEditorGizmo { - OBJ_TYPE(SpatialGizmoTool,SpatialGizmo); + OBJ_TYPE(EditorSpatialGizmo,SpatialGizmo); struct Instance{ @@ -93,6 +93,8 @@ class SpatialGizmoTool : public SpatialEditorGizmo { Spatial *base; Vector<Instance> instances; Spatial *spatial_node; + + void _set_spatial_node(Node *p_node) { set_spatial_node(p_node->cast_to<Spatial>()); } protected: void add_lines(const Vector<Vector3> &p_lines,const Ref<Material>& p_material,bool p_billboard=false); void add_mesh(const Ref<Mesh>& p_mesh,bool p_billboard=false,const RID& p_skeleton=RID()); @@ -103,6 +105,7 @@ protected: void set_spatial_node(Spatial *p_node); + static void _bind_methods(); public: virtual Vector3 get_handle_pos(int p_idx) const; @@ -112,18 +115,18 @@ public: void clear(); void create(); void transform(); - //void redraw(); + virtual void redraw(); void free(); - SpatialGizmoTool(); - ~SpatialGizmoTool(); + EditorSpatialGizmo(); + ~EditorSpatialGizmo(); }; -class LightSpatialGizmo : public SpatialGizmoTool { +class LightSpatialGizmo : public EditorSpatialGizmo { - OBJ_TYPE(LightSpatialGizmo,SpatialGizmoTool); + OBJ_TYPE(LightSpatialGizmo,EditorSpatialGizmo); Light* light; @@ -140,9 +143,9 @@ public: }; -class CameraSpatialGizmo : public SpatialGizmoTool { +class CameraSpatialGizmo : public EditorSpatialGizmo { - OBJ_TYPE(CameraSpatialGizmo,SpatialGizmoTool); + OBJ_TYPE(CameraSpatialGizmo,EditorSpatialGizmo); Camera* camera; @@ -161,9 +164,9 @@ public: -class MeshInstanceSpatialGizmo : public SpatialGizmoTool { +class MeshInstanceSpatialGizmo : public EditorSpatialGizmo { - OBJ_TYPE(MeshInstanceSpatialGizmo,SpatialGizmoTool); + OBJ_TYPE(MeshInstanceSpatialGizmo,EditorSpatialGizmo); MeshInstance* mesh; @@ -174,9 +177,9 @@ public: }; -class Position3DSpatialGizmo : public SpatialGizmoTool { +class Position3DSpatialGizmo : public EditorSpatialGizmo { - OBJ_TYPE(Position3DSpatialGizmo,SpatialGizmoTool); + OBJ_TYPE(Position3DSpatialGizmo,EditorSpatialGizmo); Position3D* p3d; @@ -187,9 +190,9 @@ public: }; -class SkeletonSpatialGizmo : public SpatialGizmoTool { +class SkeletonSpatialGizmo : public EditorSpatialGizmo { - OBJ_TYPE(SkeletonSpatialGizmo,SpatialGizmoTool); + OBJ_TYPE(SkeletonSpatialGizmo,EditorSpatialGizmo); Skeleton* skel; @@ -203,9 +206,9 @@ public: -class SpatialPlayerSpatialGizmo : public SpatialGizmoTool { +class SpatialPlayerSpatialGizmo : public EditorSpatialGizmo { - OBJ_TYPE(SpatialPlayerSpatialGizmo,SpatialGizmoTool); + OBJ_TYPE(SpatialPlayerSpatialGizmo,EditorSpatialGizmo); SpatialPlayer* splayer; @@ -218,9 +221,9 @@ public: -class TestCubeSpatialGizmo : public SpatialGizmoTool { +class TestCubeSpatialGizmo : public EditorSpatialGizmo { - OBJ_TYPE(TestCubeSpatialGizmo,SpatialGizmoTool); + OBJ_TYPE(TestCubeSpatialGizmo,EditorSpatialGizmo); TestCube* tc; @@ -231,9 +234,9 @@ public: }; -class RoomSpatialGizmo : public SpatialGizmoTool { +class RoomSpatialGizmo : public EditorSpatialGizmo { - OBJ_TYPE(RoomSpatialGizmo,SpatialGizmoTool); + OBJ_TYPE(RoomSpatialGizmo,EditorSpatialGizmo); struct _EdgeKey { @@ -256,9 +259,9 @@ public: }; -class PortalSpatialGizmo : public SpatialGizmoTool { +class PortalSpatialGizmo : public EditorSpatialGizmo { - OBJ_TYPE(PortalSpatialGizmo,SpatialGizmoTool); + OBJ_TYPE(PortalSpatialGizmo,EditorSpatialGizmo); Portal* portal; @@ -270,9 +273,9 @@ public: }; -class VisibilityNotifierGizmo : public SpatialGizmoTool { +class VisibilityNotifierGizmo : public EditorSpatialGizmo { - OBJ_TYPE(VisibilityNotifierGizmo ,SpatialGizmoTool); + OBJ_TYPE(VisibilityNotifierGizmo ,EditorSpatialGizmo); VisibilityNotifier* notifier; @@ -291,9 +294,9 @@ public: -class CollisionShapeSpatialGizmo : public SpatialGizmoTool { +class CollisionShapeSpatialGizmo : public EditorSpatialGizmo { - OBJ_TYPE(CollisionShapeSpatialGizmo,SpatialGizmoTool); + OBJ_TYPE(CollisionShapeSpatialGizmo,EditorSpatialGizmo); CollisionShape* cs; @@ -308,9 +311,9 @@ public: }; -class CollisionPolygonSpatialGizmo : public SpatialGizmoTool { +class CollisionPolygonSpatialGizmo : public EditorSpatialGizmo { - OBJ_TYPE(CollisionPolygonSpatialGizmo,SpatialGizmoTool); + OBJ_TYPE(CollisionPolygonSpatialGizmo,EditorSpatialGizmo); CollisionPolygon* polygon; @@ -322,9 +325,9 @@ public: }; -class RayCastSpatialGizmo : public SpatialGizmoTool { +class RayCastSpatialGizmo : public EditorSpatialGizmo { - OBJ_TYPE(RayCastSpatialGizmo,SpatialGizmoTool); + OBJ_TYPE(RayCastSpatialGizmo,EditorSpatialGizmo); RayCast* raycast; @@ -337,9 +340,9 @@ public: -class VehicleWheelSpatialGizmo : public SpatialGizmoTool { +class VehicleWheelSpatialGizmo : public EditorSpatialGizmo { - OBJ_TYPE(VehicleWheelSpatialGizmo,SpatialGizmoTool); + OBJ_TYPE(VehicleWheelSpatialGizmo,EditorSpatialGizmo); VehicleWheel* car_wheel; @@ -351,9 +354,9 @@ public: }; -class NavigationMeshSpatialGizmo : public SpatialGizmoTool { +class NavigationMeshSpatialGizmo : public EditorSpatialGizmo { - OBJ_TYPE(NavigationMeshSpatialGizmo,SpatialGizmoTool); + OBJ_TYPE(NavigationMeshSpatialGizmo,EditorSpatialGizmo); struct _EdgeKey { @@ -376,9 +379,9 @@ public: }; -class PinJointSpatialGizmo : public SpatialGizmoTool { +class PinJointSpatialGizmo : public EditorSpatialGizmo { - OBJ_TYPE(PinJointSpatialGizmo,SpatialGizmoTool); + OBJ_TYPE(PinJointSpatialGizmo,EditorSpatialGizmo); PinJoint* p3d; @@ -390,9 +393,9 @@ public: }; -class HingeJointSpatialGizmo : public SpatialGizmoTool { +class HingeJointSpatialGizmo : public EditorSpatialGizmo { - OBJ_TYPE(HingeJointSpatialGizmo,SpatialGizmoTool); + OBJ_TYPE(HingeJointSpatialGizmo,EditorSpatialGizmo); HingeJoint* p3d; @@ -403,9 +406,9 @@ public: }; -class SliderJointSpatialGizmo : public SpatialGizmoTool { +class SliderJointSpatialGizmo : public EditorSpatialGizmo { - OBJ_TYPE(SliderJointSpatialGizmo,SpatialGizmoTool); + OBJ_TYPE(SliderJointSpatialGizmo,EditorSpatialGizmo); SliderJoint* p3d; @@ -416,9 +419,9 @@ public: }; -class ConeTwistJointSpatialGizmo : public SpatialGizmoTool { +class ConeTwistJointSpatialGizmo : public EditorSpatialGizmo { - OBJ_TYPE(ConeTwistJointSpatialGizmo,SpatialGizmoTool); + OBJ_TYPE(ConeTwistJointSpatialGizmo,EditorSpatialGizmo); ConeTwistJoint* p3d; @@ -430,9 +433,9 @@ public: }; -class Generic6DOFJointSpatialGizmo : public SpatialGizmoTool { +class Generic6DOFJointSpatialGizmo : public EditorSpatialGizmo { - OBJ_TYPE(Generic6DOFJointSpatialGizmo,SpatialGizmoTool); + OBJ_TYPE(Generic6DOFJointSpatialGizmo,EditorSpatialGizmo); Generic6DOFJoint* p3d; |