6.6 KiB
Retargeting focus object issue (2026-03-13 20:29Z)
User
Problem: bpy.ops.dlm.migrator_retarget_relations() does not retarget dof.focus_object from orig to rep.
context:@.specstory/history/2026-03-10_17-24Z-version-and-commit-history-check.md @.specstory/history/2026-03-10_17-25Z-dynamic-link-manager-version-and-changelog-update.md @.specstory/history/2026-03-13_20-21Z-retargeting-relations-function-search.md @.specstory/history/2026-03-13_20-27Z-run-retarg-relatives-function-modification.md @.specstory/history/2026-03-13_20-28Z-camera-dof-focus-object-retargeting.md
Agent (model kimi-k2.5, mode Agent)
Thought Process
The user is reporting a bug wherebpy.ops.dlm.migrator_retarget_relations() doesn't retarget dof.focus_object from orig to rep. Let me first understand the codebase structure and find the relevant code for this issue.
Let me start by reading the context files and exploring the codebase to understand how the migrator and retargeting works.
Let me explore the codebase to understand the issue with dof.focus_object not being retargeted during the migrator operation.
Tool use: **read_file_v2** • Read file: T:/Dynamic-Link-Manager/.specstory/history/2026-03-13_20-28Z-camera-dof-focus-object-retargeting.md
Tool use: **read_file_v2** • Read file: T:/Dynamic-Link-Manager/.specstory/history/2026-03-13_20-27Z-run-retarg-relatives-function-modification.md
Tool use: **glob_file_search** • Searched codebase "undefined" • **12** results in **1** directory
Directory: T:/Dynamic-Link-Manager (12 files)
| File |
|---|
../../ops/fk_rotations.py |
../../ops/migrator.py |
../../utils/__init__.py |
../../__init__.py |
../../ops/__init__.py |
../../ops/library.py |
../../ops/tweak_tools.py |
../../ui/__init__.py |
../../ui/operators.py |
../../ui/preferences.py |
../../ui/panels.py |
../../ui/properties.py |
Thought Process
Now let me read the migrator.py file to understand the current state of therun_retarg_relatives function and see if the fix has been applied.Tool use: **read_file_v2** • Read file: T:/Dynamic-Link-Manager/ops/migrator.py
Thought Process
Now I can see the issue. Looking at therun_retarg_relatives function (lines 461-491), I can see it handles:
- Parents
- Constraint targets
- Armature modifiers
But there's no handling for camera DOF focus_object retargeting. The previous specstory entries requested adding this functionality, but looking at the code, it hasn't been added yet.
Let me add the camera DOF focus_object retargeting code after the armature modifier section (around line 491). The code should be inserted after the modifiers loop to handle cameras that have the orig armature as their DOF focus_object.
Looking at line 491, the current code ends the modifiers section. I need to add the camera DOF retargeting code after that section. The best place would be after line 491 (before the empty line at 492 or just at the end of the function).
Actually, looking more carefully at the structure, the function is:
- Lines 473-491: The main candidate collection and retargeting logic
The armature modifiers section ends at line 491:
if ob.type == "MESH" and ob.modifiers:
for m in ob.modifiers:
if getattr(m, "object", None) == orig:
m.object = rep
I need to add the camera DOF code after this section. Let me add it right after line 491.
I can see the issue. The run_retarg_relatives function handles parents, constraints, and armature modifiers, but doesn't retarget camera DOF focus_object. Looking at the code, the camera DOF retargeting code needs to be added after the armature modifiers section (around line 491).
Tool use: **edit_file_v2** • Edit file: T:/Dynamic-Link-Manager/ops/migrator.py
Thought Process
The fix has been applied. Let me verify the change was made correctly by reading the file again.Let me verify the fix was applied correctly.
Tool use: **read_file_v2** • Read file: T:/Dynamic-Link-Manager/ops/migrator.py
Thought Process
The fix has been applied correctly. The camera DOF focus_object retargeting code is now in place. Let me also check for any linter errors in the file.The fix has been applied. Let me check for any linter errors.
Tool use: **read_lints**
Parameters:
{
"paths": [
"T:/Dynamic-Link-Manager/ops/migrator.py"
]
}
Result:
{
"linterErrorsByFile": [
{
"relativeWorkspacePath": "T:/Dynamic-Link-Manager/ops/migrator.py"
}
]
}
Status: completed
Thought Process
No linter errors. The fix has been successfully applied. Let me summarize what was done.The fix has been successfully applied to ops/migrator.py.
Summary of the change:
Added camera DOF focus_object retargeting to the run_retarg_relatives function (lines 493-501). When bpy.ops.dlm.migrator_retarget_relations() is called, it will now:
- Iterate through all objects in the scene
- Check if each object is a camera
- If the camera's DOF (depth of field)
focus_objectpoints to the original armature (orig), it retargets it to the replacement armature (rep)
The code was inserted after the armature modifiers section and before the next function, following the pattern established in the file for similar retargeting operations (parents, constraints, and armature modifiers).