1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-07 12:30:27 +00:00

-Added bindings to the resource filesystem for editor

-Added set_child_rect, which was unavailable for script
This commit is contained in:
Juan Linietsky
2016-09-10 17:34:27 -03:00
parent 2da3aaefc2
commit 65b93d177e
7 changed files with 222 additions and 6 deletions

View File

@@ -2221,6 +2221,12 @@
Register a [LineEdit] in the dialog. When the enter key is pressed, the dialog will be accepted. Register a [LineEdit] in the dialog. When the enter key is pressed, the dialog will be accepted.
</description> </description>
</method> </method>
<method name="set_child_rect">
<argument index="0" name="child" type="Control">
</argument>
<description>
</description>
</method>
<method name="set_hide_on_ok"> <method name="set_hide_on_ok">
<argument index="0" name="enabled" type="bool"> <argument index="0" name="enabled" type="bool">
</argument> </argument>
@@ -11261,6 +11267,184 @@
</constant> </constant>
</constants> </constants>
</class> </class>
<class name="EditorFileSystem" inherits="Node" category="Core">
<brief_description>
Resource filesystem, as the editor sees it.
</brief_description>
<description>
This object holds information of all resources in the filesystem, their types, etc.
</description>
<methods>
<method name="get_file_type" qualifiers="const">
<return type="String">
</return>
<argument index="0" name="path" type="String">
</argument>
<description>
Get the type of the file, given the full path.
</description>
</method>
<method name="get_filesystem">
<return type="EditorFileSystemDirectory">
</return>
<description>
Get the root directory object.
</description>
</method>
<method name="get_path">
<return type="EditorFileSystemDirectory">
</return>
<argument index="0" name="path" type="String">
</argument>
<description>
</description>
</method>
<method name="get_scanning_progress" qualifiers="const">
<return type="float">
</return>
<description>
Return the scan progress for 0 to 1 if the FS is being scanned.
</description>
</method>
<method name="is_scanning" qualifiers="const">
<return type="bool">
</return>
<description>
Return true of the filesystem is being scanned.
</description>
</method>
<method name="scan">
<description>
Scan the filesystem for changes.
</description>
</method>
<method name="scan_sources">
<description>
Check if the source of any imported resource changed.
</description>
</method>
<method name="update_file">
<argument index="0" name="path" type="String">
</argument>
<description>
Update a file information. Call this if an external program (not Godot) modified the file.
</description>
</method>
</methods>
<signals>
<signal name="filesystem_changed">
<description>
Emitted if the filesystem changed.
</description>
</signal>
<signal name="sources_changed">
<argument index="0" name="exist" type="bool">
</argument>
<description>
Emitted if the source of any imported file changed.
</description>
</signal>
</signals>
<constants>
</constants>
</class>
<class name="EditorFileSystemDirectory" inherits="Object" category="Core">
<brief_description>
A diretory for the resource filesystem.
</brief_description>
<description>
</description>
<methods>
<method name="find_dir_index" qualifiers="const">
<return type="int">
</return>
<argument index="0" name="name" type="String">
</argument>
<description>
</description>
</method>
<method name="find_file_index" qualifiers="const">
<return type="int">
</return>
<argument index="0" name="name" type="String">
</argument>
<description>
</description>
</method>
<method name="get_file" qualifiers="const">
<return type="String">
</return>
<argument index="0" name="idx" type="int">
</argument>
<description>
</description>
</method>
<method name="get_file_count" qualifiers="const">
<return type="int">
</return>
<description>
</description>
</method>
<method name="get_file_path" qualifiers="const">
<return type="String">
</return>
<argument index="0" name="idx" type="int">
</argument>
<description>
</description>
</method>
<method name="get_file_type" qualifiers="const">
<return type="String">
</return>
<argument index="0" name="idx" type="int">
</argument>
<description>
</description>
</method>
<method name="get_name">
<return type="String">
</return>
<description>
</description>
</method>
<method name="get_parent">
<return type="EditorFileSystemDirectory">
</return>
<description>
</description>
</method>
<method name="get_path" qualifiers="const">
<return type="String">
</return>
<description>
</description>
</method>
<method name="get_subdir">
<return type="Object">
</return>
<argument index="0" name="idx" type="int">
</argument>
<description>
</description>
</method>
<method name="get_subdir_count" qualifiers="const">
<return type="int">
</return>
<description>
</description>
</method>
<method name="is_missing_sources" qualifiers="const">
<return type="bool">
</return>
<argument index="0" name="idx" type="int">
</argument>
<description>
</description>
</method>
</methods>
<constants>
</constants>
</class>
<class name="EditorImportPlugin" inherits="Reference" category="Core"> <class name="EditorImportPlugin" inherits="Reference" category="Core">
<brief_description> <brief_description>
Import plugin for editor Import plugin for editor
@@ -11520,6 +11704,13 @@
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). 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> </description>
</method> </method>
<method name="get_resource_filesystem">
<return type="EditorFileSystem">
</return>
<description>
Get the filesystem cache for all resources in the project.
</description>
</method>
<method name="get_resource_previewer"> <method name="get_resource_previewer">
<return type="EditorResourcePreview"> <return type="EditorResourcePreview">
</return> </return>

