Код аддона для блендер 3.3.0: blinfo = { "name": "F1 Track CTF Renamer", "blender": (3,…
- User
Код аддона для блендер 3.3.0:
bl_info = { "name": "F1 Track CTF Renamer", "blender": (3, 3, 0), "category": "3D View", "description": "Quickly rename .ctf files.", "author": "AlonsoBeast", "version": (1, 1), "support": "COMMUNITY", }
import bpy import os import shutil import subprocess
class F1TrackCTFRenamerPanel(bpy.types.Panel): """Creates a panel for the addon""" bl_label = "F1 Track CTF Renamer" bl_idname = "PT_F1TrackCTFRenamer" bl_space_type = 'VIEW_3D' bl_region_type = 'UI' bl_category = 'F1 Track DataEditor'
def draw(self, context): layout = self.layout scene = context.scene # Оборачиваем в box для туториала layout.prop(scene, "tutorial_expanded", text="Tutorial", icon='INFO', emboss=True) if scene.tutorial_expanded: box = layout.box() box.label(text="1. Select F1 directory cars/ folder") box.label(text="2. Select output folder to export") box.label(text="3. Rename source track name .ctf file to new one") layout.prop(context.scene, "source_directory", text="Source Directory") row = layout.row() row.operator("f1.track_ctf_select_source_directory", text="Select Source Directory", icon='OUTLINER_COLLECTION') layout.prop(context.scene, "output_directory", text="Output Directory") row = layout.row() row.operator("f1.track_ctf_select_directory", text="Select Output Directory", icon='FOLDER_REDIRECT') layout.prop(context.scene, "ctf_track_name", text="New Track Name") layout.prop(context.scene, "search_name", text="Source Track Name") row = layout.row() row.operator("f1.track_ctf_rename", text="Rename CTF Files", icon='GREASEPENCIL')class F1TrackCTFSelectDirectory(bpy.types.Operator): """Operator to select the output directory""" bl_idname = "f1.track_ctf_select_directory" bl_label = "Select Output Directory"
directory: bpy.props.StringProperty(subtype="DIR_PATH") def execute(self, context): context.scene.output_directory = self.directory print(f"Selected Output Directory: {context.scene.output_directory}") return {'FINISHED'} def invoke(self, context, event): self.directory = context.scene.output_directory context.window_manager.fileselect_add(self) return {'RUNNING_MODAL'}class F1TrackCTFSelectSourceDirectory(bpy.types.Operator): """Operator to select the source directory""" bl_idname = "f1.track_ctf_select_source_directory" bl_label = "Select Source Directory"
directory: bpy.props.StringProperty(subtype="DIR_PATH") def execute(self, context): context.scene.source_directory = self.directory print(f"Selected Source Directory: {context.scene.source_directory}") return {'FINISHED'} def invoke(self, context, event): self.directory = context.scene.source_directory context.window_manager.fileselect_add(self) return {'RUNNING_MODAL'}class F1TrackCTFRenamerOperator(bpy.types.Operator): """Operator to rename .ctf files""" bl_idname = "f1.track_ctf_rename" bl_label = "Rename CTF Files"
- Assistant
- User
ошибку выдает:
Warning: 'PT_F1TrackCTFRenamer' does not contain 'PT' with prefix and suffix
- Assistant