typegraph/scripts/debug/sceneNodeToString.gml

30 lines
893 B
Plaintext
Raw Permalink Normal View History

///sceneNodeToString(id)
/**
* sceneNodeToString :: SceneNode -> String
*
* Returns the scene node with all its children as a string.
*
* @param id the scene node to convert to a string
* @returns the scene node as a string
*/
var node = argument0;
var str = object_get_name(node.object_index)+"@"+string(node.id);
/*
str += " parent: "+string(argument0.parent);
str += " x: "+string(argument0.x)+" y: "+string(argument0.y);
str += " dx: "+string(argument0.xoffset)+" dy: "+string(argument0.yoffset);
str += " width: "+string(argument0.width)+" height: "+string(argument0.height);
*/
for (var i = 0; i < ds_list_size(node.children); i++) {
if (is_real(node.children[|i]) && instance_exists(node.children[|i]))
str += string_replace_all("#"+sceneNodeToString(node.children[|i]), "#", "# ");
else
str += "# [error]: child is "+string(node.children[|i]);
}
return str;