operator object.duplicate wrong object naming when object has parent and using context.copy #106105

Open
opened 2023-03-24 13:49:32 +01:00 by Vincent · 5 comments

System Information
Operating system: Windows-10-10.0.19044-SP0 64 Bits
Graphics card: NVIDIA GeForce RTX 3070/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 531.29

Blender Version
Broken: version: 3.3.5, branch: master, commit date: 2023-03-20 10:19, hash: dd0cd1df1d1a
Broken: version: 3.4.1, branch: blender-v3.4-release, commit date: 2022-12-20 08:50, hash: rBef9ca44dee7f
Broken: version: 2.93.16, branch: master, commit date: 2023-03-20 10:21, hash: 1668424eef81
Worked: none

Short description of error
When duplicating an object with a parent and using context.copy() with the object.duplicate or any other operator that uses object.duplicate the child object to get a wrong name.

Exact steps for others to reproduce the error

  1. set one object as a parent of another
  2. select both objects (parent and child)
  3. run this code in the Text Editor
import bpy
bpy.ops.object.duplicate_move(bpy.context.copy())
  1. now take a look in the outline the duplicated parent is selected, but the origin child is also selected and the name of the origin child has changed

Before:image
After:image

**System Information** Operating system: Windows-10-10.0.19044-SP0 64 Bits Graphics card: NVIDIA GeForce RTX 3070/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 531.29 **Blender Version** Broken: version: 3.3.5, branch: master, commit date: 2023-03-20 10:19, hash: `dd0cd1df1d1a` Broken: version: 3.4.1, branch: blender-v3.4-release, commit date: 2022-12-20 08:50, hash: `rBef9ca44dee7f` Broken: version: 2.93.16, branch: master, commit date: 2023-03-20 10:21, hash: `1668424eef81` Worked: none **Short description of error** When duplicating an object with a parent and using context.copy() with the object.duplicate or any other operator that uses object.duplicate the child object to get a wrong name. **Exact steps for others to reproduce the error** 1. set one object as a parent of another 2. select both objects (parent and child) 3. run this code in the Text Editor ``` import bpy bpy.ops.object.duplicate_move(bpy.context.copy()) ``` 4. now take a look in the outline the duplicated parent is selected, but the origin child is also selected and the name of the origin child has changed Before:![image](/attachments/c77f8487-c0e5-42d1-9a3b-d5501459c19c) After:![image](/attachments/6589eeea-9229-433f-b365-aa2bc2e19861)
Vincent added the
Priority
Normal
Type
Report
Status
Needs Triage
labels 2023-03-24 13:49:32 +01:00
<blender_console>:1: DeprecationWarning: Passing in context overrides is deprecated in favor of Context.temp_override(..), calling "object.duplicate_move"
```py <blender_console>:1: DeprecationWarning: Passing in context overrides is deprecated in favor of Context.temp_override(..), calling "object.duplicate_move" ```
Iliya Katueshenock added the
Interest
Python API
label 2023-03-24 14:38:46 +01:00

Thanks, but Blender 2.93 is supported until June 2023 and does not support temp_override(), so I made a report

Note: The Problem does not occur with temp_override()

Thanks, but Blender 2.93 is supported until June 2023 and does not support `temp_override()`, so I made a report **Note**: The Problem does **not** occur with `temp_override()`

Can confirm. Though not sure whether this will be fixed in 2.93

Can confirm. Though not sure whether this will be fixed in 2.93
Pratik Borhade added
Module
Python API
Status
Confirmed
and removed
Status
Needs Triage
Interest
Python API
labels 2023-03-28 08:18:06 +02:00
Pratik Borhade added this to the 2.93 LTS milestone 2023-03-28 08:18:15 +02:00
Brecht Van Lommel added the
Interest
Core
label 2023-05-01 17:07:27 +02:00

2.93 will not see another release, not sure though if we should close this now, since deprecated does not necessarily mean we dont accept bug reports for this (or maybe it does, will ask around)?

2.93 will not see another release, not sure though if we should close this now, since deprecated does not necessarily mean we dont accept bug reports for this (or maybe it does, will ask around)?

If I do the Context.temp_override equivalent of overriding everything in the dict created by bpy.context.copy() then I get the same odd renaming behaviour (using 4.0.0a 2023-06-03 ab6860f3de0f):

import bpy

with bpy.context.temp_override(**bpy.context.copy()):
    bpy.ops.object.duplicate_move()

Edit: It looks like all that's needed is to override selected_editable_objects with whatever its current value is:

import bpy

with bpy.context.temp_override(selected_editable_objects=bpy.context.selected_editable_objects):
    bpy.ops.object.duplicate()
If I do the `Context.temp_override` equivalent of overriding everything in the `dict` created by `bpy.context.copy()` then I get the same odd renaming behaviour (using 4.0.0a 2023-06-03 `ab6860f3de0f`): ```py import bpy with bpy.context.temp_override(**bpy.context.copy()): bpy.ops.object.duplicate_move() ``` Edit: It looks like all that's needed is to override `selected_editable_objects` with whatever its current value is: ```py import bpy with bpy.context.temp_override(selected_editable_objects=bpy.context.selected_editable_objects): bpy.ops.object.duplicate() ```
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
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
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
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
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#106105
There is no content yet.