Ghoulboy78 / Scarpet-edit

A useful tool for developing decorative builds etc in scarpet.
Creative Commons Zero v1.0 Universal
22 stars 4 forks source link

Hollow outline #56

Closed Firigion closed 3 years ago

Firigion commented 3 years ago

Added hollow and outline commands and brushes, to keep chipping away at tasks in #28.

The commands affect all blocks within a selection, hollowing out or outlining (adding at the border of) blobs of blocks of the same type. There's an optional block argument in both commands to specify what types of blocks to affect. The brushes work a bit differently, since instead of affecting all blocks within the selection, they search for a blob of blocks connected to the block clicked with the brush (blob of blocks meaning all connected blocks of the same type as the starting one) and apply hollow or outline only to those blocks. Outline replaces only air (or greenery, if used with -g).

The name outline collides with the one added in #45 (and as of now waiting to be readded in #52). I suggest renaming that one to outline_selection and leaving this new command as plane outline. If that is the case, the renaming should be done when merging that PR.

Implementing these two features brings to light an issue that is to be solved in the future by someone that wants to, not in this PR: flood, hollow, outline and drain all take into account only neighburs in cartesian directions (that is, the 6 direct neighbors of a block, not counting the diagonal ones). This is fine for most cases, but it produces counter intuitive results in some cases. Particularly in cases where an outline brush is meant to be applied multiple times to give a thicker outline: the second application doesn't work properly, since the outline placed by the app is not considered as a "block of blocks" (they connect only diagonally in some cases). I think the best solution for this will be adding a new flag that affects all functions that check neighbors. I'll open an issue later.