hlorus / CAD_Sketcher

Constraint-based geometry sketcher for blender
GNU General Public License v3.0
2.59k stars 122 forks source link

Removed check for running solver only on coincident constraints #455

Closed TimStrauven closed 3 months ago

TimStrauven commented 3 months ago

New behavior will run the solver every time after a line segment has been created.
[BUG] CAD Sketcher shows horizontal and vertical constraints on slanting lines. #429

hlorus commented 3 months ago

Btw we could also add a class variable (e.g. "has_alignment"), initialize it in init(), set it in main() when we add a vertical/horizontal constraint and then check in fini() if either has_coincident or has _alignment is set.

This would just prevent the solver from running when there's no new constraint which is probably a good practice but might not be too important...

TimStrauven commented 3 months ago

Sounds good, and will probably have a slight performance gain. Implemented in workflow above waiting for approval.

Thanks!

hlorus commented 3 months ago

__init__() is an internal python method which is better not used with blender's api. Stateful Operators use the init() method for initializing stuff, see: https://github.com/hlorus/CAD_Sketcher/blob/main/stateful_operator%2Fdocs.md

hlorus commented 3 months ago

Merged the PR with the removed __init__ method. Feel free to collect the bounty.

TimStrauven commented 2 months ago

Sorry for the late reply, life got busy... I didn't know about the init() method within Blender, good catch. Thanks for the merge and help you provided!