Looptools circle fails when new plane created aligned to view #70899

Closed
opened 2019-10-17 14:53:46 +02:00 by Floatharr · 8 comments

System Information
Operating system: Windows-10-10.0.18362 64 Bits
Graphics card: GeForce GTX 1080/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 436.02

Blender Version
Broken:
version: 2.81 (sub 15), branch: master, commit date: 2019-10-15 17:59, hash: cfb6ffd48f
version: 2.80 (sub 75), branch: master, commit date: 2019-07-29 14:47, hash: f6cb5f5449
version: 2.79b, commit date: 2018-03-22 14:10, hash: f4dc9f9d68b

Short description of error
Sometimes looptools circle fails seemingly randomly. Figured out why. If the plane is spawned aligned to view then it is "corrupted" and the circle operation fails as long as the origin is exactly on the plane. Any movement of the faces or origin fixes it. Clearing rotation in object mode does not help.

Exact steps for others to reproduce the error
Factory startup settings.

  1. Change Editing -> New Objects -> Align To -> View. Enable Looptools.
  2. Right click to set the cursor and add a plane
  3. Select some faces, activate Circle from the Looptools menu.
  4. Circle is not aligned to the surface.

circlebug.mp4

**System Information** Operating system: Windows-10-10.0.18362 64 Bits Graphics card: GeForce GTX 1080/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 436.02 **Blender Version** Broken: version: 2.81 (sub 15), branch: master, commit date: 2019-10-15 17:59, hash: `cfb6ffd48f` version: 2.80 (sub 75), branch: master, commit date: 2019-07-29 14:47, hash: `f6cb5f5449` version: 2.79b, commit date: 2018-03-22 14:10, hash: `f4dc9f9d68b` **Short description of error** Sometimes looptools circle fails seemingly randomly. Figured out why. If the plane is spawned aligned to view then it is "corrupted" and the circle operation fails as long as the origin is exactly on the plane. Any movement of the faces or origin fixes it. Clearing rotation in object mode does not help. **Exact steps for others to reproduce the error** Factory startup settings. 1. Change Editing -> New Objects -> Align To -> View. Enable Looptools. 2. Right click to set the cursor and add a plane 3. Select some faces, activate Circle from the Looptools menu. 4. Circle is not aligned to the surface. [circlebug.mp4](https://archive.blender.org/developer/F7829687/circlebug.mp4)
Author

Added subscriber: @Floatharr

Added subscriber: @Floatharr

Added subscriber: @MarcinTwarowski

Added subscriber: @MarcinTwarowski

It will work if you apply rotation of the object first.

It will work if you apply rotation of the object first.
Vladimir Spivak self-assigned this 2019-10-17 16:40:21 +02:00

Added subscriber: @mano-wii

Added subscriber: @mano-wii

@cwolf3d, any progress?
This patch seems to solve the problem:

diff --git a/mesh_looptools.py b/mesh_looptools.py
index 41c1be0a..67855477 100644
--- a/mesh_looptools.py
+++ b/mesh_looptools.py
@@ -19,7 +19,7 @@
 bl_info = {
     "name": "LoopTools",
     "author": "Bart Crouch",
-    "version": (4, 6, 7),
+    "version": (4, 6, 8),
     "blender": (2, 80, 0),
     "location": "View3D > Sidebar > Edit Tab / Edit Mode Context Menu",
     "warning": "",
@@ -290,8 +290,10 @@ def calculate_plane(bm_mod, loop, method="best_fit", object=False):
             for i in range(itermax):
                 vec = vec2
                 vec2 = mat @ vec
-                if vec2.length != 0:
-                    vec2 /= vec2.length
+                # Calculate length with double precision to avoid problems with `inf`
+                vec2_length = math.sqrt(vec2[0] **2 + vec2[1]** 2 + vec2[2] ** 2)
+                if vec2_length != 0:
+                    vec2 /= vec2_length
                 if vec2 == vec:
                     break
             if vec2.length == 0:

@cwolf3d, any progress? This patch seems to solve the problem: ``` diff --git a/mesh_looptools.py b/mesh_looptools.py index 41c1be0a..67855477 100644 --- a/mesh_looptools.py +++ b/mesh_looptools.py @@ -19,7 +19,7 @@ bl_info = { "name": "LoopTools", "author": "Bart Crouch", - "version": (4, 6, 7), + "version": (4, 6, 8), "blender": (2, 80, 0), "location": "View3D > Sidebar > Edit Tab / Edit Mode Context Menu", "warning": "", @@ -290,8 +290,10 @@ def calculate_plane(bm_mod, loop, method="best_fit", object=False): for i in range(itermax): vec = vec2 vec2 = mat @ vec - if vec2.length != 0: - vec2 /= vec2.length + # Calculate length with double precision to avoid problems with `inf` + vec2_length = math.sqrt(vec2[0] **2 + vec2[1]** 2 + vec2[2] ** 2) + if vec2_length != 0: + vec2 /= vec2_length if vec2 == vec: break if vec2.length == 0: ```

Thanks for the work. Yes, this patch solves the problem.

Thanks for the work. Yes, this patch solves the problem.

This issue was referenced by blender/blender-addons@ee68a17611

This issue was referenced by blender/blender-addons@ee68a17611920264c4353a1fdc79f80be08fc710

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#70899
No description provided.