diff options
author | Juan Linietsky <reduzio@gmail.com> | 2014-02-24 09:53:33 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2014-02-24 09:53:33 -0300 |
commit | 4b07eb8deb03ce8c7870d621cd03d04d45f4caaa (patch) | |
tree | 3314811f8a347ae60d951163c19d291b46381511 | |
parent | 51609ffc04290f8bd1ecbd9cf1639c0cc6368fac (diff) |
-moved script to modules
-rw-r--r-- | SConstruct | 10 | ||||
-rw-r--r-- | bin/tests/test_gdscript.cpp | 8 | ||||
-rw-r--r-- | main/main.cpp | 3 | ||||
-rw-r--r-- | modules/gdscript/SCsub | 7 | ||||
-rw-r--r-- | modules/gdscript/config.py | 11 | ||||
-rw-r--r-- | modules/gdscript/gd_compiler.cpp (renamed from script/gdscript/gd_compiler.cpp) | 0 | ||||
-rw-r--r-- | modules/gdscript/gd_compiler.h (renamed from script/gdscript/gd_compiler.h) | 0 | ||||
-rw-r--r-- | modules/gdscript/gd_editor.cpp (renamed from script/gdscript/gd_editor.cpp) | 0 | ||||
-rw-r--r-- | modules/gdscript/gd_functions.cpp (renamed from script/gdscript/gd_functions.cpp) | 0 | ||||
-rw-r--r-- | modules/gdscript/gd_functions.h (renamed from script/gdscript/gd_functions.h) | 0 | ||||
-rw-r--r-- | modules/gdscript/gd_parser.cpp (renamed from script/gdscript/gd_parser.cpp) | 0 | ||||
-rw-r--r-- | modules/gdscript/gd_parser.h (renamed from script/gdscript/gd_parser.h) | 0 | ||||
-rw-r--r-- | modules/gdscript/gd_pretty_print.cpp (renamed from script/gdscript/gd_pretty_print.cpp) | 0 | ||||
-rw-r--r-- | modules/gdscript/gd_pretty_print.h (renamed from script/gdscript/gd_pretty_print.h) | 0 | ||||
-rw-r--r-- | modules/gdscript/gd_script.cpp (renamed from script/gdscript/gd_script.cpp) | 0 | ||||
-rw-r--r-- | modules/gdscript/gd_script.h (renamed from script/gdscript/gd_script.h) | 0 | ||||
-rw-r--r-- | modules/gdscript/gd_tokenizer.cpp (renamed from script/gdscript/gd_tokenizer.cpp) | 0 | ||||
-rw-r--r-- | modules/gdscript/gd_tokenizer.h (renamed from script/gdscript/gd_tokenizer.h) | 0 | ||||
-rw-r--r-- | modules/gdscript/register_types.cpp (renamed from script/register_script_types.cpp) | 30 | ||||
-rw-r--r-- | modules/gdscript/register_types.h (renamed from script/register_script_types.h) | 14 | ||||
-rw-r--r-- | modules/multiscript/SCsub | 7 | ||||
-rw-r--r-- | modules/multiscript/config.py | 11 | ||||
-rw-r--r-- | modules/multiscript/multi_script.cpp (renamed from script/multiscript/multi_script.cpp) | 0 | ||||
-rw-r--r-- | modules/multiscript/multi_script.h (renamed from script/multiscript/multi_script.h) | 0 | ||||
-rw-r--r-- | modules/multiscript/register_types.cpp | 32 | ||||
-rw-r--r-- | modules/multiscript/register_types.h | 30 | ||||
-rw-r--r-- | script/SCsub | 16 | ||||
-rw-r--r-- | script/gdscript/SCsub | 7 | ||||
-rw-r--r-- | script/multiscript/SCsub | 7 | ||||
-rw-r--r-- | script/script_binder.cpp | 13 | ||||
-rw-r--r-- | script/script_binder.h | 15 | ||||
-rw-r--r-- | tools/docdump/makemd.py | 345 | ||||
-rw-r--r-- | tools/editor/editor_import_export.cpp | 94 | ||||
-rw-r--r-- | tools/editor/editor_import_export.h | 20 | ||||
-rw-r--r-- | tools/editor/editor_node.cpp | 2 | ||||
-rw-r--r-- | tools/editor/io_plugins/editor_texture_import_plugin.cpp | 53 | ||||
-rw-r--r-- | tools/editor/io_plugins/editor_texture_import_plugin.h | 10 | ||||
-rw-r--r-- | tools/script_plugins/terrain/plugin.cfg (renamed from plugins/terrain/plugin.cfg) | 0 | ||||
-rw-r--r-- | tools/script_plugins/terrain/terrain.gd (renamed from plugins/terrain/terrain.gd) | 0 | ||||
-rw-r--r-- | tools/script_plugins/terrain/terrain.png (renamed from plugins/terrain/terrain.png) | bin | 762 -> 762 bytes | |||
-rw-r--r-- | tools/script_plugins/terrain/terrain_node.gd (renamed from plugins/terrain/terrain_node.gd) | 0 | ||||
-rw-r--r-- | tools/script_plugins/time/plugin.cfg (renamed from plugins/time/plugin.cfg) | 0 | ||||
-rw-r--r-- | tools/script_plugins/time/time.gd (renamed from plugins/time/time.gd) | 0 |
43 files changed, 597 insertions, 148 deletions
diff --git a/SConstruct b/SConstruct index 1fb82bfc33..93e48a069f 100644 --- a/SConstruct +++ b/SConstruct @@ -210,18 +210,9 @@ for p in platform_list: if (env["builtin_zlib"]=='yes'): env.Append(CPPPATH=['#drivers/builtin_zlib/zlib']) - if (env['squirrel']=='yes'): - - env.Append(CPPFLAGS=['-DSQUIRREL_ENABLED']) - env.Append(CPPPATH=['#script/squirrel/src']) - # to test 64 bits compiltion # env.Append(CPPFLAGS=['-m64']) - if (env['lua']=='yes'): - - env.Append(CPPFLAGS=['-DLUA_ENABLED']) - env.Append(CPPPATH=['#script/lua/src']) if (env_base['squish']=='yes'): env.Append(CPPFLAGS=['-DSQUISH_ENABLED']); @@ -297,7 +288,6 @@ for p in platform_list: SConscript("servers/SCsub") SConscript("scene/SCsub") SConscript("tools/SCsub") - SConscript("script/SCsub"); SConscript("drivers/SCsub") SConscript("bin/SCsub") diff --git a/bin/tests/test_gdscript.cpp b/bin/tests/test_gdscript.cpp index 48f982425b..847be39fb4 100644 --- a/bin/tests/test_gdscript.cpp +++ b/bin/tests/test_gdscript.cpp @@ -35,10 +35,10 @@ #ifdef GDSCRIPT_ENABLED -#include "script/gdscript/gd_tokenizer.h" -#include "script/gdscript/gd_parser.h" -#include "script/gdscript/gd_compiler.h" -#include "script/gdscript/gd_script.h" +#include "modules/gdscript/gd_tokenizer.h" +#include "modules/gdscript/gd_parser.h" +#include "modules/gdscript/gd_compiler.h" +#include "modules/gdscript/gd_script.h" namespace TestGDScript { diff --git a/main/main.cpp b/main/main.cpp index 305cc88be7..8ed49a38e4 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -33,7 +33,6 @@ #include "core/register_core_types.h" #include "scene/register_scene_types.h" #include "drivers/register_driver_types.h" -#include "script/register_script_types.h" #include "servers/register_server_types.h" #include "modules/register_module_types.h" #include "script_debugger_local.h" @@ -766,7 +765,6 @@ Error Main::setup2() { MAIN_PRINT("Main: Load Scripts, Modules, Drivers"); register_module_types(); - register_script_types(); register_driver_types(); MAIN_PRINT("Main: Load Translations"); @@ -1371,7 +1369,6 @@ void Main::cleanup() { unregister_module_types(); unregister_scene_types(); unregister_server_types(); - unregister_script_types(); OS::get_singleton()->finalize(); diff --git a/modules/gdscript/SCsub b/modules/gdscript/SCsub new file mode 100644 index 0000000000..d20da72b72 --- /dev/null +++ b/modules/gdscript/SCsub @@ -0,0 +1,7 @@ +Import('env') + +env.add_source_files(env.modules_sources,"*.cpp") + +Export('env') + + diff --git a/modules/gdscript/config.py b/modules/gdscript/config.py new file mode 100644 index 0000000000..f9bd7da08d --- /dev/null +++ b/modules/gdscript/config.py @@ -0,0 +1,11 @@ + + +def can_build(platform): + return True + + +def configure(env): + pass + + + diff --git a/script/gdscript/gd_compiler.cpp b/modules/gdscript/gd_compiler.cpp index dd2834bf34..dd2834bf34 100644 --- a/script/gdscript/gd_compiler.cpp +++ b/modules/gdscript/gd_compiler.cpp diff --git a/script/gdscript/gd_compiler.h b/modules/gdscript/gd_compiler.h index cda221dab0..cda221dab0 100644 --- a/script/gdscript/gd_compiler.h +++ b/modules/gdscript/gd_compiler.h diff --git a/script/gdscript/gd_editor.cpp b/modules/gdscript/gd_editor.cpp index c10cadf83f..c10cadf83f 100644 --- a/script/gdscript/gd_editor.cpp +++ b/modules/gdscript/gd_editor.cpp diff --git a/script/gdscript/gd_functions.cpp b/modules/gdscript/gd_functions.cpp index 2930d9322c..2930d9322c 100644 --- a/script/gdscript/gd_functions.cpp +++ b/modules/gdscript/gd_functions.cpp diff --git a/script/gdscript/gd_functions.h b/modules/gdscript/gd_functions.h index 2ab397d18a..2ab397d18a 100644 --- a/script/gdscript/gd_functions.h +++ b/modules/gdscript/gd_functions.h diff --git a/script/gdscript/gd_parser.cpp b/modules/gdscript/gd_parser.cpp index e558ceb416..e558ceb416 100644 --- a/script/gdscript/gd_parser.cpp +++ b/modules/gdscript/gd_parser.cpp diff --git a/script/gdscript/gd_parser.h b/modules/gdscript/gd_parser.h index 8011495340..8011495340 100644 --- a/script/gdscript/gd_parser.h +++ b/modules/gdscript/gd_parser.h diff --git a/script/gdscript/gd_pretty_print.cpp b/modules/gdscript/gd_pretty_print.cpp index a5a993bb3a..a5a993bb3a 100644 --- a/script/gdscript/gd_pretty_print.cpp +++ b/modules/gdscript/gd_pretty_print.cpp diff --git a/script/gdscript/gd_pretty_print.h b/modules/gdscript/gd_pretty_print.h index fbf002295b..fbf002295b 100644 --- a/script/gdscript/gd_pretty_print.h +++ b/modules/gdscript/gd_pretty_print.h diff --git a/script/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp index 5679e1e066..5679e1e066 100644 --- a/script/gdscript/gd_script.cpp +++ b/modules/gdscript/gd_script.cpp diff --git a/script/gdscript/gd_script.h b/modules/gdscript/gd_script.h index 70dec4e8ee..70dec4e8ee 100644 --- a/script/gdscript/gd_script.h +++ b/modules/gdscript/gd_script.h diff --git a/script/gdscript/gd_tokenizer.cpp b/modules/gdscript/gd_tokenizer.cpp index f7320799a5..f7320799a5 100644 --- a/script/gdscript/gd_tokenizer.cpp +++ b/modules/gdscript/gd_tokenizer.cpp diff --git a/script/gdscript/gd_tokenizer.h b/modules/gdscript/gd_tokenizer.h index 24ee2be7ad..24ee2be7ad 100644 --- a/script/gdscript/gd_tokenizer.h +++ b/modules/gdscript/gd_tokenizer.h diff --git a/script/register_script_types.cpp b/modules/gdscript/register_types.cpp index 1927cd5c1f..d2d7bf426a 100644 --- a/script/register_script_types.cpp +++ b/modules/gdscript/register_types.cpp @@ -9,25 +9,17 @@ /* All Rights Reserved. */ /*************************************************/ -#include "register_script_types.h" +#include "register_types.h" -#include "script/gdscript/gd_script.h" -#include "script/multiscript/multi_script.h" +#include "gd_script.h" #include "io/resource_loader.h" - - -#ifdef GDSCRIPT_ENABLED GDScriptLanguage *script_language_gd=NULL; ResourceFormatLoaderGDScript *resource_loader_gd=NULL; ResourceFormatSaverGDScript *resource_saver_gd=NULL; -#endif -static MultiScriptLanguage *script_multi_script=NULL; +void register_gdscript_types() { -void register_script_types() { - -#ifdef GDSCRIPT_ENABLED script_language_gd=memnew( GDScriptLanguage ); script_language_gd->init(); @@ -37,21 +29,13 @@ void register_script_types() { ResourceLoader::add_resource_format_loader(resource_loader_gd); resource_saver_gd=memnew( ResourceFormatSaverGDScript ); ResourceSaver::add_resource_format_saver(resource_saver_gd); -#endif - - - script_multi_script = memnew( MultiScriptLanguage ); - ScriptServer::register_language(script_multi_script); - ObjectTypeDB::register_type<MultiScript>(); - } -void unregister_script_types() { +void unregister_gdscript_types() { -#ifdef GDSCRIPT_ENABLED if (script_language_gd) memdelete( script_language_gd ); if (resource_loader_gd) @@ -59,8 +43,4 @@ void unregister_script_types() { if (resource_saver_gd) memdelete( resource_saver_gd ); -#endif - - if (script_multi_script); - memdelete(script_multi_script); -} +}
\ No newline at end of file diff --git a/script/register_script_types.h b/modules/gdscript/register_types.h index eec0cfe539..ff7c2734df 100644 --- a/script/register_script_types.h +++ b/modules/gdscript/register_types.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* register_script_types.h */ +/* register_types.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -26,13 +26,5 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef REGISTER_SCRIPT_TYPES_H -#define REGISTER_SCRIPT_TYPES_H - -/** - @author Juan Linietsky <reduzio@gmail.com> -*/ -void register_script_types(); -void unregister_script_types(); - -#endif +void register_gdscript_types(); +void unregister_gdscript_types(); diff --git a/modules/multiscript/SCsub b/modules/multiscript/SCsub new file mode 100644 index 0000000000..d20da72b72 --- /dev/null +++ b/modules/multiscript/SCsub @@ -0,0 +1,7 @@ +Import('env') + +env.add_source_files(env.modules_sources,"*.cpp") + +Export('env') + + diff --git a/modules/multiscript/config.py b/modules/multiscript/config.py new file mode 100644 index 0000000000..f9bd7da08d --- /dev/null +++ b/modules/multiscript/config.py @@ -0,0 +1,11 @@ + + +def can_build(platform): + return True + + +def configure(env): + pass + + + diff --git a/script/multiscript/multi_script.cpp b/modules/multiscript/multi_script.cpp index 1924cf2a6e..1924cf2a6e 100644 --- a/script/multiscript/multi_script.cpp +++ b/modules/multiscript/multi_script.cpp diff --git a/script/multiscript/multi_script.h b/modules/multiscript/multi_script.h index 87d4b4e4c8..87d4b4e4c8 100644 --- a/script/multiscript/multi_script.h +++ b/modules/multiscript/multi_script.h diff --git a/modules/multiscript/register_types.cpp b/modules/multiscript/register_types.cpp new file mode 100644 index 0000000000..4b25656723 --- /dev/null +++ b/modules/multiscript/register_types.cpp @@ -0,0 +1,32 @@ +/*************************************************/ +/* register_script_types.cpp */ +/*************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/*************************************************/ +/* Source code within this file is: */ +/* (c) 2007-2010 Juan Linietsky, Ariel Manzur */ +/* All Rights Reserved. */ +/*************************************************/ + +#include "register_types.h" + +#include "multi_script.h" +#include "io/resource_loader.h" + +static MultiScriptLanguage *script_multi_script=NULL; + +void register_multiscript_types() { + + + script_multi_script = memnew( MultiScriptLanguage ); + ScriptServer::register_language(script_multi_script); + ObjectTypeDB::register_type<MultiScript>(); + + +} +void unregister_multiscript_types() { + + if (script_multi_script); + memdelete(script_multi_script); +} diff --git a/modules/multiscript/register_types.h b/modules/multiscript/register_types.h new file mode 100644 index 0000000000..d137b1c63f --- /dev/null +++ b/modules/multiscript/register_types.h @@ -0,0 +1,30 @@ +/*************************************************************************/ +/* register_types.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +void register_multiscript_types(); +void unregister_multiscript_types(); diff --git a/script/SCsub b/script/SCsub deleted file mode 100644 index 7093dee36d..0000000000 --- a/script/SCsub +++ /dev/null @@ -1,16 +0,0 @@ -Import('env') - -env.script_sources=[] -env.add_source_files(env.script_sources,"*.cpp") - -Export('env') - -if (env["gdscript"]=="yes"): - SConscript('gdscript/SCsub'); -SConscript('multiscript/SCsub'); - -lib = env.Library("script",env.script_sources, LIBSUFFIX=env['platform_libsuffix']) - -env.Prepend(LIBS=[lib]) - - diff --git a/script/gdscript/SCsub b/script/gdscript/SCsub deleted file mode 100644 index dd812edec5..0000000000 --- a/script/gdscript/SCsub +++ /dev/null @@ -1,7 +0,0 @@ -Import('env') - -env.add_source_files(env.script_sources,"*.cpp") - -Export('env') - - diff --git a/script/multiscript/SCsub b/script/multiscript/SCsub deleted file mode 100644 index dd812edec5..0000000000 --- a/script/multiscript/SCsub +++ /dev/null @@ -1,7 +0,0 @@ -Import('env') - -env.add_source_files(env.script_sources,"*.cpp") - -Export('env') - - diff --git a/script/script_binder.cpp b/script/script_binder.cpp deleted file mode 100644 index 63c6d1d050..0000000000 --- a/script/script_binder.cpp +++ /dev/null @@ -1,13 +0,0 @@ -/*************************************************/ -/* script_binder.cpp */ -/*************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/*************************************************/ -/* Source code within this file is: */ -/* (c) 2007-2010 Juan Linietsky, Ariel Manzur */ -/* All Rights Reserved. */ -/*************************************************/ - -#include "script_binder.h" - diff --git a/script/script_binder.h b/script/script_binder.h deleted file mode 100644 index c3167a901d..0000000000 --- a/script/script_binder.h +++ /dev/null @@ -1,15 +0,0 @@ -/*************************************************/ -/* script_binder.h */ -/*************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/*************************************************/ -/* Source code within this file is: */ -/* (c) 2007-2010 Juan Linietsky, Ariel Manzur */ -/* All Rights Reserved. */ -/*************************************************/ - -#ifndef SCRIPT_BINDER_H -#define SCRIPT_BINDER_H - -#endif // SCRIPT_BINDER_H 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("_","_")+'](' + class_param.lower() + '#' \ + + method_param + ')' + else: + tag_text = '[' + param.replace("_","_") + '](#' + 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("_","_")+'** ' + else: + s += ' **['+ m.attrib['name'].replace("_","_")+'](#' + 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/plugins/terrain/plugin.cfg b/tools/script_plugins/terrain/plugin.cfg index d2f2917420..d2f2917420 100644 --- a/plugins/terrain/plugin.cfg +++ b/tools/script_plugins/terrain/plugin.cfg diff --git a/plugins/terrain/terrain.gd b/tools/script_plugins/terrain/terrain.gd index b3e3121e7a..b3e3121e7a 100644 --- a/plugins/terrain/terrain.gd +++ b/tools/script_plugins/terrain/terrain.gd diff --git a/plugins/terrain/terrain.png b/tools/script_plugins/terrain/terrain.png Binary files differindex 7c1c3d70d6..7c1c3d70d6 100644 --- a/plugins/terrain/terrain.png +++ b/tools/script_plugins/terrain/terrain.png diff --git a/plugins/terrain/terrain_node.gd b/tools/script_plugins/terrain/terrain_node.gd index 91cf3fcb2b..91cf3fcb2b 100644 --- a/plugins/terrain/terrain_node.gd +++ b/tools/script_plugins/terrain/terrain_node.gd diff --git a/plugins/time/plugin.cfg b/tools/script_plugins/time/plugin.cfg index 5430306a79..5430306a79 100644 --- a/plugins/time/plugin.cfg +++ b/tools/script_plugins/time/plugin.cfg diff --git a/plugins/time/time.gd b/tools/script_plugins/time/time.gd index 66b3e9ed04..66b3e9ed04 100644 --- a/plugins/time/time.gd +++ b/tools/script_plugins/time/time.gd |