import bpy import struct import math from bpy_extras.io_utils import ImportHelper from bpy.props import StringProperty from bpy.types import Operator bl_info = { "name": "Persona2 PSX Scene Collisions Importer", "author": "Sergey Shemet", "version": (1, 0), "blender": (4, 5, 0), "location": "File > Import", "description": "Imports Persona 2 Eternal Punishment PSX 3D scenes Collisions (.p2coll)", "category": "Import-Export", } class P2CollisionImporter(Operator, ImportHelper): """Import Persona 2 PSX Collisions""" bl_idname = "import_scene.p2coll" bl_label = "Import P2Coll" bl_options = {'PRESET', 'UNDO'} filename_ext = ".p2coll" filter_glob: StringProperty( default="*.p2coll", options={'HIDDEN'}, ) def execute(self, context): return read_p2coll_file(context, self.filepath) def create_cylinder_at_location(location, radius, height, vertices=16, name="cylinder"): """Создает цилиндр с заданными параметрами в указанной позиции""" # Создаем цилиндр bpy.ops.mesh.primitive_cylinder_add( vertices=vertices, radius=radius, depth=height, location=location ) # Получаем созданный объект cylinder = context.active_object cylinder.name = name return cylinder def read_p2coll_file(context, filepath): """Чтение файла .p2coll и создание объектов в Blender""" with open(filepath, 'rb') as file: # Чтение всего файла data = file.read() # Чтение блоков из заголовка # Первый блок: vertexMap vertex_map_size = struct.unpack_from('