X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=blender_export.py;h=b1e7677fb232cf5c071a74ff4cff5f6a26af3e21;hb=4eccfd7252f8ff165670842df537441afae5458b;hp=421cf5d796e75ebbc8e21123f0ef080f80e66759;hpb=217627b6b4eef904ac89b5f7f7f819b3a0970b20;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/blender_export.py b/blender_export.py index 421cf5d..b1e7677 100644 --- a/blender_export.py +++ b/blender_export.py @@ -45,12 +45,14 @@ sr_entity_list = [ ('ent_list', 'Entity List', '', 24 ), ('ent_region', 'Region', '', 25 ), ('ent_glider', 'Glider', '', 26 ), + ('ent_npc', 'npc', '', 27 ) ] MDL_VERSION_NR = 105 SR_TRIGGERABLE = [ 'ent_audio', 'ent_ccmd', 'ent_gate', 'ent_challenge', \ 'ent_relay', 'ent_skateshop', 'ent_objective', 'ent_route',\ - 'ent_miniworld', 'ent_region', 'ent_glider', 'ent_list' ] + 'ent_miniworld', 'ent_region', 'ent_glider', 'ent_list',\ + 'ent_npc' ] def get_entity_enum_id( alias ): #{ @@ -302,6 +304,14 @@ class ent_glider(Structure):#{ 1: 'equip' } #} +class ent_npc(Structure):#{ + _fields_ = [("transform",mdl_transform), + ("id",c_uint32), + ("context",c_uint32), + ("camera",c_uint32)] + sr_functions = { 0: 'proximity', -1: 'leave' } +#} + class ent_water(Structure): #{ _fields_ = [("transform",mdl_transform), @@ -313,7 +323,7 @@ class ent_water(Structure): class volume_trigger(Structure): #{ _fields_ = [("event",c_uint32), - ("event_leave",c_uint32)] + ("event_leave",c_int32)] #} class volume_particles(Structure): @@ -523,7 +533,7 @@ class ent_objective(Structure):#{ ("id_next",c_uint32), ("filter",c_uint32),("filter2",c_uint32), ("id_win",c_uint32), - ("win_event",c_uint32), + ("win_event",c_int32), ("time_limit",c_float)] sr_functions = { 0: 'trigger', @@ -536,9 +546,9 @@ class ent_challenge(Structure):#{ ("pstr_alias",c_uint32), ("flags",c_uint32), ("target",c_uint32), - ("target_event",c_uint32), + ("target_event",c_int32), ("reset",c_uint32), - ("reset_event",c_uint32), + ("reset_event",c_int32), ("first",c_uint32), ("camera",c_uint32), ("status",c_uint32)] #runtime @@ -559,7 +569,7 @@ class ent_region(Structure):#{ class ent_relay(Structure):#{ _fields_ = [("targets",(c_uint32*2)*4), - ("targets_events",c_uint32*4)] + ("targets_events",c_int32*4)] sr_functions = { 0: 'trigger' } #} @@ -1913,10 +1923,7 @@ def sr_compile( collection ): if obj_data.target:#{ volume.target = sr_entity_id( obj_data.target ) volume._anon.trigger.event = obj_data.target_event - - ev = 0xffffffff if obj_data.target_event_leave < 0 else \ - obj_data.target_event_leave - volume._anon.trigger.event_leave = ev + volume._anon.trigger.event_leave = obj_data.target_event_leave #} sr_ent_push(volume) @@ -2067,6 +2074,15 @@ def sr_compile( collection ): compile_obj_transform( obj, glider.transform ) sr_ent_push( glider ) #} + elif ent_type == 'ent_npc':#{ + obj_data = obj.SR_data.ent_npc[0] + npc = ent_npc() + compile_obj_transform( obj, npc.transform ) + npc.id = obj_data.au + npc.context = obj_data.context + npc.camera = sr_entity_id( obj_data.cam ) + sr_ent_push( npc ) + #} elif ent_type == 'ent_cubemap':#{ cubemap = ent_cubemap() co = obj.matrix_world @ Vector((0,0,0)) @@ -3148,6 +3164,14 @@ class SR_OBJECT_ENT_GLIDER(bpy.types.PropertyGroup):#{ nothing: bpy.props.StringProperty() #} +class SR_OBJECT_ENT_NPC(bpy.types.PropertyGroup):#{ + au: bpy.props.IntProperty() + context: bpy.props.IntProperty() + cam: bpy.props.PointerProperty( \ + type=bpy.types.Object, name="Viewpoint", \ + poll=lambda self,obj: sr_filter_ent_type(obj,['ent_camera'])) +#} + class SR_OBJECT_ENT_VOLUME(bpy.types.PropertyGroup):#{ subtype: bpy.props.EnumProperty( name="Subtype", @@ -3651,6 +3675,7 @@ class SR_OBJECT_PROPERTIES(bpy.types.PropertyGroup): ent_miniworld: bpy.props.CollectionProperty(type=SR_OBJECT_ENT_MINIWORLD) ent_list: bpy.props.CollectionProperty(type=SR_OBJECT_ENT_LIST) ent_glider: bpy.props.CollectionProperty(type=SR_OBJECT_ENT_GLIDER) + ent_npc: bpy.props.CollectionProperty(type=SR_OBJECT_ENT_NPC) ent_type: bpy.props.EnumProperty( name="Type", @@ -4930,7 +4955,7 @@ classes = [ SR_INTERFACE, SR_MATERIAL_PANEL,\ SR_OBJECT_ENT_RELAY,SR_OBJECT_ENT_MINIWORLD,\ SR_OBJECT_ENT_LIST_ENTRY, SR_UL_ENT_LIST, SR_OBJECT_ENT_LIST, \ SR_OT_ENT_LIST_NEW_ITEM, SR_OT_ENT_LIST_DEL_ITEM,\ - SR_OBJECT_ENT_GLIDER, \ + SR_OBJECT_ENT_GLIDER, SR_OBJECT_ENT_NPC, \ \ SR_OBJECT_PROPERTIES, SR_LIGHT_PROPERTIES, SR_BONE_PROPERTIES, SR_MESH_PROPERTIES, SR_MATERIAL_PROPERTIES \