Skip to content
The Chat Archive
gpt-4o-mini-2024-07-18· OpenAI WildChat-4.8M (AI2)

привет ,аддон для блендер 3.3.0, не говори пока ничего: blinfo = { "name": "F1 Track…

  1. User

    привет ,аддон для блендер 3.3.0, не говори пока ничего:

    bl_info = { "name": "F1 Track Data Editor", "author": "AlonsoBeast", "version": (1, 0), "blender": (3, 3, 0), "location": "View3D > Sidebar > F1 Track Builder Toolkit", "description": "Make prepare data to import in database file", "category": "3D View", }

    import bpy import xml.etree.ElementTree as ET from bpy_extras.io_utils import ExportHelper

    TRACK_OPTIONS = [ ("FULL LIST ID's","SHOW FULL LIST RESERVED TRACK ID's", ""), ("79", "ID 79 / frontend_track / RESERVED", ""), ("82", "ID 82 / Spa_Francorchamps / RESERVED", ""), ("83", "ID 83 / monza / RESERVED", ""), ("84", "ID 84 / catalunya / RESERVED", ""), ("85", "ID 85 / hungaroring / RESERVED", ""), ("86", "ID 86 / Abu_Dhabi / RESERVED", ""), ("87", "ID 87 / Bahrain / RESERVED", ""), ("88", "ID 88 / Brazil / RESERVED", ""), ("89", "ID 89 / Hockenheim / RESERVED", ""), ("90", "ID 90 / Istanbul / RESERVED", ""), ("91", "ID 91 / Melbourne / RESERVED", ""), ("92", "ID 92 / Monaco / RESERVED", ""), ("93", "ID 93 / Montreal / RESERVED", ""), ("95", "ID 95 / nurburgring / RESERVED", ""), ("96", "ID 96 / Sepang / RESERVED", ""), ("97", "ID 97 / Shanghai / RESERVED", ""), ("98", "ID 98 / Singapore / RESERVED", ""), ("99", "ID 99 / Suzuka / RESERVED", ""), ("100", "ID 100 / Valencia / RESERVED", ""), ("101", "ID 101 / Silverstone / RESERVED", ""), ("102", "ID 102 / Korea / RESERVED", ""), ("103", "ID 103 / Delhi / RESERVED", ""), ("104", "ID 104 / Texas / RESERVED", ""), ("105", "ID 105 / Jerez / RESERVED", ""), ("110", "ID 110 / Brands / RESERVED", ""), ("111", "ID 111 / Austria / RESERVED", ""), ("112", "ID 112 / Sochi / RESERVED", ""), ("113", "ID 113 / Imola / RESERVED", ""), ("114", "ID 114 / Estoril / RESERVED", ""), ("115", "ID 115 / Baku / RESERVED", ""), ("116", "ID 116 / Qatar / RESERVED", ""), ("117", "ID 117 / Miami / RESERVED", ""), ("118", "ID 118 / Mexico / RESERVED", ""), ("119", "ID 119 / Jeddah / RESERVED", ""), ("120", "ID 120 / Vegas / RESERVED", ""), ("121", "ID 121 / Zandvoort / RESERVED", ""), ("122", "ID 122 / Paul_ricard / RESERVED", ""), ("123", "ID 123 / Mugello / RESERVED", ""), ("124", "ID 124 / Portimao / RESERVED", ""), ]

    MODEL_ID_OPTIONS = [ ("FULL LIST ID's","SHOW FULL LIST RESERVED MODEL ID's", ""), ("44", "ID 44 / garage_01_00 / RESERVED", ""), ("118", "ID 118 / skipfe / RESERVED", ""), ("119", "ID 119 / garage_01_01 / RESERVED", ""), ("176", "ID 176 / Spa Francorchamps / RESERVED", ""), ("179", "ID 179 / Monza / RESERVED", ""), ("180", "ID 180 / Circuit de Catalunya / RESERVED", ""), ("181", "ID 181 / Hungaroring / RESERVED", ""), ("184", "ID 184 / Yas Marina Circuit / RESERVED", ""), ("185", "ID 185 / Bahrain International Circuit / RESERVED", ""), ("186", "ID 186 / Autodromo Jose Carlos Pace / RESERVED", ""), ("188", "ID 188 / Istanbul / RESERVED", ""), ("189", "ID 189 / Melbourne / RESERVED", ""), ("190", "ID 190 / Monaco / RESERVED", ""), ("191", "ID 191 / Montreal / RESERVED", ""), ("193", "ID 193 / Sepang / RESERVED", ""), ("194", "ID 194 / Shanghai / RESERVED", ""), ("195", "ID 195 / Singapore / RESERVED", ""), ("196", "ID 196 / Suzuka / RESERVED", ""), ("197", "ID 197 / Valencia / RESERVED", ""), ("199", "ID 199 / RESERVED", ""), ("201", "ID 201 / Silverstone / RESERVED", ""), ("202", "ID 202 / Korea / RESERVED", ""), ("205", "ID 205 / Nurburgring / RESERVED", ""), ("208", "ID 208 / Delhi / RESERVED", ""), ("212", "ID 212 / Hockenheim / RESERVED", ""), ("213", "ID 213 / Texas / RESERVED", ""), ("216", "ID 216 / Jerez / RESERVED", ""), ("219", "ID 219 / Brands Hatch / RESERVED", ""), ("220", "ID 220 / Austria / RESERVED", ""), ("221", "ID 221 / Sochi / RESERVED", ""), ("222", "ID 222 / Imola / RESERVED", ""), ("223", "ID 223 / Estoril / RESERVED", ""), ("224", "ID 224 / Baku / RESERVED", ""), ("225", "ID 225 / Miami / RESERVED", ""), ("226", "ID 226 / Qatar / RESERVED", ""), ("227", "ID 227 / Jeddah / RESERVED", ""), ("228", "ID 228 / Mexico / RESERVED", ""), ("229", "ID 229 / Las Vegas / RESERVED", ""), ("230", "ID 230 / Zandvoort / RESERVED", ""), ("231", "ID 231 / Paul Ricard / RESERVED", ""), ("232", "ID 232 / Mugello / RESERVED", ""), ("233", "ID 233 / Portimão, Algarve / RESERVED", ""), ]

    FUEL_RESERVED_OPTIONS = [ ("FULL LIST ID's","SHOW FULL LIST RESERVED FUEL ID's", ""), ("1", "ID 1 / spa_francorchamps / RESERVED", ""), ("2", "ID 2 / monza / RESERVED", ""), ("3", "ID 3 / catalunya / RESERVED", ""), ("4", "ID 4 / hungaroring / RESERVED", ""), ("5", "ID 5 / abu_dhabi / RESERVED", ""), ("6", "ID 6 / brazil / RESERVED", ""), ("7", "ID 7 / istanbul / RESERVED", ""), ("8", "ID 8 / melbourne / RESERVED", ""), ("9", "ID 9 / monaco / RESERVED", ""), ("10", "ID 10 / montreal / RESERVED", ""), ("11", "ID 11 / sepang / RESERVED", ""), ("12", "ID 12 / shanghai / RESERVED", ""), ("13", "ID 13 / singapore / RESERVED", ""), ("14", "ID 14 / suzuka / RESERVED", ""), ("15", "ID 15 / valencia / RESERVED", ""), ("16", "ID 16 / silverstone / RESERVED", ""), ("17", "ID 17 / korea / RESERVED", ""), ("18", "ID 18 / nurburgring / RESERVED", ""), ("19", "ID 19 / delhi / RESERVED", ""), ("20", "ID 20 / hockenheim / RESERVED", ""), ("21", "ID 21 / texas / RESERVED", ""), ("22", "ID 22 / bahrain / RESERVED", ""), ("23", "ID 23 / jerez / RESERVED", ""), ("24", "ID 24 / estoril / RESERVED", ""), ("25", "ID 25 / imola / RESERVED", ""), ("26", "ID 26 / brands / RESERVED", ""), ("27", "ID 27 / austria / RESERVED", ""), ("28", "ID 28 / sochi / RESERVED", ""), ("29", "ID 29 / qatar / RESERVED", ""), ("30", "ID 30 / miami / RESERVED", ""), ("31", "ID 31 / baku / RESERVED", ""), ("32", "ID 32 / jeddah / RESERVED", ""), ("33", "ID 33 / mexico / RESERVED", ""), ("34", "ID 34 / vegas / RESERVED", ""), ("35", "ID 35 / zandvoort / RESERVED", ""), ("36", "ID 36 / paul_ricard / RESERVED", ""), ("37", "ID 37 / mugello / RESERVED", ""), ("38", "ID 38 / portimao / RESERVED", ""), ]

    PRIME_TYRE_OPTIONS = [ ("2", "2 / Soft", "Soft tyre type"), ("3", "3 / Medium", "Medium tyre type"), ("4", "4 / Hard", "Hard tyre type"), ]

    OPTION_TYRE_OPTIONS = [ ("1", "1 / Soft", "Soft tyre type"), ("2", "2 / Medium", "Medium tyre type"), ("3", "3 / Hard", "Hard tyre type"), ]

    def get_track_id_options(self, context): return TRACK_OPTIONS

    def get_model_id_options(self, context): return MODEL_ID_OPTIONS

    def get_fuel_reserved_options(self, context): return FUEL_RESERVED_OPTIONS

    def get_prime_tyre_options(self, context): return PRIME_TYRE_OPTIONS

    def get_option_tyre_options(self, context): return OPTION_TYRE_OPTIONS

    def update_option_tyre(self, context): """Обновляет prime_tyre, когда меняется option_tyre""" option_value = int(self.option_tyre) prime_value = option_value + 1 if prime_value in [2, 3, 4]:
    self.prime_tyre = str(prime_value)

    def update_prime_tyre(self, context): """Обновляет option_tyre, когда меняется prime_tyre""" prime_value = int(self.prime_tyre) option_value = prime_value - 1 if option_value in [1, 2, 3]:
    self.option_tyre = str(option_value)

    XML_DATA = '''

    def load_xml_data(): tree = ET.ElementTree(ET.fromstring(XML_DATA)) return tree.getroot()

    def update_scene_properties(context): root = load_xml_data()

    context.scene.track_id = root.find('.//track/id').text
    context.scene.name_string_id = root.find('.//track/name_string_id').text
    context.scene.nationality_id = root.find('.//track/nationality_id').text
    context.scene.carhandling_id = root.find('.//track_car_handling/ID').text
    context.scene.carhandling_track = root.find('.//track_car_handling/Track').text  
    context.scene.fuel_id = root.find('.//track_fuel_distance/ID').text
    context.scene.model_id = root.find('.//track_model/id').text
    context.scene.model_leaderboard_id = root.find('.//track_model/leaderboard_id').text
    context.scene.model_calender_glyph = root.find('.//track_model/calender_glyph').text
    context.scene.model_calendar_glyph = root.find('.//track_model/calendar_glyph').text
    context.scene.model_track_id = root.find('.//track_model/track_id').text
    context.scene.difficulty_id = root.find('.//track_difficulties/ID').text
    context.scene.difficulty_track = root.find('.//track_difficulties/track').text
    context.scene.selected_season = root.find('.//track_model/season').text
    context.scene.medium_event_name = root.find('.//track_model/medium_event_name').text
    context.scene.long_event_name = root.find('.//track_model/long_event_name').text
    context.scene.long_track_name = root.find('.//track_model/long_track_name').text
    context.scene.short_event_name = root.find('.//track_model/short_event_name').text
    context.scene.track_name = root.find('.//track_car_handling/Track').text  
    context.scene.track_description = root.find('.//track_model/track_description').text
    context.scene.fullcareer_order = root.find('.//track_model/fullcareer_order').text
    context.scene.num_laps = root.find('.//track_model/num_laps').text
    context.scene.gp_mode_round_number = root.find('.//track_model/gp_mode_round_number').text
    context.scene.main_career_round_number = root.find('.//track_model/main_career_round_number').text
    context.scene.prime_tyre = root.find('.//track_model/prime_tyre').text
    context.scene.option_tyre = root.find('.//track_model/option_tyre').text
    

    class F1TrackBuilderPanel(bpy.types.Panel): bl_label = "F1 Track Data Editor" bl_idname = "VIEW3D_PT_f1_track_builder" bl_space_type = 'VIEW_3D' bl_region_type = 'UI' bl_category = 'F1 Track DataEditor'

    def draw(self, context):
        layout = self.layout
        layout.label(text="Track Name (lowercase only):")
        row = layout.row(align=True)
        row.prop(context.scene, 'track_name', text="", icon='TEXT')
    
        row = layout.row()
        row.operator("f1trackbuilder.rename_track", text="Rename Track")
    
        layout.label(text="Click Load Data Reference to show an example strings.")
        
        row = layout.row(align=True)
        row.prop(context.scene, 'track_id', text="Track ID Unique")
        row = layout.row(align=True)
        row.prop(context.scene, 'reserved_id_list', text="") 
        row = layout.row(align=True)
        row.prop(context.scene, 'model_id', text="Model ID Unique")
        row = layout.row(align=True)
        row.prop(context.scene, 'model_id_enum', text="")
        row = layout.row(align=True)
        row.prop(context.scene, 'short_event_name', text="Short Event Name")
        row = layout.row(align=True)
        row.prop(context.scene, 'long_track_name', text="Long Track Name")
        row = layout.row(align=True)
        row.prop(context.scene, 'long_event_name', text="Long Event Name")
        row = layout.row(align=True)
        row.prop(context.scene, 'medium_event_name', text="Medium Event Name")
        row = layout.row(align=True)
        row.prop(context.scene, 'fullcareer_order', text="Menu Card Order")
        row = layout.row(align=True)
        row.prop(context.scene, 'num_laps', text="Total Laps")
        row = layout.row(align=True)
        row.prop(context.scene, 'option_tyre', text="Option Tyre")
        row = layout.row(align=True)
        row.prop(context.scene, 'prime_tyre', text="Prime Tyre")
        row = layout.row(align=True)
        row.prop(context.scene, 'gp_mode_round_number', text="F1 2013 GP Menu Order")
        row = layout.row(align=True)
        row.prop(context.scene, 'main_career_round_number', text="F1 2013 Career Order")
        row = layout.row(align=True)
        row.prop(context.scene, 'track_description', text="Mod Author")
    
        layout.operator("f1trackbuilder.update_props", text="Load Data Reference")
        layout.operator("f1trackbuilder.export_xml", text="Export Data Track XML")
    

    class RenameTrackOperator(bpy.types.Operator): bl_idname = "f1trackbuilder.rename_track" bl_label = "Rename Track"

    def execute(self, context):
        old_name = "baku"  
        new_name = context.scene.track_name
        
    
        if not new_name.islower():
            self.report({'ERROR'}, "Track name must be in lowercase only!")
            return {'CANCELLED'}
    
    
        new_name = new_name.replace(" ", "_")
        
    
        if not new_name:
            self.report({'ERROR'}, "Track name cannot be empty or consist only of spaces!")
            return {'CANCELLED'}
    
        self.report({'INFO'}, f"Will replace '{old_name}' with '{new_name}' in the XML.")
        context.scene.track_name = new_name 
    
        return {'FINISHED'}
    

    class UpdateScenePropertiesOperator(bpy.types.Operator): bl_idname = "f1trackbuilder.update_props" bl_label = "Update Scene Properties"

    def execute(self, context):
        update_scene_properties(context)
        self.report({'INFO'}, "Data was updated")
        return {'FINISHED'}
    

    class ExportXML(bpy.types.Operator, ExportHelper): bl_idname = "f1trackbuilder.export_xml" bl_label = "Export XML"

    filename_ext = ".xml"
    filter_glob: bpy.props.StringProperty(
        default="*.xml",
        options={'HIDDEN'},
        maxlen=255,
    )
    
    def execute(self, context):
    
        root = ET.fromstring(XML_DATA)
    
    
        track_id_value = context.scene.track_id
    
    
        for elem in root.iter():
            if elem.text:
          
                elem.text = elem.text.replace("baku", context.scene.track_name).replace("Baku", context.scene.track_name.capitalize())
    
        
                if elem.tag == "track":
                    id_elem = elem.find("id")
                    if id_elem is not None:
                        id_elem.text = track_id_value  
                    name_string_id_elem = elem.find("name_string_id")
                    if name_string_id_elem is not None:
                        name_string_id_elem.text = context.scene.name_string_id
                    nationality_id_elem = elem.find("nationality_id")
                    if nationality_id_elem is not None:
                        nationality_id_elem.text = context.scene.nationality_id
    
                elif elem.tag == "track_car_handling":
                    car_handling_id_elem = elem.find("ID")
                    if car_handling_id_elem is not None:
                        car_handling_id_elem.text = context.scene.carhandling_id
                    track_elem = elem.find("Track")
                    if track_elem is not None:
                        track_elem.text = context.scene.carhandling_track
    
                elif elem.tag == "track_fuel_distance":
                    id_elem = elem.find("ID")
                    if id_elem is not None:
                        id_elem.text = context.scene.fuel_id
    
                elif elem.tag == "track_model":
                    id_elem = elem.find("id")
                    if id_elem is not None:
                        id_elem.text = context.scene.model_id
                    leaderboard_id_elem = elem.find("leaderboard_id")
                    if leaderboard_id_elem is not None:
                        leaderboard_id_elem.text = context.scene.model_leaderboard_id
                    calendar_glyph_elem = elem.find("calender_glyph")
                    if calendar_glyph_elem is not None:
                        calendar_glyph_elem.text = context.scene.model_calender_glyph
                    city_glyph_elem = elem.find("calendar_glyph")
                    if city_glyph_elem is not None:
                        city_glyph_elem.text = context.scene.model_calendar_glyph
                    trackid_glyph_elem = elem.find("track_id")
                    if trackid_glyph_elem is not None:
                        trackid_glyph_elem.text = track_id_value  
                 
                    fullcareer_elem = elem.find("fullcareer_order")
                    if fullcareer_elem is not None:
                        fullcareer_elem.text = context.scene.fullcareer_order
                    num_laps_elem = elem.find("num_laps")
                    if num_laps_elem is not None:
                        num_laps_elem.text = context.scene.num_laps
                    gp_mode_elem = elem.find("gp_mode_round_number")
                    if gp_mode_elem is not None:
                        gp_mode_elem.text = context.scene.gp_mode_round_number
                    main_career_elem = elem.find("main_career_round_number")
                    if main_career_elem is not None:
                        main_career_elem.text = context.scene.main_career_round_number
                    track_desc_elem = elem.find("track_description")
                    if track_desc_elem is not None:
                        track_desc_elem.text = context.scene.track_description
                    prime_tyre_elem = elem.find("prime_tyre")
                    if prime_tyre_elem is not None:
                        prime_tyre_elem.text = context.scene.prime_tyre
                    option_tyre_elem = elem.find("option_tyre")
                    if option_tyre_elem is not None:
                        option_tyre_elem.text = context.scene.option_tyre                        
    
                
                    medium_event_elem = elem.find("medium_event_name")
                    if medium_event_elem is not None:
                        medium_event_elem.text = context.scene.medium_event_name
                    long_event_elem = elem.find("long_event_name")
                    if long_event_elem is not None:
                        long_event_elem.text = context.scene.long_event_name
                    long_track_elem = elem.find("long_track_name")
                    if long_track_elem is not None:
                        long_track_elem.text = context.scene.long_track_name
                    short_event_elem = elem.find("short_event_name")
                    if short_event_elem is not None:
                        short_event_elem.text = context.scene.short_event_name
    
                elif elem.tag == "track_difficulties":
                    id_elem = elem.find("ID")
                    if id_elem is not None:
                        id_elem.text = context.scene.difficulty_id
                    track_elem = elem.find("track")
                    if track_elem is not None:
                        track_elem.text = track_id_value  
    
            
                if elem.tag == "track_model":
                    season_elem = elem.find("season")
                    if season_elem is not None:
                        season_elem.text = context.scene.selected_season
    
    
        tree = ET.ElementTree(root)
        tree.write(self.filepath, encoding='utf-8', xml_declaration=True)
    
        self.report({'INFO'}, f"Save as {self.filepath}")
        return {'FINISHED'}
    

    def register(): bpy.utils.register_class(F1TrackBuilderPanel) bpy.utils.register_class(UpdateScenePropertiesOperator) bpy.utils.register_class(ExportXML) bpy.utils.register_class(RenameTrackOperator)

    bpy.types.Scene.track_id = bpy.props.StringProperty(name="Track ID Unique")
    bpy.types.Scene.name_string_id = bpy.props.StringProperty(name="Name String ID")
    bpy.types.Scene.nationality_id = bpy.props.StringProperty(name="Nationality ID")
    bpy.types.Scene.carhandling_id = bpy.props.StringProperty(name="Car Handling ID")
    bpy.types.Scene.carhandling_track = bpy.props.StringProperty(name="Car Handling Track")  
    bpy.types.Scene.model_id_enum = bpy.props.EnumProperty(
        name="Model ID Reserved",
        description="Select a Reserved Model ID",
        items=MODEL_ID_OPTIONS
    )
    bpy.types.Scene.fuel_reserved = bpy.props.EnumProperty(
        name="Fuel ID Reserved",
        description="Select a Reserved Fuel ID",
        items=FUEL_RESERVED_OPTIONS
    )
    bpy.types.Scene.fuel_id = bpy.props.StringProperty(name="Fuel ID Unique")
    bpy.types.Scene.model_id = bpy.props.StringProperty(name="Model ID Unique")
    bpy.types.Scene.model_leaderboard_id = bpy.props.StringProperty(name="Model Leaderboard ID Unique")
    bpy.types.Scene.model_calender_glyph = bpy.props.StringProperty(name="F1 2013 Calender Order - Unique")
    bpy.types.Scene.model_calendar_glyph = bpy.props.StringProperty(name="Calendar Order Unique")
    bpy.types.Scene.model_track_id = bpy.props.StringProperty(name="Model Track ID")
    bpy.types.Scene.difficulty_id = bpy.props.StringProperty(name="Difficulty ID Unique")
    bpy.types.Scene.difficulty_track = bpy.props.StringProperty(name="Difficulty Track Unique")
    bpy.types.Scene.selected_season = bpy.props.StringProperty(name="Select Game (Any Number)")
    bpy.types.Scene.medium_event_name = bpy.props.StringProperty(name="Medium Event Name Unique")
    bpy.types.Scene.long_event_name = bpy.props.StringProperty(name="Long Event Name Unique")
    bpy.types.Scene.long_track_name = bpy.props.StringProperty(name="Long Track Name Unique")
    bpy.types.Scene.short_event_name = bpy.props.StringProperty(name="Short Event Name Unique")
    bpy.types.Scene.fullcareer_order = bpy.props.StringProperty(name="Menu Card Order")
    bpy.types.Scene.num_laps = bpy.props.StringProperty(name="Total Laps")
    bpy.types.Scene.gp_mode_round_number = bpy.props.StringProperty(name="F1 2013 GP Menu Order")
    bpy.types.Scene.main_career_round_number = bpy.props.StringProperty(name="F1 2013 Career Order")
    bpy.types.Scene.track_description = bpy.props.StringProperty(name="Mod Author", default="Your Nick")
    bpy.types.Scene.reserved_id_list = bpy.props.EnumProperty(
        name="Show Reserved IDs",
        description="Select a Reserved Track ID",
        items=TRACK_OPTIONS
    )
    
    bpy.types.Scene.track_name = bpy.props.StringProperty(
        name="Track Name",
        description="Enter the new track name (lowercase only)",
        default="baku"  
    )
    bpy.types.Scene.prime_tyre = bpy.props.EnumProperty(
        name="Prime Tyre",
        description="Select the prime tyre type",
        items=PRIME_TYRE_OPTIONS,
        default="3",
        update=update_prime_tyre 
    )
    bpy.types.Scene.option_tyre = bpy.props.EnumProperty(
        name="Option Tyre",
        description="Select the option tyre type",
        items=OPTION_TYRE_OPTIONS,
        default="2",
        update=update_option_tyre 
    )
    

    def unregister(): bpy.utils.unregister_class(F1TrackBuilderPanel) bpy.utils.unregister_class(UpdateScenePropertiesOperator) bpy.utils.unregister_class(ExportXML) bpy.utils.unregister_class(RenameTrackOperator)

    del bpy.types.Scene.track_id
    del bpy.types.Scene.name_string_id
    del bpy.types.Scene.nationality_id
    del bpy.types.Scene.carhandling_id
    del bpy.types.Scene.carhandling_track  
    del bpy.types.Scene.fuel_id
    del bpy.types.Scene.fuel_reserved
    del bpy.types.Scene.model_id_enum
    del bpy.types.Scene.model_id
    del bpy.types.Scene.model_leaderboard_id
    del bpy.types.Scene.model_calender_glyph
    del bpy.types.Scene.model_calendar_glyph
    del bpy.types.Scene.model_track_id
    del bpy.types.Scene.difficulty_id
    del bpy.types.Scene.difficulty_track
    del bpy.types.Scene.selected_season
    del bpy.types.Scene.medium_event_name
    del bpy.types.Scene.long_event_name
    del bpy.types.Scene.long_track_name
    del bpy.types.Scene.short_event_name
    del bpy.types.Scene.fullcareer_order
    del bpy.types.Scene.num_laps
    del bpy.types.Scene.gp_mode_round_number
    del bpy.types.Scene.main_career_round_number
    del bpy.types.Scene.track_name
    del bpy.types.Scene.reserved_id_list
    del bpy.types.Scene.prime_tyre
    del bpy.types.Scene.option_tyre
    

    if name == "main": register()

  2. Assistant

    Привет! Вы привели код аддона для Blender 3.3.0, который предназначен для редактирования данных трасс в игре Формула-1. Включает в себя множество опций для отслеживания и управления различными параметрами трасс, а также для экспорта данных в формате XML. Как я могу помочь вам с этим аддоном?

  3. User

    выдает ошибку при активации:

    Traceback (most recent call last): File "F:\Big Tools\Blender 3.3.0 Alpha\3.3\scripts\modules\addon_utils.py", line 421, in disable mod.unregister() File "C:\Users\USER\AppData\Roaming\Blender Foundation\Blender\3.3\scripts\addons\f1_track_data_maker_release_v2.py", line 644, in unregister bpy.utils.unregister_class(F1TrackBuilderPanel) RuntimeError: unregister_class(...):, missing bl_rna attribute from 'RNAMeta' instance (may not be registered)

    Error: Traceback (most recent call last): File "F:\Big Tools\Blender 3.3.0 Alpha\3.3\scripts\modules\addon_utils.py", line 421, in disable mod.unregister() File "C:\Users\USER\AppData\Roaming\Blender Foundation\Blender\3.3\scripts\addons\f1_track_data_maker_release_v2.py", line 644, in unregister bpy.utils.unregister_class(F1TrackBuilderPanel) RuntimeError: unregister_class(...):, missing bl_rna attribute from 'RNAMeta' instance (may not be registered)

    Exception in module register(): C:\Users\USER\AppData\Roaming\Blender Foundation\Blender\3.3\scripts\addons\f1_track_data_maker_release_v2.py Traceback (most recent call last): File "F:\Big Tools\Blender 3.3.0 Alpha\3.3\scripts\modules\addon_utils.py", line 369, in enable mod.register() File "C:\Users\USER\AppData\Roaming\Blender Foundation\Blender\3.3\scripts\addons\f1_track_data_maker_release_v2.py", line 580, in register bpy.utils.register_class(UpdateScenePropertiesOperator) ValueError: register_class(...): already registered as a subclass 'UpdateScenePropertiesOperator'

  4. Assistant

    Ошибка, которую вы получаете, возникает из-за проблемы с регистрацией классов в Blender. Основные проблемы, которые могут вызывать такие ошибки, следующие:

    1. Дублирование регистрации: Возможно, вы уже зарегистрировали класс с тем же именем в предыдущем сеансе Blender, и при повторной попытке регистрации происходит конфликт. Убедитесь, что вы корректно вызываете unregister() перед тем, как снова вызывать register().

    2. Неправильный порядок регистрации: Ваша функция unregister() должна сначала убирать свойства и классы, а затем вызывать bpy.utils.unregister_class(). Обычно, порядок должен быть обратным тому, как вы их регистрируете.

    3. Свойства, которые должны быть зарегистрированы в классе: Некоторые свойства должны назначаться через bpy.props, и если они не были корректно инициализированы в register(), возможно это также может привести к ошибкам.

    Давайте проверим корректность ваших функций register() и unregister(). Они должны выглядеть примерно так:

    def register():
        bpy.utils.register_class(F1TrackBuilderPanel)
        bpy.utils.register_class(UpdateScenePropertiesOperator)
        bpy.utils.register_class(ExportXML)
        bpy.utils.register_class(RenameTrackOperator)
    
        # Объявление свойств после регистрации классов
        bpy.types.Scene.track_id = bpy.props.StringProperty(name="Track ID Unique")
        bpy.types.Scene.name_string_id = bpy.props.StringProperty(name="Name String ID")
        # ... добавьте остальные свойства здесь ...
        
    def unregister():
        # Сначала удалить свойства
        del bpy.types.Scene.track_id
        del bpy.types.Scene.name_string_id
        # ... удалите остальные свойства здесь ...
        
        bpy.utils.unregister_class(F1TrackBuilderPanel)
        bpy.utils.unregister_class(UpdateScenePropertiesOperator)
        bpy.utils.unregister_class(ExportXML)
        bpy.utils.unregister_class(RenameTrackOperator)
    

    Рекомендации для устранения ошибок:

    1. Перезапустите Blender: Перезапустите Blender, чтобы очистить все предыдущие регистрации.

    2. Проверьте наличие дубликатов: Убедитесь, что в коде нет дублирующих объявлений классов или свойств.

    3. Измените идентификаторы классов: Если вы действительно получаете ошибку, предполагающую, что класс уже зарегистрирован, попробуйте временно изменить имена классов, например, добавив префикс, чтобы убедиться, что нет конфликта.

    4. Включение отладочной информации: Добавьте print-заявления в функции регистрации и отмены регистрации, чтобы увидеть, какие классы или свойства добавляются или удаляются.

    Если вы продолжаете сталкиваться с проблемами, пожалуйста, предоставьте полную версию вашего кода или часть, где вы определяете классы и свойства, чтобы я мог помочь вам более предметно.