Adjust Last Operation will change selection after running operator from console #77004

Closed
opened 2020-05-23 22:02:00 +02:00 by Eugene Du · 7 comments

System Information
Operating system: Windows-10-10.0.18362-SP0 64 Bits
Graphics card: GeForce GTX 1650 SUPER/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 445.75

Blender Version
Broken: version: 2.83 (sub 17), branch: master, commit date: 2020-05-22 19:52, hash: e8dd8c2829, also 2.82a

Short description of error
after execute selection operator in Python Console, then use any tool that have "Adjust Last Operation" panel and tweak parameter in it - the selection dropped
Example_1.mp4

Exact steps for others to reproduce the error
#77004.blend

  • Open file
  • Run command in console (bpy.ops.mesh.loop_multi_select(ring=False))
  • In 3D viewport move selection
  • In adjust last operation panel modify some property

Selection will change and result will be incorrect.

**System Information** Operating system: Windows-10-10.0.18362-SP0 64 Bits Graphics card: GeForce GTX 1650 SUPER/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 445.75 **Blender Version** Broken: version: 2.83 (sub 17), branch: master, commit date: 2020-05-22 19:52, hash: `e8dd8c2829`, also 2.82a **Short description of error** after execute selection operator in Python Console, then use any tool that have "Adjust Last Operation" panel and tweak parameter in it - the selection dropped [Example_1.mp4](https://archive.blender.org/developer/F8549781/Example_1.mp4) **Exact steps for others to reproduce the error** [#77004.blend](https://archive.blender.org/developer/F8552955/T77004.blend) - Open file - Run command in console (`bpy.ops.mesh.loop_multi_select(ring=False)`) - In 3D viewport move selection - In adjust last operation panel modify some property Selection will change and result will be incorrect.
Author

Added subscriber: @APEC

Added subscriber: @APEC
Author

And before you say that it's not a bug,
I want to add interesting observation:

if we execute operator from text editor like this one

import bpy
bpy.ops.mesh.loop_multi_select(ring=False)

and then use any tool, selection will not drop.
But if we want more complex code, like this (custom addon in N panel called "Test Select" with button, depending of selected element it execute own operator)

import bpy, bmesh
from bpy.types import Panel, Operator

# Add-on info
bl_info = {
    "name": "Test Select",
    "author": "APEC",
    "version": (1, 0, 0),
    "blender": (2, 82, 0),
    "location": "View3D > Properties > Test Select",
    "description": "test select", 
    "wiki_url": "",
    "tracker_url": "",      
    "category": "3D View"
}

# Context selection: if polygons - Sel Linked All, if Edges - MultiSelect Loop, else - Sel Open Edges
class CONSEL_OT_context_select(Operator):
    bl_idname = "consel.context_select"
    bl_label = "Context selection"
    bl_description = "Selecting depend of selected elements"

    def execute(self, context):
        context = bpy.context
        ob = context.edit_object
        me = ob.data
        bm = bmesh.from_edit_mesh(me)
        
        # checking for face selected
        selFaces = [f for f in bm.faces if f.select]

        # checking for edge selected
        selEdges = [e for e in bm.edges if e.select]

        if selFaces:
            bpy.ops.mesh.select_linked(delimit={'SEAM'})
        if selEdges:
            bpy.ops.mesh.loop_multi_select(ring=False)
        else:
            bpy.ops.mesh.select_non_manifold(extend=False, use_wire=True, use_boundary=True, use_multi_face=True)
            bpy.ops.mesh.select_mode(type="EDGE")        
        return {'FINISHED'}

# UI: N panel - Test Select
class SELTOPOLOGY_PT_main(Panel):          
    bl_label = "Test Select"
    bl_space_type = "VIEW_3D"
    bl_region_type = "UI"
    bl_category = 'Test Select'
    
    def draw (self, context):
        layout = self.layout
                        
        row = layout.row(align=True)
        row.operator("consel.context_select")

def register():
    bpy.utils.register_class(CONSEL_OT_context_select)
    bpy.utils.register_class(SELTOPOLOGY_PT_main)

def unregister():
    bpy.utils.unregister_class(CONSEL_OT_context_select)
    bpy.utils.unregister_class(SELTOPOLOGY_PT_main)

if __name__ == "__main__":
    register()

and after that we use any tool and change any parameter in "Adjust Last Operation" panel, the selection will be dropped.

And before you say that it's not a bug, I want to add interesting observation: if we execute operator from text editor like this one ``` import bpy bpy.ops.mesh.loop_multi_select(ring=False) ``` and then use any tool, selection will not drop. But if we want more complex code, like this (custom addon in N panel called "Test Select" with button, depending of selected element it execute own operator) ``` import bpy, bmesh from bpy.types import Panel, Operator # Add-on info bl_info = { "name": "Test Select", "author": "APEC", "version": (1, 0, 0), "blender": (2, 82, 0), "location": "View3D > Properties > Test Select", "description": "test select", "wiki_url": "", "tracker_url": "", "category": "3D View" } # Context selection: if polygons - Sel Linked All, if Edges - MultiSelect Loop, else - Sel Open Edges class CONSEL_OT_context_select(Operator): bl_idname = "consel.context_select" bl_label = "Context selection" bl_description = "Selecting depend of selected elements" def execute(self, context): context = bpy.context ob = context.edit_object me = ob.data bm = bmesh.from_edit_mesh(me) # checking for face selected selFaces = [f for f in bm.faces if f.select] # checking for edge selected selEdges = [e for e in bm.edges if e.select] if selFaces: bpy.ops.mesh.select_linked(delimit={'SEAM'}) if selEdges: bpy.ops.mesh.loop_multi_select(ring=False) else: bpy.ops.mesh.select_non_manifold(extend=False, use_wire=True, use_boundary=True, use_multi_face=True) bpy.ops.mesh.select_mode(type="EDGE") return {'FINISHED'} # UI: N panel - Test Select class SELTOPOLOGY_PT_main(Panel): bl_label = "Test Select" bl_space_type = "VIEW_3D" bl_region_type = "UI" bl_category = 'Test Select' def draw (self, context): layout = self.layout row = layout.row(align=True) row.operator("consel.context_select") def register(): bpy.utils.register_class(CONSEL_OT_context_select) bpy.utils.register_class(SELTOPOLOGY_PT_main) def unregister(): bpy.utils.unregister_class(CONSEL_OT_context_select) bpy.utils.unregister_class(SELTOPOLOGY_PT_main) if __name__ == "__main__": register() ``` and after that we use any tool and change any parameter in "Adjust Last Operation" panel, the selection will be dropped.
Richard Antalik changed title from Python Console: execute selection operator and after use all kind of tool and tweak parameter in "Adjust Last Operation" panel - drops selection to Adjust Last Operation will change selection after running operator from console 2020-05-25 15:24:09 +02:00

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'
Author

Another example:

  1. Select some Object/s (no matter is it meshes, lights or cameras).
  2. Run command in console (bpy.ops.object.delete(use_global=False)). Simple delete.
  3. Add new object and change some parameter in "Adjust Last Operation" panel.
  4. Deleted Object/s appear. Magic!
Another example: 1. Select some Object/s (no matter is it meshes, lights or cameras). 2. Run command in console (`bpy.ops.object.delete(use_global=False)`). Simple delete. 3. Add new object and change some parameter in "Adjust Last Operation" panel. 4. Deleted Object/s appear. Magic!

Added subscriber: @ideasman42

Added subscriber: @ideasman42

Changed status from 'Confirmed' to: 'Archived'

Changed status from 'Confirmed' to: 'Archived'
Campbell Barton self-assigned this 2020-09-08 09:43:15 +02:00

In this case you need to explicitly request an undo step:

bpy.ops.mesh.loop_multi_select(True, ring=False)

See: https://docs.blender.org/api/master/bpy.ops.html#keywords-and-positional-arguments

In this case you need to explicitly request an undo step: ``` bpy.ops.mesh.loop_multi_select(True, ring=False) ``` See: https://docs.blender.org/api/master/bpy.ops.html#keywords-and-positional-arguments
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
3 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#77004
No description provided.