tl;dr I want to be able to access the root object through a custom attribute modifier applied to that object.
I’m working on a script that imports animations from a game (Rocket League) and rebuilds them inside 3ds Max. I recently added a feature that would let you import multiple camera angles from the same section of time of a replay, but the sync isn’t perfect. I want to be able to shift all the keyframes of a camera by a specified amount of time.
My ideal method is applying an empty modifier to the camera with a “Shift Amount” spinner and an “Apply Shift” button. What that would then do is use the MoveKeys function on the position, rotation, and fov controllers to shift all the keys by that specified amount. However, I can’t seem to find a way to access the camera itself from within that custom attributes modifier.
Is it possible to access the root object of a custom attribute modifier from the attribute’s rollout?
local TheCamera = FreeCamera name:CameraName -- Add custom attributes AddModifier TheCamera (EmptyModifier()) local TheModifier = TheCamera.modifiers TheModifier.name = "Sync Shift" SyncShiftModifier = attributes SyncShiftAttributes ( -- Sync Shift rollout parameters syncshiftparams rollout:ro_syncshift ( ShiftAmount type:#float ui:SpinnerShiftAmount ) rollout ro_syncshift "Sync Shift" ( spinner SpinnerShiftAmount "Shift Amount " width:162 pos:[-5,5] range:[-1000,1000,0] type:#float button ButtonApplyShift "Apply Shift" width:152 pos:[5,25] on ButtonApplyShift pressed do ( -- ERROR HERE SAYING IT CAN'T ACCESS THE LOCAL CAMERA VARIABLE -- -- I understand why the error exists, I would just like to know *how* to access the camera -- MoveKeys TheCamera.Position.X_Position.Controller SpinnerShiftAmount.value MoveKeys TheCamera.Position.Y_Position.Controller SpinnerShiftAmount.value MoveKeys TheCamera.Position.Z_Position.Controller SpinnerShiftAmount.value MoveKeys TheCamera.Rotation.X_Rotation.Controller SpinnerShiftAmount.value MoveKeys TheCamera.Rotation.Y_Rotation.Controller SpinnerShiftAmount.value MoveKeys TheCamera.Rotation.Z_Rotation.Controller SpinnerShiftAmount.value MoveKeys TheCamera.FOV.Controller 1 SpinnerShiftAmount.value = 0 ) ) ) CustAttributes.Add TheModifier SyncShiftModifier