X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=blender_export.py;h=1646d83a252a3e5f6469ca05a407b080c831e521;hb=137d40d96fe923600d8378b8e138e3c276f27ff4;hp=1b1c4fb69e9e22ad098c73109230ffeb6303db74;hpb=6190deb68aa1c9e92ede62ea05c2a755bf5516de;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/blender_export.py b/blender_export.py index 1b1c4fb..1646d83 100644 --- a/blender_export.py +++ b/blender_export.py @@ -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): @@ -397,6 +401,10 @@ class ent_swspreview(Structure): # Menu # ----------------------------------------------------------------- +class ent_menuitem_visual(Structure): +#{ + _fields_ = [("pstr_name",c_uint32)] +#} class ent_menuitem_slider(Structure): #{ _fields_ = [("id_min",c_uint32), @@ -406,7 +414,8 @@ class ent_menuitem_slider(Structure): #} class ent_menuitem_button(Structure): #{ - _fields_ = [("pstr",c_uint32)] + _fields_ = [("pstr",c_uint32), + ("stack_behaviour",c_uint32)] #} class ent_menuitem_checkmark(Structure): #{ @@ -420,12 +429,19 @@ class ent_menuitem_page(Structure): ("id_entrypoint",c_uint32), ("id_viewpoint",c_uint32)] #} +class ent_menuitem_binding(Structure): +#{ + _fields_ = [("pstr_bind",c_uint32), + ("font_variant",c_uint32)] +#} class ent_menuitem_anon_union(Union): #{ _fields_ = [("slider",ent_menuitem_slider), ("button",ent_menuitem_button), ("checkmark",ent_menuitem_checkmark), - ("page",ent_menuitem_page)] + ("page",ent_menuitem_page), + ("visual",ent_menuitem_visual), + ("binding",ent_menuitem_binding)] #} class ent_menuitem(Structure): #{ @@ -1316,9 +1332,14 @@ 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 ) + #} + elif item.type == 0:#{ + item_visual = item._anonymous_union.visual + item_visual.pstr_name = sr_compile_string( obj_data.string ) #} elif item.type == 3:#{ item_checkmark = item._anonymous_union.checkmark @@ -1342,6 +1363,11 @@ def sr_compile_menus( collection ): item_page.id_entrypoint = sr_entity_id( obj_data.newloc ) item_page.id_viewpoint = sr_entity_id( obj_data.camera ) #} + elif item.type == 6:#{ + item_binding = item._anonymous_union.binding + item_binding.pstr_bind = sr_compile_string( obj_data.string ) + item_binding.font_variant = obj_data.font_variant + #} if obj_data.link0: item.id_links[0] = sr_entity_id( obj_data.link0 ) @@ -1967,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] @@ -2148,7 +2175,7 @@ class SR_SCENE_SETTINGS(bpy.types.PropertyGroup): #{ use_hidden: bpy.props.BoolProperty( name="use hidden", default=False ) export_dir: bpy.props.StringProperty( name="Export Dir", subtype='DIR_PATH' ) - gizmos: bpy.props.BoolProperty( name="Draw Gizmos", default=True ) + gizmos: bpy.props.BoolProperty( name="Draw Gizmos", default=False ) panel: bpy.props.EnumProperty( name='Panel', @@ -2867,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', \ @@ -3120,6 +3152,10 @@ class SR_OBJECT_ENT_MENU_ITEM(bpy.types.PropertyGroup): newloc: bpy.props.PointerProperty( \ type=bpy.types.Object, name="New location", \ poll=lambda self,obj: sr_filter_ent_type(obj,['ent_menuitem'])) + stack_behaviour: bpy.props.EnumProperty( name='Stack Behaviour', + items=[('0','append',''), + ('1','replace','')]) + camera: bpy.props.PointerProperty( \ type=bpy.types.Object, name="Camera", \ poll=lambda self,obj: sr_filter_ent_type(obj,['ent_camera'])) @@ -3138,6 +3174,8 @@ class SR_OBJECT_ENT_MENU_ITEM(bpy.types.PropertyGroup): type=bpy.types.Object, name="Checked", \ poll=lambda self,obj: sr_filter_ent_type(obj,['ent_menuitem'])) + font_variant: bpy.props.IntProperty( name="Font Variant" ) + string: bpy.props.StringProperty( name="String" ) tipo: bpy.props.EnumProperty( name='Type', items=[('0','visual',''), @@ -3145,7 +3183,9 @@ class SR_OBJECT_ENT_MENU_ITEM(bpy.types.PropertyGroup): ('2','page button',''), ('3','toggle', ''), ('4','slider',''), - ('5','page','')]) + ('5','page',''), + ('6','binding',''), + ('7','visual(no colourize)','')]) @staticmethod def sr_inspector( layout, data ): @@ -3154,7 +3194,8 @@ 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 #} elif data.tipo == '1':#{ @@ -3162,7 +3203,7 @@ class SR_OBJECT_ENT_MENU_ITEM(bpy.types.PropertyGroup): #} elif data.tipo == '2':#{ box.prop( data, 'string', text='Page' ) - box.prop( data, 'newloc' ) + box.prop( data, 'stack_behaviour' ) #} elif data.tipo == '3':#{ box.prop( data, 'string', text='Data (i32)' ) @@ -3185,6 +3226,11 @@ class SR_OBJECT_ENT_MENU_ITEM(bpy.types.PropertyGroup): box.prop( data, 'camera', text='Viewpoint' ) return #} + elif data.tipo == '6':#{ + box.prop( data, 'string', text='ID' ) + box.prop( data, 'font_variant' ) + return + #} box = box.box() box.label( text="Links" )