generated from stilobique/BlenderTemplate
Make model about path used
This commit is contained in:
@@ -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)
|
||||
@@ -1,5 +1,6 @@
|
||||
import bpy
|
||||
|
||||
from .models import FangeProject
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
@@ -10,7 +11,7 @@ class ExportForFange(bpy.types.Operator):
|
||||
|
||||
def __init__(self):
|
||||
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'
|
||||
|
||||
@classmethod
|
||||
@@ -32,11 +33,12 @@ class ExportForFange(bpy.types.Operator):
|
||||
print(f'[Pipeline] Select all mesh inside the collection "{child.name}"')
|
||||
for ob in child.all_objects:
|
||||
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)
|
||||
|
||||
# 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():
|
||||
abs_export.mkdir()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user