diff options
| author | yum <yum.food.vr@gmail.com> | 2023-09-10 17:29:01 -0700 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2023-09-10 17:29:01 -0700 |
| commit | 3db7723aa5c16358f73e3e8d3bb20a959ce43d5d (patch) | |
| tree | a2dfa638188a774618d4814ad6b0e02bff511b80 /Scripts/libunity.py | |
| parent | 4a4909919223a7446944c6248472c7f71a30307c (diff) | |
Users can now choose custom chatbox texture size in UI
Diffstat (limited to 'Scripts/libunity.py')
| -rw-r--r-- | Scripts/libunity.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Scripts/libunity.py b/Scripts/libunity.py index 39348d4..77eeb95 100644 --- a/Scripts/libunity.py +++ b/Scripts/libunity.py @@ -446,7 +446,7 @@ class UnityAnimator(): self.nodes.append(node) anchor = node.anchor if anchor == None: - raise Exception("Node is missing anchor: {}".format(str(node))) + anchor = self.allocateId() if anchor in self.id_to_node: raise Exception("Duplicate anchor: {}, node 1: {}, node 2: {}".format(anchor, str(node), str(self.id_to_node[anchor]))) self.id_to_node[anchor] = node @@ -1013,9 +1013,11 @@ def unityYamlToString(nodes): %YAML 1.1 %TAG !u! tag:unity3d.com,2011: """[1:][:-1] - lines.append(preamble) + if len(nodes) > 1 or (len(nodes) == 1 and nodes[0].anchor): + lines.append(preamble) for doc in nodes: - lines.append("--- !u!" + doc.class_id + " &" + doc.anchor) + if len(nodes) > 1 or (len(nodes) == 1 and nodes[0].anchor): + lines.append("--- !u!" + doc.class_id + " &" + doc.anchor) lines.append(str(doc)) result = '\n'.join(lines) @@ -1134,7 +1136,8 @@ class UnityParser: if self.cur_node == None: self.cur_node = UnityDocument() self.cur_node.anchor = event.anchor - self.cur_node.class_id = anchor_to_class_id[event.anchor] + if event.anchor: + self.cur_node.class_id = anchor_to_class_id[event.anchor] else: self.cur_node = self.cur_node.addChildMapping(self.cur_scalar) self.pushState(self.MAPPING_START) |
