diff --git a/.gitignore b/.gitignore index d0a113f..8c9f033 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.pyc -.DS_Store \ No newline at end of file +.DS_Store +dist \ No newline at end of file diff --git a/src/__init__.py b/fspy-blender/__init__.py similarity index 92% rename from src/__init__.py rename to fspy-blender/__init__.py index d31d190..c882511 100644 --- a/src/__init__.py +++ b/fspy-blender/__init__.py @@ -3,7 +3,7 @@ "name": "Import fSpy project", "author": "Per Gantelius", "description": "Imports the background image and camera parameters from an fSpy project.", - "version": (1, 0, 0), + "version": (0, 1, 0), "blender": (2, 79, 0), "location": "File > Import > fSpy", "url": "TODO", @@ -25,6 +25,11 @@ import mathutils import tempfile + def show_popup(title, message, type = 'ERROR'): + def draw_popup(self, context): + self.layout.label(message) + bpy.context.window_manager.popup_menu(draw_popup, title, type) + def import_fpsy_project(context, filepath, use_some_setting): project = fspy.Project(filepath) @@ -40,7 +45,6 @@ def import_fpsy_project(context, filepath, use_some_setting): camera.matrix_world = mathutils.Matrix(camera_parameters.camera_transfrom) - # Set render resolution render_settings = bpy.context.scene.render render_settings.resolution_x = camera_parameters.image_width @@ -62,6 +66,8 @@ def import_fpsy_project(context, filepath, use_some_setting): rv3d = space_data.region_3d # Reference 3D view region space_data.show_background_images = True # Show BG images + space_data.camera = camera + space_data.region_3d.view_perspective = 'CAMERA' bg = space_data.background_images.new() @@ -80,6 +86,7 @@ def import_fpsy_project(context, filepath, use_some_setting): break + show_popup("Done!", message = "", type = 'INFO') return {'FINISHED'} diff --git a/src/fspy.py b/fspy-blender/fspy.py similarity index 100% rename from src/fspy.py rename to fspy-blender/fspy.py