diff --git a/ballance_blender_plugin/add_floor.py b/ballance_blender_plugin/add_floor.py index f09e763..2d8cb32 100644 --- a/ballance_blender_plugin/add_floor.py +++ b/ballance_blender_plugin/add_floor.py @@ -204,12 +204,14 @@ def create_or_get_material(material_name): m.node_tree.links.new(inode.outputs[0],bnode.inputs[0]) # write custom property - # WARNING: this data is shared with BallanceVirtoolsPlugin - mapping_BM.cpp - fix_blender_texture - m['virtools-ambient'] = (0.0, 0.0, 0.0) - m['virtools-diffuse'] = (122 / 255.0, 122 / 255.0, 122 / 255.0) if material_name in config.floor_side_material_list else (1.0, 1.0, 1.0) - m['virtools-specular'] = (0.0, 0.0, 0.0) if material_name in config.floor_side_material_list else (80 / 255.0, 80 / 255.0, 80 / 255.0) - m['virtools-emissive'] = (104 / 255.0, 104 / 255.0, 104 / 255.0) if material_name in config.floor_side_material_list else (0.0, 0.0, 0.0) - m['virtools-power'] = 0.0 + for try_item in config.floor_material_statistic: + if material_name in try_item['member']: + m['virtools-ambient'] = try_item['data']['ambient'] + m['virtools-diffuse'] = try_item['data']['diffuse'] + m['virtools-specular'] = try_item['data']['specular'] + m['virtools-emissive'] = try_item['data']['emissive'] + m['virtools-power'] = try_item['data']['power'] + break return m diff --git a/ballance_blender_plugin/config.py b/ballance_blender_plugin/config.py index 39fd489..0c849b1 100644 --- a/ballance_blender_plugin/config.py +++ b/ballance_blender_plugin/config.py @@ -157,10 +157,62 @@ floor_texture_corresponding_map = { "BallStone": "Ball_Stone.bmp" } -floor_side_material_list = [ - "FloorSide", - "FloorTopBorder_ForSide", - "FloorTopBorderless_ForSide" +# WARNING: this data is shared with BallanceVirtoolsPlugin - mapping_BM.cpp - fix_blender_texture +floor_material_statistic = [ + { + "member": [ + "FloorSide", + "FloorTopBorder_ForSide", + "FloorTopBorderless_ForSide" + ], + "data": { + "ambient": (0, 0, 0), + "diffuse": (122 / 255.0, 122 / 255.0, 122 / 255.0), + "specular": (0.0, 0.0, 0.0), + "emissive": (104 / 255.0, 104 / 255.0, 104 / 255.0), + "power": 0 + } + }, + { + "member": [ + "FloorTopBorder", + "FloorTopBorderless", + "FloorTopFlat", + "FloorTopProfilFlat" + ], + "data": { + "ambient": (0, 0, 0), + "diffuse": (1.0, 1.0, 1.0), + "specular": (80 / 255.0, 80 / 255.0, 80 / 255.0), + "emissive": (0.0, 0.0, 0.0), + "power": 100 + } + }, + { + "member": [ + "BallPaper" + ], + "data": { + "ambient": (25 / 255.0, 25 / 255.0, 25 / 255.0), + "diffuse": (1.0, 1.0, 1.0), + "specular": (0.0, 0.0, 0.0), + "emissive": (100 / 255.0, 100 / 255.0, 100 / 255.0), + "power": 0 + } + }, + { + "member": [ + "BallStone", + "BallWood" + ], + "data": { + "ambient": (25 / 255.0, 25 / 255.0, 25 / 255.0), + "diffuse": (1.0, 1.0, 1.0), + "specular": (229 / 255.0, 229 / 255.0, 229 / 255.0), + "emissive": (60 / 255.0, 60 / 255.0, 60 / 255.0), + "power": 0 + } + } ] floor_block_dict = {}