summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/docdump/makemd.py345
-rw-r--r--tools/editor/editor_import_export.cpp94
-rw-r--r--tools/editor/editor_import_export.h20
-rw-r--r--tools/editor/editor_node.cpp2
-rw-r--r--tools/editor/io_plugins/editor_texture_import_plugin.cpp53
-rw-r--r--tools/editor/io_plugins/editor_texture_import_plugin.h10
-rw-r--r--tools/script_plugins/terrain/plugin.cfg16
-rw-r--r--tools/script_plugins/terrain/terrain.gd17
-rw-r--r--tools/script_plugins/terrain/terrain.pngbin0 -> 762 bytes
-rw-r--r--tools/script_plugins/terrain/terrain_node.gd3
-rw-r--r--tools/script_plugins/time/plugin.cfg14
-rw-r--r--tools/script_plugins/time/time.gd32
12 files changed, 569 insertions, 37 deletions
diff --git a/tools/docdump/makemd.py b/tools/docdump/makemd.py
new file mode 100644
index 0000000000..7cc2e9dc4b
--- /dev/null
+++ b/tools/docdump/makemd.py
@@ -0,0 +1,345 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+import sys
+import xml.etree.ElementTree as ET
+
+input_list = []
+
+for arg in sys.argv[1:]:
+ input_list.append(arg)
+
+if len(input_list) < 1:
+ print 'usage: makedoku.py <class_list.xml>'
+ sys.exit(0)
+
+
+def validate_tag(elem, tag):
+ if elem.tag != tag:
+ print "Tag mismatch, expected '" + tag + "', got " + elem.tag
+ sys.exit(255)
+
+
+class_names = []
+classes = {}
+
+
+def make_class_list(class_list, columns):
+
+ f = open('class_list.md', 'wb')
+ prev = 0
+ col_max = len(class_list) / columns + 1
+ print ('col max is ', col_max)
+ col_count = 0
+ row_count = 0
+ last_initial = ''
+ fit_columns = []
+
+ for n in range(0, columns):
+ fit_columns += [[]]
+
+ indexers = []
+ last_initial = ''
+
+ idx = 0
+ for n in class_list:
+ col = idx / col_max
+ if col >= columns:
+ col = columns - 1
+ fit_columns[col] += [n]
+ idx += 1
+ if n[:1] != last_initial:
+ indexers += [n]
+ last_initial = n[:1]
+
+ row_max = 0
+ f.write("\n")
+
+ for n in range(0, columns):
+ if len(fit_columns[n]) > row_max:
+ row_max = len(fit_columns[n])
+
+ f.write("| ")
+ for n in range(0, columns):
+ f.write(" | |")
+
+ f.write("\n")
+ f.write("| ")
+ for n in range(0, columns):
+ f.write(" --- | ------- |")
+ f.write("\n")
+
+ for r in range(0, row_max):
+ s = '| '
+ for c in range(0, columns):
+ if r >= len(fit_columns[c]):
+ continue
+
+ classname = fit_columns[c][r]
+ initial = classname[0]
+ if classname in indexers:
+ s += '**' + initial + '** | '
+ else:
+ s += ' | '
+
+ s += '[' + classname + '](class_'+ classname.lower()+') | '
+
+ s += '\n'
+ f.write(s)
+
+
+def dokuize_text(txt):
+
+ return txt
+
+
+def dokuize_text(text):
+ pos = 0
+ while True:
+ pos = text.find('[', pos)
+ if pos == -1:
+ break
+
+ endq_pos = text.find(']', pos + 1)
+ if endq_pos == -1:
+ break
+
+ pre_text = text[:pos]
+ post_text = text[endq_pos + 1:]
+ tag_text = text[pos + 1:endq_pos]
+
+ if tag_text in class_names:
+ tag_text = make_type(tag_text)
+ else:
+
+ # command
+
+ cmd = tag_text
+ space_pos = tag_text.find(' ')
+ if cmd.find('html') == 0:
+ cmd = tag_text[:space_pos]
+ param = tag_text[space_pos + 1:]
+ tag_text = '<' + param + '>'
+ elif cmd.find('method') == 0:
+ cmd = tag_text[:space_pos]
+ param = tag_text[space_pos + 1:]
+
+ if param.find('.') != -1:
+ (class_param, method_param) = param.split('.')
+ tag_text = '['+class_param+'.'+method_param.replace("_","&#95;")+'](' + class_param.lower() + '#' \
+ + method_param + ')'
+ else:
+ tag_text = '[' + param.replace("_","&#95;") + '](#' + param + ')'
+ elif cmd.find('image=') == 0:
+ tag_text = '![](' + cmd[6:] + ')'
+ elif cmd.find('url=') == 0:
+ tag_text = '[' + cmd[4:] + ']('+cmd[4:]
+ elif cmd == '/url':
+ tag_text = ')'
+ elif cmd == 'center':
+ tag_text = ''
+ elif cmd == '/center':
+ tag_text = ''
+ elif cmd == 'br':
+ tag_text = '\n'
+ elif cmd == 'i' or cmd == '/i':
+ tag_text = '_'
+ elif cmd == 'b' or cmd == '/b':
+ tag_text = '**'
+ elif cmd == 'u' or cmd == '/u':
+ tag_text = '__'
+ else:
+ tag_text = '[' + tag_text + ']'
+
+ text = pre_text + tag_text + post_text
+ pos = len(pre_text) + len(tag_text)
+
+ # tnode = ET.SubElement(parent,"div")
+ # tnode.text=text
+
+ return text
+
+
+def make_type(t):
+ global class_names
+ if t in class_names:
+ return '[' + t + '](class_' + t.lower() + ')'
+ return t
+
+
+def make_method(
+ f,
+ name,
+ m,
+ declare,
+ event=False,
+ ):
+
+ s = ' * '
+ ret_type = 'void'
+ args = list(m)
+ mdata = {}
+ mdata['argidx'] = []
+ for a in args:
+ if a.tag == 'return':
+ idx = -1
+ elif a.tag == 'argument':
+ idx = int(a.attrib['index'])
+ else:
+ continue
+
+ mdata['argidx'].append(idx)
+ mdata[idx] = a
+
+ if not event:
+ if -1 in mdata['argidx']:
+ s += make_type(mdata[-1].attrib['type'])
+ else:
+ s += 'void'
+ s += ' '
+
+ if declare:
+
+ # span.attrib["class"]="funcdecl"
+ # a=ET.SubElement(span,"a")
+ # a.attrib["name"]=name+"_"+m.attrib["name"]
+ # a.text=name+"::"+m.attrib["name"]
+
+ s += ' **'+m.attrib['name'].replace("_","&#95;")+'** '
+ else:
+ s += ' **['+ m.attrib['name'].replace("_","&#95;")+'](#' + m.attrib['name'] + ')** '
+
+ s += ' **(**'
+ argfound = False
+ for a in mdata['argidx']:
+ arg = mdata[a]
+ if a < 0:
+ continue
+ if a > 0:
+ s += ', '
+ else:
+ s += ' '
+
+ s += make_type(arg.attrib['type'])
+ if 'name' in arg.attrib:
+ s += ' ' + arg.attrib['name']
+ else:
+ s += ' arg' + str(a)
+
+ if 'default' in arg.attrib:
+ s += '=' + arg.attrib['default']
+
+ argfound = True
+
+ if argfound:
+ s += ' '
+ s += ' **)**'
+
+ if 'qualifiers' in m.attrib:
+ s += ' ' + m.attrib['qualifiers']
+
+ f.write(s + '\n')
+
+
+def make_doku_class(node):
+
+ name = node.attrib['name']
+
+ f = open("class_"+name.lower() + '.md', 'wb')
+
+ f.write('# ' + name + ' \n')
+
+ if 'inherits' in node.attrib:
+ inh = node.attrib['inherits'].strip()
+ f.write('####**Inherits:** '+make_type(inh)+'\n')
+ if 'category' in node.attrib:
+ f.write('####**Category:** ' + node.attrib['category'].strip()
+ + '\n')
+
+ briefd = node.find('brief_description')
+ if briefd != None:
+ f.write('\n### Brief Description \n')
+ f.write(dokuize_text(briefd.text.strip()) + '\n')
+
+ methods = node.find('methods')
+
+ if methods != None and len(list(methods)) > 0:
+ f.write('\n### Member Functions \n')
+ for m in list(methods):
+ make_method(f, node.attrib['name'], m, False)
+
+ events = node.find('signals')
+ if events != None and len(list(events)) > 0:
+ f.write('\n### Signals \n')
+ for m in list(events):
+ make_method(f, node.attrib['name'], m, True, True)
+
+ members = node.find('members')
+
+ if members != None and len(list(members)) > 0:
+ f.write('\n### Member Variables \n')
+
+ for c in list(members):
+ s = ' * '
+ s += make_type(c.attrib['type']) + ' '
+ s += '**' + c.attrib['name'] + '**'
+ if c.text.strip() != '':
+ s += ' - ' + c.text.strip()
+ f.write(s + '\n')
+
+ constants = node.find('constants')
+ if constants != None and len(list(constants)) > 0:
+ f.write('\n### Numeric Constants \n')
+ for c in list(constants):
+ s = ' * '
+ s += '**' + c.attrib['name'] + '**'
+ if 'value' in c.attrib:
+ s += ' = **' + c.attrib['value'] + '**'
+ if c.text.strip() != '':
+ s += ' - ' + c.text.strip()
+ f.write(s + '\n')
+
+ descr = node.find('description')
+ if descr != None and descr.text.strip() != '':
+ f.write('\n### Description \n')
+ f.write(dokuize_text(descr.text.strip()) + '\n')
+
+ methods = node.find('methods')
+
+ if methods != None and len(list(methods)) > 0:
+ f.write('\n### Member Function Description \n')
+ for m in list(methods):
+
+ d = m.find('description')
+ if d == None or d.text.strip() == '':
+ continue
+ f.write('\n#### <a name="'+m.attrib['name']+'">' + m.attrib['name'] + '</a>\n')
+ make_method(f, node.attrib['name'], m, True)
+ f.write('\n')
+ f.write(dokuize_text(d.text.strip()))
+ f.write('\n')
+
+
+for file in input_list:
+ tree = ET.parse(file)
+ doc = tree.getroot()
+
+ if 'version' not in doc.attrib:
+ print "Version missing from 'doc'"
+ sys.exit(255)
+
+ version = doc.attrib['version']
+
+ for c in list(doc):
+ if c.attrib['name'] in class_names:
+ continue
+ class_names.append(c.attrib['name'])
+ classes[c.attrib['name']] = c
+
+class_names.sort()
+
+make_class_list(class_names, 3)
+
+for cn in class_names:
+ c = classes[cn]
+ make_doku_class(c)
+
diff --git a/tools/editor/editor_import_export.cpp b/tools/editor/editor_import_export.cpp
index 87d3e17694..22b611fdcc 100644
--- a/tools/editor/editor_import_export.cpp
+++ b/tools/editor/editor_import_export.cpp
@@ -124,6 +124,40 @@ EditorImportPlugin::EditorImportPlugin() {
/////////////////////////////////////////////////////////////////////////////////////////////////////
+void EditorExportPlugin::_bind_methods() {
+
+ BIND_VMETHOD( MethodInfo("custom_export:Dictionary",PropertyInfo(Variant::STRING,"name",PROPERTY_HINT_RESOURCE_TYPE,"EditorExportPlatformPC")) );
+}
+
+
+Vector<uint8_t> EditorExportPlugin::custom_export(String& p_path,const Ref<EditorExportPlatform> &p_platform) {
+
+ if (get_script_instance()) {
+
+ Variant d = get_script_instance()->call("custom_export",p_path,p_platform);
+ if (d.get_type()==Variant::NIL)
+ return Vector<uint8_t>();
+ 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>());
+ ERR_FAIL_COND_V(!dict.has("data"),Vector<uint8_t>());
+ p_path=dict["name"];
+ return dict["data"];
+ }
+
+ return Vector<uint8_t>();
+
+}
+
+
+EditorExportPlugin::EditorExportPlugin() {
+
+
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////////////////
+
+
static void _add_to_list(EditorFileSystemDirectory *p_efsd,Set<StringName>& r_list) {
for(int i=0;i<p_efsd->get_subdir_count();i++) {
@@ -223,48 +257,17 @@ static void _add_filter_to_list(Set<StringName>& r_list,const String& p_filter)
Vector<uint8_t> EditorExportPlatform::get_exported_file(String& p_fname) const {
+ Ref<EditorExportPlatform> ep=EditorImportExport::get_singleton()->get_export_platform(get_name());
- Ref<ResourceImportMetadata> rimd = ResourceLoader::load_import_metadata(p_fname);
+ for(int i=0;i<EditorImportExport::get_singleton()->get_export_plugin_count();i++) {
- if (rimd.is_valid()) {
+ Vector<uint8_t> data = EditorImportExport::get_singleton()->get_export_plugin(i)->custom_export(p_fname,ep);
+ if (data.size())
+ return data;
- if (rimd->get_editor()!="") {
- Ref<EditorImportPlugin> pl = EditorImportExport::get_singleton()->get_import_plugin_by_name(rimd->get_editor());
- if (pl.is_valid()) {
- Vector<uint8_t> ce = pl->custom_export(p_fname,EditorImportExport::get_singleton()->get_export_platform(get_name()));
- if (ce.size())
- return ce;
- }
- }
- } else if (EditorImportExport::get_singleton()->image_get_export_group(p_fname)) {
-
-
- Ref<EditorImportPlugin> pl = EditorImportExport::get_singleton()->get_import_plugin_by_name("texture_2d");
- if (pl.is_valid()) {
- Vector<uint8_t> ce = pl->custom_export(p_fname,EditorImportExport::get_singleton()->get_export_platform(get_name()));
- if (ce.size()) {
- p_fname=p_fname.basename()+".tex";
- return ce;
- }
- }
-
- } else if (EditorImportExport::get_singleton()->get_export_image_action()!=EditorImportExport::IMAGE_ACTION_NONE){
-
- String xt = p_fname.extension().to_lower();
- print_line("TRY FOR: "+p_fname);
- if (EditorImportExport::get_singleton()->get_image_formats().has(xt)) { //should check for more I guess?
-
- Ref<EditorImportPlugin> pl = EditorImportExport::get_singleton()->get_import_plugin_by_name("texture_2d");
- if (pl.is_valid()) {
- Vector<uint8_t> ce = pl->custom_export(p_fname,EditorImportExport::get_singleton()->get_export_platform(get_name()));
- if (ce.size()) {
- p_fname=p_fname.basename()+".tex";
- return ce;
- }
- }
- }
}
+
FileAccess *f = FileAccess::open(p_fname,FileAccess::READ);
ERR_FAIL_COND_V(!f,Vector<uint8_t>());
Vector<uint8_t> ret;
@@ -1061,12 +1064,29 @@ Ref<EditorImportPlugin> EditorImportExport::get_import_plugin(int p_idx) const{
return plugins[p_idx];
}
+
+
+
Ref<EditorImportPlugin> EditorImportExport::get_import_plugin_by_name(const String& p_string) const{
ERR_FAIL_COND_V( !by_idx.has(p_string), Ref<EditorImportPlugin>());
return plugins[ by_idx[p_string] ];
}
+void EditorImportExport::add_export_plugin(const Ref<EditorExportPlugin>& p_plugin) {
+
+ export_plugins.push_back(p_plugin);
+}
+
+int EditorImportExport::get_export_plugin_count() const{
+
+ return export_plugins.size();
+}
+Ref<EditorExportPlugin> EditorImportExport::get_export_plugin(int p_idx) const{
+
+ ERR_FAIL_INDEX_V(p_idx,export_plugins.size(),Ref<EditorExportPlugin>());
+ return export_plugins[p_idx];
+}
void EditorImportExport::set_export_file_action(const StringName& p_file, FileAction p_action) {
diff --git a/tools/editor/editor_import_export.h b/tools/editor/editor_import_export.h
index 1e5e733921..17f2592ad5 100644
--- a/tools/editor/editor_import_export.h
+++ b/tools/editor/editor_import_export.h
@@ -36,6 +36,7 @@
class EditorExportPlatform;
class FileAccess;
class EditorProgress;
+
class EditorImportPlugin : public Reference {
OBJ_TYPE( EditorImportPlugin, Reference);
@@ -59,6 +60,20 @@ public:
EditorImportPlugin();
};
+class EditorExportPlugin : public Reference {
+
+ OBJ_TYPE( EditorExportPlugin, Reference);
+
+protected:
+ static void _bind_methods();
+
+public:
+
+ virtual Vector<uint8_t> custom_export(String& p_path,const Ref<EditorExportPlatform> &p_platform);
+
+ EditorExportPlugin();
+};
+
class EditorExportPlatform : public Reference {
OBJ_TYPE( EditorExportPlatform,Reference );
@@ -223,6 +238,7 @@ protected:
int shrink;
};
+ Vector<Ref<EditorExportPlugin> > export_plugins;
Vector<Ref<EditorImportPlugin> > plugins;
Map<String,int> by_idx;
ImageAction image_action;
@@ -249,6 +265,10 @@ public:
Ref<EditorImportPlugin> get_import_plugin(int p_idx) const;
Ref<EditorImportPlugin> get_import_plugin_by_name(const String& p_string) const;
+ void add_export_plugin(const Ref<EditorExportPlugin>& p_plugin);
+ int get_export_plugin_count() const;
+ Ref<EditorExportPlugin> get_export_plugin(int p_idx) const;
+
bool poll_export_platforms();
void set_export_file_action(const StringName& p_export_file, FileAction p_action);
diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp
index 33b2e72d62..ae350e3b99 100644
--- a/tools/editor/editor_node.cpp
+++ b/tools/editor/editor_node.cpp
@@ -4006,10 +4006,12 @@ EditorNode::EditorNode() {
editor_import_export->add_import_plugin( Ref<EditorSampleImportPlugin>( memnew(EditorSampleImportPlugin(this))));
editor_import_export->add_import_plugin( Ref<EditorTranslationImportPlugin>( memnew(EditorTranslationImportPlugin(this))));
+
for(int i=0;i<editor_import_export->get_import_plugin_count();i++) {
import_menu->get_popup()->add_item(editor_import_export->get_import_plugin(i)->get_visible_name(),IMPORT_PLUGIN_BASE+i);
}
+ editor_import_export->add_export_plugin( Ref<EditorTextureExportPlugin>( memnew(EditorTextureExportPlugin)));
add_editor_plugin( memnew( CanvasItemEditorPlugin(this) ) );
add_editor_plugin( memnew( SpatialEditorPlugin(this) ) );
diff --git a/tools/editor/io_plugins/editor_texture_import_plugin.cpp b/tools/editor/io_plugins/editor_texture_import_plugin.cpp
index 2e6e755136..067edee5a0 100644
--- a/tools/editor/io_plugins/editor_texture_import_plugin.cpp
+++ b/tools/editor/io_plugins/editor_texture_import_plugin.cpp
@@ -1190,3 +1190,56 @@ EditorTextureImportPlugin::EditorTextureImportPlugin(EditorNode *p_editor, Mode
editor->get_gui_base()->add_child(dialog);
}
+
+////////////////////////////
+
+
+ Vector<uint8_t> EditorTextureExportPlugin::custom_export(String& p_path,const Ref<EditorExportPlatform> &p_platform) {
+
+ Ref<ResourceImportMetadata> rimd = ResourceLoader::load_import_metadata(p_path);
+
+ if (rimd.is_valid()) {
+
+ if (rimd->get_editor()!="") {
+ Ref<EditorImportPlugin> pl = EditorImportExport::get_singleton()->get_import_plugin_by_name(rimd->get_editor());
+ if (pl.is_valid()) {
+ Vector<uint8_t> ce = pl->custom_export(p_path,p_platform);
+ if (ce.size())
+ return ce;
+ }
+ }
+ } else if (EditorImportExport::get_singleton()->image_get_export_group(p_path)) {
+
+
+ Ref<EditorImportPlugin> pl = EditorImportExport::get_singleton()->get_import_plugin_by_name("texture_2d");
+ if (pl.is_valid()) {
+ Vector<uint8_t> ce = pl->custom_export(p_path,p_platform);
+ if (ce.size()) {
+ p_path=p_path.basename()+".tex";
+ return ce;
+ }
+ }
+
+ } else if (EditorImportExport::get_singleton()->get_export_image_action()!=EditorImportExport::IMAGE_ACTION_NONE){
+
+ String xt = p_path.extension().to_lower();
+ if (EditorImportExport::get_singleton()->get_image_formats().has(xt)) { //should check for more I guess?
+
+ Ref<EditorImportPlugin> pl = EditorImportExport::get_singleton()->get_import_plugin_by_name("texture_2d");
+ if (pl.is_valid()) {
+ Vector<uint8_t> ce = pl->custom_export(p_path,p_platform);
+ if (ce.size()) {
+ p_path=p_path.basename()+".tex";
+ return ce;
+ }
+ }
+ }
+ }
+
+ return Vector<uint8_t>();
+}
+
+EditorTextureExportPlugin::EditorTextureExportPlugin() {
+
+
+}
diff --git a/tools/editor/io_plugins/editor_texture_import_plugin.h b/tools/editor/io_plugins/editor_texture_import_plugin.h
index 4a9dd6ae9d..b2950a889c 100644
--- a/tools/editor/io_plugins/editor_texture_import_plugin.h
+++ b/tools/editor/io_plugins/editor_texture_import_plugin.h
@@ -106,6 +106,16 @@ public:
};
+class EditorTextureExportPlugin : public EditorExportPlugin {
+
+ OBJ_TYPE( EditorTextureExportPlugin, EditorExportPlugin);
+
+
+public:
+
+ virtual Vector<uint8_t> custom_export(String& p_path,const Ref<EditorExportPlatform> &p_platform);
+ EditorTextureExportPlugin();
+};
class EditorImportTextureOptions : public VBoxContainer {
OBJ_TYPE( EditorImportTextureOptions, VBoxContainer );
diff --git a/tools/script_plugins/terrain/plugin.cfg b/tools/script_plugins/terrain/plugin.cfg
new file mode 100644
index 0000000000..d2f2917420
--- /dev/null
+++ b/tools/script_plugins/terrain/plugin.cfg
@@ -0,0 +1,16 @@
+[plugin]
+
+name="Terrain"
+description="Simple plugin for generating and editing grid-based terrains. This type of terrains were all the rage in the early 2000's, but lost popularity to hand crafted geometry towards the end of the decade."
+author="Juan Linietsky"
+version="1.0"
+installs=true
+script="terrain.gd"
+install_files=["terrain.gd","terrain_node.gd","icon_terrain.png"]
+
+
+
+
+
+
+
diff --git a/tools/script_plugins/terrain/terrain.gd b/tools/script_plugins/terrain/terrain.gd
new file mode 100644
index 0000000000..b3e3121e7a
--- /dev/null
+++ b/tools/script_plugins/terrain/terrain.gd
@@ -0,0 +1,17 @@
+tool # Always declare as Tool, if it's meant to run in the editor.
+extends EditorPlugin
+
+
+func get_name():
+ return "Terrain"
+
+
+func _init():
+ print("PLUGIN INIT")
+
+
+func _enter_scene():
+ add_custom_type("Terrain","Spatial",preload("terrain_node.gd"),preload("terrain.png"))
+
+func _exit_scene():
+ remove_custom_type("Terrain")
diff --git a/tools/script_plugins/terrain/terrain.png b/tools/script_plugins/terrain/terrain.png
new file mode 100644
index 0000000000..7c1c3d70d6
--- /dev/null
+++ b/tools/script_plugins/terrain/terrain.png
Binary files differ
diff --git a/tools/script_plugins/terrain/terrain_node.gd b/tools/script_plugins/terrain/terrain_node.gd
new file mode 100644
index 0000000000..91cf3fcb2b
--- /dev/null
+++ b/tools/script_plugins/terrain/terrain_node.gd
@@ -0,0 +1,3 @@
+extends Spatial
+
+
diff --git a/tools/script_plugins/time/plugin.cfg b/tools/script_plugins/time/plugin.cfg
new file mode 100644
index 0000000000..5430306a79
--- /dev/null
+++ b/tools/script_plugins/time/plugin.cfg
@@ -0,0 +1,14 @@
+[plugin]
+
+name="The Time"
+description="This plugin displays the current local time, with great accuracy, by harvesting the power of quartz crystals inside your computer.\nIt may also serve as simple example on how to write a non-installable editor plugin, or just remind you that it's time to go back home."
+author="Juan Linietsky"
+version="1.0"
+installs=false
+script="time.gd"
+
+
+
+
+
+
diff --git a/tools/script_plugins/time/time.gd b/tools/script_plugins/time/time.gd
new file mode 100644
index 0000000000..66b3e9ed04
--- /dev/null
+++ b/tools/script_plugins/time/time.gd
@@ -0,0 +1,32 @@
+tool # Always declare as Tool, if it's meant to run in the editor.
+extends EditorPlugin
+
+var timer = null
+var label = null
+
+func _timeout():
+ if (label):
+ var time = OS.get_time()
+ label.set_text(str(time.hour).pad_zeros(2)+":"+str(time.minute).pad_zeros(2)+":"+str(time.second).pad_zeros(2))
+
+func get_name():
+ return "The Time"
+
+
+func _init():
+ print("PLUGIN INIT")
+ timer = Timer.new()
+ add_child(timer)
+ timer.set_wait_time(0.5)
+ timer.set_one_shot(false)
+ timer.connect("timeout",self,"_timeout")
+
+func _enter_scene():
+ label = Label.new()
+ add_custom_control(CONTAINER_TOOLBAR,label)
+ timer.start()
+
+func _exit_scene():
+ timer.stop()
+ label.free()
+ label=null