Graphics

 View Only
  • 1.  Applying material via Script not working in ENPS Plugin

    Posted 10-10-2018 18:34
    Hi all,

    Having trouble getting a certain graphic to work in the ENPS plugin. It works just fine in Designer/Studio versions. The script is very simple and is applied to a text field called "FS COLOR." By changing the background material and a few quads, I change the color of the fullscreen graphic between several options. On the ENPS plugin, however, it doesn't apply the material. It just shows as if each object has no material applied. Here is the script:

    dim flagbkg as xpBaseObject
    dim hedmainbkg as xpBaseObject
    dim redBKG, blueBKG, bothBKG, redGRAD, blueGRAD, grayGRAD as xpMaterial

    scene.GetObjectByName("FLAG BKG", flagbkg)
    scene.GetObjectByName("MAIN HEAD BKG", hedmainbkg)

    engine.GetMaterialByName("FLAG_BKG_BLUE_Video", blueBKG)
    engine.GetMaterialByName("FLAG_BKG_RED_Video", redBKG)
    engine.GetMaterialByName("FLAG_BKG_BOTH_Video", bothBKG)

    engine.GetMaterialByName("DEM GRADIENT", blueGRAD)
    engine.GetMaterialByName("GOP GRADIENT", redGRAD)
    engine.GetMaterialByName("NEUTRAL GRADIENT", grayGRAD)

    if trim(text) = "RED" then

    flagbkg.setMaterial(0, redBKG)
    hedmainbkg.setMaterial(0, redGRAD)

    else if trim(text) = "BLUE" then

    flagbkg.setMaterial(0, blueBKG)
    hedmainbkg.setMaterial(0, blueGRAD)

    else if trim(text) = "RED/BLUE" then

    flagbkg.setMaterial(0, bothBKG)
    hedmainbkg.setMaterial(0, grayGRAD)

    end if


    Any help that can be provided would be greatly appreciated! The materials are all correctly part of the project server package. It worked on my Designer system and I even pulled it down from the Project Server onto an XPression studio box where it also worked, so it's either something in the plugin or the BlueBox render engine.


  • 2.  RE: Applying material via Script not working in ENPS Plugin

    Posted 10-11-2018 00:31
    You can't use engine.GetMaterialByName when in a MOS workflow, because that looks for a material in the currently active project, and in a mos workflow there may be no active project, or it may be a different project entirely.

    You need to use "scene.project.GetMaterialByName" instead of "engine.GetMaterialByName".



    #XPression


  • 3.  RE: Applying material via Script not working in ENPS Plugin

    Posted 10-11-2018 17:22
    I knew it had to be something to do with that, thanks for the quick fix! If I could trouble you with one more script... this one is similar. It's now pulling the materials correctly thanks to the "scene.project" suggestion, however it's not pulling in the text correctly once someone types new data in the MOS plugin. In other words, the script doesn't seem to be putting the new data in the correct places.

    Once again, this works correctly in Designer/Studio so I'm hoping it's just something small again that I'm missing.

    dim flagbkg as xpBaseObject
    dim pwgrp, plgrp, tcgrp as xpBaseObject
    dim hedmainbkg, heddelebkg, winbkgbotbar, winbkgheadshotbar, winbkgpct, winbkgvotesflour, losbkgheadshotbar, losbkgpct, losbkgvotesflour as xpBaseObject
    dim tclbkgheadshotbar, tclbkgpct, tclbkgvotesflour, tcrbkgheadshotbar, tcrbkgpct, tcrbkgvotesflour as xpBaseObject
    dim winfname, winlname, winpct, winvotes, winchk, wintxt, losfname, loslname, lospct, losvotes as xpTextObject
    dim tclfname, tcllname, tclpct, tclvotes, tcrfname, tcrlname, tcrpct, tcrvotes as xpTextObject
    dim cand1fname, cand1lname, cand1party, cand1pct, cand1votes, cand2fname, cand2lname, cand2party, cand2pct, cand2votes as xpTextObject
    dim winhead, loshead, tclhead, tcrhead, cand1head, cand2head as xpBaseObject
    dim cand1headmat, cand2headmat as xpMaterial
    dim redBKG, blueBKG, bothBKG, redGRAD, blueGRAD, grayGRAD as xpMaterial

    scene.GetObjectByName("FLAG BKG", flagbkg)

    scene.project.GetMaterialByName("FLAG_BKG_BLUE_Video", blueBKG)
    scene.project.GetMaterialByName("FLAG_BKG_RED_Video", redBKG)
    scene.project.GetMaterialByName("FLAG_BKG_BOTH_Video", bothBKG)

    scene.project.GetMaterialByName("DEM GRADIENT", blueGRAD)
    scene.project.GetMaterialByName("GOP GRADIENT", redGRAD)
    scene.project.GetMaterialByName("NEUTRAL GRADIENT", grayGRAD)

    scene.GetObjectByName("PROJECTED WINNER GRP", pwgrp)
    scene.GetObjectByName("PROJECTED LOSER GRP", plgrp)
    scene.GetObjectByName("TOO CLOSE TO CALL GRP", tcgrp)

    scene.GetObjectByName("MAIN HEAD BKG", hedmainbkg)
    scene.GetObjectByName("TOTAL VOTES BKG", heddelebkg)

    scene.GetObjectByName("WINNER BKG BOT BAR", winbkgbotbar)
    scene.GetObjectByName("WINNER HEADSHOT BAR", winbkgheadshotbar)
    scene.GetObjectByName("WINNER PCT BKG", winbkgpct)
    scene.GetObjectByName("WINNER NUM VOTES FLOURISH", winbkgvotesflour)
    scene.GetObjectByName("WINNER CHECKMARK", winchk)
    scene.GetObjectByName("PROJECTED WINNER TEXT", wintxt)

    scene.GetObjectByName("LOSER HEADSHOT BAR", losbkgheadshotbar)
    scene.GetObjectByName("LOSER PCT BKG", losbkgpct)
    scene.GetObjectByName("LOSER NUM VOTES FLOURISH", losbkgvotesflour)

    scene.GetObjectByName("LEFT HEADSHOT BOT BAR", tclbkgheadshotbar)
    scene.GetObjectByName("LEFT PCT BKG", tclbkgpct)
    scene.GetObjectByName("LEFT NUM VOTES FLOURISH", tclbkgvotesflour)

    scene.GetObjectByName("RIGHT HEADSHOT BOT BAR", tcrbkgheadshotbar)
    scene.GetObjectByName("RIGHT PCT BKG", tcrbkgpct)
    scene.GetObjectByName("RIGHT NUM VOTES FLOURISH", tcrbkgvotesflour)

    scene.GetObjectByName("WINNER FIRST NAME", winfname)
    scene.GetObjectByName("WINNER LAST NAME", winlname)
    scene.GetObjectByName("WINNER HEADSHOT", winhead)
    scene.GetObjectByName("WINNER %", winpct)
    scene.GetObjectByName("WINNER # VOTES", winvotes)

    scene.GetObjectByName("LOSER FIRST NAME", losfname)
    scene.GetObjectByName("LOSER LAST NAME", loslname)
    scene.GetObjectByName("LOSER HEADSHOT", loshead)
    scene.GetObjectByName("LOSER %", lospct)
    scene.GetObjectByName("LOSER # VOTES", losvotes)

    scene.GetObjectByName("LEFT FIRST NAME", tclfname)
    scene.GetObjectByName("LEFT LAST NAME", tcllname)
    scene.GetObjectByName("LEFT HEADSHOT", tclhead)
    scene.GetObjectByName("LEFT %", tclpct)
    scene.GetObjectByName("LEFT # VOTES", tclvotes)

    scene.GetObjectByName("RIGHT FIRST NAME", tcrfname)
    scene.GetObjectByName("RIGHT LAST NAME", tcrlname)
    scene.GetObjectByName("RIGHT HEADSHOT", tcrhead)
    scene.GetObjectByName("RIGHT %", tcrpct)
    scene.GetObjectByName("RIGHT # VOTES", tcrvotes)

    scene.GetObjectByName("CAND 1 FIRST NAME", cand1fname)
    scene.GetObjectByName("CAND 1 LAST NAME", cand1lname)
    scene.GetObjectByName("CAND 1 HEADSHOT", cand1head)
    cand1head.GetMaterial(0, cand1headmat)
    scene.GetObjectByName("CAND 1 PARTY", cand1party)
    scene.GetObjectByName("CAND 1 PERCENT", cand1pct)
    scene.GetObjectByName("CAND 1 VOTES", cand1votes)

    scene.GetObjectByName("CAND 2 FIRST NAME", cand2fname)
    scene.GetObjectByName("CAND 2 LAST NAME", cand2lname)
    scene.GetObjectByName("CAND 2 HEADSHOT", cand2head)
    cand2head.GetMaterial(0, cand2headmat)
    scene.GetObjectByName("CAND 2 PARTY", cand2party)
    scene.GetObjectByName("CAND 2 PERCENT", cand2pct)
    scene.GetObjectByName("CAND 2 VOTES", cand2votes)

    if trim(text) = "CANDIDATE 1" then

    pwgrp.visible = true
    plgrp.visible = true
    tcgrp.visible = false

    winfname.Text = cand1fname.Text
    winlname.Text = cand1lname.Text
    winhead.setMaterial(0, cand1headmat)
    winpct.Text = cand1pct.Text
    winvotes.Text = cand1votes.Text

    losfname.Text = cand2fname.Text
    loslname.Text = cand2lname.Text
    loshead.setMaterial(0, cand2headmat)
    lospct.Text = cand2pct.Text
    losvotes.Text = cand2votes.Text

    if cand1party.Text = "REPUBLICAN" then
    flagbkg.setMaterial(0, redBKG)
    hedmainbkg.setMaterial(0, redGRAD)
    heddelebkg.setMaterial(0, redGRAD)
    winbkgbotbar.setMaterial(0, redGRAD)
    winbkgheadshotbar.setMaterial(0, redGRAD)
    winbkgpct.setMaterial(0, redGRAD)
    winbkgvotesflour.setMaterial(0, redGRAD)
    losbkgheadshotbar.setMaterial(0, redGRAD)
    losbkgpct.setMaterial(0, redGRAD)
    losbkgvotesflour.setMaterial(0, redGRAD)

    winchk.textwithtags = "{FS RESULTS CHECK RED}" & winchk.textwithtags
    wintxt.textwithtags = "{FS RESULTS PROJ WINNER RED}" & wintxt.textwithtags

    else if cand1party.Text = "DEMOCRAT" then
    flagbkg.setMaterial(0, blueBKG)
    hedmainbkg.setMaterial(0, blueGRAD)
    heddelebkg.setMaterial(0, blueGRAD)
    winbkgbotbar.setMaterial(0, blueGRAD)
    winbkgheadshotbar.setMaterial(0, blueGRAD)
    winbkgpct.setMaterial(0, blueGRAD)
    winbkgvotesflour.setMaterial(0, blueGRAD)
    losbkgheadshotbar.setMaterial(0, blueGRAD)
    losbkgpct.setMaterial(0, blueGRAD)
    losbkgvotesflour.setMaterial(0, blueGRAD)

    winchk.textwithtags = "{FS RESULTS CHECK BLUE}" & winchk.textwithtags
    wintxt.textwithtags = "{FS RESULTS PROJ WINNER BLUE}" & wintxt.textwithtags

    else if cand1party.Text = "INDEPENDENT" then
    flagbkg.setMaterial(0, bothBKG)
    hedmainbkg.setMaterial(0, grayGRAD)
    heddelebkg.setMaterial(0, grayGRAD)
    winbkgbotbar.setMaterial(0, grayGRAD)
    winbkgheadshotbar.setMaterial(0, grayGRAD)
    winbkgpct.setMaterial(0, grayGRAD)
    winbkgvotesflour.setMaterial(0, grayGRAD)
    losbkgheadshotbar.setMaterial(0, grayGRAD)
    losbkgpct.setMaterial(0, grayGRAD)
    losbkgvotesflour.setMaterial(0, grayGRAD)

    winchk.textwithtags = "{FS RESULTS CHECK BLACK}" & winchk.textwithtags
    wintxt.textwithtags = "{FS RESULTS PROJ WINNER BLACK}" & wintxt.textwithtags

    end if

    else if trim(text) = "CANDIDATE 2" then

    pwgrp.visible = true
    plgrp.visible = true
    tcgrp.visible = false

    winfname.Text = cand2fname.Text
    winlname.Text = cand2lname.Text
    winhead.setMaterial(0, cand2headmat)
    winpct.Text = cand2pct.Text
    winvotes.Text = cand2votes.Text

    losfname.Text = cand1fname.Text
    loslname.Text = cand1lname.Text
    loshead.setMaterial(0, cand1headmat)
    lospct.Text = cand1pct.Text
    losvotes.Text = cand1votes.Text

    if cand2party.Text = "REPUBLICAN" then
    flagbkg.setMaterial(0, redBKG)
    hedmainbkg.setMaterial(0, redGRAD)
    heddelebkg.setMaterial(0, redGRAD)
    winbkgbotbar.setMaterial(0, redGRAD)
    winbkgheadshotbar.setMaterial(0, redGRAD)
    winbkgpct.setMaterial(0, redGRAD)
    winbkgvotesflour.setMaterial(0, redGRAD)
    losbkgheadshotbar.setMaterial(0, redGRAD)
    losbkgpct.setMaterial(0, redGRAD)
    losbkgvotesflour.setMaterial(0, redGRAD)

    winchk.textwithtags = "{FS RESULTS CHECK RED}" & winchk.textwithtags
    wintxt.textwithtags = "{FS RESULTS PROJ WINNER RED}" & wintxt.textwithtags

    else if cand2party.Text = "DEMOCRAT" then
    flagbkg.setMaterial(0, blueBKG)
    hedmainbkg.setMaterial(0, blueGRAD)
    heddelebkg.setMaterial(0, blueGRAD)
    winbkgbotbar.setMaterial(0, blueGRAD)
    winbkgheadshotbar.setMaterial(0, blueGRAD)
    winbkgpct.setMaterial(0, blueGRAD)
    winbkgvotesflour.setMaterial(0, blueGRAD)
    losbkgheadshotbar.setMaterial(0, blueGRAD)
    losbkgpct.setMaterial(0, blueGRAD)
    losbkgvotesflour.setMaterial(0, blueGRAD)

    winchk.textwithtags = "{FS RESULTS CHECK BLUE}" & winchk.textwithtags
    wintxt.textwithtags = "{FS RESULTS PROJ WINNER BLUE}" & wintxt.textwithtags

    else if cand2party.Text = "INDEPENDENT" then
    flagbkg.setMaterial(0, bothBKG)
    hedmainbkg.setMaterial(0, grayGRAD)
    heddelebkg.setMaterial(0, grayGRAD)
    winbkgbotbar.setMaterial(0, grayGRAD)
    winbkgheadshotbar.setMaterial(0, grayGRAD)
    winbkgpct.setMaterial(0, grayGRAD)
    winbkgvotesflour.setMaterial(0, grayGRAD)
    losbkgheadshotbar.setMaterial(0, grayGRAD)
    losbkgpct.setMaterial(0, grayGRAD)
    losbkgvotesflour.setMaterial(0, grayGRAD)

    winchk.textwithtags = "{FS RESULTS CHECK BLACK}" & winchk.textwithtags
    wintxt.textwithtags = "{FS RESULTS PROJ WINNER BLACK}" & wintxt.textwithtags

    end if

    else if trim(text) = "TOO CLOSE TO CALL" then

    pwgrp.visible = false
    plgrp.visible = false
    tcgrp.visible = true
    flagbkg.setMaterial(0, bothBKG)

    hedmainbkg.setMaterial(0, grayGRAD)
    heddelebkg.setMaterial(0, grayGRAD)

    tclfname.Text = cand1fname.Text
    tcllname.Text = cand1lname.Text
    tclhead.setMaterial(0, cand1headmat)
    tclpct.Text = cand1pct.Text
    tclvotes.Text = cand1votes.Text

    tcrfname.Text = cand2fname.Text
    tcrlname.Text = cand2lname.Text
    tcrhead.setMaterial(0, cand2headmat)
    tcrpct.Text = cand2pct.Text
    tcrvotes.Text = cand2votes.Text

    tclbkgheadshotbar.setMaterial(0, grayGRAD)
    tclbkgpct.setMaterial(0, grayGRAD)
    tclbkgvotesflour.setMaterial(0, grayGRAD)

    tcrbkgheadshotbar.setMaterial(0, grayGRAD)
    tcrbkgpct.setMaterial(0, grayGRAD)
    tcrbkgvotesflour.setMaterial(0, grayGRAD)

    end if

    #XPression


  • 4.  RE: Applying material via Script not working in ENPS Plugin

    Posted 10-11-2018 18:25
    You need to do this in OnOnline instead of OnSetText. What is likely happening is that the text object that this script is on, is being update before all the data for the other text objects that this script is trying to pull data from. You cannot set the order in which published text objects are set, so if the script runs prior to all the other fields being set it will be using the wrong data. OnOnline runs after all text objects have their new data, so that would be the right place to do this. You'll probably need to make a few tweaks for this to work in OnOnline; like "scene" will need to be changed to "self", etc.

    #XPression