MCPcopy Create free account
hub / github.com/PerroEngine/Perro / write_node

Method write_node

perro_source/runtime_project/perro_scene/src/scene_doc.rs:159–222  ·  view source on GitHub ↗
(&self, node: &SceneNodeEntry, out: &mut String)

Source from the content-addressed store, hash-verified

157 out.push('\n');
158 }
159
160 out
161 }
162
163 fn write_node(&self, node: &SceneNodeEntry, out: &mut String) {
164 out.push('[');
165 let node_key = self.doc.scene.key_name_or_id(node.key);
166 out.push_str(node_key.as_ref());
167 out.push_str("]\n");
168 if node
169 .name
170 .as_ref()
171 .is_some_and(|name| name.as_ref() != node_key.as_ref())
172 {
173 out.push_str("name = ");
174 write_str(node.name.as_ref().expect("checked"), out);
175 out.push('\n');
176 }
177 if !node.tags.is_empty() {
178 out.push_str("tags = [");
179 for (idx, tag) in node.tags.iter().enumerate() {
180 if idx > 0 {
181 out.push_str(", ");
182 }
183 write_str(tag, out);
184 }
185 out.push_str("]\n");
186 }
187 if let Some(parent) = &node.parent {
188 out.push_str("parent = ");
189 out.push('@');
190 out.push_str(self.doc.scene.key_name_or_id(*parent).as_ref());
191 out.push('\n');
192 }
193 if let Some(script) = &node.script {
194 out.push_str("script = ");
195 write_str(script, out);
196 out.push('\n');
197 } else if node.clear_script {
198 out.push_str("script = null\n");
199 }
200 if let Some(root_of) = &node.root_of {
201 out.push_str("root_of = ");
202 write_str(root_of, out);
203 out.push('\n');
204 }
205 if !node.script_vars.is_empty() {
206 out.push_str("script_vars = ");
207 self.write_object(
208 node.script_vars.as_ref(),
209 out,
210 0,
211 node.script_vars.len() > 1,
212 );
213 out.push('\n');
214 }
215
216 if node.has_data_override {

Callers 1

writeMethod · 0.80

Calls 10

write_strFunction · 0.85
key_name_or_idMethod · 0.80
write_objectMethod · 0.80
write_dataMethod · 0.80
pushMethod · 0.45
as_refMethod · 0.45
expectMethod · 0.45
is_emptyMethod · 0.45
iterMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected