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: 
sjb64
Roku Guru

Re: Beta Scene Graph Components

That qualifies as a dead end, so I'll use the XML way, but what I am trying to do involves moving tiles around that I wont know the number needed, or where they start or move to, until runtime, so I can't really have an XML file waiting with everything filled out. I assume dynamically adding posters with animations after the scenegraph is created and displayed (via XML) will cause the same issue on the added items?
0 Kudos
EnTerr
Roku Guru

Re: Beta Scene Graph Components

"RokuJoel" wrote:
Yes, you can do that however, you lose the advantage of multi-threading, so you can expect, if your code is at all complex, for it to exhibit substandard performance as various things will block for screen refresh, which may slow down your code execution significantly.

Hmm, why wouldn't multi-threading work, if he would be using the same scenic-components?
It's the same executor with the same capabilities... it was mentioned console is on another port, global vars separate - sounds like container separation is done on a scenical-component-use line and not XML?
0 Kudos
TheEndless
Channel Surfer

Re: Beta Scene Graph Components

"EnTerr" wrote:
"RokuJoel" wrote:
Yes, you can do that however, you lose the advantage of multi-threading, so you can expect, if your code is at all complex, for it to exhibit substandard performance as various things will block for screen refresh, which may slow down your code execution significantly.

Hmm, why wouldn't multi-threading work, if he would be using the same scenic-components?
It's the same executor with the same capabilities... it was mentioned console is on another port, global vars separate - sounds like in the same threading container?

You can't create Task nodes outside of the SceneGraph thread.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
sjb64
Roku Guru

Re: Beta Scene Graph Components

If you go to http://www.blackcountrycaravans.co.uk/advanced-stocklist.aspx#key=cac44eb1-5494-4529-bc00-3723245c14... you'd see an example of the concept I was trying to play with, and why the data would be very dynamic, and therefore generated at runtime. If adding nodes at runtime (via BRS) to a graph created via XML allows the new nodes to run on the original scenegraph task thread, it should all work out.
0 Kudos
EnTerr
Roku Guru

Re: Beta Scene Graph Components

"TheEndless" wrote:
You can't create Task nodes outside of the SceneGraph thread.

Okay... i don't follow, i am afraid. How does that necessitate (static) XML, vs tasks/nodes being spun from the scynical-graph thread dynamically/as-needed?
0 Kudos
TheEndless
Channel Surfer

Re: Beta Scene Graph Components

"EnTerr" wrote:
"TheEndless" wrote:
You can't create Task nodes outside of the SceneGraph thread.

Okay... i don't follow, i am afraid. How does that necessitate (static) XML, vs being spun dynamically from the scynical-graph thread?

The code that runs in the SceneGraph thread has to be defined/referenced via a <script> tag in the XML. So at the very least, you'd need a barebones XML file to define the initial scene. There's no reason you couldn't dynamically create all of the components for the scene via code, though.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
sjb64
Roku Guru

Re: Beta Scene Graph Components

"TheEndless" wrote:
There's no reason you couldn't dynamically create all of the components for the scene via code, though.

Tried that, none of the animations would run for me yet when created in code. The objects themseves did appear, and videos and timers run fine. Still messing with it tho to get the animations going...
0 Kudos
sjb64
Roku Guru

Re: Beta Scene Graph Components

Followup of animations...

I took the VideoBanner sample and added the following code lines to the scripts init sub (between SetVideo() and end sub)

bR2nd = m.top.findNode("bannerGroup").createChild("Rectangle"): bR2nd.id = "bR2"
ccA2nd = bR2nd.createChild("Animation"): ccA2nd.id = "ccA2"
ccR2nd = ccA2nd.createChild("ColorFieldInterpolator"): ccR2nd.id = "ccR2"

ccR2nd.setFields({key:[0.0,0.5,1.0], keyValue:[&h00FF00FF, &h00000FFF, &h00FF00FF], fieldToInterp:"bR2.color" })
ccA2nd.setFields({duration:10, repeat:true, control:"start", easeFunction:"linear"})
bR2nd.setFields({width:1280, height:30, color:&h00FF00FF, translation:[0,0]})

I get the green bar as expected, but the animation doesn't run. This is in the script block of the XML so the task thread should be correct, which leads me to think I am making a different mistake in my animation.

Changing the order of the code that sets the fields, including setting immediately upon creating each component, makes no difference. Moving the animations control="start" to follow this block as a final step also makes no difference.

Edit: Also moved the animation to the group and then to the top of the scene, out of the rectangle, as some examples in the docs show animations on their own instread of embedded in the control the interpolator happens to target. Makes no difference.
0 Kudos
sjb64
Roku Guru

Re: Beta Scene Graph Components

Continuation of the last post, found the issue, don't know if something I'm missing or a legit bug...

Modified the VideoBanner project again, putting these lines between SetVideo() and end sub:
m.top.findNode("bannerGroup").createChild("Rectangle").id = "bottomRectangle2"
PrintChildren(m.top,"")
print m.top.findNode("textTimer").id ' Prints textTimer as it should
print m.top.findNode("colorchangeRectangle").id ' Prints colorchangeRectangle as it should
print m.top.findNode("bannerGroup").GetChild(3).id ' Prints bottomRectangle2 as it should
print m.top.findNode("bannerGroup").findNode("bottomRectangle2") ' Print invalid, even tho we can see the node as GetChild(3)
print m.top.findNode("bottomRectangle2") ' Again prints invalid

Also this references a new debugging subroutine:
function PrintChildren(node, prefix)
print Prefix+"["+Node.id+"]"+", "+Node.GetChildCount().ToStr()+", "+Node.subType()
for count = 0 to Node.GetChildCount()-1
if Node.ID<>"musicvideos" printChildren(Node.GetChild(Count),prefix+" ")
' Video doesnt traverse well with this routine, unrelated issue so ignoring it
end for
end function

Here is the output, bottomRectangle2 is the 3rd item under bannerGroup, but the last 2 lines (invalid) are the ones that make no sense to me:
[], 2, videobannerScene
[], 0, Poster
[LayerRoot], 3, RenderableNode
[Layer], 0, RenderableNode
[Layer], 4, RenderableNode
[musicvideos], 2, Video
[bannerGroup], 4, RenderableNode
[bottomRectangle], 1, Rectangle
[colorchangeAnimation], 1, Animation
[colorchangeRectangle], 0, ColorFieldInterpolator
[bottomLabel], 1, Label
[scrollbackAnimation], 1, Animation
[scrollbackLabel], 0, Vector2DFieldInterpolator
[channelPoster], 1, Poster
[fadeinoutAnimation], 1, Animation
[fadeinoutPoster], 0, FloatFieldInterpolator
[bottomRectangle2], 0, Rectangle
[warningRectangle], 1, Rectangle
[warningLabel], 0, Label
[textTimer], 0, Timer
[Layer], 0, RenderableNode
textTimer
colorchangeRectangle
bottomRectangle2
invalid
invalid

Seems this all has nothing to do with animations at all, I was chasing a symptom. The node tree itself has an issue that is affecting the animations ability to link the nodes up.

Any thoughts would be appreciated.
0 Kudos
adamkaz
Channel Surfer

Re: Beta Scene Graph Components

Either I'm using it wrong or this is a bug:
http://sdkdocs.roku.com/display/sdkdoc/Video setting mute = true does nothing to mute the video.
0 Kudos