Home

Awesome

Blender Add-on with Bézier Utility Operations

<b>Add-on Version: 0.9.96 </b>

This add-on contains several tools and utility ops for working with Bézier curves. <br> Supported Blender Versions: <b>3.0+</b> <br> Video Tutorials: </b> https://www.youtube.com/playlist?list=PLxsh4i5F_h9G6QFoPzKvBRMayz8533fSW<br>

Installation

*** Please do not download the github zip, you need only the blenderbezierutils.py file

After installation, a new tab: 'Bézier Utilities' is displayed in Object and Edit modes on 'Active Tool and Workspace settings' area on the properties panel. <br/> There will also appear two new buttons - <b>Flexi Draw Bézier</b> and <b>Flexi Edit Bézier</b> - in Object Mode and a <b>Flexi Grease Bézier</b> button in GP Draw Mode on the toolshelf.

Overview

The tools Flexi Draw , Flexi Edit and Flexi Grease are interactive tools that allow drawing and editing Bézier curves.

Flexi Draw Bézier Tool

This tool is available in object mode via a new button on the toolshelf (short cut to toggle the toolshelf - t). It allows drawing Bézier curves by manipulating the control points.<br>

Drawing Bézier Curve:

To draw the curve, activate the tool by clicking the Flexi Draw Bézier tool on the toolshelf and select Bézier Curve from Shape Type drop-down. Click the LMB on the starting point of the curve. Then click and drag LMB on the end point to adjust the curvature. You can continue drawing subsequent segments in this fashion. Double clicking or hitting enter or space will convert the drawing to a curve object. You can auto-close the curve by pressing Shift+Space or Shift+Enter<br>

<p align="center"><img src="https://github.com/Shriinivas/etc/blob/master/blenderbezierutils/illustrations/drawdemo.gif" alt="Demo"/></p><br/> <b>Repositioning the Bézier point:</b> <br> At the time of dragging the LMB to set the handle location, you can grab the Bézier point to reposition it by pressing G (configirable). All the snapping options are available for setting the handle location and repositioning the Bézier point. Press G again to release the grab. <br> <b>Resetting Handle:</b> <br> You can reset the handle if you need to draw a straight line after a curved segment by pressing the hot key Shift+G (configurable).<br/> <b>Dissociating Handle:</b> <br> While adjusting the handle by dragging the mouse pointer, you can change the handle type to free by pressing the hot-key V. This allows creating cusp nodes, even while creating the curve.<br/> <b>Undo:</b><br/> While drawing, you can undo one segment at a time by pressing backspace. Pressing escape removes the entire curve. After the drawing is finished, the curve creation can be undone by pressing ctrl-Z <br><br>

Drawing Primitive Shapes:

<p align="center"><img src="https://github.com/Shriinivas/etc/blob/master/blenderbezierutils/illustrations/drawshapeoptions.png" alt="Draw Options"/></p><br/> Other than Bézier curve you can also create primitive shapes with Bézier segments. To do this, select the appropriate primitive shape from the Shape Type drop-down in the tollbar at the top. The shapes currently available are 1) Rectangle 2) Ellipse / Circle 3) Polygon 4) Star. Click the starting point and end point of the shape. To draw shapes with equal height and width (e.g. perfect circle or square), hold down shift key. You can optionally snap to the grid. The shapes are all 2d, so for drawing in the 3d perspective view, you can either choose a constraining plane or set the orientation to view. In perspective view, without any constraining plain, the depth value of the current mouse location is applied to all the points.<br> <p align="center"><img src="https://github.com/Shriinivas/etc/blob/master/blenderbezierutils/illustrations/drawprim.gif" alt="Demo"/></p><br/> <b>Adjusting number of segments (Ellipse) or Sides (Polygon / Star):</b> <br> To adjust the segment count or sides use the mouse wheel or + or - keys on numpad. You may also directly type the value in the edit box on toolbar.<br> <b>Drawing from Center or from Corner:</b> <br> You can start the drawing either from the corner (Bounding Box) or from the center by choosing appropriate option in the Drawing Mode drop-down.<br> <b>Sweep (Available in Ellipse / Circle, Polygon and Star):</b> <br> The sweep angle can be entered directly in the edit box of the toolbar or changed incrementally using left or right arrow keys while drawing the shape. The maximum angle value is 360, which makes the shape complete.<br> <b>Starting Angle (Available in Ellipse / Circle):</b> <br> The starting angle can be entered directly in the edit box of the toolbar or changed incrementally using up or down arrow keys while drawing the shape. This angle changes the tilt of the ellipse being drawn.<br> <b>Copy Object Properties:</b> <br> Select an existing curve object in the Copy Object Properties option in the toolbar to apply its properties like material, dimension, bevel depth, bevel object on to the curves / shapes drawn with the Flexi Bézier Tool. If a mesh object is selected, only its material is applied to the curve / shape drawn.<br>

