Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


Adobe XD scenegraph.root reading layers backwards??

Explorer ,
Apr 13, 2021 Apr 13, 2021

Copy link to clipboard

Copied

Hello, im  a bit confused... in some of my other panel scripts, whenever iterate through the "scenegraph.root" and console.log all the nodes (and children nodes).. the scenegraph would read or spit out the information from the layers panel from TOP to BOTTOM.  However, after creating a new panel using the UXP Developers Tool it seems to be reading from BOTTOM to TOP...

 

for example, please look at the screenshot below.  You can see insidie my "Main Artboard" there are 3 items...

 

davidc88034496_0-1618344543911.png

 

whenever i output using the below code, the UXP console debug tool outputs the information starting from the bottom.  It will output 'frame', then 'section#bottom-body' and then 'section#top-banner'... if i remember correctly from my previous scripts, its suppose to read it from the top then the bottom.  This is causing me issues.. how would i reverse it so that i output whats on top first and then going down. or is my code wrong?

 

 

const scenegraph = require("scenegraph");

recurseSceneGraph(scenegraph.root);

function recurseSceneGraph(node) {
node.children.forEach((nodeParent) => {
console.log("--" + nodeParent.name);
if (nodeParent.children.length > 0) {
nodeParent.children.forEach((node) => {
if (node.children.length > 0) {
console.log("-" + node.name);
recurseSceneGraph(node);
}
});
}
}); 

 

Views

110

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 13, 2021 Apr 13, 2021

Copy link to clipboard

Copied

LATEST

i was able to answer my own question by using scenegraph.node.children.forEachRight().  im still not sure if the order is by layer panel or something else though.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines