Maniphest T101128

Regression: Torus Adding Error (can't be selected because it is not in View Layer)
Closed, ResolvedBUG

Assigned To
Aras Pranckevicius (aras_p)
Authored By
Joseph Masaki (vertenflow)
Sep 16 2022, 8:09 PM
Tags
  • BF Blender
  • Core
Subscribers
Bastien Montagne (mont29)
Damien Picard (pioverfour)
Germano Cavalcante (mano-wii)
Jesse Yurkovich (deadpin)
Joseph Masaki (vertenflow)
monique (monique)
Pratik Borhade (PratikPB2123)
RedHaloStudio (RedHaloStudio)

Description

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 rB68589a31ebfb: ViewLayer: Lazy sync of scene data.

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

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.

Revisions and Commits

rB Blender
D16004

Related Objects

Mentioned In
T101204: Import FBX ERROR
D16004: ViewLayer: fix missing sync in object APIs (fixes T101128)
Mentioned Here
rB68589a31ebfb: ViewLayer: Lazy sync of scene data.

Event Timeline

Joseph Masaki (vertenflow) created this task.Sep 16 2022, 8:09 PM
Jesse Yurkovich (deadpin) renamed this task from Torus Adding Error to Regression: Torus Adding Error (can't be selected because it is not in View Layer).Sep 16 2022, 9:09 PM
Jesse Yurkovich (deadpin) changed the task status from Needs Triage to Confirmed.
Jesse Yurkovich (deadpin) triaged this task as High priority.
Jesse Yurkovich (deadpin) updated the task description.
Germano Cavalcante (mano-wii) added subscribers: monique (monique), Bastien Montagne (mont29), Germano Cavalcante (mano-wii).Sep 16 2022, 9:28 PM

rB68589a31ebfb: ViewLayer: Lazy sync of scene data. is the first bad commit.
Cc @monique (monique), @Bastien Montagne (mont29)

Germano Cavalcante (mano-wii) updated the task description.Sep 16 2022, 9:29 PM
Germano Cavalcante (mano-wii) added a project: Core.
Damien Picard (pioverfour) added a subscriber: Damien Picard (pioverfour).Sep 18 2022, 2:10 AM

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 (aras_p) claimed this task.Sep 19 2022, 8:52 AM
Aras Pranckevicius (aras_p) added a revision: D16004: ViewLayer: fix missing sync in object APIs (fixes T101128).
Jesse Yurkovich (deadpin) mentioned this in T101204: Import FBX ERROR.Sep 20 2022, 5:33 AM
Pratik Borhade (PratikPB2123) merged a task: T101204: Import FBX ERROR.Sep 20 2022, 5:38 AM
Pratik Borhade (PratikPB2123) added subscribers: RedHaloStudio (RedHaloStudio), Jesse Yurkovich (deadpin), Pratik Borhade (PratikPB2123).
Hans Goudey (HooglyBoogly) changed the subtype of this task from "Report" to "Bug".Sep 20 2022, 5:45 AM
Aras Pranckevicius (aras_p) closed this task as Resolved by committing rBe00f76c6a8cc: ViewLayer: fix missing sync in object APIs (fixes T101128, T101204).Sep 20 2022, 8:48 AM
Aras Pranckevicius (aras_p) added a commit: rBe00f76c6a8cc: ViewLayer: fix missing sync in object APIs (fixes T101128, T101204).