Почему не заменяются данные цифры например в <id>115</id> в track и т.д, меняются только…
- User
Почему не заменяются данные цифры например в 115 в track и т.д, меняются только baku и всё
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
XML Data Reference Example
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.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.track_name = root.find('.//track_car_handling/Track').textclass 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="I signed a unique ID.") layout.label(text="Compare the ID with others tracks in Database Editor.") 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, 'fuel_id', text="Fuel ID Unique") 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_leaderboard_id', text="Model Leaderboard ID Unique") row = layout.row(align=True) row.prop(context.scene, 'model_calender_glyph', text="F1 2013 Calender Order - Unique") row = layout.row(align=True) row.prop(context.scene, 'model_calendar_glyph', text="Calendar Order Unique") row = layout.row(align=True) row.prop(context.scene, 'difficulty_id', text="Difficulty ID Unique") row = layout.row(align=True) row.prop(context.scene, 'difficulty_track', text="F1 2013 Difficulty Track Unique") row = layout.row(align=True) row.prop(context.scene, 'selected_season', text="Select Game (Any Number)") layout.operator("f1trackbuilder.update_props", text="Load Data Reference") layout.operator("f1trackbuilder.export_xml", text="Export Data Track XML") - Assistant
В вашем коде для Blender, по всей видимости, не реализована функциональность обновления идентификаторов
<id>и других полей в XML-документе помимо имени трека. В текущем коде вы выполняете замену только для строки "baku", когда при экспорте XML вызывается метод класса . - User
Python: Traceback (most recent call last): File "C:\Users\USER\AppData\Roaming\Blender Foundation\Blender\3.3\scripts\addons\f1_track_data_maker.py", line 270, in execute elem.find("id").text = context.scene.track_id AttributeError: 'NoneType' object has no attribute 'text'
- Assistant
- User
- Assistant
- User
- Assistant