if 'imported' in locals():
    import imp
    import bpy
    imp.reload(blendergltf)
else:
    imported = True
    from . import blendergltf


import json
import math

import bpy


def togl(matrix):
    return [i for col in matrix.col for i in col]


class BTFConverter:
    def convert(self, add_delta, update_delta, remove_delta, view_delta):
        for key, value in update_delta.items():
            if value:
                add_delta[key] = value

        data = blendergltf.export_gltf(add_delta)

        self.export_view(view_delta, data)

        return data

    def export_view(self, view_delta, gltf):
        if 'extras' not in gltf:
            gltf['extras'] = {}

        if 'viewport' in view_delta:
            gltf['extras']['view'] = {
                'width' : view_delta['viewport'].width,
                'height' : view_delta['viewport'].width,
                'projection_matrix': togl(view_delta['projection_matrix']),
                'view_matrix': togl(view_delta['view_matrix']),
            }

@@ -495,24 +495,51 @@
 add_delta)%0A%0A
+        if view_delta:%0A    
         self
@@ -565,24 +565,24 @@
 elta, data)%0A
-
 %0A        ret
@@ -700,16 +700,52 @@
 s'%5D = %7B%7D
+%0A        gltf%5B'extras'%5D%5B'view'%5D = %7B%7D
 %0A%0A      
@@ -912,37 +912,38 @@
 lta%5B'viewport'%5D.
-width
+height
 ,%0A              
@@ -938,22 +938,31 @@
         
+  %7D%0A
       
+  if 
 'project
@@ -964,33 +964,105 @@
 ojection_matrix'
-:
+ in view_delta:%0A            gltf%5B'extras'%5D%5B'view'%5D%5B'projection_matrix'%5D =
  togl(view_delta
@@ -1075,33 +1075,32 @@
 ection_matrix'%5D)
-,
 %0A               
@@ -1092,24 +1092,83 @@
         
-        
+if 'view_matrix' in view_delta:%0A            gltf%5B'extras'%5D%5B'view'%5D%5B
 'view_ma
@@ -1172,17 +1172,19 @@
 _matrix'
-:
+%5D =
  togl(vi
@@ -1207,24 +1207,9 @@
 atrix'%5D)
-,%0A            %7D
 %0A

Fix exporting view information