Browse Source

:wrench: Add uid replacement

Very strange behaviors were happening in the editor. It was switching
component having the same uid.
DricomDragon 2 years ago
parent
commit
a14d9368ca
2 changed files with 7 additions and 7 deletions
  1. 3 3
      godot/slides/template/TEMPLATE_NAME.tscn
  2. 4 4
      tools/gd-slide.fish

+ 3 - 3
godot/slides/template/TEMPLATE_NAME.tscn

@@ -1,8 +1,8 @@
-[gd_scene load_steps=4 format=3 uid="uid://dfe2r0hb6nayr"]
+[gd_scene load_steps=4 format=3 uid="uid://uuuuuuuuuuuuu"]
 
 [ext_resource type="Script" path="res://projector/slide/Slide.gd" id="1_aaaaa"]
-[ext_resource type="Texture2D" uid="uid://jjrdfilvox4o" path="res://icon.svg" id="2_bbbbb"]
-[ext_resource type="PackedScene" uid="uid://bvrtmyq4g1qes" path="res://common/components/title/title.tscn" id="3_ccccc"]
+[ext_resource type="Texture2D" uid="uid://vvvvvvvvvvvv" path="res://icon.svg" id="2_bbbbb"]
+[ext_resource type="PackedScene" uid="uid://wwwwwwwwwwwww" path="res://common/components/title/title.tscn" id="3_ccccc"]
 
 [node name="TEMPLATE_NAME" type="Node2D"]
 script = ExtResource("1_aaaaa")

+ 4 - 4
tools/gd-slide.fish

@@ -14,11 +14,11 @@ set SLIDE_FOLDER "$SLIDES_PATH/$SLIDE_NUM"
 set SLIDE_FILE "$SLIDE_FOLDER/$SLIDE_NAME.tscn"
 
 function gen-res-id
-	echo (head -n 10 /dev/urandom | tr -dc 'a-z' | string shorten -m 5 --char="")
+	echo (head -n 10 /dev/urandom | tr -dc 'a-z' | string shorten -m $argv[1] --char="")
 end
 
-set IDS (gen-res-id) (gen-res-id) (gen-res-id)
-set IDS_MARK 'aaaaa' 'bbbbb' 'ccccc'
+set IDS (gen-res-id 5) (gen-res-id 5) (gen-res-id 5) (gen-res-id 13) (gen-res-id 13) (gen-res-id 13)
+set IDS_MARK 'aaaaa' 'bbbbb' 'ccccc' 'uuuuuuuuuuuuu' 'vvvvvvvvvvvvv' 'wwwwwwwwwwwww'
 
 echo "Read $TEMPLATE_FILE"
 set CONTENT (cat $TEMPLATE_FILE)
@@ -35,7 +35,7 @@ set CONTENT (get-content | sed -e "s/$SLIDE_TITLE_MARK/$SLIDE_TITLE/")
 echo "Replace marks"
 for k in (seq 3)
 	echo $k ':' $IDS_MARK[$k] '->' $IDS[$k]
-	set CONTENT (get-content | sed -e "s/$k\_$IDS_MARK[$k]/$k\_$IDS[$k]/")
+	set CONTENT (get-content | sed -e "s/$IDS_MARK[$k]/$IDS[$k]/")
 end
 
 echo "Write to : $SLIDE_FILE"