PC controls for skids
[carveJwlIkooP6JGAAIwe30JlM.git] / blender_export.py
index 168f023d71f6c65c3009adec6edb046a62391603..e9b7a1e46d8d7c9ceb6b4cdb70e22baaf6ca178e 100644 (file)
@@ -484,7 +484,8 @@ class ent_worldinfo(Structure):
                ("pstr_author",c_uint32),    # unused
                ("pstr_desc",c_uint32),      # unused
                ("timezone",c_float),
-               ("pstr_skybox",c_uint32)]
+               ("pstr_skybox",c_uint32),
+               ("flags",c_uint32)]
 #}
 
 class ent_ccmd(Structure):
@@ -562,7 +563,8 @@ class ent_prop(Structure):#{
    _fields_ = [("transform",mdl_transform),
                ("submesh_start",c_uint32),
                ("submesh_count",c_uint32),
-               ("flags",c_uint32)]
+               ("flags",c_uint32),
+               ("pstr_alias",c_uint32)]
 #}
 
 def obj_ent_type( obj ):
@@ -870,6 +872,7 @@ def sr_compile_material( mat ):#{
 
    if mat.SR_data.shader == 'standard': m.shader = 0
    if mat.SR_data.shader == 'standard_cutout': m.shader = 1
+   if mat.SR_data.shader == 'foliage': m.shader = 10
    if mat.SR_data.shader == 'terrain_blend':#{
       m.shader = 2
 
@@ -929,7 +932,8 @@ def sr_compile_material( mat ):#{
    #}
    
    if mat.SR_data.shader in ['standard', 'standard_cutout', 'terrain_blend', \
-                             'vertex_blend', 'fxglow', 'cubemap' ]: #{
+                             'vertex_blend', 'fxglow', 'cubemap', \
+                             'foliage' ]: #{
       if 'tex_diffuse' in inf: 
          m.tex_diffuse = sr_compile_texture(inf['tex_diffuse'])
    #}
@@ -1716,7 +1720,7 @@ def sr_compile( collection ):
          #}
          #--------------------------
 
-         print( F'[SR] {i: 3}/{mesh_count} {obj.name:<40}', end='\r' )
+         print( F'[SR] {i: 3}/{mesh_count} {obj.name:<40}' )
          sr_compile_mesh( obj )
       #}
    #}
@@ -1936,7 +1940,17 @@ def sr_compile( collection ):
             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
+
+            flags = 0x00
+
+            if obj_data.fix_time:#{
+               worldinfo.timezone = obj_data.fixed_time
+               flags |= 0x1
+            #}
+            else:
+               worldinfo.timezone = obj_data.timezone
+
+            worldinfo.flags = flags
             worldinfo.pstr_skybox = sr_compile_string( obj_data.skybox )
             sr_ent_push( worldinfo )
          #}
@@ -2023,10 +2037,12 @@ def sr_compile( collection ):
          #}
          elif ent_type == 'ent_prop':#{
             prop = ent_prop()
+            obj_data = obj.SR_data.ent_prop[0]
             compile_obj_transform( obj, prop.transform )
             prop.submesh_start, prop.submesh_count, _ = \
                   sr_compile_mesh_internal( obj )
-            prop.flags = 0
+            prop.flags = obj_data.flags
+            prop.pstr_alias = sr_compile_string( obj_data.alias )
             sr_ent_push( prop )
          #}
       #}
@@ -3204,6 +3220,7 @@ class SR_OBJECT_ENT_AUDIO(bpy.types.PropertyGroup):
 class SR_OBJECT_ENT_MARKER(bpy.types.PropertyGroup):
 #{
    alias: bpy.props.StringProperty()
+   flags: bpy.props.IntProperty()
 #}
 
 class SR_OBJECT_ENT_GLYPH(bpy.types.PropertyGroup):
@@ -3411,8 +3428,24 @@ 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)")
    skybox: bpy.props.StringProperty(name="Skybox")
+
+   fix_time: bpy.props.BoolProperty(name="Fix Time")
+   timezone: bpy.props.FloatProperty(name="Timezone(hrs) (UTC0 +hrs)")
+   fixed_time: bpy.props.FloatProperty(name="Fixed Time (0-1)")
+
+   @staticmethod
+   def sr_inspector( layout, data ):#{
+      layout.prop( data[0], 'name' )
+      layout.prop( data[0], 'desc' )
+      layout.prop( data[0], 'author' )
+
+      layout.prop( data[0], 'fix_time' )
+      if data[0].fix_time:
+         layout.prop( data[0], 'fixed_time' )
+      else:
+         layout.prop( data[0], 'timezone' )
+   #}
 #}
 
 class SR_OBJECT_ENT_CCMD(bpy.types.PropertyGroup):
@@ -3531,6 +3564,7 @@ class SR_OBJECT_PROPERTIES(bpy.types.PropertyGroup):
    ent_volume: bpy.props.CollectionProperty(type=SR_OBJECT_ENT_VOLUME)
    ent_audio: bpy.props.CollectionProperty(type=SR_OBJECT_ENT_AUDIO)
    ent_marker: bpy.props.CollectionProperty(type=SR_OBJECT_ENT_MARKER)
+   ent_prop: bpy.props.CollectionProperty(type=SR_OBJECT_ENT_MARKER)
    ent_glyph: bpy.props.CollectionProperty(type=SR_OBJECT_ENT_GLYPH)
    ent_font: bpy.props.CollectionProperty(type=SR_OBJECT_ENT_FONT)
    ent_traffic: bpy.props.CollectionProperty(type=SR_OBJECT_ENT_TRAFFIC)
@@ -3623,7 +3657,8 @@ class SR_MATERIAL_PROPERTIES(bpy.types.PropertyGroup):
       ('boundary','Boundary',''),
       ('fxglow','FX Glow',''),
       ('cubemap','Cubemap',''),
-      ('walking','Walking','')
+      ('walking','Walking',''),
+      ('foliage','Foliage','')
       ])
 
    surface_prop: bpy.props.EnumProperty(