Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Level 8

Scene Graph Understanding

Over the past couple of years this forum has provided me with much help in developing channels on Roku. I came across the Scene Graph documentation and examples and decided to take a crack at learning something new. Not sure that was a wise decision after getting into it. I came across an example for an epg done with scenes. From what I read, this particular part is no longer supported in the SDK due to copyright so was wondering if I could have somebody just explain a couple of things. The epgGridScene looked short so thought it might be easy to look into. First, from ... ne#p508680 I found the code. Just wondering what the first xml file called epgGridScene.xml does exactly? The code is below:
Secondly, I see the xml file called EpgGrid.xml (shown below), provides data to be displayed on the screen. Am I correct in thinking that the main.brs executes the epgGridScene.xml which in turn gets it's data from the EpgGrid.xml? If so, would it be possible to load the content (EpgGrid.xml) from a server? If so, would I create a second entry in the epgGradScene.xml above the entry <customEPGGRID/> that would call another xml which would create a urltransfer?
If the questions seem elementary I'm sorry. I have been doing something very similar to what this seems to do but thru a lot of code, reading a server, parsing etc. Just trying to understand the benefit of using scene graph.

<?xml version="1.0" encoding="utf-8" ?> 

<!--********** Copyright 2015 Roku Corp.  All Rights Reserved. **********-->

<component name="epgGridScene" extends="Scene">

   <script type="text/brightscript" >

      <!-- EPG Grid -->
      <customEPGGrid />

<?xml version="1.0" encoding="utf-8" ?> 

<component name="customEPGGrid" extends="EPGGrid" >

<script type="text/brightscript" >


function init()
   print "inside epg"
   m.content = createObject("RoSGNode","ContentNode")
   dateNow = CreateObject("roDateTime")
   dateNow = dateNow.asSeconds() - 2000
   addItem("ABC Show ", dateNow)

   addItem("CBS Show ", dateNow)

   addItem("NBC Show ", dateNow)
   addItem("NICK Show ", dateNow)

   addItem("Outside Show ", dateNow)
   addItem("Test Show ", dateNow) = m.content = [50, 300] = 5 = 10800 = false = 0 = "Hello"
end function

sub addChannel(channelText as string) = m.content.createChild("ContentNode") = channelText = ""
end sub
sub addItem(progText as string, timeStart)
  For i=0 To 5 Step 1
    program ="ContentNode")
     program.TITLE = progText + str(i)
     program.PLAYSTART = timeStart + (i * 2000)
     program.PLAYDURATION = "2000"
End For
end sub


0 Kudos
1 REPLY 1\
Level 10

Re: Scene Graph Understanding

I'd recommend walking through the tutorial as a starting point.  That should prep you for trying to understand a more complex sample app.
My Channels: - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos