Announcement

Collapse
No announcement yet.

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

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    If you look at my example #9, you'll see that I'm doing it inside of the SuperSphere - or Teapot, in your case. It's the teapot that creates the widget and sends self reference.

    Alternatively, you can use last pic in example #7 and have teapot access the HUD, grab the widget reference present there and store it for itself.

    Comment


      #17
      Originally posted by Everynone View Post
      If you look at my example #9, you'll see that I'm doing it inside of the SuperSphere - or Teapot, in your case. It's the teapot that creates the widget and sends self reference.

      Alternatively, you can use last pic in example #7 and have teapot access the HUD, grab the widget reference present there and store it for itself.
      ok so I mistakenly thought that having the widget created inside the teapot would need a different widget for each object whenever I decided to try to place more than one object in the scene, but I suppose it's just the creation, it could point to the same widget that would be created based on the object's specifications, right? so I'm gonna try to have the object itself create the widget.

      I assume that it's a better choice than making it in the hud blueprint as it is currently?

      EDIT: so I tried creating the widget from the teapot with a reference to self and it worked.

      it's really funny for me because I get really confused by this kind of interaction. like, inside the widget blueprint I created a variable, pointing it to the teapot actor class blueprint, and I thought that it would be enough to use it as a reference inside the widget blueprint, but that variable meant nothing for some reason. guess I had to define it? but then, the "create widget" node, which is in another blueprint, "found" that variable and added a connector with that variable in the node, even though I had just created and exposed the variable, didn't drag it to the widget blueprint, didn't connect it anywhere, but it appeared in the node anyway. cool I guess, but how did it find it and why? so I could define it? each time I want to make something interact cross blueprints it's a totally different method.

      It's hard for me to make sense of these things, I've been watching quite a few videos about blueprints from the basics to more intermediate cases, but each case is so specific, I can't seem to find a logic for these kinds of interactions.
      Last edited by fael097; 08-17-2018, 01:08 PM.
      behance.net/fael097

      Comment


        #18
        ok so I mistakenly thought that having the widget created inside the teapot would need a different widget for each object whenever I decided to try to place more than one object in the scene
        On the contrary, you were right, this approach would indeed require one widget per one object. It's a ham-fisted approach but it's exceptionally easy too implement. Do note that one widget here mean one widget instance - it's still the same widget blueprint, of course.

        It is not a bad approach if you want the widget to remember the settings as the user scrubs through items and fiddles with the sliders and whatnot. When you come back to the previous item, the settings will be still applied, no need to save anything.

        Comment


          #19
          well I guess that's what I meant, I thought I would have to code a separate widget for each object.

          so how would you approach it? I want to make a material selector that works like this:

          when I have one object in my scene, a simple button (let's say button 1) will appear on the botom, and it will display the name of the object I have in my scene, and the behaviour will be related to that object. if I add another object, another button that behaves the same will appear, but with information from the second object. (didn't figure out how I'm gonna add the object yet, but it doesn't matter right now)

          these single buttons when clicked will open another series of buttons above them, and their behaviour doesn't matter, what matters is that the widget will work the same for every object, but the text displayed in the butons (product name, material name) and the number of buttons (number of elements in the object) will be generated dynamically based on information from the object.

          would you make one widget and script this behaviour based on variables set on object construction?
          behance.net/fael097

          Comment


            #20
            It makes perfect sense. I would definitely use 1 widget for this and feed it data from the currently selected object. This widget would have a second hidden panel with additional buttons. I'll try to put an example for you if you can wait until Monday. Stay tuned.

            Comment


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

              Comment


                #22
                got it, thanks! gonna take a look ASAP
                behance.net/fael097

                Comment


                  #23
                  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:

                  Code:
                  <?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
                  behance.net/fael097

                  Comment


                    #24
                    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
                    behance.net/fael097

                    Comment


                      #25
                      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.

                      Comment

                      Working...
                      X