Graphics

 View Only
Expand all | Collapse all

Scripting Line Object Point List

  • 1.  Scripting Line Object Point List

    Posted 07-05-2022 15:46
    I'm working on another attempt to make a linegraph that my producers can build in our ENPS Xpression plugin.

    I have multiple 10x10 quads I want to be the points in the Point List that define my 3D lines object.

    I have been working with the following script,

    dim Lines1 as xpLinesObject
    dim Line1 as xpPointList
    dim pt1L1, pt2L1, pt3L1, pt4L1 as xpQuadObject
    
    self.GetObjectByName ("Lines1", Lines1)
    self.GetPointListByName ("Line1", Line1)
    self.GetObjectByName ("pt1L1", pt1L1)
    self.GetObjectByName ("pt2L1", pt2L1)
    self.GetObjectByName ("pt3L1", pt3L1)
    self.GetObjectByName ("pt4L1", pt4L1)
    
    line1.BeginUpdate
    
    Lines1.AddPoint(pt1L1.PosX,pt1L1.PosY,0)
    Lines1.AddPoint(pt2L1.PosX,pt2L1.PosY,0)
    Lines1.AddPoint(pt3L1.PosX,pt3L1.PosY,0)
    Lines1.AddPoint(pt4L1.PosX,pt4L1.PosY,0)
    
    line1.EndUpdate​

    and one time got it to work, but I had pasted the script into a number of events because I couldn't decide which should work---when I pasted the script that I thought had worked---it no longer worked.

    I had pasted the wrong version...and lost it.

    Does anybody have any idea what is wrong with my script?...and what event should I be using? 

    Thanks,
    James.


    ------------------------------
    James Hessler
    WAAY (HEARTLAND MEDIA)
    ------------------------------


  • 2.  RE: Scripting Line Object Point List

    Ross Staff
    Posted 07-06-2022 09:05
    Hey James,

    Rather than update you could try clearing the list adding a new list and then adding the points to that?

    ------------------------------
    Simon Redmile
    Senior Graphic Programmer & Designer
    Ross Video
    Bristol United Kingdom
    ------------------------------



  • 3.  RE: Scripting Line Object Point List

    Posted 07-07-2022 00:23
    Hey Red!

    I couldn't be sure that BeginUpdate and EndUpdate were what I needed,  but I patched up my syntax and got a single 3D line made with four points working.

    I used my list that I had been working with in layout mode, but deleted all the points before I playing it out in sequence mode.

    I have keyframed the percentage of the line visible on each of ten lines and want up to twelve points on each line---think deaths or cases by month---and plan to reveal one line at a time.

    My problem now is that my script is creating linelist points from unused quads which I've defaulted to position (0,0,0), so all my lines loop back to zero---it is cool to watch, but not what I need.

    I started playing with if-thens, but ten lines of twelve points was starting to hurt my head!

    Any ideas?

    Thanks,
    James.

    I truncated this script to set points only for the first line...
    dim Diameter as xpTextObject
    self.GetObjectByName ("Diameter", Diameter)
    
    dim Lines1, Lines2, Lines3, Lines4, Lines5, Lines6, Lines7, Lines8, Lines9, Lines10 as xpLinesObject
    
    dim Line1, Line2, Line3, Line4, Line5, Line6, Line7, Line8, Line9, Line10 as xpPointList
    
    dim pt1Line1, pt2Line1, pt3Line1, pt4Line1, pt5Line1, pt6Line1, pt7Line1, pt8Line1, pt9Line1, pt10Line1, pt11Line1, pt12Line1 as xpQuadObject
    dim pt1Line2, pt2Line2, pt3Line2, pt4Line2, pt5Line2, pt6Line2, pt7Line2, pt8Line2, pt9Line2, pt10Line2, pt11Line2, pt12Line2 as xpQuadObject
    dim pt1Line3, pt2Line3, pt3Line3, pt4Line3, pt5Line3, pt6Line3, pt7Line3, pt8Line3, pt9Line3, pt10Line3, pt11Line3, pt12Line3 as xpQuadObject
    dim pt1Line4, pt2Line4, pt3Line4, pt4Line4, pt5Line4, pt6Line4, pt7Line4, pt8Line4, pt9Line4, pt10Line4, pt11Line4, pt12Line4 as xpQuadObject
    dim pt1Line5, pt2Line5, pt3Line5, pt4Line5, pt5Line5, pt6Line5, pt7Line5, pt8Line5, pt9Line5, pt10Line5, pt11Line5, pt12Line5 as xpQuadObject
    dim pt1Line6, pt2Line6, pt3Line6, pt4Line6, pt5Line6, pt6Line6, pt7Line6, pt8Line6, pt9Line6, pt10Line6, pt11Line6, pt12Line6 as xpQuadObject
    dim pt1Line7, pt2Line7, pt3Line7, pt4Line7, pt5Line7, pt6Line7, pt7Line7, pt8Line7, pt9Line7, pt10Line7, pt11Line7, pt12Line7 as xpQuadObject
    dim pt1Line8, pt2Line8, pt3Line8, pt4Line8, pt5Line8, pt6Line8, pt7Line8, pt8Line8, pt9Line8, pt10Line8, pt11Line8, pt12Line8 as xpQuadObject
    dim pt1Line9, pt2Line9, pt3Line9, pt4Line9, pt5Line9, pt6Line9, pt7Line9, pt8Line9, pt9Line9, pt10Line9, pt11Line9, pt12Line9 as xpQuadObject
    dim pt1Line10, pt2Line10, pt3Line10, pt4Line10, pt5Line10, pt6Line10, pt7Line10, pt8Line10, pt9Line10, pt10Line10, pt11Line10, pt12Line10 as xpQuadObject
    
    self.GetObjectByName ("Lines1", Lines1)
    self.GetObjectByName ("pt1Line1", pt1Line1)
    self.GetObjectByName ("pt2Line1", pt2Line1)
    self.GetObjectByName ("pt3Line1", pt3Line1)
    self.GetObjectByName ("pt4Line1", pt4Line1)
    self.GetObjectByName ("pt5Line1", pt5Line1)
    self.GetObjectByName ("pt6Line1", pt6Line1)
    self.GetObjectByName ("pt7Line1", pt7Line1)
    self.GetObjectByName ("pt8Line1", pt8Line1)
    self.GetObjectByName ("pt9Line1", pt9Line1)
    self.GetObjectByName ("pt10Line1", pt10Line1)
    self.GetObjectByName ("pt11Line1", pt11Line1)
    self.GetObjectByName ("pt12Line1", pt12Line1)
    
    Lines1.SetCurrentList(0)
    
    Lines1.BeginUpdate()
    Lines1.AddPoint(pt1Line1.PosX,pt1Line1.PosY,0,Diameter.text)
    Lines1.AddPoint(pt2Line1.PosX,pt2Line1.PosY,0,Diameter.text)
    Lines1.AddPoint(pt3Line1.PosX,pt3Line1.PosY,0,Diameter.text)
    Lines1.AddPoint(pt4Line1.PosX,pt4Line1.PosY,0,Diameter.text)
    Lines1.AddPoint(pt5Line1.PosX,pt5Line1.PosY,0,Diameter.text)
    Lines1.AddPoint(pt6Line1.PosX,pt6Line1.PosY,0,Diameter.text)
    Lines1.AddPoint(pt7Line1.PosX,pt7Line1.PosY,0,Diameter.text)
    Lines1.AddPoint(pt8Line1.PosX,pt8Line1.PosY,0,Diameter.text)
    Lines1.AddPoint(pt9Line1.PosX,pt9Line1.PosY,0,Diameter.text)
    Lines1.AddPoint(pt10Line1.PosX,pt10Line1.PosY,0,Diameter.text)
    Lines1.AddPoint(pt11Line1.PosX,pt11Line1.PosY,0,Diameter.text)
    Lines1.AddPoint(pt12Line1.PosX,pt12Line1.PosY,0,Diameter.text)
    
    Lines1.EndUpdate()​


    ------------------------------
    James Hessler
    WAAY (HEARTLAND MEDIA)
    ------------------------------



  • 4.  RE: Scripting Line Object Point List

    Ross Staff
    Posted 07-07-2022 06:03
    You should definitely look at writing a loop for this. 

    for i = 0 to (hitPosX.length-1)
    hitLinesObj.AddPoint(cdbl(hitPosX(i)), cdbl(hitPosY(i)), cdbl(hitPosZ(i)*-1), hitLineDiam)
    next

    This loop looks at hitposx which is a text string and looks for how many points there are in the string and runs the loop that many times only meaning it will stop when it runs out of points avoiding the zero. 

    However if I understand your project its multiple text boxes so you might want to right something like;

    dim Diameter as xpTextObject
    dim Lines1 as xpLinesObject
    dim ptLine1 as xpQuadObject
    dim i as integer

    self.GetObjectByName ("Diameter", Diameter)

    self.GetObjectByName ("Lines1", Lines1)

    Lines1.SetCurrentList(0)

    for i = 0 to 12
    Self.GetObjectByName("pt" & i & "Line1", ptline1)
    Lines1.AddPoint(ptLine1.PosX,ptLine1.PosY,0,Diameter.text)
    Next

    This will do the first line, you'll need to do more for rest.

    ------------------------------
    Simon Redmile
    Senior Graphic Programmer & Designer
    Ross Video
    Bristol United Kingdom
    ------------------------------



  • 5.  RE: Scripting Line Object Point List

    Posted 07-07-2022 22:53
    Hey Red,

    I got the loop working, but still can't stop the loop depending upon how many of the quads are used to define the lines object.

    I created a pointcount in visual logic and tried to insert that as the "to" integer, but wasn't successful in getting it to work.

    dim Diameter,text1 as xpTextObject
    dim Lines1 as xpLinesObject
    dim Line1 as xpPointList
    dim ptLine1 as xpQuadObject
    dim PointCount1 as xpTextObject
    dim Count1 as xpQuadObject
    
    dim i as integer
    
    self.GetObjectByName ("Diameter", Diameter)
    self.GetObjectByName ("PointCount1", PointCount1)
    self.GetObjectByName ("Count1", Count1)
    self.GetObjectByName ("Lines1", Lines1)
    self.GetObjectByName ("text1", text1)
    
    Lines1.SetCurrentList(0)
    
    for i = 1 to 4
    'for i = 1 to (CInt(PointCount1.text))
    
    Self.GetObjectByName("pt" & i & "Line1", ptline1)
    
    Lines1.AddPoint(ptLine1.PosX,ptLine1.PosY,0,Diameter.text)
    
    Next i​
    Can you tell what I'm doing wrong?

    Thanks,
    James.


    ------------------------------
    James Hessler
    WAAY (HEARTLAND MEDIA)
    ------------------------------



  • 6.  RE: Scripting Line Object Point List

    Ross Staff
    Posted 07-08-2022 05:23
    You could put an if statement in that checks if the values are zero. 

    if ptline.posx = 0 then
    else 
    Lines1.AddPoint(ptLine1.PosX,ptLine1.PosY,0,Diameter.text)
    end if

    ------------------------------
    Simon Redmile
    Senior Graphic Programmer & Designer
    Ross Video
    Bristol United Kingdom
    ------------------------------



  • 7.  RE: Scripting Line Object Point List

    Posted 07-20-2022 16:56
    Hey Red,

    I've gotten back around to this---the script works beautifully. 

    Because of some extensive visual logic support, I did have to move the script to scene director events.

    I found I needed this solution when I started building out the parts to make multiple lines and they stopped previewing in sequence mode.

    I got all that ironed out yesterday and I had five lines working.

    Today, I decided to add some text on color coded quads across the top describing what each line represented which included some fairly simple visual logic to size the quads to the text and position the groups containing quads/text.

    Now, my previews in sequence mode have disappeared again.

    Any idea what might cause this?

    Thanks,
    James.
    Will have to rework the vertical scale, but I'm close!
    ------------------------------
    James Hessler
    WAAY (HEARTLAND MEDIA)
    ------------------------------



  • 8.  RE: Scripting Line Object Point List

    Ross Staff
    Posted 07-25-2022 10:47
    The most common reasons for preview not working is, preview script is broken or, something in your script is reliant on something in VL or perhaps a macro that's being set by data and it isn't being resolved when that single frame is rendered. Something that will be corrected when it plays online as it continues to render so if something isn't in order that issue is hidden.

    ------------------------------
    Simon Redmile
    Senior Graphic Programmer & Designer
    Ross Video
    Bristol United Kingdom
    ------------------------------



  • 9.  RE: Scripting Line Object Point List

    Posted 10-10-2022 09:47

    Hi there guys!

    Thanks for this little forum post! Definetly helped me along on how to get some line graphs going.
    @Red I did run into two problems though...

    1. How did you stop the lines from looping back around the 0-point if trigged multiple times?
      I kinda assume it's in there, as it was mentioned as a problem, but I just cant see where...

    2. If I turn off "Use Spline Interpolation" the line that is auto generated by the script disappears.
      But if I add a point list manually it works just fine... Why?​ And how do I fix?


    ------------------------------
    Aleksander Stalsberg
    Inland Norway University of Applied Sciences/Lillehammer Icehockey Club
    Norway
    ------------------------------



  • 10.  RE: Scripting Line Object Point List

    Ross Staff
    Posted 10-10-2022 11:49
    1. when you trigger the line again do you want it to animate again or do nothing?
    2. I actually don't know without looking at the project. 

    You can share your project with me if we wish and I can take a look, can't be sure I can fix anything but worth a look.

    ------------------------------
    Simon Redmile
    Senior Graphic Programmer & Designer
    Ross Video
    Bristol United Kingdom
    ------------------------------



  • 11.  RE: Scripting Line Object Point List