v1 → v2 Migration Guide
Download MarkdownThis guide explains how to migrate from v1 to v2. Most existing code will work as-is. Changes are required for: (1) the import style, (2) the slot type rule, and (3) replacing removed select_* with get_*(select=1).
1. Import Change (Required)
v1 (5 lines)
import sys, os, pymxs
_p = os.path.join(pymxs.runtime.getDir(pymxs.runtime.Name("userScripts")), "os_fast_ref_package")
if _p not in sys.path:
sys.path.append(_p)
from os_fast_ref.api import FastRefAPI
v2 (1 line)
from os_fast_ref.api import FastRefAPI
When you install the v2 .mzp, a startup script (fast_ref_register_path.ms) is automatically registered, so you can import without any path setup from the moment Max starts.
Note: If you don't reinstall with the v2
.mzp, the single-line import will not work. Make sure to reinstall with the latest MZP.
2. Strict slot Type Rule (Review Required)
In v2, only int is accepted for the slot argument. bool, str, float, etc. immediately raise TypeError.
Affected Methods
remove_reference, replace_reference, reload_reference, merge_reference, set_space_activate, set_unpack, export_fbx
What to Check
# This v1 pattern raises TypeError in v2
slot = "0" # string slot
api.remove_reference(slot=slot) # TypeError!
# Correct approach
slot = int(slot)
api.remove_reference(slot=slot) # OK
3. New Methods (Optional)
| Method | Description |
|---|---|
get_outdated_references() |
Returns only OUTDATED reference list |
reload_outdated_references() |
Reloads only OUTDATED references |
refresh() |
Force-rescans InfoNode |
get_all_objects / get_skin_meshes / get_skin_bones / get_all_skin_objects / get_duplicate_nodes / get_biped_com / get_biped_nodes |
Get Nodes query APIs (select=0|1) |
Not required if not used in existing code. If you used old select_*, see section 6 (required).
4. FBX preset Keyword (Optional)
The preset= keyword has been added to export_fbx / export_fbx_all. The existing fbx_options=dict approach still works.
# v1 style (still works in v2)
api.export_fbx(slot=0, output_path=r"J:\output\char.fbx",
fbx_options={"Animation": False})
# v2 new — specify by preset name
api.export_fbx(slot=0, output_path=r"J:\output\char.fbx", preset="Unreal_Ani")
5. Silent Write Operations Guaranteed
In v1, calling add/remove/replace etc. on a scene with Space OFF references could trigger a Smart Switch confirmation dialog.
The v2 public API always runs in silent mode. No confirmation dialogs are shown.
Quick Migration Example
Before (v1)
import sys, os, pymxs
_p = os.path.join(pymxs.runtime.getDir(pymxs.runtime.Name("userScripts")), "os_fast_ref_package")
if _p not in sys.path:
sys.path.append(_p)
from os_fast_ref.api import FastRefAPI
api = FastRefAPI()
api.reload_all_references()
api.export_fbx_all(output_folder=r"J:\output")
api.update_ui()
After (v2)
from os_fast_ref.api import FastRefAPI
api = FastRefAPI()
api.reload_outdated_references() # reload only OUTDATED
api.export_fbx_all(
output_folder=r"J:\output",
preset="Unreal_Ani" # specify preset by name
)
api.update_ui()
6. Removed select_ → get_(select=1) (Required if applicable)
The old select_reference_nodes / select_duplicate_nodes / select_skin_mesh / select_skin_bones APIs were fully removed (no shim). Calling them raises AttributeError.
| Removed | Replacement |
|---|---|
select_reference_nodes(...) |
get_all_objects(slot=..., select=1) |
select_duplicate_nodes(...) |
get_duplicate_nodes(slot=..., select=1) |
select_skin_mesh(...) |
get_skin_meshes(slot=..., select=1) |
select_skin_bones(...) |
get_skin_bones(slot=..., select=1) |
Use select=0 (default) when you only need query results. See the Get Nodes overview page for the shared contract and exceptions.
# Before (removed — AttributeError)
# api.select_skin_mesh(slot=0)
# After
api.get_skin_meshes(slot=0, select=1)