EngineHub / WorldEdit

🗺️ Minecraft map editor and mod
https://enginehub.org/worldedit/
Other
3.09k stars 837 forks source link

Allow filling the edges of a selection #2279

Open haykam821 opened 1 year ago

haykam821 commented 1 year ago

The Problem

Currently, the //faces command exists to fill the six faces of a cuboid region. However, there is no way to specify to only fill the outer edges of this cuboid region.

A Solution

A complement command could be introduced with the syntax //edges <pattern>. For a cuboid region, this would fill its twelve edges. The behavior for other regions is more difficult to define, but the main purpose of this command would be to use it with cuboid regions.

Alternatives

The closest solution I know of is using //faces then manually changing the difference between faces and edges back to air.

TomyLobo commented 1 year ago

How about //g magenta_concrete (abs(x)==1)+(abs(y)==1)+(abs(z)==1)>=2? image

mk-pmb commented 1 year ago

Good idea! I only need the corner pillars, which I'd find more related to //walls (because of the missing top and botton), but I can live with that option on //edges as well. Maybe -v for "vertical only" or -y for "Y axis only"?

How about //g magenta_concrete (abs(x)==1)+(abs(y)==1)+(abs(z)==1)>=2?

Would be appropriate it the goal is to scare potential users away. I know there's often a gap in opinion between the devs and me about ease of use, but I hope we can agree users shouldn't have to type math formulas for common tasks.

TomyLobo commented 1 year ago

well, we can't offer a command for every corner case (pun intended). flags could work, but what about just the corners? what about just the bottom corners? what about just corner pillars but rotated 90°?

There's always a case missing and in order to still support flexible shape generation, we have //generate. If you can't do the math for that and you don't have anyone you can ask about it, you can just select the 4 corner pillars separately and draw them one by one.

Take a look at that earlier command, btw:

//g magenta_concrete (abs(x)==1)+(abs(y)==1)+(abs(z)==1)>=2

What happens here is that we count the number of outer walls this block is a part of. If a block is part of 3 walls, it's a corner. If a block is part of 2 walls, it's an edge. If a block is part of 1 wall, it's a face. Grab a (real-life) cube, pick a corner/edge/face and count the number of walls it's bordering. You'll arrive at those same numbers.

Now in order to only draw the corner pillars, we need to adjust the formula slightly. Basically, we want to completely ignore the top and bottom (i.e. positive and negative y) walls in this calculation, so we just remove the (abs(y)==1) term from the expression:

//g magenta_concrete (abs(x)==1)+(abs(z)==1)>=2

Hope this helps in understanding what's going on.

mk-pmb commented 1 year ago

what about just the corners? what about just the bottom corners? what about just corner pillars but rotated 90°?

Good ideas. I suggest a combination of uppercase flags NSWETB that, if any of them are present, limiting the effect to the {north,south,west,east,top,bottom}-most blocks.

Hope this helps in understanding what's going on.

Thanks. I for one have had enough geometry to understand it (when I'm awake enough), but it's probably helpful for other readers. I agree it's useful to have such a powerful command for power users. In my use case however, I mostly play Minecraft only for recreation, so I'm usually not in the mood for working the algebra part of my brain. (Because when I'm in the mood for that, I'll use my skills for things other than Minecraft.)