Skip to content

Commit

Permalink
Add action function _v1 and _v2 commands to Python API
Browse files Browse the repository at this point in the history
These commands can be used to check if the gien action is using the
"Solver Version" 1 or 2.
  • Loading branch information
david-cattermole committed Dec 31, 2022
1 parent 0a8d602 commit c82be0b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
10 changes: 9 additions & 1 deletion python/mmSolver/_api/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,18 @@
Action = collections.namedtuple('Action', ('func', 'args', 'kwargs'))


def action_func_is_mmSolver(action):
def action_func_is_mmSolver_v1(action):
return _action_func_is_name(action, 'mmSolver')


# For backwards compatibility.
action_func_is_mmSolver = action_func_is_mmSolver_v1


def action_func_is_mmSolver_v2(action):
return _action_func_is_name(action, 'mmSolver_v2')


def action_func_is_camera_solve(action):
return _action_func_is_name(action, 'camera_solve')

Expand Down
4 changes: 4 additions & 0 deletions python/mmSolver/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
from mmSolver._api.action import (
Action,
action_func_is_mmSolver,
action_func_is_mmSolver_v1,
action_func_is_mmSolver_v2,
action_func_is_mmSolverAffects,
func_str_to_callable,
action_to_components,
Expand Down Expand Up @@ -407,6 +409,8 @@
'generate_isolate_nodes',
# Action
'action_func_is_mmSolver',
'action_func_is_mmSolver_v1',
'action_func_is_mmSolver_v2',
'action_func_is_mmSolverAffects',
'func_str_to_callable',
'action_to_components',
Expand Down

0 comments on commit c82be0b

Please sign in to comment.