small compression
[carveJwlIkooP6JGAAIwe30JlM.git] / blender_export.py
index 239bfd03afa2f394f50694b2336aec4d8fa6c6de..1646d83a252a3e5f6469ca05a407b080c831e521 100644 (file)
@@ -42,9 +42,9 @@ sr_entity_list = [
    ('ent_relay',        'Relay',          '', 20 )
 ]
 
-MDL_VERSION_NR = 102
+MDL_VERSION_NR = 103
 SR_TRIGGERABLE = [ 'ent_audio', 'ent_ccmd', 'ent_gate', 'ent_challenge', \
-                   'ent_relay', 'ent_skateshop', 'ent_objective' ]
+                   'ent_relay', 'ent_skateshop', 'ent_objective', 'ent_route' ]
 
 def get_entity_enum_id( alias ):
 #{
@@ -263,7 +263,11 @@ class ent_route(Structure):
                ("factive",c_float),
                ("board_transform",(c_float*3)*4),
                ("sm",mdl_submesh),
-               ("latest_pass",c_double)]
+               ("latest_pass",c_double),
+               ("id_camera",c_uint32), # v103+ 
+               ]
+
+   sr_functions = { 0: 'view' }
 #}
 
 class ent_water(Structure):
@@ -1328,7 +1332,7 @@ def sr_compile_menus( collection ):
                sr_compile_mesh_internal( obj )
       #}
 
-      if item.type == 1 or item.type == 2:#{
+      if item.type == 1 or item.type == 2 or item.type == 7:#{
          item_button = item._anonymous_union.button
          item_button.pstr = sr_compile_string( obj_data.string )
          item_button.stack_behaviour = int( obj_data.stack_behaviour )
@@ -1989,6 +1993,7 @@ def sr_compile( collection ):
          route.pstr_name = sr_compile_string( obj_data.alias )
          route.checkpoints_start = checkpoint_count
          route.checkpoints_count = 0
+         route.id_camera = sr_entity_id( obj_data.cam )
 
          for ci in range(3):
             route.colour[ci] = obj_data.colour[ci]
@@ -2889,11 +2894,16 @@ class SR_OBJECT_ENT_ROUTE(bpy.types.PropertyGroup):
           name="Alias",\
           default="Untitled Course")
 
+   cam: bpy.props.PointerProperty( \
+           type=bpy.types.Object, name="Viewpoint", \
+           poll=lambda self,obj: sr_filter_ent_type(obj,['ent_camera']))
+
    @staticmethod
    def sr_inspector( layout, data ):
    #{
       layout.prop( data[0], 'alias' )
       layout.prop( data[0], 'colour' )
+      layout.prop( data[0], 'cam' )
 
       layout.label( text='Checkpoints' )
       layout.template_list('SR_UL_ROUTE_NODE_LIST', 'Checkpoints', \
@@ -3174,7 +3184,8 @@ class SR_OBJECT_ENT_MENU_ITEM(bpy.types.PropertyGroup):
                                         ('3','toggle', ''),
                                         ('4','slider',''),
                                         ('5','page',''),
-                                        ('6','binding','')])
+                                        ('6','binding',''),
+                                        ('7','visual(no colourize)','')])
 
    @staticmethod
    def sr_inspector( layout, data ):
@@ -3183,7 +3194,7 @@ class SR_OBJECT_ENT_MENU_ITEM(bpy.types.PropertyGroup):
       box = layout.box()
       box.prop( data, 'tipo' )
 
-      if data.tipo == '0':#{
+      if data.tipo == '0' or data.tipo == '7':#{
          box.prop( data, 'string', text='Name' )
          return
       #}