I have a fairly large associative array of data that I would like to convert to a Node Tree as recommended by the SDK docs. However, I cannot seem to get roSGNode children and findNode to play nicely together. Below is a snippet I have been using for testing. Any thoughts?
When testing I tried the above and found that appendChild() does appear to be adding the child to the obj but findNode() dose not find it. I did some more testing such as:
The original code that wasn’t working was inside a component extending Group and in a runtime function and so I suppose it was in the render thread?Switching the first line of code to that suggested by @ChrisDP fixed this though. Is this how we’re expected to create the initial Node in a Node Tree?
“RokuNB” wrote: @ChrisDP - model#? firmware#?
which thread are you trying findNode() in? (render thread, task thread, main() thread)
model# 4630x - Roku Premiere+
firmware# 7.7.0 - build 4094-29
This was on the render thread and was executedinside a component extending Group and in a runtime function like @Fenda .
It seems that pointer to child element is not set correctly before node is appended to m.top. Attaching and detaching node fixes the pointer, but it should work out of box.
“bird3214” wrote:
It seems that pointer to child element is not set correctly before node is appended to m.top. Attaching and detaching node fixes the pointer, but it should work out of box.
ah… i vaguely seem to remember that perhaps search is always done from m.top (i.e. current component context) down. Check in the docs, maybe it’s between the lines.