View File

@@ -368,6 +368,7 @@ void AcceptDialog::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_custom_action"),&AcceptDialog::_custom_action); ObjectTypeDB::bind_method(_MD("_custom_action"),&AcceptDialog::_custom_action);
ObjectTypeDB::bind_method(_MD("set_text","text"),&AcceptDialog::set_text); ObjectTypeDB::bind_method(_MD("set_text","text"),&AcceptDialog::set_text);
ObjectTypeDB::bind_method(_MD("get_text"),&AcceptDialog::get_text); ObjectTypeDB::bind_method(_MD("get_text"),&AcceptDialog::get_text);
ObjectTypeDB::bind_method(_MD("set_child_rect","child:Control"),&AcceptDialog::set_child_rect);
ADD_SIGNAL( MethodInfo("confirmed") ); ADD_SIGNAL( MethodInfo("confirmed") );
ADD_SIGNAL( MethodInfo("custom_action",PropertyInfo(Variant::STRING,"action")) ); ADD_SIGNAL( MethodInfo("custom_action",PropertyInfo(Variant::STRING,"action")) );

View File

@@ -208,10 +208,14 @@ void EditorFileSystemDirectory::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_file_count"),&EditorFileSystemDirectory::get_file_count); ObjectTypeDB::bind_method(_MD("get_file_count"),&EditorFileSystemDirectory::get_file_count);
ObjectTypeDB::bind_method(_MD("get_file","idx"),&EditorFileSystemDirectory::get_file); ObjectTypeDB::bind_method(_MD("get_file","idx"),&EditorFileSystemDirectory::get_file);
ObjectTypeDB::bind_method(_MD("get_file_path","idx"),&EditorFileSystemDirectory::get_file_path); ObjectTypeDB::bind_method(_MD("get_file_path","idx"),&EditorFileSystemDirectory::get_file_path);
ObjectTypeDB::bind_method(_MD("get_file_types","idx"),&EditorFileSystemDirectory::get_file_type); ObjectTypeDB::bind_method(_MD("get_file_type","idx"),&EditorFileSystemDirectory::get_file_type);
ObjectTypeDB::bind_method(_MD("is_missing_sources","idx"),&EditorFileSystemDirectory::is_missing_sources); ObjectTypeDB::bind_method(_MD("is_missing_sources","idx"),&EditorFileSystemDirectory::is_missing_sources);
ObjectTypeDB::bind_method(_MD("get_name"),&EditorFileSystemDirectory::get_name); ObjectTypeDB::bind_method(_MD("get_name"),&EditorFileSystemDirectory::get_name);
ObjectTypeDB::bind_method(_MD("get_parent"),&EditorFileSystemDirectory::get_parent); ObjectTypeDB::bind_method(_MD("get_path"),&EditorFileSystemDirectory::get_path);
ObjectTypeDB::bind_method(_MD("get_parent:EditorFileSystemDirectory"),&EditorFileSystemDirectory::get_parent);
ObjectTypeDB::bind_method(_MD("find_file_index","name"),&EditorFileSystemDirectory::find_file_index);
ObjectTypeDB::bind_method(_MD("find_dir_index","name"),&EditorFileSystemDirectory::find_dir_index);
} }
@@ -1341,6 +1345,16 @@ void EditorFileSystem::update_file(const String& p_file) {
void EditorFileSystem::_bind_methods() { void EditorFileSystem::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_filesystem:EditorFileSystemDirectory"),&EditorFileSystem::get_filesystem);
ObjectTypeDB::bind_method(_MD("is_scanning"),&EditorFileSystem::is_scanning);
ObjectTypeDB::bind_method(_MD("get_scanning_progress"),&EditorFileSystem::get_scanning_progress);
ObjectTypeDB::bind_method(_MD("scan"),&EditorFileSystem::scan);
ObjectTypeDB::bind_method(_MD("scan_sources"),&EditorFileSystem::scan_sources);
ObjectTypeDB::bind_method(_MD("update_file","path"),&EditorFileSystem::update_file);
ObjectTypeDB::bind_method(_MD("get_path:EditorFileSystemDirectory","path"),&EditorFileSystem::get_path);
ObjectTypeDB::bind_method(_MD("get_file_type","path"),&EditorFileSystem::get_file_type);
ADD_SIGNAL( MethodInfo("filesystem_changed") ); ADD_SIGNAL( MethodInfo("filesystem_changed") );
ADD_SIGNAL( MethodInfo("sources_changed",PropertyInfo(Variant::BOOL,"exist")) ); ADD_SIGNAL( MethodInfo("sources_changed",PropertyInfo(Variant::BOOL,"exist")) );

View File

@@ -4141,6 +4141,9 @@ void EditorNode::register_editor_types() {
ObjectTypeDB::register_type<EditorSpatialGizmo>(); ObjectTypeDB::register_type<EditorSpatialGizmo>();
ObjectTypeDB::register_type<EditorResourcePreview>(); ObjectTypeDB::register_type<EditorResourcePreview>();
ObjectTypeDB::register_type<EditorResourcePreviewGenerator>(); ObjectTypeDB::register_type<EditorResourcePreviewGenerator>();
ObjectTypeDB::register_type<EditorFileSystem>();
ObjectTypeDB::register_type<EditorFileSystemDirectory>();
//ObjectTypeDB::register_type<EditorImporter>(); //ObjectTypeDB::register_type<EditorImporter>();

View File

@@ -320,6 +320,10 @@ void EditorPlugin::inspect_object(Object *p_obj,const String& p_for_property) {
EditorNode::get_singleton()->push_item(p_obj,p_for_property); EditorNode::get_singleton()->push_item(p_obj,p_for_property);
} }
EditorFileSystem *EditorPlugin::get_resource_file_system() {
return EditorFileSystem::get_singleton();
}
void EditorPlugin::_bind_methods() { 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_container","container","control:Control"),&EditorPlugin::add_control_to_container);
@@ -337,6 +341,7 @@ void EditorPlugin::_bind_methods() {
ObjectTypeDB::bind_method(_MD("remove_export_plugin","plugin:EditorExportPlugin"),&EditorPlugin::remove_export_plugin); ObjectTypeDB::bind_method(_MD("remove_export_plugin","plugin:EditorExportPlugin"),&EditorPlugin::remove_export_plugin);
ObjectTypeDB::bind_method(_MD("get_resource_previewer:EditorResourcePreview"),&EditorPlugin::get_resource_previewer); ObjectTypeDB::bind_method(_MD("get_resource_previewer:EditorResourcePreview"),&EditorPlugin::get_resource_previewer);
ObjectTypeDB::bind_method(_MD("get_resource_filesystem:EditorFileSystem"),&EditorPlugin::get_resource_file_system);
ObjectTypeDB::bind_method(_MD("inspect_object","object","for_property"),&EditorPlugin::inspect_object,DEFVAL(String())); ObjectTypeDB::bind_method(_MD("inspect_object","object","for_property"),&EditorPlugin::inspect_object,DEFVAL(String()));
ObjectTypeDB::bind_method(_MD("update_canvas"),&EditorPlugin::update_canvas); ObjectTypeDB::bind_method(_MD("update_canvas"),&EditorPlugin::update_canvas);

View File

@@ -49,6 +49,7 @@ class SpatialEditorGizmo;
class EditorImportPlugin; class EditorImportPlugin;
class EditorExportPlugin; class EditorExportPlugin;
class EditorResourcePreview; class EditorResourcePreview;
class EditorFileSystem;
class EditorPlugin : public Node { class EditorPlugin : public Node {
@@ -139,6 +140,7 @@ public:
//EditorImportExport *get_import_export(); //EditorImportExport *get_import_export();
EditorSettings *get_editor_settings(); EditorSettings *get_editor_settings();
EditorResourcePreview *get_resource_previewer(); EditorResourcePreview *get_resource_previewer();
EditorFileSystem *get_resource_file_system();
virtual void restore_global_state(); virtual void restore_global_state();
virtual void save_global_state(); virtual void save_global_state();

View File

@@ -3470,7 +3470,7 @@ void SpatialEditor::_unhandled_key_input(InputEvent p_event) {
return; return;
#if 0 #if 0
//i don't remember this being used //i don't remember this being used, why was it here?
{ {
EditorNode *en = editor; EditorNode *en = editor;