Regression: Torus Adding Error (can't be selected because it is not in View Layer) #101128

Closed
opened 2022-09-16 20:09:22 +02:00 by Joseph Masaki · 10 comments

System Information
Operating system: Linux-5.18.10-76051810-generic-x86_64-with-glibc2.35 64 Bits
Graphics card: Mesa Intel(R) UHD Graphics (TGL GT1) Intel 4.6 (Core Profile) Mesa 22.0.5

Blender Version
Broken: version: 3.4.0, caused by 68589a31eb

Worked: version: 3.4.0 Alpha, branch: master, commit date: 2022-09-13 22:06, hash: e1a9c16176

Short description of error
When adding a torus I get the following error.

Python: Traceback (most recent call last):
File "/HOMEPATH/Documents/builds/blender-3.4.0-alpha+master.d5df23d75812-linux.x86_64-release/3.4/scripts/startup/bl_operators/add_mesh_torus.py", line 218, in invoke
return self.execute(context)
File "/HOMEPATH/Documents/builds/blender-3.4.0-alpha+master.d5df23d75812-linux.x86_64-release/3.4/scripts/startup/bl_operators/add_mesh_torus.py", line 253, in execute
object_utils.object_data_add(context, mesh, operator=self)
File "/HOMEPATH/Documents/builds/blender-3.4.0-alpha+master.d5df23d75812-linux.x86_64-release/3.4/scripts/modules/bpy_extras/object_utils.py", line 110, in object_data_add
obj_new.select_set(True)
RuntimeError: Error: Object 'Torus.002' can't be selected because it is not in View Layer 'View Layer'!

Exact steps for others to reproduce the error
Add a torus.

**System Information** Operating system: Linux-5.18.10-76051810-generic-x86_64-with-glibc2.35 64 Bits Graphics card: Mesa Intel(R) UHD Graphics (TGL GT1) Intel 4.6 (Core Profile) Mesa 22.0.5 **Blender Version** Broken: version: 3.4.0, caused by 68589a31eb Worked: version: 3.4.0 Alpha, branch: master, commit date: 2022-09-13 22:06, hash: `e1a9c16176` **Short description of error** When adding a torus I get the following error. > > Python: Traceback (most recent call last): > File "/HOMEPATH/Documents/builds/blender-3.4.0-alpha+master.d5df23d75812-linux.x86_64-release/3.4/scripts/startup/bl_operators/add_mesh_torus.py", line 218, in invoke > return self.execute(context) > File "/HOMEPATH/Documents/builds/blender-3.4.0-alpha+master.d5df23d75812-linux.x86_64-release/3.4/scripts/startup/bl_operators/add_mesh_torus.py", line 253, in execute > object_utils.object_data_add(context, mesh, operator=self) > File "/HOMEPATH/Documents/builds/blender-3.4.0-alpha+master.d5df23d75812-linux.x86_64-release/3.4/scripts/modules/bpy_extras/object_utils.py", line 110, in object_data_add > obj_new.select_set(True) > RuntimeError: Error: Object 'Torus.002' can't be selected because it is not in View Layer 'View Layer'! > **Exact steps for others to reproduce the error** Add a torus.
Author

Added subscriber: @JosephMasaki

Added subscriber: @JosephMasaki

blender/blender-addons#101204 was marked as duplicate of this issue

blender/blender-addons#101204 was marked as duplicate of this issue
Jesse Yurkovich changed title from Torus Adding Error to Regression: Torus Adding Error (can't be selected because it is not in View Layer) 2022-09-16 21:09:22 +02:00

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

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

Added subscribers: @monique-4, @mont29, @mano-wii

Added subscribers: @monique-4, @mont29, @mano-wii

68589a31eb is the first bad commit.
Cc @monique-4, @mont29

68589a31eb is the first bad commit. Cc @monique-4, @mont29
Member

Added subscriber: @pioverfour

Added subscriber: @pioverfour
Member

Looks like this fixes it:

diff --git a/release/scripts/modules/bpy_extras/object_utils.py b/release/scripts/modules/bpy_extras/object_utils.py
index ab678ba27c8..e599095cecf 100644
--- a/release/scripts/modules/bpy_extras/object_utils.py
+++ b/release/scripts/modules/bpy_extras/object_utils.py
@@ -107,6 +107,7 @@ def object_data_add(context, obdata, operator=None, name=None):
     obj_act = layer.objects.active
     obj_new = bpy.data.objects.new(name, obdata)
     scene_collection.objects.link(obj_new)
+    layer.update()
     obj_new.select_set(True)
     obj_new.matrix_world = add_object_align_init(context, operator)
 
@@ -120,12 +121,8 @@ def object_data_add(context, obdata, operator=None, name=None):
 
     if obj_act and obj_act.mode == 'EDIT' and obj_act.type == obj_new.type:
         bpy.ops.mesh.select_all(action='DESELECT')
-        obj_act.select_set(True)
         bpy.ops.object.mode_set(mode='OBJECT')
-
         obj_act.select_set(True)
-        layer.update()  # apply location
-        # layer.objects.active = obj_new
 
         - Match up UV layers, this is needed so adding an object with UV's
         - doesn't create new layers when there happens to be a naming mismatch.
Looks like this fixes it: ``` diff --git a/release/scripts/modules/bpy_extras/object_utils.py b/release/scripts/modules/bpy_extras/object_utils.py index ab678ba27c8..e599095cecf 100644 --- a/release/scripts/modules/bpy_extras/object_utils.py +++ b/release/scripts/modules/bpy_extras/object_utils.py @@ -107,6 +107,7 @@ def object_data_add(context, obdata, operator=None, name=None): obj_act = layer.objects.active obj_new = bpy.data.objects.new(name, obdata) scene_collection.objects.link(obj_new) + layer.update() obj_new.select_set(True) obj_new.matrix_world = add_object_align_init(context, operator) @@ -120,12 +121,8 @@ def object_data_add(context, obdata, operator=None, name=None): if obj_act and obj_act.mode == 'EDIT' and obj_act.type == obj_new.type: bpy.ops.mesh.select_all(action='DESELECT') - obj_act.select_set(True) bpy.ops.object.mode_set(mode='OBJECT') - obj_act.select_set(True) - layer.update() # apply location - # layer.objects.active = obj_new - Match up UV layers, this is needed so adding an object with UV's - doesn't create new layers when there happens to be a naming mismatch. ```
Aras Pranckevicius self-assigned this 2022-09-19 08:52:40 +02:00
Member

Added subscribers: @HMRP, @deadpin, @PratikPB2123

Added subscribers: @HMRP, @deadpin, @PratikPB2123

This issue was referenced by e00f76c6a8

This issue was referenced by e00f76c6a8ccaafbdd09b069923176ad23e3ce7e

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Bastien Montagne added this to the Core project 2023-02-09 15:43:11 +01:00
Bastien Montagne removed this from the Core project 2023-02-09 18:20:14 +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
7 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#101128
No description provided.