Better collision flag export

This commit is contained in:
Phillip Stephens 2016-12-26 13:01:18 -08:00
parent f6b3a2aea8
commit e7eb961c04
1 changed files with 96 additions and 26 deletions

View File

@ -8,16 +8,24 @@ namespace DNAMP1
void DeafBabe::BlenderInit(hecl::BlenderConnection::PyOutStream& os) void DeafBabe::BlenderInit(hecl::BlenderConnection::PyOutStream& os)
{ {
os << "TYPE_COLORS = {'NoSFX':(0.0, 0.0, 0.0),\n" os << "TYPE_COLORS = {'NoSFX':(0.0, 0.0, 0.0),\n"
" 'Ground':(1.0, 0.43, 0.15),\n" " 'Stone':(1.0, 0.43, 0.15),\n"
" 'Wood':(0.305, 0.159, 0.033),\n"
" 'Stone':(0.28, 0.28, 0.28),\n"
" 'Ice':(0.0, 0.1, 0.1),\n"
" 'Metal':(0.5, 0.5, 0.5),\n" " 'Metal':(0.5, 0.5, 0.5),\n"
" 'Grass':(0.0, 0.42, 0.01)," " 'Grass':(0.0, 0.42, 0.01),"
" 'Lava':(0.8, 0.15, 0.0)," " 'Ice':(0.0, 0.1, 0.1),\n"
" 'Mud':(0.119, 0.056, 0.023)," " 'Metal Grating':(0.09, 0.09, 0.09),\n"
" 'Goo':(0.026, 0.467, 0.186)," " 'Phazon':(0.24, 0.0, 0.21),\n"
" 'Sand':(0.539, 0.445, 0.216)}\n" " 'Rock':(0.1, 0.07, 0.05),\n"
" 'Stone':(0.12, 0.12, 0.12),\n"
" 'Lava':(0.8, 0.15, 0.0),\n"
" 'Stone/Rock':(0.06, 0.05, 0.03),\n"
" 'Snow':(0.60, 0.74, 1.0),\n"
" 'Mud (Slow)':(0.12, 0.06, 0.02),\n"
" 'Mud':(0.12, 0.06, 0.02),\n"
" 'Glass':(0.27, 0.38, 0.9),\n"
" 'Shield':(1.0, 0.6, 0.0),\n"
" 'Sand':(0.53, 0.44, 0.21),\n"
" 'Wood':(0.30, 0.15, 0.03),\n"
" 'Organic':(0.19, 0.45, 0.2)}\n"
"\n" "\n"
"# Diffuse Color Maker\n" "# Diffuse Color Maker\n"
"def make_color(index, mat_type, name):\n" "def make_color(index, mat_type, name):\n"
@ -28,14 +36,36 @@ void DeafBabe::BlenderInit(hecl::BlenderConnection::PyOutStream& os)
" new_mat.diffuse_color.hsv = ((index / 6.0) % 1.0, 1.0-((index // 6) / 6.0), 1)\n" " new_mat.diffuse_color.hsv = ((index / 6.0) % 1.0, 1.0-((index // 6) / 6.0), 1)\n"
" return new_mat\n" " return new_mat\n"
"\n" "\n"
"bpy.types.Material.retro_collision_type = bpy.props.IntProperty(name='Retro: Collsion Type')\n" "bpy.types.Material.retro_u0 = bpy.props.BoolProperty(name='Retro u0')\n"
"bpy.types.Material.retro_projectile_passthrough = bpy.props.BoolProperty(name='Retro: Projectile Passthrough')\n" "bpy.types.Material.retro_surface_stone = bpy.props.BoolProperty(name='Retro Surface: Stone')\n"
"bpy.types.Material.retro_ai_passthrough = bpy.props.BoolProperty(name='Retro: AI Passthrough')\n" "bpy.types.Material.retro_surface_metal = bpy.props.BoolProperty(name='Retro Surface: Metal')\n"
"bpy.types.Material.retro_camera_passthrough = bpy.props.BoolProperty(name='Retro: Camera Passthrough')\n" "bpy.types.Material.retro_surface_grass = bpy.props.BoolProperty(name='Retro Surface: Grass')\n"
"bpy.types.Material.retro_surface_ice = bpy.props.BoolProperty(name='Retro Surface: Ice')\n"
"bpy.types.Material.retro_u5 = bpy.props.BoolProperty(name='Retro u5')\n"
"bpy.types.Material.retro_surface_metal_grating = bpy.props.BoolProperty(name='Retro Surface: Metal Grating')\n"
"bpy.types.Material.retro_surface_phazon = bpy.props.BoolProperty(name='Retro Surface: Phazon')\n"
"bpy.types.Material.retro_surface_rock = bpy.props.BoolProperty(name='Retro Surface: Rock')\n"
"bpy.types.Material.retro_surface_lava = bpy.props.BoolProperty(name='Retro Surface: Lava')\n"
"bpy.types.Material.retro_surface_stone_rock = bpy.props.BoolProperty(name='Retro Surface: Stone/Rock')\n"
"bpy.types.Material.retro_surface_snow = bpy.props.BoolProperty(name='Retro Surface: Snow')\n"
"bpy.types.Material.retro_surface_mud_slow = bpy.props.BoolProperty(name='Retro Surface: Mud (Slow)')\n"
"bpy.types.Material.retro_half_pipe = bpy.props.BoolProperty(name='Retro: Half Pipe')\n" "bpy.types.Material.retro_half_pipe = bpy.props.BoolProperty(name='Retro: Half Pipe')\n"
"bpy.types.Material.retro_surface_mud = bpy.props.BoolProperty(name='Retro Surface: Mud')\n"
"bpy.types.Material.retro_surface_glass = bpy.props.BoolProperty(name='Retro Surface: Glass')\n"
"bpy.types.Material.retro_surface_shield = bpy.props.BoolProperty(name='Retro Surface: Sheild')\n"
"bpy.types.Material.retro_surface_sand = bpy.props.BoolProperty(name='Retro Surface: Sand')\n"
"bpy.types.Material.retro_projectile_passthrough = bpy.props.BoolProperty(name='Retro: Projectile Passthrough')\n"
"bpy.types.Material.retro_solid = bpy.props.BoolProperty(name='Retro: Solid')\n" "bpy.types.Material.retro_solid = bpy.props.BoolProperty(name='Retro: Solid')\n"
"bpy.types.Material.retro_camera_passthrough = bpy.props.BoolProperty(name='Retro: Camera Passthrough')\n"
"bpy.types.Material.retro_surface_wood = bpy.props.BoolProperty(name='Retro Surface: Wood')\n"
"bpy.types.Material.retro_surface_organic = bpy.props.BoolProperty(name='Retro Surface: Organic')\n"
"bpy.types.Material.retro_ai_passthrough = bpy.props.BoolProperty(name='Retro: AI Passthrough')\n"
"bpy.types.Material.retro_u26 = bpy.props.BoolProperty(name='Retro: u26')\n"
"bpy.types.Material.retro_scan_passthrough = bpy.props.BoolProperty(name='Retro: Scan Passthrough')\n" "bpy.types.Material.retro_scan_passthrough = bpy.props.BoolProperty(name='Retro: Scan Passthrough')\n"
"bpy.types.Material.retro_no_walk = bpy.props.BoolProperty(name='Retro: No Walk')\n" "bpy.types.Material.retro_u28 = bpy.props.BoolProperty(name='Retro u28')\n"
"bpy.types.Material.retro_u29 = bpy.props.BoolProperty(name='Retro u28')\n"
"bpy.types.Material.retro_no_climb = bpy.props.BoolProperty(name='Retro: No Walk')\n"
"bpy.types.Material.retro_u31 = bpy.props.BoolProperty(name='Retro u31')\n"
"\n" "\n"
"material_dict = {}\n" "material_dict = {}\n"
"material_index = []\n" "material_index = []\n"
@ -55,24 +85,40 @@ void DeafBabe::BlenderInit(hecl::BlenderConnection::PyOutStream& os)
" mat_type = str(type_id)\n" " mat_type = str(type_id)\n"
" if type_id == 0:\n" " if type_id == 0:\n"
" mat_type = 'NoSFX'\n" " mat_type = 'NoSFX'\n"
" if type_id == 1 or type_id == 14 or type_id == 22 or type_id == 23:\n" " if type_id == 1:\n"
" mat_type = 'Ground'\n" " mat_type = 'Stone'\n"
" elif type_id == 2 or type_id == 6:\n" " elif type_id == 2:\n"
" mat_type = 'Metal'\n" " mat_type = 'Metal'\n"
" elif type_id == 3 or type_id == 8:\n" " elif type_id == 3:\n"
" mat_type = 'Grass'\n" " mat_type = 'Grass'\n"
" elif type_id == 4 or type_id == 11:\n" " elif type_id == 4:\n"
" mat_type = 'Ice'\n" " mat_type = 'Ice'\n"
" elif type_id == 12:\n" " elif type_id == 6:\n"
" mat_type = 'Mud'\n" " mat_type = 'Metal Grating'\n"
" elif type_id == 7:\n" " elif type_id == 7:\n"
" mat_type = 'Wood'\n" " mat_type = 'Phazon'\n"
" elif type_id == 9 or type_id == 10:\n" " elif type_id == 8:\n"
" mat_type = 'Rock'\n"
" elif type_id == 9:\n"
" mat_type = 'Lava'\n" " mat_type = 'Lava'\n"
" elif type_id == 15 or type_id == 16:\n" " elif type_id == 10:\n"
" mat_type = 'Goo'\n" " mat_type = 'Stone/Rock'\n"
" elif type_id == 11:\n"
" mat_type = 'Snow'\n"
" elif type_id == 12:\n"
" mat_type = 'Mud (Slow)'\n"
" elif type_id == 14:\n"
" mat_type = 'Mud'\n"
" elif type_id == 15:\n"
" mat_type = 'Glass'\n"
" elif type_id == 16:\n"
" mat_type = 'Shield'\n"
" elif type_id == 17:\n" " elif type_id == 17:\n"
" mat_type = 'Sand'\n" " mat_type = 'Sand'\n"
" elif type_id == 22:\n"
" mat_type = 'Wood'\n"
" elif type_id == 23:\n"
" mat_type = 'Organic'\n"
"\n" "\n"
" mat_flags = ''\n" " mat_flags = ''\n"
" if ((data >> 0) & 1):\n" " if ((data >> 0) & 1):\n"
@ -120,14 +166,38 @@ void DeafBabe::BlenderInit(hecl::BlenderConnection::PyOutStream& os)
" return len(material_index)-1\n" " return len(material_index)-1\n"
" else:\n" " else:\n"
" mat = make_color(len(material_dict), mat_type, mat_name)\n" " mat = make_color(len(material_dict), mat_type, mat_name)\n"
" mat.retro_collision_type = type_id\n" " mat.diffuse_intensity = 1.0\n"
" mat.specular_intensity = 0.0\n"
" mat.retro_u0 = ((data >> 0) & 1)\n"
" mat.retro_surface_stone = ((data >> 1) & 1)\n"
" mat.retro_surface_metal = ((data >> 2) & 1)\n"
" mat.retro_surface_grass = ((data >> 3) & 1) \n"
" mat.retro_surface_ice = ((data >> 4) & 1)\n"
" mat.retro_u5 = ((data >> 5) & 1)\n"
" mat.retro_surface_metal_grating = ((data >> 6) & 1)\n"
" mat.retro_surface_phazon = ((data >> 7) & 1)\n"
" mat.retro_surface_rock = ((data >> 8) & 1)\n"
" mat.retro_surface_lava = ((data >> 9) & 1)\n"
" mat.retro_surface_stone_rock = ((data >> 10) & 1)\n"
" mat.retro_surface_snow = ((data >> 11) & 1)\n"
" mat.retro_surface_mud_slow = ((data >> 12) & 1)\n"
" mat.retro_half_pipe = ((data >> 13) & 1)\n" " mat.retro_half_pipe = ((data >> 13) & 1)\n"
" mat.retro_surface_mud = ((data >> 14) & 1)\n"
" mat.retro_surface_glass = ((data >> 15) & 1)\n"
" mat.retro_surface_shield = ((data >> 16) & 1)\n"
" mat.retro_surface_sand = ((data >> 17) & 1)\n"
" mat.retro_projectile_passthrough = ((data >> 18) & 1)\n" " mat.retro_projectile_passthrough = ((data >> 18) & 1)\n"
" mat.retro_solid = ((data >> 19) & 1)\n" " mat.retro_solid = ((data >> 19) & 1)\n"
" mat.retro_camera_passthrough = ((data >> 21) & 1)\n" " mat.retro_camera_passthrough = ((data >> 21) & 1)\n"
" mat.retro_surface_wood = ((data >> 22) & 1)\n"
" mat.retro_surface_organic = ((data >> 23) & 1)\n"
" mat.retro_ai_passthrough = ((data >> 24) & 1)\n" " mat.retro_ai_passthrough = ((data >> 24) & 1)\n"
" mat.retro_u26 = ((data >> 26) & 1)\n"
" mat.retro_scan_passthrough = ((data >> 27) & 1)\n" " mat.retro_scan_passthrough = ((data >> 27) & 1)\n"
" mat.retro_no_walk = ((data >> 30) & 1)\n" " mat.retro_u28 = ((data >> 28) & 1)\n"
" mat.retro_u29 = ((data >> 29) & 1)\n"
" mat.retro_no_climb = ((data >> 30) & 1)\n"
" mat.retro_u31 = ((data >> 31) & 1)\n"
" material_dict[mat_name] = mat\n" " material_dict[mat_name] = mat\n"
" material_index.append(mat_name)\n" " material_index.append(mat_name)\n"
" return len(material_index)-1\n" " return len(material_index)-1\n"