Graphics

 View Only
  • 1.  Scripting a dynamic graph with the Lines object

    Posted 01-28-2020 17:25

    Hi there,

    I am trying to control a Lines object from script. I can create a graph manually just fine, but the script API does not seem to work correctly. Not only do I not see a correct graph, but xPression hangs frequently when playing out the scene.

    I run the following script in OnPrepare:

    dim lines as xpLinesObject
    self.getObjectByName("Lines2",lines)
    lines.SetCurrentList(0)

    lines.addPoint(100,200,0.0)
    lines.addPoint(200,300,0.0)
    lines.addPoint(300,100,0.0)
    lines.addPoint(400,150,0.0)
    lines.addPoint(500,100,0.0)
    lines.addPoint(600,20,0.0)

     

    The end result is that the preview shows the line correctly, but running the scene online I see nothing on my graph. If I restart xPression then the graph displays OK, but if I edit my script, those changes don't show up when I put the scene online.

    Has anyone done something similar (generated a graph in the script) and made this work?

     

     



  • 2.  RE: Scripting a dynamic graph with the Lines object

    Posted 01-28-2020 17:59

    A few things: Is this the entire script? in my experience when using API texture shaders you generally need a Draw method in order for it to show up in the engine. I'm not seeing that in your script. Additionally, we use an xpPointsList instead of an xpLinesObject, I'm not familiar with that object so I can't speak to how it fully works.

     

    Also, we put any of our Draw methods on the OnOnline and OnPreviewRender events, not OnPrepare.


    #XPression


  • 3.  RE: Scripting a dynamic graph with the Lines object

    Posted 01-29-2020 16:18

    Which version are you running?  There were some fixes for issues controlling the lines object from the API put into version 9.5.

    Are you using the lines object in 2D mode or 3D mode.  

     


    #XPression