X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=blender_export.py;h=b4a501d64ad36bce28ed88f6473e7f70f46bab25;hb=63fe317d7db724162561da52aa382c82ac3c29be;hp=239bfd03afa2f394f50694b2336aec4d8fa6c6de;hpb=53597f45307d8a2120e3a0bbe71797b216e8750b;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/blender_export.py b/blender_export.py index 239bfd0..b4a501d 100644 --- a/blender_export.py +++ b/blender_export.py @@ -39,12 +39,14 @@ sr_entity_list = [ ('ent_ccmd', 'CCmd', '', 17 ), ('ent_objective', 'Objective', '', 18 ), ('ent_challenge', 'Challenge', '', 19 ), - ('ent_relay', 'Relay', '', 20 ) + ('ent_relay', 'Relay', '', 20 ), + ('ent_miniworld', 'Mini World', '', 22 ) ] -MDL_VERSION_NR = 102 +MDL_VERSION_NR = 104 SR_TRIGGERABLE = [ 'ent_audio', 'ent_ccmd', 'ent_gate', 'ent_challenge', \ - 'ent_relay', 'ent_skateshop', 'ent_objective' ] + 'ent_relay', 'ent_skateshop', 'ent_objective', 'ent_route',\ + 'ent_miniworld' ] def get_entity_enum_id( alias ): #{ @@ -263,7 +265,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): @@ -463,7 +469,8 @@ class ent_worldinfo(Structure): _fields_ = [("pstr_name",c_uint32), ("pstr_author",c_uint32), # unused ("pstr_desc",c_uint32), # unused - ("timezone",c_float)] + ("timezone",c_float), + ("pstr_skybox",c_uint32)] #} class ent_ccmd(Structure): @@ -517,6 +524,14 @@ class ent_cubemap(Structure):#{ ("placeholder",c_uint32*2)] #} +class ent_miniworld(Structure):#{ + _fields_ = [("transform",mdl_transform), + ("pstr_world",c_uint32), + ("purpose",c_int32)] + + sr_functions = { 0: 'zone' } +#} + def obj_ent_type( obj ): #{ if obj.type == 'ARMATURE': return 'mdl_armature' @@ -1328,7 +1343,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 ) @@ -1875,6 +1890,7 @@ def sr_compile( collection ): worldinfo.pstr_author = sr_compile_string( obj_data.author ) worldinfo.pstr_desc = sr_compile_string( obj_data.desc ) worldinfo.timezone = obj_data.timezone + worldinfo.pstr_skybox = sr_compile_string( obj_data.skybox ) sr_ent_push( worldinfo ) #} elif ent_type == 'ent_ccmd':#{ @@ -1938,6 +1954,14 @@ def sr_compile( collection ): cubemap.live = 60 sr_ent_push( cubemap ) #} + elif ent_type == 'ent_miniworld':#{ + miniworld = ent_miniworld() + obj_data = obj.SR_data.ent_miniworld[0] + + compile_obj_transform( obj, miniworld.transform ) + miniworld.pstr_world = sr_compile_string( obj_data.world ) + sr_ent_push( miniworld ) + #} #} #} @@ -1989,6 +2013,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] @@ -2573,6 +2598,11 @@ class SR_OBJECT_ENT_ROUTE_ENTRY(bpy.types.PropertyGroup): poll=lambda self,obj: sr_filter_ent_type(obj,['ent_gate'])) #} +class SR_OBJECT_ENT_MINIWORLD(bpy.types.PropertyGroup): +#{ + world: bpy.props.StringProperty( name='world UID' ) +#} + class SR_UL_ROUTE_NODE_LIST(bpy.types.UIList): #{ bl_idname = 'SR_UL_ROUTE_NODE_LIST' @@ -2889,11 +2919,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 +3209,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 +3219,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 #} @@ -3236,6 +3272,7 @@ class SR_OBJECT_ENT_WORLD_INFO(bpy.types.PropertyGroup): desc: bpy.props.StringProperty(name="Description") author: bpy.props.StringProperty(name="Author") timezone: bpy.props.FloatProperty(name="Timezone(hrs) (UTC0 +hrs)") + skybox: bpy.props.StringProperty(name="Skybox") #} class SR_OBJECT_ENT_CCMD(bpy.types.PropertyGroup): @@ -3359,6 +3396,7 @@ class SR_OBJECT_PROPERTIES(bpy.types.PropertyGroup): ent_objective: bpy.props.CollectionProperty(type=SR_OBJECT_ENT_OBJECTIVE) ent_challenge: bpy.props.CollectionProperty(type=SR_OBJECT_ENT_CHALLENGE) ent_relay: bpy.props.CollectionProperty(type=SR_OBJECT_ENT_RELAY) + ent_miniworld: bpy.props.CollectionProperty(type=SR_OBJECT_ENT_MINIWORLD) ent_type: bpy.props.EnumProperty( name="Type", @@ -4586,7 +4624,7 @@ classes = [ SR_INTERFACE, SR_MATERIAL_PANEL,\ SR_OBJECT_ENT_WORKSHOP_PREVIEW,SR_OBJECT_ENT_MENU_ITEM,\ SR_OBJECT_ENT_WORLD_INFO,SR_OBJECT_ENT_CCMD,\ SR_OBJECT_ENT_OBJECTIVE,SR_OBJECT_ENT_CHALLENGE,\ - SR_OBJECT_ENT_RELAY,\ + SR_OBJECT_ENT_RELAY,SR_OBJECT_ENT_MINIWORLD,\ \ SR_OBJECT_PROPERTIES, SR_LIGHT_PROPERTIES, SR_BONE_PROPERTIES, SR_MESH_PROPERTIES, SR_MATERIAL_PROPERTIES \