4
$\begingroup$

I always get the following error

Warning: 'ABC_Fbx_PT_Panel' doesn't have upper case alpha-numeric prefix

But I don't really get why...

That is my code:

import bpy
from bpy_extras.io_utils import ExportHelper
from bpy.props import (StringProperty, CollectionProperty,)
from bpy.types import (Operator, OperatorFileListElement,)


class WorldOriginExport(Operator, ExportHelper):
    bl_label = 'Export'
    bl_idname = 'test.world_origin_export'
    bl_options = {'PRESET', 'UNDO', 'REGISTER'}
    files = CollectionProperty(name = 'File Path', type = OperatorFileListElement,)
    directory = StringProperty(subtype = 'DIR_PATH',)
    filename_ext = ''

    def draw(self, context):
        layout = self.layout
        layout.use_property_split = False
        layout.use_property_decorate = False  # No animation.
        sfile = context.space_data
        operator = sfile.active_operator


    def execute(self, context):
        return {'FINISHED'}



class ABC_Gltf_PT_Panel(bpy.types.Panel):
    bl_space_type = 'FILE_BROWSER'
    bl_region_type = 'TOOL_PROPS'
    bl_label = 'glTF Embedded / Separate'
    bl_options = {'DEFAULT_CLOSED'}


    def draw(self, context):
        layout = self.layout
        layout.use_property_split = True
        sfile = context.space_data
        operator = sfile.active_operator


    @classmethod
    def poll(cls, context):
        sfile = context.space_data
        operator = sfile.active_operator
        return operator.bl_idname == "TEST_OT_world_origin_export"




class ABC_Fbx_PT_Panel(bpy.types.Panel):
    bl_space_type = 'FILE_BROWSER'
    bl_region_type = 'TOOL_PROPS'
    bl_label = 'FBX'
    bl_options = {'DEFAULT_CLOSED'}


    def draw(self, context):
        layout = self.layout
        layout.use_property_split = True
        layout.use_property_decorate = False  # No animation.
        sfile = context.space_data
        operator = sfile.active_operator

        if operator.fileType == 'GLTF_SEPARATE':
            layout.enabled = False
        elif operator.fileType == 'GLTF_EMBEDDED':
            layout.enabled = False
        else:
            layout.enabled = True


    @classmethod
    def poll(cls, context):
        sfile = context.space_data
        operator = sfile.active_operator
        return operator.bl_idname == "TEST_OT_world_origin_export"



def register():
    bpy.utils.register_class(WorldOriginExport)
    bpy.utils.register_class(ABC_Gltf_PT_Panel)
    bpy.utils.register_class(ABC_Fbx_PT_Panel)

def unregister():
    bpy.utils.unregister_class(ABC_Fbx_PT_Panel)
    bpy.utils.unregister_class(ABC_Gltf_PT_Panel)
    bpy.utils.unregister_class(WorldOriginExport)


if __name__ == '__main__':
    register()
    bpy.ops.test.world_origin_export('INVOKE_DEFAULT')
$\endgroup$
0

1 Answer 1

5
$\begingroup$

The part before _PT_ must be uppercase alphanumeric to suppress the message (no special characters). You can use whatever for the part after it though, snake_case is advised by Blender guidelines (mixed case is supported too).

https://wiki.blender.org/wiki/Reference/Release_Notes/2.80/Python_API/Addons#Naming

You could rename your class names to:

ABC_PT_Gltf and ABC_PT_Fbx. The _PT_ part means it is a panel class so there is no need to write it again afterwards in my opinion.

$\endgroup$
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .