Fix scene preview with nodes, that have spaces in names (#806)

Fixes #688
This commit is contained in:
Mikhail Zolotukhin
2025-03-04 21:39:58 +01:00
committed by GitHub
parent e528384ea5
commit 34de1b64f0

View File

@@ -87,9 +87,9 @@ export class SceneParser {
const nodeRegex = /\[node.*/g;
for (const match of text.matchAll(nodeRegex)) {
const line = match[0];
const name = line.match(/name="([\w]+)"/)?.[1];
const name = line.match(/name="([^.:@/"%]+)"/)?.[1];
const type = line.match(/type="([\w]+)"/)?.[1] ?? "PackedScene";
let parent = line.match(/parent="([\w\/.]+)"/)?.[1];
let parent = line.match(/parent="(([^.:@/"%]|[\/.])+)"/)?.[1];
const instance = line.match(/instance=ExtResource\(\s*"?([\w]+)"?\s*\)/)?.[1];
// leaving this in case we have a reason to use these node paths in the future