Skip to content

New Circle (Brush) Carver Tool #32

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

New Circle (Brush) Carver Tool #32

wants to merge 5 commits into from

Conversation

nickberckley
Copy link
Owner

This is (experimental) ongoing implementation of the new Circle Carve tool. The new circle tool replaces the old one, which was just the Box Carve tool except with the ability to set the number of vertices. Box Carve tool will now inherit this ability, making it able to draw shapes with any number of vertices (where 4 is a rectangle, anything more is a circle).

The New Circle tool is similar to sculpt brushes, it has a circle around the cursor (with an adjustable radius) with a shape inside it. When clicked, it executes an operator that carves the shape out of an active object (It doesn't support carving multiple objects like Box and Polyline tools; it only works on active object). This is meant to be used for cutting precisely sized holes in meshes (which is difficult when drawing with a cursor), because the size of the shape is tied to the tool, and can be reused for an infinite number of cuts.


Using the tool:

  • F starts changing the radius of the circle & shape, just like sculpt brushes.

Implementation details:
Initial code for the tool (drawing of a circle, storing Runtime data, raycasting, and etc.) is from 3D Hair Brush by VFX Grace, which is licensed under GPL. Modifications have been made to simplify the code and fit the purpose of the tool better, but nevertheless credit goes to VFX Grace.

  • Tool has draw_cursor staticmethod property, which calls raycast_under_cursor (new function in select.py) and gets the active object data under the cursor. Data is stored in runtime ToolRuntimeData() (stored in properties.py) and passed to new drawing function carver_brush.
  • carver_brush function uses data to manipulate GPU matrix inside with gpu.matrix.push_pop() loop to align GPU projection to mesh normals, calculates circle and shape inside it, and draws them with draw_shader function.

@nickberckley nickberckley added the Feature Laid out feature design or implementation label Nov 18, 2024
…yline`

For circle object third operator will be created, which will not require modal support.
Shape isn't created in the correct place yet, but it is being created.
@nickberckley
Copy link
Owner Author

Todo:

  • Show modifier key icons in the status bar

Using context.workspace.status_text_set() line it's possible to set status bar text during modal (although ugly one). Using function instead of string it can even use layout and set icons to text. The problem is I can't pass the operator self as an argument to the function (it only accepts self and context, self being that status bar header panel), so I can't do if statements inside the function that check for operator states. But, with enough hacks I might be able to stitch something together. It's not worth doing now when operator in main is one, but with split, separate operators it will be simpler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Laid out feature design or implementation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant