Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
georgejecook
Streaming Star

Unbelievable issue with accessing node as field of other node

I have a node with a field type like this

<fields>
<id="[size=85][font=monospace]colors[/font][/size]" type="node"> 



which holds another node described as

<?xml version="1.0" encoding="UTF-8"?>
<component
    name="ColorsContent"
    extends="ContentNode"



I can print out this node as follows

 m.top.content.colors



and get


<Component: roSGNode> =
{
    change: <Component: roAssociativeArray>
    focusable: false
    focusedChild: <Component: roInvalid>
    id: ""
    backgroundColor: "#e5e4e5"
    fadeOverlayStyle: "verticalGradient"
    progressBarBackgroundColor: "#000000BB"
    progressBarColor: "#ffc706"
    textColor: "#313131"
    tileColor: "#003d8d"
}



but if I access any properties, I get an error.. w.. t.. h.. 


 ? m.top.content.colors.id
BRIGHTSCRIPT: ERROR: roSGNode.<lookup>: RoSGNode instance of subtype ColorsContent is inaccessible from render thread
invalid
George Cook
https://georgejecook.github.io/
https://linkedin.com/in/georgejecook/
Roku developers slack group (https://join.slack.com/t/rokudevelopers/shared_invite/zt-4vw7rg6v-NH46oY7hTktpRIBM_zGvwA) : georgejecook

Contact me on roku developer slack group, or via pm to discuss consultancy/work opportunities/rooibos unit testing framework
0 Kudos
1 REPLY 1
georgejecook
Streaming Star

Re: Unbelievable issue with accessing node as field of other node

Okay, after speaking with a roku guy, this does look like a bug.

I've tested a workaround.

if you have node fields, then add them as children also
once you pass the thread boundary, remove the duplicate child - your node field will now work

I have an elegant way of doing this with a base contentnode class, which has nodeFieldNames array and hasNodeFields bool fields declared
when I create my nodes in my background task, my node factory adds the contentnode fields as children, and sets the nodeFieldNames and hasNodeFields values via a WorkAroundNodeRendesvouBug method

on the other side, I then iterate over the node graph, and remove all children that correspond to contentNodeFields, on all nodes that have hasNodeFields set to true

I can do this easily and without much fuss becauseI have a framework for processing my json into nodes, and for returning my contentNodes back to RSG.

I can't share exact code, because it belongs to my client 😉

Good luck peeps
George Cook
https://georgejecook.github.io/
https://linkedin.com/in/georgejecook/
Roku developers slack group (https://join.slack.com/t/rokudevelopers/shared_invite/zt-4vw7rg6v-NH46oY7hTktpRIBM_zGvwA) : georgejecook

Contact me on roku developer slack group, or via pm to discuss consultancy/work opportunities/rooibos unit testing framework
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.