Flexi Edit Bézier Tool

Demo<br> This tool is available in object mode via a new button on the toolshelf (short cut to toggle the toolshelf - t). With it You can 1) edit a Bézier curve by dragging a point on the curve 2) Move Segment endpoints and manipulate handles 3) Add or delete a vertex at any arbitrary location on the curve <br><br> <b>Edit Curve and move handles and end points: </b> When the tool is activated, moving a mouse cursor in the 3d viewport would highlight the individual curve segments under the mouse cursor. Clicking on a segment will make the segment active and it's handles will be visible. You can drag any point on the curve to edit it. Releasing the button will apply the changes to the curve. Also when the handles are visible, bringing the mouse cursor in the vicinity of any of the handle points will highlight that point (bright green), indicating the mouse click will operate on it. You can move the handles and segment points by dragging the mouse pointer. Releasing the mouse button makes the changes permanent.<br><br> <b>Grab the Edit Point:</b> The point being edited can be grabbed by double clicking it. Once grabbed the point will move along the mouse, without having to drag the pointer. The grab is released on the next single click. <b>Adding a vertex: </b> Hold down control and click the mouse on any location on curve to add a vertex at that position. If you also hold down shift along with control the added point will have aligned handles. The handles will be of type vector if alt and control are held down while pressing the mouse button.<br><br> <b>Deleting a vertex or handle point: </b> Select any end point (the selected point is marked in dark green) and press del to delete it. Pressing del when a handle point is selected will align it with the other point of the segment. <br><br> You can toggle between Flexi Draw and Flexi Edit by pressing <b>e</b>.<br> Press <b>h</b> to toggle the visibility of the selected segment handles.<br><br> <b>Subdivide Segments Uniformly: </b> You can also subdivide the selected segments uniformly. To initiate the subdivision op, first select the segments (hold down shift to select multiple segments). Then press w. Now there will appear a subdivision marker at the middle of each selected segment. You can increase or decrease the number of subdivisions by scrolling the mouse wheel or pressing + or - keys. Press Spacebar or Enter to confirm the subdiv operation.<br><br> <b>Align Handle:</b> To align the handle with the opposite handle of the same end point, select the handle point and press K. This way you can quickly smooth out the sharp corners.

Flexi Grease Bézier Tool

Demo<br> This tool will appear on the toolshelf in Grease Pencil Draw mode. You can draw Bézier curves just as you would draw with the Flexi Draw tool. After confirming the drawing is converted to grease pencil strokes. All the snapping and locking options of the Flexi Draw are available here also.<br> Additionaly, you can increase of decrease the resolution of the stroke using the mouse wheel or pressing + or - keys.<br> The subdivision point visibility can be toggled by pressing h key.<br>

Configurable Entities

Configurable Options<br> Values of a number of entities are user configurable via Add-ons dialog (from Preferences->Add-on Menu). Some of these are:

Snapping & Locking Framework

The Framework provides comprihensive snapping and locking options common to all three Flexi tools. After activating one of the Flexi tools the header portion displayes the following new options:

<b>1) Constraining Axes Dropdown:</b> Selecting an axis or axis-pair from this dropdown will constrain the point being drawn or edited to the an axis or plane that is parallel to the selection. The actual axis or plane will be determined by click location in 3d space. The interpretation of Axes X, Y, Z will differ based on the selection in the Snapping Orientation (see below).

<b>2) Snap to Plane Checkbox:</b> This option is available when the Costrain Axes drop down has an axis-pair (plane) selection. When checked the point being drawn or edited will be snapped to the plane of the point selected in the Snap Origin dialog (see below).

<b>3) Snapping Orientation Dropdown:</b> The options in the dropdown are:

The Orientation affects the constraining plane and axis, as well as the reference axis for snapping to angle increment. For example, if the constraining axis are XY and the selected option in the Orienation dropdown is Active object, the point will be constrained to the XY plane of the active object local space, if it is available.

<b>4) Snapping Origin Dropdown:</b> The options in the dropdown are:

The distance values are calculated / interpretated based on the selection in this dialog. Additionally, the snapping plane (when Snap to Plane option is selected) is the plane containing the Snapping Origin point.

<b>5) Axis Scale Checkbox: </b> When this option is selected, the entries made via keyboard (see below) are interpreted in terms of the scale of the Custom Axis or the Reference Line. 10 Units on the scale represent the total length of the axis.

<b> Keyboard Input: </b> It's now possible to directly enter the position values of the point being drawn or edited via keyboard. To set the next point location, start typing a number after starting a new segment (draw) or grabbing the edit point (edit). This number will be the movement along the first free of the free axes. User can enter values for the next axis by pressing tab. The values entered are with respect to the current Snapping Origin and along the Snapping Orientation Axes.

