mirror of
https://github.com/godotengine/godot.git
synced 2025-10-15 02:49:24 +00:00
Compare commits
289 Commits
3.0.4-stab
...
2.1.1-stab
Author | SHA1 | Date | |
---|---|---|---|
![]() |
3e2247ca53 | ||
![]() |
bf3cf5505e | ||
![]() |
bcc887bbe5 | ||
![]() |
9b32df9cab | ||
![]() |
601f056b6f | ||
![]() |
14b46c4263 | ||
![]() |
8a813e2a1e | ||
![]() |
679e9f413c | ||
![]() |
19ce11b908 | ||
![]() |
28944e95e7 | ||
![]() |
2d6dabc68e | ||
![]() |
9219ac7e44 | ||
![]() |
e3dc319f78 | ||
![]() |
221346521c | ||
![]() |
f1c2d70f1a | ||
![]() |
3e127ce3fd | ||
![]() |
0413d85add | ||
![]() |
7d09222b37 | ||
![]() |
dd8b87f58e | ||
![]() |
36a4c54593 | ||
![]() |
51fe9fc132 | ||
![]() |
9e1e5daddf | ||
![]() |
bc8dabf3d2 | ||
![]() |
fada9d7a8e | ||
![]() |
82b458f160 | ||
![]() |
64f38490df | ||
![]() |
c282ac8ec7 | ||
![]() |
210618c5e2 | ||
![]() |
2b00fdc679 | ||
![]() |
d7ec768805 | ||
![]() |
86c6aabf27 | ||
![]() |
e5f210693c | ||
![]() |
7e3360ae01 | ||
![]() |
67f65f6639 | ||
![]() |
dbca4ee3fe | ||
![]() |
cd828bd5fc | ||
![]() |
da4a870bc4 | ||
![]() |
ce54b6ea8b | ||
![]() |
5ee9a9962f | ||
![]() |
f629b1fd3e | ||
![]() |
eaf803f71e | ||
![]() |
a7389217f8 | ||
![]() |
e259bf8bbb | ||
![]() |
561c1f17a1 | ||
![]() |
7c92b401f1 | ||
![]() |
d44e6ea268 | ||
![]() |
1185da656f | ||
![]() |
c78aef5812 | ||
![]() |
91af714d39 | ||
![]() |
5033fc92f4 | ||
![]() |
1038c1f856 | ||
![]() |
8087be05c7 | ||
![]() |
a20da0c048 | ||
![]() |
d67bbd183e | ||
![]() |
647b287a1e | ||
![]() |
91df1ebff6 | ||
![]() |
62d1e39113 | ||
![]() |
b492dd78bd | ||
![]() |
a27aee241c | ||
![]() |
e3be51f87c | ||
![]() |
68b6b50d28 | ||
![]() |
06c47e6f8a | ||
![]() |
e56961f58b | ||
![]() |
b0013f32bf | ||
![]() |
58daf901f9 | ||
![]() |
887b1de1db | ||
![]() |
caf42f77d2 | ||
![]() |
9f9d1eed7b | ||
![]() |
0af331d1c0 | ||
![]() |
7a17d72e84 | ||
![]() |
52bf8bd168 | ||
![]() |
f3b42e049d | ||
![]() |
a130520a7c | ||
![]() |
85a7105345 | ||
![]() |
dcd4b80c13 | ||
![]() |
5a49e45d21 | ||
![]() |
7143401e25 | ||
![]() |
f4414e3e03 | ||
![]() |
aa1367595e | ||
![]() |
d96842b80e | ||
![]() |
8bf3bc3449 | ||
![]() |
f1bd2f6f56 | ||
![]() |
e04ec9565b | ||
![]() |
8263fca121 | ||
![]() |
1022705707 | ||
![]() |
4ff4177acc | ||
![]() |
c8a97c3678 | ||
![]() |
82e8721715 | ||
![]() |
bfea3f1d9a | ||
![]() |
4cd640f684 | ||
![]() |
995dcb610c | ||
![]() |
55414bc573 | ||
![]() |
819ccdd340 | ||
![]() |
ea1e180e4a | ||
![]() |
575e986bde | ||
![]() |
846db09038 | ||
![]() |
fae2863a5e | ||
![]() |
56b03e7208 | ||
![]() |
c9d7f77c6f | ||
![]() |
14e45a55d4 | ||
![]() |
7d25d20861 | ||
![]() |
e88a540b91 | ||
![]() |
2287bac8f7 | ||
![]() |
00b0f3dfde | ||
![]() |
64b083b496 | ||
![]() |
9b71cae50f | ||
![]() |
8a8ace8fa0 | ||
![]() |
2261c65f19 | ||
![]() |
a418304def | ||
![]() |
ea48675ffa | ||
![]() |
d5ee98bb2c | ||
![]() |
728ac94313 | ||
![]() |
a8502ae6f6 | ||
![]() |
04255541a0 | ||
![]() |
17edff2f84 | ||
![]() |
b4edaa892d | ||
![]() |
81bc271619 | ||
![]() |
5f540a17cc | ||
![]() |
4b6809a2b3 | ||
![]() |
280728c0c7 | ||
![]() |
35cdb1a49b | ||
![]() |
3df8f79c9f | ||
![]() |
99d82f3033 | ||
![]() |
f250c0cf50 | ||
![]() |
55a5631986 | ||
![]() |
8cb09bf9d0 | ||
![]() |
58e2652f94 | ||
![]() |
3f941faf4d | ||
![]() |
b3bf3c392a | ||
![]() |
c757787fed | ||
![]() |
1ae1deabfa | ||
![]() |
22680a30f1 | ||
![]() |
ce1138cb02 | ||
![]() |
a139c7afe6 | ||
![]() |
e51cd3d454 | ||
![]() |
a7d6894a9f | ||
![]() |
6775cce469 | ||
![]() |
9e20b39b3d | ||
![]() |
0462bf01a2 | ||
![]() |
cf427eeb7a | ||
![]() |
cd03f8cce2 | ||
![]() |
d0ff75c91c | ||
![]() |
82dfaf7af6 | ||
![]() |
c0ba08b8d5 | ||
![]() |
ba095b8dcc | ||
![]() |
9593863a92 | ||
![]() |
97ebfddaaf | ||
![]() |
342b1408d5 | ||
![]() |
359b5f3b25 | ||
![]() |
5b942f056a | ||
![]() |
44ba542de6 | ||
![]() |
f63b338e0f | ||
![]() |
13108317ae | ||
![]() |
12d4d65668 | ||
![]() |
56dc7aa568 | ||
![]() |
f315d352ec | ||
![]() |
ef0bcc7e20 | ||
![]() |
b2a58da321 | ||
![]() |
de13e52b9b | ||
![]() |
73e7ccabf5 | ||
![]() |
721599c797 | ||
![]() |
ab231cd3fb | ||
![]() |
268b3446c6 | ||
![]() |
d7925ca09d | ||
![]() |
d613952300 | ||
![]() |
a3c58999e2 | ||
![]() |
4b2243f82e | ||
![]() |
6fc894d652 | ||
![]() |
5adb75c2e7 | ||
![]() |
a827734e03 | ||
![]() |
f4f5855168 | ||
![]() |
f4da1e9ed2 | ||
![]() |
a5fe7ffbcd | ||
![]() |
02487a4be1 | ||
![]() |
228ee4363e | ||
![]() |
36b1521cdc | ||
![]() |
d1ad94acf0 | ||
![]() |
63b5a80088 | ||
![]() |
45a5769162 | ||
![]() |
b9399e93ad | ||
![]() |
33223e7a8a | ||
![]() |
12edde80f2 | ||
![]() |
c8299249e4 | ||
![]() |
1d175be921 | ||
![]() |
94e5c48004 | ||
![]() |
4084ec4869 | ||
![]() |
d3b549f2a3 | ||
![]() |
4ca83c635f | ||
![]() |
e788ffff65 | ||
![]() |
6a0d47f34c | ||
![]() |
e6d49fb54c | ||
![]() |
eed5d878e8 | ||
![]() |
521b5bd90f | ||
![]() |
8dca3f3f42 | ||
![]() |
d2aa006ddb | ||
![]() |
ec32c33799 | ||
![]() |
9b9870ed9f | ||
![]() |
a72945f4e3 | ||
![]() |
3ff8dea5f9 | ||
![]() |
2b43d0a028 | ||
![]() |
ee23649813 | ||
![]() |
75f51aece9 | ||
![]() |
5653ac41f9 | ||
![]() |
6c22cab856 | ||
![]() |
71dc733ad2 | ||
![]() |
04ade4d639 | ||
![]() |
20c3b35dd5 | ||
![]() |
323dec7dd5 | ||
![]() |
3b691907e9 | ||
![]() |
85eca7bc93 | ||
![]() |
2e6ce4b362 | ||
![]() |
a1df4f138c | ||
![]() |
0aad82e921 | ||
![]() |
aae720e488 | ||
![]() |
772a590261 | ||
![]() |
f90370886f | ||
![]() |
c44757c2b7 | ||
![]() |
ffe5ecd67d | ||
![]() |
e0ddef3164 | ||
![]() |
7178399548 | ||
![]() |
c007d31e52 | ||
![]() |
3f30a22cb0 | ||
![]() |
d6dc8f4644 | ||
![]() |
c4f79716d3 | ||
![]() |
4a9461fded | ||
![]() |
49dd7b38bc | ||
![]() |
bfcfb58efc | ||
![]() |
ed96689d8c | ||
![]() |
125a9f0b06 | ||
![]() |
fd58f8dce8 | ||
![]() |
adcf45b627 | ||
![]() |
48d1e8bd4e | ||
![]() |
73b40d1457 | ||
![]() |
e7772e43d3 | ||
![]() |
de5f49aac5 | ||
![]() |
2ab7e6daab | ||
![]() |
68c7da5a35 | ||
![]() |
a3a065b458 | ||
![]() |
9ea76ff46d | ||
![]() |
cd6afd5f1d | ||
![]() |
265715f5b2 | ||
![]() |
cd8beea3bf | ||
![]() |
0657d43960 | ||
![]() |
a21b9caa2a | ||
![]() |
83864514f9 | ||
![]() |
b1ea299edf | ||
![]() |
103b04e529 | ||
![]() |
07caf4438d | ||
![]() |
6df46803a7 | ||
![]() |
cccc35e427 | ||
![]() |
fa1f5e55de | ||
![]() |
6a563949c7 | ||
![]() |
f9aeb91850 | ||
![]() |
71a9efe604 | ||
![]() |
5f9e6d2b48 | ||
![]() |
6327fc47c8 | ||
![]() |
3cbd6b8701 | ||
![]() |
4890db7fef | ||
![]() |
df3d2b25d8 | ||
![]() |
743c63670e | ||
![]() |
e26acc39da | ||
![]() |
1a53c4d3c2 | ||
![]() |
37fc61f986 | ||
![]() |
16fc229e5d | ||
![]() |
4f07998552 | ||
![]() |
3b7ab73cab | ||
![]() |
bbb543735c | ||
![]() |
ed931d3b59 | ||
![]() |
720305d98e | ||
![]() |
676b60a8b5 | ||
![]() |
0c76ba32cc | ||
![]() |
c5e2c83dcd | ||
![]() |
9cc700a0ab | ||
![]() |
569966f3bb | ||
![]() |
58556f5f95 | ||
![]() |
229b172977 | ||
![]() |
c56ea7cf91 | ||
![]() |
1913e4a040 | ||
![]() |
2b35ba4815 | ||
![]() |
d853eb2fb7 | ||
![]() |
36eeedb357 | ||
![]() |
5f18c5cb46 | ||
![]() |
f25e9a08e1 | ||
![]() |
4f8f9a4dbf | ||
![]() |
dd97502788 | ||
![]() |
d55304c56f | ||
![]() |
03a4b8cbc8 | ||
![]() |
2f0df52fe7 | ||
![]() |
fd6f62fd9a |
@@ -69,8 +69,8 @@ addons:
|
||||
before_script:
|
||||
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew update; brew install scons; fi
|
||||
- if [ "$TRAVIS_OS_NAME" = "osx" ] && [ "$GODOT_TARGET" = "android" ]; then
|
||||
brew update; brew install -v android-sdk;
|
||||
brew install -v android-ndk | grep -v "inflating:" | grep -v "creating:";
|
||||
brew update; travis_wait 20 brew install -v android-sdk;
|
||||
travis_wait 20 brew install -v android-ndk | grep -v "inflating:" | grep -v "creating:";
|
||||
export ANDROID_HOME=/usr/local/opt/android-sdk; export ANDROID_NDK_ROOT=/usr/local/opt/android-ndk;
|
||||
fi
|
||||
|
||||
|
66
README.md
66
README.md
@@ -1,30 +1,66 @@
|
||||

|
||||
[](https://godotengine.org)
|
||||
|
||||
https://godotengine.org
|
||||
## Godot Engine
|
||||
|
||||
### The Engine
|
||||
Homepage: https://godotengine.org
|
||||
|
||||
Godot is a fully featured, open source, MIT licensed, game engine. It focuses on having great tools, and a visual oriented workflow that can export to PC, Mobile and Web platforms with no hassle.
|
||||
The editor, language and APIs are feature rich, yet simple to learn, allowing you to become productive in a matter of hours.
|
||||
#### 2D and 3D cross-platform game engine
|
||||
|
||||
### About
|
||||
Godot Engine is a feature-packed, cross-platform game engine to create 2D and
|
||||
3D games from a unified interface. It provides a comprehensive set of common
|
||||
tools, so that users can focus on making games without having to reinvent the
|
||||
wheel. Games can be exported in one click to a number of platforms, including
|
||||
the major desktop platforms (Linux, Mac OSX, Windows) as well as mobile
|
||||
(Android, iOS) and web-based (HTML5) platforms.
|
||||
|
||||
Godot has been developed by Juan Linietsky and Ariel Manzur for several years, and was born as an in-house engine, used to publish several work-for-hire titles. Godot is a member project of the [Software Freedom Conservancy](https://sfconservancy.org)
|
||||
#### Free, open source and community-driven
|
||||
|
||||
### Documentation
|
||||
Godot is completely free and open source under the very permissive MIT license.
|
||||
No strings attached, no royalties, nothing. The users' games are theirs, down
|
||||
to the last line of engine code. Godot's development is fully independent and
|
||||
community-driven, empowering users to help shape their engine to match their
|
||||
expectations. It is supported by the Software Freedom Conservancy
|
||||
not-for-profit.
|
||||
|
||||
Documentation is hosted on [ReadTheDocs](http://docs.godotengine.org).
|
||||
Before being open sourced in February 2014, Godot had been developed by Juan
|
||||
Linietsky and Ariel Manzur (both still maintaining the project) for several
|
||||
years as an in-house engine, used to publish several work-for-hire titles.
|
||||
|
||||
### Binary Downloads, Community, etc.
|
||||
### Getting the engine
|
||||
|
||||
Binary downloads, community, etc. can be found in Godot homepage:
|
||||
#### Binary downloads
|
||||
|
||||
https://godotengine.org
|
||||
Official binaries for the Godot editor and the export templates can be found
|
||||
[on the homepage](https://godotengine.org/download).
|
||||
|
||||
### Compiling from Source
|
||||
#### Compiling from source
|
||||
|
||||
See docs for compilation instructions for every platform:
|
||||
http://docs.godotengine.org/en/latest/reference/_compiling.html
|
||||
[See the official docs](http://docs.godotengine.org/en/latest/reference/_compiling.html)
|
||||
for compilation instructions for every supported platform.
|
||||
|
||||
### Community
|
||||
|
||||
Godot is not only an engine but an ever-growing community of users and engine
|
||||
developers. The main community channels are listed [on the homepage](https://godotengine.org/community).
|
||||
|
||||
To get in touch with the developers, the best way is to join the
|
||||
[#godotengine IRC channel](https://webchat.freenode.net/?channels=godotengine)
|
||||
on Freenode.
|
||||
|
||||
### Documentation and demos
|
||||
|
||||
The official documentation is hosted on [ReadTheDocs](http://docs.godotengine.org).
|
||||
It is maintained by the Godot community in its own [GitHub repository](https://github.com/godotengine/godot-docs).
|
||||
|
||||
The [class reference](http://docs.godotengine.org/en/latest/classes/_classes.html)
|
||||
is also accessible from within the engine.
|
||||
|
||||
The official demos are maintained in their own [GitHub repository](https://github.com/godotengine/godot-demo-projects)
|
||||
as well.
|
||||
|
||||
There are also a number of other learning resources provided by the community,
|
||||
such as text and video tutorials, demos, etc. Consult the [community channels](https://godotengine.org/community)
|
||||
for more info.
|
||||
|
||||
[](https://travis-ci.org/godotengine/godot)
|
||||
[](http://www.codetriage.com/godotengine/godot)
|
||||
|
630
SConstruct
630
SConstruct
@@ -1,4 +1,6 @@
|
||||
EnsureSConsVersion(0,14);
|
||||
#!/usr/bin/env python
|
||||
|
||||
EnsureSConsVersion(0, 14)
|
||||
|
||||
|
||||
import string
|
||||
@@ -12,84 +14,85 @@ methods.update_version()
|
||||
|
||||
# scan possible build platforms
|
||||
|
||||
platform_list = [] # list of platforms
|
||||
platform_opts = {} # options for each platform
|
||||
platform_flags = {} # flags for each platform
|
||||
platform_list = [] # list of platforms
|
||||
platform_opts = {} # options for each platform
|
||||
platform_flags = {} # flags for each platform
|
||||
|
||||
|
||||
active_platforms=[]
|
||||
active_platform_ids=[]
|
||||
platform_exporters=[]
|
||||
global_defaults=[]
|
||||
active_platforms = []
|
||||
active_platform_ids = []
|
||||
platform_exporters = []
|
||||
global_defaults = []
|
||||
|
||||
for x in glob.glob("platform/*"):
|
||||
if (not os.path.isdir(x) or not os.path.exists(x+"/detect.py")):
|
||||
continue
|
||||
tmppath="./"+x
|
||||
if (not os.path.isdir(x) or not os.path.exists(x + "/detect.py")):
|
||||
continue
|
||||
tmppath = "./" + x
|
||||
|
||||
sys.path.append(tmppath)
|
||||
import detect
|
||||
sys.path.append(tmppath)
|
||||
import detect
|
||||
|
||||
if (os.path.exists(x+"/export/export.cpp")):
|
||||
platform_exporters.append(x[9:])
|
||||
if (os.path.exists(x+"/globals/global_defaults.cpp")):
|
||||
global_defaults.append(x[9:])
|
||||
if (detect.is_active()):
|
||||
active_platforms.append( detect.get_name() )
|
||||
active_platform_ids.append(x);
|
||||
if (detect.can_build()):
|
||||
x=x.replace("platform/","") # rest of world
|
||||
x=x.replace("platform\\","") # win32
|
||||
platform_list+=[x]
|
||||
platform_opts[x]=detect.get_opts()
|
||||
platform_flags[x]=detect.get_flags()
|
||||
sys.path.remove(tmppath)
|
||||
sys.modules.pop('detect')
|
||||
if (os.path.exists(x + "/export/export.cpp")):
|
||||
platform_exporters.append(x[9:])
|
||||
if (os.path.exists(x + "/globals/global_defaults.cpp")):
|
||||
global_defaults.append(x[9:])
|
||||
if (detect.is_active()):
|
||||
active_platforms.append(detect.get_name())
|
||||
active_platform_ids.append(x)
|
||||
if (detect.can_build()):
|
||||
x = x.replace("platform/", "") # rest of world
|
||||
x = x.replace("platform\\", "") # win32
|
||||
platform_list += [x]
|
||||
platform_opts[x] = detect.get_opts()
|
||||
platform_flags[x] = detect.get_flags()
|
||||
sys.path.remove(tmppath)
|
||||
sys.modules.pop('detect')
|
||||
|
||||
module_list=methods.detect_modules()
|
||||
module_list = methods.detect_modules()
|
||||
|
||||
|
||||
#print "Detected Platforms: "+str(platform_list)
|
||||
# print "Detected Platforms: "+str(platform_list)
|
||||
|
||||
methods.save_active_platforms(active_platforms,active_platform_ids)
|
||||
methods.save_active_platforms(active_platforms, active_platform_ids)
|
||||
|
||||
custom_tools=['default']
|
||||
custom_tools = ['default']
|
||||
|
||||
platform_arg = ARGUMENTS.get("platform", False)
|
||||
platform_arg = ARGUMENTS.get("platform", ARGUMENTS.get("p", False))
|
||||
|
||||
if (os.name=="posix"):
|
||||
pass
|
||||
elif (os.name=="nt"):
|
||||
if (os.getenv("VSINSTALLDIR")==None or platform_arg=="android"):
|
||||
custom_tools=['mingw']
|
||||
if (os.name == "posix"):
|
||||
pass
|
||||
elif (os.name == "nt"):
|
||||
if (os.getenv("VSINSTALLDIR") == None or platform_arg == "android"):
|
||||
custom_tools = ['mingw']
|
||||
|
||||
env_base=Environment(tools=custom_tools);
|
||||
env_base = Environment(tools=custom_tools)
|
||||
if 'TERM' in os.environ:
|
||||
env_base['ENV']['TERM'] = os.environ['TERM']
|
||||
env_base.AppendENVPath('PATH', os.getenv('PATH'))
|
||||
env_base.AppendENVPath('PKG_CONFIG_PATH', os.getenv('PKG_CONFIG_PATH'))
|
||||
env_base.global_defaults=global_defaults
|
||||
env_base.android_maven_repos=[]
|
||||
env_base.android_dependencies=[]
|
||||
env_base.android_java_dirs=[]
|
||||
env_base.android_res_dirs=[]
|
||||
env_base.android_aidl_dirs=[]
|
||||
env_base.android_jni_dirs=[]
|
||||
env_base.android_default_config=[]
|
||||
env_base.android_manifest_chunk=""
|
||||
env_base.android_permission_chunk=""
|
||||
env_base.android_appattributes_chunk=""
|
||||
env_base.disabled_modules=[]
|
||||
env_base.use_ptrcall=False
|
||||
env_base.split_drivers=False
|
||||
env_base.global_defaults = global_defaults
|
||||
env_base.android_maven_repos = []
|
||||
env_base.android_dependencies = []
|
||||
env_base.android_java_dirs = []
|
||||
env_base.android_res_dirs = []
|
||||
env_base.android_aidl_dirs = []
|
||||
env_base.android_jni_dirs = []
|
||||
env_base.android_default_config = []
|
||||
env_base.android_manifest_chunk = ""
|
||||
env_base.android_permission_chunk = ""
|
||||
env_base.android_appattributes_chunk = ""
|
||||
env_base.disabled_modules = []
|
||||
env_base.use_ptrcall = False
|
||||
env_base.split_drivers = False
|
||||
|
||||
|
||||
|
||||
env_base.__class__.android_add_maven_repository=methods.android_add_maven_repository
|
||||
env_base.__class__.android_add_dependency=methods.android_add_dependency
|
||||
env_base.__class__.android_add_java_dir=methods.android_add_java_dir
|
||||
env_base.__class__.android_add_res_dir=methods.android_add_res_dir
|
||||
env_base.__class__.android_add_aidl_dir=methods.android_add_aidl_dir
|
||||
env_base.__class__.android_add_jni_dir=methods.android_add_jni_dir
|
||||
env_base.__class__.android_add_default_config=methods.android_add_default_config
|
||||
env_base.__class__.android_add_maven_repository = methods.android_add_maven_repository
|
||||
env_base.__class__.android_add_dependency = methods.android_add_dependency
|
||||
env_base.__class__.android_add_java_dir = methods.android_add_java_dir
|
||||
env_base.__class__.android_add_res_dir = methods.android_add_res_dir
|
||||
env_base.__class__.android_add_aidl_dir = methods.android_add_aidl_dir
|
||||
env_base.__class__.android_add_jni_dir = methods.android_add_jni_dir
|
||||
env_base.__class__.android_add_default_config = methods.android_add_default_config
|
||||
env_base.__class__.android_add_to_manifest = methods.android_add_to_manifest
|
||||
env_base.__class__.android_add_to_permissions = methods.android_add_to_permissions
|
||||
env_base.__class__.android_add_to_attributes = methods.android_add_to_attributes
|
||||
@@ -97,78 +100,92 @@ env_base.__class__.disable_module = methods.disable_module
|
||||
|
||||
env_base.__class__.add_source_files = methods.add_source_files
|
||||
env_base.__class__.use_windows_spawn_fix = methods.use_windows_spawn_fix
|
||||
env_base.__class__.split_lib = methods.split_lib
|
||||
|
||||
env_base["x86_opt_gcc"]=False
|
||||
env_base["x86_opt_vc"]=False
|
||||
env_base["armv7_opt_gcc"]=False
|
||||
env_base["x86_libtheora_opt_gcc"] = False
|
||||
env_base["x86_libtheora_opt_vc"] = False
|
||||
|
||||
# Build options
|
||||
|
||||
customs = ['custom.py']
|
||||
|
||||
profile = ARGUMENTS.get("profile", False)
|
||||
if profile:
|
||||
import os.path
|
||||
if os.path.isfile(profile):
|
||||
customs.append(profile)
|
||||
elif os.path.isfile(profile+".py"):
|
||||
customs.append(profile+".py")
|
||||
import os.path
|
||||
if os.path.isfile(profile):
|
||||
customs.append(profile)
|
||||
elif os.path.isfile(profile + ".py"):
|
||||
customs.append(profile + ".py")
|
||||
|
||||
opts = Variables(customs, ARGUMENTS)
|
||||
|
||||
# Target build options
|
||||
opts.Add('arch', "Platform-dependent architecture (arm/arm64/x86/x64/mips/etc)", '')
|
||||
opts.Add('bits', "Target platform bits (default/32/64/fat)", 'default')
|
||||
opts.Add('p', "Platform (alias for 'platform')", '')
|
||||
opts.Add('platform', "Target platform: any in " + str(platform_list), '')
|
||||
opts.Add('target', "Compilation target (debug/release_debug/release)", 'debug')
|
||||
opts.Add('tools', "Build the tools a.k.a. the Godot editor (yes/no)", 'yes')
|
||||
|
||||
# Components
|
||||
opts.Add('deprecated', "Enable deprecated features (yes/no)", 'yes')
|
||||
opts.Add('gdscript', "Build GDSCript support (yes/no)", 'yes')
|
||||
opts.Add('minizip', "Build minizip archive support (yes/no)", 'yes')
|
||||
opts.Add('xml', "XML format support for resources (yes/no)", 'yes')
|
||||
|
||||
# Advanced options
|
||||
opts.Add('disable_3d', "Disable 3D nodes for smaller executable (yes/no)", 'no')
|
||||
opts.Add('disable_advanced_gui', "Disable advance 3D gui nodes and behaviors (yes/no)", 'no')
|
||||
opts.Add('extra_suffix', "Custom extra suffix added to the base filename of all generated binary files", '')
|
||||
opts.Add('unix_global_settings_path', "UNIX-specific path to system-wide settings. Currently only used for templates", '')
|
||||
opts.Add('verbose', "Enable verbose output for the compilation (yes/no)", 'yes')
|
||||
opts.Add('vsproj', "Generate Visual Studio Project. (yes/no)", 'no')
|
||||
|
||||
# Thirdparty libraries
|
||||
opts.Add('builtin_freetype', "Use the builtin freetype library (yes/no)", 'yes')
|
||||
opts.Add('builtin_glew', "Use the builtin glew library (yes/no)", 'yes')
|
||||
opts.Add('builtin_libmpcdec', "Use the builtin libmpcdec library (yes/no)", 'yes')
|
||||
opts.Add('builtin_libogg', "Use the builtin libogg library (yes/no)", 'yes')
|
||||
opts.Add('builtin_libpng', "Use the builtin libpng library (yes/no)", 'yes')
|
||||
opts.Add('builtin_libtheora', "Use the builtin libtheora library (yes/no)", 'yes')
|
||||
opts.Add('builtin_libvorbis', "Use the builtin libvorbis library (yes/no)", 'yes')
|
||||
opts.Add('builtin_libwebp', "Use the builtin libwebp library (yes/no)", 'yes')
|
||||
opts.Add('builtin_openssl', "Use the builtin openssl library (yes/no)", 'yes')
|
||||
opts.Add('builtin_opus', "Use the builtin opus library (yes/no)", 'yes')
|
||||
# (akien) Unbundling would require work in audio_stream_speex.{cpp,h}, but since speex was
|
||||
# removed in 3.0+ and this is only to preserve compatibility in 2.1, I haven't worked on it.
|
||||
# Patches welcome if anyone cares :)
|
||||
opts.Add('builtin_speex', "Use the builtin speex library (yes/no)", 'yes')
|
||||
opts.Add('builtin_squish', "Use the builtin squish library (yes/no)", 'yes')
|
||||
opts.Add('builtin_zlib', "Use the builtin zlib library (yes/no)", 'yes')
|
||||
|
||||
# Environment setup
|
||||
opts.Add("CXX", "C++ compiler")
|
||||
opts.Add("CC", "C compiler")
|
||||
opts.Add("CCFLAGS", "Custom flags for the C and C++ compilers")
|
||||
opts.Add("CFLAGS", "Custom flags for the C compiler")
|
||||
opts.Add("LINKFLAGS", "Custom flags for the linker")
|
||||
|
||||
opts=Variables(customs, ARGUMENTS)
|
||||
opts.Add('target', 'Compile Target (debug/release_debug/release).', "debug")
|
||||
opts.Add('arch', 'Platform dependent architecture (arm/arm64/x86/x64/mips/etc)', "")
|
||||
opts.Add('bits', 'Compile Target Bits (default/32/64/fat).', "default")
|
||||
opts.Add('platform','Platform: '+str(platform_list)+'.',"")
|
||||
opts.Add('p','Platform (same as platform=).',"")
|
||||
opts.Add('tools','Build Tools (Including Editor): (yes/no)','yes')
|
||||
opts.Add('gdscript','Build GDSCript support: (yes/no)','yes')
|
||||
opts.Add('vorbis','Build Ogg Vorbis Support: (yes/no)','yes')
|
||||
opts.Add('opus','Build Opus Audio Format Support: (yes/no)','yes')
|
||||
opts.Add('minizip','Build Minizip Archive Support: (yes/no)','yes')
|
||||
opts.Add('squish','Squish BC Texture Compression in editor (yes/no)','yes')
|
||||
opts.Add('theora','Theora Video (yes/no)','yes')
|
||||
opts.Add('theoralib','Theora Video (yes/no)','no')
|
||||
opts.Add('freetype','Freetype support in editor','builtin')
|
||||
opts.Add('speex','Speex Audio (yes/no)','yes')
|
||||
opts.Add('xml','XML Save/Load support (yes/no)','yes')
|
||||
opts.Add('png','PNG Image loader support (yes/no)','yes')
|
||||
opts.Add('jpg','JPG Image loader support (yes/no)','yes')
|
||||
opts.Add('webp','WEBP Image loader support (yes/no)','yes')
|
||||
opts.Add('dds','DDS Texture loader support (yes/no)','yes')
|
||||
opts.Add('pvr','PVR (PowerVR) Texture loader support (yes/no)','yes')
|
||||
opts.Add('etc1','etc1 Texture compression support (yes/no)','yes')
|
||||
opts.Add('builtin_zlib','Use built-in zlib (yes/no)','yes')
|
||||
opts.Add('openssl','Use OpenSSL (yes/no/builtin)','no')
|
||||
opts.Add('musepack','Musepack Audio (yes/no)','yes')
|
||||
opts.Add("CXX", "Compiler");
|
||||
opts.Add("CCFLAGS", "Custom flags for the C++ compiler");
|
||||
opts.Add("CFLAGS", "Custom flags for the C compiler");
|
||||
opts.Add("LINKFLAGS", "Custom flags for the linker");
|
||||
opts.Add('unix_global_settings_path', 'unix-specific path to system-wide settings. Currently only used by templates.','')
|
||||
opts.Add('disable_3d', 'Disable 3D nodes for smaller executable (yes/no)', "no")
|
||||
opts.Add('disable_advanced_gui', 'Disable advance 3D gui nodes and behaviors (yes/no)', "no")
|
||||
opts.Add('colored', 'Enable colored output for the compilation (yes/no)', 'no')
|
||||
opts.Add('deprecated','Enable deprecated features (yes/no)','yes')
|
||||
opts.Add('extra_suffix', 'Custom extra suffix added to the base filename of all generated binary files.', '')
|
||||
opts.Add('vsproj', 'Generate Visual Studio Project. (yes/no)', 'no')
|
||||
|
||||
# add platform specific options
|
||||
|
||||
for k in platform_opts.keys():
|
||||
opt_list = platform_opts[k]
|
||||
for o in opt_list:
|
||||
opts.Add(o[0],o[1],o[2])
|
||||
opt_list = platform_opts[k]
|
||||
for o in opt_list:
|
||||
opts.Add(o[0], o[1], o[2])
|
||||
|
||||
for x in module_list:
|
||||
opts.Add('module_'+x+'_enabled', "Enable module '"+x+"'.", "yes")
|
||||
opts.Add('module_' + x + '_enabled', "Enable module '" + x + "' (yes/no)", "yes")
|
||||
|
||||
opts.Update(env_base) # update environment
|
||||
Help(opts.GenerateHelpText(env_base)) # generate help
|
||||
opts.Update(env_base) # update environment
|
||||
Help(opts.GenerateHelpText(env_base)) # generate help
|
||||
|
||||
# add default include paths
|
||||
|
||||
env_base.Append(CPPPATH=['#core','#core/math','#tools','#drivers','#'])
|
||||
env_base.Append(CPPPATH=['#core', '#core/math', '#tools', '#drivers', '#'])
|
||||
|
||||
# configure ENV for platform
|
||||
env_base.platform_exporters=platform_exporters
|
||||
env_base.platform_exporters = platform_exporters
|
||||
|
||||
"""
|
||||
sys.path.append("./platform/"+env_base["platform"])
|
||||
@@ -178,276 +195,223 @@ sys.path.remove("./platform/"+env_base["platform"])
|
||||
sys.modules.pop('detect')
|
||||
"""
|
||||
|
||||
if (env_base['target']=='debug'):
|
||||
env_base.Append(CPPFLAGS=['-DDEBUG_MEMORY_ALLOC']);
|
||||
env_base.Append(CPPFLAGS=['-DSCI_NAMESPACE'])
|
||||
if (env_base['target'] == 'debug'):
|
||||
env_base.Append(CPPFLAGS=['-DDEBUG_MEMORY_ALLOC'])
|
||||
env_base.Append(CPPFLAGS=['-DSCI_NAMESPACE'])
|
||||
|
||||
if (env_base['deprecated']!='no'):
|
||||
env_base.Append(CPPFLAGS=['-DENABLE_DEPRECATED']);
|
||||
if (env_base['deprecated'] != 'no'):
|
||||
env_base.Append(CPPFLAGS=['-DENABLE_DEPRECATED'])
|
||||
|
||||
env_base.platforms = {}
|
||||
|
||||
|
||||
selected_platform =""
|
||||
selected_platform = ""
|
||||
|
||||
if env_base['platform'] != "":
|
||||
selected_platform=env_base['platform']
|
||||
selected_platform = env_base['platform']
|
||||
elif env_base['p'] != "":
|
||||
selected_platform=env_base['p']
|
||||
env_base["platform"]=selected_platform
|
||||
|
||||
selected_platform = env_base['p']
|
||||
env_base["platform"] = selected_platform
|
||||
|
||||
|
||||
if selected_platform in platform_list:
|
||||
|
||||
sys.path.append("./platform/"+selected_platform)
|
||||
import detect
|
||||
if "create" in dir(detect):
|
||||
env = detect.create(env_base)
|
||||
else:
|
||||
env = env_base.Clone()
|
||||
sys.path.append("./platform/" + selected_platform)
|
||||
import detect
|
||||
if "create" in dir(detect):
|
||||
env = detect.create(env_base)
|
||||
else:
|
||||
env = env_base.Clone()
|
||||
|
||||
if env['vsproj']=="yes":
|
||||
env.vs_incs = []
|
||||
env.vs_srcs = []
|
||||
if env['vsproj'] == "yes":
|
||||
env.vs_incs = []
|
||||
env.vs_srcs = []
|
||||
|
||||
def AddToVSProject( sources ):
|
||||
for x in sources:
|
||||
if type(x) == type(""):
|
||||
fname = env.File(x).path
|
||||
else:
|
||||
fname = env.File(x)[0].path
|
||||
pieces = fname.split(".")
|
||||
if len(pieces)>0:
|
||||
basename = pieces[0]
|
||||
basename = basename.replace('\\\\','/')
|
||||
env.vs_srcs = env.vs_srcs + [basename + ".cpp"]
|
||||
env.vs_incs = env.vs_incs + [basename + ".h"]
|
||||
#print basename
|
||||
env.AddToVSProject = AddToVSProject
|
||||
def AddToVSProject(sources):
|
||||
for x in sources:
|
||||
if type(x) == type(""):
|
||||
fname = env.File(x).path
|
||||
else:
|
||||
fname = env.File(x)[0].path
|
||||
pieces = fname.split(".")
|
||||
if len(pieces) > 0:
|
||||
basename = pieces[0]
|
||||
basename = basename.replace('\\\\', '/')
|
||||
env.vs_srcs = env.vs_srcs + [basename + ".cpp"]
|
||||
env.vs_incs = env.vs_incs + [basename + ".h"]
|
||||
# print basename
|
||||
env.AddToVSProject = AddToVSProject
|
||||
|
||||
env.extra_suffix=""
|
||||
env.extra_suffix = ""
|
||||
|
||||
if env["extra_suffix"] != '' :
|
||||
env.extra_suffix += '.'+env["extra_suffix"]
|
||||
if env["extra_suffix"] != '':
|
||||
env.extra_suffix += '.' + env["extra_suffix"]
|
||||
|
||||
CCFLAGS = env.get('CCFLAGS', '')
|
||||
env['CCFLAGS'] = ''
|
||||
CCFLAGS = env.get('CCFLAGS', '')
|
||||
env['CCFLAGS'] = ''
|
||||
|
||||
env.Append(CCFLAGS=string.split(str(CCFLAGS)))
|
||||
env.Append(CCFLAGS=string.split(str(CCFLAGS)))
|
||||
|
||||
CFLAGS = env.get('CFLAGS', '')
|
||||
env['CFLAGS'] = ''
|
||||
CFLAGS = env.get('CFLAGS', '')
|
||||
env['CFLAGS'] = ''
|
||||
|
||||
env.Append(CFLAGS=string.split(str(CFLAGS)))
|
||||
env.Append(CFLAGS=string.split(str(CFLAGS)))
|
||||
|
||||
LINKFLAGS = env.get('LINKFLAGS', '')
|
||||
env['LINKFLAGS'] = ''
|
||||
LINKFLAGS = env.get('LINKFLAGS', '')
|
||||
env['LINKFLAGS'] = ''
|
||||
|
||||
env.Append(LINKFLAGS=string.split(str(LINKFLAGS)))
|
||||
env.Append(LINKFLAGS=string.split(str(LINKFLAGS)))
|
||||
|
||||
flag_list = platform_flags[selected_platform]
|
||||
for f in flag_list:
|
||||
if not (f[0] in ARGUMENTS): # allow command line to override platform flags
|
||||
env[f[0]] = f[1]
|
||||
flag_list = platform_flags[selected_platform]
|
||||
for f in flag_list:
|
||||
if not (f[0] in ARGUMENTS): # allow command line to override platform flags
|
||||
env[f[0]] = f[1]
|
||||
|
||||
#must happen after the flags, so when flags are used by configure, stuff happens (ie, ssl on x11)
|
||||
detect.configure(env)
|
||||
# must happen after the flags, so when flags are used by configure, stuff happens (ie, ssl on x11)
|
||||
detect.configure(env)
|
||||
|
||||
#env['platform_libsuffix'] = env['LIBSUFFIX']
|
||||
|
||||
if (env["freetype"]!="no"):
|
||||
env.Append(CCFLAGS=['-DFREETYPE_ENABLED'])
|
||||
if (env["freetype"]=="builtin"):
|
||||
env.Append(CPPPATH=['#drivers/freetype'])
|
||||
env.Append(CPPPATH=['#drivers/freetype/freetype/include'])
|
||||
suffix = "." + selected_platform
|
||||
|
||||
if (env["target"] == "release"):
|
||||
if (env["tools"] == "yes"):
|
||||
print("Tools can only be built with targets 'debug' and 'release_debug'.")
|
||||
sys.exit(255)
|
||||
suffix += ".opt"
|
||||
|
||||
#env['platform_libsuffix'] = env['LIBSUFFIX']
|
||||
env.Append(CCFLAGS=['-DNDEBUG'])
|
||||
|
||||
suffix="."+selected_platform
|
||||
elif (env["target"] == "release_debug"):
|
||||
if (env["tools"] == "yes"):
|
||||
suffix += ".opt.tools"
|
||||
else:
|
||||
suffix += ".opt.debug"
|
||||
else:
|
||||
if (env["tools"] == "yes"):
|
||||
suffix += ".tools"
|
||||
else:
|
||||
suffix += ".debug"
|
||||
|
||||
if (env["target"]=="release"):
|
||||
if (env["tools"]=="yes"):
|
||||
print("Tools can only be built with targets 'debug' and 'release_debug'.")
|
||||
sys.exit(255)
|
||||
suffix+=".opt"
|
||||
if env["arch"] != "":
|
||||
suffix += "." + env["arch"]
|
||||
elif (env["bits"] == "32"):
|
||||
suffix += ".32"
|
||||
elif (env["bits"] == "64"):
|
||||
suffix += ".64"
|
||||
elif (env["bits"] == "fat"):
|
||||
suffix += ".fat"
|
||||
|
||||
elif (env["target"]=="release_debug"):
|
||||
if (env["tools"]=="yes"):
|
||||
suffix+=".opt.tools"
|
||||
else:
|
||||
suffix+=".opt.debug"
|
||||
else:
|
||||
if (env["tools"]=="yes"):
|
||||
suffix+=".tools"
|
||||
else:
|
||||
suffix+=".debug"
|
||||
suffix += env.extra_suffix
|
||||
|
||||
if env["arch"] != "":
|
||||
suffix += "."+env["arch"]
|
||||
elif (env["bits"]=="32"):
|
||||
suffix+=".32"
|
||||
elif (env["bits"]=="64"):
|
||||
suffix+=".64"
|
||||
elif (env["bits"]=="fat"):
|
||||
suffix+=".fat"
|
||||
env["PROGSUFFIX"] = suffix + env["PROGSUFFIX"]
|
||||
env["OBJSUFFIX"] = suffix + env["OBJSUFFIX"]
|
||||
env["LIBSUFFIX"] = suffix + env["LIBSUFFIX"]
|
||||
env["SHLIBSUFFIX"] = suffix + env["SHLIBSUFFIX"]
|
||||
|
||||
suffix+=env.extra_suffix
|
||||
sys.path.remove("./platform/" + selected_platform)
|
||||
sys.modules.pop('detect')
|
||||
|
||||
env["PROGSUFFIX"]=suffix+env["PROGSUFFIX"]
|
||||
env["OBJSUFFIX"]=suffix+env["OBJSUFFIX"]
|
||||
env["LIBSUFFIX"]=suffix+env["LIBSUFFIX"]
|
||||
env["SHLIBSUFFIX"]=suffix+env["SHLIBSUFFIX"]
|
||||
env.module_list = []
|
||||
|
||||
sys.path.remove("./platform/"+selected_platform)
|
||||
sys.modules.pop('detect')
|
||||
for x in module_list:
|
||||
if env['module_' + x + '_enabled'] != "yes":
|
||||
continue
|
||||
tmppath = "./modules/" + x
|
||||
sys.path.append(tmppath)
|
||||
env.current_module = x
|
||||
import config
|
||||
if (config.can_build(selected_platform)):
|
||||
config.configure(env)
|
||||
env.module_list.append(x)
|
||||
sys.path.remove(tmppath)
|
||||
sys.modules.pop('config')
|
||||
|
||||
if (env.use_ptrcall):
|
||||
env.Append(CPPFLAGS=['-DPTRCALL_ENABLED'])
|
||||
|
||||
env.module_list=[]
|
||||
# to test 64 bits compiltion
|
||||
# env.Append(CPPFLAGS=['-m64'])
|
||||
|
||||
for x in module_list:
|
||||
if env['module_'+x+'_enabled'] != "yes":
|
||||
continue
|
||||
tmppath="./modules/"+x
|
||||
sys.path.append(tmppath)
|
||||
env.current_module=x
|
||||
import config
|
||||
if (config.can_build(selected_platform)):
|
||||
config.configure(env)
|
||||
env.module_list.append(x)
|
||||
sys.path.remove(tmppath)
|
||||
sys.modules.pop('config')
|
||||
if (env['tools'] == 'yes'):
|
||||
env.Append(CPPFLAGS=['-DTOOLS_ENABLED'])
|
||||
if (env['disable_3d'] == 'yes'):
|
||||
env.Append(CPPFLAGS=['-D_3D_DISABLED'])
|
||||
if (env['gdscript'] == 'yes'):
|
||||
env.Append(CPPFLAGS=['-DGDSCRIPT_ENABLED'])
|
||||
if (env['disable_advanced_gui'] == 'yes'):
|
||||
env.Append(CPPFLAGS=['-DADVANCED_GUI_DISABLED'])
|
||||
|
||||
if (env['minizip'] == 'yes'):
|
||||
env.Append(CPPFLAGS=['-DMINIZIP_ENABLED'])
|
||||
|
||||
if (env.use_ptrcall):
|
||||
env.Append(CPPFLAGS=['-DPTRCALL_ENABLED']);
|
||||
if (env['xml'] == 'yes'):
|
||||
env.Append(CPPFLAGS=['-DXML_ENABLED'])
|
||||
|
||||
if (env['musepack']=='yes'):
|
||||
env.Append(CPPFLAGS=['-DMUSEPACK_ENABLED']);
|
||||
if (env['verbose'] == 'no'):
|
||||
methods.no_verbose(sys, env)
|
||||
|
||||
#if (env['openssl']!='no'):
|
||||
# env.Append(CPPFLAGS=['-DOPENSSL_ENABLED']);
|
||||
# if (env['openssl']=="builtin"):
|
||||
# env.Append(CPPPATH=['#drivers/builtin_openssl2'])
|
||||
Export('env')
|
||||
|
||||
if (env["builtin_zlib"]=='yes'):
|
||||
env.Append(CPPPATH=['#drivers/builtin_zlib/zlib'])
|
||||
# build subdirs, the build order is dependent on link order.
|
||||
|
||||
# to test 64 bits compiltion
|
||||
# env.Append(CPPFLAGS=['-m64'])
|
||||
SConscript("core/SCsub")
|
||||
SConscript("servers/SCsub")
|
||||
SConscript("scene/SCsub")
|
||||
SConscript("tools/SCsub")
|
||||
SConscript("drivers/SCsub")
|
||||
SConscript("bin/SCsub")
|
||||
|
||||
if (env_base['squish']=='yes'):
|
||||
env.Append(CPPFLAGS=['-DSQUISH_ENABLED']);
|
||||
SConscript("modules/SCsub")
|
||||
SConscript("main/SCsub")
|
||||
|
||||
if (env['vorbis']=='yes'):
|
||||
env.Append(CPPFLAGS=['-DVORBIS_ENABLED']);
|
||||
if (env['opus']=='yes'):
|
||||
env.Append(CPPFLAGS=['-DOPUS_ENABLED']);
|
||||
SConscript("platform/" + selected_platform + "/SCsub") # build selected platform
|
||||
|
||||
# Microsoft Visual Studio Project Generation
|
||||
if (env['vsproj']) == "yes":
|
||||
|
||||
if (env['theora']=='yes'):
|
||||
env['theoralib']='yes'
|
||||
env.Append(CPPFLAGS=['-DTHEORA_ENABLED']);
|
||||
if (env['theoralib']=='yes'):
|
||||
env.Append(CPPFLAGS=['-DTHEORALIB_ENABLED']);
|
||||
AddToVSProject(env.core_sources)
|
||||
AddToVSProject(env.main_sources)
|
||||
AddToVSProject(env.modules_sources)
|
||||
AddToVSProject(env.scene_sources)
|
||||
AddToVSProject(env.servers_sources)
|
||||
AddToVSProject(env.tool_sources)
|
||||
|
||||
if (env['png']=='yes'):
|
||||
env.Append(CPPFLAGS=['-DPNG_ENABLED']);
|
||||
if (env['dds']=='yes'):
|
||||
env.Append(CPPFLAGS=['-DDDS_ENABLED']);
|
||||
if (env['pvr']=='yes'):
|
||||
env.Append(CPPFLAGS=['-DPVR_ENABLED']);
|
||||
if (env['jpg']=='yes'):
|
||||
env.Append(CPPFLAGS=['-DJPG_ENABLED']);
|
||||
if (env['webp']=='yes'):
|
||||
env.Append(CPPFLAGS=['-DWEBP_ENABLED']);
|
||||
# this env flag won't work, it needs to be set in env_base=Environment(MSVC_VERSION='9.0')
|
||||
# Even then, SCons still seems to ignore it and builds with the latest MSVC...
|
||||
# That said, it's not needed to be set so far but I'm leaving it here so that this comment
|
||||
# has a purpose.
|
||||
# env['MSVS_VERSION']='9.0'
|
||||
|
||||
if (env['speex']=='yes'):
|
||||
env.Append(CPPFLAGS=['-DSPEEX_ENABLED']);
|
||||
# Calls a CMD with /C(lose) and /V(delayed environment variable expansion) options.
|
||||
# And runs vcvarsall bat for the propper arhitecture and scons for propper configuration
|
||||
env['MSVSBUILDCOM'] = 'cmd /V /C set "plat=$(PlatformTarget)" ^& (if "$(PlatformTarget)"=="x64" (set "plat=x86_amd64")) ^& set "tools=yes" ^& (if "$(Configuration)"=="release" (set "tools=no")) ^& call "$(VCInstallDir)vcvarsall.bat" !plat! ^& scons platform=windows target=$(Configuration) tools=!tools! -j2'
|
||||
env['MSVSREBUILDCOM'] = 'cmd /V /C set "plat=$(PlatformTarget)" ^& (if "$(PlatformTarget)"=="x64" (set "plat=x86_amd64")) ^& set "tools=yes" ^& (if "$(Configuration)"=="release" (set "tools=no")) & call "$(VCInstallDir)vcvarsall.bat" !plat! ^& scons platform=windows target=$(Configuration) tools=!tools! vsproj=yes -j2'
|
||||
env['MSVSCLEANCOM'] = 'cmd /V /C set "plat=$(PlatformTarget)" ^& (if "$(PlatformTarget)"=="x64" (set "plat=x86_amd64")) ^& set "tools=yes" ^& (if "$(Configuration)"=="release" (set "tools=no")) ^& call "$(VCInstallDir)vcvarsall.bat" !plat! ^& scons --clean platform=windows target=$(Configuration) tools=!tools! -j2'
|
||||
|
||||
if (env['tools']=='yes'):
|
||||
env.Append(CPPFLAGS=['-DTOOLS_ENABLED'])
|
||||
if (env['disable_3d']=='yes'):
|
||||
env.Append(CPPFLAGS=['-D_3D_DISABLED'])
|
||||
if (env['gdscript']=='yes'):
|
||||
env.Append(CPPFLAGS=['-DGDSCRIPT_ENABLED'])
|
||||
if (env['disable_advanced_gui']=='yes'):
|
||||
env.Append(CPPFLAGS=['-DADVANCED_GUI_DISABLED'])
|
||||
|
||||
if (env['minizip'] == 'yes'):
|
||||
env.Append(CPPFLAGS=['-DMINIZIP_ENABLED'])
|
||||
|
||||
if (env['xml']=='yes'):
|
||||
env.Append(CPPFLAGS=['-DXML_ENABLED'])
|
||||
|
||||
if (env['colored']=='yes'):
|
||||
methods.colored(sys,env)
|
||||
|
||||
if (env['etc1']=='yes'):
|
||||
env.Append(CPPFLAGS=['-DETC1_ENABLED'])
|
||||
|
||||
Export('env')
|
||||
|
||||
#build subdirs, the build order is dependent on link order.
|
||||
|
||||
SConscript("core/SCsub")
|
||||
SConscript("servers/SCsub")
|
||||
SConscript("scene/SCsub")
|
||||
SConscript("tools/SCsub")
|
||||
SConscript("drivers/SCsub")
|
||||
SConscript("bin/SCsub")
|
||||
|
||||
SConscript("modules/SCsub")
|
||||
SConscript("main/SCsub")
|
||||
|
||||
SConscript("platform/"+selected_platform+"/SCsub"); # build selected platform
|
||||
|
||||
# Microsoft Visual Studio Project Generation
|
||||
if (env['vsproj'])=="yes":
|
||||
|
||||
AddToVSProject(env.core_sources)
|
||||
AddToVSProject(env.main_sources)
|
||||
AddToVSProject(env.modules_sources)
|
||||
AddToVSProject(env.scene_sources)
|
||||
AddToVSProject(env.servers_sources)
|
||||
AddToVSProject(env.tool_sources)
|
||||
|
||||
# this env flag won't work, it needs to be set in env_base=Environment(MSVC_VERSION='9.0')
|
||||
# Even then, SCons still seems to ignore it and builds with the latest MSVC...
|
||||
# That said, it's not needed to be set so far but I'm leaving it here so that this comment
|
||||
# has a purpose.
|
||||
#env['MSVS_VERSION']='9.0'
|
||||
|
||||
|
||||
# Calls a CMD with /C(lose) and /V(delayed environment variable expansion) options.
|
||||
# And runs vcvarsall bat for the propper arhitecture and scons for propper configuration
|
||||
env['MSVSBUILDCOM'] = 'cmd /V /C set "plat=$(PlatformTarget)" ^& (if "$(PlatformTarget)"=="x64" (set "plat=x86_amd64")) ^& set "tools=yes" ^& (if "$(Configuration)"=="release" (set "tools=no")) ^& call "$(VCInstallDir)vcvarsall.bat" !plat! ^& scons platform=windows target=$(Configuration) tools=!tools! -j2'
|
||||
env['MSVSREBUILDCOM'] = 'cmd /V /C set "plat=$(PlatformTarget)" ^& (if "$(PlatformTarget)"=="x64" (set "plat=x86_amd64")) ^& set "tools=yes" ^& (if "$(Configuration)"=="release" (set "tools=no")) & call "$(VCInstallDir)vcvarsall.bat" !plat! ^& scons platform=windows target=$(Configuration) tools=!tools! vsproj=yes -j2'
|
||||
env['MSVSCLEANCOM'] = 'cmd /V /C set "plat=$(PlatformTarget)" ^& (if "$(PlatformTarget)"=="x64" (set "plat=x86_amd64")) ^& set "tools=yes" ^& (if "$(Configuration)"=="release" (set "tools=no")) ^& call "$(VCInstallDir)vcvarsall.bat" !plat! ^& scons --clean platform=windows target=$(Configuration) tools=!tools! -j2'
|
||||
|
||||
# This version information (Win32, x64, Debug, Release, Release_Debug seems to be
|
||||
# required for Visual Studio to understand that it needs to generate an NMAKE
|
||||
# project. Do not modify without knowing what you are doing.
|
||||
debug_variants = ['debug|Win32']+['debug|x64']
|
||||
release_variants = ['release|Win32']+['release|x64']
|
||||
release_debug_variants = ['release_debug|Win32']+['release_debug|x64']
|
||||
variants = debug_variants + release_variants + release_debug_variants
|
||||
debug_targets = ['Debug']+['Debug']
|
||||
release_targets = ['Release']+['Release']
|
||||
release_debug_targets = ['ReleaseDebug']+['ReleaseDebug']
|
||||
targets = debug_targets + release_targets + release_debug_targets
|
||||
msvproj = env.MSVSProject(target = ['#godot' + env['MSVSPROJECTSUFFIX'] ],
|
||||
incs = env.vs_incs,
|
||||
srcs = env.vs_srcs,
|
||||
runfile = targets,
|
||||
buildtarget = targets,
|
||||
auto_build_solution=1,
|
||||
variant = variants)
|
||||
# This version information (Win32, x64, Debug, Release, Release_Debug seems to be
|
||||
# required for Visual Studio to understand that it needs to generate an NMAKE
|
||||
# project. Do not modify without knowing what you are doing.
|
||||
debug_variants = ['debug|Win32'] + ['debug|x64']
|
||||
release_variants = ['release|Win32'] + ['release|x64']
|
||||
release_debug_variants = ['release_debug|Win32'] + ['release_debug|x64']
|
||||
variants = debug_variants + release_variants + release_debug_variants
|
||||
debug_targets = ['bin\\godot.windows.tools.32.exe'] + ['bin\\godot.windows.tools.64.exe']
|
||||
release_targets = ['bin\\godot.windows.opt.32.exe'] + ['bin\\godot.windows.opt.64.exe']
|
||||
release_debug_targets = ['bin\\godot.windows.opt.tools.32.exe'] + ['bin\\godot.windows.opt.tools.64.exe']
|
||||
targets = debug_targets + release_targets + release_debug_targets
|
||||
msvproj = env.MSVSProject(target=['#godot' + env['MSVSPROJECTSUFFIX']],
|
||||
incs=env.vs_incs,
|
||||
srcs=env.vs_srcs,
|
||||
runfile=targets,
|
||||
buildtarget=targets,
|
||||
auto_build_solution=1,
|
||||
variant=variants)
|
||||
|
||||
else:
|
||||
|
||||
print("No valid target platform selected.")
|
||||
print("The following were detected:")
|
||||
for x in platform_list:
|
||||
print("\t"+x)
|
||||
print("\nPlease run scons again with argument: platform=<string>")
|
||||
print("No valid target platform selected.")
|
||||
print("The following were detected:")
|
||||
for x in platform_list:
|
||||
print("\t" + x)
|
||||
print("\nPlease run scons again with argument: platform=<string>")
|
||||
|
@@ -1,4 +1,6 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
Import('env')
|
||||
Export('env')
|
||||
|
||||
SConscript('tests/SCsub');
|
||||
SConscript('tests/SCsub')
|
||||
|
@@ -1,12 +1,14 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
Import('env')
|
||||
|
||||
env.tests_sources=[]
|
||||
env.add_source_files(env.tests_sources,"*.cpp")
|
||||
env.tests_sources = []
|
||||
env.add_source_files(env.tests_sources, "*.cpp")
|
||||
|
||||
Export('env')
|
||||
|
||||
#SConscript('math/SCsub');
|
||||
# SConscript('math/SCsub');
|
||||
|
||||
lib = env.Library("tests",env.tests_sources)
|
||||
lib = env.Library("tests", env.tests_sources)
|
||||
|
||||
env.Prepend(LIBS=[lib])
|
||||
|
72
core/SCsub
72
core/SCsub
@@ -1,65 +1,67 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
Import('env')
|
||||
|
||||
env.core_sources=[]
|
||||
env.core_sources = []
|
||||
|
||||
|
||||
gd_call=""
|
||||
gd_inc=""
|
||||
gd_call = ""
|
||||
gd_inc = ""
|
||||
|
||||
for x in env.global_defaults:
|
||||
env.core_sources.append("#platform/"+x+"/globals/global_defaults.cpp")
|
||||
gd_inc+='#include "platform/'+x+'/globals/global_defaults.h"\n'
|
||||
gd_call+="\tregister_"+x+"_global_defaults();\n"
|
||||
env.core_sources.append("#platform/" + x + "/globals/global_defaults.cpp")
|
||||
gd_inc += '#include "platform/' + x + '/globals/global_defaults.h"\n'
|
||||
gd_call += "\tregister_" + x + "_global_defaults();\n"
|
||||
|
||||
gd_cpp='#include "globals.h"\n'
|
||||
gd_cpp+=gd_inc
|
||||
gd_cpp+="void Globals::register_global_defaults() {\n"+gd_call+"\n}\n"
|
||||
gd_cpp = '#include "globals.h"\n'
|
||||
gd_cpp += gd_inc
|
||||
gd_cpp += "void Globals::register_global_defaults() {\n" + gd_call + "\n}\n"
|
||||
|
||||
f = open("global_defaults.cpp","wb")
|
||||
f = open("global_defaults.cpp", "wb")
|
||||
f.write(gd_cpp)
|
||||
f.close()
|
||||
|
||||
import os
|
||||
txt = "0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0"
|
||||
if ("SCRIPT_AES256_ENCRYPTION_KEY" in os.environ):
|
||||
e=os.environ["SCRIPT_AES256_ENCRYPTION_KEY"]
|
||||
txt = ""
|
||||
ec_valid=True
|
||||
if (len(e)!=64):
|
||||
ec_valid=False
|
||||
else:
|
||||
e = os.environ["SCRIPT_AES256_ENCRYPTION_KEY"]
|
||||
txt = ""
|
||||
ec_valid = True
|
||||
if (len(e) != 64):
|
||||
ec_valid = False
|
||||
else:
|
||||
|
||||
for i in range(len(e)>>1):
|
||||
if (i>0):
|
||||
txt+=","
|
||||
txts="0x"+e[i*2:i*2+2]
|
||||
try:
|
||||
int(txts,16)
|
||||
except:
|
||||
ec_valid=False
|
||||
txt+=txts
|
||||
if (not ec_valid):
|
||||
txt = "0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0"
|
||||
print("Invalid AES256 encryption key, not 64 bits hex: "+e)
|
||||
for i in range(len(e) >> 1):
|
||||
if (i > 0):
|
||||
txt += ","
|
||||
txts = "0x" + e[i * 2:i * 2 + 2]
|
||||
try:
|
||||
int(txts, 16)
|
||||
except:
|
||||
ec_valid = False
|
||||
txt += txts
|
||||
if (not ec_valid):
|
||||
txt = "0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0"
|
||||
print("Invalid AES256 encryption key, not 64 bits hex: " + e)
|
||||
|
||||
f = open("script_encryption_key.cpp", "wb")
|
||||
f.write("#include \"globals.h\"\nuint8_t script_encryption_key[32]={" + txt + "};\n")
|
||||
f.close()
|
||||
|
||||
|
||||
env.add_source_files(env.core_sources,"*.cpp")
|
||||
env.add_source_files(env.core_sources, "*.cpp")
|
||||
|
||||
|
||||
Export('env')
|
||||
|
||||
import make_binders
|
||||
env.Command(['method_bind.inc','method_bind_ext.inc'], 'make_binders.py', make_binders.run)
|
||||
env.Command(['method_bind.inc', 'method_bind_ext.inc'], 'make_binders.py', make_binders.run)
|
||||
|
||||
SConscript('os/SCsub');
|
||||
SConscript('math/SCsub');
|
||||
SConscript('io/SCsub');
|
||||
SConscript('bind/SCsub');
|
||||
SConscript('os/SCsub')
|
||||
SConscript('math/SCsub')
|
||||
SConscript('io/SCsub')
|
||||
SConscript('bind/SCsub')
|
||||
|
||||
lib = env.Library("core",env.core_sources)
|
||||
lib = env.Library("core", env.core_sources)
|
||||
|
||||
env.Prepend(LIBS=[lib])
|
||||
|
@@ -1,5 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
Import('env')
|
||||
|
||||
env.add_source_files(env.core_sources,"*.cpp")
|
||||
env.add_source_files(env.core_sources, "*.cpp")
|
||||
|
||||
Export('env')
|
||||
|
@@ -480,9 +480,9 @@ void _OS::set_use_vsync(bool p_enable) {
|
||||
OS::get_singleton()->set_use_vsync(p_enable);
|
||||
}
|
||||
|
||||
bool _OS::is_vsnc_enabled() const {
|
||||
bool _OS::is_vsync_enabled() const {
|
||||
|
||||
return OS::get_singleton()->is_vsnc_enabled();
|
||||
return OS::get_singleton()->is_vsync_enabled();
|
||||
}
|
||||
|
||||
|
||||
@@ -1172,7 +1172,7 @@ void _OS::_bind_methods() {
|
||||
ObjectTypeDB::bind_method(_MD("set_thread_name","name"),&_OS::set_thread_name);
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("set_use_vsync","enable"),&_OS::set_use_vsync);
|
||||
ObjectTypeDB::bind_method(_MD("is_vsnc_enabled"),&_OS::is_vsnc_enabled);
|
||||
ObjectTypeDB::bind_method(_MD("is_vsync_enabled"),&_OS::is_vsync_enabled);
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("get_engine_version"),&_OS::get_engine_version);
|
||||
|
||||
@@ -1936,6 +1936,13 @@ Error _Directory::make_dir(String p_dir){
|
||||
Error _Directory::make_dir_recursive(String p_dir){
|
||||
|
||||
ERR_FAIL_COND_V(!d,ERR_UNCONFIGURED);
|
||||
if (!p_dir.is_rel_path()) {
|
||||
DirAccess *d = DirAccess::create_for_path(p_dir);
|
||||
Error err = d->make_dir_recursive(p_dir);
|
||||
memdelete(d);
|
||||
return err;
|
||||
|
||||
}
|
||||
return d->make_dir_recursive(p_dir);
|
||||
}
|
||||
|
||||
|
@@ -318,7 +318,7 @@ public:
|
||||
Error set_thread_name(const String& p_name);
|
||||
|
||||
void set_use_vsync(bool p_enable);
|
||||
bool is_vsnc_enabled() const;
|
||||
bool is_vsync_enabled() const;
|
||||
|
||||
Dictionary get_engine_version() const;
|
||||
|
||||
|
@@ -57,33 +57,33 @@ enum Error {
|
||||
ERR_FILE_MISSING_DEPENDENCIES,
|
||||
ERR_FILE_EOF,
|
||||
ERR_CANT_OPEN, ///< Can't open a resource/socket/file
|
||||
ERR_CANT_CREATE,
|
||||
ERROR_QUERY_FAILED, // (20)
|
||||
ERR_CANT_CREATE, // (20)
|
||||
ERROR_QUERY_FAILED,
|
||||
ERR_ALREADY_IN_USE,
|
||||
ERR_LOCKED, ///< resource is locked
|
||||
ERR_TIMEOUT,
|
||||
ERR_CANT_CONNECT,
|
||||
ERR_CANT_RESOLVE, // (25)
|
||||
ERR_CANT_CONNECT, // (25)
|
||||
ERR_CANT_RESOLVE,
|
||||
ERR_CONNECTION_ERROR,
|
||||
ERR_CANT_AQUIRE_RESOURCE,
|
||||
ERR_CANT_FORK,
|
||||
ERR_INVALID_DATA, ///< Data passed is invalid
|
||||
ERR_INVALID_PARAMETER, ///< Parameter passed is invalid (30)
|
||||
ERR_INVALID_DATA, ///< Data passed is invalid (30)
|
||||
ERR_INVALID_PARAMETER, ///< Parameter passed is invalid
|
||||
ERR_ALREADY_EXISTS, ///< When adding, item already exists
|
||||
ERR_DOES_NOT_EXIST, ///< When retrieving/erasing, it item does not exist
|
||||
ERR_DATABASE_CANT_READ, ///< database is full
|
||||
ERR_DATABASE_CANT_WRITE, ///< database is full
|
||||
ERR_COMPILATION_FAILED, // (35)
|
||||
ERR_DATABASE_CANT_WRITE, ///< database is full (35)
|
||||
ERR_COMPILATION_FAILED,
|
||||
ERR_METHOD_NOT_FOUND,
|
||||
ERR_LINK_FAILED,
|
||||
ERR_SCRIPT_FAILED,
|
||||
ERR_CYCLIC_LINK,
|
||||
ERR_INVALID_DECLARATION, // (40)
|
||||
ERR_CYCLIC_LINK, // (40)
|
||||
ERR_INVALID_DECLARATION,
|
||||
ERR_DUPLICATE_SYMBOL,
|
||||
ERR_PARSE_ERROR,
|
||||
ERR_BUSY,
|
||||
ERR_SKIP,
|
||||
ERR_HELP, ///< user requested help!! (45)
|
||||
ERR_SKIP, // (45)
|
||||
ERR_HELP, ///< user requested help!!
|
||||
ERR_BUG, ///< a bug in the software certainly happened, due to a double check failing or unexpected behavior.
|
||||
ERR_PRINTER_ON_FIRE, /// the parallel port printer is engulfed in flames
|
||||
ERR_OMFG_THIS_IS_VERY_VERY_BAD, ///< shit happens, has never been used, though
|
||||
|
@@ -65,7 +65,7 @@ void FuncRef::_bind_methods() {
|
||||
mi.arguments.push_back( PropertyInfo( Variant::NIL, "arg"+itos(i)));
|
||||
defargs.push_back(Variant());
|
||||
}
|
||||
ObjectTypeDB::bind_native_method(METHOD_FLAGS_DEFAULT,"call_func:Variant",&FuncRef::call_func,mi,defargs);
|
||||
ObjectTypeDB::bind_native_method(METHOD_FLAGS_DEFAULT,"call_func",&FuncRef::call_func,mi,defargs);
|
||||
|
||||
}
|
||||
|
||||
|
@@ -54,7 +54,7 @@ String Globals::localize_path(const String& p_path) const {
|
||||
if (resource_path=="")
|
||||
return p_path; //not initialied yet
|
||||
|
||||
if (p_path.begins_with("res://") || p_path.begins_with("user://"))
|
||||
if (p_path.begins_with("res://") || p_path.begins_with("user://") || p_path.is_abs_path())
|
||||
return p_path.simplify_path();
|
||||
|
||||
|
||||
@@ -1375,6 +1375,25 @@ Vector<String> Globals::get_optimizer_presets() const {
|
||||
|
||||
}
|
||||
|
||||
void Globals::_add_property_info_bind(const Dictionary& p_info) {
|
||||
|
||||
ERR_FAIL_COND(!p_info.has("name"));
|
||||
ERR_FAIL_COND(!p_info.has("type"));
|
||||
|
||||
PropertyInfo pinfo;
|
||||
pinfo.name = p_info["name"];
|
||||
ERR_FAIL_COND(!props.has(pinfo.name));
|
||||
pinfo.type = Variant::Type(p_info["type"].operator int());
|
||||
ERR_FAIL_INDEX(pinfo.type, Variant::VARIANT_MAX);
|
||||
|
||||
if (p_info.has("hint"))
|
||||
pinfo.hint = PropertyHint(p_info["hint"].operator int());
|
||||
if (p_info.has("hint_string"))
|
||||
pinfo.hint_string = p_info["hint_string"];
|
||||
|
||||
set_custom_property_info(pinfo.name, pinfo);
|
||||
}
|
||||
|
||||
void Globals::set_custom_property_info(const String& p_prop,const PropertyInfo& p_info) {
|
||||
|
||||
ERR_FAIL_COND(!props.has(p_prop));
|
||||
@@ -1399,6 +1418,7 @@ void Globals::_bind_methods() {
|
||||
ObjectTypeDB::bind_method(_MD("get_order","name"),&Globals::get_order);
|
||||
ObjectTypeDB::bind_method(_MD("set_persisting","name","enable"),&Globals::set_persisting);
|
||||
ObjectTypeDB::bind_method(_MD("is_persisting","name"),&Globals::is_persisting);
|
||||
ObjectTypeDB::bind_method(_MD("add_property_info", "hint"),&Globals::_add_property_info_bind);
|
||||
ObjectTypeDB::bind_method(_MD("clear","name"),&Globals::clear);
|
||||
ObjectTypeDB::bind_method(_MD("localize_path","path"),&Globals::localize_path);
|
||||
ObjectTypeDB::bind_method(_MD("globalize_path","path"),&Globals::globalize_path);
|
||||
|
@@ -96,6 +96,8 @@ protected:
|
||||
|
||||
bool _load_resource_pack(const String& p_pack);
|
||||
|
||||
void _add_property_info_bind(const Dictionary& p_info);
|
||||
|
||||
protected:
|
||||
|
||||
static void _bind_methods();
|
||||
|
@@ -74,7 +74,10 @@ static inline uint32_t hash_djb2_one_float(float p_in,uint32_t p_prev=5381) {
|
||||
float f;
|
||||
uint32_t i;
|
||||
} u;
|
||||
u.f=p_in;
|
||||
|
||||
// handle -0 case
|
||||
if (p_in==0.0f) u.f=0.0f;
|
||||
else u.f=p_in;
|
||||
|
||||
return ((p_prev<<5)+p_prev)+u.i;
|
||||
}
|
||||
|
@@ -232,64 +232,6 @@ bool InputMap::event_is_action(const InputEvent& p_event, const StringName& p_ac
|
||||
return _find_event(E->get().inputs,p_event)!=NULL;
|
||||
}
|
||||
|
||||
bool InputMap::event_is_joy_motion_action_pressed(const InputEvent& p_event) const {
|
||||
|
||||
ERR_FAIL_COND_V(p_event.type!=InputEvent::JOYSTICK_MOTION,false);
|
||||
bool pressed=false;
|
||||
|
||||
//this could be optimized by having a separate list of joymotions?
|
||||
|
||||
for (Map<StringName, Action>::Element *A=input_map.front();A;A=A->next()) {
|
||||
|
||||
for (List<InputEvent>::Element *E=A->get().inputs.front();E;E=E->next()) {
|
||||
|
||||
const InputEvent& e=E->get();
|
||||
if(e.type!=p_event.type)
|
||||
continue;
|
||||
if (e.type!=InputEvent::KEY && e.device!=p_event.device)
|
||||
continue;
|
||||
|
||||
switch(p_event.type) {
|
||||
|
||||
case InputEvent::KEY: {
|
||||
|
||||
if (e.key.scancode==p_event.key.scancode && e.key.mod == p_event.key.mod)
|
||||
return e.key.pressed;
|
||||
|
||||
} break;
|
||||
case InputEvent::JOYSTICK_BUTTON: {
|
||||
|
||||
if (e.joy_button.button_index==p_event.joy_button.button_index) {
|
||||
return e.joy_button.pressed;
|
||||
}
|
||||
|
||||
} break;
|
||||
case InputEvent::MOUSE_BUTTON: {
|
||||
|
||||
if (e.mouse_button.button_index==p_event.mouse_button.button_index) {
|
||||
return e.mouse_button.pressed;
|
||||
}
|
||||
|
||||
} break;
|
||||
case InputEvent::JOYSTICK_MOTION: {
|
||||
|
||||
if (e.joy_motion.axis==p_event.joy_motion.axis) {
|
||||
if (
|
||||
(e.joy_motion.axis_value * p_event.joy_motion.axis_value >0) && //same axis
|
||||
ABS(e.joy_motion.axis_value)>0.5 && ABS(p_event.joy_motion.axis_value)>0.5 )
|
||||
pressed=true;
|
||||
}
|
||||
|
||||
} break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return pressed;
|
||||
|
||||
}
|
||||
|
||||
void InputMap::load_from_globals() {
|
||||
|
||||
input_map.clear();;
|
||||
|
@@ -70,7 +70,6 @@ public:
|
||||
|
||||
const List<InputEvent> *get_action_list(const StringName& p_action);
|
||||
bool event_is_action(const InputEvent& p_event, const StringName& p_action) const;
|
||||
bool event_is_joy_motion_action_pressed(const InputEvent& p_event) const;
|
||||
|
||||
|
||||
void load_from_globals();
|
||||
|
@@ -1,7 +1,9 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
Import('env')
|
||||
|
||||
env.add_source_files(env.core_sources,"*.cpp")
|
||||
env.add_source_files(env.core_sources,"*.c")
|
||||
#env.core_sources.append("io/fastlz.c")
|
||||
env.add_source_files(env.core_sources, "*.cpp")
|
||||
env.add_source_files(env.core_sources, "*.c")
|
||||
# env.core_sources.append("io/fastlz.c")
|
||||
|
||||
Export('env')
|
||||
|
@@ -1,7 +1,7 @@
|
||||
# -*- coding: ibm850 -*-
|
||||
|
||||
|
||||
template_typed="""
|
||||
template_typed = """
|
||||
#ifdef TYPED_METHOD_BIND
|
||||
template<class T $ifret ,class R$ $ifargs ,$ $arg, class P@$>
|
||||
class MethodBind$argc$$ifret R$$ifconst C$ : public MethodBind {
|
||||
@@ -75,7 +75,7 @@ MethodBind* create_method_bind($ifret R$ $ifnoret void$ (T::*p_method)($arg, P@$
|
||||
#endif
|
||||
"""
|
||||
|
||||
template="""
|
||||
template = """
|
||||
#ifndef TYPED_METHOD_BIND
|
||||
$iftempl template<$ $ifret class R$ $ifretargs ,$ $arg, class P@$ $iftempl >$
|
||||
class MethodBind$argc$$ifret R$$ifconst C$ : public MethodBind {
|
||||
@@ -161,96 +161,95 @@ MethodBind* create_method_bind($ifret R$ $ifnoret void$ (T::*p_method)($arg, P@$
|
||||
"""
|
||||
|
||||
|
||||
def make_version(template,nargs,argmax,const,ret):
|
||||
def make_version(template, nargs, argmax, const, ret):
|
||||
|
||||
intext=template
|
||||
from_pos=0
|
||||
outtext=""
|
||||
intext = template
|
||||
from_pos = 0
|
||||
outtext = ""
|
||||
|
||||
while(True):
|
||||
to_pos=intext.find("$",from_pos)
|
||||
if (to_pos==-1):
|
||||
outtext+=intext[from_pos:]
|
||||
break
|
||||
else:
|
||||
outtext+=intext[from_pos:to_pos]
|
||||
end=intext.find("$",to_pos+1)
|
||||
if (end==-1):
|
||||
break # ignore
|
||||
macro=intext[to_pos+1:end]
|
||||
cmd=""
|
||||
data=""
|
||||
while(True):
|
||||
to_pos = intext.find("$", from_pos)
|
||||
if (to_pos == -1):
|
||||
outtext += intext[from_pos:]
|
||||
break
|
||||
else:
|
||||
outtext += intext[from_pos:to_pos]
|
||||
end = intext.find("$", to_pos + 1)
|
||||
if (end == -1):
|
||||
break # ignore
|
||||
macro = intext[to_pos + 1:end]
|
||||
cmd = ""
|
||||
data = ""
|
||||
|
||||
if (macro.find(" ")!=-1):
|
||||
cmd=macro[0:macro.find(" ")]
|
||||
data=macro[macro.find(" ")+1:]
|
||||
else:
|
||||
cmd=macro
|
||||
if (macro.find(" ") != -1):
|
||||
cmd = macro[0:macro.find(" ")]
|
||||
data = macro[macro.find(" ") + 1:]
|
||||
else:
|
||||
cmd = macro
|
||||
|
||||
if (cmd=="argc"):
|
||||
outtext+=str(nargs)
|
||||
if (cmd=="ifret" and ret):
|
||||
outtext+=data
|
||||
if (cmd=="ifargs" and nargs):
|
||||
outtext+=data
|
||||
if (cmd=="ifretargs" and nargs and ret):
|
||||
outtext+=data
|
||||
if (cmd=="ifconst" and const):
|
||||
outtext+=data
|
||||
elif (cmd=="ifnoconst" and not const):
|
||||
outtext+=data
|
||||
elif (cmd=="ifnoret" and not ret):
|
||||
outtext+=data
|
||||
elif (cmd=="iftempl" and (nargs>0 or ret)):
|
||||
outtext+=data
|
||||
elif (cmd=="arg,"):
|
||||
for i in range(1,nargs+1):
|
||||
if (i>1):
|
||||
outtext+=", "
|
||||
outtext+=data.replace("@",str(i))
|
||||
elif (cmd=="arg"):
|
||||
for i in range(1,nargs+1):
|
||||
outtext+=data.replace("@",str(i))
|
||||
elif (cmd=="noarg"):
|
||||
for i in range(nargs+1,argmax+1):
|
||||
outtext+=data.replace("@",str(i))
|
||||
elif (cmd=="noarg"):
|
||||
for i in range(nargs+1,argmax+1):
|
||||
outtext+=data.replace("@",str(i))
|
||||
if (cmd == "argc"):
|
||||
outtext += str(nargs)
|
||||
if (cmd == "ifret" and ret):
|
||||
outtext += data
|
||||
if (cmd == "ifargs" and nargs):
|
||||
outtext += data
|
||||
if (cmd == "ifretargs" and nargs and ret):
|
||||
outtext += data
|
||||
if (cmd == "ifconst" and const):
|
||||
outtext += data
|
||||
elif (cmd == "ifnoconst" and not const):
|
||||
outtext += data
|
||||
elif (cmd == "ifnoret" and not ret):
|
||||
outtext += data
|
||||
elif (cmd == "iftempl" and (nargs > 0 or ret)):
|
||||
outtext += data
|
||||
elif (cmd == "arg,"):
|
||||
for i in range(1, nargs + 1):
|
||||
if (i > 1):
|
||||
outtext += ", "
|
||||
outtext += data.replace("@", str(i))
|
||||
elif (cmd == "arg"):
|
||||
for i in range(1, nargs + 1):
|
||||
outtext += data.replace("@", str(i))
|
||||
elif (cmd == "noarg"):
|
||||
for i in range(nargs + 1, argmax + 1):
|
||||
outtext += data.replace("@", str(i))
|
||||
elif (cmd == "noarg"):
|
||||
for i in range(nargs + 1, argmax + 1):
|
||||
outtext += data.replace("@", str(i))
|
||||
|
||||
from_pos=end+1
|
||||
from_pos = end + 1
|
||||
|
||||
return outtext
|
||||
return outtext
|
||||
|
||||
|
||||
def run(target, source, env):
|
||||
|
||||
versions=10
|
||||
versions_ext=6
|
||||
text=""
|
||||
text_ext=""
|
||||
versions = 10
|
||||
versions_ext = 6
|
||||
text = ""
|
||||
text_ext = ""
|
||||
|
||||
for i in range(0,versions+1):
|
||||
for i in range(0, versions + 1):
|
||||
|
||||
t=""
|
||||
t+=make_version(template,i,versions,False,False)
|
||||
t+=make_version(template_typed,i,versions,False,False)
|
||||
t+=make_version(template,i,versions,False,True)
|
||||
t+=make_version(template_typed,i,versions,False,True)
|
||||
t+=make_version(template,i,versions,True,False)
|
||||
t+=make_version(template_typed,i,versions,True,False)
|
||||
t+=make_version(template,i,versions,True,True)
|
||||
t+=make_version(template_typed,i,versions,True,True)
|
||||
if (i>=versions_ext):
|
||||
text_ext+=t
|
||||
else:
|
||||
text+=t
|
||||
t = ""
|
||||
t += make_version(template, i, versions, False, False)
|
||||
t += make_version(template_typed, i, versions, False, False)
|
||||
t += make_version(template, i, versions, False, True)
|
||||
t += make_version(template_typed, i, versions, False, True)
|
||||
t += make_version(template, i, versions, True, False)
|
||||
t += make_version(template_typed, i, versions, True, False)
|
||||
t += make_version(template, i, versions, True, True)
|
||||
t += make_version(template_typed, i, versions, True, True)
|
||||
if (i >= versions_ext):
|
||||
text_ext += t
|
||||
else:
|
||||
text += t
|
||||
|
||||
f = open(target[0].path, "w")
|
||||
f.write(text)
|
||||
f.close()
|
||||
|
||||
f=open(target[0].path,"w")
|
||||
f.write(text)
|
||||
f.close()
|
||||
|
||||
f=open(target[1].path,"w")
|
||||
f.write(text_ext)
|
||||
f.close()
|
||||
f = open(target[1].path, "w")
|
||||
f.write(text_ext)
|
||||
f.close()
|
||||
|
@@ -1,5 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
Import('env')
|
||||
|
||||
env.add_source_files(env.core_sources,"*.cpp")
|
||||
env.add_source_files(env.core_sources, "*.cpp")
|
||||
|
||||
Export('env')
|
||||
|
440
core/math/a_star.cpp
Normal file
440
core/math/a_star.cpp
Normal file
@@ -0,0 +1,440 @@
|
||||
/*************************************************************************/
|
||||
/* a_star.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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. */
|
||||
/*************************************************************************/
|
||||
#include "a_star.h"
|
||||
#include "geometry.h"
|
||||
|
||||
|
||||
int AStar::get_available_point_id() const {
|
||||
|
||||
if (points.empty()) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return points.back()->key()+1;
|
||||
}
|
||||
|
||||
void AStar::add_point(int p_id, const Vector3 &p_pos, float p_weight_scale) {
|
||||
ERR_FAIL_COND(p_id<0);
|
||||
if (!points.has(p_id)) {
|
||||
Point *pt = memnew( Point );
|
||||
pt->id=p_id;
|
||||
pt->pos=p_pos;
|
||||
pt->weight_scale=p_weight_scale;
|
||||
pt->prev_point=NULL;
|
||||
pt->last_pass=0;
|
||||
points[p_id]=pt;
|
||||
} else {
|
||||
points[p_id]->pos=p_pos;
|
||||
points[p_id]->weight_scale=p_weight_scale;
|
||||
}
|
||||
}
|
||||
|
||||
Vector3 AStar::get_point_pos(int p_id) const{
|
||||
|
||||
ERR_FAIL_COND_V(!points.has(p_id),Vector3());
|
||||
|
||||
return points[p_id]->pos;
|
||||
|
||||
}
|
||||
float AStar::get_point_weight_scale(int p_id) const{
|
||||
|
||||
ERR_FAIL_COND_V(!points.has(p_id),0);
|
||||
|
||||
return points[p_id]->weight_scale;
|
||||
|
||||
}
|
||||
void AStar::remove_point(int p_id){
|
||||
|
||||
ERR_FAIL_COND(!points.has(p_id));
|
||||
|
||||
Point* p = points[p_id];
|
||||
|
||||
for(int i=0;i<p->neighbours.size();i++) {
|
||||
|
||||
Segment s(p_id,p->neighbours[i]->id);
|
||||
segments.erase(s);
|
||||
p->neighbours[i]->neighbours.erase(p);
|
||||
}
|
||||
|
||||
memdelete(p);
|
||||
points.erase(p_id);
|
||||
}
|
||||
|
||||
void AStar::connect_points(int p_id,int p_with_id){
|
||||
|
||||
ERR_FAIL_COND(!points.has(p_id));
|
||||
ERR_FAIL_COND(!points.has(p_with_id));
|
||||
ERR_FAIL_COND(p_id==p_with_id);
|
||||
|
||||
|
||||
Point* a = points[p_id];
|
||||
Point* b = points[p_with_id];
|
||||
a->neighbours.push_back(b);
|
||||
b->neighbours.push_back(a);
|
||||
|
||||
Segment s(p_id,p_with_id);
|
||||
if (s.from==p_id) {
|
||||
s.from_point=a;
|
||||
s.to_point=b;
|
||||
} else {
|
||||
s.from_point=b;
|
||||
s.to_point=a;
|
||||
}
|
||||
|
||||
segments.insert(s);
|
||||
|
||||
|
||||
}
|
||||
void AStar::disconnect_points(int p_id,int p_with_id){
|
||||
|
||||
Segment s(p_id,p_with_id);
|
||||
ERR_FAIL_COND(!segments.has(s));
|
||||
|
||||
|
||||
segments.erase(s);
|
||||
|
||||
Point *a = points[p_id];
|
||||
Point *b = points[p_with_id];
|
||||
a->neighbours.erase(b);
|
||||
b->neighbours.erase(a);
|
||||
|
||||
}
|
||||
bool AStar::are_points_connected(int p_id,int p_with_id) const{
|
||||
|
||||
Segment s(p_id,p_with_id);
|
||||
return segments.has(s);
|
||||
}
|
||||
|
||||
void AStar::clear(){
|
||||
|
||||
for (const Map<int,Point*>::Element *E=points.front();E;E=E->next()) {
|
||||
|
||||
memdelete(E->get());
|
||||
}
|
||||
segments.clear();
|
||||
points.clear();
|
||||
}
|
||||
|
||||
|
||||
int AStar::get_closest_point(const Vector3& p_point) const{
|
||||
|
||||
int closest_id=-1;
|
||||
float closest_dist=1e20;
|
||||
|
||||
for (const Map<int,Point*>::Element *E=points.front();E;E=E->next()) {
|
||||
|
||||
float d = p_point.distance_squared_to(E->get()->pos);
|
||||
if (closest_id<0 || d<closest_dist) {
|
||||
closest_dist=d;
|
||||
closest_id=E->key();
|
||||
}
|
||||
}
|
||||
|
||||
return closest_id;
|
||||
|
||||
|
||||
}
|
||||
Vector3 AStar::get_closest_pos_in_segment(const Vector3& p_point) const {
|
||||
|
||||
float closest_dist = 1e20;
|
||||
bool found=false;
|
||||
Vector3 closest_point;
|
||||
|
||||
|
||||
for (const Set<Segment>::Element *E=segments.front();E;E=E->next()) {
|
||||
|
||||
Vector3 segment[2]={
|
||||
E->get().from_point->pos,
|
||||
E->get().to_point->pos,
|
||||
};
|
||||
|
||||
Vector3 p = Geometry::get_closest_point_to_segment(p_point,segment);
|
||||
float d = p_point.distance_squared_to(p);
|
||||
if (!found || d<closest_dist) {
|
||||
|
||||
closest_point=p;
|
||||
closest_dist=d;
|
||||
found=true;
|
||||
}
|
||||
}
|
||||
|
||||
return closest_point;
|
||||
}
|
||||
|
||||
bool AStar::_solve(Point* begin_point, Point* end_point) {
|
||||
|
||||
pass++;
|
||||
|
||||
SelfList<Point>::List open_list;
|
||||
|
||||
bool found_route=false;
|
||||
|
||||
|
||||
for(int i=0;i<begin_point->neighbours.size();i++) {
|
||||
|
||||
Point *n = begin_point->neighbours[i];
|
||||
n->prev_point=begin_point;
|
||||
n->distance=n->pos.distance_to(begin_point->pos);
|
||||
n->distance*=n->weight_scale;
|
||||
n->last_pass=pass;
|
||||
open_list.add(&n->list);
|
||||
|
||||
if (end_point==n) {
|
||||
found_route=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
while(!found_route) {
|
||||
|
||||
if (open_list.first()==NULL) {
|
||||
//could not find path sadly
|
||||
break;
|
||||
}
|
||||
//check open list
|
||||
|
||||
SelfList<Point> *least_cost_point=NULL;
|
||||
float least_cost=1e30;
|
||||
|
||||
//this could be faster (cache previous results)
|
||||
for (SelfList<Point> *E=open_list.first();E;E=E->next()) {
|
||||
|
||||
Point *p=E->self();
|
||||
|
||||
float cost=p->distance;
|
||||
cost+=p->pos.distance_to(end_point->pos);
|
||||
cost*=p->weight_scale;
|
||||
|
||||
if (cost<least_cost) {
|
||||
|
||||
least_cost_point=E;
|
||||
least_cost=cost;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Point *p=least_cost_point->self();
|
||||
//open the neighbours for search
|
||||
int es = p->neighbours.size();
|
||||
|
||||
for(int i=0;i<es;i++) {
|
||||
|
||||
|
||||
Point* e=p->neighbours[i];
|
||||
|
||||
|
||||
float distance = p->pos.distance_to(e->pos) + p->distance;
|
||||
distance*=e->weight_scale;
|
||||
|
||||
|
||||
|
||||
if (e->last_pass==pass) {
|
||||
//oh this was visited already, can we win the cost?
|
||||
|
||||
if (e->distance>distance) {
|
||||
|
||||
e->prev_point=p;
|
||||
e->distance=distance;
|
||||
}
|
||||
} else {
|
||||
//add to open neighbours
|
||||
|
||||
e->prev_point=p;
|
||||
e->distance=distance;
|
||||
e->last_pass=pass; //mark as used
|
||||
open_list.add(&e->list);
|
||||
|
||||
if (e==end_point) {
|
||||
//oh my reached end! stop algorithm
|
||||
found_route=true;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (found_route)
|
||||
break;
|
||||
|
||||
open_list.remove(least_cost_point);
|
||||
}
|
||||
|
||||
//clear the openf list
|
||||
while(open_list.first()) {
|
||||
open_list.remove( open_list.first() );
|
||||
}
|
||||
|
||||
return found_route;
|
||||
|
||||
}
|
||||
|
||||
DVector<Vector3> AStar::get_point_path(int p_from_id, int p_to_id) {
|
||||
|
||||
ERR_FAIL_COND_V(!points.has(p_from_id),DVector<Vector3>());
|
||||
ERR_FAIL_COND_V(!points.has(p_to_id),DVector<Vector3>());
|
||||
|
||||
|
||||
pass++;
|
||||
|
||||
Point* a = points[p_from_id];
|
||||
Point* b = points[p_to_id];
|
||||
|
||||
if (a==b) {
|
||||
DVector<Vector3> ret;
|
||||
ret.push_back(a->pos);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Point *begin_point=a;
|
||||
Point *end_point=b;
|
||||
|
||||
bool found_route=_solve(begin_point,end_point);
|
||||
|
||||
if (!found_route)
|
||||
return DVector<Vector3>();
|
||||
|
||||
//midpoints
|
||||
Point *p=end_point;
|
||||
int pc=1; //begin point
|
||||
while(p!=begin_point) {
|
||||
pc++;
|
||||
p=p->prev_point;
|
||||
}
|
||||
|
||||
DVector<Vector3> path;
|
||||
path.resize(pc);
|
||||
|
||||
{
|
||||
DVector<Vector3>::Write w = path.write();
|
||||
|
||||
Point *p=end_point;
|
||||
int idx=pc-1;
|
||||
while(p!=begin_point) {
|
||||
w[idx--]=p->pos;
|
||||
p=p->prev_point;
|
||||
}
|
||||
|
||||
w[0]=p->pos; //assign first
|
||||
|
||||
}
|
||||
|
||||
return path;
|
||||
|
||||
}
|
||||
|
||||
|
||||
DVector<int> AStar::get_id_path(int p_from_id, int p_to_id) {
|
||||
|
||||
ERR_FAIL_COND_V(!points.has(p_from_id),DVector<int>());
|
||||
ERR_FAIL_COND_V(!points.has(p_to_id),DVector<int>());
|
||||
|
||||
|
||||
pass++;
|
||||
|
||||
Point* a = points[p_from_id];
|
||||
Point* b = points[p_to_id];
|
||||
|
||||
if (a==b) {
|
||||
DVector<int> ret;
|
||||
ret.push_back(a->id);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Point *begin_point=a;
|
||||
Point *end_point=b;
|
||||
|
||||
bool found_route=_solve(begin_point,end_point);
|
||||
|
||||
if (!found_route)
|
||||
return DVector<int>();
|
||||
|
||||
//midpoints
|
||||
Point *p=end_point;
|
||||
int pc=1; //begin point
|
||||
while(p!=begin_point) {
|
||||
pc++;
|
||||
p=p->prev_point;
|
||||
}
|
||||
|
||||
DVector<int> path;
|
||||
path.resize(pc);
|
||||
|
||||
{
|
||||
DVector<int>::Write w = path.write();
|
||||
|
||||
p=end_point;
|
||||
int idx=pc-1;
|
||||
while(p!=begin_point) {
|
||||
w[idx--]=p->id;
|
||||
p=p->prev_point;
|
||||
}
|
||||
|
||||
w[0]=p->id; //assign first
|
||||
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
void AStar::_bind_methods() {
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("get_available_point_id"),&AStar::get_available_point_id);
|
||||
ObjectTypeDB::bind_method(_MD("add_point","id","pos","weight_scale"),&AStar::add_point,DEFVAL(1.0));
|
||||
ObjectTypeDB::bind_method(_MD("get_point_pos","id"),&AStar::get_point_pos);
|
||||
ObjectTypeDB::bind_method(_MD("get_point_weight_scale","id"),&AStar::get_point_weight_scale);
|
||||
ObjectTypeDB::bind_method(_MD("remove_point","id"),&AStar::remove_point);
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("connect_points","id","to_id"),&AStar::connect_points);
|
||||
ObjectTypeDB::bind_method(_MD("disconnect_points","id","to_id"),&AStar::disconnect_points);
|
||||
ObjectTypeDB::bind_method(_MD("are_points_connected","id","to_id"),&AStar::are_points_connected);
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("clear"),&AStar::clear);
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("get_closest_point","to_pos"),&AStar::get_closest_point);
|
||||
ObjectTypeDB::bind_method(_MD("get_closest_pos_in_segment","to_pos"),&AStar::get_closest_pos_in_segment);
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("get_point_path","from_id","to_id"),&AStar::get_point_path);
|
||||
ObjectTypeDB::bind_method(_MD("get_id_path","from_id","to_id"),&AStar::get_id_path);
|
||||
|
||||
}
|
||||
|
||||
|
||||
AStar::AStar() {
|
||||
|
||||
pass=1;
|
||||
}
|
||||
|
||||
|
||||
AStar::~AStar() {
|
||||
|
||||
pass=1;
|
||||
}
|
@@ -1,5 +1,5 @@
|
||||
/*************************************************************************/
|
||||
/* memory_pool_static_nedmalloc.h */
|
||||
/* a_star.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
@@ -26,52 +26,98 @@
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifdef NEDMALLOC_ENABLED
|
||||
#ifndef ASTAR_H
|
||||
#define ASTAR_H
|
||||
|
||||
//
|
||||
// C++ Interface: memory_static_malloc
|
||||
//
|
||||
// Description:
|
||||
//
|
||||
//
|
||||
// Author: Juan Linietsky <red@lunatea>, (C) 2006
|
||||
//
|
||||
// Copyright: See COPYING file that comes with this distribution
|
||||
//
|
||||
//
|
||||
#ifndef MEMORY_POOL_STATIC_NEDMALLOC_H
|
||||
#define MEMORY_POOL_STATIC_NEDMALLOC_H
|
||||
|
||||
#include "os/memory_pool_static.h"
|
||||
#include "os/mutex.h"
|
||||
#include "reference.h"
|
||||
#include "self_list.h"
|
||||
/**
|
||||
@author Juan Linietsky <red@lunatea>
|
||||
@author Juan Linietsky <reduzio@gmail.com>
|
||||
*/
|
||||
class MemoryPoolStaticNedMalloc : public MemoryPoolStatic {
|
||||
|
||||
Mutex *mutex;
|
||||
class AStar: public Reference {
|
||||
|
||||
OBJ_TYPE(AStar,Reference)
|
||||
|
||||
|
||||
uint64_t pass;
|
||||
|
||||
struct Point {
|
||||
|
||||
SelfList<Point> list;
|
||||
|
||||
int id;
|
||||
Vector3 pos;
|
||||
float weight_scale;
|
||||
uint64_t last_pass;
|
||||
|
||||
Vector<Point*> neighbours;
|
||||
|
||||
//used for pathfinding
|
||||
Point *prev_point;
|
||||
float distance;
|
||||
|
||||
Point() : list(this) {}
|
||||
};
|
||||
|
||||
Map<int,Point*> points;
|
||||
|
||||
struct Segment {
|
||||
union {
|
||||
struct {
|
||||
int32_t from;
|
||||
int32_t to;
|
||||
};
|
||||
uint64_t key;
|
||||
};
|
||||
|
||||
Point *from_point;
|
||||
Point *to_point;
|
||||
|
||||
bool operator<(const Segment& p_s) const { return key<p_s.key; }
|
||||
Segment() { key=0; }
|
||||
Segment(int p_from,int p_to) {
|
||||
if (p_from > p_to) {
|
||||
SWAP(p_from,p_to);
|
||||
}
|
||||
|
||||
from=p_from;
|
||||
to=p_to;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Set<Segment> segments;
|
||||
|
||||
bool _solve(Point *begin_point, Point *end_point);
|
||||
|
||||
protected:
|
||||
|
||||
static void _bind_methods();
|
||||
public:
|
||||
|
||||
void* alloc(size_t p_bytes,const char *p_description=""); ///< Pointer in p_description shold be to a const char const like "hello"
|
||||
void* realloc(void *p_memory,size_t p_bytes); ///< Pointer in
|
||||
void free(void *p_ptr); ///< Pointer in p_description shold be to a const char const
|
||||
virtual size_t get_available_mem() const;
|
||||
virtual size_t get_total_usage();
|
||||
|
||||
/* Most likely available only if memory debugger was compiled in */
|
||||
virtual int get_alloc_count();
|
||||
virtual void * get_alloc_ptr(int p_alloc_idx);
|
||||
virtual const char* get_alloc_description(int p_alloc_idx);
|
||||
virtual size_t get_alloc_size(int p_alloc_idx);
|
||||
|
||||
virtual void debug_print_all_memory();
|
||||
|
||||
MemoryPoolStaticNedMalloc();
|
||||
~MemoryPoolStaticNedMalloc();
|
||||
int get_available_point_id() const;
|
||||
|
||||
void add_point(int p_id,const Vector3& p_pos,float p_weight_scale=1);
|
||||
Vector3 get_point_pos(int p_id) const;
|
||||
float get_point_weight_scale(int p_id) const;
|
||||
void remove_point(int p_id);
|
||||
|
||||
void connect_points(int p_id,int p_with_id);
|
||||
void disconnect_points(int p_id,int p_with_id);
|
||||
bool are_points_connected(int p_id,int p_with_id) const;
|
||||
|
||||
void clear();
|
||||
|
||||
|
||||
int get_closest_point(const Vector3& p_point) const;
|
||||
Vector3 get_closest_pos_in_segment(const Vector3& p_point) const;
|
||||
|
||||
DVector<Vector3> get_point_path(int p_from_id, int p_to_id);
|
||||
DVector<int> get_id_path(int p_from_id, int p_to_id);
|
||||
|
||||
AStar();
|
||||
~AStar();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif // ASTAR_H
|
@@ -424,7 +424,7 @@ Matrix32 Matrix32::inverse() const {
|
||||
|
||||
void Matrix32::affine_invert() {
|
||||
|
||||
float det = elements[0][0]*elements[1][1] - elements[1][0]*elements[0][1];
|
||||
float det = basis_determinant();
|
||||
ERR_FAIL_COND(det==0);
|
||||
float idet = 1.0 / det;
|
||||
|
||||
@@ -475,18 +475,18 @@ Matrix32::Matrix32(real_t p_rot, const Vector2& p_pos) {
|
||||
elements[2]=p_pos;
|
||||
}
|
||||
|
||||
Vector2 Matrix32::get_scale() const {
|
||||
Size2 Matrix32::get_scale() const {
|
||||
|
||||
return Vector2( elements[0].length(), elements[1].length() );
|
||||
return Size2( elements[0].length(), elements[1].length() );
|
||||
}
|
||||
|
||||
void Matrix32::scale(const Vector2& p_scale) {
|
||||
void Matrix32::scale(const Size2& p_scale) {
|
||||
|
||||
elements[0]*=p_scale;
|
||||
elements[1]*=p_scale;
|
||||
elements[2]*=p_scale;
|
||||
}
|
||||
void Matrix32::scale_basis(const Vector2& p_scale) {
|
||||
void Matrix32::scale_basis(const Size2& p_scale) {
|
||||
|
||||
elements[0]*=p_scale;
|
||||
elements[1]*=p_scale;
|
||||
@@ -501,7 +501,6 @@ void Matrix32::translate( const Vector2& p_translation ) {
|
||||
elements[2]+=basis_xform(p_translation);
|
||||
}
|
||||
|
||||
|
||||
void Matrix32::orthonormalize() {
|
||||
|
||||
// Gram-Schmidt Process
|
||||
@@ -550,11 +549,6 @@ void Matrix32::operator*=(const Matrix32& p_transform) {
|
||||
elements[2] = xform(p_transform.elements[2]);
|
||||
|
||||
float x0,x1,y0,y1;
|
||||
/*
|
||||
x0 = p_transform.tdotx(elements[0]);
|
||||
x1 = p_transform.tdoty(elements[0]);
|
||||
y0 = p_transform.tdotx(elements[1]);
|
||||
y1 = p_transform.tdoty(elements[1]);*/
|
||||
|
||||
x0 = tdotx(p_transform.elements[0]);
|
||||
x1 = tdoty(p_transform.elements[0]);
|
||||
@@ -576,7 +570,7 @@ Matrix32 Matrix32::operator*(const Matrix32& p_transform) const {
|
||||
|
||||
}
|
||||
|
||||
Matrix32 Matrix32::scaled(const Vector2& p_scale) const {
|
||||
Matrix32 Matrix32::scaled(const Size2& p_scale) const {
|
||||
|
||||
Matrix32 copy=*this;
|
||||
copy.scale(p_scale);
|
||||
@@ -584,7 +578,7 @@ Matrix32 Matrix32::scaled(const Vector2& p_scale) const {
|
||||
|
||||
}
|
||||
|
||||
Matrix32 Matrix32::basis_scaled(const Vector2& p_scale) const {
|
||||
Matrix32 Matrix32::basis_scaled(const Size2& p_scale) const {
|
||||
|
||||
Matrix32 copy=*this;
|
||||
copy.scale_basis(p_scale);
|
||||
@@ -629,8 +623,8 @@ Matrix32 Matrix32::interpolate_with(const Matrix32& p_transform, float p_c) cons
|
||||
real_t r1 = get_rotation();
|
||||
real_t r2 = p_transform.get_rotation();
|
||||
|
||||
Vector2 s1 = get_scale();
|
||||
Vector2 s2 = p_transform.get_scale();
|
||||
Size2 s1 = get_scale();
|
||||
Size2 s2 = p_transform.get_scale();
|
||||
|
||||
//slerp rotation
|
||||
Vector2 v1(Math::cos(r1), Math::sin(r1));
|
||||
|
@@ -553,10 +553,8 @@ struct Rect2i {
|
||||
|
||||
struct Matrix32 {
|
||||
|
||||
|
||||
Vector2 elements[3];
|
||||
|
||||
|
||||
_FORCE_INLINE_ float tdotx(const Vector2& v) const { return elements[0][0] * v.x + elements[1][0] * v.y; }
|
||||
_FORCE_INLINE_ float tdoty(const Vector2& v) const { return elements[0][1] * v.x + elements[1][1] * v.y; }
|
||||
|
||||
@@ -577,26 +575,25 @@ struct Matrix32 {
|
||||
_FORCE_INLINE_ void set_rotation_and_scale(real_t p_phi,const Size2& p_scale);
|
||||
void rotate(real_t p_phi);
|
||||
|
||||
void scale(const Vector2& p_scale);
|
||||
void scale_basis(const Vector2& p_scale);
|
||||
void scale(const Size2& p_scale);
|
||||
void scale_basis(const Size2& p_scale);
|
||||
void translate( real_t p_tx, real_t p_ty);
|
||||
void translate( const Vector2& p_translation );
|
||||
|
||||
float basis_determinant() const;
|
||||
|
||||
Vector2 get_scale() const;
|
||||
Size2 get_scale() const;
|
||||
|
||||
_FORCE_INLINE_ const Vector2& get_origin() const { return elements[2]; }
|
||||
_FORCE_INLINE_ void set_origin(const Vector2& p_origin) { elements[2]=p_origin; }
|
||||
|
||||
Matrix32 scaled(const Vector2& p_scale) const;
|
||||
Matrix32 basis_scaled(const Vector2& p_scale) const;
|
||||
Matrix32 scaled(const Size2& p_scale) const;
|
||||
Matrix32 basis_scaled(const Size2& p_scale) const;
|
||||
Matrix32 translated(const Vector2& p_offset) const;
|
||||
Matrix32 rotated(float p_phi) const;
|
||||
|
||||
Matrix32 untranslated() const;
|
||||
|
||||
|
||||
void orthonormalize();
|
||||
Matrix32 orthonormalized() const;
|
||||
|
||||
@@ -615,13 +612,20 @@ struct Matrix32 {
|
||||
_FORCE_INLINE_ Rect2 xform(const Rect2& p_vec) const;
|
||||
_FORCE_INLINE_ Rect2 xform_inv(const Rect2& p_vec) const;
|
||||
|
||||
|
||||
operator String() const;
|
||||
|
||||
Matrix32(real_t xx, real_t xy, real_t yx, real_t yy, real_t ox, real_t oy) {
|
||||
|
||||
elements[0][0] = xx;
|
||||
elements[0][1] = xy;
|
||||
elements[1][0] = yx;
|
||||
elements[1][1] = yy;
|
||||
elements[2][0] = ox;
|
||||
elements[2][1] = oy;
|
||||
}
|
||||
|
||||
Matrix32(real_t p_rot, const Vector2& p_pos);
|
||||
Matrix32() { elements[0][0]=1.0; elements[1][1]=1.0; }
|
||||
|
||||
};
|
||||
|
||||
bool Rect2::intersects_transformed(const Matrix32& p_xform, const Rect2& p_rect) const {
|
||||
|
@@ -71,7 +71,7 @@ bool Triangulate::is_inside_triangle(float Ax, float Ay,
|
||||
return ((aCROSSbp >= 0.0f) && (bCROSScp >= 0.0f) && (cCROSSap >= 0.0f));
|
||||
};
|
||||
|
||||
bool Triangulate::snip(const Vector<Vector2> &p_contour,int u,int v,int w,int n,int *V)
|
||||
bool Triangulate::snip(const Vector<Vector2> &p_contour,int u,int v,int w,int n,const Vector<int>& V)
|
||||
{
|
||||
int p;
|
||||
float Ax, Ay, Bx, By, Cx, Cy, Px, Py;
|
||||
@@ -107,8 +107,8 @@ bool Triangulate::triangulate(const Vector<Vector2> &contour,Vector<int> &result
|
||||
if ( n < 3 ) return false;
|
||||
|
||||
|
||||
|
||||
int *V = (int*)alloca(sizeof(int)*n);
|
||||
Vector<int> V;
|
||||
V.resize(n);
|
||||
|
||||
/* we want a counter-clockwise polygon in V */
|
||||
|
||||
@@ -122,7 +122,7 @@ bool Triangulate::triangulate(const Vector<Vector2> &contour,Vector<int> &result
|
||||
/* remove nv-2 Vertices, creating 1 triangle every time */
|
||||
int count = 2*nv; /* error detection */
|
||||
|
||||
for(int m=0, v=nv-1; nv>2; )
|
||||
for(int v=nv-1; nv>2; )
|
||||
{
|
||||
/* if we loop, it is probably a non-simple polygon */
|
||||
if (0 >= (count--))
|
||||
@@ -144,18 +144,10 @@ bool Triangulate::triangulate(const Vector<Vector2> &contour,Vector<int> &result
|
||||
a = V[u]; b = V[v]; c = V[w];
|
||||
|
||||
/* output Triangle */
|
||||
/*
|
||||
result.push_back( contour[a] );
|
||||
result.push_back( contour[b] );
|
||||
result.push_back( contour[c] );
|
||||
*/
|
||||
|
||||
result.push_back( a );
|
||||
result.push_back( b );
|
||||
result.push_back( c );
|
||||
|
||||
m++;
|
||||
|
||||
/* remove v from remaining polygon */
|
||||
for(s=v,t=v+1;t<nv;s++,t++) V[s] = V[t]; nv--;
|
||||
|
||||
|
@@ -56,7 +56,7 @@ public:
|
||||
|
||||
|
||||
private:
|
||||
static bool snip(const Vector<Vector2> &p_contour,int u,int v,int w,int n,int *V);
|
||||
static bool snip(const Vector<Vector2> &p_contour,int u,int v,int w,int n,const Vector<int>& V);
|
||||
|
||||
};
|
||||
|
||||
|
@@ -49,13 +49,13 @@ void Vector3::set_axis(int p_axis,real_t p_value) {
|
||||
}
|
||||
real_t Vector3::get_axis(int p_axis) const {
|
||||
|
||||
ERR_FAIL_INDEX_V(p_axis,3,0);
|
||||
return operator[](p_axis);
|
||||
ERR_FAIL_INDEX_V(p_axis,3,0);
|
||||
return operator[](p_axis);
|
||||
}
|
||||
|
||||
int Vector3::min_axis() const {
|
||||
|
||||
return x < y ? (x < z ? 0 : 2) : (y < z ? 1 : 2);
|
||||
return x < y ? (x < z ? 0 : 2) : (y < z ? 1 : 2);
|
||||
}
|
||||
int Vector3::max_axis() const {
|
||||
|
||||
@@ -75,9 +75,9 @@ void Vector3::snap(float p_val) {
|
||||
}
|
||||
Vector3 Vector3::snapped(float p_val) const {
|
||||
|
||||
Vector3 v=*this;
|
||||
v.snap(p_val);
|
||||
return v;
|
||||
Vector3 v=*this;
|
||||
v.snap(p_val);
|
||||
return v;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -63,77 +63,78 @@ struct Vector3 {
|
||||
return coord[p_axis];
|
||||
}
|
||||
|
||||
void set_axis(int p_axis,real_t p_value);
|
||||
real_t get_axis(int p_axis) const;
|
||||
void set_axis(int p_axis,real_t p_value);
|
||||
real_t get_axis(int p_axis) const;
|
||||
|
||||
int min_axis() const;
|
||||
int max_axis() const;
|
||||
int min_axis() const;
|
||||
int max_axis() const;
|
||||
|
||||
_FORCE_INLINE_ real_t length() const;
|
||||
_FORCE_INLINE_ real_t length_squared() const;
|
||||
_FORCE_INLINE_ real_t length() const;
|
||||
_FORCE_INLINE_ real_t length_squared() const;
|
||||
|
||||
_FORCE_INLINE_ void normalize();
|
||||
_FORCE_INLINE_ Vector3 normalized() const;
|
||||
_FORCE_INLINE_ Vector3 inverse() const;
|
||||
_FORCE_INLINE_ void normalize();
|
||||
_FORCE_INLINE_ Vector3 normalized() const;
|
||||
_FORCE_INLINE_ Vector3 inverse() const;
|
||||
|
||||
_FORCE_INLINE_ void zero();
|
||||
|
||||
void snap(float p_val);
|
||||
Vector3 snapped(float p_val) const;
|
||||
void snap(float p_val);
|
||||
Vector3 snapped(float p_val) const;
|
||||
|
||||
void rotate(const Vector3& p_axis,float p_phi);
|
||||
Vector3 rotated(const Vector3& p_axis,float p_phi) const;
|
||||
|
||||
/* Static Methods between 2 vector3s */
|
||||
/* Static Methods between 2 vector3s */
|
||||
|
||||
_FORCE_INLINE_ Vector3 linear_interpolate(const Vector3& p_b,float p_t) const;
|
||||
_FORCE_INLINE_ Vector3 linear_interpolate(const Vector3& p_b,float p_t) const;
|
||||
Vector3 cubic_interpolate(const Vector3& p_b,const Vector3& p_pre_a, const Vector3& p_post_b,float p_t) const;
|
||||
Vector3 cubic_interpolaten(const Vector3& p_b,const Vector3& p_pre_a, const Vector3& p_post_b,float p_t) const;
|
||||
|
||||
_FORCE_INLINE_ Vector3 cross(const Vector3& p_b) const;
|
||||
_FORCE_INLINE_ real_t dot(const Vector3& p_b) const;
|
||||
_FORCE_INLINE_ Vector3 cross(const Vector3& p_b) const;
|
||||
_FORCE_INLINE_ real_t dot(const Vector3& p_b) const;
|
||||
|
||||
_FORCE_INLINE_ Vector3 abs() const;
|
||||
_FORCE_INLINE_ Vector3 floor() const;
|
||||
_FORCE_INLINE_ Vector3 ceil() const;
|
||||
_FORCE_INLINE_ Vector3 abs() const;
|
||||
_FORCE_INLINE_ Vector3 floor() const;
|
||||
_FORCE_INLINE_ Vector3 ceil() const;
|
||||
|
||||
_FORCE_INLINE_ real_t distance_to(const Vector3& p_b) const;
|
||||
_FORCE_INLINE_ real_t distance_squared_to(const Vector3& p_b) const;
|
||||
_FORCE_INLINE_ real_t distance_to(const Vector3& p_b) const;
|
||||
_FORCE_INLINE_ real_t distance_squared_to(const Vector3& p_b) const;
|
||||
|
||||
_FORCE_INLINE_ real_t angle_to(const Vector3& p_b) const;
|
||||
|
||||
|
||||
_FORCE_INLINE_ Vector3 slide(const Vector3& p_vec) const;
|
||||
_FORCE_INLINE_ Vector3 reflect(const Vector3& p_vec) const;
|
||||
|
||||
|
||||
/* Operators */
|
||||
/* Operators */
|
||||
|
||||
_FORCE_INLINE_ Vector3& operator+=(const Vector3& p_v);
|
||||
_FORCE_INLINE_ Vector3 operator+(const Vector3& p_v) const;
|
||||
_FORCE_INLINE_ Vector3& operator-=(const Vector3& p_v);
|
||||
_FORCE_INLINE_ Vector3 operator-(const Vector3& p_v) const;
|
||||
_FORCE_INLINE_ Vector3& operator*=(const Vector3& p_v);
|
||||
_FORCE_INLINE_ Vector3 operator*(const Vector3& p_v) const;
|
||||
_FORCE_INLINE_ Vector3& operator/=(const Vector3& p_v);
|
||||
_FORCE_INLINE_ Vector3 operator/(const Vector3& p_v) const;
|
||||
_FORCE_INLINE_ Vector3& operator+=(const Vector3& p_v);
|
||||
_FORCE_INLINE_ Vector3 operator+(const Vector3& p_v) const;
|
||||
_FORCE_INLINE_ Vector3& operator-=(const Vector3& p_v);
|
||||
_FORCE_INLINE_ Vector3 operator-(const Vector3& p_v) const;
|
||||
_FORCE_INLINE_ Vector3& operator*=(const Vector3& p_v);
|
||||
_FORCE_INLINE_ Vector3 operator*(const Vector3& p_v) const;
|
||||
_FORCE_INLINE_ Vector3& operator/=(const Vector3& p_v);
|
||||
_FORCE_INLINE_ Vector3 operator/(const Vector3& p_v) const;
|
||||
|
||||
|
||||
_FORCE_INLINE_ Vector3& operator*=(real_t p_scalar);
|
||||
_FORCE_INLINE_ Vector3 operator*(real_t p_scalar) const;
|
||||
_FORCE_INLINE_ Vector3& operator/=(real_t p_scalar);
|
||||
_FORCE_INLINE_ Vector3 operator/(real_t p_scalar) const;
|
||||
_FORCE_INLINE_ Vector3& operator*=(real_t p_scalar);
|
||||
_FORCE_INLINE_ Vector3 operator*(real_t p_scalar) const;
|
||||
_FORCE_INLINE_ Vector3& operator/=(real_t p_scalar);
|
||||
_FORCE_INLINE_ Vector3 operator/(real_t p_scalar) const;
|
||||
|
||||
_FORCE_INLINE_ Vector3 operator-() const;
|
||||
_FORCE_INLINE_ Vector3 operator-() const;
|
||||
|
||||
_FORCE_INLINE_ bool operator==(const Vector3& p_v) const;
|
||||
_FORCE_INLINE_ bool operator!=(const Vector3& p_v) const;
|
||||
_FORCE_INLINE_ bool operator<(const Vector3& p_v) const;
|
||||
_FORCE_INLINE_ bool operator==(const Vector3& p_v) const;
|
||||
_FORCE_INLINE_ bool operator!=(const Vector3& p_v) const;
|
||||
_FORCE_INLINE_ bool operator<(const Vector3& p_v) const;
|
||||
_FORCE_INLINE_ bool operator<=(const Vector3& p_v) const;
|
||||
|
||||
operator String() const;
|
||||
|
||||
_FORCE_INLINE_ Vector3() { x=y=z=0; }
|
||||
_FORCE_INLINE_ Vector3(real_t p_x,real_t p_y,real_t p_z) { x=p_x; y=p_y; z=p_z; }
|
||||
_FORCE_INLINE_ Vector3() { x=y=z=0; }
|
||||
_FORCE_INLINE_ Vector3(real_t p_x,real_t p_y,real_t p_z) { x=p_x; y=p_y; z=p_z; }
|
||||
|
||||
};
|
||||
|
||||
@@ -151,11 +152,12 @@ Vector3 Vector3::cross(const Vector3& p_b) const {
|
||||
(x * p_b.y) - (y * p_b.x)
|
||||
);
|
||||
|
||||
return ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
real_t Vector3::dot(const Vector3& p_b) const {
|
||||
|
||||
return x*p_b.x + y*p_b.y + z*p_b.z;
|
||||
return x*p_b.x + y*p_b.y + z*p_b.z;
|
||||
}
|
||||
|
||||
Vector3 Vector3::abs() const {
|
||||
@@ -180,115 +182,119 @@ Vector3 Vector3::linear_interpolate(const Vector3& p_b,float p_t) const {
|
||||
y+(p_t * (p_b.y-y)),
|
||||
z+(p_t * (p_b.z-z))
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
real_t Vector3::distance_to(const Vector3& p_b) const {
|
||||
|
||||
return (p_b-*this).length();
|
||||
}
|
||||
|
||||
real_t Vector3::distance_squared_to(const Vector3& p_b) const {
|
||||
|
||||
return (p_b-*this).length_squared();
|
||||
return (p_b-*this).length_squared();
|
||||
}
|
||||
|
||||
real_t Vector3::angle_to(const Vector3& p_b) const {
|
||||
|
||||
return Math::acos(this->dot(p_b) / Math::sqrt(this->length_squared() * p_b.length_squared()));
|
||||
}
|
||||
|
||||
/* Operators */
|
||||
|
||||
Vector3& Vector3::operator+=(const Vector3& p_v) {
|
||||
|
||||
x+=p_v.x;
|
||||
y+=p_v.y;
|
||||
z+=p_v.z;
|
||||
return *this;
|
||||
x+=p_v.x;
|
||||
y+=p_v.y;
|
||||
z+=p_v.z;
|
||||
return *this;
|
||||
}
|
||||
|
||||
Vector3 Vector3::operator+(const Vector3& p_v) const {
|
||||
|
||||
return Vector3(x+p_v.x, y+p_v.y, z+ p_v.z);
|
||||
return Vector3(x+p_v.x, y+p_v.y, z+ p_v.z);
|
||||
}
|
||||
|
||||
Vector3& Vector3::operator-=(const Vector3& p_v) {
|
||||
|
||||
x-=p_v.x;
|
||||
y-=p_v.y;
|
||||
z-=p_v.z;
|
||||
return *this;
|
||||
x-=p_v.x;
|
||||
y-=p_v.y;
|
||||
z-=p_v.z;
|
||||
return *this;
|
||||
}
|
||||
Vector3 Vector3::operator-(const Vector3& p_v) const {
|
||||
|
||||
return Vector3(x-p_v.x, y-p_v.y, z- p_v.z);
|
||||
return Vector3(x-p_v.x, y-p_v.y, z- p_v.z);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Vector3& Vector3::operator*=(const Vector3& p_v) {
|
||||
|
||||
x*=p_v.x;
|
||||
y*=p_v.y;
|
||||
z*=p_v.z;
|
||||
return *this;
|
||||
x*=p_v.x;
|
||||
y*=p_v.y;
|
||||
z*=p_v.z;
|
||||
return *this;
|
||||
}
|
||||
Vector3 Vector3::operator*(const Vector3& p_v) const {
|
||||
|
||||
return Vector3(x*p_v.x, y*p_v.y, z* p_v.z);
|
||||
return Vector3(x*p_v.x, y*p_v.y, z* p_v.z);
|
||||
}
|
||||
|
||||
Vector3& Vector3::operator/=(const Vector3& p_v) {
|
||||
|
||||
x/=p_v.x;
|
||||
y/=p_v.y;
|
||||
z/=p_v.z;
|
||||
return *this;
|
||||
x/=p_v.x;
|
||||
y/=p_v.y;
|
||||
z/=p_v.z;
|
||||
return *this;
|
||||
}
|
||||
|
||||
Vector3 Vector3::operator/(const Vector3& p_v) const {
|
||||
|
||||
return Vector3(x/p_v.x, y/p_v.y, z/ p_v.z);
|
||||
return Vector3(x/p_v.x, y/p_v.y, z/ p_v.z);
|
||||
}
|
||||
|
||||
Vector3& Vector3::operator*=(real_t p_scalar) {
|
||||
x*=p_scalar;
|
||||
y*=p_scalar;
|
||||
z*=p_scalar;
|
||||
return *this;
|
||||
|
||||
x*=p_scalar;
|
||||
y*=p_scalar;
|
||||
z*=p_scalar;
|
||||
return *this;
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ Vector3 operator*(real_t p_scalar, const Vector3& p_vec) {
|
||||
|
||||
return p_vec * p_scalar;
|
||||
}
|
||||
|
||||
Vector3 Vector3::operator*(real_t p_scalar) const {
|
||||
|
||||
return Vector3( x*p_scalar, y*p_scalar, z*p_scalar);
|
||||
return Vector3( x*p_scalar, y*p_scalar, z*p_scalar);
|
||||
}
|
||||
|
||||
Vector3& Vector3::operator/=(real_t p_scalar) {
|
||||
x/=p_scalar;
|
||||
y/=p_scalar;
|
||||
z/=p_scalar;
|
||||
return *this;
|
||||
|
||||
x/=p_scalar;
|
||||
y/=p_scalar;
|
||||
z/=p_scalar;
|
||||
return *this;
|
||||
}
|
||||
|
||||
Vector3 Vector3::operator/(real_t p_scalar) const {
|
||||
|
||||
return Vector3( x/p_scalar, y/p_scalar, z/p_scalar);
|
||||
return Vector3( x/p_scalar, y/p_scalar, z/p_scalar);
|
||||
}
|
||||
|
||||
Vector3 Vector3::operator-() const {
|
||||
|
||||
return Vector3( -x, -y, -z );
|
||||
return Vector3( -x, -y, -z );
|
||||
}
|
||||
|
||||
|
||||
bool Vector3::operator==(const Vector3& p_v) const {
|
||||
|
||||
return (x==p_v.x && y==p_v.y && z==p_v.z);
|
||||
return (x==p_v.x && y==p_v.y && z==p_v.z);
|
||||
}
|
||||
|
||||
bool Vector3::operator!=(const Vector3& p_v) const {
|
||||
|
||||
return (x!=p_v.x || y!=p_v.y || z!=p_v.z);
|
||||
return (x!=p_v.x || y!=p_v.y || z!=p_v.z);
|
||||
}
|
||||
|
||||
bool Vector3::operator<(const Vector3& p_v) const {
|
||||
@@ -298,9 +304,9 @@ bool Vector3::operator<(const Vector3& p_v) const {
|
||||
return z<p_v.z;
|
||||
else
|
||||
return y<p_v.y;
|
||||
} else
|
||||
} else {
|
||||
return x<p_v.x;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
bool Vector3::operator<=(const Vector3& p_v) const {
|
||||
@@ -310,9 +316,9 @@ bool Vector3::operator<=(const Vector3& p_v) const {
|
||||
return z<=p_v.z;
|
||||
else
|
||||
return y<p_v.y;
|
||||
} else
|
||||
} else {
|
||||
return x<p_v.x;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ Vector3 vec3_cross(const Vector3& p_a, const Vector3& p_b) {
|
||||
@@ -333,6 +339,7 @@ real_t Vector3::length() const {
|
||||
|
||||
return Math::sqrt(x2+y2+z2);
|
||||
}
|
||||
|
||||
real_t Vector3::length_squared() const {
|
||||
|
||||
real_t x2=x*x;
|
||||
@@ -340,27 +347,25 @@ real_t Vector3::length_squared() const {
|
||||
real_t z2=z*z;
|
||||
|
||||
return x2+y2+z2;
|
||||
|
||||
}
|
||||
|
||||
void Vector3::normalize() {
|
||||
|
||||
real_t l=length();
|
||||
if (l==0) {
|
||||
|
||||
real_t l=length();
|
||||
if (l==0) {
|
||||
x=y=z=0;
|
||||
} else {
|
||||
|
||||
} else {
|
||||
x/=l;
|
||||
y/=l;
|
||||
z/=l;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Vector3 Vector3::normalized() const {
|
||||
|
||||
Vector3 v=*this;
|
||||
v.normalize();
|
||||
return v;
|
||||
Vector3 v=*this;
|
||||
v.normalize();
|
||||
return v;
|
||||
}
|
||||
|
||||
Vector3 Vector3::inverse() const {
|
||||
@@ -377,10 +382,10 @@ Vector3 Vector3::slide(const Vector3& p_vec) const {
|
||||
|
||||
return p_vec - *this * this->dot(p_vec);
|
||||
}
|
||||
|
||||
Vector3 Vector3::reflect(const Vector3& p_vec) const {
|
||||
|
||||
return p_vec - *this * this->dot(p_vec) * 2.0;
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@@ -1152,6 +1152,15 @@ void Object::emit_signal(const StringName& p_name,const Variant** p_args,int p_a
|
||||
|
||||
Signal *s = signal_map.getptr(p_name);
|
||||
if (!s) {
|
||||
#ifdef DEBUG_ENABLED
|
||||
bool signal_is_valid = ObjectTypeDB::has_signal(get_type_name(),p_name);
|
||||
//check in script
|
||||
if (!signal_is_valid && !script.is_null() && !Ref<Script>(script)->has_script_signal(p_name)) {
|
||||
ERR_EXPLAIN("Can't emit non-existing signal " + String("\"")+p_name+"\".");
|
||||
ERR_FAIL();
|
||||
}
|
||||
#endif
|
||||
//not connected? just return
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
Import('env')
|
||||
|
||||
env.add_source_files(env.core_sources,"*.cpp")
|
||||
env.add_source_files(env.core_sources, "*.cpp")
|
||||
|
||||
Export('env')
|
||||
|
@@ -31,89 +31,18 @@
|
||||
|
||||
#include "typedefs.h"
|
||||
|
||||
///@TODO use optimized routines for this, depending on platform. these are just the standard ones
|
||||
#ifdef PLATFORM_COPYMEM
|
||||
|
||||
#define copymem(m_to,m_from,m_count) \
|
||||
do { \
|
||||
unsigned char * _from=(unsigned char*)m_from; \
|
||||
unsigned char * _to=(unsigned char*)m_to; \
|
||||
int _count=m_count; \
|
||||
for (int _i=0;_i<_count;_i++) \
|
||||
_to[_i]=_from[_i]; \
|
||||
} while (0);
|
||||
/*
|
||||
case 0: *_dto++ = *_dfrom++; \
|
||||
case 7: *_dto++ = *_dfrom++; \
|
||||
case 6: *_dto++ = *_dfrom++; \
|
||||
case 5: *_dto++ = *_dfrom++; \
|
||||
case 4: *_dto++ = *_dfrom++; \
|
||||
case 3: *_dto++ = *_dfrom++; \
|
||||
case 2: *_dto++ = *_dfrom++; \
|
||||
case 1: *_dto++ = *_dfrom++; \
|
||||
*/
|
||||
#define movemem_duff(m_to, m_from, m_count) \
|
||||
do { \
|
||||
if (m_to<m_from) { \
|
||||
unsigned char* _dto = (unsigned char*)m_to; \
|
||||
unsigned char* _dfrom = (unsigned char*)m_from; \
|
||||
int n = (m_count + 7) / 8; \
|
||||
switch (m_count % 8) { \
|
||||
do { \
|
||||
case 0: *_dto++ = *_dfrom++; \
|
||||
case 7: *_dto++ = *_dfrom++; \
|
||||
case 6: *_dto++ = *_dfrom++; \
|
||||
case 5: *_dto++ = *_dfrom++; \
|
||||
case 4: *_dto++ = *_dfrom++; \
|
||||
case 3: *_dto++ = *_dfrom++; \
|
||||
case 2: *_dto++ = *_dfrom++; \
|
||||
case 1: *_dto++ = *_dfrom++; \
|
||||
} while (--n > 0); \
|
||||
}; \
|
||||
} else if (m_to>m_from) { \
|
||||
unsigned char* _dto = &((unsigned char*)m_to)[m_count-1]; \
|
||||
unsigned char* _dfrom = &((unsigned char*)m_from)[m_count-1]; \
|
||||
int n = (m_count + 7) / 8; \
|
||||
switch (m_count % 8) { \
|
||||
do { \
|
||||
case 0: *_dto-- = *_dfrom--; \
|
||||
case 7: *_dto-- = *_dfrom--; \
|
||||
case 6: *_dto-- = *_dfrom--; \
|
||||
case 5: *_dto-- = *_dfrom--; \
|
||||
case 4: *_dto-- = *_dfrom--; \
|
||||
case 3: *_dto-- = *_dfrom--; \
|
||||
case 2: *_dto-- = *_dfrom--; \
|
||||
case 1: *_dto-- = *_dfrom--; \
|
||||
} while (--n > 0); \
|
||||
}; \
|
||||
} \
|
||||
} while(0) \
|
||||
#include "platform_copymem.h" // included from platform/<current_platform>/platform_copymem.h"
|
||||
|
||||
#define movemem_conventional(m_to,m_from,m_count) \
|
||||
do { \
|
||||
if (m_to<m_from) { \
|
||||
unsigned char * _from=(unsigned char*)m_from; \
|
||||
unsigned char * _to=(unsigned char*)m_to; \
|
||||
int _count=m_count; \
|
||||
for (int _i=0;_i<_count;_i++) \
|
||||
_to[_i]=_from[_i]; \
|
||||
\
|
||||
} else if (m_to>m_from) { \
|
||||
unsigned char * _from=(unsigned char*)m_from; \
|
||||
unsigned char * _to=(unsigned char*)m_to; \
|
||||
int _count=m_count; \
|
||||
while (_count--) \
|
||||
_to[_count]=_from[_count]; \
|
||||
\
|
||||
\
|
||||
} \
|
||||
} while (0); \
|
||||
#else
|
||||
|
||||
void movemem_system(void*,void*,int);
|
||||
#include <string.h>
|
||||
|
||||
#define movemem movemem_system
|
||||
|
||||
|
||||
void zeromem(void* p_mem,size_t p_bytes);
|
||||
#define copymem(to,from,count) memcpy(to,from,count)
|
||||
#define zeromem(to, count) memset(to, 0, count)
|
||||
#define movemem(to, from, count) memmove(to, from, count)
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@@ -62,6 +62,10 @@ void Input::_bind_methods() {
|
||||
ObjectTypeDB::bind_method(_MD("get_connected_joysticks"),&Input::get_connected_joysticks);
|
||||
ObjectTypeDB::bind_method(_MD("get_joy_vibration_strength", "device"), &Input::get_joy_vibration_strength);
|
||||
ObjectTypeDB::bind_method(_MD("get_joy_vibration_duration", "device"), &Input::get_joy_vibration_duration);
|
||||
ObjectTypeDB::bind_method(_MD("get_joy_button_string", "button_index"), &Input::get_joy_button_string);
|
||||
ObjectTypeDB::bind_method(_MD("get_joy_button_index_from_string", "button"), &Input::get_joy_button_index_from_string);
|
||||
ObjectTypeDB::bind_method(_MD("get_joy_axis_string", "axis_index"), &Input::get_joy_axis_string);
|
||||
ObjectTypeDB::bind_method(_MD("get_joy_axis_index_from_string", "axis"), &Input::get_joy_axis_index_from_string);
|
||||
ObjectTypeDB::bind_method(_MD("start_joy_vibration", "device", "weak_magnitude", "strong_magnitude", "duration"), &Input::start_joy_vibration, DEFVAL(0));
|
||||
ObjectTypeDB::bind_method(_MD("stop_joy_vibration", "device"), &Input::stop_joy_vibration);
|
||||
ObjectTypeDB::bind_method(_MD("get_accelerometer"),&Input::get_accelerometer);
|
||||
|
@@ -94,6 +94,11 @@ public:
|
||||
virtual void set_custom_mouse_cursor(const RES& p_cursor,const Vector2& p_hotspot=Vector2())=0;
|
||||
virtual void set_mouse_in_window(bool p_in_window)=0;
|
||||
|
||||
virtual String get_joy_button_string(int p_button)=0;
|
||||
virtual String get_joy_axis_string(int p_axis)=0;
|
||||
virtual int get_joy_button_index_from_string(String p_button)=0;
|
||||
virtual int get_joy_axis_index_from_string(String p_axis)=0;
|
||||
|
||||
Input();
|
||||
};
|
||||
|
||||
|
@@ -34,8 +34,57 @@
|
||||
*/
|
||||
|
||||
bool InputEvent::operator==(const InputEvent &p_event) const {
|
||||
if (type != p_event.type){
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
switch(type) {
|
||||
case NONE:
|
||||
return true;
|
||||
case KEY:
|
||||
return key.unicode == p_event.key.unicode
|
||||
&& key.scancode == p_event.key.scancode
|
||||
&& key.echo == p_event.key.echo
|
||||
&& key.pressed == p_event.key.pressed
|
||||
&& key.mod == p_event.key.mod;
|
||||
case MOUSE_MOTION:
|
||||
return mouse_motion.x == p_event.mouse_motion.x
|
||||
&& mouse_motion.y == p_event.mouse_motion.y
|
||||
&& mouse_motion.relative_x == p_event.mouse_motion.relative_x
|
||||
&& mouse_motion.relative_y == p_event.mouse_motion.relative_y
|
||||
&& mouse_motion.button_mask == p_event.mouse_motion.button_mask
|
||||
&& key.mod == p_event.key.mod;
|
||||
case MOUSE_BUTTON:
|
||||
return mouse_button.pressed == p_event.mouse_button.pressed
|
||||
&& mouse_button.x == p_event.mouse_button.x
|
||||
&& mouse_button.y == p_event.mouse_button.y
|
||||
&& mouse_button.button_index == p_event.mouse_button.button_index
|
||||
&& mouse_button.button_mask == p_event.mouse_button.button_mask
|
||||
&& key.mod == p_event.key.mod;
|
||||
case JOYSTICK_MOTION:
|
||||
return joy_motion.axis == p_event.joy_motion.axis
|
||||
&& joy_motion.axis_value == p_event.joy_motion.axis_value;
|
||||
case JOYSTICK_BUTTON:
|
||||
return joy_button.pressed == p_event.joy_button.pressed
|
||||
&& joy_button.button_index == p_event.joy_button.button_index
|
||||
&& joy_button.pressure == p_event.joy_button.pressure;
|
||||
case SCREEN_TOUCH:
|
||||
return screen_touch.pressed == p_event.screen_touch.pressed
|
||||
&& screen_touch.index == p_event.screen_touch.index
|
||||
&& screen_touch.x == p_event.screen_touch.x
|
||||
&& screen_touch.y == p_event.screen_touch.y;
|
||||
case SCREEN_DRAG:
|
||||
return screen_drag.index == p_event.screen_drag.index
|
||||
&& screen_drag.x == p_event.screen_drag.x
|
||||
&& screen_drag.y == p_event.screen_drag.y;
|
||||
case ACTION:
|
||||
return action.action == p_event.action.action
|
||||
&& action.pressed == p_event.action.pressed;
|
||||
default:
|
||||
ERR_PRINT("No logic to compare InputEvents of this type, this shouldn't happen.");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
InputEvent::operator String() const {
|
||||
|
||||
@@ -156,7 +205,7 @@ bool InputEvent::is_pressed() const {
|
||||
case MOUSE_BUTTON: return mouse_button.pressed;
|
||||
case JOYSTICK_BUTTON: return joy_button.pressed;
|
||||
case SCREEN_TOUCH: return screen_touch.pressed;
|
||||
case JOYSTICK_MOTION: return InputMap::get_singleton()->event_is_joy_motion_action_pressed(*this);
|
||||
case JOYSTICK_MOTION: return ABS(joy_motion.axis_value) > 0.5;
|
||||
case ACTION: return action.pressed;
|
||||
default: {}
|
||||
}
|
||||
|
@@ -542,7 +542,7 @@ void OS::set_use_vsync(bool p_enable) {
|
||||
|
||||
}
|
||||
|
||||
bool OS::is_vsnc_enabled() const{
|
||||
bool OS::is_vsync_enabled() const{
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@@ -364,6 +364,7 @@ public:
|
||||
virtual void set_screen_orientation(ScreenOrientation p_orientation);
|
||||
ScreenOrientation get_screen_orientation() const;
|
||||
|
||||
virtual void enable_for_stealing_focus(ProcessID pid) {}
|
||||
virtual void move_window_to_foreground() {}
|
||||
|
||||
virtual void debug_break();
|
||||
@@ -422,7 +423,7 @@ public:
|
||||
virtual void set_context(int p_context);
|
||||
|
||||
virtual void set_use_vsync(bool p_enable);
|
||||
virtual bool is_vsnc_enabled() const;
|
||||
virtual bool is_vsync_enabled() const;
|
||||
|
||||
Dictionary get_engine_version() const;
|
||||
|
||||
|
@@ -33,6 +33,7 @@
|
||||
#include "io/config_file.h"
|
||||
#include "os/main_loop.h"
|
||||
#include "io/packet_peer.h"
|
||||
#include "math/a_star.h"
|
||||
#include "globals.h"
|
||||
#include "object_type_db.h"
|
||||
#include "geometry.h"
|
||||
@@ -48,6 +49,7 @@
|
||||
#include "os/input.h"
|
||||
#include "core/io/xml_parser.h"
|
||||
#include "io/http_client.h"
|
||||
#include "io/pck_packer.h"
|
||||
#include "packed_data_container.h"
|
||||
#include "func_ref.h"
|
||||
#include "input_map.h"
|
||||
@@ -144,8 +146,11 @@ void register_core_types() {
|
||||
|
||||
ObjectTypeDB::register_type<ConfigFile>();
|
||||
|
||||
ObjectTypeDB::register_type<PCKPacker>();
|
||||
|
||||
ObjectTypeDB::register_type<PackedDataContainer>();
|
||||
ObjectTypeDB::register_virtual_type<PackedDataContainerRef>();
|
||||
ObjectTypeDB::register_type<AStar>();
|
||||
|
||||
ip = IP::create();
|
||||
|
||||
|
@@ -134,6 +134,8 @@ void ScriptDebuggerRemote::debug(ScriptLanguage *p_script,bool p_can_continue) {
|
||||
ERR_FAIL();
|
||||
}
|
||||
|
||||
OS::get_singleton()->enable_for_stealing_focus(Globals::get_singleton()->get("editor_pid"));
|
||||
|
||||
packet_peer_stream->put_var("debug_enter");
|
||||
packet_peer_stream->put_var(2);
|
||||
packet_peer_stream->put_var(p_can_continue);
|
||||
@@ -219,7 +221,8 @@ void ScriptDebuggerRemote::debug(ScriptLanguage *p_script,bool p_can_continue) {
|
||||
|
||||
if (F->get().get_type()==Variant::OBJECT) {
|
||||
packet_peer_stream->put_var("*"+E->get());
|
||||
packet_peer_stream->put_var(safe_get_instance_id(F->get()));
|
||||
String pretty_print = F->get().operator String();
|
||||
packet_peer_stream->put_var(pretty_print.ascii().get_data());
|
||||
} else {
|
||||
packet_peer_stream->put_var(E->get());
|
||||
packet_peer_stream->put_var(F->get());
|
||||
@@ -242,7 +245,8 @@ void ScriptDebuggerRemote::debug(ScriptLanguage *p_script,bool p_can_continue) {
|
||||
|
||||
if (F->get().get_type()==Variant::OBJECT) {
|
||||
packet_peer_stream->put_var("*"+E->get());
|
||||
packet_peer_stream->put_var(safe_get_instance_id(F->get()));
|
||||
String pretty_print = F->get().operator String();
|
||||
packet_peer_stream->put_var(pretty_print.ascii().get_data());
|
||||
} else {
|
||||
packet_peer_stream->put_var(E->get());
|
||||
packet_peer_stream->put_var(F->get());
|
||||
@@ -271,6 +275,7 @@ void ScriptDebuggerRemote::debug(ScriptLanguage *p_script,bool p_can_continue) {
|
||||
|
||||
set_depth(-1);
|
||||
set_lines_left(-1);
|
||||
OS::get_singleton()->move_window_to_foreground();
|
||||
break;
|
||||
} else if (command=="break") {
|
||||
ERR_PRINT("Got break when already broke!");
|
||||
|
@@ -32,11 +32,23 @@
|
||||
#include "os/os.h"
|
||||
|
||||
static const char* locale_list[]={
|
||||
"aa", // Afar
|
||||
"aa_DJ", // Afar (Djibouti)
|
||||
"aa_ER", // Afar (Eritrea)
|
||||
"aa_ET", // Afar (Ethiopia)
|
||||
"af", // Afrikaans
|
||||
"af_ZA", // Afrikaans (South Africa)
|
||||
"agr_PE", // Aguaruna (Peru)
|
||||
"ak_GH", // Akan (Ghana)
|
||||
"am_ET", // Amharic (Ethiopia)
|
||||
"an_ES", // Aragonese (Spain)
|
||||
"anp_IN", // Angika (India)
|
||||
"ar", // Arabic
|
||||
"ar_AE", // Arabic (United Arab Emirates)
|
||||
"ar_BH", // Arabic (Bahrain)
|
||||
"ar_DZ", // Arabic (Algeria)
|
||||
"ar_EG", // Arabic (Egypt)
|
||||
"ar_IN", // Arabic (India)
|
||||
"ar_IQ", // Arabic (Iraq)
|
||||
"ar_JO", // Arabic (Jordan)
|
||||
"ar_KW", // Arabic (Kuwait)
|
||||
@@ -47,48 +59,91 @@ static const char* locale_list[]={
|
||||
"ar_QA", // Arabic (Qatar)
|
||||
"ar_SA", // Arabic (Saudi Arabia)
|
||||
"ar_SD", // Arabic (Sudan)
|
||||
"ar_SS", // Arabic (South Soudan)
|
||||
"ar_SY", // Arabic (Syria)
|
||||
"ar_TN", // Arabic (Tunisia)
|
||||
"ar_YE", // Arabic (Yemen)
|
||||
"as_IN", // Assamese (India)
|
||||
"ast_ES", // Asturian (Spain)
|
||||
"ayc_PE", // Southern Aymara (Peru)
|
||||
"ay_PE", // Aymara (Peru)
|
||||
"az_AZ", // Azerbaijani (Azerbaijan)
|
||||
"be", // Belarusian
|
||||
"be_BY", // Belarusian (Belarus)
|
||||
"bem_ZM", // Bemba (Zambia)
|
||||
"ber_DZ", // Berber languages (Algeria)
|
||||
"ber_MA", // Berber languages (Morocco)
|
||||
"bg", // Bulgarian
|
||||
"bg_BG", // Bulgarian (Bulgaria)
|
||||
"bhb_IN", // Bhili (India)
|
||||
"bho_IN", // Bhojpuri (India)
|
||||
"bi_TV", // Bislama (Tuvalu)
|
||||
"bn", // Bengali
|
||||
"bn_BD", // Bengali (Bangladesh)
|
||||
"bn_IN", // Bengali (India)
|
||||
"bo", // Tibetan
|
||||
"bo_CN", // Tibetan (China)
|
||||
"bo_IN", // Tibetan (India)
|
||||
"br_FR", // Breton (France)
|
||||
"brx_IN", // Bodo (India)
|
||||
"bs_BA", // Bosnian (Bosnia and Herzegovina)
|
||||
"byn_ER", // Bilin (Eritrea)
|
||||
"ca", // Catalan
|
||||
"ca_AD", // Catalan (Andorra)
|
||||
"ca_ES", // Catalan (Spain)
|
||||
"ca_FR", // Catalan (France)
|
||||
"ca_IT", // Catalan (Italy)
|
||||
"ce_RU", // Chechen (Russia)
|
||||
"chr_US", // Cherokee (United States)
|
||||
"cmn_TW", // Mandarin Chinese (Taiwan)
|
||||
"crh_UA", // Crimean Tatar (Ukraine)
|
||||
"csb_PL", // Kashubian (Poland)
|
||||
"cs", // Czech
|
||||
"cs_CZ", // Czech (Czech Republic)
|
||||
"cv_RU", // Chuvash (Russia)
|
||||
"cy_GB", // Welsh (United Kingdom)
|
||||
"da", // Danish
|
||||
"da_DK", // Danish (Denmark)
|
||||
"de", // German
|
||||
"de_AT", // German (Austria)
|
||||
"de_BE", // German (Belgium)
|
||||
"de_CH", // German (Switzerland)
|
||||
"de_DE", // German (Germany)
|
||||
"de_IT", // German (Italy)
|
||||
"de_LU", // German (Luxembourg)
|
||||
"doi_IN", // Dogri (India)
|
||||
"dv_MV", // Dhivehi (Maldives)
|
||||
"dz_BT", // Dzongkha (Bhutan)
|
||||
"el", // Greek
|
||||
"el_CY", // Greek (Cyprus)
|
||||
"el_GR", // Greek (Greece)
|
||||
"en", // English
|
||||
"en_AG", // English (Antigua and Barbuda)
|
||||
"en_AU", // English (Australia)
|
||||
"en_BW", // English (Botswana)
|
||||
"en_CA", // English (Canada)
|
||||
"en_DK", // English (Denmark)
|
||||
"en_GB", // English (United Kingdom)
|
||||
"en_HK", // English (Hong Kong)
|
||||
"en_IE", // English (Ireland)
|
||||
"en_IL", // English (Israel)
|
||||
"en_IN", // English (India)
|
||||
"en_MT", // English (Malta)
|
||||
"en_NG", // English (Nigeria)
|
||||
"en_NZ", // English (New Zealand)
|
||||
"en_PH", // English (Philippines)
|
||||
"en_SG", // English (Singapore)
|
||||
"en_US", // English (United States)
|
||||
"en_ZA", // English (South Africa)
|
||||
"en_ZM", // English (Zambia)
|
||||
"en_ZW", // English (Zimbabwe)
|
||||
"eo", // Esperanto
|
||||
"es", // Spanish
|
||||
"es_AR", // Spanish (Argentina)
|
||||
"es_BO", // Spanish (Bolivia)
|
||||
"es_CL", // Spanish (Chile)
|
||||
"es_CO", // Spanish (Colombia)
|
||||
"es_CR", // Spanish (Costa Rica)
|
||||
"es_CU", // Spanish (Cuba)
|
||||
"es_DO", // Spanish (Dominican Republic)
|
||||
"es_EC", // Spanish (Ecuador)
|
||||
"es_ES", // Spanish (Spain)
|
||||
@@ -106,100 +161,252 @@ static const char* locale_list[]={
|
||||
"es_VE", // Spanish (Venezuela)
|
||||
"et", // Estonian
|
||||
"et_EE", // Estonian (Estonia)
|
||||
"eu", // Basque
|
||||
"eu_ES", // Basque (Spain)
|
||||
"fa", // Persian
|
||||
"fa_IR", // Persian (Iran)
|
||||
"ff_SN", // Fulah (Senegal)
|
||||
"fi", // Finnish
|
||||
"fi_FI", // Finnish (Finland)
|
||||
"fil_PH", // Filipino (Philippines)
|
||||
"fo_FO", // Faroese (Faroe Islands)
|
||||
"fr", // French
|
||||
"fr_BE", // French (Belgium)
|
||||
"fr_CA", // French (Canada)
|
||||
"fr_CH", // French (Switzerland)
|
||||
"fr_FR", // French (France)
|
||||
"fr_LU", // French (Luxembourg)
|
||||
"fur_IT", // Friulian (Italy)
|
||||
"fy_DE", // Western Frisian (Germany)
|
||||
"fy_NL", // Western Frisian (Netherlands)
|
||||
"ga", // Irish
|
||||
"ga_IE", // Irish (Ireland)
|
||||
"hi", // Hindi (India)
|
||||
"gd_GB", // Scottish Gaelic (United Kingdom)
|
||||
"gez_ER", // Geez (Eritrea)
|
||||
"gez_ET", // Geez (Ethiopia)
|
||||
"gl_ES", // Galician (Spain)
|
||||
"gu_IN", // Gujarati (India)
|
||||
"gv_GB", // Manx (United Kingdom)
|
||||
"hak_TW", // Hakka Chinese (Taiwan)
|
||||
"ha_NG", // Hausa (Nigeria)
|
||||
"he", // Hebrew
|
||||
"he_IL", // Hebrew (Israel)
|
||||
"hi", // Hindi
|
||||
"hi_IN", // Hindi (India)
|
||||
"hne_IN", // Chhattisgarhi (India)
|
||||
"hr", // Croatian
|
||||
"hr_HR", // Croatian (Croatia)
|
||||
"hsb_DE", // Upper Sorbian (Germany)
|
||||
"ht_HT", // Haitian (Haiti)
|
||||
"hu", // Hungarian
|
||||
"hu_HU", // Hungarian (Hungary)
|
||||
"in", // Indonesian
|
||||
"in_ID", // Indonesian (Indonesia)
|
||||
"hus_MX", // Huastec (Mexico)
|
||||
"hy_AM", // Armenian (Armenia)
|
||||
"ia_FR", // Interlingua (France)
|
||||
"id", // Indonesian
|
||||
"id_ID", // Indonesian (Indonesia)
|
||||
"ig_NG", // Igbo (Nigeria)
|
||||
"ik_CA", // Inupiaq (Canada)
|
||||
"is", // Icelandic
|
||||
"is_IS", // Icelandic (Iceland)
|
||||
"it", // Italian
|
||||
"it_CH", // Italian (Switzerland)
|
||||
"it_IT", // Italian (Italy)
|
||||
"iw", // Hebrew
|
||||
"iw_IL", // Hebrew (Israel)
|
||||
"iu_CA", // Inuktitut (Canada)
|
||||
"ja", // Japanese
|
||||
"ja_JP", // Japanese (Japan)
|
||||
"ja_JP_JP", // Japanese (Japan,JP)
|
||||
"kab_DZ", // Kabyle (Algeria)
|
||||
"ka_GE", // Georgian (Georgia)
|
||||
"kk_KZ", // Kazakh (Kazakhstan)
|
||||
"kl_GL", // Kalaallisut (Greenland)
|
||||
"km_KH", // Central Khmer (Cambodia)
|
||||
"kn_IN", // Kannada (India)
|
||||
"kok_IN", // Konkani (India)
|
||||
"ko", // Korean
|
||||
"ko_KR", // Korean (South Korea)
|
||||
"ks_IN", // Kashmiri (India)
|
||||
"ku", // Kurdish
|
||||
"ku_TR", // Kurdish (Turkey)
|
||||
"kw_GB", // Cornish (United Kingdom)
|
||||
"ky_KG", // Kirghiz (Kyrgyzstan)
|
||||
"lb_LU", // Luxembourgish (Luxembourg)
|
||||
"lg_UG", // Ganda (Uganda)
|
||||
"li_BE", // Limburgan (Belgium)
|
||||
"li_NL", // Limburgan (Netherlands)
|
||||
"lij_IT", // Ligurian (Italy)
|
||||
"ln_CD", // Lingala (Congo)
|
||||
"lo_LA", // Lao (Laos)
|
||||
"lt", // Lithuanian
|
||||
"lt_LT", // Lithuanian (Lithuania)
|
||||
"lv", // Latvian
|
||||
"lv_LV", // Latvian (Latvia)
|
||||
"lzh_TW", // Literary Chinese (Taiwan)
|
||||
"mag_IN", // Magahi (India)
|
||||
"mai_IN", // Maithili (India)
|
||||
"mg_MG", // Malagasy (Madagascar)
|
||||
"mh_MH", // Marshallese (Marshall Islands)
|
||||
"mhr_RU", // Eastern Mari (Russia)
|
||||
"mi_NZ", // Maori (New Zealand)
|
||||
"miq_NI", // Mískito (Nicaragua)
|
||||
"mk", // Macedonian
|
||||
"mk_MK", // Macedonian (Macedonia)
|
||||
"ml_IN", // Malayalam (India)
|
||||
"mni_IN", // Manipuri (India)
|
||||
"mn_MN", // Mongolian (Mongolia)
|
||||
"mr_IN", // Marathi (India)
|
||||
"ms", // Malay
|
||||
"ms_MY", // Malay (Malaysia)
|
||||
"mt", // Maltese
|
||||
"mt_MT", // Maltese (Malta)
|
||||
"my_MM", // Burmese (Myanmar)
|
||||
"myv_RU", // Erzya (Russia)
|
||||
"nah_MX", // Nahuatl languages (Mexico)
|
||||
"nan_TW", // Min Nan Chinese (Taiwan)
|
||||
"nb", // Norwegian Bokmål
|
||||
"nb_NO", // Norwegian Bokmål (Norway)
|
||||
"nds_DE", // Low German (Germany)
|
||||
"nds_NL", // Low German (Netherlands)
|
||||
"ne_NP", // Nepali (Nepal)
|
||||
"nhn_MX", // Central Nahuatl (Mexico)
|
||||
"niu_NU", // Niuean (Niue)
|
||||
"niu_NZ", // Niuean (New Zealand)
|
||||
"nl", // Dutch
|
||||
"nl_AW", // Dutch (Aruba)
|
||||
"nl_BE", // Dutch (Belgium)
|
||||
"nl_NL", // Dutch (Netherlands)
|
||||
"no", // Norwegian
|
||||
"no_NO", // Norwegian (Norway)
|
||||
"no_NO_NY", // Norwegian (Norway,Nynorsk)
|
||||
"nn", // Norwegian Nynorsk
|
||||
"nn_NO", // Norwegian Nynorsk (Norway)
|
||||
"nr_ZA", // South Ndebele (South Africa)
|
||||
"nso_ZA", // Pedi (South Africa)
|
||||
"oc_FR", // Occitan (France)
|
||||
"om", // Oromo
|
||||
"om_ET", // Oromo (Ethiopia)
|
||||
"om_KE", // Oromo (Kenya)
|
||||
"or_IN", // Oriya (India)
|
||||
"os_RU", // Ossetian (Russia)
|
||||
"pa_IN", // Panjabi (India)
|
||||
"pap", // Papiamento
|
||||
"pap_AN", // Papiamento (Netherlands Antilles)
|
||||
"pap_AW", // Papiamento (Aruba)
|
||||
"pap_CW", // Papiamento (Curaçao)
|
||||
"pa_PK", // Panjabi (Pakistan)
|
||||
"pl", // Polish
|
||||
"pl_PL", // Polish (Poland)
|
||||
"ps_AF", // Pushto (Afghanistan)
|
||||
"pt", // Portuguese
|
||||
"pt_BR", // Portuguese (Brazil)
|
||||
"pt_PT", // Portuguese (Portugal)
|
||||
"quy_PE", // Ayacucho Quechua (Peru)
|
||||
"quz_PE", // Cusco Quechua (Peru)
|
||||
"raj_IN", // Rajasthani (India)
|
||||
"ro", // Romanian
|
||||
"ro_RO", // Romanian (Romania)
|
||||
"ru", // Russian
|
||||
"ru_RU", // Russian (Russia)
|
||||
"ru_UA", // Russian (Ukraine)
|
||||
"rw_RW", // Kinyarwanda (Rwanda)
|
||||
"sa_IN", // Sanskrit (India)
|
||||
"sat_IN", // Santali (India)
|
||||
"sc_IT", // Sardinian (Italy)
|
||||
"sd_IN", // Sindhi (India)
|
||||
"se_NO", // Northern Sami (Norway)
|
||||
"sgs_LT", // Samogitian (Lithuania)
|
||||
"shs_CA", // Shuswap (Canada)
|
||||
"sid_ET", // Sidamo (Ethiopia)
|
||||
"si_LK", // Sinhala (Sri Lanka)
|
||||
"sk", // Slovak
|
||||
"sk_SK", // Slovak (Slovakia)
|
||||
"sl", // Slovenian
|
||||
"sl_SI", // Slovenian (Slovenia)
|
||||
"so", // Somali
|
||||
"so_DJ", // Somali (Djibouti)
|
||||
"so_ET", // Somali (Ethiopia)
|
||||
"so_KE", // Somali (Kenya)
|
||||
"so_SO", // Somali (Somalia)
|
||||
"son_ML", // Songhai languages (Mali)
|
||||
"sq", // Albanian
|
||||
"sq_AL", // Albanian (Albania)
|
||||
"sq_KV", // Albanian (Kosovo)
|
||||
"sq_MK", // Albanian (Macedonia)
|
||||
"sr", // Serbian
|
||||
"sr_BA", // Serbian (Bosnia and Herzegovina)
|
||||
"sr_CS", // Serbian (Serbia and Montenegro)
|
||||
"sr_ME", // Serbian (Montenegro)
|
||||
"sr_RS", // Serbian (Serbia)
|
||||
"ss_ZA", // Swati (South Africa)
|
||||
"st_ZA", // Southern Sotho (South Africa)
|
||||
"sv", // Swedish
|
||||
"sv_FI", // Swedish (Finland)
|
||||
"sv_SE", // Swedish (Sweden)
|
||||
"sw_KE", // Swahili (Kenya)
|
||||
"sw_TZ", // Swahili (Tanzania)
|
||||
"szl_PL", // Silesian (Poland)
|
||||
"ta", // Tamil
|
||||
"ta_IN", // Tamil (India)
|
||||
"ta_LK", // Tamil (Sri Lanka)
|
||||
"tcy_IN", // Tulu (India)
|
||||
"te_IN", // Telugu (India)
|
||||
"tg_TJ", // Tajik (Tajikistan)
|
||||
"the_NP", // Chitwania Tharu (Nepal)
|
||||
"th", // Thai
|
||||
"th_TH", // Thai (Thailand)
|
||||
"th_TH_TH", // Thai (Thailand,TH)
|
||||
"ti", // Tigrinya
|
||||
"ti_ER", // Tigrinya (Eritrea)
|
||||
"ti_ET", // Tigrinya (Ethiopia)
|
||||
"tig_ER", // Tigre (Eritrea)
|
||||
"tk_TM", // Turkmen (Turkmenistan)
|
||||
"tl_PH", // Tagalog (Philippines)
|
||||
"tn_ZA", // Tswana (South Africa)
|
||||
"tr", // Turkish
|
||||
"tr_CY", // Turkish (Cyprus)
|
||||
"tr_TR", // Turkish (Turkey)
|
||||
"ts_ZA", // Tsonga (South Africa)
|
||||
"tt_RU", // Tatar (Russia)
|
||||
"ug_CN", // Uighur (China)
|
||||
"uk", // Ukrainian
|
||||
"uk_UA", // Ukrainian (Ukraine)
|
||||
"unm_US", // Unami (United States)
|
||||
"ur", // Urdu
|
||||
"ur_IN", // Urdu (India)
|
||||
"ur_PK", // Urdu (Pakistan)
|
||||
"uz", // Uzbek
|
||||
"uz_UZ", // Uzbek (Uzbekistan)
|
||||
"ve_ZA", // Venda (South Africa)
|
||||
"vi", // Vietnamese
|
||||
"vi_VN", // Vietnamese (Vietnam)
|
||||
"wa_BE", // Walloon (Belgium)
|
||||
"wae_CH", // Walser (Switzerland)
|
||||
"wal_ET", // Wolaytta (Ethiopia)
|
||||
"wo_SN", // Wolof (Senegal)
|
||||
"xh_ZA", // Xhosa (South Africa)
|
||||
"yi_US", // Yiddish (United States)
|
||||
"yo_NG", // Yoruba (Nigeria)
|
||||
"yue_HK", // Yue Chinese (Hong Kong)
|
||||
"zh", // Chinese
|
||||
"zh_CN", // Chinese (China)
|
||||
"zh_HK", // Chinese (Hong Kong)
|
||||
"zh_SG", // Chinese (Singapore)
|
||||
"zh_TW", // Chinese (Taiwan)
|
||||
"zu_ZA", // Zulu (South Africa)
|
||||
0
|
||||
};
|
||||
|
||||
static const char* locale_names[]={
|
||||
"Afar",
|
||||
"Afar (Djibouti)",
|
||||
"Afar (Eritrea)",
|
||||
"Afar (Ethiopia)",
|
||||
"Afrikaans",
|
||||
"Afrikaans (South Africa)",
|
||||
"Aguaruna (Peru)",
|
||||
"Akan (Ghana)",
|
||||
"Amharic (Ethiopia)",
|
||||
"Aragonese (Spain)",
|
||||
"Angika (India)",
|
||||
"Arabic",
|
||||
"Arabic (United Arab Emirates)",
|
||||
"Arabic (Bahrain)",
|
||||
"Arabic (Algeria)",
|
||||
"Arabic (Egypt)",
|
||||
"Arabic (India)",
|
||||
"Arabic (Iraq)",
|
||||
"Arabic (Jordan)",
|
||||
"Arabic (Kuwait)",
|
||||
@@ -210,48 +417,91 @@ static const char* locale_names[]={
|
||||
"Arabic (Qatar)",
|
||||
"Arabic (Saudi Arabia)",
|
||||
"Arabic (Sudan)",
|
||||
"Arabic (South Soudan)",
|
||||
"Arabic (Syria)",
|
||||
"Arabic (Tunisia)",
|
||||
"Arabic (Yemen)",
|
||||
"Assamese (India)",
|
||||
"Asturian (Spain)",
|
||||
"Southern Aymara (Peru)",
|
||||
"Aymara (Peru)",
|
||||
"Azerbaijani (Azerbaijan)",
|
||||
"Belarusian",
|
||||
"Belarusian (Belarus)",
|
||||
"Bemba (Zambia)",
|
||||
"Berber languages (Algeria)",
|
||||
"Berber languages (Morocco)",
|
||||
"Bulgarian",
|
||||
"Bulgarian (Bulgaria)",
|
||||
"Bhili (India)",
|
||||
"Bhojpuri (India)",
|
||||
"Bislama (Tuvalu)",
|
||||
"Bengali",
|
||||
"Bengali (Bangladesh)",
|
||||
"Bengali (India)",
|
||||
"Tibetan",
|
||||
"Tibetan (China)",
|
||||
"Tibetan (India)",
|
||||
"Breton (France)",
|
||||
"Bodo (India)",
|
||||
"Bosnian (Bosnia and Herzegovina)",
|
||||
"Bilin (Eritrea)",
|
||||
"Catalan",
|
||||
"Catalan (Andorra)",
|
||||
"Catalan (Spain)",
|
||||
"Catalan (France)",
|
||||
"Catalan (Italy)",
|
||||
"Chechen (Russia)",
|
||||
"Cherokee (United States)",
|
||||
"Mandarin Chinese (Taiwan)",
|
||||
"Crimean Tatar (Ukraine)",
|
||||
"Kashubian (Poland)",
|
||||
"Czech",
|
||||
"Czech (Czech Republic)",
|
||||
"Chuvash (Russia)",
|
||||
"Welsh (United Kingdom)",
|
||||
"Danish",
|
||||
"Danish (Denmark)",
|
||||
"German",
|
||||
"German (Austria)",
|
||||
"German (Belgium)",
|
||||
"German (Switzerland)",
|
||||
"German (Germany)",
|
||||
"German (Italy)",
|
||||
"German (Luxembourg)",
|
||||
"Dogri (India)",
|
||||
"Dhivehi (Maldives)",
|
||||
"Dzongkha (Bhutan)",
|
||||
"Greek",
|
||||
"Greek (Cyprus)",
|
||||
"Greek (Greece)",
|
||||
"English",
|
||||
"English (Antigua and Barbuda)",
|
||||
"English (Australia)",
|
||||
"English (Botswana)",
|
||||
"English (Canada)",
|
||||
"English (Denmark)",
|
||||
"English (United Kingdom)",
|
||||
"English (Hong Kong)",
|
||||
"English (Ireland)",
|
||||
"English (Israel)",
|
||||
"English (India)",
|
||||
"English (Malta)",
|
||||
"English (Nigeria)",
|
||||
"English (New Zealand)",
|
||||
"English (Philippines)",
|
||||
"English (Singapore)",
|
||||
"English (United States)",
|
||||
"English (South Africa)",
|
||||
"English (Zambia)",
|
||||
"English (Zimbabwe)",
|
||||
"Esperanto",
|
||||
"Spanish",
|
||||
"Spanish (Argentina)",
|
||||
"Spanish (Bolivia)",
|
||||
"Spanish (Chile)",
|
||||
"Spanish (Colombia)",
|
||||
"Spanish (Costa Rica)",
|
||||
"Spanish (Cuba)",
|
||||
"Spanish (Dominican Republic)",
|
||||
"Spanish (Ecuador)",
|
||||
"Spanish (Spain)",
|
||||
@@ -269,91 +519,231 @@ static const char* locale_names[]={
|
||||
"Spanish (Venezuela)",
|
||||
"Estonian",
|
||||
"Estonian (Estonia)",
|
||||
"Basque",
|
||||
"Basque (Spain)",
|
||||
"Persian",
|
||||
"Persian (Iran)",
|
||||
"Fulah (Senegal)",
|
||||
"Finnish",
|
||||
"Finnish (Finland)",
|
||||
"Filipino (Philippines)",
|
||||
"Faroese (Faroe Islands)",
|
||||
"French",
|
||||
"French (Belgium)",
|
||||
"French (Canada)",
|
||||
"French (Switzerland)",
|
||||
"French (France)",
|
||||
"French (Luxembourg)",
|
||||
"Friulian (Italy)",
|
||||
"Western Frisian (Germany)",
|
||||
"Western Frisian (Netherlands)",
|
||||
"Irish",
|
||||
"Irish (Ireland)",
|
||||
"Scottish Gaelic (United Kingdom)",
|
||||
"Geez (Eritrea)",
|
||||
"Geez (Ethiopia)",
|
||||
"Galician (Spain)",
|
||||
"Gujarati (India)",
|
||||
"Manx (United Kingdom)",
|
||||
"Hakka Chinese (Taiwan)",
|
||||
"Hausa (Nigeria)",
|
||||
"Hebrew",
|
||||
"Hebrew (Israel)",
|
||||
"Hindi",
|
||||
"Hindi (India)",
|
||||
"Hindi (India)",
|
||||
"Chhattisgarhi (India)",
|
||||
"Croatian",
|
||||
"Croatian (Croatia)",
|
||||
"Upper Sorbian (Germany)",
|
||||
"Haitian (Haiti)",
|
||||
"Hungarian",
|
||||
"Hungarian (Hungary)",
|
||||
"Huastec (Mexico)",
|
||||
"Armenian (Armenia)",
|
||||
"Interlingua (France)",
|
||||
"Indonesian",
|
||||
"Indonesian (Indonesia)",
|
||||
"Igbo (Nigeria)",
|
||||
"Inupiaq (Canada)",
|
||||
"Icelandic",
|
||||
"Icelandic (Iceland)",
|
||||
"Italian",
|
||||
"Italian (Switzerland)",
|
||||
"Italian (Italy)",
|
||||
"Hebrew",
|
||||
"Hebrew (Israel)",
|
||||
"Inuktitut (Canada)",
|
||||
"Japanese",
|
||||
"Japanese (Japan)",
|
||||
"Japanese (Japan JP)",
|
||||
"Kabyle (Algeria)",
|
||||
"Georgian (Georgia)",
|
||||
"Kazakh (Kazakhstan)",
|
||||
"Kalaallisut (Greenland)",
|
||||
"Central Khmer (Cambodia)",
|
||||
"Kannada (India)",
|
||||
"Konkani (India)",
|
||||
"Korean",
|
||||
"Korean (South Korea)",
|
||||
"Kashmiri (India)",
|
||||
"Kurdish",
|
||||
"Kurdish (Turkey)",
|
||||
"Cornish (United Kingdom)",
|
||||
"Kirghiz (Kyrgyzstan)",
|
||||
"Luxembourgish (Luxembourg)",
|
||||
"Ganda (Uganda)",
|
||||
"Limburgan (Belgium)",
|
||||
"Limburgan (Netherlands)",
|
||||
"Ligurian (Italy)",
|
||||
"Lingala (Congo)",
|
||||
"Lao (Laos)",
|
||||
"Lithuanian",
|
||||
"Lithuanian (Lithuania)",
|
||||
"Latvian",
|
||||
"Latvian (Latvia)",
|
||||
"Literary Chinese (Taiwan)",
|
||||
"Magahi (India)",
|
||||
"Maithili (India)",
|
||||
"Malagasy (Madagascar)",
|
||||
"Marshallese (Marshall Islands)",
|
||||
"Eastern Mari (Russia)",
|
||||
"Maori (New Zealand)",
|
||||
"Mískito (Nicaragua)",
|
||||
"Macedonian",
|
||||
"Macedonian (Macedonia)",
|
||||
"Malayalam (India)",
|
||||
"Manipuri (India)",
|
||||
"Mongolian (Mongolia)",
|
||||
"Marathi (India)",
|
||||
"Malay",
|
||||
"Malay (Malaysia)",
|
||||
"Maltese",
|
||||
"Maltese (Malta)",
|
||||
"Burmese (Myanmar)",
|
||||
"Erzya (Russia)",
|
||||
"Nahuatl languages (Mexico)",
|
||||
"Min Nan Chinese (Taiwan)",
|
||||
"Norwegian Bokmål",
|
||||
"Norwegian Bokmål (Norway)",
|
||||
"Low German (Germany)",
|
||||
"Low German (Netherlands)",
|
||||
"Nepali (Nepal)",
|
||||
"Central Nahuatl (Mexico)",
|
||||
"Niuean (Niue)",
|
||||
"Niuean (New Zealand)",
|
||||
"Dutch",
|
||||
"Dutch (Aruba)",
|
||||
"Dutch (Belgium)",
|
||||
"Dutch (Netherlands)",
|
||||
"Norwegian",
|
||||
"Norwegian (Norway)",
|
||||
"Norwegian (Norway Nynorsk)",
|
||||
"Norwegian Nynorsk",
|
||||
"Norwegian Nynorsk (Norway)",
|
||||
"South Ndebele (South Africa)",
|
||||
"Pedi (South Africa)",
|
||||
"Occitan (France)",
|
||||
"Oromo",
|
||||
"Oromo (Ethiopia)",
|
||||
"Oromo (Kenya)",
|
||||
"Oriya (India)",
|
||||
"Ossetian (Russia)",
|
||||
"Panjabi (India)",
|
||||
"Papiamento",
|
||||
"Papiamento (Netherlands Antilles)",
|
||||
"Papiamento (Aruba)",
|
||||
"Papiamento (Curaçao)",
|
||||
"Panjabi (Pakistan)",
|
||||
"Polish",
|
||||
"Polish (Poland)",
|
||||
"Pushto (Afghanistan)",
|
||||
"Portuguese",
|
||||
"Portuguese (Brazil)",
|
||||
"Portuguese (Portugal)",
|
||||
"Ayacucho Quechua (Peru)",
|
||||
"Cusco Quechua (Peru)",
|
||||
"Rajasthani (India)",
|
||||
"Romanian",
|
||||
"Romanian (Romania)",
|
||||
"Russian",
|
||||
"Russian (Russia)",
|
||||
"Russian (Ukraine)",
|
||||
"Kinyarwanda (Rwanda)",
|
||||
"Sanskrit (India)",
|
||||
"Santali (India)",
|
||||
"Sardinian (Italy)",
|
||||
"Sindhi (India)",
|
||||
"Northern Sami (Norway)",
|
||||
"Samogitian (Lithuania)",
|
||||
"Shuswap (Canada)",
|
||||
"Sidamo (Ethiopia)",
|
||||
"Sinhala (Sri Lanka)",
|
||||
"Slovak",
|
||||
"Slovak (Slovakia)",
|
||||
"Slovenian",
|
||||
"Slovenian (Slovenia)",
|
||||
"Somali",
|
||||
"Somali (Djibouti)",
|
||||
"Somali (Ethiopia)",
|
||||
"Somali (Kenya)",
|
||||
"Somali (Somalia)",
|
||||
"Songhai languages (Mali)",
|
||||
"Albanian",
|
||||
"Albanian (Albania)",
|
||||
"Albanian (Kosovo)",
|
||||
"Albanian (Macedonia)",
|
||||
"Serbian",
|
||||
"Serbian (Bosnia and Herzegovina)",
|
||||
"Serbian (Serbia and Montenegro)",
|
||||
"Serbian (Montenegro)",
|
||||
"Serbian (Serbia)",
|
||||
"Swati (South Africa)",
|
||||
"Southern Sotho (South Africa)",
|
||||
"Swedish",
|
||||
"Swedish (Finland)",
|
||||
"Swedish (Sweden)",
|
||||
"Swahili (Kenya)",
|
||||
"Swahili (Tanzania)",
|
||||
"Silesian (Poland)",
|
||||
"Tamil",
|
||||
"Tamil (India)",
|
||||
"Tamil (Sri Lanka)",
|
||||
"Tulu (India)",
|
||||
"Telugu (India)",
|
||||
"Tajik (Tajikistan)",
|
||||
"Chitwania Tharu (Nepal)",
|
||||
"Thai",
|
||||
"Thai (Thailand)",
|
||||
"Thai (Thailand TH)",
|
||||
"Tigrinya",
|
||||
"Tigrinya (Eritrea)",
|
||||
"Tigrinya (Ethiopia)",
|
||||
"Tigre (Eritrea)",
|
||||
"Turkmen (Turkmenistan)",
|
||||
"Tagalog (Philippines)",
|
||||
"Tswana (South Africa)",
|
||||
"Turkish",
|
||||
"Turkish (Cyprus)",
|
||||
"Turkish (Turkey)",
|
||||
"Tsonga (South Africa)",
|
||||
"Tatar (Russia)",
|
||||
"Uighur (China)",
|
||||
"Ukrainian",
|
||||
"Ukrainian (Ukraine)",
|
||||
"Unami (United States)",
|
||||
"Urdu",
|
||||
"Urdu (India)",
|
||||
"Urdu (Pakistan)",
|
||||
"Uzbek",
|
||||
"Uzbek (Uzbekistan)",
|
||||
"Venda (South Africa)",
|
||||
"Vietnamese",
|
||||
"Vietnamese (Vietnam)",
|
||||
"Walloon (Belgium)",
|
||||
"Walser (Switzerland)",
|
||||
"Wolaytta (Ethiopia)",
|
||||
"Wolof (Senegal)",
|
||||
"Xhosa (South Africa)",
|
||||
"Yiddish (United States)",
|
||||
"Yoruba (Nigeria)",
|
||||
"Yue Chinese (Hong Kong)",
|
||||
"Chinese",
|
||||
"Chinese (China)",
|
||||
"Chinese (Hong Kong)",
|
||||
"Chinese (Singapore)",
|
||||
"Chinese (Taiwan)",
|
||||
"Zulu (South Africa)",
|
||||
0
|
||||
};
|
||||
|
||||
@@ -389,6 +779,11 @@ Vector<String> TranslationServer::get_all_locale_names(){
|
||||
}
|
||||
|
||||
|
||||
static String get_trimmed_locale(const String& p_locale) {
|
||||
|
||||
return p_locale.substr(0,2);
|
||||
}
|
||||
|
||||
static bool is_valid_locale(const String& p_locale) {
|
||||
|
||||
const char **ptr=locale_list;
|
||||
@@ -449,9 +844,20 @@ void Translation::_set_messages(const DVector<String>& p_messages){
|
||||
|
||||
void Translation::set_locale(const String& p_locale) {
|
||||
|
||||
ERR_EXPLAIN("Invalid Locale: "+p_locale);
|
||||
ERR_FAIL_COND(!is_valid_locale(p_locale));
|
||||
locale=p_locale;
|
||||
// replaces '-' with '_' for macOS Sierra-style locales
|
||||
String univ_locale = p_locale.replace("-", "_");
|
||||
|
||||
if(!is_valid_locale(univ_locale)) {
|
||||
String trimmed_locale = get_trimmed_locale(univ_locale);
|
||||
|
||||
ERR_EXPLAIN("Invalid Locale: "+trimmed_locale);
|
||||
ERR_FAIL_COND(!is_valid_locale(trimmed_locale));
|
||||
|
||||
locale=trimmed_locale;
|
||||
}
|
||||
else {
|
||||
locale=univ_locale;
|
||||
}
|
||||
}
|
||||
|
||||
void Translation::add_message( const StringName& p_src_text, const StringName& p_xlated_text ) {
|
||||
@@ -516,9 +922,20 @@ Translation::Translation() {
|
||||
|
||||
void TranslationServer::set_locale(const String& p_locale) {
|
||||
|
||||
ERR_EXPLAIN("Invalid Locale: "+p_locale);
|
||||
ERR_FAIL_COND(!is_valid_locale(p_locale));
|
||||
locale=p_locale;
|
||||
// replaces '-' with '_' for macOS Sierra-style locales
|
||||
String univ_locale = p_locale.replace("-", "_");
|
||||
|
||||
if(!is_valid_locale(univ_locale)) {
|
||||
String trimmed_locale = get_trimmed_locale(univ_locale);
|
||||
|
||||
ERR_EXPLAIN("Invalid Locale: "+trimmed_locale);
|
||||
ERR_FAIL_COND(!is_valid_locale(trimmed_locale));
|
||||
|
||||
locale=trimmed_locale;
|
||||
}
|
||||
else {
|
||||
locale=univ_locale;
|
||||
}
|
||||
}
|
||||
|
||||
String TranslationServer::get_locale() const {
|
||||
|
@@ -52,26 +52,46 @@ void UndoRedo::_discard_redo() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
void UndoRedo::create_action(const String& p_name,bool p_mergeable) {
|
||||
void UndoRedo::create_action(const String& p_name,MergeMode p_mode) {
|
||||
|
||||
if (action_level==0) {
|
||||
|
||||
_discard_redo();
|
||||
if (p_mergeable && actions.size() && actions[actions.size()-1].name==p_name) {
|
||||
|
||||
//old will replace new (it's mergeable after all)
|
||||
// should check references though!
|
||||
// Check if the merge operation is valid
|
||||
if (p_mode!=MERGE_DISABLE && actions.size() && actions[actions.size()-1].name==p_name) {
|
||||
|
||||
current_action=actions.size()-2;
|
||||
actions[current_action+1].do_ops.clear();
|
||||
//actions[current_action+1].undo_ops.clear(); - no, this is kept
|
||||
merging=true;
|
||||
|
||||
if (p_mode==MERGE_ENDS) {
|
||||
|
||||
// Clear all do ops from last action, and delete all object references
|
||||
List<Operation>::Element *E=actions[current_action+1].do_ops.front();
|
||||
|
||||
while (E) {
|
||||
|
||||
if (E->get().type==Operation::TYPE_REFERENCE) {
|
||||
|
||||
Object *obj=ObjectDB::get_instance(E->get().object);
|
||||
|
||||
if (obj)
|
||||
memdelete(obj);
|
||||
}
|
||||
|
||||
E=E->next();
|
||||
actions[current_action+1].do_ops.pop_front();
|
||||
}
|
||||
}
|
||||
|
||||
merge_mode=p_mode;
|
||||
|
||||
} else {
|
||||
|
||||
Action new_action;
|
||||
new_action.name=p_name;
|
||||
actions.push_back(new_action);
|
||||
merging=false;
|
||||
|
||||
merge_mode=MERGE_DISABLE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,8 +122,10 @@ void UndoRedo::add_undo_method(Object *p_object,const String& p_method,VARIANT_A
|
||||
VARIANT_ARGPTRS
|
||||
ERR_FAIL_COND(action_level<=0);
|
||||
ERR_FAIL_COND((current_action+1)>=actions.size());
|
||||
if (merging)
|
||||
return; //- no undo if merging
|
||||
|
||||
// No undo if the merge mode is MERGE_ENDS
|
||||
if (merge_mode==MERGE_ENDS)
|
||||
return;
|
||||
|
||||
Operation undo_op;
|
||||
undo_op.object=p_object->get_instance_ID();
|
||||
@@ -139,6 +161,10 @@ void UndoRedo::add_undo_property(Object *p_object,const String& p_property,const
|
||||
ERR_FAIL_COND(action_level<=0);
|
||||
ERR_FAIL_COND((current_action+1)>=actions.size());
|
||||
|
||||
// No undo if the merge mode is MERGE_ENDS
|
||||
if (merge_mode==MERGE_ENDS)
|
||||
return;
|
||||
|
||||
Operation undo_op;
|
||||
undo_op.object=p_object->get_instance_ID();
|
||||
if (p_object->cast_to<Resource>())
|
||||
@@ -167,6 +193,11 @@ void UndoRedo::add_undo_reference(Object *p_object) {
|
||||
|
||||
ERR_FAIL_COND(action_level<=0);
|
||||
ERR_FAIL_COND((current_action+1)>=actions.size());
|
||||
|
||||
// No undo if the merge mode is MERGE_ENDS
|
||||
if (merge_mode==MERGE_ENDS)
|
||||
return;
|
||||
|
||||
Operation undo_op;
|
||||
undo_op.object=p_object->get_instance_ID();
|
||||
if (p_object->cast_to<Resource>())
|
||||
@@ -352,7 +383,7 @@ UndoRedo::UndoRedo() {
|
||||
action_level=0;
|
||||
current_action=-1;
|
||||
max_steps=-1;
|
||||
merging=true;
|
||||
merge_mode=MERGE_DISABLE;
|
||||
callback=NULL;
|
||||
callback_ud=NULL;
|
||||
|
||||
@@ -448,7 +479,7 @@ Variant UndoRedo::_add_undo_method(const Variant** p_args, int p_argcount, Varia
|
||||
|
||||
void UndoRedo::_bind_methods() {
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("create_action","name","mergeable"),&UndoRedo::create_action, DEFVAL(false) );
|
||||
ObjectTypeDB::bind_method(_MD("create_action","name","merge_mode"),&UndoRedo::create_action, DEFVAL(MERGE_DISABLE) );
|
||||
ObjectTypeDB::bind_method(_MD("commit_action"),&UndoRedo::commit_action);
|
||||
|
||||
//ObjectTypeDB::bind_method(_MD("add_do_method","p_object", "p_method", "VARIANT_ARG_LIST"),&UndoRedo::add_do_method);
|
||||
@@ -489,4 +520,8 @@ void UndoRedo::_bind_methods() {
|
||||
ObjectTypeDB::bind_method(_MD("clear_history"),&UndoRedo::clear_history);
|
||||
ObjectTypeDB::bind_method(_MD("get_current_action_name"),&UndoRedo::get_current_action_name);
|
||||
ObjectTypeDB::bind_method(_MD("get_version"),&UndoRedo::get_version);
|
||||
|
||||
BIND_CONSTANT(MERGE_DISABLE);
|
||||
BIND_CONSTANT(MERGE_ENDS);
|
||||
BIND_CONSTANT(MERGE_ALL);
|
||||
}
|
||||
|
@@ -41,6 +41,12 @@ class UndoRedo : public Object {
|
||||
OBJ_SAVE_TYPE( UndoRedo );
|
||||
public:
|
||||
|
||||
enum MergeMode {
|
||||
MERGE_DISABLE,
|
||||
MERGE_ENDS,
|
||||
MERGE_ALL
|
||||
};
|
||||
|
||||
typedef void (*CommitNotifyCallback)(void *p_ud,const String& p_name);
|
||||
Variant _add_do_method(const Variant** p_args, int p_argcount, Variant::CallError& r_error);
|
||||
Variant _add_undo_method(const Variant** p_args, int p_argcount, Variant::CallError& r_error);
|
||||
@@ -76,7 +82,7 @@ private:
|
||||
int current_action;
|
||||
int action_level;
|
||||
int max_steps;
|
||||
bool merging;
|
||||
MergeMode merge_mode;
|
||||
uint64_t version;
|
||||
|
||||
void _pop_history_tail();
|
||||
@@ -98,7 +104,7 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
void create_action(const String& p_name="",bool p_mergeable=false);
|
||||
void create_action(const String& p_name="",MergeMode p_mode=MERGE_DISABLE);
|
||||
|
||||
void add_do_method(Object *p_object,const String& p_method,VARIANT_ARG_LIST);
|
||||
void add_undo_method(Object *p_object,const String& p_method,VARIANT_ARG_LIST);
|
||||
@@ -128,4 +134,6 @@ public:
|
||||
~UndoRedo();
|
||||
};
|
||||
|
||||
VARIANT_ENUM_CAST( UndoRedo::MergeMode );
|
||||
|
||||
#endif // UNDO_REDO_H
|
||||
|
@@ -3073,6 +3073,11 @@ String String::simplify_path() const {
|
||||
}
|
||||
|
||||
s =s.replace("\\","/");
|
||||
while(true){ // in case of using 2 or more slash
|
||||
String compare = s.replace("//","/");
|
||||
if (s==compare) break;
|
||||
else s=compare;
|
||||
}
|
||||
Vector<String> dirs = s.split("/",false);
|
||||
|
||||
for(int i=0;i<dirs.size();i++) {
|
||||
@@ -3173,7 +3178,7 @@ bool String::is_valid_identifier() const {
|
||||
|
||||
//kind of poor should be rewritten properly
|
||||
|
||||
String String::world_wrap(int p_chars_per_line) const {
|
||||
String String::word_wrap(int p_chars_per_line) const {
|
||||
|
||||
int from=0;
|
||||
int last_space=0;
|
||||
|
@@ -218,7 +218,7 @@ public:
|
||||
String c_escape() const;
|
||||
String c_unescape() const;
|
||||
String json_escape() const;
|
||||
String world_wrap(int p_chars_per_line) const;
|
||||
String word_wrap(int p_chars_per_line) const;
|
||||
|
||||
String percent_encode() const;
|
||||
String percent_decode() const;
|
||||
|
@@ -429,6 +429,7 @@ bool Variant::can_convert(Variant::Type p_type_from,Variant::Type p_type_to) {
|
||||
return true;
|
||||
i++;
|
||||
}
|
||||
|
||||
} else if (invalid_types) {
|
||||
|
||||
|
||||
@@ -439,6 +440,8 @@ bool Variant::can_convert(Variant::Type p_type_from,Variant::Type p_type_to) {
|
||||
return false;
|
||||
i++;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -457,7 +460,6 @@ bool Variant::can_convert_strict(Variant::Type p_type_from,Variant::Type p_type_
|
||||
};
|
||||
|
||||
const Type *valid_types=NULL;
|
||||
const Type *invalid_types=NULL;
|
||||
|
||||
switch(p_type_to) {
|
||||
case BOOL: {
|
||||
@@ -679,16 +681,6 @@ bool Variant::can_convert_strict(Variant::Type p_type_from,Variant::Type p_type_
|
||||
return true;
|
||||
i++;
|
||||
}
|
||||
} else if (invalid_types) {
|
||||
|
||||
|
||||
int i=0;
|
||||
while(invalid_types[i]!=NIL) {
|
||||
|
||||
if (p_type_from==invalid_types[i])
|
||||
return false;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@@ -346,6 +346,7 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var
|
||||
VCALL_LOCALMEM0R(Vector2,angle);
|
||||
// VCALL_LOCALMEM1R(Vector2,cross);
|
||||
VCALL_LOCALMEM0R(Vector2,abs);
|
||||
VCALL_LOCALMEM1R(Vector2,clamped);
|
||||
|
||||
VCALL_LOCALMEM0R(Rect2,get_area);
|
||||
VCALL_LOCALMEM1R(Rect2,intersects);
|
||||
@@ -374,6 +375,7 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var
|
||||
VCALL_LOCALMEM0R(Vector3, ceil);
|
||||
VCALL_LOCALMEM1R(Vector3, distance_to);
|
||||
VCALL_LOCALMEM1R(Vector3, distance_squared_to);
|
||||
VCALL_LOCALMEM1R(Vector3, angle_to);
|
||||
VCALL_LOCALMEM1R(Vector3, slide);
|
||||
VCALL_LOCALMEM1R(Vector3, reflect);
|
||||
|
||||
@@ -1398,6 +1400,7 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl
|
||||
ADDFUNC1(VECTOR2,VECTOR2,Vector2,reflect,VECTOR2,"vec",varray());
|
||||
//ADDFUNC1(VECTOR2,REAL,Vector2,cross,VECTOR2,"with",varray());
|
||||
ADDFUNC0(VECTOR2,VECTOR2,Vector2,abs,varray());
|
||||
ADDFUNC1(VECTOR2,VECTOR2,Vector2,clamped,REAL,"length",varray());
|
||||
|
||||
ADDFUNC0(RECT2,REAL,Rect2,get_area,varray());
|
||||
ADDFUNC1(RECT2,BOOL,Rect2,intersects,RECT2,"b",varray());
|
||||
@@ -1426,6 +1429,7 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl
|
||||
ADDFUNC0(VECTOR3,VECTOR3,Vector3,ceil,varray());
|
||||
ADDFUNC1(VECTOR3,REAL,Vector3,distance_to,VECTOR3,"b",varray());
|
||||
ADDFUNC1(VECTOR3,REAL,Vector3,distance_squared_to,VECTOR3,"b",varray());
|
||||
ADDFUNC1(VECTOR3,REAL,Vector3,angle_to,VECTOR3,"to",varray());
|
||||
ADDFUNC1(VECTOR3,VECTOR3,Vector3,slide,VECTOR3,"by",varray());
|
||||
ADDFUNC1(VECTOR3,VECTOR3,Vector3,reflect,VECTOR3,"by",varray());
|
||||
|
||||
|
@@ -3046,7 +3046,7 @@ bool Variant::iter_next(Variant& r_iter,bool &valid) const {
|
||||
const String *str=reinterpret_cast<const String*>(_data._mem);
|
||||
int idx = r_iter;
|
||||
idx++;
|
||||
if (idx >= str->size())
|
||||
if (idx >= str->length())
|
||||
return false;
|
||||
r_iter = idx;
|
||||
return true;
|
||||
|
@@ -986,7 +986,18 @@ Error VariantParser::parse_value(Token& token,Variant &value,Stream *p_stream,in
|
||||
|
||||
InputEvent ie;
|
||||
|
||||
if (id=="KEY") {
|
||||
if (id=="NONE") {
|
||||
|
||||
ie.type=InputEvent::NONE;
|
||||
|
||||
get_token(p_stream,token,line,r_err_str);
|
||||
|
||||
if (token.type!=TK_PARENTHESIS_CLOSE) {
|
||||
r_err_str="Expected ')'";
|
||||
return ERR_PARSE_ERROR;
|
||||
}
|
||||
|
||||
} else if (id=="KEY") {
|
||||
|
||||
get_token(p_stream,token,line,r_err_str);
|
||||
if (token.type!=TK_COMMA) {
|
||||
@@ -2093,6 +2104,9 @@ Error VariantWriter::write(const Variant& p_variant, StoreStringFunc p_store_str
|
||||
case InputEvent::JOYSTICK_MOTION: {
|
||||
str+="JAXIS,"+itos(ev.joy_motion.axis)+","+itos(ev.joy_motion.axis_value);
|
||||
} break;
|
||||
case InputEvent::NONE: {
|
||||
str+="NONE";
|
||||
} break;
|
||||
default: {}
|
||||
}
|
||||
|
||||
|
1230
doc/base/classes.xml
1230
doc/base/classes.xml
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/python
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import sys
|
||||
@@ -6,206 +6,210 @@ import xml.etree.ElementTree as ET
|
||||
|
||||
|
||||
tree = ET.parse(sys.argv[1])
|
||||
old_doc=tree.getroot()
|
||||
old_doc = tree.getroot()
|
||||
|
||||
tree = ET.parse(sys.argv[2])
|
||||
new_doc=tree.getroot()
|
||||
new_doc = tree.getroot()
|
||||
|
||||
f = file(sys.argv[3],"wb")
|
||||
tab=0
|
||||
f = file(sys.argv[3], "wb")
|
||||
tab = 0
|
||||
|
||||
old_classes={}
|
||||
old_classes = {}
|
||||
|
||||
|
||||
def write_string(_f, text, newline=True):
|
||||
for t in range(tab):
|
||||
_f.write("\t")
|
||||
_f.write(text)
|
||||
if (newline):
|
||||
_f.write("\n")
|
||||
|
||||
def write_string(_f, text,newline=True):
|
||||
for t in range(tab):
|
||||
_f.write("\t")
|
||||
_f.write(text)
|
||||
if (newline):
|
||||
_f.write("\n")
|
||||
|
||||
def escape(ret):
|
||||
ret=ret.replace("&","&");
|
||||
ret=ret.replace("<",">");
|
||||
ret=ret.replace(">","<");
|
||||
ret=ret.replace("'","'");
|
||||
ret=ret.replace("\"",""");
|
||||
return ret
|
||||
ret = ret.replace("&", "&")
|
||||
ret = ret.replace("<", ">")
|
||||
ret = ret.replace(">", "<")
|
||||
ret = ret.replace("'", "'")
|
||||
ret = ret.replace("\"", """)
|
||||
return ret
|
||||
|
||||
|
||||
def inc_tab():
|
||||
global tab
|
||||
tab+=1
|
||||
global tab
|
||||
tab += 1
|
||||
|
||||
|
||||
def dec_tab():
|
||||
global tab
|
||||
tab-=1
|
||||
global tab
|
||||
tab -= 1
|
||||
|
||||
write_string(f,'<?xml version="1.0" encoding="UTF-8" ?>')
|
||||
write_string(f,'<doc version="'+new_doc.attrib["version"]+'">')
|
||||
write_string(f, '<?xml version="1.0" encoding="UTF-8" ?>')
|
||||
write_string(f, '<doc version="' + new_doc.attrib["version"] + '">')
|
||||
|
||||
def get_tag(node,name):
|
||||
tag=""
|
||||
if (name in node.attrib):
|
||||
tag=' '+name+'="'+escape(node.attrib[name])+'" '
|
||||
return tag
|
||||
|
||||
def find_method_descr(old_class,name):
|
||||
def get_tag(node, name):
|
||||
tag = ""
|
||||
if (name in node.attrib):
|
||||
tag = ' ' + name + '="' + escape(node.attrib[name]) + '" '
|
||||
return tag
|
||||
|
||||
methods = old_class.find("methods")
|
||||
if(methods!=None and len(list(methods))>0):
|
||||
for m in list(methods):
|
||||
if (m.attrib["name"]==name):
|
||||
description=m.find("description")
|
||||
if (description!=None and description.text.strip()!=""):
|
||||
return description.text
|
||||
|
||||
return None
|
||||
def find_method_descr(old_class, name):
|
||||
|
||||
def find_signal_descr(old_class,name):
|
||||
methods = old_class.find("methods")
|
||||
if(methods != None and len(list(methods)) > 0):
|
||||
for m in list(methods):
|
||||
if (m.attrib["name"] == name):
|
||||
description = m.find("description")
|
||||
if (description != None and description.text.strip() != ""):
|
||||
return description.text
|
||||
|
||||
signals = old_class.find("signals")
|
||||
if(signals!=None and len(list(signals))>0):
|
||||
for m in list(signals):
|
||||
if (m.attrib["name"]==name):
|
||||
description=m.find("description")
|
||||
if (description!=None and description.text.strip()!=""):
|
||||
return description.text
|
||||
return None
|
||||
|
||||
return None
|
||||
|
||||
def find_constant_descr(old_class,name):
|
||||
def find_signal_descr(old_class, name):
|
||||
|
||||
signals = old_class.find("signals")
|
||||
if(signals != None and len(list(signals)) > 0):
|
||||
for m in list(signals):
|
||||
if (m.attrib["name"] == name):
|
||||
description = m.find("description")
|
||||
if (description != None and description.text.strip() != ""):
|
||||
return description.text
|
||||
|
||||
return None
|
||||
|
||||
|
||||
def find_constant_descr(old_class, name):
|
||||
|
||||
if (old_class == None):
|
||||
return None
|
||||
constants = old_class.find("constants")
|
||||
if(constants != None and len(list(constants)) > 0):
|
||||
for m in list(constants):
|
||||
if (m.attrib["name"] == name):
|
||||
if (m.text.strip() != ""):
|
||||
return m.text
|
||||
return None
|
||||
|
||||
if (old_class==None):
|
||||
return None
|
||||
constants = old_class.find("constants")
|
||||
if(constants!=None and len(list(constants))>0):
|
||||
for m in list(constants):
|
||||
if (m.attrib["name"]==name):
|
||||
if (m.text.strip()!=""):
|
||||
return m.text
|
||||
return None
|
||||
|
||||
def write_class(c):
|
||||
class_name = c.attrib["name"]
|
||||
print("Parsing Class: "+class_name)
|
||||
if (class_name in old_classes):
|
||||
old_class=old_classes[class_name]
|
||||
else:
|
||||
old_class=None
|
||||
class_name = c.attrib["name"]
|
||||
print("Parsing Class: " + class_name)
|
||||
if (class_name in old_classes):
|
||||
old_class = old_classes[class_name]
|
||||
else:
|
||||
old_class = None
|
||||
|
||||
category = get_tag(c, "category")
|
||||
inherits = get_tag(c, "inherits")
|
||||
write_string(f, '<class name="' + class_name + '" ' + category + inherits + '>')
|
||||
inc_tab()
|
||||
|
||||
category=get_tag(c,"category")
|
||||
inherits=get_tag(c,"inherits")
|
||||
write_string(f,'<class name="'+class_name+'" '+category+inherits+'>')
|
||||
inc_tab()
|
||||
write_string(f, "<brief_description>")
|
||||
|
||||
write_string(f,"<brief_description>")
|
||||
if (old_class != None):
|
||||
old_brief_descr = old_class.find("brief_description")
|
||||
if (old_brief_descr != None):
|
||||
write_string(f, escape(old_brief_descr.text.strip()))
|
||||
|
||||
if (old_class!=None):
|
||||
old_brief_descr=old_class.find("brief_description")
|
||||
if (old_brief_descr!=None):
|
||||
write_string(f,escape(old_brief_descr.text.strip()))
|
||||
write_string(f, "</brief_description>")
|
||||
|
||||
write_string(f, "<description>")
|
||||
if (old_class != None):
|
||||
old_descr = old_class.find("description")
|
||||
if (old_descr != None):
|
||||
write_string(f, escape(old_descr.text.strip()))
|
||||
|
||||
write_string(f,"</brief_description>")
|
||||
write_string(f, "</description>")
|
||||
|
||||
write_string(f,"<description>")
|
||||
if (old_class!=None):
|
||||
old_descr=old_class.find("description")
|
||||
if (old_descr!=None):
|
||||
write_string(f,escape(old_descr.text.strip()))
|
||||
methods = c.find("methods")
|
||||
if(methods != None and len(list(methods)) > 0):
|
||||
|
||||
write_string(f,"</description>")
|
||||
write_string(f, "<methods>")
|
||||
inc_tab()
|
||||
|
||||
methods = c.find("methods")
|
||||
if(methods!=None and len(list(methods))>0):
|
||||
for m in list(methods):
|
||||
qualifiers = get_tag(m, "qualifiers")
|
||||
|
||||
write_string(f,"<methods>")
|
||||
inc_tab()
|
||||
write_string(f, '<method name="' + escape(m.attrib["name"]) + '" ' + qualifiers + '>')
|
||||
inc_tab()
|
||||
|
||||
for m in list(methods):
|
||||
qualifiers=get_tag(m,"qualifiers")
|
||||
for a in list(m):
|
||||
if (a.tag == "return"):
|
||||
typ = get_tag(a, "type")
|
||||
write_string(f, '<return' + typ + '>')
|
||||
write_string(f, '</return>')
|
||||
elif (a.tag == "argument"):
|
||||
|
||||
write_string(f,'<method name="'+escape(m.attrib["name"])+'" ' +qualifiers+'>')
|
||||
inc_tab()
|
||||
default = get_tag(a, "default")
|
||||
|
||||
for a in list(m):
|
||||
if (a.tag=="return"):
|
||||
typ=get_tag(a,"type")
|
||||
write_string(f,'<return'+typ+'>');
|
||||
write_string(f,'</return>');
|
||||
elif (a.tag=="argument"):
|
||||
write_string(f, '<argument index="' + a.attrib["index"] + '" name="' + escape(a.attrib["name"]) + '" type="' + a.attrib["type"] + '"' + default + '>')
|
||||
write_string(f, '</argument>')
|
||||
|
||||
default=get_tag(a,"default")
|
||||
write_string(f, '<description>')
|
||||
if (old_class != None):
|
||||
old_method_descr = find_method_descr(old_class, m.attrib["name"])
|
||||
if (old_method_descr):
|
||||
write_string(f, escape(escape(old_method_descr.strip())))
|
||||
|
||||
write_string(f,'<argument index="'+a.attrib["index"]+'" name="'+escape(a.attrib["name"])+'" type="'+a.attrib["type"]+'"' +default+'>');
|
||||
write_string(f,'</argument>');
|
||||
write_string(f, '</description>')
|
||||
dec_tab()
|
||||
write_string(f, "</method>")
|
||||
dec_tab()
|
||||
write_string(f, "</methods>")
|
||||
|
||||
write_string(f,'<description>');
|
||||
if (old_class!=None):
|
||||
old_method_descr=find_method_descr(old_class,m.attrib["name"])
|
||||
if (old_method_descr):
|
||||
write_string(f,escape(escape(old_method_descr.strip())))
|
||||
signals = c.find("signals")
|
||||
if(signals != None and len(list(signals)) > 0):
|
||||
|
||||
write_string(f,'</description>');
|
||||
dec_tab()
|
||||
write_string(f,"</method>")
|
||||
dec_tab()
|
||||
write_string(f,"</methods>")
|
||||
write_string(f, "<signals>")
|
||||
inc_tab()
|
||||
|
||||
signals = c.find("signals")
|
||||
if(signals!=None and len(list(signals))>0):
|
||||
for m in list(signals):
|
||||
|
||||
write_string(f,"<signals>")
|
||||
inc_tab()
|
||||
write_string(f, '<signal name="' + escape(m.attrib["name"]) + '">')
|
||||
inc_tab()
|
||||
|
||||
for m in list(signals):
|
||||
for a in list(m):
|
||||
if (a.tag == "argument"):
|
||||
|
||||
write_string(f,'<signal name="'+escape(m.attrib["name"])+'">')
|
||||
inc_tab()
|
||||
write_string(f, '<argument index="' + a.attrib["index"] + '" name="' + escape(a.attrib["name"]) + '" type="' + a.attrib["type"] + '">')
|
||||
write_string(f, '</argument>')
|
||||
|
||||
for a in list(m):
|
||||
if (a.tag=="argument"):
|
||||
write_string(f, '<description>')
|
||||
if (old_class != None):
|
||||
old_signal_descr = find_signal_descr(old_class, m.attrib["name"])
|
||||
if (old_signal_descr):
|
||||
write_string(f, escape(old_signal_descr.strip()))
|
||||
write_string(f, '</description>')
|
||||
dec_tab()
|
||||
write_string(f, "</signal>")
|
||||
dec_tab()
|
||||
write_string(f, "</signals>")
|
||||
|
||||
write_string(f,'<argument index="'+a.attrib["index"]+'" name="'+escape(a.attrib["name"])+'" type="'+a.attrib["type"]+'">');
|
||||
write_string(f,'</argument>');
|
||||
constants = c.find("constants")
|
||||
if(constants != None and len(list(constants)) > 0):
|
||||
|
||||
write_string(f,'<description>');
|
||||
if (old_class!=None):
|
||||
old_signal_descr=find_signal_descr(old_class,m.attrib["name"])
|
||||
if (old_signal_descr):
|
||||
write_string(f,escape(old_signal_descr.strip()))
|
||||
write_string(f,'</description>');
|
||||
dec_tab()
|
||||
write_string(f,"</signal>")
|
||||
dec_tab()
|
||||
write_string(f,"</signals>")
|
||||
write_string(f, "<constants>")
|
||||
inc_tab()
|
||||
|
||||
constants = c.find("constants")
|
||||
if(constants!=None and len(list(constants))>0):
|
||||
for m in list(constants):
|
||||
|
||||
write_string(f,"<constants>")
|
||||
inc_tab()
|
||||
write_string(f, '<constant name="' + escape(m.attrib["name"]) + '" value="' + m.attrib["value"] + '">')
|
||||
old_constant_descr = find_constant_descr(old_class, m.attrib["name"])
|
||||
if (old_constant_descr):
|
||||
write_string(f, escape(old_constant_descr.strip()))
|
||||
write_string(f, "</constant>")
|
||||
|
||||
for m in list(constants):
|
||||
dec_tab()
|
||||
write_string(f, "</constants>")
|
||||
|
||||
write_string(f,'<constant name="'+escape(m.attrib["name"])+'" value="'+m.attrib["value"]+'">')
|
||||
old_constant_descr=find_constant_descr(old_class,m.attrib["name"])
|
||||
if (old_constant_descr):
|
||||
write_string(f,escape(old_constant_descr.strip()))
|
||||
write_string(f,"</constant>")
|
||||
|
||||
dec_tab()
|
||||
write_string(f,"</constants>")
|
||||
|
||||
dec_tab()
|
||||
write_string(f,"</class>")
|
||||
dec_tab()
|
||||
write_string(f, "</class>")
|
||||
|
||||
for c in list(old_doc):
|
||||
old_classes[c.attrib["name"]]=c
|
||||
old_classes[c.attrib["name"]] = c
|
||||
|
||||
for c in list(new_doc):
|
||||
write_class(c)
|
||||
write_string(f,'</doc>\n')
|
||||
|
||||
|
||||
write_class(c)
|
||||
write_string(f, '</doc>\n')
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/python3
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import sys
|
||||
import re
|
||||
@@ -11,233 +11,235 @@ import xml.etree.ElementTree as ET
|
||||
################################################################################
|
||||
|
||||
flags = {
|
||||
'c': platform.platform() != 'Windows', # Disable by default on windows, since we use ANSI escape codes
|
||||
'b': False,
|
||||
'g': False,
|
||||
's': False,
|
||||
'u': False,
|
||||
'h': False,
|
||||
'p': False,
|
||||
'o': True,
|
||||
'i': False,
|
||||
'c': platform.platform() != 'Windows', # Disable by default on windows, since we use ANSI escape codes
|
||||
'b': False,
|
||||
'g': False,
|
||||
's': False,
|
||||
'u': False,
|
||||
'h': False,
|
||||
'p': False,
|
||||
'o': True,
|
||||
'i': False,
|
||||
}
|
||||
flag_descriptions = {
|
||||
'c': 'Toggle colors when outputting.',
|
||||
'b': 'Toggle showing only not fully described classes.',
|
||||
'g': 'Toggle showing only completed classes.',
|
||||
's': 'Toggle showing comments about the status.',
|
||||
'u': 'Toggle URLs to docs.',
|
||||
'h': 'Show help and exit.',
|
||||
'p': 'Toggle showing percentage as well as counts.',
|
||||
'o': 'Toggle overall column.',
|
||||
'i': 'Toggle collapse of class items columns.',
|
||||
'c': 'Toggle colors when outputting.',
|
||||
'b': 'Toggle showing only not fully described classes.',
|
||||
'g': 'Toggle showing only completed classes.',
|
||||
's': 'Toggle showing comments about the status.',
|
||||
'u': 'Toggle URLs to docs.',
|
||||
'h': 'Show help and exit.',
|
||||
'p': 'Toggle showing percentage as well as counts.',
|
||||
'o': 'Toggle overall column.',
|
||||
'i': 'Toggle collapse of class items columns.',
|
||||
}
|
||||
long_flags = {
|
||||
'colors': 'c',
|
||||
'use-colors': 'c',
|
||||
'colors': 'c',
|
||||
'use-colors': 'c',
|
||||
|
||||
'bad': 'b',
|
||||
'only-bad': 'b',
|
||||
'bad': 'b',
|
||||
'only-bad': 'b',
|
||||
|
||||
'good': 'g',
|
||||
'only-good': 'g',
|
||||
'good': 'g',
|
||||
'only-good': 'g',
|
||||
|
||||
'comments': 's',
|
||||
'status': 's',
|
||||
'comments': 's',
|
||||
'status': 's',
|
||||
|
||||
'urls': 'u',
|
||||
'gen-url': 'u',
|
||||
'urls': 'u',
|
||||
'gen-url': 'u',
|
||||
|
||||
'help': 'h',
|
||||
'help': 'h',
|
||||
|
||||
'percent': 'p',
|
||||
'use-percentages': 'p',
|
||||
'percent': 'p',
|
||||
'use-percentages': 'p',
|
||||
|
||||
'overall': 'o',
|
||||
'use-overall': 'o',
|
||||
'overall': 'o',
|
||||
'use-overall': 'o',
|
||||
|
||||
'items': 'i',
|
||||
'collapse': 'i',
|
||||
'items': 'i',
|
||||
'collapse': 'i',
|
||||
}
|
||||
table_columns = ['name', 'brief_description', 'description', 'methods', 'constants', 'members', 'signals']
|
||||
table_column_names = ['Name', 'Brief Desc.', 'Desc.', 'Methods', 'Constants', 'Members', 'Signals']
|
||||
colors = {
|
||||
'name': [36], # cyan
|
||||
'part_big_problem': [4, 31], # underline, red
|
||||
'part_problem': [31], # red
|
||||
'part_mostly_good': [33], # yellow
|
||||
'part_good': [32], # green
|
||||
'url': [4, 34], # underline, blue
|
||||
'section': [1, 4], # bold, underline
|
||||
'state_off': [36], # cyan
|
||||
'state_on': [1, 35], # bold, magenta/plum
|
||||
'name': [36], # cyan
|
||||
'part_big_problem': [4, 31], # underline, red
|
||||
'part_problem': [31], # red
|
||||
'part_mostly_good': [33], # yellow
|
||||
'part_good': [32], # green
|
||||
'url': [4, 34], # underline, blue
|
||||
'section': [1, 4], # bold, underline
|
||||
'state_off': [36], # cyan
|
||||
'state_on': [1, 35], # bold, magenta/plum
|
||||
}
|
||||
overall_progress_description_weigth = 10
|
||||
|
||||
|
||||
|
||||
################################################################################
|
||||
# Utils #
|
||||
################################################################################
|
||||
|
||||
def validate_tag(elem, tag):
|
||||
if elem.tag != tag:
|
||||
print('Tag mismatch, expected "' + tag + '", got ' + elem.tag)
|
||||
sys.exit(255)
|
||||
if elem.tag != tag:
|
||||
print('Tag mismatch, expected "' + tag + '", got ' + elem.tag)
|
||||
sys.exit(255)
|
||||
|
||||
|
||||
def color(color, string):
|
||||
if flags['c']:
|
||||
color_format = ''
|
||||
for code in colors[color]:
|
||||
color_format += '\033[' + str(code) + 'm'
|
||||
return color_format + string + '\033[0m'
|
||||
else:
|
||||
return string
|
||||
if flags['c']:
|
||||
color_format = ''
|
||||
for code in colors[color]:
|
||||
color_format += '\033[' + str(code) + 'm'
|
||||
return color_format + string + '\033[0m'
|
||||
else:
|
||||
return string
|
||||
|
||||
ansi_escape = re.compile(r'\x1b[^m]*m')
|
||||
def nonescape_len(s):
|
||||
return len(ansi_escape.sub('', s))
|
||||
|
||||
|
||||
def nonescape_len(s):
|
||||
return len(ansi_escape.sub('', s))
|
||||
|
||||
|
||||
################################################################################
|
||||
# Classes #
|
||||
################################################################################
|
||||
|
||||
class ClassStatusProgress:
|
||||
def __init__(self, described = 0, total = 0):
|
||||
self.described = described
|
||||
self.total = total
|
||||
|
||||
def __add__(self, other):
|
||||
return ClassStatusProgress(self.described + other.described, self.total + other.total)
|
||||
def __init__(self, described=0, total=0):
|
||||
self.described = described
|
||||
self.total = total
|
||||
|
||||
def increment(self, described):
|
||||
if described:
|
||||
self.described += 1
|
||||
self.total += 1
|
||||
def __add__(self, other):
|
||||
return ClassStatusProgress(self.described + other.described, self.total + other.total)
|
||||
|
||||
def is_ok(self):
|
||||
return self.described >= self.total
|
||||
def increment(self, described):
|
||||
if described:
|
||||
self.described += 1
|
||||
self.total += 1
|
||||
|
||||
def to_configured_colored_string(self):
|
||||
if flags['p']:
|
||||
return self.to_colored_string('{percent}% ({has}/{total})', '{pad_percent}{pad_described}{s}{pad_total}')
|
||||
else:
|
||||
return self.to_colored_string()
|
||||
def is_ok(self):
|
||||
return self.described >= self.total
|
||||
|
||||
def to_colored_string(self, format='{has}/{total}', pad_format='{pad_described}{s}{pad_total}'):
|
||||
ratio = self.described/self.total if self.total != 0 else 1
|
||||
percent = round(100*ratio)
|
||||
s = format.format(has = str(self.described), total = str(self.total), percent = str(percent))
|
||||
if self.described >= self.total:
|
||||
s = color('part_good', s)
|
||||
elif self.described >= self.total/4*3:
|
||||
s = color('part_mostly_good', s)
|
||||
elif self.described > 0:
|
||||
s = color('part_problem', s)
|
||||
else:
|
||||
s = color('part_big_problem', s)
|
||||
pad_size = max(len(str(self.described)), len(str(self.total)))
|
||||
pad_described = ''.ljust(pad_size - len(str(self.described)))
|
||||
pad_percent = ''.ljust(3 - len(str(percent)))
|
||||
pad_total = ''.ljust(pad_size - len(str(self.total)))
|
||||
return pad_format.format(pad_described = pad_described, pad_total = pad_total, pad_percent = pad_percent, s = s)
|
||||
def to_configured_colored_string(self):
|
||||
if flags['p']:
|
||||
return self.to_colored_string('{percent}% ({has}/{total})', '{pad_percent}{pad_described}{s}{pad_total}')
|
||||
else:
|
||||
return self.to_colored_string()
|
||||
|
||||
def to_colored_string(self, format='{has}/{total}', pad_format='{pad_described}{s}{pad_total}'):
|
||||
ratio = self.described / self.total if self.total != 0 else 1
|
||||
percent = round(100 * ratio)
|
||||
s = format.format(has=str(self.described), total=str(self.total), percent=str(percent))
|
||||
if self.described >= self.total:
|
||||
s = color('part_good', s)
|
||||
elif self.described >= self.total / 4 * 3:
|
||||
s = color('part_mostly_good', s)
|
||||
elif self.described > 0:
|
||||
s = color('part_problem', s)
|
||||
else:
|
||||
s = color('part_big_problem', s)
|
||||
pad_size = max(len(str(self.described)), len(str(self.total)))
|
||||
pad_described = ''.ljust(pad_size - len(str(self.described)))
|
||||
pad_percent = ''.ljust(3 - len(str(percent)))
|
||||
pad_total = ''.ljust(pad_size - len(str(self.total)))
|
||||
return pad_format.format(pad_described=pad_described, pad_total=pad_total, pad_percent=pad_percent, s=s)
|
||||
|
||||
|
||||
class ClassStatus:
|
||||
def __init__(self, name=''):
|
||||
self.name = name
|
||||
self.has_brief_description = True
|
||||
self.has_description = True
|
||||
self.progresses = {
|
||||
'methods': ClassStatusProgress(),
|
||||
'constants': ClassStatusProgress(),
|
||||
'members': ClassStatusProgress(),
|
||||
'signals': ClassStatusProgress()
|
||||
}
|
||||
|
||||
def __add__(self, other):
|
||||
new_status = ClassStatus()
|
||||
new_status.name = self.name
|
||||
new_status.has_brief_description = self.has_brief_description and other.has_brief_description
|
||||
new_status.has_description = self.has_description and other.has_description
|
||||
for k in self.progresses:
|
||||
new_status.progresses[k] = self.progresses[k] + other.progresses[k]
|
||||
return new_status
|
||||
def __init__(self, name=''):
|
||||
self.name = name
|
||||
self.has_brief_description = True
|
||||
self.has_description = True
|
||||
self.progresses = {
|
||||
'methods': ClassStatusProgress(),
|
||||
'constants': ClassStatusProgress(),
|
||||
'members': ClassStatusProgress(),
|
||||
'signals': ClassStatusProgress()
|
||||
}
|
||||
|
||||
def is_ok(self):
|
||||
ok = True
|
||||
ok = ok and self.has_brief_description
|
||||
ok = ok and self.has_description
|
||||
for k in self.progresses:
|
||||
ok = ok and self.progresses[k].is_ok()
|
||||
return ok
|
||||
def __add__(self, other):
|
||||
new_status = ClassStatus()
|
||||
new_status.name = self.name
|
||||
new_status.has_brief_description = self.has_brief_description and other.has_brief_description
|
||||
new_status.has_description = self.has_description and other.has_description
|
||||
for k in self.progresses:
|
||||
new_status.progresses[k] = self.progresses[k] + other.progresses[k]
|
||||
return new_status
|
||||
|
||||
def make_output(self):
|
||||
output = {}
|
||||
output['name'] = color('name', self.name)
|
||||
def is_ok(self):
|
||||
ok = True
|
||||
ok = ok and self.has_brief_description
|
||||
ok = ok and self.has_description
|
||||
for k in self.progresses:
|
||||
ok = ok and self.progresses[k].is_ok()
|
||||
return ok
|
||||
|
||||
ok_string = color('part_good', 'OK')
|
||||
missing_string = color('part_big_problem', 'MISSING')
|
||||
def make_output(self):
|
||||
output = {}
|
||||
output['name'] = color('name', self.name)
|
||||
|
||||
output['brief_description'] = ok_string if self.has_brief_description else missing_string
|
||||
output['description'] = ok_string if self.has_description else missing_string
|
||||
ok_string = color('part_good', 'OK')
|
||||
missing_string = color('part_big_problem', 'MISSING')
|
||||
|
||||
description_progress = ClassStatusProgress(
|
||||
(self.has_brief_description + self.has_description) * overall_progress_description_weigth,
|
||||
2 * overall_progress_description_weigth
|
||||
)
|
||||
items_progress = ClassStatusProgress()
|
||||
output['brief_description'] = ok_string if self.has_brief_description else missing_string
|
||||
output['description'] = ok_string if self.has_description else missing_string
|
||||
|
||||
for k in ['methods', 'constants', 'members', 'signals']:
|
||||
items_progress += self.progresses[k]
|
||||
output[k] = self.progresses[k].to_configured_colored_string()
|
||||
description_progress = ClassStatusProgress(
|
||||
(self.has_brief_description + self.has_description) * overall_progress_description_weigth,
|
||||
2 * overall_progress_description_weigth
|
||||
)
|
||||
items_progress = ClassStatusProgress()
|
||||
|
||||
output['items'] = items_progress.to_configured_colored_string()
|
||||
for k in ['methods', 'constants', 'members', 'signals']:
|
||||
items_progress += self.progresses[k]
|
||||
output[k] = self.progresses[k].to_configured_colored_string()
|
||||
|
||||
output['overall'] = (description_progress + items_progress).to_colored_string('{percent}%', '{pad_percent}{s}')
|
||||
output['items'] = items_progress.to_configured_colored_string()
|
||||
|
||||
if self.name.startswith('Total'):
|
||||
output['url'] = color('url', 'http://docs.godotengine.org/en/latest/classes/_classes.html')
|
||||
if flags['s']:
|
||||
output['comment'] = color('part_good', 'ALL OK')
|
||||
else:
|
||||
output['url'] = color('url', 'http://docs.godotengine.org/en/latest/classes/class_{name}.html'.format(name=self.name.lower()))
|
||||
output['overall'] = (description_progress + items_progress).to_colored_string('{percent}%', '{pad_percent}{s}')
|
||||
|
||||
if flags['s'] and not flags['g'] and self.is_ok():
|
||||
output['comment'] = color('part_good', 'ALL OK')
|
||||
if self.name.startswith('Total'):
|
||||
output['url'] = color('url', 'http://docs.godotengine.org/en/latest/classes/_classes.html')
|
||||
if flags['s']:
|
||||
output['comment'] = color('part_good', 'ALL OK')
|
||||
else:
|
||||
output['url'] = color('url', 'http://docs.godotengine.org/en/latest/classes/class_{name}.html'.format(name=self.name.lower()))
|
||||
|
||||
return output
|
||||
if flags['s'] and not flags['g'] and self.is_ok():
|
||||
output['comment'] = color('part_good', 'ALL OK')
|
||||
|
||||
def generate_for_class(c):
|
||||
status = ClassStatus()
|
||||
status.name = c.attrib['name']
|
||||
for tag in list(c):
|
||||
return output
|
||||
|
||||
if tag.tag == 'brief_description':
|
||||
status.has_brief_description = len(tag.text.strip()) > 0
|
||||
def generate_for_class(c):
|
||||
status = ClassStatus()
|
||||
status.name = c.attrib['name']
|
||||
for tag in list(c):
|
||||
|
||||
elif tag.tag == 'description':
|
||||
status.has_description = len(tag.text.strip()) > 0
|
||||
if tag.tag == 'brief_description':
|
||||
status.has_brief_description = len(tag.text.strip()) > 0
|
||||
|
||||
elif tag.tag in ['methods', 'signals']:
|
||||
for sub_tag in list(tag):
|
||||
descr = sub_tag.find('description')
|
||||
status.progresses[tag.tag].increment(len(descr.text.strip()) > 0)
|
||||
elif tag.tag == 'description':
|
||||
status.has_description = len(tag.text.strip()) > 0
|
||||
|
||||
elif tag.tag in ['constants', 'members']:
|
||||
for sub_tag in list(tag):
|
||||
status.progresses[tag.tag].increment(len(sub_tag.text.strip()) > 0)
|
||||
elif tag.tag in ['methods', 'signals']:
|
||||
for sub_tag in list(tag):
|
||||
descr = sub_tag.find('description')
|
||||
status.progresses[tag.tag].increment(len(descr.text.strip()) > 0)
|
||||
|
||||
elif tag.tag in ['theme_items']:
|
||||
pass #Ignore those tags, since they seem to lack description at all
|
||||
elif tag.tag in ['constants', 'members']:
|
||||
for sub_tag in list(tag):
|
||||
status.progresses[tag.tag].increment(len(sub_tag.text.strip()) > 0)
|
||||
|
||||
else:
|
||||
print(tag.tag, tag.attrib)
|
||||
elif tag.tag in ['theme_items']:
|
||||
pass # Ignore those tags, since they seem to lack description at all
|
||||
|
||||
return status
|
||||
else:
|
||||
print(tag.tag, tag.attrib)
|
||||
|
||||
return status
|
||||
|
||||
|
||||
################################################################################
|
||||
@@ -248,31 +250,31 @@ input_file_list = []
|
||||
input_class_list = []
|
||||
|
||||
for arg in sys.argv[1:]:
|
||||
if arg.startswith('--'):
|
||||
flags[long_flags[arg[2:]]] = not flags[long_flags[arg[2:]]]
|
||||
elif arg.startswith('-'):
|
||||
for f in arg[1:]:
|
||||
flags[f] = not flags[f]
|
||||
elif arg.endswith('.xml'):
|
||||
input_file_list.append(arg)
|
||||
else:
|
||||
input_class_list.append(arg)
|
||||
if arg.startswith('--'):
|
||||
flags[long_flags[arg[2:]]] = not flags[long_flags[arg[2:]]]
|
||||
elif arg.startswith('-'):
|
||||
for f in arg[1:]:
|
||||
flags[f] = not flags[f]
|
||||
elif arg.endswith('.xml'):
|
||||
input_file_list.append(arg)
|
||||
else:
|
||||
input_class_list.append(arg)
|
||||
|
||||
if flags['i']:
|
||||
for r in ['methods', 'constants', 'members', 'signals']:
|
||||
index = table_columns.index(r)
|
||||
del table_column_names[index]
|
||||
del table_columns[index]
|
||||
table_column_names.append('Items')
|
||||
table_columns.append('items')
|
||||
for r in ['methods', 'constants', 'members', 'signals']:
|
||||
index = table_columns.index(r)
|
||||
del table_column_names[index]
|
||||
del table_columns[index]
|
||||
table_column_names.append('Items')
|
||||
table_columns.append('items')
|
||||
|
||||
if flags['o'] == (not flags['i']):
|
||||
table_column_names.append('Overall')
|
||||
table_columns.append('overall')
|
||||
table_column_names.append('Overall')
|
||||
table_columns.append('overall')
|
||||
|
||||
if flags['u']:
|
||||
table_column_names.append('Docs URL')
|
||||
table_columns.append('url')
|
||||
table_column_names.append('Docs URL')
|
||||
table_columns.append('url')
|
||||
|
||||
|
||||
################################################################################
|
||||
@@ -280,29 +282,28 @@ if flags['u']:
|
||||
################################################################################
|
||||
|
||||
if len(input_file_list) < 1 or flags['h']:
|
||||
if not flags['h']:
|
||||
print(color('section', 'Invalid usage') + ': At least one classes.xml file is required')
|
||||
print(color('section', 'Usage') + ': doc_status.py [flags] <classes.xml> [class names]')
|
||||
print('\t< and > signify required parameters, while [ and ] signify optional parameters.')
|
||||
print('\tNote that you can give more than one classes file, in which case they will be merged on-the-fly.')
|
||||
print(color('section', 'Available flags') + ':')
|
||||
possible_synonym_list = list(long_flags)
|
||||
possible_synonym_list.sort()
|
||||
flag_list = list(flags)
|
||||
flag_list.sort()
|
||||
for flag in flag_list:
|
||||
synonyms = [color('name', '-' + flag)]
|
||||
for synonym in possible_synonym_list:
|
||||
if long_flags[synonym] == flag:
|
||||
synonyms.append(color('name', '--' + synonym))
|
||||
|
||||
print(('{synonyms} (Currently '+color('state_'+('on' if flags[flag] else 'off'), '{value}')+')\n\t{description}').format(
|
||||
synonyms = ', '.join(synonyms),
|
||||
value = ('on' if flags[flag] else 'off'),
|
||||
description = flag_descriptions[flag]
|
||||
))
|
||||
sys.exit(0)
|
||||
if not flags['h']:
|
||||
print(color('section', 'Invalid usage') + ': At least one classes.xml file is required')
|
||||
print(color('section', 'Usage') + ': doc_status.py [flags] <classes.xml> [class names]')
|
||||
print('\t< and > signify required parameters, while [ and ] signify optional parameters.')
|
||||
print('\tNote that you can give more than one classes file, in which case they will be merged on-the-fly.')
|
||||
print(color('section', 'Available flags') + ':')
|
||||
possible_synonym_list = list(long_flags)
|
||||
possible_synonym_list.sort()
|
||||
flag_list = list(flags)
|
||||
flag_list.sort()
|
||||
for flag in flag_list:
|
||||
synonyms = [color('name', '-' + flag)]
|
||||
for synonym in possible_synonym_list:
|
||||
if long_flags[synonym] == flag:
|
||||
synonyms.append(color('name', '--' + synonym))
|
||||
|
||||
print(('{synonyms} (Currently ' + color('state_' + ('on' if flags[flag] else 'off'), '{value}') + ')\n\t{description}').format(
|
||||
synonyms=', '.join(synonyms),
|
||||
value=('on' if flags[flag] else 'off'),
|
||||
description=flag_descriptions[flag]
|
||||
))
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
################################################################################
|
||||
@@ -313,26 +314,25 @@ class_names = []
|
||||
classes = {}
|
||||
|
||||
for file in input_file_list:
|
||||
tree = ET.parse(file)
|
||||
doc = tree.getroot()
|
||||
tree = ET.parse(file)
|
||||
doc = tree.getroot()
|
||||
|
||||
if 'version' not in doc.attrib:
|
||||
print('Version missing from "doc"')
|
||||
sys.exit(255)
|
||||
if 'version' not in doc.attrib:
|
||||
print('Version missing from "doc"')
|
||||
sys.exit(255)
|
||||
|
||||
version = doc.attrib['version']
|
||||
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
|
||||
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()
|
||||
|
||||
if len(input_class_list) < 1:
|
||||
input_class_list = class_names
|
||||
|
||||
input_class_list = class_names
|
||||
|
||||
|
||||
################################################################################
|
||||
@@ -346,34 +346,32 @@ table_column_chars = '|'
|
||||
total_status = ClassStatus('Total')
|
||||
|
||||
for cn in input_class_list:
|
||||
if not cn in classes:
|
||||
print('Cannot find class ' + cn + '!')
|
||||
sys.exit(255)
|
||||
if not cn in classes:
|
||||
print('Cannot find class ' + cn + '!')
|
||||
sys.exit(255)
|
||||
|
||||
c = classes[cn]
|
||||
validate_tag(c, 'class')
|
||||
status = ClassStatus.generate_for_class(c)
|
||||
c = classes[cn]
|
||||
validate_tag(c, 'class')
|
||||
status = ClassStatus.generate_for_class(c)
|
||||
|
||||
if flags['b'] and status.is_ok():
|
||||
continue
|
||||
if flags['g'] and not status.is_ok():
|
||||
continue
|
||||
if flags['b'] and status.is_ok():
|
||||
continue
|
||||
if flags['g'] and not status.is_ok():
|
||||
continue
|
||||
|
||||
total_status = total_status + status
|
||||
out = status.make_output()
|
||||
row = []
|
||||
for column in table_columns:
|
||||
if column in out:
|
||||
row.append(out[column])
|
||||
else:
|
||||
row.append('')
|
||||
|
||||
if 'comment' in out and out['comment'] != '':
|
||||
row.append(out['comment'])
|
||||
|
||||
table.append(row)
|
||||
total_status = total_status + status
|
||||
out = status.make_output()
|
||||
row = []
|
||||
for column in table_columns:
|
||||
if column in out:
|
||||
row.append(out[column])
|
||||
else:
|
||||
row.append('')
|
||||
|
||||
if 'comment' in out and out['comment'] != '':
|
||||
row.append(out['comment'])
|
||||
|
||||
table.append(row)
|
||||
|
||||
|
||||
################################################################################
|
||||
@@ -381,50 +379,49 @@ for cn in input_class_list:
|
||||
################################################################################
|
||||
|
||||
if len(table) == 1:
|
||||
print(color('part_big_problem', 'No classes suitable for printing!'))
|
||||
sys.exit(0)
|
||||
print(color('part_big_problem', 'No classes suitable for printing!'))
|
||||
sys.exit(0)
|
||||
|
||||
if len(table) > 2:
|
||||
total_status.name = 'Total = {0}'.format(len(table) - 1)
|
||||
out = total_status.make_output()
|
||||
row = []
|
||||
for column in table_columns:
|
||||
if column in out:
|
||||
row.append(out[column])
|
||||
else:
|
||||
row.append('')
|
||||
table.append(row)
|
||||
total_status.name = 'Total = {0}'.format(len(table) - 1)
|
||||
out = total_status.make_output()
|
||||
row = []
|
||||
for column in table_columns:
|
||||
if column in out:
|
||||
row.append(out[column])
|
||||
else:
|
||||
row.append('')
|
||||
table.append(row)
|
||||
|
||||
table_column_sizes = []
|
||||
for row in table:
|
||||
for cell_i, cell in enumerate(row):
|
||||
if cell_i >= len(table_column_sizes):
|
||||
table_column_sizes.append(0)
|
||||
for cell_i, cell in enumerate(row):
|
||||
if cell_i >= len(table_column_sizes):
|
||||
table_column_sizes.append(0)
|
||||
|
||||
table_column_sizes[cell_i] = max(nonescape_len(cell), table_column_sizes[cell_i])
|
||||
table_column_sizes[cell_i] = max(nonescape_len(cell), table_column_sizes[cell_i])
|
||||
|
||||
divider_string = table_row_chars[0]
|
||||
for cell_i in range(len(table[0])):
|
||||
divider_string += table_row_chars[1] * (table_column_sizes[cell_i] + 2) + table_row_chars[0]
|
||||
divider_string += table_row_chars[1] * (table_column_sizes[cell_i] + 2) + table_row_chars[0]
|
||||
print(divider_string)
|
||||
|
||||
for row_i, row in enumerate(table):
|
||||
row_string = table_column_chars
|
||||
for cell_i, cell in enumerate(row):
|
||||
padding_needed = table_column_sizes[cell_i] - nonescape_len(cell) + 2
|
||||
if cell_i == 0:
|
||||
row_string += table_row_chars[2] + cell + table_row_chars[2]*(padding_needed-1)
|
||||
else:
|
||||
row_string += table_row_chars[2]*math.floor(padding_needed/2) + cell + table_row_chars[2]*math.ceil((padding_needed/2))
|
||||
row_string += table_column_chars
|
||||
row_string = table_column_chars
|
||||
for cell_i, cell in enumerate(row):
|
||||
padding_needed = table_column_sizes[cell_i] - nonescape_len(cell) + 2
|
||||
if cell_i == 0:
|
||||
row_string += table_row_chars[2] + cell + table_row_chars[2] * (padding_needed - 1)
|
||||
else:
|
||||
row_string += table_row_chars[2] * math.floor(padding_needed / 2) + cell + table_row_chars[2] * math.ceil((padding_needed / 2))
|
||||
row_string += table_column_chars
|
||||
|
||||
print(row_string)
|
||||
print(row_string)
|
||||
|
||||
if row_i == 0 or row_i == len(table) - 2:
|
||||
print(divider_string)
|
||||
if row_i == 0 or row_i == len(table) - 2:
|
||||
print(divider_string)
|
||||
|
||||
print(divider_string)
|
||||
|
||||
if total_status.is_ok() and not flags['g']:
|
||||
print('All listed classes are ' + color('part_good', 'OK') + '!')
|
||||
|
||||
print('All listed classes are ' + color('part_good', 'OK') + '!')
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/python3
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
#
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/python
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import sys
|
||||
@@ -8,308 +8,295 @@ input_list = []
|
||||
|
||||
|
||||
for arg in sys.argv[1:]:
|
||||
input_list.append(arg)
|
||||
input_list.append(arg)
|
||||
|
||||
if len(input_list) < 1:
|
||||
print("usage: makedoku.py <classes.xml>")
|
||||
sys.exit(0)
|
||||
print("usage: makedoku.py <classes.xml>")
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
def validate_tag(elem,tag):
|
||||
if (elem.tag != tag):
|
||||
print("Tag mismatch, expected '"+tag+"', got "+elem.tag);
|
||||
sys.exit(255)
|
||||
def validate_tag(elem, tag):
|
||||
if (elem.tag != tag):
|
||||
print("Tag mismatch, expected '" + tag + "', got " + elem.tag)
|
||||
sys.exit(255)
|
||||
|
||||
|
||||
class_names=[]
|
||||
classes={}
|
||||
class_names = []
|
||||
classes = {}
|
||||
|
||||
|
||||
def make_class_list(class_list,columns):
|
||||
def make_class_list(class_list, columns):
|
||||
|
||||
f=open("class_list.txt","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=[]
|
||||
f = open("class_list.txt", "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+=[[]]
|
||||
for n in range(0, columns):
|
||||
fit_columns += [[]]
|
||||
|
||||
indexers=[]
|
||||
last_initial=""
|
||||
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]
|
||||
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
|
||||
|
||||
row_max=0
|
||||
for n in range(0, columns):
|
||||
if (len(fit_columns[n]) > row_max):
|
||||
row_max = len(fit_columns[n])
|
||||
|
||||
for n in range(0,columns):
|
||||
if (len(fit_columns[n])>row_max):
|
||||
row_max=len(fit_columns[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 += " |"
|
||||
|
||||
for r in range(0,row_max):
|
||||
s="|"
|
||||
for c in range(0,columns):
|
||||
if (r>=len(fit_columns[c])):
|
||||
continue
|
||||
s += "[[" + classname.lower() + "|" + classname + "]]|"
|
||||
|
||||
classname = fit_columns[c][r]
|
||||
initial=classname[0]
|
||||
if (classname in indexers):
|
||||
s+="**"+initial+"**|"
|
||||
else:
|
||||
s+=" |"
|
||||
|
||||
s+="[["+classname.lower()+"|"+classname+"]]|"
|
||||
|
||||
s+="\n"
|
||||
f.write(s)
|
||||
s += "\n"
|
||||
f.write(s)
|
||||
|
||||
|
||||
def dokuize_text(txt):
|
||||
|
||||
return txt
|
||||
return txt
|
||||
|
||||
|
||||
def dokuize_text(text):
|
||||
pos=0
|
||||
while(True):
|
||||
pos = text.find("[",pos)
|
||||
if (pos==-1):
|
||||
break
|
||||
pos = 0
|
||||
while(True):
|
||||
pos = text.find("[", pos)
|
||||
if (pos == -1):
|
||||
break
|
||||
|
||||
endq_pos=text.find("]",pos+1)
|
||||
if (endq_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]
|
||||
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="[["+tag_text.lower()+"|"+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 (tag_text in class_names):
|
||||
tag_text = "[[" + tag_text.lower() + "|" + 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.lower()+"#"+method_param+"|"+class_param+'.'+method_param+"]]"
|
||||
else:
|
||||
tag_text="[[#"+param+"|"+param+"]]"
|
||||
elif (cmd.find("image=")==0):
|
||||
tag_text="{{"+cmd[6:]+"}}"
|
||||
elif (cmd.find("url=")==0):
|
||||
tag_text="[["+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+"]"
|
||||
if (param.find(".") != -1):
|
||||
class_param, method_param = param.split(".")
|
||||
tag_text = "[[" + class_param.lower() + "#" + method_param + "|" + class_param + '.' + method_param + "]]"
|
||||
else:
|
||||
tag_text = "[[#" + param + "|" + param + "]]"
|
||||
elif (cmd.find("image=") == 0):
|
||||
tag_text = "{{" + cmd[6:] + "}}"
|
||||
elif (cmd.find("url=") == 0):
|
||||
tag_text = "[[" + 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)
|
||||
|
||||
text=pre_text+tag_text+post_text
|
||||
pos=len(pre_text)+len(tag_text)
|
||||
|
||||
#tnode = ET.SubElement(parent,"div")
|
||||
#tnode.text=text
|
||||
return 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.lower()+"|"+t+"]]"
|
||||
return t
|
||||
global class_names
|
||||
if (t in class_names):
|
||||
return "[[" + t.lower() + "|" + t + "]]"
|
||||
return t
|
||||
|
||||
|
||||
def make_method(f,name,m,declare,event=False):
|
||||
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
|
||||
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
|
||||
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):
|
||||
|
||||
if (not event):
|
||||
if (-1 in mdata["argidx"]):
|
||||
s+=make_type(mdata[-1].attrib["type"])
|
||||
else:
|
||||
s+="void"
|
||||
s+=" "
|
||||
# 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"] + "**"
|
||||
else:
|
||||
s += "[[#" + m.attrib["name"] + "|" + m.attrib["name"] + "]]"
|
||||
|
||||
if (declare):
|
||||
s += "**(**"
|
||||
argfound = False
|
||||
for a in mdata["argidx"]:
|
||||
arg = mdata[a]
|
||||
if (a < 0):
|
||||
continue
|
||||
if (a > 0):
|
||||
s += ", "
|
||||
else:
|
||||
s += " "
|
||||
|
||||
#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"]+"**"
|
||||
else:
|
||||
s+="[[#"+m.attrib["name"]+"|"+m.attrib["name"]+"]]"
|
||||
s += make_type(arg.attrib["type"])
|
||||
if ("name" in arg.attrib):
|
||||
s += " " + arg.attrib["name"]
|
||||
else:
|
||||
s += " arg" + str(a)
|
||||
|
||||
s+="**(**"
|
||||
argfound=False
|
||||
for a in mdata["argidx"]:
|
||||
arg=mdata[a]
|
||||
if (a<0):
|
||||
continue
|
||||
if (a>0):
|
||||
s+=", "
|
||||
else:
|
||||
s+=" "
|
||||
if ("default" in arg.attrib):
|
||||
s += "=" + arg.attrib["default"]
|
||||
|
||||
s+=make_type(arg.attrib["type"])
|
||||
if ("name" in arg.attrib):
|
||||
s+=" "+arg.attrib["name"]
|
||||
else:
|
||||
s+=" arg"+str(a)
|
||||
argfound = True
|
||||
|
||||
if ("default" in arg.attrib):
|
||||
s+="="+arg.attrib["default"]
|
||||
if (argfound):
|
||||
s += " "
|
||||
s += "**)**"
|
||||
|
||||
if ("qualifiers" in m.attrib):
|
||||
s += " " + m.attrib["qualifiers"]
|
||||
|
||||
argfound=True
|
||||
|
||||
if (argfound):
|
||||
s+=" "
|
||||
s+="**)**"
|
||||
|
||||
if ("qualifiers" in m.attrib):
|
||||
s+=" "+m.attrib["qualifiers"]
|
||||
|
||||
f.write(s+"\n")
|
||||
f.write(s + "\n")
|
||||
|
||||
|
||||
def make_doku_class(node):
|
||||
|
||||
name = node.attrib["name"]
|
||||
name = node.attrib["name"]
|
||||
|
||||
f=open(name.lower()+".txt","wb")
|
||||
f = open(name.lower() + ".txt", "wb")
|
||||
|
||||
f.write("====== "+name+" ======\n")
|
||||
f.write("====== " + name + " ======\n")
|
||||
|
||||
if ("inherits" in node.attrib):
|
||||
inh=node.attrib["inherits"].strip()
|
||||
f.write("**Inherits:** [["+inh.lower()+"|"+inh+"]]\\\\\n")
|
||||
if ("category" in node.attrib):
|
||||
f.write("**Category:** "+node.attrib["category"].strip()+"\\\\\n")
|
||||
if ("inherits" in node.attrib):
|
||||
inh = node.attrib["inherits"].strip()
|
||||
f.write("**Inherits:** [[" + inh.lower() + "|" + 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("===== Brief Description ======\n")
|
||||
f.write( dokuize_text(briefd.text.strip())+"\n" )
|
||||
briefd = node.find("brief_description")
|
||||
if (briefd != None):
|
||||
f.write("===== Brief Description ======\n")
|
||||
f.write(dokuize_text(briefd.text.strip()) + "\n")
|
||||
|
||||
methods = node.find("methods")
|
||||
methods = node.find("methods")
|
||||
|
||||
if(methods!=None and len(list(methods))>0):
|
||||
f.write("===== Member Functions ======\n")
|
||||
for m in list(methods):
|
||||
make_method(f,node.attrib["name"],m,False)
|
||||
if(methods != None and len(list(methods)) > 0):
|
||||
f.write("===== 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("===== Signals ======\n")
|
||||
for m in list(events):
|
||||
make_method(f,node.attrib["name"],m,True,True)
|
||||
events = node.find("signals")
|
||||
if(events != None and len(list(events)) > 0):
|
||||
f.write("===== Signals ======\n")
|
||||
for m in list(events):
|
||||
make_method(f, node.attrib["name"], m, True, True)
|
||||
|
||||
members = node.find("members")
|
||||
members = node.find("members")
|
||||
|
||||
if(members!=None and len(list(members))>0):
|
||||
f.write("===== Member Variables ======\n")
|
||||
if(members != None and len(list(members)) > 0):
|
||||
f.write("===== 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")
|
||||
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("===== 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("===== Description ======\n")
|
||||
f.write(dokuize_text(descr.text.strip()) + "\n")
|
||||
|
||||
constants = node.find("constants")
|
||||
if(constants!=None and len(list(constants))>0):
|
||||
f.write("===== 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")
|
||||
methods = node.find("methods")
|
||||
|
||||
if(methods != None and len(list(methods)) > 0):
|
||||
f.write("===== Member Function Description ======\n")
|
||||
for m in list(methods):
|
||||
|
||||
descr=node.find("description")
|
||||
if (descr!=None and descr.text.strip()!=""):
|
||||
f.write("===== Description ======\n")
|
||||
f.write(dokuize_text(descr.text.strip())+"\n")
|
||||
d = m.find("description")
|
||||
if (d == None or d.text.strip() == ""):
|
||||
continue
|
||||
f.write("== " + m.attrib["name"] + " ==\n")
|
||||
make_method(f, node.attrib["name"], m, False)
|
||||
f.write("\\\\\n")
|
||||
f.write(dokuize_text(d.text.strip()))
|
||||
f.write("\n")
|
||||
|
||||
methods = node.find("methods")
|
||||
|
||||
if(methods!=None and len(list(methods))>0):
|
||||
f.write("===== Member Function Description ======\n")
|
||||
for m in list(methods):
|
||||
|
||||
d=m.find("description")
|
||||
if (d==None or d.text.strip()==""):
|
||||
continue
|
||||
f.write("== "+m.attrib["name"]+" ==\n")
|
||||
make_method(f,node.attrib["name"],m,False)
|
||||
f.write("\\\\\n")
|
||||
f.write(dokuize_text(d.text.strip()))
|
||||
f.write("\n")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
"""
|
||||
div=ET.Element("div")
|
||||
div.attrib["class"]="class";
|
||||
|
||||
@@ -487,28 +474,26 @@ def make_doku_class(node):
|
||||
return div
|
||||
"""
|
||||
for file in input_list:
|
||||
tree = ET.parse(file)
|
||||
doc=tree.getroot()
|
||||
tree = ET.parse(file)
|
||||
doc = tree.getroot()
|
||||
|
||||
if ("version" not in doc.attrib):
|
||||
print("Version missing from 'doc'")
|
||||
sys.exit(255)
|
||||
if ("version" not in doc.attrib):
|
||||
print("Version missing from 'doc'")
|
||||
sys.exit(255)
|
||||
|
||||
version=doc.attrib["version"]
|
||||
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
|
||||
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,4)
|
||||
make_class_list(class_names, 4)
|
||||
|
||||
for cn in class_names:
|
||||
c=classes[cn]
|
||||
make_doku_class(c)
|
||||
|
||||
|
||||
c = classes[cn]
|
||||
make_doku_class(c)
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/python
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import sys
|
||||
@@ -7,17 +7,17 @@ import xml.etree.ElementTree as ET
|
||||
input_list = []
|
||||
|
||||
for arg in sys.argv[1:]:
|
||||
input_list.append(arg)
|
||||
input_list.append(arg)
|
||||
|
||||
if len(input_list) < 1:
|
||||
print 'usage: makemd.py <classes.xml>'
|
||||
sys.exit(0)
|
||||
print 'usage: makemd.py <classes.xml>'
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
def validate_tag(elem, tag):
|
||||
if elem.tag != tag:
|
||||
print "Tag mismatch, expected '" + tag + "', got " + elem.tag
|
||||
sys.exit(255)
|
||||
if elem.tag != tag:
|
||||
print "Tag mismatch, expected '" + tag + "', got " + elem.tag
|
||||
sys.exit(255)
|
||||
|
||||
|
||||
class_names = []
|
||||
@@ -26,321 +26,320 @@ 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 = []
|
||||
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 += [[]]
|
||||
for n in range(0, columns):
|
||||
fit_columns += [[]]
|
||||
|
||||
indexers = []
|
||||
last_initial = ''
|
||||
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]
|
||||
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")
|
||||
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])
|
||||
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("| ")
|
||||
for n in range(0, columns):
|
||||
f.write(" | |")
|
||||
|
||||
f.write("\n")
|
||||
f.write("| ")
|
||||
for n in range(0, columns):
|
||||
f.write(" --- | ------- |")
|
||||
f.write("\n")
|
||||
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
|
||||
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 += ' | '
|
||||
classname = fit_columns[c][r]
|
||||
initial = classname[0]
|
||||
if classname in indexers:
|
||||
s += '**' + initial + '** | '
|
||||
else:
|
||||
s += ' | '
|
||||
|
||||
s += '[' + classname + '](class_'+ classname.lower()+') | '
|
||||
s += '[' + classname + '](class_' + classname.lower() + ') | '
|
||||
|
||||
s += '\n'
|
||||
f.write(s)
|
||||
s += '\n'
|
||||
f.write(s)
|
||||
|
||||
|
||||
def dokuize_text(txt):
|
||||
|
||||
return txt
|
||||
return txt
|
||||
|
||||
|
||||
def dokuize_text(text):
|
||||
pos = 0
|
||||
while True:
|
||||
pos = text.find('[', pos)
|
||||
if pos == -1:
|
||||
break
|
||||
pos = 0
|
||||
while True:
|
||||
pos = text.find('[', pos)
|
||||
if pos == -1:
|
||||
break
|
||||
|
||||
endq_pos = text.find(']', pos + 1)
|
||||
if endq_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]
|
||||
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:
|
||||
if tag_text in class_names:
|
||||
tag_text = make_type(tag_text)
|
||||
else:
|
||||
|
||||
# command
|
||||
# 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:]
|
||||
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 = ''
|
||||
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 + ']'
|
||||
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 = ''
|
||||
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)
|
||||
text = pre_text + tag_text + post_text
|
||||
pos = len(pre_text) + len(tag_text)
|
||||
|
||||
# tnode = ET.SubElement(parent,"div")
|
||||
# tnode.text=text
|
||||
|
||||
return text
|
||||
return text
|
||||
|
||||
|
||||
def make_type(t):
|
||||
global class_names
|
||||
if t in class_names:
|
||||
return '[' + t + '](class_' + t.lower() + ')'
|
||||
return 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,
|
||||
):
|
||||
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
|
||||
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
|
||||
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 not event:
|
||||
if -1 in mdata['argidx']:
|
||||
s += make_type(mdata[-1].attrib['type'])
|
||||
else:
|
||||
s += 'void'
|
||||
s += ' '
|
||||
|
||||
if declare:
|
||||
if declare:
|
||||
|
||||
# span.attrib["class"]="funcdecl"
|
||||
# a=ET.SubElement(span,"a")
|
||||
# a.attrib["name"]=name+"_"+m.attrib["name"]
|
||||
# a.text=name+"::"+m.attrib["name"]
|
||||
# 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 += ' **' + 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 += ' **(**'
|
||||
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)
|
||||
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']
|
||||
if 'default' in arg.attrib:
|
||||
s += '=' + arg.attrib['default']
|
||||
|
||||
argfound = True
|
||||
argfound = True
|
||||
|
||||
if argfound:
|
||||
s += ' '
|
||||
s += ' **)**'
|
||||
if argfound:
|
||||
s += ' '
|
||||
s += ' **)**'
|
||||
|
||||
if 'qualifiers' in m.attrib:
|
||||
s += ' ' + m.attrib['qualifiers']
|
||||
if 'qualifiers' in m.attrib:
|
||||
s += ' ' + m.attrib['qualifiers']
|
||||
|
||||
f.write(s + '\n')
|
||||
f.write(s + '\n')
|
||||
|
||||
|
||||
def make_doku_class(node):
|
||||
|
||||
name = node.attrib['name']
|
||||
name = node.attrib['name']
|
||||
|
||||
f = open("class_"+name.lower() + '.md', 'wb')
|
||||
f = open("class_" + name.lower() + '.md', 'wb')
|
||||
|
||||
f.write('# ' + name + ' \n')
|
||||
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')
|
||||
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')
|
||||
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')
|
||||
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)
|
||||
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)
|
||||
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')
|
||||
members = node.find('members')
|
||||
|
||||
if members != None and len(list(members)) > 0:
|
||||
f.write('\n### Member Variables \n')
|
||||
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')
|
||||
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')
|
||||
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')
|
||||
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')
|
||||
methods = node.find('methods')
|
||||
|
||||
if methods != None and len(list(methods)) > 0:
|
||||
f.write('\n### Member Function Description \n')
|
||||
for m in list(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')
|
||||
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()
|
||||
tree = ET.parse(file)
|
||||
doc = tree.getroot()
|
||||
|
||||
if 'version' not in doc.attrib:
|
||||
print "Version missing from 'doc'"
|
||||
sys.exit(255)
|
||||
if 'version' not in doc.attrib:
|
||||
print "Version missing from 'doc'"
|
||||
sys.exit(255)
|
||||
|
||||
version = doc.attrib['version']
|
||||
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
|
||||
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, 2)
|
||||
|
||||
for cn in class_names:
|
||||
c = classes[cn]
|
||||
make_doku_class(c)
|
||||
|
||||
c = classes[cn]
|
||||
make_doku_class(c)
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/python
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import codecs
|
||||
@@ -8,512 +8,510 @@ import xml.etree.ElementTree as ET
|
||||
input_list = []
|
||||
|
||||
for arg in sys.argv[1:]:
|
||||
input_list.append(arg)
|
||||
input_list.append(arg)
|
||||
|
||||
if len(input_list) < 1:
|
||||
print 'usage: makerst.py <classes.xml>'
|
||||
sys.exit(0)
|
||||
print 'usage: makerst.py <classes.xml>'
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
def validate_tag(elem, tag):
|
||||
if elem.tag != tag:
|
||||
print "Tag mismatch, expected '" + tag + "', got " + elem.tag
|
||||
sys.exit(255)
|
||||
if elem.tag != tag:
|
||||
print "Tag mismatch, expected '" + tag + "', got " + elem.tag
|
||||
sys.exit(255)
|
||||
|
||||
|
||||
class_names = []
|
||||
classes = {}
|
||||
|
||||
def ul_string(str,ul):
|
||||
str+="\n"
|
||||
for i in range(len(str)-1):
|
||||
str+=ul
|
||||
str+="\n"
|
||||
return str
|
||||
|
||||
def ul_string(str, ul):
|
||||
str += "\n"
|
||||
for i in range(len(str) - 1):
|
||||
str += ul
|
||||
str += "\n"
|
||||
return str
|
||||
|
||||
|
||||
def make_class_list(class_list, columns):
|
||||
|
||||
f = codecs.open('class_list.rst', 'wb', 'utf-8')
|
||||
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 = []
|
||||
f = codecs.open('class_list.rst', 'wb', 'utf-8')
|
||||
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 += [[]]
|
||||
for n in range(0, columns):
|
||||
fit_columns += [[]]
|
||||
|
||||
indexers = []
|
||||
last_initial = ''
|
||||
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]
|
||||
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")
|
||||
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])
|
||||
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("| ")
|
||||
for n in range(0, columns):
|
||||
f.write(" | |")
|
||||
|
||||
f.write("\n")
|
||||
f.write("+")
|
||||
for n in range(0, columns):
|
||||
f.write("--+-------+")
|
||||
f.write("\n")
|
||||
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
|
||||
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 += ' | '
|
||||
classname = fit_columns[c][r]
|
||||
initial = classname[0]
|
||||
if classname in indexers:
|
||||
s += '**' + initial + '** | '
|
||||
else:
|
||||
s += ' | '
|
||||
|
||||
s += '[' + classname + '](class_'+ classname.lower()+') | '
|
||||
s += '[' + classname + '](class_' + classname.lower() + ') | '
|
||||
|
||||
s += '\n'
|
||||
f.write(s)
|
||||
s += '\n'
|
||||
f.write(s)
|
||||
|
||||
for n in range(0, columns):
|
||||
f.write("--+-------+")
|
||||
f.write("\n")
|
||||
for n in range(0, columns):
|
||||
f.write("--+-------+")
|
||||
f.write("\n")
|
||||
|
||||
|
||||
def rstize_text(text,cclass):
|
||||
def rstize_text(text, cclass):
|
||||
|
||||
# Linebreak + tabs in the XML should become two line breaks unless in a "codeblock"
|
||||
pos = 0
|
||||
while True:
|
||||
pos = text.find('\n', pos)
|
||||
if pos == -1:
|
||||
break
|
||||
# Linebreak + tabs in the XML should become two line breaks unless in a "codeblock"
|
||||
pos = 0
|
||||
while True:
|
||||
pos = text.find('\n', pos)
|
||||
if pos == -1:
|
||||
break
|
||||
|
||||
pre_text = text[:pos]
|
||||
while text[pos+1] == '\t':
|
||||
pos += 1
|
||||
post_text = text[pos+1:]
|
||||
pre_text = text[:pos]
|
||||
while text[pos + 1] == '\t':
|
||||
pos += 1
|
||||
post_text = text[pos + 1:]
|
||||
|
||||
# Handle codeblocks
|
||||
if post_text.startswith("[codeblock]"):
|
||||
end_pos = post_text.find("[/codeblock]")
|
||||
if end_pos == -1:
|
||||
sys.exit("ERROR! [codeblock] without a closing tag!")
|
||||
# Handle codeblocks
|
||||
if post_text.startswith("[codeblock]"):
|
||||
end_pos = post_text.find("[/codeblock]")
|
||||
if end_pos == -1:
|
||||
sys.exit("ERROR! [codeblock] without a closing tag!")
|
||||
|
||||
code_text = post_text[len("[codeblock]"):end_pos]
|
||||
post_text = post_text[end_pos:]
|
||||
code_text = post_text[len("[codeblock]"):end_pos]
|
||||
post_text = post_text[end_pos:]
|
||||
|
||||
# Remove extraneous tabs
|
||||
code_pos = 0
|
||||
while True:
|
||||
code_pos = code_text.find('\n', code_pos)
|
||||
if code_pos == -1:
|
||||
break
|
||||
# Remove extraneous tabs
|
||||
code_pos = 0
|
||||
while True:
|
||||
code_pos = code_text.find('\n', code_pos)
|
||||
if code_pos == -1:
|
||||
break
|
||||
|
||||
to_skip = 0
|
||||
while code_pos+to_skip+1 < len(code_text) and code_text[code_pos+to_skip+1] == '\t':
|
||||
to_skip += 1
|
||||
to_skip = 0
|
||||
while code_pos + to_skip + 1 < len(code_text) and code_text[code_pos + to_skip + 1] == '\t':
|
||||
to_skip += 1
|
||||
|
||||
if len(code_text[code_pos+to_skip+1:])==0:
|
||||
code_text = code_text[:code_pos] + "\n"
|
||||
code_pos += 1
|
||||
else:
|
||||
code_text = code_text[:code_pos] + "\n " + code_text[code_pos+to_skip+1:]
|
||||
code_pos += 5 - to_skip
|
||||
if len(code_text[code_pos + to_skip + 1:]) == 0:
|
||||
code_text = code_text[:code_pos] + "\n"
|
||||
code_pos += 1
|
||||
else:
|
||||
code_text = code_text[:code_pos] + "\n " + code_text[code_pos + to_skip + 1:]
|
||||
code_pos += 5 - to_skip
|
||||
|
||||
text = pre_text + "\n[codeblock]" + code_text + post_text
|
||||
pos += len("\n[codeblock]" + code_text)
|
||||
text = pre_text + "\n[codeblock]" + code_text + post_text
|
||||
pos += len("\n[codeblock]" + code_text)
|
||||
|
||||
# Handle normal text
|
||||
else:
|
||||
text = pre_text + "\n\n" + post_text
|
||||
pos += 2
|
||||
# Handle normal text
|
||||
else:
|
||||
text = pre_text + "\n\n" + post_text
|
||||
pos += 2
|
||||
|
||||
# Escape * character to avoid interpreting it as emphasis
|
||||
pos = 0
|
||||
while True:
|
||||
pos = text.find('*', pos)
|
||||
if pos == -1:
|
||||
break
|
||||
text = text[:pos] + "\*" + text[pos + 1:]
|
||||
pos += 2
|
||||
# Escape * character to avoid interpreting it as emphasis
|
||||
pos = 0
|
||||
while True:
|
||||
pos = text.find('*', pos)
|
||||
if pos == -1:
|
||||
break
|
||||
text = text[:pos] + "\*" + text[pos + 1:]
|
||||
pos += 2
|
||||
|
||||
# Escape _ character at the end of a word to avoid interpreting it as an inline hyperlink
|
||||
pos = 0
|
||||
while True:
|
||||
pos = text.find('_', pos)
|
||||
if pos == -1:
|
||||
break
|
||||
if not text[pos + 1].isalnum(): # don't escape within a snake_case word
|
||||
text = text[:pos] + "\_" + text[pos + 1:]
|
||||
pos += 2
|
||||
else:
|
||||
pos += 1
|
||||
# Escape _ character at the end of a word to avoid interpreting it as an inline hyperlink
|
||||
pos = 0
|
||||
while True:
|
||||
pos = text.find('_', pos)
|
||||
if pos == -1:
|
||||
break
|
||||
if not text[pos + 1].isalnum(): # don't escape within a snake_case word
|
||||
text = text[:pos] + "\_" + text[pos + 1:]
|
||||
pos += 2
|
||||
else:
|
||||
pos += 1
|
||||
|
||||
# Handle [tags]
|
||||
pos = 0
|
||||
while True:
|
||||
pos = text.find('[', pos)
|
||||
if pos == -1:
|
||||
break
|
||||
# Handle [tags]
|
||||
pos = 0
|
||||
while True:
|
||||
pos = text.find('[', pos)
|
||||
if pos == -1:
|
||||
break
|
||||
|
||||
endq_pos = text.find(']', pos + 1)
|
||||
if endq_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]
|
||||
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 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 = ':ref:`'+class_param+'.'+method_param+'<class_' + class_param + '_' + method_param + '>`'
|
||||
else:
|
||||
tag_text = ':ref:`' + param + '<class_' + cclass +"_"+ param + '>`'
|
||||
elif cmd.find('image=') == 0:
|
||||
tag_text = "" #''
|
||||
elif cmd.find('url=') == 0:
|
||||
tag_text = ':ref:`' + cmd[4:] + '<'+cmd[4:]+">`"
|
||||
elif cmd == '/url':
|
||||
tag_text = ')'
|
||||
elif cmd == 'center':
|
||||
tag_text = ''
|
||||
elif cmd == '/center':
|
||||
tag_text = ''
|
||||
elif cmd == 'codeblock':
|
||||
tag_text = '\n::\n'
|
||||
elif cmd == '/codeblock':
|
||||
tag_text = ''
|
||||
# Strip newline if the tag was alone on one
|
||||
if pre_text[-1] == '\n':
|
||||
pre_text = pre_text[:-1]
|
||||
elif cmd == 'br':
|
||||
# Make a new paragraph instead of a linebreak, rst is not so linebreak friendly
|
||||
tag_text = '\n\n'
|
||||
# Strip potential leading spaces
|
||||
while post_text[0] == ' ':
|
||||
post_text = post_text[1:]
|
||||
elif cmd == 'i' or cmd == '/i':
|
||||
tag_text = '*'
|
||||
elif cmd == 'b' or cmd == '/b':
|
||||
tag_text = '**'
|
||||
elif cmd == 'u' or cmd == '/u':
|
||||
tag_text = ''
|
||||
elif cmd == 'code' or cmd == '/code':
|
||||
tag_text = '``'
|
||||
else:
|
||||
tag_text = ':ref:`' + tag_text + '<class_'+tag_text.lower()+'>`'
|
||||
if param.find('.') != -1:
|
||||
(class_param, method_param) = param.split('.')
|
||||
tag_text = ':ref:`' + class_param + '.' + method_param + '<class_' + class_param + '_' + method_param + '>`'
|
||||
else:
|
||||
tag_text = ':ref:`' + param + '<class_' + cclass + "_" + param + '>`'
|
||||
elif cmd.find('image=') == 0:
|
||||
tag_text = "" # ''
|
||||
elif cmd.find('url=') == 0:
|
||||
tag_text = ':ref:`' + cmd[4:] + '<' + cmd[4:] + ">`"
|
||||
elif cmd == '/url':
|
||||
tag_text = ')'
|
||||
elif cmd == 'center':
|
||||
tag_text = ''
|
||||
elif cmd == '/center':
|
||||
tag_text = ''
|
||||
elif cmd == 'codeblock':
|
||||
tag_text = '\n::\n'
|
||||
elif cmd == '/codeblock':
|
||||
tag_text = ''
|
||||
# Strip newline if the tag was alone on one
|
||||
if pre_text[-1] == '\n':
|
||||
pre_text = pre_text[:-1]
|
||||
elif cmd == 'br':
|
||||
# Make a new paragraph instead of a linebreak, rst is not so linebreak friendly
|
||||
tag_text = '\n\n'
|
||||
# Strip potential leading spaces
|
||||
while post_text[0] == ' ':
|
||||
post_text = post_text[1:]
|
||||
elif cmd == 'i' or cmd == '/i':
|
||||
tag_text = '*'
|
||||
elif cmd == 'b' or cmd == '/b':
|
||||
tag_text = '**'
|
||||
elif cmd == 'u' or cmd == '/u':
|
||||
tag_text = ''
|
||||
elif cmd == 'code' or cmd == '/code':
|
||||
tag_text = '``'
|
||||
else:
|
||||
tag_text = ':ref:`' + tag_text + '<class_' + tag_text.lower() + '>`'
|
||||
|
||||
text = pre_text + tag_text + post_text
|
||||
pos = len(pre_text) + len(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
|
||||
return text
|
||||
|
||||
|
||||
def make_type(t):
|
||||
global class_names
|
||||
if t in class_names:
|
||||
return ':ref:`'+t+'<class_' + t.lower()+'>`'
|
||||
return t
|
||||
global class_names
|
||||
if t in class_names:
|
||||
return ':ref:`' + t + '<class_' + t.lower() + '>`'
|
||||
return t
|
||||
|
||||
|
||||
def make_method(
|
||||
f,
|
||||
name,
|
||||
m,
|
||||
declare,
|
||||
cname,
|
||||
event=False,
|
||||
pp=None
|
||||
):
|
||||
f,
|
||||
name,
|
||||
m,
|
||||
declare,
|
||||
cname,
|
||||
event=False,
|
||||
pp=None
|
||||
):
|
||||
|
||||
if (declare or pp==None):
|
||||
t = '- '
|
||||
else:
|
||||
t = ""
|
||||
if (declare or pp == None):
|
||||
t = '- '
|
||||
else:
|
||||
t = ""
|
||||
|
||||
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
|
||||
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
|
||||
mdata['argidx'].append(idx)
|
||||
mdata[idx] = a
|
||||
|
||||
if not event:
|
||||
if -1 in mdata['argidx']:
|
||||
t += make_type(mdata[-1].attrib['type'])
|
||||
else:
|
||||
t += 'void'
|
||||
t += ' '
|
||||
if not event:
|
||||
if -1 in mdata['argidx']:
|
||||
t += make_type(mdata[-1].attrib['type'])
|
||||
else:
|
||||
t += 'void'
|
||||
t += ' '
|
||||
|
||||
if declare or pp==None:
|
||||
if declare or pp == None:
|
||||
|
||||
# span.attrib["class"]="funcdecl"
|
||||
# a=ET.SubElement(span,"a")
|
||||
# a.attrib["name"]=name+"_"+m.attrib["name"]
|
||||
# a.text=name+"::"+m.attrib["name"]
|
||||
# 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']+'** '
|
||||
else:
|
||||
s = ':ref:`'+ m.attrib['name']+'<class_' + cname+"_"+m.attrib['name'] + '>` '
|
||||
s = ' **' + m.attrib['name'] + '** '
|
||||
else:
|
||||
s = ':ref:`' + m.attrib['name'] + '<class_' + cname + "_" + 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 += ' **(**'
|
||||
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)
|
||||
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']
|
||||
if 'default' in arg.attrib:
|
||||
s += '=' + arg.attrib['default']
|
||||
|
||||
argfound = True
|
||||
argfound = True
|
||||
|
||||
if argfound:
|
||||
s += ' '
|
||||
s += ' **)**'
|
||||
if argfound:
|
||||
s += ' '
|
||||
s += ' **)**'
|
||||
|
||||
if 'qualifiers' in m.attrib:
|
||||
s += ' ' + m.attrib['qualifiers']
|
||||
if 'qualifiers' in m.attrib:
|
||||
s += ' ' + m.attrib['qualifiers']
|
||||
|
||||
# f.write(s)
|
||||
if (not declare):
|
||||
if (pp!=None):
|
||||
pp.append( (t,s) )
|
||||
else:
|
||||
f.write("- "+t+" "+s+"\n")
|
||||
else:
|
||||
f.write(t+s+"\n")
|
||||
if (not declare):
|
||||
if (pp != None):
|
||||
pp.append((t, s))
|
||||
else:
|
||||
f.write("- " + t + " " + s + "\n")
|
||||
else:
|
||||
f.write(t + s + "\n")
|
||||
|
||||
|
||||
def make_heading(title, underline):
|
||||
return title + '\n' + underline*len(title) + "\n\n"
|
||||
|
||||
return title + '\n' + underline * len(title) + "\n\n"
|
||||
|
||||
|
||||
def make_rst_class(node):
|
||||
|
||||
name = node.attrib['name']
|
||||
name = node.attrib['name']
|
||||
|
||||
f = codecs.open("class_"+name.lower() + '.rst', 'wb', 'utf-8')
|
||||
f = codecs.open("class_" + name.lower() + '.rst', 'wb', 'utf-8')
|
||||
|
||||
# Warn contributors not to edit this file directly
|
||||
f.write(".. Generated automatically by doc/tools/makerst.py in Godot's source tree.\n")
|
||||
f.write(".. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead.\n\n")
|
||||
# Warn contributors not to edit this file directly
|
||||
f.write(".. Generated automatically by doc/tools/makerst.py in Godot's source tree.\n")
|
||||
f.write(".. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead.\n\n")
|
||||
|
||||
f.write(".. _class_"+name+":\n\n")
|
||||
f.write(make_heading(name, '='))
|
||||
f.write(".. _class_" + name + ":\n\n")
|
||||
f.write(make_heading(name, '='))
|
||||
|
||||
if 'inherits' in node.attrib:
|
||||
inh = node.attrib['inherits'].strip()
|
||||
if 'inherits' in node.attrib:
|
||||
inh = node.attrib['inherits'].strip()
|
||||
# whle inh in classes[cn]
|
||||
f.write('**Inherits:** ')
|
||||
first=True
|
||||
while(inh in classes):
|
||||
if (not first):
|
||||
f.write(" **<** ")
|
||||
else:
|
||||
first=False
|
||||
f.write('**Inherits:** ')
|
||||
first = True
|
||||
while(inh in classes):
|
||||
if (not first):
|
||||
f.write(" **<** ")
|
||||
else:
|
||||
first = False
|
||||
|
||||
f.write(make_type(inh))
|
||||
inode = classes[inh]
|
||||
if ('inherits' in inode.attrib):
|
||||
inh=inode.attrib['inherits'].strip()
|
||||
else:
|
||||
inh=None
|
||||
f.write(make_type(inh))
|
||||
inode = classes[inh]
|
||||
if ('inherits' in inode.attrib):
|
||||
inh = inode.attrib['inherits'].strip()
|
||||
else:
|
||||
inh = None
|
||||
|
||||
f.write("\n\n")
|
||||
|
||||
f.write("\n\n")
|
||||
inherited = []
|
||||
for cn in classes:
|
||||
c = classes[cn]
|
||||
if 'inherits' in c.attrib:
|
||||
if (c.attrib['inherits'].strip() == name):
|
||||
inherited.append(c.attrib['name'])
|
||||
|
||||
inherited=[]
|
||||
for cn in classes:
|
||||
c=classes[cn]
|
||||
if 'inherits' in c.attrib:
|
||||
if (c.attrib['inherits'].strip()==name):
|
||||
inherited.append(c.attrib['name'])
|
||||
if (len(inherited)):
|
||||
f.write('**Inherited By:** ')
|
||||
for i in range(len(inherited)):
|
||||
if (i > 0):
|
||||
f.write(", ")
|
||||
f.write(make_type(inherited[i]))
|
||||
f.write("\n\n")
|
||||
if 'category' in node.attrib:
|
||||
f.write('**Category:** ' + node.attrib['category'].strip() + "\n\n")
|
||||
|
||||
if (len(inherited)):
|
||||
f.write('**Inherited By:** ')
|
||||
for i in range(len(inherited)):
|
||||
if (i>0):
|
||||
f.write(", ")
|
||||
f.write(make_type(inherited[i]))
|
||||
f.write("\n\n")
|
||||
if 'category' in node.attrib:
|
||||
f.write('**Category:** ' + node.attrib['category'].strip() + "\n\n")
|
||||
f.write(make_heading('Brief Description', '-'))
|
||||
briefd = node.find('brief_description')
|
||||
if briefd != None:
|
||||
f.write(rstize_text(briefd.text.strip(), name) + "\n\n")
|
||||
|
||||
f.write(make_heading('Brief Description', '-'))
|
||||
briefd = node.find('brief_description')
|
||||
if briefd != None:
|
||||
f.write(rstize_text(briefd.text.strip(),name) + "\n\n")
|
||||
methods = node.find('methods')
|
||||
|
||||
methods = node.find('methods')
|
||||
if methods != None and len(list(methods)) > 0:
|
||||
f.write(make_heading('Member Functions', '-'))
|
||||
ml = []
|
||||
for m in list(methods):
|
||||
make_method(f, node.attrib['name'], m, False, name, False, ml)
|
||||
longest_t = 0
|
||||
longest_s = 0
|
||||
for s in ml:
|
||||
sl = len(s[0])
|
||||
if (sl > longest_s):
|
||||
longest_s = sl
|
||||
tl = len(s[1])
|
||||
if (tl > longest_t):
|
||||
longest_t = tl
|
||||
|
||||
if methods != None and len(list(methods)) > 0:
|
||||
f.write(make_heading('Member Functions', '-'))
|
||||
ml=[]
|
||||
for m in list(methods):
|
||||
make_method(f, node.attrib['name'], m, False,name,False,ml)
|
||||
longest_t = 0
|
||||
longest_s = 0
|
||||
for s in ml:
|
||||
sl = len(s[0])
|
||||
if (sl>longest_s):
|
||||
longest_s=sl
|
||||
tl = len(s[1])
|
||||
if (tl>longest_t):
|
||||
longest_t=tl
|
||||
sep = "+"
|
||||
for i in range(longest_s + 2):
|
||||
sep += "-"
|
||||
sep += "+"
|
||||
for i in range(longest_t + 2):
|
||||
sep += "-"
|
||||
sep += "+\n"
|
||||
f.write(sep)
|
||||
for s in ml:
|
||||
rt = s[0]
|
||||
while(len(rt) < longest_s):
|
||||
rt += " "
|
||||
st = s[1]
|
||||
while(len(st) < longest_t):
|
||||
st += " "
|
||||
f.write("| " + rt + " | " + st + " |\n")
|
||||
f.write(sep)
|
||||
f.write('\n')
|
||||
|
||||
sep="+"
|
||||
for i in range(longest_s+2):
|
||||
sep+="-"
|
||||
sep+="+"
|
||||
for i in range(longest_t+2):
|
||||
sep+="-"
|
||||
sep+="+\n"
|
||||
f.write(sep)
|
||||
for s in ml:
|
||||
rt = s[0]
|
||||
while( len(rt) < longest_s ):
|
||||
rt+=" "
|
||||
st = s[1]
|
||||
while( len(st) < longest_t ):
|
||||
st+=" "
|
||||
f.write("| "+rt+" | "+st+" |\n")
|
||||
f.write(sep)
|
||||
f.write('\n')
|
||||
events = node.find('signals')
|
||||
if events != None and len(list(events)) > 0:
|
||||
f.write(make_heading('Signals', '-'))
|
||||
for m in list(events):
|
||||
make_method(f, node.attrib['name'], m, True, name, True)
|
||||
f.write('\n')
|
||||
|
||||
members = node.find('members')
|
||||
if members != None and len(list(members)) > 0:
|
||||
f.write(make_heading('Member Variables', '-'))
|
||||
|
||||
events = node.find('signals')
|
||||
if events != None and len(list(events)) > 0:
|
||||
f.write(make_heading('Signals', '-'))
|
||||
for m in list(events):
|
||||
make_method(f, node.attrib['name'], m, True,name, True)
|
||||
f.write('\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')
|
||||
f.write('\n')
|
||||
|
||||
members = node.find('members')
|
||||
if members != None and len(list(members)) > 0:
|
||||
f.write(make_heading('Member Variables', '-'))
|
||||
constants = node.find('constants')
|
||||
if constants != None and len(list(constants)) > 0:
|
||||
f.write(make_heading('Numeric Constants', '-'))
|
||||
for c in list(constants):
|
||||
s = '- '
|
||||
s += '**' + c.attrib['name'] + '**'
|
||||
if 'value' in c.attrib:
|
||||
s += ' = **' + c.attrib['value'] + '**'
|
||||
if c.text.strip() != '':
|
||||
s += ' --- ' + rstize_text(c.text.strip(), name)
|
||||
f.write(s + '\n')
|
||||
f.write('\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')
|
||||
f.write('\n')
|
||||
descr = node.find('description')
|
||||
if descr != None and descr.text.strip() != '':
|
||||
f.write(make_heading('Description', '-'))
|
||||
f.write(rstize_text(descr.text.strip(), name) + "\n\n")
|
||||
|
||||
constants = node.find('constants')
|
||||
if constants != None and len(list(constants)) > 0:
|
||||
f.write(make_heading('Numeric Constants', '-'))
|
||||
for c in list(constants):
|
||||
s = '- '
|
||||
s += '**' + c.attrib['name'] + '**'
|
||||
if 'value' in c.attrib:
|
||||
s += ' = **' + c.attrib['value'] + '**'
|
||||
if c.text.strip() != '':
|
||||
s += ' --- ' + rstize_text(c.text.strip(),name)
|
||||
f.write(s + '\n')
|
||||
f.write('\n')
|
||||
|
||||
descr = node.find('description')
|
||||
if descr != None and descr.text.strip() != '':
|
||||
f.write(make_heading('Description', '-'))
|
||||
f.write(rstize_text(descr.text.strip(),name) + "\n\n")
|
||||
|
||||
methods = node.find('methods')
|
||||
if methods != None and len(list(methods)) > 0:
|
||||
f.write(make_heading('Member Function Description', '-'))
|
||||
for m in list(methods):
|
||||
f.write(".. _class_"+name+"_"+m.attrib['name']+":\n\n")
|
||||
methods = node.find('methods')
|
||||
if methods != None and len(list(methods)) > 0:
|
||||
f.write(make_heading('Member Function Description', '-'))
|
||||
for m in list(methods):
|
||||
f.write(".. _class_" + name + "_" + m.attrib['name'] + ":\n\n")
|
||||
# f.write(ul_string(m.attrib['name'],"^"))
|
||||
#f.write('\n<a name="'+m.attrib['name']+'">' + m.attrib['name'] + '</a>\n------\n')
|
||||
make_method(f, node.attrib['name'], m, True,name)
|
||||
f.write('\n')
|
||||
d = m.find('description')
|
||||
if d == None or d.text.strip() == '':
|
||||
continue
|
||||
f.write(rstize_text(d.text.strip(),name))
|
||||
f.write("\n\n")
|
||||
f.write('\n')
|
||||
#f.write('\n<a name="'+m.attrib['name']+'">' + m.attrib['name'] + '</a>\n------\n')
|
||||
make_method(f, node.attrib['name'], m, True, name)
|
||||
f.write('\n')
|
||||
d = m.find('description')
|
||||
if d == None or d.text.strip() == '':
|
||||
continue
|
||||
f.write(rstize_text(d.text.strip(), name))
|
||||
f.write("\n\n")
|
||||
f.write('\n')
|
||||
|
||||
|
||||
for file in input_list:
|
||||
tree = ET.parse(file)
|
||||
doc = tree.getroot()
|
||||
tree = ET.parse(file)
|
||||
doc = tree.getroot()
|
||||
|
||||
if 'version' not in doc.attrib:
|
||||
print "Version missing from 'doc'"
|
||||
sys.exit(255)
|
||||
if 'version' not in doc.attrib:
|
||||
print "Version missing from 'doc'"
|
||||
sys.exit(255)
|
||||
|
||||
version = doc.attrib['version']
|
||||
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
|
||||
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()
|
||||
|
||||
#Don't make class list for Sphinx, :toctree: handles it
|
||||
# Don't make class list for Sphinx, :toctree: handles it
|
||||
#make_class_list(class_names, 2)
|
||||
|
||||
for cn in class_names:
|
||||
c = classes[cn]
|
||||
make_rst_class(c)
|
||||
|
||||
c = classes[cn]
|
||||
make_rst_class(c)
|
||||
|
134
drivers/SCsub
vendored
134
drivers/SCsub
vendored
@@ -1,115 +1,41 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
Import('env')
|
||||
|
||||
env_drivers = env.Clone()
|
||||
env.drivers_sources = []
|
||||
|
||||
env.drivers_sources=[]
|
||||
#env.add_source_files(env.drivers_sources,"*.cpp")
|
||||
env_drivers.Append(CPPPATH=["vorbis"])
|
||||
if ("builtin_zlib" in env and env["builtin_zlib"] == "yes"):
|
||||
SConscript("zlib/SCsub")
|
||||
|
||||
Export('env_drivers')
|
||||
# OS drivers
|
||||
SConscript('unix/SCsub')
|
||||
SConscript('windows/SCsub')
|
||||
|
||||
SConscript('unix/SCsub');
|
||||
SConscript('alsa/SCsub');
|
||||
SConscript('pulseaudio/SCsub');
|
||||
SConscript('windows/SCsub');
|
||||
SConscript('gles2/SCsub');
|
||||
SConscript('gl_context/SCsub');
|
||||
SConscript('pnm/SCsub');
|
||||
# Sounds drivers
|
||||
SConscript('alsa/SCsub')
|
||||
SConscript('pulseaudio/SCsub')
|
||||
if (env["platform"] == "windows"):
|
||||
SConscript("rtaudio/SCsub")
|
||||
|
||||
if (env['openssl']!='no'):
|
||||
env_drivers.Append(CPPFLAGS=['-DOPENSSL_ENABLED']);
|
||||
if (env['openssl']=="builtin"):
|
||||
env_drivers.Append(CPPPATH=['#drivers/builtin_openssl2'])
|
||||
SConscript("builtin_openssl2/SCsub");
|
||||
# Graphics drivers
|
||||
SConscript('gles2/SCsub')
|
||||
SConscript('gl_context/SCsub')
|
||||
|
||||
SConscript('openssl/SCsub')
|
||||
# Core dependencies
|
||||
SConscript("png/SCsub")
|
||||
SConscript("nrex/SCsub")
|
||||
|
||||
# Tools override
|
||||
# FIXME: Should likely be integrated in the tools/ codebase
|
||||
if (env["tools"] == "yes"):
|
||||
SConscript("convex_decomp/SCsub")
|
||||
|
||||
if (env["png"]=="yes"):
|
||||
SConscript("png/SCsub");
|
||||
if (env["jpg"]=="yes"):
|
||||
#SConscript("jpg/SCsub");
|
||||
SConscript("jpegd/SCsub");
|
||||
if (env["webp"]=="yes"):
|
||||
SConscript("webp/SCsub");
|
||||
SConscript("dds/SCsub");
|
||||
SConscript("pvr/SCsub");
|
||||
SConscript("etc1/SCsub")
|
||||
if (env["builtin_zlib"]=="yes"):
|
||||
SConscript("builtin_zlib/SCsub");
|
||||
if env['vsproj'] == "yes":
|
||||
env.AddToVSProject(env.drivers_sources)
|
||||
|
||||
SConscript("rtaudio/SCsub");
|
||||
SConscript("nedmalloc/SCsub");
|
||||
SConscript("nrex/SCsub");
|
||||
SConscript("chibi/SCsub");
|
||||
if (env["vorbis"]=="yes" or env["speex"]=="yes" or env["theoralib"]=="yes" or env["opus"]=="yes"):
|
||||
SConscript("ogg/SCsub");
|
||||
if (env["vorbis"]=="yes"):
|
||||
SConscript("vorbis/SCsub");
|
||||
if (env["opus"]=="yes"):
|
||||
SConscript('opus/SCsub');
|
||||
if (env["tools"]=="yes"):
|
||||
SConscript("convex_decomp/SCsub");
|
||||
|
||||
if (env["theoralib"]=="yes"):
|
||||
SConscript("theora/SCsub");
|
||||
if (env['speex']=='yes'):
|
||||
SConscript("speex/SCsub");
|
||||
if (env['musepack']=='yes'):
|
||||
SConscript("mpc/SCsub");
|
||||
if (env["squish"]=="yes" and env["tools"]=="yes"):
|
||||
SConscript("squish/SCsub");
|
||||
if (env["freetype"]!="no"):
|
||||
SConscript("freetype/SCsub");
|
||||
|
||||
num = 0
|
||||
cur_base = ""
|
||||
total = len(env.drivers_sources)
|
||||
max_src = 64
|
||||
list = []
|
||||
lib_list = []
|
||||
|
||||
import string
|
||||
|
||||
if env['vsproj']=="yes":
|
||||
env.AddToVSProject(env.drivers_sources)
|
||||
|
||||
if (env.split_drivers): #split drivers, this used to be needed for windows until separate builders for windows were created
|
||||
|
||||
for f in env.drivers_sources:
|
||||
fname = ""
|
||||
if type(f) == type(""):
|
||||
fname = env.File(f).path
|
||||
else:
|
||||
fname = env.File(f)[0].path
|
||||
fname = fname.replace("\\", "/")
|
||||
base = string.join(fname.split("/")[:2], "/")
|
||||
if base != cur_base and len(list) > max_src:
|
||||
if num > 0:
|
||||
lib = env_drivers.Library("drivers"+str(num), list)
|
||||
lib_list.append(lib)
|
||||
list = []
|
||||
num = num+1
|
||||
cur_base = base
|
||||
list.append(f)
|
||||
|
||||
lib = env_drivers.Library("drivers"+str(num), list)
|
||||
lib_list.append(lib)
|
||||
|
||||
if len(lib_list) > 0:
|
||||
import os, sys
|
||||
if os.name=='posix' and sys.platform=='msys':
|
||||
env.Replace(ARFLAGS=['rcsT'])
|
||||
|
||||
lib = env_drivers.Library("drivers_collated", lib_list)
|
||||
lib_list = [lib]
|
||||
|
||||
drivers_base=[]
|
||||
env_drivers.add_source_files(drivers_base,"*.cpp")
|
||||
lib_list.insert(0, env_drivers.Library("drivers", drivers_base))
|
||||
|
||||
env.Prepend(LIBS=lib_list)
|
||||
if env.split_drivers:
|
||||
env.split_lib("drivers")
|
||||
else:
|
||||
env_drivers.add_source_files(env.drivers_sources,"*.cpp")
|
||||
lib = env_drivers.Library("drivers",env.drivers_sources)
|
||||
env.Prepend(LIBS=[lib])
|
||||
env.add_source_files(env.drivers_sources, "*.cpp")
|
||||
lib = env.Library("drivers", env.drivers_sources)
|
||||
env.Prepend(LIBS=[lib])
|
||||
|
@@ -1,5 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
Import('env')
|
||||
|
||||
env.add_source_files(env.drivers_sources,"*.cpp")
|
||||
env.add_source_files(env.drivers_sources, "*.cpp")
|
||||
|
||||
Export('env')
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,22 +0,0 @@
|
||||
Import('env')
|
||||
|
||||
zlib_sources = [
|
||||
|
||||
"builtin_zlib/zlib/adler32.c",
|
||||
"builtin_zlib/zlib/compress.c",
|
||||
"builtin_zlib/zlib/crc32.c",
|
||||
"builtin_zlib/zlib/deflate.c",
|
||||
"builtin_zlib/zlib/infback.c",
|
||||
"builtin_zlib/zlib/inffast.c",
|
||||
"builtin_zlib/zlib/inflate.c",
|
||||
"builtin_zlib/zlib/inftrees.c",
|
||||
"builtin_zlib/zlib/trees.c",
|
||||
"builtin_zlib/zlib/uncompr.c",
|
||||
"builtin_zlib/zlib/zutil.c",
|
||||
]
|
||||
|
||||
|
||||
env.drivers_sources+=zlib_sources
|
||||
|
||||
#env.add_source_files("core", png_sources)
|
||||
Export('env')
|
@@ -1,5 +0,0 @@
|
||||
Import('env')
|
||||
|
||||
env.add_source_files(env.drivers_sources,"*.cpp")
|
||||
|
||||
Export('env')
|
@@ -1,4 +1,7 @@
|
||||
Import('env')
|
||||
Export('env');
|
||||
#!/usr/bin/env python
|
||||
|
||||
env.add_source_files(env.drivers_sources,"*.cpp")
|
||||
Import('env')
|
||||
|
||||
env.add_source_files(env.drivers_sources, "*.cpp")
|
||||
|
||||
Export('env')
|
||||
|
@@ -1,10 +0,0 @@
|
||||
Import('env')
|
||||
|
||||
|
||||
dds_sources = [
|
||||
"dds/texture_loader_dds.cpp"
|
||||
]
|
||||
|
||||
env.drivers_sources+=dds_sources
|
||||
|
||||
#env.add_source_files(env.drivers_sources, dds_sources)
|
@@ -1,15 +0,0 @@
|
||||
Import('env')
|
||||
|
||||
|
||||
etc_sources = [
|
||||
"etc1/image_etc.cpp",
|
||||
"etc1/rg_etc1.cpp",
|
||||
"etc1/texture_loader_pkm.cpp"
|
||||
]
|
||||
|
||||
if (env["etc1"] != "no"):
|
||||
env.drivers_sources+=etc_sources
|
||||
|
||||
#env.add_source_files(env.drivers_sources, etc_sources)
|
||||
|
||||
Export('env')
|
@@ -1,68 +0,0 @@
|
||||
Import('env')
|
||||
|
||||
ft_sources=[\
|
||||
"src/autofit/autofit.c",\
|
||||
"src/base/ftapi.c",\
|
||||
"src/base/ftbase.c",\
|
||||
"src/base/ftbbox.c",\
|
||||
"src/base/ftbdf.c",\
|
||||
"src/base/ftbitmap.c",\
|
||||
"src/base/ftcid.c",\
|
||||
"src/base/ftdebug.c",\
|
||||
"src/base/ftfntfmt.c",\
|
||||
"src/base/ftfstype.c",\
|
||||
"src/base/ftgasp.c",\
|
||||
"src/base/ftglyph.c",\
|
||||
"src/base/ftgxval.c",\
|
||||
"src/base/ftinit.c",\
|
||||
"src/base/ftlcdfil.c",\
|
||||
"src/base/ftmm.c",\
|
||||
"src/base/ftotval.c",\
|
||||
"src/base/ftpatent.c",\
|
||||
"src/base/ftpfr.c",\
|
||||
"src/base/ftpic.c",\
|
||||
"src/base/ftstroke.c",\
|
||||
"src/base/ftsynth.c",\
|
||||
"src/base/ftsystem.c",\
|
||||
"src/base/fttype1.c",\
|
||||
"src/base/ftwinfnt.c",\
|
||||
"src/bdf/bdf.c",\
|
||||
"src/cache/ftcache.c",\
|
||||
"src/cff/cff.c",\
|
||||
"src/cid/type1cid.c",\
|
||||
"src/gxvalid/gxvalid.c",\
|
||||
"src/otvalid/otvalid.c",\
|
||||
"src/pcf/pcf.c",\
|
||||
"src/pfr/pfr.c",\
|
||||
"src/psaux/psaux.c",\
|
||||
"src/pshinter/pshinter.c",\
|
||||
"src/psnames/psnames.c",\
|
||||
"src/raster/raster.c",\
|
||||
"src/sfnt/sfnt.c",\
|
||||
"src/smooth/smooth.c",\
|
||||
"src/truetype/truetype.c",\
|
||||
"src/type1/type1.c",\
|
||||
"src/type42/type42.c",\
|
||||
"src/winfonts/winfnt.c",\
|
||||
]
|
||||
|
||||
|
||||
if (env["freetype"]=="builtin"):
|
||||
# fix for Windows' shell miserably failing on long lines, split in two libraries
|
||||
half1=[]
|
||||
half2=[]
|
||||
for x in ft_sources:
|
||||
if (x.find("src/base")==0 or x.find("src/sfnt")==0):
|
||||
half2.append(x)
|
||||
else:
|
||||
half1.append(x)
|
||||
|
||||
lib = env.Library("freetype_builtin1",half2)
|
||||
env.Append(LIBS=[lib])
|
||||
lib = env.Library("freetype_builtin2",half1)
|
||||
env.Append(LIBS=[lib])
|
||||
|
||||
env.Append(CPPPATH=["#drivers/freetype/include"])
|
||||
|
||||
|
||||
Export('env')
|
@@ -1,19 +0,0 @@
|
||||
# FreeType 2 src Jamfile
|
||||
#
|
||||
# Copyright 2001-2016 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
SubDir FT2_TOP $(FT2_SRC_DIR) ;
|
||||
|
||||
for xx in $(FT2_COMPONENTS)
|
||||
{
|
||||
SubInclude FT2_TOP $(FT2_SRC_DIR) $(xx) ;
|
||||
}
|
||||
|
||||
# end of src Jamfile
|
@@ -1,53 +0,0 @@
|
||||
# FreeType 2 src/autofit Jamfile
|
||||
#
|
||||
# Copyright 2003-2016 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
SubDir FT2_TOP src autofit ;
|
||||
|
||||
{
|
||||
local _sources ;
|
||||
|
||||
# define FT2_AUTOFIT2 to enable experimental latin hinter replacement
|
||||
if $(FT2_AUTOFIT2)
|
||||
{
|
||||
CCFLAGS += FT_OPTION_AUTOFIT2 ;
|
||||
}
|
||||
if $(FT2_MULTI)
|
||||
{
|
||||
_sources = afangles
|
||||
afblue
|
||||
afcjk
|
||||
afdummy
|
||||
afglobal
|
||||
afhints
|
||||
afindic
|
||||
aflatin
|
||||
afloader
|
||||
afmodule
|
||||
afpic
|
||||
afranges
|
||||
afshaper
|
||||
afwarp
|
||||
;
|
||||
|
||||
if $(FT2_AUTOFIT2)
|
||||
{
|
||||
_sources += aflatin2 ;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_sources = autofit ;
|
||||
}
|
||||
|
||||
Library $(FT2_LIB) : $(_sources).c ;
|
||||
}
|
||||
|
||||
# end of src/autofit Jamfile
|
@@ -1,88 +0,0 @@
|
||||
# FreeType 2 src/base Jamfile
|
||||
#
|
||||
# Copyright 2001-2016 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
SubDir FT2_TOP $(FT2_SRC_DIR) base ;
|
||||
|
||||
|
||||
{
|
||||
local _sources ;
|
||||
|
||||
if $(FT2_MULTI)
|
||||
{
|
||||
_sources = basepic
|
||||
ftadvanc
|
||||
ftcalc
|
||||
ftdbgmem
|
||||
ftgloadr
|
||||
fthash
|
||||
ftobjs
|
||||
ftoutln
|
||||
ftpic
|
||||
ftrfork
|
||||
ftsnames
|
||||
ftstream
|
||||
fttrigon
|
||||
ftutil
|
||||
;
|
||||
}
|
||||
else
|
||||
{
|
||||
_sources = ftbase ;
|
||||
}
|
||||
|
||||
Library $(FT2_LIB) : $(_sources).c ;
|
||||
}
|
||||
|
||||
# Add the optional/replaceable files.
|
||||
#
|
||||
{
|
||||
local _sources = ftapi
|
||||
ftbbox
|
||||
ftbdf
|
||||
ftbitmap
|
||||
ftcid
|
||||
ftdebug
|
||||
ftfntfmt
|
||||
ftfstype
|
||||
ftgasp
|
||||
ftglyph
|
||||
ftgxval
|
||||
ftinit
|
||||
ftlcdfil
|
||||
ftmm
|
||||
ftotval
|
||||
ftpatent
|
||||
ftpfr
|
||||
ftstroke
|
||||
ftsynth
|
||||
ftsystem
|
||||
fttype1
|
||||
ftwinfnt
|
||||
;
|
||||
|
||||
Library $(FT2_LIB) : $(_sources).c ;
|
||||
}
|
||||
|
||||
# Add Macintosh-specific file to the library when necessary.
|
||||
#
|
||||
if $(MAC)
|
||||
{
|
||||
Library $(FT2_LIB) : ftmac.c ;
|
||||
}
|
||||
else if $(OS) = MACOSX
|
||||
{
|
||||
if $(FT2_MULTI)
|
||||
{
|
||||
Library $(FT2_LIB) : ftmac.c ;
|
||||
}
|
||||
}
|
||||
|
||||
# end of src/base Jamfile
|
@@ -1,31 +0,0 @@
|
||||
# FreeType 2 src/bdf Jamfile
|
||||
#
|
||||
# Copyright 2002-2016 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
SubDir FT2_TOP $(FT2_SRC_DIR) bdf ;
|
||||
|
||||
{
|
||||
local _sources ;
|
||||
|
||||
if $(FT2_MULTI)
|
||||
{
|
||||
_sources = bdfdrivr
|
||||
bdflib
|
||||
;
|
||||
}
|
||||
else
|
||||
{
|
||||
_sources = bdf ;
|
||||
}
|
||||
|
||||
Library $(FT2_LIB) : $(_sources).c ;
|
||||
}
|
||||
|
||||
# end of src/bdf Jamfile
|
37
drivers/freetype/src/cache/Jamfile
vendored
37
drivers/freetype/src/cache/Jamfile
vendored
@@ -1,37 +0,0 @@
|
||||
# FreeType 2 src/cache Jamfile
|
||||
#
|
||||
# Copyright 2001-2016 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
SubDir FT2_TOP $(FT2_SRC_DIR) cache ;
|
||||
|
||||
{
|
||||
local _sources ;
|
||||
|
||||
if $(FT2_MULTI)
|
||||
{
|
||||
_sources = ftcbasic
|
||||
ftccache
|
||||
ftcglyph
|
||||
ftcimage
|
||||
ftcmanag
|
||||
ftccmap
|
||||
ftcmru
|
||||
ftcsbits
|
||||
;
|
||||
}
|
||||
else
|
||||
{
|
||||
_sources = ftcache ;
|
||||
}
|
||||
|
||||
Library $(FT2_LIB) : $(_sources).c ;
|
||||
}
|
||||
|
||||
# end of src/cache Jamfile
|
@@ -1,45 +0,0 @@
|
||||
# FreeType 2 src/cff Jamfile
|
||||
#
|
||||
# Copyright 2001-2016 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
SubDir FT2_TOP $(FT2_SRC_DIR) cff ;
|
||||
|
||||
{
|
||||
local _sources ;
|
||||
|
||||
if $(FT2_MULTI)
|
||||
{
|
||||
_sources = cffcmap
|
||||
cffdrivr
|
||||
cffgload
|
||||
cffload
|
||||
cffobjs
|
||||
cffparse
|
||||
cffpic
|
||||
cf2arrst
|
||||
cf2blues
|
||||
cf2error
|
||||
cf2font
|
||||
cf2ft
|
||||
cf2hints
|
||||
cf2intrp
|
||||
cf2read
|
||||
cf2stack
|
||||
;
|
||||
}
|
||||
else
|
||||
{
|
||||
_sources = cff ;
|
||||
}
|
||||
|
||||
Library $(FT2_LIB) : $(_sources).c ;
|
||||
}
|
||||
|
||||
# end of src/cff Jamfile
|
@@ -1,34 +0,0 @@
|
||||
# FreeType 2 src/cid Jamfile
|
||||
#
|
||||
# Copyright 2001-2016 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
SubDir FT2_TOP $(FT2_SRC_DIR) cid ;
|
||||
|
||||
{
|
||||
local _sources ;
|
||||
|
||||
if $(FT2_MULTI)
|
||||
{
|
||||
_sources = cidgload
|
||||
cidload
|
||||
cidobjs
|
||||
cidparse
|
||||
cidriver
|
||||
;
|
||||
}
|
||||
else
|
||||
{
|
||||
_sources = type1cid ;
|
||||
}
|
||||
|
||||
Library $(FT2_LIB) : $(_sources).c ;
|
||||
}
|
||||
|
||||
# end of src/cid Jamfile
|
@@ -1,52 +0,0 @@
|
||||
# FreeType 2 src/gxvalid Jamfile
|
||||
#
|
||||
# Copyright 2005-2016 by
|
||||
# suzuki toshiya, Masatake YAMATO and Red Hat K.K.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
SubDir FT2_TOP $(FT2_SRC_DIR) gxvalid ;
|
||||
|
||||
|
||||
{
|
||||
local _sources ;
|
||||
|
||||
if $(FT2_MULTI)
|
||||
{
|
||||
_sources = gxvbsln
|
||||
gxvcommn
|
||||
gxvfeat
|
||||
gxvjust
|
||||
gxvkern
|
||||
gxvlcar
|
||||
gxvmod
|
||||
gxvmort
|
||||
gxvmort0
|
||||
gxvmort1
|
||||
gxvmort2
|
||||
gxvmort4
|
||||
gxvmort5
|
||||
gxvmorx
|
||||
gxvmorx0
|
||||
gxvmorx1
|
||||
gxvmorx2
|
||||
gxvmorx4
|
||||
gxvmorx5
|
||||
gxvopbd
|
||||
gxvprop
|
||||
gxvtrak
|
||||
;
|
||||
}
|
||||
else
|
||||
{
|
||||
_sources = gxvalid ;
|
||||
}
|
||||
|
||||
Library $(FT2_LIB) : $(_sources).c ;
|
||||
}
|
||||
|
||||
# end of src/gxvalid Jamfile
|
@@ -1,37 +0,0 @@
|
||||
# FreeType 2 src/otvalid Jamfile
|
||||
#
|
||||
# Copyright 2004-2016 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
SubDir FT2_TOP $(FT2_SRC_DIR) otvalid ;
|
||||
|
||||
{
|
||||
local _sources ;
|
||||
|
||||
if $(FT2_MULTI)
|
||||
{
|
||||
_sources = otvbase
|
||||
otvcommn
|
||||
otvgdef
|
||||
otvgpos
|
||||
otvgsub
|
||||
otvjstf
|
||||
otvmath
|
||||
otvmod
|
||||
;
|
||||
}
|
||||
else
|
||||
{
|
||||
_sources = otvalid ;
|
||||
}
|
||||
|
||||
Library $(FT2_LIB) : $(_sources).c ;
|
||||
}
|
||||
|
||||
# end of src/otvalid Jamfile
|
@@ -1,32 +0,0 @@
|
||||
# FreeType 2 src/pcf Jamfile
|
||||
#
|
||||
# Copyright 2001-2016 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
SubDir FT2_TOP $(FT2_SRC_DIR) pcf ;
|
||||
|
||||
{
|
||||
local _sources ;
|
||||
|
||||
if $(FT2_MULTI)
|
||||
{
|
||||
_sources = pcfdrivr
|
||||
pcfread
|
||||
pcfutil
|
||||
;
|
||||
}
|
||||
else
|
||||
{
|
||||
_sources = pcf ;
|
||||
}
|
||||
|
||||
Library $(FT2_LIB) : $(_sources).c ;
|
||||
}
|
||||
|
||||
# end of src/pcf Jamfile
|
@@ -1,35 +0,0 @@
|
||||
# FreeType 2 src/pfr Jamfile
|
||||
#
|
||||
# Copyright 2002-2016 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
SubDir FT2_TOP $(FT2_SRC_DIR) pfr ;
|
||||
|
||||
{
|
||||
local _sources ;
|
||||
|
||||
if $(FT2_MULTI)
|
||||
{
|
||||
_sources = pfrcmap
|
||||
pfrdrivr
|
||||
pfrgload
|
||||
pfrload
|
||||
pfrobjs
|
||||
pfrsbit
|
||||
;
|
||||
}
|
||||
else
|
||||
{
|
||||
_sources = pfr ;
|
||||
}
|
||||
|
||||
Library $(FT2_LIB) : $(_sources).c ;
|
||||
}
|
||||
|
||||
# end of src/pfr Jamfile
|
@@ -1,35 +0,0 @@
|
||||
# FreeType 2 src/psaux Jamfile
|
||||
#
|
||||
# Copyright 2001-2016 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
SubDir FT2_TOP $(FT2_SRC_DIR) psaux ;
|
||||
|
||||
{
|
||||
local _sources ;
|
||||
|
||||
if $(FT2_MULTI)
|
||||
{
|
||||
_sources = afmparse
|
||||
psauxmod
|
||||
psconv
|
||||
psobjs
|
||||
t1cmap
|
||||
t1decode
|
||||
;
|
||||
}
|
||||
else
|
||||
{
|
||||
_sources = psaux ;
|
||||
}
|
||||
|
||||
Library $(FT2_LIB) : $(_sources).c ;
|
||||
}
|
||||
|
||||
# end of src/psaux Jamfile
|
@@ -1,34 +0,0 @@
|
||||
# FreeType 2 src/pshinter Jamfile
|
||||
#
|
||||
# Copyright 2001-2016 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
SubDir FT2_TOP $(FT2_SRC_DIR) pshinter ;
|
||||
|
||||
{
|
||||
local _sources ;
|
||||
|
||||
if $(FT2_MULTI)
|
||||
{
|
||||
_sources = pshalgo
|
||||
pshglob
|
||||
pshmod
|
||||
pshpic
|
||||
pshrec
|
||||
;
|
||||
}
|
||||
else
|
||||
{
|
||||
_sources = pshinter ;
|
||||
}
|
||||
|
||||
Library $(FT2_LIB) : $(_sources).c ;
|
||||
}
|
||||
|
||||
# end of src/pshinter Jamfile
|
@@ -1,31 +0,0 @@
|
||||
# FreeType 2 src/psnames Jamfile
|
||||
#
|
||||
# Copyright 2001-2016 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
SubDir FT2_TOP $(FT2_SRC_DIR) psnames ;
|
||||
|
||||
{
|
||||
local _sources ;
|
||||
|
||||
if $(FT2_MULTI)
|
||||
{
|
||||
_sources = psmodule
|
||||
pspic
|
||||
;
|
||||
}
|
||||
else
|
||||
{
|
||||
_sources = psnames ;
|
||||
}
|
||||
|
||||
Library $(FT2_LIB) : $(_sources).c ;
|
||||
}
|
||||
|
||||
# end of src/psnames Jamfile
|
@@ -1,32 +0,0 @@
|
||||
# FreeType 2 src/raster Jamfile
|
||||
#
|
||||
# Copyright 2001-2016 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
SubDir FT2_TOP $(FT2_SRC_DIR) raster ;
|
||||
|
||||
{
|
||||
local _sources ;
|
||||
|
||||
if $(FT2_MULTI)
|
||||
{
|
||||
_sources = ftraster
|
||||
ftrend1
|
||||
rastpic
|
||||
;
|
||||
}
|
||||
else
|
||||
{
|
||||
_sources = raster ;
|
||||
}
|
||||
|
||||
Library $(FT2_LIB) : $(_sources).c ;
|
||||
}
|
||||
|
||||
# end of src/raster Jamfile
|
@@ -1,40 +0,0 @@
|
||||
# FreeType 2 src/sfnt Jamfile
|
||||
#
|
||||
# Copyright 2001-2016 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
SubDir FT2_TOP $(FT2_SRC_DIR) sfnt ;
|
||||
|
||||
{
|
||||
local _sources ;
|
||||
|
||||
if $(FT2_MULTI)
|
||||
{
|
||||
_sources = pngshim
|
||||
sfdriver
|
||||
sfntpic
|
||||
sfobjs
|
||||
ttbdf
|
||||
ttcmap
|
||||
ttkern
|
||||
ttload
|
||||
ttmtx
|
||||
ttpost
|
||||
ttsbit
|
||||
;
|
||||
}
|
||||
else
|
||||
{
|
||||
_sources = sfnt ;
|
||||
}
|
||||
|
||||
Library $(FT2_LIB) : $(_sources).c ;
|
||||
}
|
||||
|
||||
# end of src/sfnt Jamfile
|
@@ -1,32 +0,0 @@
|
||||
# FreeType 2 src/smooth Jamfile
|
||||
#
|
||||
# Copyright 2001-2016 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
SubDir FT2_TOP $(FT2_SRC_DIR) smooth ;
|
||||
|
||||
{
|
||||
local _sources ;
|
||||
|
||||
if $(FT2_MULTI)
|
||||
{
|
||||
_sources = ftgrays
|
||||
ftsmooth
|
||||
ftspic
|
||||
;
|
||||
}
|
||||
else
|
||||
{
|
||||
_sources = smooth ;
|
||||
}
|
||||
|
||||
Library $(FT2_LIB) : $(_sources).c ;
|
||||
}
|
||||
|
||||
# end of src/smooth Jamfile
|
@@ -1,37 +0,0 @@
|
||||
# FreeType 2 src/truetype Jamfile
|
||||
#
|
||||
# Copyright 2001-2016 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
SubDir FT2_TOP $(FT2_SRC_DIR) truetype ;
|
||||
|
||||
{
|
||||
local _sources ;
|
||||
|
||||
if $(FT2_MULTI)
|
||||
{
|
||||
_sources = ttdriver
|
||||
ttgload
|
||||
ttgxvar
|
||||
ttinterp
|
||||
ttobjs
|
||||
ttpic
|
||||
ttpload
|
||||
ttsubpix
|
||||
;
|
||||
}
|
||||
else
|
||||
{
|
||||
_sources = truetype ;
|
||||
}
|
||||
|
||||
Library $(FT2_LIB) : $(_sources).c ;
|
||||
}
|
||||
|
||||
# end of src/truetype Jamfile
|
@@ -1,35 +0,0 @@
|
||||
# FreeType 2 src/type1 Jamfile
|
||||
#
|
||||
# Copyright 2001-2016 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
SubDir FT2_TOP $(FT2_SRC_DIR) type1 ;
|
||||
|
||||
{
|
||||
local _sources ;
|
||||
|
||||
if $(FT2_MULTI)
|
||||
{
|
||||
_sources = t1afm
|
||||
t1driver
|
||||
t1gload
|
||||
t1load
|
||||
t1objs
|
||||
t1parse
|
||||
;
|
||||
}
|
||||
else
|
||||
{
|
||||
_sources = type1 ;
|
||||
}
|
||||
|
||||
Library $(FT2_LIB) : $(_sources).c ;
|
||||
}
|
||||
|
||||
# end of src/type1 Jamfile
|
@@ -1,32 +0,0 @@
|
||||
# FreeType 2 src/type42 Jamfile
|
||||
#
|
||||
# Copyright 2002-2016 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
SubDir FT2_TOP $(FT2_SRC_DIR) type42 ;
|
||||
|
||||
{
|
||||
local _sources ;
|
||||
|
||||
if $(FT2_MULTI)
|
||||
{
|
||||
_sources = t42drivr
|
||||
t42objs
|
||||
t42parse
|
||||
;
|
||||
}
|
||||
else
|
||||
{
|
||||
_sources = type42 ;
|
||||
}
|
||||
|
||||
Library $(FT2_LIB) : $(_sources).c ;
|
||||
}
|
||||
|
||||
# end of src/type42 Jamfile
|
@@ -1,16 +0,0 @@
|
||||
# FreeType 2 src/winfonts Jamfile
|
||||
#
|
||||
# Copyright 2001-2016 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
SubDir FT2_TOP $(FT2_SRC_DIR) winfonts ;
|
||||
|
||||
Library $(FT2_LIB) : winfnt.c ;
|
||||
|
||||
# end of src/winfonts Jamfile
|
@@ -1,11 +1,23 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
Import('env')
|
||||
|
||||
env.add_source_files(env.drivers_sources,"*.cpp")
|
||||
if (env["platform"] in ["haiku", "osx", "windows", "x11"]):
|
||||
# Thirdparty source files
|
||||
if (env['builtin_glew'] != 'no'): # builtin
|
||||
thirdparty_dir = "#thirdparty/glew/"
|
||||
thirdparty_sources = [
|
||||
"glew.c",
|
||||
]
|
||||
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
|
||||
|
||||
if (env.get('glew') == 'yes'):
|
||||
env.add_source_files(env.drivers_sources,"glew.c")
|
||||
env.Append(CPPFLAGS = ['-DGLEW_ENABLED'])
|
||||
env.Append(CPPFLAGS = ['-DGLEW_STATIC'])
|
||||
env.Append(CPPPATH = ['.'])
|
||||
env.add_source_files(env.drivers_sources, thirdparty_sources)
|
||||
env.Append(CPPFLAGS=['-DGLEW_STATIC'])
|
||||
env.Append(CPPPATH=[thirdparty_dir])
|
||||
|
||||
env.Append(CPPFLAGS=['-DGLEW_ENABLED'])
|
||||
|
||||
# Godot source files
|
||||
env.add_source_files(env.drivers_sources, "*.cpp")
|
||||
|
||||
Export('env')
|
||||
|
@@ -1,5 +1,9 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
Import('env')
|
||||
|
||||
env.add_source_files(env.drivers_sources,"*.cpp")
|
||||
env.add_source_files(env.drivers_sources, "*.cpp")
|
||||
|
||||
SConscript("shaders/SCsub")
|
||||
|
||||
Export('env')
|
||||
|
@@ -36,6 +36,7 @@
|
||||
#include "servers/visual/particle_system_sw.h"
|
||||
#include "gl_context/context_gl.h"
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef GLEW_ENABLED
|
||||
#define _GL_HALF_FLOAT_OES 0x140B
|
||||
@@ -1998,7 +1999,6 @@ void RasterizerGLES2::mesh_add_surface(RID p_mesh,VS::PrimitiveType p_primitive,
|
||||
if (use_VBO) {
|
||||
|
||||
elem_size=VS::ARRAY_WEIGHTS_SIZE*sizeof(GLushort);
|
||||
elem_count=VS::ARRAY_WEIGHTS_SIZE;
|
||||
valid_local=false;
|
||||
bind=true;
|
||||
normalize=true;
|
||||
@@ -2007,7 +2007,6 @@ void RasterizerGLES2::mesh_add_surface(RID p_mesh,VS::PrimitiveType p_primitive,
|
||||
|
||||
} else {
|
||||
elem_size=VS::ARRAY_WEIGHTS_SIZE*sizeof(GLfloat);
|
||||
elem_count=VS::ARRAY_WEIGHTS_SIZE;
|
||||
valid_local=false;
|
||||
bind=false;
|
||||
datatype=GL_FLOAT;
|
||||
@@ -2019,7 +2018,6 @@ void RasterizerGLES2::mesh_add_surface(RID p_mesh,VS::PrimitiveType p_primitive,
|
||||
|
||||
if (use_VBO) {
|
||||
elem_size=VS::ARRAY_WEIGHTS_SIZE*sizeof(GLubyte);
|
||||
elem_count=VS::ARRAY_WEIGHTS_SIZE;
|
||||
valid_local=false;
|
||||
bind=true;
|
||||
datatype=GL_UNSIGNED_BYTE;
|
||||
@@ -2027,7 +2025,6 @@ void RasterizerGLES2::mesh_add_surface(RID p_mesh,VS::PrimitiveType p_primitive,
|
||||
} else {
|
||||
|
||||
elem_size=VS::ARRAY_WEIGHTS_SIZE*sizeof(GLushort);
|
||||
elem_count=VS::ARRAY_WEIGHTS_SIZE;
|
||||
valid_local=false;
|
||||
bind=false;
|
||||
datatype=GL_UNSIGNED_SHORT;
|
||||
@@ -4666,7 +4663,7 @@ void RasterizerGLES2::_update_shader( Shader* p_shader) const {
|
||||
enablers.push_back("#define USE_LIGHT_SHADER_CODE\n");
|
||||
}
|
||||
if (light_flags.uses_shadow_color) {
|
||||
enablers.push_back("#define USE_LIGHT_SHADOW_COLOR\n");
|
||||
enablers.push_back("#define USE_OUTPUT_SHADOW_COLOR\n");
|
||||
}
|
||||
if (light_flags.uses_time || fragment_flags.uses_time || vertex_flags.uses_time) {
|
||||
enablers.push_back("#define USE_TIME\n");
|
||||
@@ -4709,7 +4706,7 @@ void RasterizerGLES2::_update_shader( Shader* p_shader) const {
|
||||
enablers.push_back("#define USE_TEXPIXEL_SIZE\n");
|
||||
}
|
||||
if (light_flags.uses_shadow_color) {
|
||||
enablers.push_back("#define USE_LIGHT_SHADOW_COLOR\n");
|
||||
enablers.push_back("#define USE_OUTPUT_SHADOW_COLOR\n");
|
||||
}
|
||||
|
||||
if (vertex_flags.uses_worldvec) {
|
||||
@@ -5460,9 +5457,16 @@ void RasterizerGLES2::_setup_light(uint16_t p_light) {
|
||||
}
|
||||
|
||||
|
||||
light_data[VL_LIGHT_ATTENUATION][0]=l->vars[VS::LIGHT_PARAM_ENERGY];
|
||||
light_data[VL_LIGHT_ATTENUATION][1]=l->vars[VS::LIGHT_PARAM_RADIUS];
|
||||
light_data[VL_LIGHT_ATTENUATION][2]=l->vars[VS::LIGHT_PARAM_ATTENUATION];
|
||||
light_data[VL_LIGHT_ATTENUATION][0] = l->vars[VS::LIGHT_PARAM_ENERGY];
|
||||
|
||||
if (l->type == VS::LIGHT_DIRECTIONAL) {
|
||||
light_data[VL_LIGHT_ATTENUATION][1] = l->directional_shadow_param[VS::LIGHT_DIRECTIONAL_SHADOW_PARAM_MAX_DISTANCE];
|
||||
}
|
||||
else{
|
||||
light_data[VL_LIGHT_ATTENUATION][1] = l->vars[VS::LIGHT_PARAM_RADIUS];
|
||||
}
|
||||
|
||||
light_data[VL_LIGHT_ATTENUATION][2] = l->vars[VS::LIGHT_PARAM_ATTENUATION];
|
||||
|
||||
light_data[VL_LIGHT_SPOT_ATTENUATION][0]=Math::cos(Math::deg2rad(l->vars[VS::LIGHT_PARAM_SPOT_ANGLE]));
|
||||
light_data[VL_LIGHT_SPOT_ATTENUATION][1]=l->vars[VS::LIGHT_PARAM_SPOT_ATTENUATION];
|
||||
@@ -7008,6 +7012,10 @@ void RasterizerGLES2::_process_glow_bloom() {
|
||||
|
||||
void RasterizerGLES2::_process_hdr() {
|
||||
|
||||
if (framebuffer.luminance.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, framebuffer.luminance[0].fbo);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D, framebuffer.color );
|
||||
@@ -10789,14 +10797,52 @@ void RasterizerGLES2::init() {
|
||||
print_line(String("GLES2: Using GLEW ") + (const char*) glewGetString(GLEW_VERSION));
|
||||
}
|
||||
|
||||
// Godot makes use of functions from ARB_framebuffer_object extension which is not implemented by all drivers.
|
||||
// On the other hand, these drivers might implement the older EXT_framebuffer_object extension
|
||||
// with which current source code is backward compatible.
|
||||
|
||||
bool framebuffer_object_is_supported = glewIsSupported("GL_ARB_framebuffer_object");
|
||||
|
||||
if ( !framebuffer_object_is_supported ) {
|
||||
WARN_PRINT("GL_ARB_framebuffer_object not supported by your graphics card.");
|
||||
|
||||
if ( glewIsSupported("GL_EXT_framebuffer_object") ) {
|
||||
// falling-back to the older EXT function if present
|
||||
WARN_PRINT("Falling-back to GL_EXT_framebuffer_object.");
|
||||
|
||||
glIsRenderbuffer = glIsRenderbufferEXT;
|
||||
glBindRenderbuffer = glBindRenderbufferEXT;
|
||||
glDeleteRenderbuffers = glDeleteRenderbuffersEXT;
|
||||
glGenRenderbuffers = glGenRenderbuffersEXT;
|
||||
glRenderbufferStorage = glRenderbufferStorageEXT;
|
||||
glGetRenderbufferParameteriv = glGetRenderbufferParameterivEXT;
|
||||
glIsFramebuffer = glIsFramebufferEXT;
|
||||
glBindFramebuffer = glBindFramebufferEXT;
|
||||
glDeleteFramebuffers = glDeleteFramebuffersEXT;
|
||||
glGenFramebuffers = glGenFramebuffersEXT;
|
||||
glCheckFramebufferStatus = glCheckFramebufferStatusEXT;
|
||||
glFramebufferTexture1D = glFramebufferTexture1DEXT;
|
||||
glFramebufferTexture2D = glFramebufferTexture2DEXT;
|
||||
glFramebufferTexture3D = glFramebufferTexture3DEXT;
|
||||
glFramebufferRenderbuffer = glFramebufferRenderbufferEXT;
|
||||
glGetFramebufferAttachmentParameteriv = glGetFramebufferAttachmentParameterivEXT;
|
||||
glGenerateMipmap = glGenerateMipmapEXT;
|
||||
|
||||
framebuffer_object_is_supported = true;
|
||||
}
|
||||
else {
|
||||
ERR_PRINT("Framebuffer Object is not supported by your graphics card.");
|
||||
}
|
||||
}
|
||||
|
||||
// Check for GL 2.1 compatibility, if not bail out
|
||||
if (!glewIsSupported("GL_VERSION_2_1")) {
|
||||
if (!(glewIsSupported("GL_VERSION_2_1") && framebuffer_object_is_supported)) {
|
||||
ERR_PRINT("Your system's graphic drivers seem not to support OpenGL 2.1 / GLES 2.0, sorry :(\n"
|
||||
"Try a drivers update, buy a new GPU or try software rendering on Linux; Godot will now crash with a segmentation fault.");
|
||||
"Try a drivers update, buy a new GPU or try software rendering on Linux; Godot is now going to terminate.");
|
||||
OS::get_singleton()->alert("Your system's graphic drivers seem not to support OpenGL 2.1 / GLES 2.0, sorry :(\n"
|
||||
"Godot Engine will self-destruct as soon as you acknowledge this error message.",
|
||||
"Fatal error: Insufficient OpenGL / GLES drivers");
|
||||
// TODO: If it's even possible, we should stop the execution without segfault and memory leaks :)
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@@ -904,6 +904,7 @@ ShaderCompilerGLES2::ShaderCompilerGLES2() {
|
||||
mode_replace_table[ShaderLanguage::SHADER_CANVAS_ITEM_LIGHT]["LIGHT_VEC"]="light_vec";
|
||||
mode_replace_table[ShaderLanguage::SHADER_CANVAS_ITEM_LIGHT]["LIGHT_HEIGHT"]="light_height";
|
||||
mode_replace_table[ShaderLanguage::SHADER_CANVAS_ITEM_LIGHT]["LIGHT_COLOR"]="light";
|
||||
mode_replace_table[ShaderLanguage::SHADER_CANVAS_ITEM_LIGHT]["LIGHT_SHADOW"]="light_shadow_color";
|
||||
mode_replace_table[ShaderLanguage::SHADER_CANVAS_ITEM_LIGHT]["LIGHT_UV"]="light_uv";
|
||||
mode_replace_table[ShaderLanguage::SHADER_CANVAS_ITEM_LIGHT]["LIGHT"]="light_out";
|
||||
mode_replace_table[ShaderLanguage::SHADER_CANVAS_ITEM_LIGHT]["SHADOW"]="shadow_color";
|
||||
|
@@ -1,8 +1,12 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
Import('env')
|
||||
|
||||
if env['BUILDERS'].has_key('GLSL120GLES'):
|
||||
env.GLSL120GLES('material.glsl');
|
||||
env.GLSL120GLES('canvas.glsl');
|
||||
env.GLSL120GLES('canvas_shadow.glsl');
|
||||
env.GLSL120GLES('blur.glsl');
|
||||
env.GLSL120GLES('copy.glsl');
|
||||
env.GLSL120GLES('material.glsl')
|
||||
env.GLSL120GLES('canvas.glsl')
|
||||
env.GLSL120GLES('canvas_shadow.glsl')
|
||||
env.GLSL120GLES('blur.glsl')
|
||||
env.GLSL120GLES('copy.glsl')
|
||||
|
||||
Export('env')
|
||||
|
@@ -244,7 +244,7 @@ FRAGMENT_SHADER_CODE
|
||||
|
||||
vec2 light_uv = light_uv_interp.xy;
|
||||
vec4 light = texture2D(light_texture,light_uv) * light_color;
|
||||
#if defined(USE_LIGHT_SHADOW_COLOR)
|
||||
#if defined(USE_OUTPUT_SHADOW_COLOR)
|
||||
vec4 shadow_color=vec4(0.0,0.0,0.0,0.0);
|
||||
#endif
|
||||
|
||||
@@ -380,7 +380,7 @@ LIGHT_SHADER_CODE
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(USE_LIGHT_SHADOW_COLOR)
|
||||
#if defined(USE_OUTPUT_SHADOW_COLOR)
|
||||
color=mix(shadow_color,color,shadow_attenuation);
|
||||
#else
|
||||
//color*=shadow_attenuation;
|
||||
|
@@ -976,6 +976,12 @@ FRAGMENT_SHADER_CODE
|
||||
#ifdef LIGHT_USE_SHADOW
|
||||
#ifdef LIGHT_TYPE_DIRECTIONAL
|
||||
|
||||
float shadow_fade_exponent=5.0; //hardcoded for now
|
||||
float shadow_fade=pow(length(vertex_interp)/light_attenuation.g,shadow_fade_exponent);
|
||||
|
||||
// optimization - skip shadows outside visible range
|
||||
if(shadow_fade<1.0){
|
||||
|
||||
#ifdef LIGHT_USE_PSSM
|
||||
|
||||
|
||||
@@ -1101,6 +1107,12 @@ FRAGMENT_SHADER_CODE
|
||||
|
||||
shadow_attenuation=SAMPLE_SHADOW_TEX(shadow_coord.xy,shadow_coord.z);
|
||||
#endif
|
||||
|
||||
shadow_attenuation=mix(shadow_attenuation,1.0,shadow_fade);
|
||||
}else{
|
||||
shadow_attenuation=1.0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef LIGHT_TYPE_OMNI
|
||||
@@ -1181,7 +1193,7 @@ FRAGMENT_SHADER_CODE
|
||||
vec3 mdiffuse = diffuse.rgb;
|
||||
vec3 light;
|
||||
|
||||
#if defined(USE_LIGHT_SHADOW_COLOR)
|
||||
#if defined(USE_OUTPUT_SHADOW_COLOR)
|
||||
vec3 shadow_color=vec3(0.0,0.0,0.0);
|
||||
#endif
|
||||
|
||||
@@ -1205,7 +1217,7 @@ LIGHT_SHADER_CODE
|
||||
#endif
|
||||
diffuse.rgb = const_light_mult * ambient_light *diffuse.rgb + light * attenuation * shadow_attenuation;
|
||||
|
||||
#if defined(USE_LIGHT_SHADOW_COLOR)
|
||||
#if defined(USE_OUTPUT_SHADOW_COLOR)
|
||||
diffuse.rgb += light * shadow_color * attenuation * (1.0 - shadow_attenuation);
|
||||
#endif
|
||||
|
||||
|
@@ -1,11 +0,0 @@
|
||||
Import('env')
|
||||
|
||||
|
||||
jpg_sources = [
|
||||
"jpegd/jpgd.cpp",
|
||||
"jpegd/image_loader_jpegd.cpp"
|
||||
]
|
||||
|
||||
env.drivers_sources+=jpg_sources
|
||||
|
||||
#env.add_source_files(env.drivers_sources, jpg_sources)
|
@@ -1,21 +0,0 @@
|
||||
Import('env')
|
||||
|
||||
|
||||
mpc_sources = [
|
||||
"mpc/huffman.c",
|
||||
"mpc/mpc_bits_reader.c",
|
||||
"mpc/mpc_decoder.c",
|
||||
"mpc/mpc_demux.c",
|
||||
"mpc/mpc_reader.c",
|
||||
"mpc/requant.c",
|
||||
"mpc/streaminfo.c",
|
||||
"mpc/synth_filter.c",
|
||||
]
|
||||
|
||||
env.drivers_sources+=mpc_sources
|
||||
|
||||
env.add_source_files(env.drivers_sources,"*.cpp")
|
||||
|
||||
#env.add_source_files(env.drivers_sources, mpc_sources)
|
||||
|
||||
Export('env')
|
@@ -1,23 +0,0 @@
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
Permission is hereby granted, free of charge, to any person or organization
|
||||
obtaining a copy of the software and accompanying documentation covered by
|
||||
this license (the "Software") to use, reproduce, display, distribute,
|
||||
execute, and transmit the Software, and to prepare derivative works of the
|
||||
Software, and to permit third-parties to whom the Software is furnished to
|
||||
do so, all subject to the following:
|
||||
|
||||
The copyright notices in the Software and this entire statement, including
|
||||
the above license grant, this restriction and the following disclaimer,
|
||||
must be included in all copies of the Software, in whole or in part, and
|
||||
all derivative works of the Software, unless such copies or derivative
|
||||
works are solely in the form of machine-executable object code generated by
|
||||
a source language processor.
|
||||
|
||||
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, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
@@ -1,136 +0,0 @@
|
||||
nedalloc v1.05 15th June 2008:
|
||||
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
|
||||
by Niall Douglas (http://www.nedprod.com/programs/portable/nedmalloc/)
|
||||
|
||||
Enclosed is nedalloc, an alternative malloc implementation for multiple
|
||||
threads without lock contention based on dlmalloc v2.8.4. It is more
|
||||
or less a newer implementation of ptmalloc2, the standard allocator in
|
||||
Linux (which is based on dlmalloc v2.7.0) but also contains a per-thread
|
||||
cache for maximum CPU scalability.
|
||||
|
||||
It is licensed under the Boost Software License which basically means
|
||||
you can do anything you like with it. This does not apply to the malloc.c.h
|
||||
file which remains copyright to others.
|
||||
|
||||
It has been tested on win32 (x86), win64 (x64), Linux (x64), FreeBSD (x64)
|
||||
and Apple MacOS X (x86). It works very well on all of these and is very
|
||||
significantly faster than the system allocator on all of these platforms.
|
||||
|
||||
By literally dropping in this allocator as a replacement for your system
|
||||
allocator, you can see real world improvements of up to three times in normal
|
||||
code!
|
||||
|
||||
To use:
|
||||
-=-=-=-
|
||||
Drop in nedmalloc.h, nedmalloc.c and malloc.c.h into your project.
|
||||
Configure using the instructions in nedmalloc.h. Run and enjoy.
|
||||
|
||||
To test, compile test.c. It will run a comparison between your system
|
||||
allocator and nedalloc and tell you how much faster nedalloc is. It also
|
||||
serves as an example of usage.
|
||||
|
||||
Notes:
|
||||
-=-=-=
|
||||
If you want the very latest version of this allocator, get it from the
|
||||
TnFOX SVN repository at svn://svn.berlios.de/viewcvs/tnfox/trunk/src/nedmalloc
|
||||
|
||||
Because of how nedalloc allocates an mspace per thread, it can cause
|
||||
severe bloating of memory usage under certain allocation patterns.
|
||||
You can substantially reduce this wastage by setting MAXTHREADSINPOOL
|
||||
or the threads parameter to nedcreatepool() to a fraction of the number of
|
||||
threads which would normally be in a pool at once. This will reduce
|
||||
bloating at the cost of an increase in lock contention. If allocated size
|
||||
is less than THREADCACHEMAX, locking is avoided 90-99% of the time and
|
||||
if most of your allocations are below this value, you can safely set
|
||||
MAXTHREADSINPOOL to one.
|
||||
|
||||
You will suffer memory leakage unless you call neddisablethreadcache()
|
||||
per pool for every thread which exits. This is because nedalloc cannot
|
||||
portably know when a thread exits and thus when its thread cache can
|
||||
be returned for use by other code. Don't forget pool zero, the system pool.
|
||||
|
||||
For C++ type allocation patterns (where the same sizes of memory are
|
||||
regularly allocated and deallocated as objects are created and destroyed),
|
||||
the threadcache always benefits performance. If however your allocation
|
||||
patterns are different, searching the threadcache may significantly slow
|
||||
down your code - as a rule of thumb, if cache utilisation is below 80%
|
||||
(see the source for neddisablethreadcache() for how to enable debug
|
||||
printing in release mode) then you should disable the thread cache for
|
||||
that thread. You can compile out the threadcache code by setting
|
||||
THREADCACHEMAX to zero.
|
||||
|
||||
Speed comparisons:
|
||||
-=-=-=-=-=-=-=-=-=
|
||||
See Benchmarks.xls for details.
|
||||
|
||||
The enclosed test.c can do two things: it can be a torture test or a speed
|
||||
test. The speed test is designed to be a representative synthetic
|
||||
memory allocator test. It works by randomly mixing allocations with frees
|
||||
with half of the allocation sizes being a two power multiple less than
|
||||
512 bytes (to mimic C++ stack instantiated objects) and the other half
|
||||
being a simple random value less than 16Kb.
|
||||
|
||||
The real world code results are from Tn's TestIO benchmark. This is a
|
||||
heavily multithreaded and memory intensive benchmark with a lot of branching
|
||||
and other stuff modern processors don't like so much. As you'll note, the
|
||||
test doesn't show the benefits of the threadcache mostly due to the saturation
|
||||
of the memory bus being the limiting factor.
|
||||
|
||||
ChangeLog:
|
||||
-=-=-=-=-=
|
||||
v1.05 15th June 2008:
|
||||
* { 1042 } Added error check for TLSSET() and TLSFREE() macros. Thanks to
|
||||
Markus Elfring for reporting this.
|
||||
* { 1043 } Fixed a segfault when freeing memory allocated using
|
||||
nedindependent_comalloc(). Thanks to Pavel Vozenilek for reporting this.
|
||||
|
||||
v1.04 14th July 2007:
|
||||
* Fixed a bug with the new optimised implementation that failed to lock
|
||||
on a realloc under certain conditions.
|
||||
* Fixed lack of thread synchronisation in InitPool() causing pool corruption
|
||||
* Fixed a memory leak of thread cache contents on disabling. Thanks to Earl
|
||||
Chew for reporting this.
|
||||
* Added a sanity check for freed blocks being valid.
|
||||
* Reworked test.c into being a torture test.
|
||||
* Fixed GCC assembler optimisation misspecification
|
||||
|
||||
v1.04alpha_svn915 7th October 2006:
|
||||
* Fixed failure to unlock thread cache list if allocating a new list failed.
|
||||
Thanks to Dmitry Chichkov for reporting this. Futher thanks to Aleksey Sanin.
|
||||
* Fixed realloc(0, <size>) segfaulting. Thanks to Dmitry Chichkov for
|
||||
reporting this.
|
||||
* Made config defines #ifndef so they can be overriden by the build system.
|
||||
Thanks to Aleksey Sanin for suggesting this.
|
||||
* Fixed deadlock in nedprealloc() due to unnecessary locking of preferred
|
||||
thread mspace when mspace_realloc() always uses the original block's mspace
|
||||
anyway. Thanks to Aleksey Sanin for reporting this.
|
||||
* Made some speed improvements by hacking mspace_malloc() to no longer lock
|
||||
its mspace, thus allowing the recursive mutex implementation to be removed
|
||||
with an associated speed increase. Thanks to Aleksey Sanin for suggesting this.
|
||||
* Fixed a bug where allocating mspaces overran its max limit. Thanks to
|
||||
Aleksey Sanin for reporting this.
|
||||
|
||||
v1.03 10th July 2006:
|
||||
* Fixed memory corruption bug in threadcache code which only appeared with >4
|
||||
threads and in heavy use of the threadcache.
|
||||
|
||||
v1.02 15th May 2006:
|
||||
* Integrated dlmalloc v2.8.4, fixing the win32 memory release problem and
|
||||
improving performance still further. Speed is now up to twice the speed of v1.01
|
||||
(average is 67% faster).
|
||||
* Fixed win32 critical section implementation. Thanks to Pavel Kuznetsov
|
||||
for reporting this.
|
||||
* Wasn't locking mspace if all mspaces were locked. Thanks to Pavel Kuznetsov
|
||||
for reporting this.
|
||||
* Added Apple Mac OS X support.
|
||||
|
||||
v1.01 24th February 2006:
|
||||
* Fixed multiprocessor scaling problems by removing sources of cache sloshing
|
||||
* Earl Chew <earl_chew <at> agilent <dot> com> sent patches for the following:
|
||||
1. size2binidx() wasn't working for default code path (non x86)
|
||||
2. Fixed failure to release mspace lock under certain circumstances which
|
||||
caused a deadlock
|
||||
|
||||
v1.00 1st January 2006:
|
||||
* First release
|
@@ -1,4 +0,0 @@
|
||||
Import('env')
|
||||
Export('env');
|
||||
|
||||
env.add_source_files(env.drivers_sources,"*.cpp")
|
File diff suppressed because it is too large
Load Diff
@@ -1,163 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* memory_pool_static_nedmalloc.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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. */
|
||||
/*************************************************************************/
|
||||
#ifdef NEDMALLOC_ENABLED
|
||||
|
||||
//
|
||||
// C++ Implementation: memory_static_malloc
|
||||
//
|
||||
// Description:
|
||||
//
|
||||
//
|
||||
// Author: Juan Linietsky <red@lunatea>, (C) 2006
|
||||
//
|
||||
// Copyright: See COPYING file that comes with this distribution
|
||||
//
|
||||
//
|
||||
#include "memory_pool_static_nedmalloc.h"
|
||||
#include "error_macros.h"
|
||||
#include "os/memory.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "os/copymem.h"
|
||||
#include "os/os.h"
|
||||
|
||||
#include "nedmalloc.h"
|
||||
|
||||
/**
|
||||
* NOTE NOTE NOTE NOTE
|
||||
* in debug mode, this appends the memory size before the allocated, returned pointer
|
||||
* so BE CAREFUL!
|
||||
*/
|
||||
|
||||
void* MemoryPoolStaticNedMalloc::alloc(size_t p_bytes,const char *p_description) {
|
||||
|
||||
ERR_FAIL_COND_V(p_bytes==0,0);
|
||||
|
||||
MutexLock lock(mutex);
|
||||
|
||||
void *mem=nedalloc::nedmalloc(p_bytes);
|
||||
|
||||
ERR_FAIL_COND_V(!mem,0); //out of memory, or unreasonable request
|
||||
return mem;
|
||||
}
|
||||
|
||||
|
||||
void* MemoryPoolStaticNedMalloc::realloc(void *p_memory,size_t p_bytes) {
|
||||
|
||||
if (p_memory==NULL) {
|
||||
|
||||
return alloc( p_bytes );
|
||||
}
|
||||
|
||||
if (p_bytes<=0) {
|
||||
|
||||
this->free(p_memory);
|
||||
ERR_FAIL_COND_V( p_bytes < 0 , NULL );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MutexLock lock(mutex);
|
||||
|
||||
return nedalloc::nedrealloc( p_memory, p_bytes );
|
||||
}
|
||||
|
||||
void MemoryPoolStaticNedMalloc::free(void *p_ptr) {
|
||||
|
||||
MutexLock lock(mutex);
|
||||
|
||||
ERR_FAIL_COND(p_ptr==0);
|
||||
|
||||
nedalloc::nedfree(p_ptr);
|
||||
}
|
||||
|
||||
|
||||
size_t MemoryPoolStaticNedMalloc::get_available_mem() const {
|
||||
|
||||
return 0xffffffff;
|
||||
}
|
||||
|
||||
size_t MemoryPoolStaticNedMalloc::get_total_usage() {
|
||||
|
||||
return nedalloc::nedmalloc_footprint();
|
||||
}
|
||||
|
||||
/* Most likely available only if memory debugger was compiled in */
|
||||
int MemoryPoolStaticNedMalloc::get_alloc_count() {
|
||||
|
||||
return 0;
|
||||
}
|
||||
void * MemoryPoolStaticNedMalloc::get_alloc_ptr(int p_alloc_idx) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
const char* MemoryPoolStaticNedMalloc::get_alloc_description(int p_alloc_idx) {
|
||||
|
||||
|
||||
return "";
|
||||
}
|
||||
size_t MemoryPoolStaticNedMalloc::get_alloc_size(int p_alloc_idx) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void MemoryPoolStaticNedMalloc::debug_print_all_memory() {
|
||||
|
||||
nedalloc::nedmalloc_stats();
|
||||
}
|
||||
|
||||
MemoryPoolStaticNedMalloc::MemoryPoolStaticNedMalloc() {
|
||||
|
||||
mutex=NULL;
|
||||
#ifndef NO_THREADS
|
||||
|
||||
mutex=Mutex::create(); // at this point, this should work
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
MemoryPoolStaticNedMalloc::~MemoryPoolStaticNedMalloc() {
|
||||
|
||||
Mutex *old_mutex=mutex;
|
||||
mutex=NULL;
|
||||
if (old_mutex)
|
||||
memdelete(old_mutex);
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
|
||||
if (OS::get_singleton()->is_stdout_verbose())
|
||||
nedalloc::nedmalloc_stats();
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user