From 148309a2d5c53f7a03ad4e645cb2654e5278fe35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mi=C5=82osz=20K=C5=82osowicz?= Date: Tue, 3 Jan 2017 00:40:15 +0100 Subject: [PATCH 1/2] Set horizon from markers vector --- movie_clip_editor_panorama_tracker/core.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/movie_clip_editor_panorama_tracker/core.py b/movie_clip_editor_panorama_tracker/core.py index a27d240..0ee6385 100644 --- a/movie_clip_editor_panorama_tracker/core.py +++ b/movie_clip_editor_panorama_tracker/core.py @@ -182,7 +182,7 @@ def calculate_orientation(scene): if not movieclip: return (0,0,0) settings = movieclip.panorama_settings - + set_horizon = settings.set_horizon tracking = movieclip.tracking.objects[movieclip.tracking.active_object_index] focus = tracking.tracks.get(settings.focus) target = tracking.tracks.get(settings.target) @@ -207,11 +207,11 @@ def calculate_orientation(scene): # retarget y axis again nvecy = vecz.cross(vecx) nvecy.normalize() - + # store orientation orientation = sphere_to_euler(vecx, nvecy, vecz) - orientation = (settings.orientation.to_matrix() * orientation.to_matrix()).to_euler() - + if set_horizon == False: + orientation = (settings.orientation.to_matrix() * orientation.to_matrix()).to_euler() return (-orientation[0], -orientation[1], -orientation[2]) @@ -470,6 +470,7 @@ def update_panorama_orientation(scene): tex_env.texture_mapping.rotation = mapping_node_order_flip(orientation) + def mapping_node_order_flip(orientation): """ Flip euler order of mapping shader node @@ -491,6 +492,7 @@ class TrackingPanoramaSettings(bpy.types.PropertyGroup): target = StringProperty() flip = BoolProperty(default=True) show_preview = BoolProperty(default=False, name="Show Preview", update=show_preview_update) + set_horizon = BoolProperty(default=False, name="Set horizon") # ############################### From 0fbb1ca05a1b64929e21860852a0d20582a307b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mi=C5=82osz=20K=C5=82osowicz?= Date: Tue, 3 Jan 2017 00:41:32 +0100 Subject: [PATCH 2/2] Set horizon from markers vactor --- movie_clip_editor_panorama_tracker/ui.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/movie_clip_editor_panorama_tracker/ui.py b/movie_clip_editor_panorama_tracker/ui.py index 0009a0c..bfcc9ed 100644 --- a/movie_clip_editor_panorama_tracker/ui.py +++ b/movie_clip_editor_panorama_tracker/ui.py @@ -52,6 +52,8 @@ def draw(self, context): col.separator() col.prop(settings, "show_preview") + col.separator() + col.prop(settings, "set_horizon") # ############################### # Register / Unregister @@ -61,4 +63,4 @@ def register(): def unregister(): - bpy.utils.unregister_class(CLIP_PanoramaPanel) + bpy.utils.unregister_class(CLIP_PanoramaPanel)