Make model about path used

This commit is contained in:
2024-05-07 22:49:09 +02:00
parent f9628eda0f
commit 649b19a33d
2 changed files with 33 additions and 3 deletions
+28
View File
@@ -0,0 +1,28 @@
import bpy
from pathlib import Path
class FangeProject:
def __init__(self):
self._pref = bpy.context.preferences.addons[__name__.split(".")[0]].preferences
self._project_path = Path(self._pref.project_path)
self._subdir_path = Path(self._pref.subdir_graph)
self._building_path = Path(self._pref.subdir_buildings)
self._props_path = Path(self._pref.subdir_props)
self._characters_path = Path(self._pref.subdir_characters)
@property
def buildings(self):
"""Get the buildings project path, on absolute"""
return self._project_path.joinpath(self._subdir_path, self._building_path)
@property
def props(self):
return self._project_path.joinpath(self._subdir_path, self._props_path)
@property
def characters(self):
return self._project_path.joinpath(self._subdir_path, self._characters_path)
+5 -3
View File
@@ -1,5 +1,6 @@
import bpy import bpy
from .models import FangeProject
from pathlib import Path from pathlib import Path
@@ -10,7 +11,7 @@ class ExportForFange(bpy.types.Operator):
def __init__(self): def __init__(self):
self.coll_layout = bpy.data.collections.get('Placeholder') self.coll_layout = bpy.data.collections.get('Placeholder')
self.output = Path("W:\\", "Graou Studio", "Game Projects", "Fange Prototype", "Assets", "Graph", "Buildings") self.path = FangeProject()
self.fbx_preset = 'sm-unity-building' self.fbx_preset = 'sm-unity-building'
@classmethod @classmethod
@@ -32,11 +33,12 @@ class ExportForFange(bpy.types.Operator):
print(f'[Pipeline] Select all mesh inside the collection "{child.name}"') print(f'[Pipeline] Select all mesh inside the collection "{child.name}"')
for ob in child.all_objects: for ob in child.all_objects:
print(f'\tLook "{ob.name}", his type are "{type(ob.data)}"') print(f'\tLook "{ob.name}", his type are "{type(ob.data)}"')
if isinstance(ob.data, bpy.types.Mesh) or isinstance(ob.data, bpy.types.Empty): # TODO Support another type object, not only SM/SK
if isinstance(ob.data, bpy.types.Mesh):
ob.select_set(True) ob.select_set(True)
# TODO The plugin export only the garden building # TODO The plugin export only the garden building
abs_export = self.output.joinpath("Garden", "Meshes") abs_export = self.path.buildings.joinpath("Garden", "Meshes")
if not abs_export.exists(): if not abs_export.exists():
abs_export.mkdir() abs_export.mkdir()