diff options
-rw-r--r-- | io_scene_obj/import_obj.py | 8 | ||||
-rw-r--r-- | space_clip_editor_refine_solution.py | 30 |
2 files changed, 27 insertions, 11 deletions
diff --git a/io_scene_obj/import_obj.py b/io_scene_obj/import_obj.py index 2bf4ac94..916ff313 100644 --- a/io_scene_obj/import_obj.py +++ b/io_scene_obj/import_obj.py @@ -318,7 +318,7 @@ def create_materials(filepath, relpath, # rgb, filter color, blender has no support for this. print("WARNING, currently unsupported 'tf' filter color option, skipped.") elif line_id == b'illum': - illum = int(line_split[1]) + illum = get_int(line_split[1]) # inline comments are from the spec, v4.2 if illum == 0: @@ -835,6 +835,12 @@ def get_float_func(filepath): return float +def get_int(svalue): + if b',' in svalue: + return int(float(svalue.replace(b',', b'.'))) + return int(float(svalue)) + + def load(context, filepath, *, diff --git a/space_clip_editor_refine_solution.py b/space_clip_editor_refine_solution.py index a3287b78..2287714b 100644 --- a/space_clip_editor_refine_solution.py +++ b/space_clip_editor_refine_solution.py @@ -18,12 +18,14 @@ # # ##### END GPL LICENSE BLOCK ##### +# <pep8 compliant> + bl_info = { "name": "Refine tracking solution", "author": "Stephen Leger", "license": "GPL", - "version": (1, 1, 3), - "blender": (2, 7, 8), + "version": (1, 1, 4), + "blender": (2, 80, 0), "location": "Clip Editor > Tools > Solve > Refine Solution", "description": "Refine motion solution by setting track weight according" " to reprojection error", @@ -70,10 +72,9 @@ class OP_Tracking_refine_solution(Operator): marker_position = Vector() for frame in range(start, end): - camera = tracking.reconstruction.cameras.find_frame(frame) + camera = tracking.reconstruction.cameras.find_frame(frame=frame) if camera is not None: - imat = camera.matrix.inverted() - projection_matrix = imat.transposed() + camera_invert = camera.matrix.inverted() else: continue @@ -102,7 +103,7 @@ class OP_Tracking_refine_solution(Operator): else: tw = 1.0 - reprojected_position = track.bundle * projection_matrix + reprojected_position = camera_invert @ track.bundle if reprojected_position.z == 0: track.weight = 0 track.keyframe_insert("weight", frame=frame) @@ -152,11 +153,11 @@ class OP_Tracking_reset_solution(Operator): start = tracking.reconstruction.cameras[0].frame end = tracking.reconstruction.cameras[-1].frame for frame in range(start, end): - camera = tracking.reconstruction.cameras.find_frame(frame) + camera = tracking.reconstruction.cameras.find_frame(frame=frame) if camera is None: continue for track in tracking.tracks: - marker = track.markers.find_frame(frame) + marker = track.markers.find_frame(frame=frame) if marker is None: continue track.weight = 1.0 @@ -191,6 +192,13 @@ class RefineMotionTrackingPanel(Panel): row.operator("tracking.reset_solution") +classes =( + OP_Tracking_refine_solution, + OP_Tracking_reset_solution, + RefineMotionTrackingPanel + ) + + def register(): bpy.types.WindowManager.TrackingTargetError = FloatProperty( name="Target Error", @@ -204,11 +212,13 @@ def register(): default=25, min=1 ) - bpy.utils.register_module(__name__) + for cls in classes: + bpy.utils.register_class(cls) def unregister(): - bpy.utils.unregister_module(__name__) + for cls in reversed(classes): + bpy.utils.unregister_class(cls) del bpy.types.WindowManager.TrackingTargetError del bpy.types.WindowManager.TrackingSmooth |