-
-
Notifications
You must be signed in to change notification settings - Fork 113
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
Select sectors by distance. #519
Conversation
When selecting sectors by poin, select sector containing point and closest to given point, instead of just selecting first one containing it. Allows working with sectors inside sectors, needed when working with 3d floors or similar. Use custom distance code, as MapSector::distanceTo seems to be very slow (noticable lag on hover highlights if using it).
After working more I see that highlight is very necessary. And for not too complex maps I tried to create so far there were no issues with this implementation. Though I noticed that working with 3d sectors is still quite complicated in slade, as 3d editing does not seem to support rendering it correctly. Still this is a minor improvement, allowing one to work in some cases. Though there are limitations with this too, if one say has stacked two, say rectangle sectors, on one another, all vertex distances will be same and which one gets selected will be a bit unpredictable (well should be one with lower id). Though I'll try to come up with some better idea for such cases too, maybe. |
I'm not sure if changing the semantics of a function called |
By "sectors within sectors", do you mean self-referencing sectors? You don't need those to make 3D floors, unless you mean purely vanilla invisible floors rather than the ZDoom/Eternity feature. |
No, I have not worked with self referencing sectors at all. I mean stuff like in his video on doom builder (which i can not use as I use linux) https://www.youtube.com/watch?v=5rsLrwFlhME . You have sector, then you draw in some shape inside, then some dummy sector in some other place, take one line of dummy sector set it to type 160 etc... And you get platform or maybe walls from drawn blueprint, and then roof, then you could add second floor etc etc. Still without support in 3d edit it is quite a pain. And as mentioned previously overlapping vertices is problem |
I guess I don't understand how this change helps with that? Selecting inside the inner sector should always only select... the inner sector. |
I'm not seeing the point of this either - MapSector::isWithin will work in all normal situations, the only place I can see where it might not is self-referencing sectors, which you have said this isn't for. |
Have you tried how current code works? Simple test case, draw a sector, for simplicity a square, then draw another sector inside it. De-select everything, go to sector mode and now try to select smaller sector using mouse. There is no way to do that. As current code bails out as soon as it encounters first sector that contains mouse and returns that sector. As bigger/containing sector was drawn first, it has lower id, and will always be returned. This creates a really awkward situation with basically unselectable sector. I can imagine that being an issue even without trying to do what I was doing. But in any case, for use case see my linked video. If you accidentally place smaller sector inside larger, you will again have trouble removing it (barring undo) or maybe editing some map that has such sectors. I do not see how having such a limitation is good. |
Are you drawing the middle sector counter-clockwise (so that the lines point outwards)? If so, that will put a 'hole' in the surrounding sector, rather than create a new one in the middle. If you press |
I drawn sectors in both ways. In any case when I draw sector inside walls seem to be two sided by default. As for the hole, if I'm using 3d floors (which I am) it is not a hole but floating platform or some such. Again look at the video. I can upload wad with my tests after about 10hours when I get back from work. In any case look at the orginal code of |
I have watched the video, and what he does with the inner sector works fine in SLADE, the inner sector is selectable.
I think I'd have to see your map to figure out what's going on on your end. |
I'll test again with old code when I get back. But I believe it did not work for me. But what definitely does not seem to work is creating smaller sector outside and then moving it inside bigger one, then trying to select it does not work for sure. |
Yes that is expected, doing that will result in the inner sector's lines having the wrong sector references, as SLADE doesn't automatically fix/update these in this case. |
It probably should. :) |
Hm I guess this can be closed. Indeed it seems everything seems to be working when drawing new sector directly inside larger sector (no matter the direction, CW or CCW). It only fails when moving in sector from outside, possibly I mostly tried that before patching. But for that as I understand it is unrelated feature. Wonder how I got so lost. Possibly I mostly tried drawing outside and moving in. Sorry for time wasted. Still looking at that doom maker video and as far as I have tried with slade, it seems slade has some limitations, i.e. 3d view does not seem to show 3d floors as they are rendered in-game or in doom maker. Unless maybe I'm again doing something incorrectly or missing some setting? |
3D mode doesn't show 3D floors yet, no. I've done some work on it; it's #205. |
When selecting sectors by poin, select sector containing point and closest to
given point, instead of just selecting first one containing it. Allows working
with sectors inside sectors, needed when working with 3d floors or similar.
Use custom distance code, as MapSector::distanceTo seems to be very slow
(noticeable lag on hover highlights if using it).
SIDE NOTE:
Considering some performance implication of this, and the need of this to work 3d stuff (not entirely sure it is strictly needed, as I'm new to mapping, and maybe there are some other methods, but in any case such precise selection seems like a correct way to function), highlight feature might be problematic (though with this distance code it was not bad on my smallish map, while distanceTo was very slow).