<b>Tweaking the Location via Keyboard: </b> After moving the point by mouse, user can further tweak the value via keyboard (e.g. round off the coordinates). To initiate tweaking press P, whereupon the point no more movable by mouse. Now you can type the coordinates just as in case of entering through keyboard.

<b>Entering Location value in The Form of Polar Coordinates: </b> When the drawing / editing is constrained to a single plane (the Constrain Axes dropdown has an axis-pair selection), you can tweak the polar coordinate values. To do this press P twice, after the first time you can enter cartesian coordinates and after the second, it's possible to enter the coordinates in polar form. Please note all the values are interpreted based on the selections in the Snapping Orientation and Snapping Origin dropdown.

<b>Reference Line and Reference Line Point: </b> Reference Line takes on different connotations based on the context. While drawing (Flexi Draw and Flexi Grease), the Reference Line is the segment previous to the one being drawn and the Reference Line Point is the immediate previous point. While editing, for a Bézier Point, the Reference Line is the line joining the current Bézier point with the other one of the segment (which is also the Reference Line Point). In case of handles, the Reference Line is the handle itself and the Reference Line point is the Bézier point in the handle. While moving a point on the segment, the Reference Line point is the location of the point before it is moved.

<b>Custom Axis:</b> Custom Axis is a user defined line, that serves multiple purpose. To create a Custom Axis, make sure the selection in Snapping Origin dropdown is 'Custom Axis Origin' and rightclick the starting point, move the pointer to the end point and rightclick once again. You can snap to grid or bezier point location while creating the Custom Axis. Additionally, it's possible to define custom snapping points along the Custom Axis, using mouse wheel (or plus or minus keys).<br> The Custom Axis can be used to define the Snappig Orientation, Snapping Origin, Custom scale and Custom snapping points.

<b>Hotkey Snapping Options (Active for the Point being Drawn / Edited):</b>

By default, snapping to the end points joins the new curve to the curve(s) it is being snapped to. You can hold down <b>ctrl</b> while ending the curve (by double click or space or return key) to keep the curve separate. The curve can also be separated from the snapped curves be pressing ctrl-Z after confirming. <br>

The snapping gets adapted to the viewport zoom level. <br>

<b>Locking Options:</b>

Snapping and locking can be combined together. So user can hold down both control and shift to snap to grid as well as restrict the angle. Likewise, user can press shift-Z to lock to XY plane and then hold shift while moving the mouse to restrict the angle between the segment end points.

When Constrain Axes dropdown has an axis-pair selection (lock to plane), pressing a single axis key will allow users to draw lines parallel to the axis (or slide the point along this line).

Other Tools

The utility ops are arranged in a collapsible Panel, grouped according to the functionality type. Here is a brief overview of a few of the ops in this add-on:

<b>Video Tutorials & Demos:</b><br> <b>Overview of Flexi Draw Bézier Tool:</b> https://youtu.be/C9PXp0XHgYQ<br> <b>Overview of Flexi Edit Bézier Tool:</b> https://youtu.be/enQHGmluQIw<br> <b>Overview of Snapping & Locking Framework:</b> https://youtu.be/VQCXZbOq47s<br> <b>Overview of Flexi Grease Bézier & Uniform Subdiv Op:</b> https://youtu.be/4XrjpWwLU4M<br> <b>Demo of Flexi Ellipse: </b>https://youtu.be/t7eVWP8gxeE<br> <b>All Bézier Toolkit videos: </b> https://www.youtube.com/playlist?list=PLxsh4i5F_h9G6QFoPzKvBRMayz8533fSW<br>

Credits

The functionality of editing curve by grabbing a point on it, is adapted from Inkscape edit curve tool: https://gitlab.com/inkscape/inkscape/blob/master/src/ui/tool/curve-drag-point.cpp <br> I am grateful to the authors of the module for making this great piece of code accessible to everyone.<br><br>

The add-on script includes python converted a2c js function (Copyright (C) 2013-2015 by Vitaly Puzrin) located at the github repository: https://github.com/fontello/svgpath. It is used in Draw Ellipse / Circle tool. Heartfelt thanks to the authors for this amazing function!<br><br>

Algorithms that were inspired by the answers on stackoverflow are mentioned with the corresponding links in the code. I would also like to thank the users who provided this very useful information, sometimes even with working sample code.<br><br>

Known Issues

Limitations

In general, exercise caution when using this add-on in production, since all possible conditions have not been extensively tested.<br> You may report bug as comment on the youtube videos or on the issues page here on Github. I will try and fix them as soon as I can.