Python Point.select returns unselected points sometimes #83372

Closed
opened 2020-12-03 18:28:06 +01:00 by Sergey Kritskiy · 10 comments

System Information
Operating system: Windows-10-10.0.18362-SP0 64 Bits
Graphics card: GeForce GTX 1060 3GB/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 446.14

Blender Version
Broken: version: 2.91.0, branch: master, commit date: 2020-11-25 08:34, hash: 0f45cab862
Worked: not sure

Short description of error
I'm trying to manipulate selected points of a specific curve via Python but some unselected points act as selected.
I can't seem to find a pattern to recreate this issue with any curve from scratch, but I'm attaching a curve with the issue.

Running the script in the attached .blend file moves two points instead of one, print() (that prints out selected points) prints two selected points even though there only one is selected.
Using a Deselect (Alt+A) command doesn't solve the issue, only iterating through all the points and setting point.select to False with Python does.

Exact steps for others to reproduce the error

  • Open the attached .blend file, there's one point selected in the curve:
    image.png
  • Run the code provided in the file: it moves a selected point by (1,0,0);
  • Expected result: selected point is moved, console outputs 1 selected point;
  • Result I'm getting: two points are moved, console outputs 2 selected points:
    image.png

problem_.blend

**System Information** Operating system: Windows-10-10.0.18362-SP0 64 Bits Graphics card: GeForce GTX 1060 3GB/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 446.14 **Blender Version** Broken: version: 2.91.0, branch: master, commit date: 2020-11-25 08:34, hash: `0f45cab862` Worked: not sure **Short description of error** I'm trying to manipulate selected points of a specific curve via Python but some unselected points act as selected. I can't seem to find a pattern to recreate this issue with any curve from scratch, but I'm attaching a curve with the issue. Running the script in the attached `.blend` file moves two points instead of one, `print()` (that prints out selected points) prints two selected points even though there only one is selected. Using a Deselect (`Alt+A`) command doesn't solve the issue, only iterating through all the points and setting `point.select` to `False` with Python does. **Exact steps for others to reproduce the error** - Open the attached .blend file, there's one point selected in the curve: ![image.png](https://archive.blender.org/developer/F9441199/image.png) - Run the code provided in the file: it moves a selected point by `(1,0,0)`; - Expected result: selected point is moved, console outputs 1 selected point; - Result I'm getting: two points are moved, console outputs 2 selected points: ![image.png](https://archive.blender.org/developer/F9441460/image.png) [problem_.blend](https://archive.blender.org/developer/F9441106/problem_.blend)

Added subscriber: @Sergey-Kritskiy

Added subscriber: @Sergey-Kritskiy
Sergey Kritskiy changed title from Python Point.select selects wrong points to Python Point.select returns unselected points sometimes 2020-12-03 18:28:56 +01:00

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

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

Added subscriber: @mano-wii

Added subscriber: @mano-wii
Member

Added subscriber: @Calra

Added subscriber: @Calra
Member

Insights

  • very interesting indeed, I did print the point.select for all the points, and it was 'True` to that one point.
  • not able to reproduce with new geometry.

Edit: Removed comment about being Platform specific

New Info:

If we change the Spline Type from Poly to Beizer, not able to reproduce the error.
If Spline Type -> Nurbs, able to reproduce the error

Note: The Spline Type used in the file is Poly

Insights * very interesting indeed, I did print the `point.select` for all the points, and it was 'True` to that one point. * not able to reproduce with new geometry. Edit: Removed comment about being Platform specific New Info: If we change the Spline Type from Poly to Beizer, not able to reproduce the error. If Spline Type -> Nurbs, able to reproduce the error Note: The Spline Type used in the file is Poly

Something I wanted to add:

So far I experienced the issue only with curves that had points added with Python subdivide op. Once again, I can't reproduce this all the time but I believe that was the code that was producing these broken curves:

- selects a specific point of a specific spline
- selects next point (point_index + 1)
# subdivide the segment by cuts_number
def add_points(point_index, spline_index, cuts_number, obj):
  bpy.ops.curve.select_all(action='DESELECT')
  spline = obj.data.splines[spline_index]
  spline.points[point_index].select = True
  spline.points[point_index + 1].select = True
  bpy.ops.curve.subdivide(number_cuts=(cuts_number+1))
  bpy.ops.curve.select_all(action='DESELECT')
Something I wanted to add: So far I experienced the issue only with curves that had points added with Python subdivide op. Once again, I can't reproduce this all the time but I believe that was the code that was producing these broken curves: ``` - selects a specific point of a specific spline - selects next point (point_index + 1) # subdivide the segment by cuts_number def add_points(point_index, spline_index, cuts_number, obj): bpy.ops.curve.select_all(action='DESELECT') spline = obj.data.splines[spline_index] spline.points[point_index].select = True spline.points[point_index + 1].select = True bpy.ops.curve.subdivide(number_cuts=(cuts_number+1)) bpy.ops.curve.select_all(action='DESELECT') ```

Actually, today I once again stumbled upon this issue. However this time I was simple creating new points with extrude (E), no prior script was used. I have no points selected, but if I run a script that prints out selected points, I'm getting a bunch of Trues:

image.png

Attaching a scene with a script to print out points:
problem_points.blend

Actually, today I once again stumbled upon this issue. However this time I was simple creating new points with extrude (`E`), no prior script was used. I have no points selected, but if I run a script that prints out selected points, I'm getting a bunch of `True`s: ![image.png](https://archive.blender.org/developer/F9516591/image.png) Attaching a scene with a script to print out points: [problem_points.blend](https://archive.blender.org/developer/F9516589/problem_points.blend)

This issue was referenced by 4be9df7692

This issue was referenced by 4be9df7692eb67706e4d013ca3f0727f8a664cc2

This issue was referenced by 967cf303f3

This issue was referenced by 967cf303f32fa5a920c34c934d63e0f3c582b886

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Campbell Barton self-assigned this 2021-01-06 13:32:53 +01:00
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#83372
No description provided.