mirror of
https://github.com/godotengine/godot.git
synced 2024-11-22 04:06:14 +00:00
-moved script to modules
This commit is contained in:
parent
51609ffc04
commit
4b07eb8deb
10
SConstruct
10
SConstruct
@ -210,18 +210,9 @@ for p in platform_list:
|
|||||||
if (env["builtin_zlib"]=='yes'):
|
if (env["builtin_zlib"]=='yes'):
|
||||||
env.Append(CPPPATH=['#drivers/builtin_zlib/zlib'])
|
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
|
# to test 64 bits compiltion
|
||||||
# env.Append(CPPFLAGS=['-m64'])
|
# env.Append(CPPFLAGS=['-m64'])
|
||||||
|
|
||||||
if (env['lua']=='yes'):
|
|
||||||
|
|
||||||
env.Append(CPPFLAGS=['-DLUA_ENABLED'])
|
|
||||||
env.Append(CPPPATH=['#script/lua/src'])
|
|
||||||
if (env_base['squish']=='yes'):
|
if (env_base['squish']=='yes'):
|
||||||
env.Append(CPPFLAGS=['-DSQUISH_ENABLED']);
|
env.Append(CPPFLAGS=['-DSQUISH_ENABLED']);
|
||||||
|
|
||||||
@ -297,7 +288,6 @@ for p in platform_list:
|
|||||||
SConscript("servers/SCsub")
|
SConscript("servers/SCsub")
|
||||||
SConscript("scene/SCsub")
|
SConscript("scene/SCsub")
|
||||||
SConscript("tools/SCsub")
|
SConscript("tools/SCsub")
|
||||||
SConscript("script/SCsub");
|
|
||||||
SConscript("drivers/SCsub")
|
SConscript("drivers/SCsub")
|
||||||
SConscript("bin/SCsub")
|
SConscript("bin/SCsub")
|
||||||
|
|
||||||
|
@ -35,10 +35,10 @@
|
|||||||
|
|
||||||
#ifdef GDSCRIPT_ENABLED
|
#ifdef GDSCRIPT_ENABLED
|
||||||
|
|
||||||
#include "script/gdscript/gd_tokenizer.h"
|
#include "modules/gdscript/gd_tokenizer.h"
|
||||||
#include "script/gdscript/gd_parser.h"
|
#include "modules/gdscript/gd_parser.h"
|
||||||
#include "script/gdscript/gd_compiler.h"
|
#include "modules/gdscript/gd_compiler.h"
|
||||||
#include "script/gdscript/gd_script.h"
|
#include "modules/gdscript/gd_script.h"
|
||||||
|
|
||||||
|
|
||||||
namespace TestGDScript {
|
namespace TestGDScript {
|
||||||
|
@ -33,7 +33,6 @@
|
|||||||
#include "core/register_core_types.h"
|
#include "core/register_core_types.h"
|
||||||
#include "scene/register_scene_types.h"
|
#include "scene/register_scene_types.h"
|
||||||
#include "drivers/register_driver_types.h"
|
#include "drivers/register_driver_types.h"
|
||||||
#include "script/register_script_types.h"
|
|
||||||
#include "servers/register_server_types.h"
|
#include "servers/register_server_types.h"
|
||||||
#include "modules/register_module_types.h"
|
#include "modules/register_module_types.h"
|
||||||
#include "script_debugger_local.h"
|
#include "script_debugger_local.h"
|
||||||
@ -766,7 +765,6 @@ Error Main::setup2() {
|
|||||||
MAIN_PRINT("Main: Load Scripts, Modules, Drivers");
|
MAIN_PRINT("Main: Load Scripts, Modules, Drivers");
|
||||||
|
|
||||||
register_module_types();
|
register_module_types();
|
||||||
register_script_types();
|
|
||||||
register_driver_types();
|
register_driver_types();
|
||||||
|
|
||||||
MAIN_PRINT("Main: Load Translations");
|
MAIN_PRINT("Main: Load Translations");
|
||||||
@ -1371,7 +1369,6 @@ void Main::cleanup() {
|
|||||||
unregister_module_types();
|
unregister_module_types();
|
||||||
unregister_scene_types();
|
unregister_scene_types();
|
||||||
unregister_server_types();
|
unregister_server_types();
|
||||||
unregister_script_types();
|
|
||||||
|
|
||||||
OS::get_singleton()->finalize();
|
OS::get_singleton()->finalize();
|
||||||
|
|
||||||
|
7
modules/gdscript/SCsub
Normal file
7
modules/gdscript/SCsub
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
Import('env')
|
||||||
|
|
||||||
|
env.add_source_files(env.modules_sources,"*.cpp")
|
||||||
|
|
||||||
|
Export('env')
|
||||||
|
|
||||||
|
|
11
modules/gdscript/config.py
Normal file
11
modules/gdscript/config.py
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
|
||||||
|
|
||||||
|
def can_build(platform):
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
def configure(env):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -9,25 +9,17 @@
|
|||||||
/* All Rights Reserved. */
|
/* All Rights Reserved. */
|
||||||
/*************************************************/
|
/*************************************************/
|
||||||
|
|
||||||
#include "register_script_types.h"
|
#include "register_types.h"
|
||||||
|
|
||||||
#include "script/gdscript/gd_script.h"
|
#include "gd_script.h"
|
||||||
#include "script/multiscript/multi_script.h"
|
|
||||||
#include "io/resource_loader.h"
|
#include "io/resource_loader.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef GDSCRIPT_ENABLED
|
|
||||||
GDScriptLanguage *script_language_gd=NULL;
|
GDScriptLanguage *script_language_gd=NULL;
|
||||||
ResourceFormatLoaderGDScript *resource_loader_gd=NULL;
|
ResourceFormatLoaderGDScript *resource_loader_gd=NULL;
|
||||||
ResourceFormatSaverGDScript *resource_saver_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=memnew( GDScriptLanguage );
|
||||||
script_language_gd->init();
|
script_language_gd->init();
|
||||||
@ -37,21 +29,13 @@ void register_script_types() {
|
|||||||
ResourceLoader::add_resource_format_loader(resource_loader_gd);
|
ResourceLoader::add_resource_format_loader(resource_loader_gd);
|
||||||
resource_saver_gd=memnew( ResourceFormatSaverGDScript );
|
resource_saver_gd=memnew( ResourceFormatSaverGDScript );
|
||||||
ResourceSaver::add_resource_format_saver(resource_saver_gd);
|
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)
|
if (script_language_gd)
|
||||||
memdelete( script_language_gd );
|
memdelete( script_language_gd );
|
||||||
if (resource_loader_gd)
|
if (resource_loader_gd)
|
||||||
@ -59,8 +43,4 @@ void unregister_script_types() {
|
|||||||
if (resource_saver_gd)
|
if (resource_saver_gd)
|
||||||
memdelete( resource_saver_gd );
|
memdelete( resource_saver_gd );
|
||||||
|
|
||||||
#endif
|
}
|
||||||
|
|
||||||
if (script_multi_script);
|
|
||||||
memdelete(script_multi_script);
|
|
||||||
}
|
|
@ -1,5 +1,5 @@
|
|||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/* register_script_types.h */
|
/* register_types.h */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/* This file is part of: */
|
/* This file is part of: */
|
||||||
/* GODOT ENGINE */
|
/* GODOT ENGINE */
|
||||||
@ -26,13 +26,5 @@
|
|||||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
#ifndef REGISTER_SCRIPT_TYPES_H
|
void register_gdscript_types();
|
||||||
#define REGISTER_SCRIPT_TYPES_H
|
void unregister_gdscript_types();
|
||||||
|
|
||||||
/**
|
|
||||||
@author Juan Linietsky <reduzio@gmail.com>
|
|
||||||
*/
|
|
||||||
void register_script_types();
|
|
||||||
void unregister_script_types();
|
|
||||||
|
|
||||||
#endif
|
|
7
modules/multiscript/SCsub
Normal file
7
modules/multiscript/SCsub
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
Import('env')
|
||||||
|
|
||||||
|
env.add_source_files(env.modules_sources,"*.cpp")
|
||||||
|
|
||||||
|
Export('env')
|
||||||
|
|
||||||
|
|
11
modules/multiscript/config.py
Normal file
11
modules/multiscript/config.py
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
|
||||||
|
|
||||||
|
def can_build(platform):
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
def configure(env):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
32
modules/multiscript/register_types.cpp
Normal file
32
modules/multiscript/register_types.cpp
Normal file
@ -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);
|
||||||
|
}
|
30
modules/multiscript/register_types.h
Normal file
30
modules/multiscript/register_types.h
Normal file
@ -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();
|
16
script/SCsub
16
script/SCsub
@ -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])
|
|
||||||
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
|||||||
Import('env')
|
|
||||||
|
|
||||||
env.add_source_files(env.script_sources,"*.cpp")
|
|
||||||
|
|
||||||
Export('env')
|
|
||||||
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
|||||||
Import('env')
|
|
||||||
|
|
||||||
env.add_source_files(env.script_sources,"*.cpp")
|
|
||||||
|
|
||||||
Export('env')
|
|
||||||
|
|
||||||
|
|
@ -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"
|
|
||||||
|
|
@ -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
|
|
345
tools/docdump/makemd.py
Normal file
345
tools/docdump/makemd.py
Normal file
@ -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)
|
||||||
|
|
@ -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) {
|
static void _add_to_list(EditorFileSystemDirectory *p_efsd,Set<StringName>& r_list) {
|
||||||
|
|
||||||
for(int i=0;i<p_efsd->get_subdir_count();i++) {
|
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 {
|
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);
|
FileAccess *f = FileAccess::open(p_fname,FileAccess::READ);
|
||||||
ERR_FAIL_COND_V(!f,Vector<uint8_t>());
|
ERR_FAIL_COND_V(!f,Vector<uint8_t>());
|
||||||
Vector<uint8_t> ret;
|
Vector<uint8_t> ret;
|
||||||
@ -1061,12 +1064,29 @@ Ref<EditorImportPlugin> EditorImportExport::get_import_plugin(int p_idx) const{
|
|||||||
return plugins[p_idx];
|
return plugins[p_idx];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Ref<EditorImportPlugin> EditorImportExport::get_import_plugin_by_name(const String& p_string) const{
|
Ref<EditorImportPlugin> EditorImportExport::get_import_plugin_by_name(const String& p_string) const{
|
||||||
|
|
||||||
ERR_FAIL_COND_V( !by_idx.has(p_string), Ref<EditorImportPlugin>());
|
ERR_FAIL_COND_V( !by_idx.has(p_string), Ref<EditorImportPlugin>());
|
||||||
return plugins[ by_idx[p_string] ];
|
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) {
|
void EditorImportExport::set_export_file_action(const StringName& p_file, FileAction p_action) {
|
||||||
|
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
class EditorExportPlatform;
|
class EditorExportPlatform;
|
||||||
class FileAccess;
|
class FileAccess;
|
||||||
class EditorProgress;
|
class EditorProgress;
|
||||||
|
|
||||||
class EditorImportPlugin : public Reference {
|
class EditorImportPlugin : public Reference {
|
||||||
|
|
||||||
OBJ_TYPE( EditorImportPlugin, Reference);
|
OBJ_TYPE( EditorImportPlugin, Reference);
|
||||||
@ -59,6 +60,20 @@ public:
|
|||||||
EditorImportPlugin();
|
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 {
|
class EditorExportPlatform : public Reference {
|
||||||
|
|
||||||
OBJ_TYPE( EditorExportPlatform,Reference );
|
OBJ_TYPE( EditorExportPlatform,Reference );
|
||||||
@ -223,6 +238,7 @@ protected:
|
|||||||
int shrink;
|
int shrink;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Vector<Ref<EditorExportPlugin> > export_plugins;
|
||||||
Vector<Ref<EditorImportPlugin> > plugins;
|
Vector<Ref<EditorImportPlugin> > plugins;
|
||||||
Map<String,int> by_idx;
|
Map<String,int> by_idx;
|
||||||
ImageAction image_action;
|
ImageAction image_action;
|
||||||
@ -249,6 +265,10 @@ public:
|
|||||||
Ref<EditorImportPlugin> get_import_plugin(int p_idx) const;
|
Ref<EditorImportPlugin> get_import_plugin(int p_idx) const;
|
||||||
Ref<EditorImportPlugin> get_import_plugin_by_name(const String& p_string) 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();
|
bool poll_export_platforms();
|
||||||
|
|
||||||
void set_export_file_action(const StringName& p_export_file, FileAction p_action);
|
void set_export_file_action(const StringName& p_export_file, FileAction p_action);
|
||||||
|
@ -4006,10 +4006,12 @@ EditorNode::EditorNode() {
|
|||||||
editor_import_export->add_import_plugin( Ref<EditorSampleImportPlugin>( memnew(EditorSampleImportPlugin(this))));
|
editor_import_export->add_import_plugin( Ref<EditorSampleImportPlugin>( memnew(EditorSampleImportPlugin(this))));
|
||||||
editor_import_export->add_import_plugin( Ref<EditorTranslationImportPlugin>( memnew(EditorTranslationImportPlugin(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++) {
|
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);
|
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( CanvasItemEditorPlugin(this) ) );
|
||||||
add_editor_plugin( memnew( SpatialEditorPlugin(this) ) );
|
add_editor_plugin( memnew( SpatialEditorPlugin(this) ) );
|
||||||
|
@ -1190,3 +1190,56 @@ EditorTextureImportPlugin::EditorTextureImportPlugin(EditorNode *p_editor, Mode
|
|||||||
editor->get_gui_base()->add_child(dialog);
|
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() {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -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 {
|
class EditorImportTextureOptions : public VBoxContainer {
|
||||||
|
|
||||||
OBJ_TYPE( EditorImportTextureOptions, VBoxContainer );
|
OBJ_TYPE( EditorImportTextureOptions, VBoxContainer );
|
||||||
|
Before Width: | Height: | Size: 762 B After Width: | Height: | Size: 762 B |
Loading…
Reference in New Issue
Block a user