diff --git a/motion_generate_tools/__init__.py b/motion_generate_tools/__init__.py index 6245cac..b205dec 100644 --- a/motion_generate_tools/__init__.py +++ b/motion_generate_tools/__init__.py @@ -18,7 +18,7 @@ bl_info = { "name": "motion_generate_tools", "author": "UuuNyaa", - "version": (0, 0, 3), + "version": (0, 0, 4), "blender": (3, 3, 0), "location": "View3D > Sidebar > Panel", "description": "Utility tools for motion generating.", diff --git a/motion_generate_tools/preferences.py b/motion_generate_tools/preferences.py index a5680d1..88ba3be 100644 --- a/motion_generate_tools/preferences.py +++ b/motion_generate_tools/preferences.py @@ -21,11 +21,11 @@ def _lines_append(line: str): class DownloadClipModel(bpy.types.Operator): bl_idname = 'motion_generate_tools.download_clip_model' bl_label = 'Download CLIP Model' - bl_options = {'REGISTER'} + bl_options = {'REGISTER', 'INTERNAL'} @classmethod def poll(cls, _context): - return not setup_utils.is_installer_running() + return (not setup_utils.is_installer_running()) and setup_utils.get_required_modules()['clip'] def execute(self, context): _LINES.clear() @@ -37,7 +37,7 @@ def execute(self, context): class DeleteClipModel(bpy.types.Operator): bl_idname = 'motion_generate_tools.delete_clip_model' bl_label = 'Delete CLIP Model' - bl_options = {'REGISTER'} + bl_options = {'REGISTER', 'INTERNAL'} @classmethod def poll(cls, _context): @@ -52,7 +52,7 @@ def execute(self, _context): class UpdatePythonModulesOperator(bpy.types.Operator): bl_idname = 'motion_generate_tools.update_python_modules' bl_label = 'Update Python Modules' - bl_options = {'REGISTER'} + bl_options = {'REGISTER', 'INTERNAL'} use_gpu: bpy.props.BoolProperty(default=False) @@ -74,7 +74,7 @@ def execute(self, context): class UninstallPythonModulesOperator(bpy.types.Operator): bl_idname = 'motion_generate_tools.uninstall_python_modules' bl_label = 'Uninstall Python Modules' - bl_options = {'REGISTER'} + bl_options = {'REGISTER', 'INTERNAL'} @classmethod def poll(cls, _context): @@ -93,7 +93,7 @@ def execute(self, context): class ListPythonModulesOperator(bpy.types.Operator): bl_idname = 'motion_generate_tools.list_python_modules' bl_label = 'List Python Modules' - bl_options = {'REGISTER'} + bl_options = {'REGISTER', 'INTERNAL'} @classmethod def poll(cls, _context): @@ -117,17 +117,6 @@ class MotionGenerateToolsAddonPreferences(bpy.types.AddonPreferences): def draw(self, _context: bpy.types.Context): layout = self.layout - col = layout.column(align=True) - flow = col.grid_flow(align=True) - flow.row().label(text="CLIP Model:") - is_clip_model_exist = setup_utils.is_clip_model_exist() - if not is_clip_model_exist: - flow.row().label(text="Not found", icon='ERROR') - col.operator(DownloadClipModel.bl_idname) - else: - flow.row().label(text="OK", icon='CHECKMARK') - col.operator(DeleteClipModel.bl_idname) - col = layout.column(align=True) flow = col.grid_flow(align=True) flow.row().label(text="Required Python Modules:") @@ -140,6 +129,17 @@ def draw(self, _context: bpy.types.Context): flow.row().operator(UninstallPythonModulesOperator.bl_idname) flow.row().operator(ListPythonModulesOperator.bl_idname) + col = layout.column(align=True) + flow = col.grid_flow(align=True) + flow.row().label(text="CLIP Model:") + is_clip_model_exist = setup_utils.is_clip_model_exist() + if not is_clip_model_exist: + flow.row().label(text="Not found", icon='ERROR') + col.operator(DownloadClipModel.bl_idname) + else: + flow.row().label(text="OK", icon='CHECKMARK') + col.operator(DeleteClipModel.bl_idname) + col = layout.column(align=False) row = col.row(align=True) row.prop(