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

398: Prototype shape support for brush tool #4399

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open

Conversation

kduske
Copy link
Collaborator

@kduske kduske commented Dec 7, 2023

Closes #398.

This is an alternative design for #4350 where the shapes are created with the DrawBrushTool. Additional shapes are added by implementing and registering a subclass of DrawBrushToolExtension.

Also adds a few features for drawing brushes

  • in 2D views, holding shift will draw a brush with fixed aspect ratio in the directions orthogonal to the view direction
  • in 3D views, holding shift will draw a brush with fixed aspect ratio on the XY plane
  • in 3D views, holding shift and alt will draw a brush with fixed aspect ratio on all axes

Future ideas:

  • Allow changing the shape of the most recently created brush as long as it's still selected by selecting a different shape / changing the shape parameters.

Todos:

  • Add documentation for new features
  • Add more shapes: sphere, arch, ...

@kduske kduske mentioned this pull request Dec 7, 2023
@jitspoe
Copy link
Contributor

jitspoe commented Dec 7, 2023

How well do you think this would work with multi-brush creation? After simple stuff like cylinders, I was planning to add support for hollow pipes/tubes, arches, etc., which is why I felt it might make more sense to be its own tool, but I guess if they're all sort of sub-tools, that could still work?

Also wanted to add options for UV's and such so you could create seamless wrapping around cylinders.

Another thing I'd like to be able to do is convert existing selected brushes to the shape/parameters. For example, say you made a simple blockout and wanted to replace all the pillars (just 4 sided blocks) with cylinders, or you placed some cylinders and wanted to just adjust the number of sides or radius without redoing them all. Maybe a simple "apply" button could work that's enabled when you have brushes selected.

Not suggesting you do any of this stuff now. Just wanted to share stuff I wanted in the future to make sure it aligns with your design.

@kduske
Copy link
Collaborator Author

kduske commented Dec 7, 2023

How well do you think this would work with multi-brush creation? After simple stuff like cylinders, I was planning to add support for hollow pipes/tubes, arches, etc., which is why I felt it might make more sense to be its own tool, but I guess if they're all sort of sub-tools, that could still work?

That sounds like it should still work.

Also wanted to add options for UV's and such so you could create seamless wrapping around cylinders.

I don't see a problem with that either.

Another thing I'd like to be able to do is convert existing selected brushes to the shape/parameters. For example, say you made a simple blockout and wanted to replace all the pillars (just 4 sided blocks) with cylinders, or you placed some cylinders and wanted to just adjust the number of sides or radius without redoing them all. Maybe a simple "apply" button could work that's enabled when you have brushes selected.

Yeah I have thought a bit about that and I'm not so convinced by this idea. There are parameters that you cannot detect easily (like the orientation of the cylinder you want to create). You would want this to be more flexible. What if your brush isn't oriented along a coordinate system axis? What if your brush isn't just a block? What if your brush is already a cylinder, but slightly slanted, and now you select it and choose a cylinder shape with more sides - wouldn't you expect the outcome to be still slanted? But the tool can't do that, because it doesn't know that the cylinder has been rotated or sheared or whatever.

I think this will turn out to be more frustrating because in many cases it won't do what the user expects.

@jitspoe
Copy link
Contributor

jitspoe commented Dec 8, 2023

I feel like just using the brush bonds and an axis selection would be sufficient and meet expectations. I don't think rotating cylinders at arbitrary angles is common practice. Don't the compilers sometimes freak out if you do that anyway? I think it'd quickly become obvious that the tool is just limited to the 3 axes. I don't think skipping out on functionality because it might not cover all cases is a good reason to avoid adding it all together.

Personally, I find this kind of thing really useful in BSP where I can specify an exact radius -- especially if you're making a large room. Maybe I want to have something that has a radius of exactly 520 units. That'd be a pain to click and drag out, but if I could just place a brush in the center then set the radius and tweak the number of sides until it looked good, that'd be a much better workflow.

@kduske
Copy link
Collaborator Author

kduske commented Dec 8, 2023

I feel like just using the brush bonds and an axis selection would be sufficient and meet expectations. I don't think rotating cylinders at arbitrary angles is common practice. Don't the compilers sometimes freak out if you do that anyway? I think it'd quickly become obvious that the tool is just limited to the 3 axes. I don't think skipping out on functionality because it might not cover all cases is a good reason to avoid adding it all together

TrenchBroom's UX is supposed to be simple, unsurprising and intuitive. That's why it's easy to use and easy to learn. So on the contrary, I think it's a very good reason to skip functionality if it doesn't fit these criteria.

Personally, I find this kind of thing really useful in BSP where I can specify an exact radius -- especially if you're making a large room. Maybe I want to have something that has a radius of exactly 520 units. That'd be a pain to click and drag out, but if I could just place a brush in the center then set the radius and tweak the number of sides until it looked good, that'd be a much better workflow.

Sure, there are always workflows that TB doesn't support well. But again, its UX is geared towards other principles. It's not workflow agnostic in that it supports everyone's workflows and ideas. Rather, TB is opinionated in that it is geared towards specific workflows. The idea is to make simple things simple, and difficult things possible. If we can make a difficult problem simple, that's great. But not at the price of overloading the UI with more and more options until a user can't tell what the intended workflow is. And the intended workflow in TB is drawing brushes with the mouse.

That is why I often draw the line and decide not to support features that are only useful to a very specific way of working. I'm sorry about that, but it is more import to me to have a cohesive UX, even at the risk of making a wrong decision here and there.

Also, if it turns out that there is a lot of demand to support a different workflow, we can always add things in the future. But the opposite is almost impossible - I can never take a feature away once it's in the editor.

@kduske
Copy link
Collaborator Author

kduske commented Dec 9, 2023

I have cleaned up the code a bit and would propose this as a basis for adding more shapes and, later on, additional functionality.

@kduske kduske marked this pull request as ready for review December 9, 2023 18:17
@kduske
Copy link
Collaborator Author

kduske commented Dec 10, 2023

I have added support for drawing brushes with a fixed aspect ratio in 2D and 3D:

  • in 2D views, holding shift will draw a brush with fixed aspect ratio in the directions orthogonal to the view direction
  • in 3D views, holding shift will draw a brush with fixed aspect ratio on the XY plane
  • in 3D views, holding shift and alt will draw a brush with fixed aspect ratio on all axes

@kduske
Copy link
Collaborator Author

kduske commented Dec 10, 2023

@jitspoe Would you be interested to add more shapes on the basis of this PR?

@kduske
Copy link
Collaborator Author

kduske commented Dec 15, 2023

@jitspoe any interest in working on this?

@jitspoe
Copy link
Contributor

jitspoe commented Dec 18, 2023

Sorry, been busy lately and haven't had a chance to keep up with all the github stuff. What's left to do? Just more shapes? Can't promise when I'll have time to work on TB stuff again. Are you wanting me to work on this within a branch or is this in a state it could be merged into master and just have features added to it?

@kduske
Copy link
Collaborator Author

kduske commented Dec 18, 2023

Sorry, been busy lately and haven't had a chance to keep up with all the github stuff. What's left to do? Just more shapes? Can't promise when I'll have time to work on TB stuff again. Are you wanting me to work on this within a branch or is this in a state it could be merged into master and just have features added to it?

No worries, we're all just hobbyists. I'd like to get a couple more shapes in before merging this, then we can add more shapes later on. I just want to ship this with more than two shapes. Let's compile a list of shapes that we think should be supported for a first iteration. Here's mine:

  • cylinder
  • cone
  • sphere
  • half sphere
  • hollow cylinder

@kduske
Copy link
Collaborator Author

kduske commented Dec 18, 2023

Oh, and I don't expect you to implement any of this if you don't have time right now. I can work on it, too.

@eGax
Copy link
Contributor

eGax commented Jan 3, 2024

I did notice some differences in that last action build you made I didn't see mentioned.

https://github.com/TrenchBroom/TrenchBroom/actions/runs/7267066845

The rotation tool setting had been removed. I assume it was intentional or due to being a WIP but just in case I thought I would comment.

image

A prior build on the left with Rotation setting shown and your last primitive tool build on the right is lacking those.

@eGax
Copy link
Contributor

eGax commented Jan 3, 2024

OK, after playing around with this a bit more it seems just the behavior changed slightly. Before you could select the brush, then activate rotation tool and the Rotation setting will just appear.

Now after activating the Rotation tool you are required to make an extra click on the brush to make the settings appear.

2024-01-03.02-15-07.mp4

@kduske
Copy link
Collaborator Author

kduske commented Jan 3, 2024

That's a bug, thanks for pointing it out!

@eGax
Copy link
Contributor

eGax commented Jan 4, 2024

Even with just cube, cone, and cylinders the shape tool works pretty nice.

@jitspoe
Copy link
Contributor

jitspoe commented Feb 21, 2024

Your changes reminded me I had some WIP stuff to try to support hollow cylinders/tubes/pipes, but that meant making it so the brush tool could actually support an array of brushes. Not sure if I'm on the right track or not: a48deda

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for quick primitive creation like cylinders
3 participants