From 835d053c003aef4f5883e558491c8952db1e2f99 Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Wed, 10 Jan 2024 00:41:27 +0100 Subject: [PATCH] Add script to update icons in the extension config --- gdextension/limboai.gdextension | 56 ++++++++++++++++++++++++++++++++- gdextension/update_icons.py | 39 +++++++++++++++++++++++ 2 files changed, 94 insertions(+), 1 deletion(-) create mode 100755 gdextension/update_icons.py diff --git a/gdextension/limboai.gdextension b/gdextension/limboai.gdextension index 1e97d7b..567ddc8 100644 --- a/gdextension/limboai.gdextension +++ b/gdextension/limboai.gdextension @@ -24,4 +24,58 @@ android.release.arm64 = "res://addons/limboai/bin/liblimboai.android.template_re [icons] -GDExample = "res://icons/gd_example.svg" +BTAction = "res://addons/limboai/icons/BTAction.svg" +BTAlwaysFail = "res://addons/limboai/icons/BTAlwaysFail.svg" +BTAlwaysSucceed = "res://addons/limboai/icons/BTAlwaysSucceed.svg" +BTAwaitAnimation = "res://addons/limboai/icons/BTAwaitAnimation.svg" +BTCallMethod = "res://addons/limboai/icons/BTCallMethod.svg" +BTCheckAgentProperty = "res://addons/limboai/icons/BTCheckAgentProperty.svg" +BTCheckTrigger = "res://addons/limboai/icons/BTCheckTrigger.svg" +BTCheckVar = "res://addons/limboai/icons/BTCheckVar.svg" +BTComment = "res://addons/limboai/icons/BTComment.svg" +BTCondition = "res://addons/limboai/icons/BTCondition.svg" +BTConsolePrint = "res://addons/limboai/icons/BTConsolePrint.svg" +BTCooldown = "res://addons/limboai/icons/BTCooldown.svg" +BTDecorator = "res://addons/limboai/icons/BTDecorator.svg" +BTDelay = "res://addons/limboai/icons/BTDelay.svg" +BTDynamicSelector = "res://addons/limboai/icons/BTDynamicSelector.svg" +BTDynamicSequence = "res://addons/limboai/icons/BTDynamicSequence.svg" +BTFail = "res://addons/limboai/icons/BTFail.svg" +BTForEach = "res://addons/limboai/icons/BTForEach.svg" +BTInvert = "res://addons/limboai/icons/BTInvert.svg" +BTNewScope = "res://addons/limboai/icons/BTNewScope.svg" +BTParallel = "res://addons/limboai/icons/BTParallel.svg" +BTPauseAnimation = "res://addons/limboai/icons/BTPauseAnimation.svg" +BTPlayAnimation = "res://addons/limboai/icons/BTPlayAnimation.svg" +BTPlayer = "res://addons/limboai/icons/BTPlayer.svg" +BTProbability = "res://addons/limboai/icons/BTProbability.svg" +BTProbabilitySelector = "res://addons/limboai/icons/BTProbabilitySelector.svg" +BTRandomSelector = "res://addons/limboai/icons/BTRandomSelector.svg" +BTRandomSequence = "res://addons/limboai/icons/BTRandomSequence.svg" +BTRandomWait = "res://addons/limboai/icons/BTRandomWait.svg" +BTRepeat = "res://addons/limboai/icons/BTRepeat.svg" +BTRepeatUntilFailure = "res://addons/limboai/icons/BTRepeatUntilFailure.svg" +BTRepeatUntilSuccess = "res://addons/limboai/icons/BTRepeatUntilSuccess.svg" +BTRunLimit = "res://addons/limboai/icons/BTRunLimit.svg" +BTSelector = "res://addons/limboai/icons/BTSelector.svg" +BTSequence = "res://addons/limboai/icons/BTSequence.svg" +BTSetAgentProperty = "res://addons/limboai/icons/BTSetAgentProperty.svg" +BTSetVar = "res://addons/limboai/icons/BTSetVar.svg" +BTState = "res://addons/limboai/icons/BTState.svg" +BTStopAnimation = "res://addons/limboai/icons/BTStopAnimation.svg" +BTSubtree = "res://addons/limboai/icons/BTSubtree.svg" +BTTimeLimit = "res://addons/limboai/icons/BTTimeLimit.svg" +BTWait = "res://addons/limboai/icons/BTWait.svg" +BTWaitTicks = "res://addons/limboai/icons/BTWaitTicks.svg" +BehaviorTree = "res://addons/limboai/icons/BehaviorTree.svg" +LimboAI = "res://addons/limboai/icons/LimboAI.svg" +LimboDeselectAll = "res://addons/limboai/icons/LimboDeselectAll.svg" +LimboExtraBlackboard = "res://addons/limboai/icons/LimboExtraBlackboard.svg" +LimboExtraClock = "res://addons/limboai/icons/LimboExtraClock.svg" +LimboExtraVariable = "res://addons/limboai/icons/LimboExtraVariable.svg" +LimboExtractSubtree = "res://addons/limboai/icons/LimboExtractSubtree.svg" +LimboHSM = "res://addons/limboai/icons/LimboHSM.svg" +LimboPercent = "res://addons/limboai/icons/LimboPercent.svg" +LimboSelectAll = "res://addons/limboai/icons/LimboSelectAll.svg" +LimboSpecifyValue = "res://addons/limboai/icons/LimboSpecifyValue.svg" +LimboState = "res://addons/limboai/icons/LimboState.svg" diff --git a/gdextension/update_icons.py b/gdextension/update_icons.py new file mode 100755 index 0000000..11b4f9d --- /dev/null +++ b/gdextension/update_icons.py @@ -0,0 +1,39 @@ +#!/usr/bin/python + +import os +import glob + +def get_script_dir(): + return os.path.dirname(os.path.realpath(__file__)) + + +def main(): + config_dir = get_script_dir() + config_path = os.path.join(config_dir, "limboai.gdextension") + content = "" + + f = open(config_path, "r") + for line in f: + if line.startswith("[icons]"): + break + content += line + f.close() + + content += "[icons]\n\n" + + icons_dir = os.path.join(config_dir, "../icons/") + for icon_file in glob.glob(icons_dir + "/*.svg"): + icon_file = os.path.basename(icon_file) + content += os.path.splitext(icon_file)[0] + " = \"res://addons/limboai/icons/" + icon_file + "\"\n" + + f = open(config_path, "w") + f.write(content) + f.close() + + print(content) + print("--------------------------------------------------------------------------------------") + print("Done!") + + +if __name__ == "__main__": + main()