Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add drag and drop for rails in editor :) #164

Merged
merged 2 commits into from
Oct 16, 2021

Conversation

DasCapschen
Copy link
Member

Fixed #151 😄

don't merge just yet, there might be some bugs.
we might want to add a minimum radius.

@HaSa1002
Copy link
Member

Cursor is offset.
Repro:

  1. Create Rail with curvature
  2. Add new rail using "after rail"
  3. Drag the endpoint of the second rail

@HaSa1002
Copy link
Member

if you drag the endpoint onto the movement gizmo, you trigger the movement

@HaSa1002
Copy link
Member

HaSa1002 commented Oct 10, 2021

Issue is not related to PR
power line is not updated correctly
grafik

@HaSa1002
Copy link
Member

HaSa1002 commented Oct 10, 2021

I would favor if you could change the addition behaviour to (but not a blocker and can be made in a follow-up PR):

  1. Tell game, you want to add a rail
  2. Move your mouse to start position
  3. Press LMB and hold
    1. If near other rail, snap to that rail and get curvature and radius from that rails
    2. Else set Rotation to 0
  4. Drag rail
  5. Release LMB to end action

@DasCapschen
Copy link
Member Author

ty for review

  • style changes applied
  • cursor offset fixed
  • ui updates while dragging
  • gizmo hidden while dragging (gizmo itself still broken)
  • powerline is a Rail.gd issue
  • gonna code snapping now :)

@DasCapschen DasCapschen force-pushed the dragon-drop branch 2 times, most recently from f53c750 to bb40e63 Compare October 11, 2021 17:02
@DasCapschen DasCapschen self-assigned this Oct 12, 2021
@HaSa1002 HaSa1002 added the enhancement New feature or request label Oct 12, 2021
@HaSa1002 HaSa1002 added this to the 0.9 milestone Oct 12, 2021
@HaSa1002
Copy link
Member

I doesn't do anything after I press OK and instead get that error:

ERROR: Signal 'confirmed' is already connected to given method '_snap_complex_connector' in that object.
   At: core/object.cpp:1512

@HaSa1002
Copy link
Member

and when it starts to show the text box, it says:

ERROR: Signal 'confirmed' is already connected to given method '_snap_complex_connector' in that object.
   At: core/object.cpp:1512
[]
ERROR: Signal 'confirmed' is already connected to given method '_snap_complex_connector' in that object.
   At: core/object.cpp:1512
[]
ERROR: Signal 'confirmed' is already connected to given method '_snap_complex_connector' in that object.
   At: core/object.cpp:1512
[]
ERROR: Signal 'confirmed' is already connected to given method '_snap_complex_connector' in that object.
   At: core/object.cpp:1512
[]
ERROR: Signal 'confirmed' is already connected to given method '_snap_complex_connector' in that object.
   At: core/object.cpp:1512

@DasCapschen
Copy link
Member Author

Looks like you're triggering the complex connector, for arbitrary connections. That's not implemented yet, I guess I should have disabled the popup for it, but as it stands, this PR is WIP.

Signal errors should be fixed with a simple if check. (though I kinda wish godot just wouldn't throw an error on double connect...)
I have no idea where the [] print comes from...

@HaSa1002
Copy link
Member

Yeah I figured the signals will be connected multiple times, because the snapping is in place, but the the popup connection logic is triggered every snapping mouse movement frame.

That is totally fine. I was just super confused, but I found the two working use cases, so no worried there (although the complex one may be used even in the 90° case).

@HaSa1002 HaSa1002 added the editor everthing that belongs to the editor functions of Libre TrainSim label Oct 12, 2021
@HaSa1002 HaSa1002 merged commit 6547268 into Libre-TrainSim:master Oct 16, 2021
@HaSa1002
Copy link
Member

🥳

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editor everthing that belongs to the editor functions of Libre TrainSim enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add drag and drop support for track building
2 participants