Add script to update icons in the extension config

This commit is contained in:
Serhii Snitsaruk 2024-01-10 00:41:27 +01:00
parent 960f04b0ab
commit 835d053c00
2 changed files with 94 additions and 1 deletions

View File

@ -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"

39
gdextension/update_icons.py Executable file
View File

@ -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()