Announcement

Collapse
No announcement yet.

UMG - Drag&Drop capturing mouse events.

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

    UMG - Drag&Drop capturing mouse events.

    I have just spend 2h trying to get simple mouse events working. Like change text over text block when mouse enter widget.

    But so far without success.

    I have Drag&Drop working with Slate in C++, and tried to get something working in UMG now.
    So far it seems like my widget can't simply capture mouse click.

    Could anyway write, some steps, needed to get inpture capture working for UMG widget ?
    https://github.com/iniside/ActionRPGGame - Action RPG Starter kit. Work in Progress. You can use it in whatever way you wish.

    #2
    You could try the Enable Input Node for the BluePrint. Connect that to Event Begin Play. Might work. Works for Meshs in the scene. Just a theory, might be way off.

    Comment


      #3
      Nevermind. It turned out that stacking UMG and slate in single viewport didn't worked out so well. My Slate widgets were capturing all input before it make into UMG.
      https://github.com/iniside/ActionRPGGame - Action RPG Starter kit. Work in Progress. You can use it in whatever way you wish.

      Comment


        #4
        Hey iniside -- were you able to get some drag & drop functionality with UMG? I would really appreciate a screenshot of a simple set up. I've been trying to set this up for a while with no results.

        thanks!
        Sunless Chronicles: Upcoming Action RPG game for Windows

        Check out the development thread and the first look video. Let me know your thoughts.

        Comment


          #5
          Looks like my quick start guide for drag drop didn't survive the drafting stage of the release notes, guess they were already getting a bit hefty - that's right the release notes were bigger

          NOTE: Drag/Drop bug, if you attempt to use it in a fullscreen game it's going to kick you out. Currently it's placing the content into a new temp window, on the list to be fixed. Other random stuff, if you attempt to make a button drag/droppable, you're going to have a bad time. The button is going to capture the mouse on down and the drag will never occur. Also on the list of stuff to fix

          Step 1) On Draggable Widget: You will implement the on mouse down event and do something like this: This allows drag detection to be detected, and will maintain it as long as the Drag Key is pressed.
          Click image for larger version

Name:	Screen Shot 2014-10-16 at 7.01.56 PM.png
Views:	1
Size:	286.0 KB
ID:	1057866

          Step 2) On Draggable Widget: When the drag is detected (after movement has overcome the jitter damping in Slate), On Drag Detected will be fired, and you can implement it like this, by creating a DragDropOperation that has a UObject Payload, and some widget representing the dragged content. Here’s an example I made with a spell icon widget.
          Click image for larger version

Name:	Screen Shot 2014-10-16 at 7.02.12 PM.png
Views:	1
Size:	393.4 KB
ID:	1057867

          Step 3) On Droppable Widget, you’ll need to implement some logic that does something with the Payload and Operation. I made a simple example that doesn’t do anything fancy it just moves the payload, which happens to be the spell Widget that the drag occurred on, and it just re-parents it to a widget it controls.
          Click image for larger version

Name:	Screen Shot 2014-10-16 at 7.02.28 PM.png
Views:	1
Size:	542.3 KB
ID:	1057868

          Step 4)
          Click on [Root] in both the Draggable and Droppable widget's, change their visibility to Visible, instead of Self Hit Test Invisible. That way they actually receive these mouse and drop/drag events.
          Last edited by Nick Darnell; 10-19-2014, 09:02 AM.

          Comment


            #6
            Thank you so much for this Nick. I was just starting on porting from my old system of drawing everything manually to using UMG. This should make my D&D systems so much easier to use.
            Movable Widgets

            Comment


              #7
              Thanks a lot for that Nick

              I guess I'll wait until the button issue is fixed!
              Sunless Chronicles: Upcoming Action RPG game for Windows

              Check out the development thread and the first look video. Let me know your thoughts.

              Comment


                #8
                I'm having some trouble getting the above to work. I have an Image inside of a scale box as my widget. In the Graph I right clicked "On Mouse Button Down" and implemented it like the image above. If I run it now there is no response from OnMouseButtonDown, so I bound it to the event on the Image "OnMouseButtonDown". This causes this event to fire, however my OnDragDetected function gets no response here. Is there something I'm missing?

                Comment


                  #9
                  if you implement the OnMouseButtonDown and the OnDragDetected in your widget, then bind your OnMouseButtonDown for the image to the OnMouseButtonDown of your widget instead of creating a new binding for the image. it should work.

                  Comment


                    #10
                    Originally posted by greynz View Post
                    I'm having some trouble getting the above to work. I have an Image inside of a scale box as my widget. In the Graph I right clicked "On Mouse Button Down" and implemented it like the image above. If I run it now there is no response from OnMouseButtonDown, so I bound it to the event on the Image "OnMouseButtonDown". This causes this event to fire, however my OnDragDetected function gets no response here. Is there something I'm missing?
                    I forgot one very important thing!

                    Click on [Root] in both the Draggable and Droppable widget's, change their visibility to Visible, instead of Self Hit Test Invisible.

                    Comment


                      #11
                      Well I can definitely get the drag to show up but I've tried multiple different widgets to drop on and none seem to receive the payload I'm trying to hand to them.

                      Edit: Ignore my comment, it's too early and I was casting to the wrong place.
                      Last edited by Hakabane; 10-19-2014, 09:55 AM.
                      Movable Widgets

                      Comment


                        #12
                        @Nick, do you have much information or documentation on how "On Drag Over" works? Basically all I need to know is how to figure out the widget that is below the payload that I'm dragging.

                        Thanks,
                        Haka
                        Movable Widgets

                        Comment


                          #13
                          Originally posted by Hakabane View Post
                          @Nick, do you have much information or documentation on how "On Drag Over" works? Basically all I need to know is how to figure out the widget that is below the payload that I'm dragging.
                          The documentation that exists is what's above, official doc that covers all the things takes time and this feature still has some rough edges as noted at the top. "On Drag Over" is what is called on the widget that the droppable content is hovering on top of.

                          Comment


                            #14
                            Ahhhhh I figured it out! Or at least what is causing my problem.. Now I just need to figure out the best way to go about this. Your reply got me on the right trail Nick, thinking about the Root got me thinking about parents. Anyways, the problem was I have an Item widget which I implemented the mouse down and drag and drop functions on. If I make one of these on its own everything works as expected. However, I didn't think it was working because whenever I made one of the widgets I would immediately parent it into a Uniform Grid Panel (my inventory). It looks like now the over-ridden mousedown and ondrag functions don't get called on my item when it's a child. It's calling the uniform grid's mousedown / ondrag functions.

                            I'd like it to ignore the parent's functions so that I can drag around the items that are contained within it using their mousedown / ondrag functions. Is this possible? If not, how could I get a reference to a specific item within a grid panel, based on if the mouse is over it? Thank you!

                            Comment


                              #15
                              Hey Nick,

                              I figured it all out. I almost have a completely perfect drag and drop inventory system through UMG now. Your guidance has been really great. I couldn't ask for more helpful devs.
                              Movable Widgets

                              Comment

                              Working...
                              X