Your Digital Media Has Never Looked So Good

  • 1
  • 3
  • 4
  • 5
  • 6
  • 7
  • 16
 
sjb64
Posts: 108
Joined: Thu Apr 16, 2015 1:13 pm
Location: Memphis, TN

Re: Beta Scene Graph Components

Thu Oct 22, 2015 11:21 am

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?
FlixRaider channel
 
EnTerr
** Valued Community Member **
Posts: 3834
Joined: Sun Jan 02, 2011 2:41 am

Re: Beta Scene Graph Components

Thu Oct 22, 2015 11:30 am

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?
Last edited by EnTerr on Thu Oct 22, 2015 11:35 am, edited 1 time in total.
 
User avatar
TheEndless
** Valued Community Member **
Posts: 9231
Joined: Mon Oct 04, 2004 10:15 am
Location: US
Contact:

Re: Beta Scene Graph Components

Thu Oct 22, 2015 11:34 am

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)
 
sjb64
Posts: 108
Joined: Thu Apr 16, 2015 1:13 pm
Location: Memphis, TN

Re: Beta Scene Graph Components

Thu Oct 22, 2015 11:45 am

If you go to http://www.blackcountrycaravans.co.uk/advanced-stocklist.aspx#key=cac44eb1-5494-4529-bc00-3723245c14db 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.
FlixRaider channel
 
EnTerr
** Valued Community Member **
Posts: 3834
Joined: Sun Jan 02, 2011 2:41 am

Re: Beta Scene Graph Components

Thu Oct 22, 2015 11:47 am

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?
 
User avatar
TheEndless
** Valued Community Member **
Posts: 9231
Joined: Mon Oct 04, 2004 10:15 am
Location: US
Contact:

Re: Beta Scene Graph Components

Thu Oct 22, 2015 11:57 am

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)
 
sjb64
Posts: 108
Joined: Thu Apr 16, 2015 1:13 pm
Location: Memphis, TN

Re: Beta Scene Graph Components

Thu Oct 22, 2015 12:18 pm

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...
FlixRaider channel
 
sjb64
Posts: 108
Joined: Thu Apr 16, 2015 1:13 pm
Location: Memphis, TN

Re: Beta Scene Graph Components

Thu Oct 22, 2015 1:10 pm

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.
FlixRaider channel
 
sjb64
Posts: 108
Joined: Thu Apr 16, 2015 1:13 pm
Location: Memphis, TN

Re: Beta Scene Graph Components

Fri Oct 23, 2015 6:07 am

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.
FlixRaider channel
 
adamkaz
Posts: 116
Joined: Sun Jan 11, 2009 2:23 pm

Re: Beta Scene Graph Components

Mon Oct 26, 2015 6:44 am

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.
 
edskitter
Posts: 25
Joined: Fri May 01, 2015 8:15 am

Re: Beta Scene Graph Components

Fri Oct 30, 2015 4:25 pm

Does anyone have an example of the epggrid? It would be great to see the performance and what is offered...
 
edskitter
Posts: 25
Joined: Fri May 01, 2015 8:15 am

Re: Beta Scene Graph Components

Tue Nov 03, 2015 1:23 pm

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

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

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

   <script type="text/brightscript" >
   
   </script>

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


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

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

<script type="text/brightscript" >

<![CDATA[

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

   addChannel("CBS")
   addItem("CBS Show ", dateNow)

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

   addChannel("OUTSIDE")
   addItem("Outside Show ", dateNow)
   
   addChannel("TEST")
   addItem("Test Show ", dateNow)

   m.top.content = m.content
   m.top.translation = [50, 300]
   m.top.numRows = 5
   m.top.duration = 10800
   m.top.nowNextMode = false
   m.top.infoGridGap = 0
   m.top.channelInfoColumnLabel = "Hello"
   
end function

sub addChannel(channelText as string)
  m.channel = m.content.createChild("ContentNode")
  m.channel.TITLE = channelText
  m.channel.HDSMALLICONURL = "http://css.boshanka.co.uk/wp-content/uploads/2015/04/icon-logo-design-small.png"
end sub
 
sub addItem(progText as string, timeStart)
  For i=0 To 5 Step 1
    program = m.channel.createChild("ContentNode")
     program.TITLE = progText + str(i)
     program.PLAYSTART = timeStart + (i * 2000)
     program.PLAYDURATION = "2000"
End For
 
end sub

]]>

</script>
</component>


main.brs
'********** Copyright 2015 Roku Corp.  All Rights Reserved. **********

sub Main()
   showChannelSGScreen()
end sub

sub showChannelSGScreen()
   print "in showChannelSGScreen"
   screen = CreateObject("roSGScreen")
   m.port = CreateObject("roMessagePort")
   screen.setMessagePort(m.port)
   scene = screen.CreateScene("epgGridScene")
   screen.show()

   while(true)

      msg = wait(0, m.port)
      msgType = type(msg)

      if msgType = "roSGScreenEvent"

         if msg.isScreenClosed()
            print "screen closed"
          return
          end if

      end if

   end while
end sub


I can get the EPG to render but I can not get the grid to have focus to move up / down / left / right. What am I missing?
 
User avatar
TheEndless
** Valued Community Member **
Posts: 9231
Joined: Mon Oct 04, 2004 10:15 am
Location: US
Contact:

Re: Beta Scene Graph Components

Wed Nov 04, 2015 12:54 am

edskitter wrote:
I can get the EPG to render but I can not get the grid to have focus to move up / down / left / right. What am I missing?

Try giving your customEPGGrid tag an id and setting the "initialFocus" attribute of the epgGridScene component. Or set focus to the grid explicitly inside the init function (which currently doesn't exist) in your epgGridScene.xml.
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)
 
sudo97
Posts: 46
Joined: Wed Sep 16, 2015 8:43 am

Re: Beta Scene Graph Components

Wed Nov 04, 2015 5:27 am

What about creating one scene from another? I need to edit settings in my application. Or can I just use Dialogs?
here's code I wrote to create a simple dialog, and nothing appears, when I press button:
function onKeyEvent(key as string, press as boolean) as boolean
    handled = false
    if (press)
        if(key = "options")
             m.dialog = CreateObject("roSGNode", "Dialog")
             m.dialog.title = "HELLO WORLD"
             m.dialog.message = "SIMPLE DIALOG"
             handled = true
        end if
    end if
    return handled
end function


I use roku stick, what am I doing wrong?


SOLVED, just had to write m.top.dialog instead of m.dialog
Last edited by sudo97 on Tue Nov 10, 2015 5:26 am, edited 1 time in total.
 
edskitter
Posts: 25
Joined: Fri May 01, 2015 8:15 am

Re: Beta Scene Graph Components

Wed Nov 04, 2015 7:51 am

Thanks Endless but I had tried both. Strange, I used this :

m.top.jumpToItem = 0
m.top.animateToItem = 1


inside the customEPGGrid component and I am able to scroll now. I am really not sure why that kicked it off. I kept the m.top.setFocus(true) inside the component as before.
  • 1
  • 3
  • 4
  • 5
  • 6
  • 7
  • 16

Who is online

Users browsing this forum: No registered users and 8 guests