X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=blender_export.py;h=32e548b4afa0d1583f4171949d0fec4e534b4886;hb=7fb47c3eb672f4468da8b5b452c09d44e1389d5f;hp=f27123773e24397891e41edd2769e5297af79e84;hpb=ec90a4b46865009c1e1b1679f6926e35d2ee3f12;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/blender_export.py b/blender_export.py index f271237..32e548b 100644 --- a/blender_export.py +++ b/blender_export.py @@ -33,7 +33,9 @@ sr_entity_list = [ ('ent_skateshop', 'Skate Shop', '', 12 ), ('ent_camera', 'Camera', '', 13 ), ('ent_swspreview', 'Workshop Preview', '', 14 ), - ('ent_menuitem', 'Menu Item', '', 15 ) + ('ent_menuitem', 'Menu Item', '', 15 ), + ('ent_worldinfo', 'World Info', '', 16 ), + ('ent_ccmd', 'CCmd', '', 17 ) ] def get_entity_enum_id( alias ): @@ -185,6 +187,7 @@ class ent_gate(Structure): #{ _fields_ = [("type",c_uint32), ("target", c_uint32), + ("key",c_uint32), ("dimensions", c_float*3), ("co", (c_float*3)*2), ("q", (c_float*4)*2), @@ -353,10 +356,16 @@ class ent_skateshop_boards(Structure): ("id_info",c_uint32), ("id_rack",c_uint32)] #} +class ent_skateshop_worlds(Structure): +#{ + _fields_ = [("id_display",c_uint32), + ("id_info",c_uint32)] +#} class ent_skateshop_anon_union(Union): #{ _fields_ = [("boards",ent_skateshop_boards), - ("character",ent_skateshop_characters)] + ("character",ent_skateshop_characters), + ("worlds",ent_skateshop_worlds)] #} class ent_skateshop(Structure): #{ @@ -423,6 +432,19 @@ class ent_camera(Structure): ("fov",c_float)] #} +class ent_worldinfo(Structure): +#{ + _fields_ = [("pstr_name",c_uint32), + ("pstr_author",c_uint32), # unused + ("pstr_desc",c_uint32), # unused + ("timezone",c_float)] +#} + +class ent_ccmd(Structure): +#{ + _fields_ = [("pstr_command",c_uint32)] +#} + def obj_ent_type( obj ): #{ if obj.type == 'ARMATURE': return 'mdl_armature' @@ -687,6 +709,7 @@ def sr_compile_material( mat ): if mat.SR_data.skate_surface: flags |= 0x1 if mat.SR_data.grow_grass: flags |= 0x4 if mat.SR_data.grind_surface: flags |= 0x8 + if mat.SR_data.preview_visibile: flags |= 0x40 #} if mat.SR_data.shader == 'invisible': flags |= 0x10 if mat.SR_data.shader == 'boundary': flags |= (0x10|0x20) @@ -1558,7 +1581,8 @@ def sr_compile( collection ): #} #} elif obj_data.tipo == 'nonlocal':#{ - gate.target = sr_compile_string(obj_data.key) + gate.target = 0 + gate.key = sr_compile_string(obj_data.key) gate.type = 2 #} else: gate.type = 0 @@ -1683,6 +1707,11 @@ def sr_compile( collection ): charshop.id_display = sr_entity_id( obj_data.mark_display ) charshop.id_info = sr_entity_id( obj_data.mark_info ) #} + elif skateshop.type == 2:#{ + worldshop = skateshop._anonymous_union.worlds + worldshop.id_display = sr_entity_id( obj_data.mark_display ) + worldshop.id_info = sr_entity_id( obj_data.mark_info ) + #} skateshop.id_camera = sr_entity_id( obj_data.cam ) compile_obj_transform( obj, skateshop.transform ) sr_ent_push(skateshop) @@ -1695,6 +1724,21 @@ def sr_compile( collection ): workshop_preview.id_camera = sr_entity_id( obj_data.cam ) sr_ent_push( workshop_preview ) #} + elif ent_type == 'ent_worldinfo':#{ + worldinfo = ent_worldinfo() + obj_data = obj.SR_data.ent_worldinfo[0] + worldinfo.pstr_name = sr_compile_string( obj_data.name ) + worldinfo.pstr_author = sr_compile_string( obj_data.author ) + worldinfo.pstr_desc = sr_compile_string( obj_data.desc ) + worldinfo.timezone = obj_data.timezone + sr_ent_push( worldinfo ) + #} + elif ent_type == 'ent_ccmd':#{ + ccmd = ent_ccmd() + obj_data = obj.SR_data.ent_ccmd[0] + ccmd.pstr_command = sr_compile_string( obj_data.command ) + sr_ent_push( ccmd ) + #} #} #} @@ -1890,6 +1934,7 @@ def sr_compile( collection ): path = F"{folder}{collection.name}.mdl" print( path ) + os.makedirs(os.path.dirname(path),exist_ok=True) fp = open( path, "wb" ) header = mdl_header() header.version = 101 @@ -2206,6 +2251,7 @@ class SR_MATERIAL_PANEL(bpy.types.Panel): row.prop( active_mat.SR_data, "skate_surface" ) row.prop( active_mat.SR_data, "grind_surface" ) row.prop( active_mat.SR_data, "grow_grass" ) + row.prop( active_mat.SR_data, "preview_visibile" ) #} #} @@ -2643,7 +2689,7 @@ class SR_OBJECT_ENT_VOLUME(bpy.types.PropertyGroup): target: bpy.props.PointerProperty( \ type=bpy.types.Object, name="Target", \ poll=lambda self,obj: sr_filter_ent_type(obj,\ - ['ent_audio','ent_skateshop'])) + ['ent_audio','ent_skateshop','ent_ccmd'])) @staticmethod def sr_inspector( layout, data ): @@ -2714,16 +2760,15 @@ class SR_OBJECT_ENT_AUDIO(bpy.types.PropertyGroup): box.prop( data[0], 'flag_loop' ) box.prop( data[0], 'flag_auto' ) + layout.prop( data[0], 'probability_curve' ) + split = layout.split(factor=0.7) c = split.column() c.label( text='Filepath' ) c = split.column() - c.label( text='Chance (0.1s)' ) - - layout.prop( data[0], 'probability_curve' ) - + c.label( text='Chance' ) layout.template_list('SR_UL_AUDIO_LIST', 'Files', \ - data[0], 'files', data[0], 'file_index', rows=5) + data[0], 'files', data[0], 'files_index', rows=5) row = layout.row() row.operator( 'skaterift.al_new_entry', text='Add' ) @@ -2798,7 +2843,8 @@ class SR_OBJECT_ENT_SKATESHOP(bpy.types.PropertyGroup): #{ tipo: bpy.props.EnumProperty( name='Type', items=[('0','boards',''), - ('1','character','')] ) + ('1','character',''), + ('2','world','')] ) mark_rack: bpy.props.PointerProperty( \ type=bpy.types.Object, name="Board Rack", \ poll=lambda self,obj: sr_filter_ent_type(obj,['ent_marker'])) @@ -2919,6 +2965,19 @@ class SR_OBJECT_ENT_MENU_ITEM(bpy.types.PropertyGroup): #} #} +class SR_OBJECT_ENT_WORLD_INFO(bpy.types.PropertyGroup): +#{ + name: bpy.props.StringProperty(name="Name") + desc: bpy.props.StringProperty(name="Description") + author: bpy.props.StringProperty(name="Author") + timezone: bpy.props.FloatProperty(name="Timezone(hrs) (UTC0 +hrs)") +#} + +class SR_OBJECT_ENT_CCMD(bpy.types.PropertyGroup): +#{ + command: bpy.props.StringProperty(name="Command Line") +#} + class SR_OBJECT_PROPERTIES(bpy.types.PropertyGroup): #{ ent_gate: bpy.props.CollectionProperty(type=SR_OBJECT_ENT_GATE) @@ -2934,6 +2993,8 @@ class SR_OBJECT_PROPERTIES(bpy.types.PropertyGroup): ent_swspreview: \ bpy.props.CollectionProperty(type=SR_OBJECT_ENT_WORKSHOP_PREVIEW) ent_menuitem: bpy.props.CollectionProperty(type=SR_OBJECT_ENT_MENU_ITEM) + ent_worldinfo: bpy.props.CollectionProperty(type=SR_OBJECT_ENT_WORLD_INFO) + ent_ccmd: bpy.props.CollectionProperty(type=SR_OBJECT_ENT_CCMD) ent_type: bpy.props.EnumProperty( name="Type", @@ -3041,6 +3102,11 @@ class SR_MATERIAL_PROPERTIES(bpy.types.PropertyGroup): default=False,\ description = "Spawn grass sprites on this surface?" \ ) + preview_visibile: bpy.props.BoolProperty( \ + name="Preview visibile", \ + default=True,\ + description = "Show this material in preview models?" \ + ) blend_offset: bpy.props.FloatVectorProperty( \ name="Blend Offset", \ size=2, \ @@ -3913,6 +3979,15 @@ def cv_draw(): info_cu = Vector((1.2,0.01,0.3))*0.5 info_co = Vector((0.0,0.0,0.0))*0.5 #} + elif data.tipo == '2':#{ + rack = None + cc1 = (1.0,0.0,0.0) + cc2 = (1.0,0.5,0.0) + display_cu = Vector((1.0,1.0,0.5))*0.5 + display_co = Vector((0.0,0.0,0.5))*0.5 + info_cu = Vector((1.2,0.01,0.3))*0.5 + info_co = Vector((0.0,0.0,0.0))*0.5 + #} if rack: cv_draw_ucube( rack.matrix_world, cc, rack_cu, rack_co ) @@ -4039,6 +4114,7 @@ classes = [ SR_INTERFACE, SR_MATERIAL_PANEL,\ SR_UL_FONT_VARIANT_LIST,SR_UL_FONT_GLYPH_LIST,\ SR_OBJECT_ENT_FONT,SR_OBJECT_ENT_TRAFFIC,SR_OBJECT_ENT_SKATESHOP,\ SR_OBJECT_ENT_WORKSHOP_PREVIEW,SR_OBJECT_ENT_MENU_ITEM,\ + SR_OBJECT_ENT_WORLD_INFO,SR_OBJECT_ENT_CCMD,\ \ SR_OBJECT_PROPERTIES, SR_LIGHT_PROPERTIES, SR_BONE_PROPERTIES, SR_MESH_PROPERTIES, SR_MATERIAL_PROPERTIES \