From 15df44a0eb73f0e927296e8fa66da54fda806df8 Mon Sep 17 00:00:00 2001 From: Aurelien Vaillant Date: Thu, 9 May 2024 00:25:15 +0200 Subject: [PATCH] Add basic setup to generate collision mesh --- Fange Pipeline/__init__.py | 4 ++-- Fange Pipeline/ops.py | 12 ++++++++++++ Fange Pipeline/preference.py | 2 +- Fange Pipeline/ui.py | 3 +++ 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/Fange Pipeline/__init__.py b/Fange Pipeline/__init__.py index 510f509..439eb92 100644 --- a/Fange Pipeline/__init__.py +++ b/Fange Pipeline/__init__.py @@ -1,7 +1,7 @@ import bpy from .ui import GRAOU_PT_panel -from .ops import ExportForFange +from .ops import ExportForFange, MakeBasicCollision from .preference import GRAOU_AddonPreference bl_info = { @@ -18,7 +18,7 @@ bl_info = { modules_class = [ # Main Property - ExportForFange, + ExportForFange, MakeBasicCollision, # UI GRAOU_PT_panel, # Preference diff --git a/Fange Pipeline/ops.py b/Fange Pipeline/ops.py index 2b226e3..4c229f4 100644 --- a/Fange Pipeline/ops.py +++ b/Fange Pipeline/ops.py @@ -90,3 +90,15 @@ class ExportForFange(bpy.types.Operator): # print(f'[Pipeline] Check {coll}. Item type {type(coll)}') return {'FINISHED'} + +class MakeBasicCollision(bpy.types.Operator): + """From selected mesh, make a collision object""" + bl_idname = 'graou.make_collision' + bl_label = 'Generate a collision from selected mesh' + + @classmethod + def poll(cls, context): + return bpy.context.object + + def execute(self, context): + return {'FINISHED'} diff --git a/Fange Pipeline/preference.py b/Fange Pipeline/preference.py index 5a2044d..28452d3 100644 --- a/Fange Pipeline/preference.py +++ b/Fange Pipeline/preference.py @@ -17,7 +17,7 @@ class GRAOU_AddonPreference(bpy.types.AddonPreferences): """ Configuration about the Fange pipeline """ - bl_idname = __package__.split('.')[0] + bl_idname = __package__.split(".")[0] project_path: bpy.props.StringProperty( name='Fange Unity project', diff --git a/Fange Pipeline/ui.py b/Fange Pipeline/ui.py index 6e2a1e4..6b04955 100644 --- a/Fange Pipeline/ui.py +++ b/Fange Pipeline/ui.py @@ -14,6 +14,9 @@ class GRAOU_PT_panel(bpy.types.Panel): layout.use_property_split = True layout.use_property_decorate = False + layout.label(text='Collision', icon='WORLD_DATA') + layout.operator('graou.make_collision') + layout.label(text='Building', icon='WORLD_DATA') layout.operator('graou.building_export')