blender Error in adding the 3D Viewport Pie Menu plugin #105091

Closed
opened 2023-12-28 15:18:28 +01:00 by pcs · 2 comments

System Information
Operating system: Windows-10-10.0.19041-SP0 64 Bits
Graphics card: NVIDIA GeForce RTX 3090/PCIe/SSE2 NVIDIA Corporation 4.6.0 NVIDIA 536.23

Blender Version
Broken: version: 4.0.2, branch: blender-v4.0-release, commit date: 2023-12-05 07:41, hash: 9be62e85b727
Worked: (newest version of Blender that worked as expected)

Addon Information
Name: 3D Viewport Pie Menus (1, 3, 0)
Author: meta-androcto

Short description of error
[ origin to bottom : When selecting multiple objects, only one object can be applied, and the origin of other objects will be reset to the center of the object. It should be possible to apply it to all selected objects instead of resetting the origin to the center of the object except for the active object ]

Exact steps for others to reproduce the error
[ Enable the 3D Viewport Pie Menu plugin ---- Select two or more objects ----alt+ctrl+x ---- origin to bottom ]
[Based on the default startup or an attached .blend file (as simple as possible)]

**System Information** Operating system: Windows-10-10.0.19041-SP0 64 Bits Graphics card: NVIDIA GeForce RTX 3090/PCIe/SSE2 NVIDIA Corporation 4.6.0 NVIDIA 536.23 **Blender Version** Broken: version: 4.0.2, branch: blender-v4.0-release, commit date: 2023-12-05 07:41, hash: `9be62e85b727` Worked: (newest version of Blender that worked as expected) **Addon Information** Name: 3D Viewport Pie Menus (1, 3, 0) Author: meta-androcto **Short description of error** [ origin to bottom : When selecting multiple objects, only one object can be applied, and the origin of other objects will be reset to the center of the object. It should be possible to apply it to all selected objects instead of resetting the origin to the center of the object except for the active object ] **Exact steps for others to reproduce the error** [ Enable the 3D Viewport Pie Menu plugin ---- Select two or more objects ----alt+ctrl+x ---- origin to bottom ] [Based on the default startup or an attached .blend file (as simple as possible)]
pcs added the
Status
Needs Triage
Priority
Normal
Type
Report
labels 2023-12-28 15:18:28 +01:00
Member

Hi, thanks for the report. I can confirm. Operator intentionally first changes origin of selected objects to geometry center for further calculation: https://projects.blender.org/blender/blender-addons/src/branch/main/space_view3d_pie_menus/pie_origin.py#L61
Then tweaks origin of active object only hence origin of other object resets to geometry center.

Hi, thanks for the report. I can confirm. Operator intentionally first changes origin of selected objects to geometry center for further calculation: https://projects.blender.org/blender/blender-addons/src/branch/main/space_view3d_pie_menus/pie_origin.py#L61 Then tweaks origin of active object only hence origin of other object resets to geometry center.
Pratik Borhade added
Status
Confirmed
Module
Add-ons (Community)
and removed
Status
Needs Triage
labels 2024-01-05 11:17:00 +01:00
Member

Following change will fix this:

diff --git a/space_view3d_pie_menus/pie_origin.py b/space_view3d_pie_menus/pie_origin.py
index 5c6070ad..02656c5f 100644
--- a/space_view3d_pie_menus/pie_origin.py
+++ b/space_view3d_pie_menus/pie_origin.py
@@ -59,19 +59,20 @@ class PIE_OT_PivotBottom(Operator):
     def execute(self, context):
         bpy.ops.object.transform_apply(location=True, rotation=True, scale=True)
         bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY')
-        o = context.active_object
-        init = 0
-        for x in o.data.vertices:
-            if init == 0:
-                a = x.co.z
-                init = 1
-            elif x.co.z < a:
-                a = x.co.z
-
-        for x in o.data.vertices:
-            x.co.z -= a

-        o.location.z += a
+        init = 0
+        for ob in context.selected_objects:
+            for x in ob.data.vertices:
+                if init == 0:
+                    a = x.co.z
+                    init = 1
+                elif x.co.z < a:
+                    a = x.co.z
+
+            for x in ob.data.vertices:
+                x.co.z -= a
+
+            ob.location.z += a

         return {'FINISHED'}
Following change will fix this: ``` diff --git a/space_view3d_pie_menus/pie_origin.py b/space_view3d_pie_menus/pie_origin.py index 5c6070ad..02656c5f 100644 --- a/space_view3d_pie_menus/pie_origin.py +++ b/space_view3d_pie_menus/pie_origin.py @@ -59,19 +59,20 @@ class PIE_OT_PivotBottom(Operator): def execute(self, context): bpy.ops.object.transform_apply(location=True, rotation=True, scale=True) bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY') - o = context.active_object - init = 0 - for x in o.data.vertices: - if init == 0: - a = x.co.z - init = 1 - elif x.co.z < a: - a = x.co.z - - for x in o.data.vertices: - x.co.z -= a - o.location.z += a + init = 0 + for ob in context.selected_objects: + for x in ob.data.vertices: + if init == 0: + a = x.co.z + init = 1 + elif x.co.z < a: + a = x.co.z + + for x in ob.data.vertices: + x.co.z -= a + + ob.location.z += a return {'FINISHED'} ```
Blender Bot added
Status
Resolved
and removed
Status
Confirmed
labels 2024-01-12 12:01:33 +01:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 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-addons#105091
No description provided.