-
Notifications
You must be signed in to change notification settings - Fork 79
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
Pick object to follow when activity window is shown #1604
base: master
Are you sure you want to change the base?
Pick object to follow when activity window is shown #1604
Conversation
please refrain of using any multithreading if not 1000% necessary |
Coroutines have nothing to do with multithreading, i.e., they are used for sequential processing and – unlike threads – are in no way concurrent. I suggest using them as a fallback for I really don't like my current solution of the I'll more than likely submit a PR and you can decide if what I come up with is acceptable to you. |
At this early stage, I'd prefer feedback on the basic mechanic. Especially, the idea that the picked object expires after a few seconds, reverting to the current behavior of picking the object near the center of the view. |
Can you describe in the initial post what exactly you want to achieve with this? I.e. how you imagine this to work exactly. That is easier to discuss than to infer/guess that from the source/changeset which is rather large.
IIRC it only had the option to follow the object currently in the cross/center of the window once you click the button. BTW: An alternative to your |
Tested it a bit and thats the behavior:
Hope this helps |
Wow, thanks. There're quite a few things you discovered that don't work as intended. In any case, this has to be rebased on top of #1594, as that has implications for object picking due to how the zoom calculation is affected. I'll keep the debug code around until then. |
Right. I meant to expand the initial post later. I've done so now.
I completely missed that function. Makes perfect sense to get rid of the changes to |
ba559f0
to
cc1a1a4
Compare
Thanks for the update, that makes it clear and sounds very good!
I don't think that can be easily done and neither think is actually that useful for the required work. Might be enough to have "Follow centered object"/"Follow picked object" instead.
I'm fine with the kinda higher radius
I think it's a good idea. After unfollow the current mechanic should be used, same as after expiration. Might even have a separate button but not sure if there is enough space to make this look good.
Absolutely: Get rid of the latter by folding it into the former. Or do you require the separation at some point? Some implementation notes:
|
cc1a1a4
to
bef6906
Compare
I've used your suggestion for now, but do still find that rather useful. Postponed to a separate PR and if I discover along the way, that it's not worth the effort, I'll drop it. (I don't think it's too involved TBH.)
It doesn't make a lot of sense to me to pick an object ridiculously far away from the cursor when the objective is to pick what the user clicked on.
There's room for a button, but it involves more work, including creating a new asset (or can we reuse something?). Maybe in the future?
Well, I did and it bit me in the end.
Consequently, we now have another bool in
Thanks for the pointer. ;-) Fixed!
Done.
Also done. Went further and moved it into a separate file. I felt it had grown large enough.
This is now done in the static member functions via a Notes:
|
bef6906
to
1b0811a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm using move-semantics to pass the PickedMovableObject from iwAction to iwObservate which invalidates the object stored in iwAction. Not technically needed since iwAction doesn't stick around long enough to cause problems, but is more correct anyway.
I don't think this is required it just makes things a bit more complicated as one now has to know what a moved-from pickable object is. So I'd just leave it. BTW: You can use std::exchange
for the move ctor and even for the current call if you need:
std::move(pickedObject_)
-> std::exchange(pickedObject_, PickedMovableObject{})
Calculate the euclidean distance to the origin or another point, avoiding overflows when all element types are unsigned.
PickedMovableObject represents a node object figure that has been picked to be followed in the observation window.
Pick the object to follow when the activity window is shown.
1b0811a
to
4d318e4
Compare
For some figures, there's a significant position error due to an offset that's applied for drawing. I've spent some time exploring different solutions:
Option 3 seems the most reasonable and I'd leave that work for a follow-up PR. This error isn't new, so it's not a regression and this PR doesn't make things worse. One exception might be trying to pick a builder which can move outside the pick radius (in pixels, not map points) while working on a building site. With these future changes in mind, it might make sense to polish the debug code ( This PR may also contribute a few more
Lastly, another issue identified is that |
Using the "Follow object" function is quite cumbersome, as one has to place the object near the center of the Observation Window first, which can be difficult at higher game speeds.
I propose picking the object to follow at the time the mouse click to open the Activity Window occurs. Simultaneously, I didn't want to completely replace the existing behavior and implemented an expiration mechanic. After some amount of time (TBD) the picked object is expired and the Observation Window reverts to the existing behavior. For the duration the picked object is valid, the tooltip shows which object will be followed when activated (currently – as a placeholder only – using
typeid(obj).name()
).I can think of less clunky, more elaborate solutions, but it's honestly not an important enough feature, that I'd care to expend the effort. The goal is just to go from (IMO) "unusable" to "usable".
To-do:
Follow %s
format string and replacestd::type_info
placeholders.IsValid()
andHasExpired()
or otherwise make the use of each function clearer.MoveToFollowedObj()
can probably be rewritten usingTrackPickedMovableObject()
.