Download

widget button to change object material - where to script the actions?

**@fael097 **Sent you a private message. Let me know if it makes any sense to you.

got it, thanks! gonna take a look ASAP

yeah, absolutely it makes sense. the scene has some level of complexity for me, specially the game mode, but I understand the concept. the widget is getting info from the static mesh which is unique to each of the meshes, and then displaying this info, such as color and their names.

so what I thought is something like this, but instead of getting their existing information (such as color and name in this example), getting something I store into them, like number of elements and what materials each element can have assigned.

I do realize I could get the number of elements the mesh already have, but some products have parts that can only have one material, and I wouldn’t need a button for that element, so I think setting a number of “active” elements would be more appropriate.

so each product would have a variable for the number of active elements, and one array of materials for each active element. I see you commented that the showcase object should be hooked up to a database, and what I was thinking is if I could get the value for these variables from an XML table, so I could easily edit and add new material options without having to recompile everything.

so my interface would read the number of active elements from the product, and create that number of buttons, and each button would read the array of materials and create that number of sub-buttons.

I uploaded an html version of what I currently have, just so you can see how the interface would behave. gonna send it to your inbox. right now I don’t have any fancy variables, just hard wired each button to a different material.

so as you can see, right now I have a button labeled “color”, and it opens up 2 buttons labeled “body” and “lid” and each of them opens up another 3 buttons that apply a different material to the teapot part they are assigned to.

with the variables, the color button would create any number of buttons for active elements, and those would create another number of buttons for the array of materials each element can have.
for example:



<?xml?>
<teapot>
  <element name="body">
    <material>Red</material>
    <material>Green</material>
    <material>Blue</material>
  </element>
  <element name="lid">
    <material>Cyan</material>
    <material>Magenta</material>
    <material>Yellow</material>
  </element>
</teapot>


hope all this nonsense is understandable, I don’t know all the technical terms and sometimes I get lost in all of this, and I might be repeating myself as well :rolleyes:

it doesn’t need to be xml, I just thought of that because it’s easily editable with notepad, but really any kind of data table that can be edited manually will do

This should be quite doable with a *.csv that can be loaded into a DataTable. Quite a but of extra setup is required to get something like this going. I’ll try to have a look into this if I find the time this week.