diff --git a/projects/nat-archive-tool/src/nat/ArchiveController.kiss b/projects/nat-archive-tool/src/nat/ArchiveController.kiss index 57fbf1de..d200e61e 100644 --- a/projects/nat-archive-tool/src/nat/ArchiveController.kiss +++ b/projects/nat-archive-tool/src/nat/ArchiveController.kiss @@ -211,7 +211,6 @@ (archive.addSystem ps) (set ps.setupProcess true) (ps.process archive ui) - (set ps.setupProcess false) (ps.switchPlaygroundKey (dictGet archive.playgrounds "default"))) // Just for testing: @@ -243,7 +242,11 @@ (defCommand CreateEntry [name (Text null)] [(archive.createEntry ->e - (addComponent archive e Name name))]) + { + (when (and playgroundSystem (playgroundSystem.currentDefaultTags)) + (addTags archive e (playgroundSystem.currentDefaultTags))) + (addComponent archive e Name name) + })]) (defCommand CreateEntries [names (VarText null)] // createEntry returns a list, so these lists must be flattened @@ -338,11 +341,14 @@ (true (addComponent archive e Scale scale)))) entries) - (defCommand CreatePlayground [name (Text null) catsMatchExp (Text null)] + // TODO use VarTags + (defCommand CreatePlayground [name (Text null) catsMatchExp (Text null) defaultTags (VarText null)] (archive.changePlaygrounds ->:Void [:DynamicAccess p] (dictSet p name (object catsMatch catsMatchExp))) - // TODO make the corresponding playground entry and return it - []) + (let [[e] (CreateTaggedEntry ["playground"] name)] + (addComponent archive e CatsMatchExp catsMatchExp) + (addComponent archive e TagList defaultTags) + [e])) (defCommand SwitchPlayground [name (Text null)] (archive.changePlaygrounds ->:Void [:DynamicAccess p] (dictSet p "default" name)) diff --git a/projects/nat-archive-tool/src/nat/systems/PlaygroundSystem.kiss b/projects/nat-archive-tool/src/nat/systems/PlaygroundSystem.kiss index afde7de5..2b1b4741 100644 --- a/projects/nat-archive-tool/src/nat/systems/PlaygroundSystem.kiss +++ b/projects/nat-archive-tool/src/nat/systems/PlaygroundSystem.kiss @@ -1,7 +1,7 @@ (load "../Lib.kiss") (prop &mut :String _playgroundKey "") -(prop &mut :TagList currentDefaultTags []) +(method :TagList currentDefaultTags [] (or (dictGet playgroundDefaultTags _playgroundKey) [])) (method :String getPlaygroundKey [] _playgroundKey) (prop :Map playgroundDefaultTags (new Map)) @@ -50,10 +50,11 @@ (prop &mut :Bool setupProcess false) (method &override :Void process [:Archive archive &opt :ArchiveUI ui] - (when _playgroundKey - (set setupProcess true) + (when setupProcess (super.process archive ui) (set setupProcess false) + (return)) + (when _playgroundKey (super.process archive ui) (doFor e (entries.iterator) (when (hasComponent e Positions)