Skip to content

Commit

Permalink
refactor: simplify export plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
derkork committed Nov 21, 2024
1 parent ff3bcbe commit 76a1e98
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 28 deletions.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.4.1] - 2024-11-21
### Improved
- Increased scanning speed by a factor of 15 by using a different API for traversing the file system. This avoids building a lot of strings for path names and reduces scan time from 2.3 seconds to 0.13 seconds for a project with 100k files in it.

## [0.4.0] - 2024-07-19
### Added
Expand Down
6 changes: 3 additions & 3 deletions addons/godot_resource_groups/godot_resource_groups.gd
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ func _enter_tree():
})

# register the export plugin
#_export_plugin = ResourceGroupsExportPlugin.new()
#add_export_plugin(_export_plugin)
_export_plugin = ResourceGroupsExportPlugin.new(_rebuild_resource_groups)
add_export_plugin(_export_plugin)


func _exit_tree():
remove_tool_menu_item("Rebuild project resource groups")
#remove_export_plugin(_export_plugin)
remove_export_plugin(_export_plugin)


func _build() -> bool:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,31 +1,14 @@
@tool
extends EditorExportPlugin

#const ResourceScanner = preload("resource_scanner.gd")
var _on_export:Callable

func _init(on_export:Callable):
_on_export = on_export

func _begin_customize_resources(platform: EditorExportPlatform, features: PackedStringArray) -> bool:
return true

func _get_name() -> String:
return "Godot Resource Groups Export Plugin"
func _export_begin(features, is_debug, path, flags):
_on_export.call()

func _customize_resource(resource: Resource, path: String) -> Resource:
print("Customizing resource: ", path)
# re-scan resource paths for ResourceGroup on export
# if resource is ResourceGroup:
# print("Updating resource group before export: ", path)
# var group:ResourceGroup = resource as ResourceGroup
# var resource_scanner = ResourceScanner.new(group)
# var resource_paths = resource_scanner.scan()
# group.paths = resource_paths
# return group

# everything else we don't care about
return null

func _customize_scene(scene: Node, path: String) -> Node:
return null


func _get_customization_configuration_hash() -> int:
return 0
func _get_name() -> String:
return "Godot Resource Groups Export Plugin"

0 comments on commit 76a1e98

Please sign in to comment.