a mess but stable
[carveJwlIkooP6JGAAIwe30JlM.git] / skaterift_blender / sr_main.py
index 1f4910bef8aef8ef960f6d66416fdcb126c7d5b7..e4ba4d99d69eb65e91fb36f4f453dccf20e887c9 100644 (file)
@@ -9,18 +9,6 @@ from gpu_extras.batch import batch_for_shader
 from bpy_extras import mesh_utils
 from bpy_extras import view3d_utils
 
-bl_info = {
-   "name":"Skaterift .mdl exporter",
-   "author": "Harry Godden (hgn)",
-   "version": (0,2),
-   "blender":(3,1,0),
-   "location":"Export",
-   "description":"",
-   "warning":"",
-   "wiki_url":"",
-   "category":"Import/Export",
-}
-
 sr_entity_list = [
    ('none',             'None',           '', 0  ),
    ('ent_gate',         'Gate',           '', 1  ),
@@ -55,7 +43,7 @@ MDL_VERSION_NR = 106
 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_npc' ]
+                   'ent_npc', 'ent_water' ]
 
 def get_entity_enum_id( alias ):
 #{
@@ -338,6 +326,7 @@ class ent_water(Structure):
                ("max_dist",c_float),
                ("reserved0",c_uint32),
                ("reserved1",c_uint32)]
+   sr_functions = { 0: "drown" }
 #}
 
 class volume_trigger(Structure):
@@ -1781,6 +1770,9 @@ def sr_compile( collection ):
             else:
                worldinfo.timezone = obj_data.timezone
 
+            if obj_data.water_safe:
+               flags |= 0x2
+
             worldinfo.flags = flags
             worldinfo.pstr_skybox = sr_compile_string( obj_data.skybox )
             sr_ent_push( worldinfo )
@@ -3316,8 +3308,11 @@ class SR_OBJECT_ENT_WORLD_INFO(bpy.types.PropertyGroup):
    timezone: bpy.props.FloatProperty(name="Timezone(hrs) (UTC0 +hrs)")
    fixed_time: bpy.props.FloatProperty(name="Fixed Time (0-1)")
 
+   water_safe: bpy.props.BoolProperty(name="Water is Safe")
+
    @staticmethod
-   def sr_inspector( layout, data ):#{
+   def sr_inspector( layout, data ):
+   #{
       layout.prop( data[0], 'name' )
       layout.prop( data[0], 'desc' )
       layout.prop( data[0], 'author' )
@@ -3327,6 +3322,8 @@ class SR_OBJECT_ENT_WORLD_INFO(bpy.types.PropertyGroup):
          layout.prop( data[0], 'fixed_time' )
       else:
          layout.prop( data[0], 'timezone' )
+
+      layout.prop( data[0], 'water_safe' )
    #}
 #}
 
@@ -3604,8 +3601,8 @@ class SR_MATERIAL_PROPERTIES(bpy.types.PropertyGroup):
    sand_colour: bpy.props.FloatVectorProperty( \
          name="Sand Colour",\
          subtype='COLOR',\
-         min=0.0,max=1.0,\
-         default=Vector((0.79,0.63,0.48)),\
+         min=0.0,max=1.0,size=4,\
+         default=Vector((0.79,0.63,0.48,1.0)),\
          description="Blend to this colour near the 0 coordinate on UP axis"\
    )
    shore_colour: bpy.props.FloatVectorProperty( \