Graphics

 View Only
  • 1.  global swap of material

    Posted 08-22-2017 18:58
    hi guys,
    i'm looking for a simple way to swap out a team logo. I have about 10 team logos that i want to quickly swap out thru out the project without having to maually select them within the material manager. I did have it set up so you only needed to swap out the logo in the material manager, but i'm looking for somehting quicker, maybe using VL, input selector and text object....1 = panthers, 2 = lion, 3 = tigers...

    anyone have a clue?



  • 2.  RE: global swap of material

    Posted 08-24-2017 14:37
    Hi
    I'd do it script.
    I'll assume you have every team logo already loaded as a material, and that they are all interchangeable (ie all line up the same way if you assign them to a quad)
    In each scene, have a text box that will be used to choose each team logo you need - these could be datalinq'd or set to use a global list of all your team names. If you use datalinq, this could achieve what you need on a global project scale.
    If you name your text object and team logo quad with the same number at the end, this will make this script useable across each text object and quad in your scene without changing anything
    eg TeamText1, TeamLogoQuad1 Just copy and paste it onto the OnSetText event for each text object
    In the OnSetText event for your text object put this script:

    'this is how we work out which team we are going to update, and means the same code can be used in every text object that needs to update a quad without doing any further changes
    'Assuming the text object is called TeamText
    dim teamIndex as integer = val(self.name.replace("TeamText",""))
    dim teamQuad as xpQuadObject
    dim teamMaterial as xpMaterial

    'Get the reference to our team quad
    self.GetObjectByName("TeamLogoQuad"+teamIndex.tostring(), teamQuad)
    'The text being set in the text box, must be the name of the material you want to use. So naming the materials as the team names makes sense, which looks like you have done.
    engine.GetMaterialByName(text, teamMaterial)

    'Now assign that material to the quad's front face
    teamQuad.SetMaterial(0, teamMaterial)

    That's it!




    #XPression


  • 3.  RE: global swap of material

    Posted 08-28-2017 22:36
    Pretty easy in VL using a text object fed by a LIST BOX and using an input selector block. Let me know if you want the VL layout I tried.
    #XPression


  • 4.  RE: global swap of material

    Posted 09-01-2017 17:17
    I'd actually like to see that VL setup/layout if you don't mind...
    #XPression


  • 5.  RE: global swap of material

    Posted 09-01-2017 21:02

    Where TEAM is Text (controlled by a list box in this example) the operator assigns a number value to this text field corresponding to the team they want. This becomes the index for the Input Selector. If TEAM =1 then Reds material is placed on TeamsLogo-Faces.Face. If 2 is selected it is Lions. You could use the same TEAM text to control every aspect of the scene. This text field could also be controlled by a datalinq (how I do it) Where TEAM Text is linked to a specific field on a CSV spreadsheet. Change this number in the CSV and save it and every instance of the logo would change. I do it this way for the various NBA teams that come to town. It changes all the BG colors, the Fonts, the Logos and even has the team roster built into it. If this isn't what you were asking, then at least this gives you an idea.


    #XPression


  • 6.  RE: global swap of material

    Posted 09-04-2017 14:06
    Another way to do this (and to use your materials more efficiently) is to use this same sort of setup Malcolm has shown here but to use Excel to control your teams. What I normally do is have a Tricode selection area in Excel that then creates a corresponding file path to the team logo that has been designated by the tricode. This then updates the home and away team logos globally throughout the project instead of having to go and change it manually throughout the project. So in essence, instead of loading materials for all teams in XPression (which takes up more space and causes the project to load longer), you only use two materials for logos for the whole project, the home logo material and the away logo material. I have noticed though that using VL in this case can cause a flicker in the logos though because VL renders and updates on each frame rather than rendering the scene completely from the start so scripting this action might be the best option.
    #XPression