Maniphest T101910

Make Single User operator does not override
Closed, Archived

Assigned To
None
Authored By
Mikhail Rachinskiy (alm)
Oct 18 2022, 9:56 PM
Tags
  • BF Blender
  • Python API
Subscribers
Germano Cavalcante (mano-wii)
Mikhail Rachinskiy (alm)

Description

System Information
Operating system: Windows-10-10.0.19043-SP0 64 Bits
Graphics card: NVIDIA GeForce GTX 860M/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 511.79

Blender Version
Broken: version: 3.4.0 Alpha, branch: master, commit date: 2022-09-07 19:33, hash: rB0a32f6b76a63

Short description of error
Cannot override selected objects for Make Single User operator.

Exact steps for others to reproduce the error

  1. Open attached blend file.
  2. Run Script.

There are two operators, translate which is successfully overridden, and make_single_user which ignores override.

Event Timeline

Mikhail Rachinskiy (alm) created this task.Oct 18 2022, 9:56 PM
Germano Cavalcante (mano-wii) changed the task status from Needs Triage to Needs Information from Developers.Oct 18 2022, 11:24 PM
Germano Cavalcante (mano-wii) added a project: Python API.
Germano Cavalcante (mano-wii) added a subscriber: Germano Cavalcante (mano-wii).

The operator (written in C) does not use the context to find selected objects.
I'm not sure if this can be considered a bug.
Needs Information from Developers.

Germano Cavalcante (mano-wii) closed this task as Archived.Oct 21 2022, 3:55 PM

On second thought, whether in C or Python, operators are not required to use context to perform their operations.

Even if the context's "selected_objects" are overwritten, Object.select_get() is not affected (and is used for eg save or undo).

You can confirm this with this code:

import bpy

obs = [bpy.data.objects["Sphere"]]

with bpy.context.temp_override(selected_objects=obs):
    print(bpy.context.selected_objects[0].select_get())

We could change specific operators to give preference to context, but even then not using them is not necessarily considered a bug.

So, unless you intend to work on this operator (proposing patches), as this report is not about a bug or error, I am closing it.