Unable to copy Hook modifiers via API #119905

Closed
opened 2024-03-26 06:30:59 +01:00 by Y.T-LAW · 2 comments

System Information

Operating system: Windows-10-10.0.22631-SP0 64 Bits
Graphics card: NVIDIA GeForce RTX 2080 with Max-Q Design/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 551.61

Blender Version
Broken: version: 3.6.1, branch: blender-v3.6-release, commit date: 2023-07-17 12:50, hash: 8bda729ef4dc
Worked: (newest version of Blender that worked as expected)

Short description of error
[Please fill out a short description of the error here]

Exact steps for others to reproduce the error

Successfully copy the Boolean modifier according to the following script:

# Based on factory startup
import bpy

cube = bpy.data.objects["Cube"]
bpy.ops.mesh.primitive_plane_add()
plane = bpy.context.object

md = cube.modifiers.new("", "BOOLEAN")
with bpy.context.temp_override(object=cube, selected_objects=[plane]):
    bpy.ops.object.modifier_copy_to_selected(modifier=md.name)


But fails on Hook modifier

# Based on factory startup
import bpy

cube = bpy.data.objects["Cube"]
bpy.ops.mesh.primitive_plane_add()
plane = bpy.context.object

md = cube.modifiers.new("", "HOOK") # only changed here
with bpy.context.temp_override(object=cube, selected_objects=[plane]):
    bpy.ops.object.modifier_copy_to_selected(modifier=md.name)

I tested all 57 modifiers and 4 failed:

HOOK
MESH_TO_VOLUME
VOLUME_DISPLACE
COLLISION
**System Information** Operating system: Windows-10-10.0.22631-SP0 64 Bits Graphics card: NVIDIA GeForce RTX 2080 with Max-Q Design/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 551.61 **Blender Version** Broken: version: 3.6.1, branch: blender-v3.6-release, commit date: 2023-07-17 12:50, hash: `8bda729ef4dc` Worked: (newest version of Blender that worked as expected) **Short description of error** [Please fill out a short description of the error here] **Exact steps for others to reproduce the error** Successfully copy the Boolean modifier according to the following script: ```Python # Based on factory startup import bpy cube = bpy.data.objects["Cube"] bpy.ops.mesh.primitive_plane_add() plane = bpy.context.object md = cube.modifiers.new("", "BOOLEAN") with bpy.context.temp_override(object=cube, selected_objects=[plane]): bpy.ops.object.modifier_copy_to_selected(modifier=md.name) ``` But fails on Hook modifier ```Python # Based on factory startup import bpy cube = bpy.data.objects["Cube"] bpy.ops.mesh.primitive_plane_add() plane = bpy.context.object md = cube.modifiers.new("", "HOOK") # only changed here with bpy.context.temp_override(object=cube, selected_objects=[plane]): bpy.ops.object.modifier_copy_to_selected(modifier=md.name) ``` I tested all 57 modifiers and 4 failed: ``` HOOK MESH_TO_VOLUME VOLUME_DISPLACE COLLISION ```
Y.T-LAW added the
Priority
Normal
Type
Report
Status
Needs Triage
labels 2024-03-26 06:31:00 +01:00
Iliya Katushenock added the
Interest
Modifiers
Interest
Python API
labels 2024-03-26 06:53:49 +01:00
Member

Can confirm, will have a look...

Can confirm, will have a look...
Philipp Oeser added
Status
Confirmed
and removed
Status
Needs Triage
labels 2024-03-26 12:46:07 +01:00
Member

Checked code and BKE_object_copy_modifier / object_modifier_type_copy_check explicitly exclude eModifierType_Hook & eModifierType_Collision see d92a6f140d and bc95c249a7

Assumption here is that this was excluded due to the special data in those modifiers that have very little chance to be copied over to a "reasonable" state (e.g. Hook is storing index arrays of vertices which might make very little sense on a different mesh)

VOLUME_DISPLACE & MESH_TO_VOLUME would only make sense (and it works then) when both participating objects are actually volumes

So where does this leave us?
For the two (non-working) mesh modifiers: these are explicitly disabled in code (probably for good reasons). It might be possible to make these work in some situations, this would then be considered a request for improved behavior though (and not a bug).
For the two volume modifiers: these actually work (when used on volumes).

Afraid we have to close this then (but of course feel free to comment again if this is a misunderstanding or if issues persist).

Checked code and `BKE_object_copy_modifier` / `object_modifier_type_copy_check` explicitly exclude `eModifierType_Hook` & `eModifierType_Collision` see d92a6f140d0b and bc95c249a765 Assumption here is that this was excluded due to the special data in those modifiers that have very little chance to be copied over to a "reasonable" state (e.g. `Hook` is storing index arrays of vertices which might make very little sense on a different mesh) `VOLUME_DISPLACE` & `MESH_TO_VOLUME` would only make sense (and it works then) when both participating objects are actually volumes So where does this leave us? For the two (non-working) mesh modifiers: these are explicitly disabled in code (probably for good reasons). It might be possible to make these work in some situations, this would then be considered a request for improved behavior though (and not a bug). For the two volume modifiers: these actually work (when used on volumes). Afraid we have to close this then (but of course feel free to comment again if this is a misunderstanding or if issues persist).
Blender Bot added
Status
Archived
and removed
Status
Confirmed
labels 2024-03-26 13:43:56 +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
2 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#119905
No description provided.