dalexeev / gdscript-preprocessor Goto Github PK
View Code? Open in Web Editor NEWAn export plugin for stripping comments and "conditional compilation" of GDScript.
License: MIT License
An export plugin for stripping comments and "conditional compilation" of GDScript.
License: MIT License
I tried an executable build and it just crashes on loading a scene with the plugin enabled, the executable works if I turn the plugin off though. I've not done much building with godot yet so I need to figure out how to debug executables, but it seems strange it would do this as it should only be stripping comments?
So I have the follow code:
func _ready() ->void:
#~if OS.is_debug_build()
var c = 0
var b = 0;
var is_debug = OS.is_debug_build()
var t1 = Time.get_ticks_usec()
while c < 1000000:
if is_debug:
b += 1
else:
b -= 1
c += 1
print(Time.get_ticks_usec() - t1)
print(b)
#~endif
SignalManager.main_hud_action_selected.connect(on_main_hud_action_selected)
SignalManager.main_hud_consumable_select.connect(on_main_hud_consumable_select)
but when I export the project with the Export With Debug
unchecked and unpack the pck file, the code looks like this:
func _ready() ->void:
var c = 0
var b = 0;
var is_debug = OS.is_debug_build()
var t1 = Time.get_ticks_usec()
while c < 1000000:
if is_debug:
b += 1
else:
b -= 1
c += 1
print(Time.get_ticks_usec() - t1)
print(b)
SignalManager.main_hud_action_selected.connect(on_main_hud_action_selected)
SignalManager.main_hud_consumable_select.connect(on_main_hud_consumable_select)
I am not sure why only comments are bring stripped out. I would expect the conditional block to be stripped. I did not change any of the setting in the export dialog and I restarted the editor after enabling the plugin to make sure that was good.
I also tried using #~if OS.has_feature("editor")
(which I assume should be stripped regardless of it being in debug mode) and got the same result.
Love this plugin, works really well when I tested with GodotRE. I was wondering, would it be possible to replace all print() with pass? This way, no print debug messages would be exported, but functions that use them wouldn't break. Either that, or all print("") strings could be cleared to ""?
Since you simplify Engine.is_editor_hint()
calls, you can also get rid of @tool
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.