Compare commits

..

23 Commits

Author SHA1 Message Date
stilobique 88f5deeda0 Automatized the thumbnail generation, and adding easily all lights 2024-06-07 11:56:09 +02:00
stilobique 4017020909 Packed the HDR texture 2024-06-07 11:14:29 +02:00
stilobique 65ef02eb26 Clear import lib 2024-06-07 10:59:26 +02:00
stilobique 44b0781b94 Setup thumbnail param
Update export to find export path without the operator
2024-06-07 10:49:41 +02:00
stilobique cfb7a8b514 Fix character error 2024-06-06 22:11:22 +02:00
stilobique c61ba477ad Write a basic operator to generate the thumbnail 2024-06-06 22:03:56 +02:00
stilobique 83d321c69d Make a class panel to easily draw each class 2024-06-06 19:55:46 +02:00
stilobique cd8301e29c Refactoring, split the panel 2024-06-06 19:41:11 +02:00
stilobique a9564255da WIP to convert curve to geometry 2024-05-31 17:46:07 +02:00
stilobique 0821574902 WIP Lighting build 2024-05-31 17:31:39 +02:00
stilobique 4fa3170b93 Clear git ignore file 2024-05-31 11:02:05 +02:00
stilobique 940bc14d77 Update export, to be more clear and readable. 2024-05-31 10:42:41 +02:00
stilobique d20a7d2198 Return an error if the placeholder export are empty or no children collection.
Update the docstring operator to be more clear.
2024-05-31 10:36:28 +02:00
stilobique e380e894d7 Add basic operator to setup a light env 2024-05-31 10:10:45 +02:00
stilobique 30531affba Add small docstring about method 2024-05-30 18:02:06 +02:00
stilobique ebbb80a2da Add icon test, not enable 2024-05-16 22:31:59 +02:00
stilobique 9cbe89e4b8 Rename the main folder 2024-05-16 22:12:11 +02:00
stilobique 814e158eb5 Fix the socket to be a clear empty and re-set his value when the export are done 2024-05-14 02:27:34 +02:00
stilobique 9ed89657c3 Rename export operator, it's only the placeholder exporter 2024-05-14 00:10:19 +02:00
stilobique 9758304066 Update the outline operators.
Make a setup to generate the socket collection
2024-05-14 00:04:10 +02:00
stilobique 61e3bcaaf3 Tweak the UI 2024-05-13 23:17:33 +02:00
stilobique 7418be4196 Update socket config 2024-05-13 22:31:31 +02:00
stilobique 4f539912eb Refactoring model inside properties
Make a Property Group for blender
2024-05-12 18:15:19 +02:00
27 changed files with 535 additions and 269 deletions
-15
View File
@@ -7,24 +7,9 @@
__pycache__/
**/__pycache__/
# Unit Test #
*.zip
tests/blender/**
tests/blender/*.dmg
!tests/blender/.keep
### Blender ###
*.blend1
### Unreal ###
tests/unreal_sample/DerivedDataCache
tests/unreal_sample/Intermediate
tests/unreal_sample/Saved
# Secret file
**/token.txt
# Virtual Environment
**/venv/**
venv/
-42
View File
@@ -1,42 +0,0 @@
import bpy
from .ui.export import GRAOU_PT_panel
from .operators.outline import ConfigBlendScene
from .operators.exports import ExportForFange
from .operators.misc import MakeBasicCollision
from .preference import GRAOU_AddonPreference
bl_info = {
'name': 'Fange Pipeline',
'description': 'Pipeline about the game project "Fange"',
'author': 'Graou Studio, Aurelien Vaillant',
'version': (0, 0, 1),
'blender': (4, 1, 0),
'doc_url': "",
'tracker_url': "",
'support': "COMMUNITY",
'category': 'Graou Studio',
}
modules_class = [
# Main Property
ExportForFange, MakeBasicCollision, ConfigBlendScene,
# UI
GRAOU_PT_panel,
# Preference
GRAOU_AddonPreference
]
def register():
for cls in modules_class:
bpy.utils.register_class(cls)
def unregister():
for cls in reversed(modules_class):
bpy.utils.unregister_class(cls)
if __name__ == "__main__":
register()
-128
View File
@@ -1,128 +0,0 @@
import bpy
from ..models import FangeProject
from pathlib import Path
class ExportForFange(bpy.types.Operator):
"""Export a building for fange"""
bl_idname = 'graou.building_export'
bl_label = 'Easily export a building asset'
def __init__(self):
self.coll_layout = bpy.data.collections.get('Placeholder')
self.path = FangeProject()
self.asset = self.get_asset_name()
self.category = self.get_asset_type()
@classmethod
def poll(cls, context):
col = bpy.data.collections.get('Placeholder')
if col is not None and bpy.data.is_saved:
return True
def execute(self, context):
bpy.ops.object.select_all(action='DESELECT')
print(f'[Pipeline] Start to export the building props.')
# Make a check if the file are saved on the disk
if not bpy.data.is_saved:
self.report({'ERROR'}, 'Your blend file is not saved.')
return {'CANCELLED'}
if not self.category:
self.report({'ERROR'}, 'Can\'t find the asset category.')
return {'CANCELLED'}
if len(self.coll_layout.collection_children):
for coll in self.coll_layout.children:
print(f'[Pipeline] Update "{coll.name}" mesh')
child = bpy.data.collections.get(coll.name)
for ob in child.all_objects:
print(f'\tLook "{ob.name}", his type are "{type(ob.data)}"')
# TODO Support another type object, not only SM/SK
if ob.type == 'MESH' or 'EMPTY':
ob.select_set(True)
abs_export = self.category.joinpath(self.asset, "Meshes")
if not abs_export.exists():
abs_export.mkdir(parents=True)
# TODO Use a preset system
bpy.ops.export_scene.fbx(filepath=abs_export.joinpath(f"SM_{coll.name}.fbx").as_posix(),
use_selection=True,
use_visible=False,
use_active_collection=False,
global_scale=1.0,
apply_unit_scale=True,
apply_scale_options='FBX_SCALE_NONE',
use_space_transform=True,
bake_space_transform=True,
object_types={'MESH', 'EMPTY'},
use_mesh_modifiers=True,
use_mesh_modifiers_render=True,
mesh_smooth_type='OFF',
colors_type='SRGB',
prioritize_active_color=False,
use_subsurf=False,
use_mesh_edges=False,
use_tspace=False,
use_triangles=False,
use_custom_props=False,
add_leaf_bones=True,
primary_bone_axis='Y',
secondary_bone_axis='X',
use_armature_deform_only=False,
armature_nodetype='NULL',
bake_anim=False,
bake_anim_use_all_bones=True,
bake_anim_use_nla_strips=True,
bake_anim_use_all_actions=True,
bake_anim_force_startend_keying=True,
bake_anim_step=1.0,
bake_anim_simplify_factor=1.0,
path_mode='AUTO',
embed_textures=False,
batch_mode='OFF',
use_batch_own_dir=True,
axis_forward='X',
axis_up='Y'
)
print(f'[Pipeline] Export here "{abs_export}"')
bpy.ops.object.select_all(action='DESELECT')
# for coll in coll_layout.children:
# print(f'[Pipeline] Check {coll}. Item type {type(coll)}')
self.report({'INFO'}, 'Placeholder exported')
return {'FINISHED'}
def get_asset_type(self) -> Path:
"""Look the file path, to understand if the asset are a Character, Buildings or Props"""
abs_blend_path = Path(bpy.data.filepath)
print(f'[Pipeline] Get blend file path "{abs_blend_path}"')
print(f'[Pipeline] Convert to List "{abs_blend_path.parts}"')
if 'Buildings' in abs_blend_path.parts:
print(f'[Pipeline] Export here "{self.path.buildings}"')
return self.path.buildings
elif 'Pros' in abs_blend_path.parts:
print(f'[Pipeline] Export here "{self.path.props}"')
return self.path.props
elif 'Characters' in abs_blend_path.parts:
print(f'[Pipeline] Export here "{self.path.characters}"')
return self.path.characters
else:
print(f'[Pipeline] Can\'t find asset category')
return Path()
@staticmethod
def get_asset_name():
abs_blend_path = Path(bpy.data.filepath)
return abs_blend_path.stem
-27
View File
@@ -1,27 +0,0 @@
import bpy
from ..models import Outline
class ConfigBlendScene(bpy.types.Operator):
"""Init the opened blend scene"""
bl_idname = 'graou.build_scene'
bl_label = 'Config or update the outline'
def __init__(self):
self._outline = Outline()
def execute(self, context):
for key, value in self._outline.collections.items():
collection = bpy.data.collections.get(key)
# Make the collection if this item not exist
if collection is None:
collection = bpy.data.collections.new(value.name)
context.scene.collection.children.link(collection)
# Check if the color are correctly setup, if not update-it
if collection.color_tag is not value.color:
collection.color_tag = value.color
return {'FINISHED'}
-29
View File
@@ -1,29 +0,0 @@
import bpy
class GRAOU_PT_panel(bpy.types.Panel):
bl_idname = 'GRAOU_PT_MAIN'
bl_space_type = 'VIEW_3D'
bl_region_type = 'UI'
bl_label = 'Pipeline'
bl_category = 'Graou Studio'
def draw(self, context):
layout = self.layout
layout.use_property_split = True
layout.use_property_decorate = False
row = layout.row(align=False)
row.label(text='Main Config:')
layout.operator('graou.build_scene', text='Init Scene', icon='OUTLINER')
row = layout.row(align=False)
row.label(text='Asset:')
layout.operator('graou.make_collision', text='Make all collision', icon='MOD_PHYSICS')
row = layout.row(align=True)
row.label(text='Export scene:')
box = layout.box()
box.label(text='Sanity Check')
layout.operator('graou.building_export', text='Export all assets', icon='EXPORT')
-28
View File
@@ -1,28 +0,0 @@
import bpy
from pathlib import Path
def get_export_preset():
"""
Select a FBX preset you want use.
"""
# TODO Subdir need to be exposed
fbx_preset_paths = bpy.utils.preset_paths(r"operator\export_scene.fbx")
# TODO Preset name need to be exposed
fbx_preset = Path(fbx_preset_paths[0], "sm-unity-building.py")
if fbx_preset_paths:
print(f'[Pipeline] Get the preset path "{fbx_preset}"')
return fbx_preset
else:
print(f'[Pipeline] Preset folder not found')
def apply_mesh_and_join():
"""
This function make a new mesh with all selected asset.
"""
pass
+55
View File
@@ -0,0 +1,55 @@
import bpy
# UI and Interface
from .ui.asset import GraouPanel_asset
from .ui.export import GRAOU_PT_export
from .ui.icon import GraouPanel_thumbnail
from .ui.setup import GRAOU_PT_setup
# All operators
from .operators.exports import ExportForFange
from .operators.outline import ConfigBlendScene
from .operators.misc import MakeBasicCollision
from .operators.lighting import ConfigLighting
from .operators.thumbnails import ConfigRendering
# Preferences and properties
from .preference import GRAOU_AddonPreference
from .properties.main import FangeProperties
bl_info = {
'name': 'Fange Pipeline',
'description': 'Pipeline about the game project "Fange"',
'author': 'Graou Studio, Aurelien Vaillant',
'version': (0, 0, 1),
'blender': (4, 1, 0),
'doc_url': "",
'tracker_url': "",
'support': "COMMUNITY",
'category': 'Graou Studio',
}
modules_class = [
# Main operators property
ExportForFange, MakeBasicCollision, ConfigBlendScene, ConfigLighting, ConfigRendering,
# UI, the order are the way to select how show each panel
GRAOU_PT_setup, GraouPanel_asset, GRAOU_PT_export, GraouPanel_thumbnail,
# Preference
GRAOU_AddonPreference, FangeProperties
]
def register():
for cls in modules_class:
bpy.utils.register_class(cls)
bpy.types.Scene.graou_props = bpy.props.PointerProperty(type=FangeProperties)
def unregister():
for cls in reversed(modules_class):
bpy.utils.unregister_class(cls)
del bpy.types.Scene.graou_props
if __name__ == "__main__":
register()
+126
View File
@@ -0,0 +1,126 @@
import bpy
from ..utils import get_export_path, get_asset_name
class ExportForFange(bpy.types.Operator):
"""Export a building for fange.
Requiert your blend file are write on your hard-drive."""
bl_idname = 'graou.building_export'
bl_label = 'Easily export a building asset'
def __init__(self):
self.coll_layout = bpy.data.collections.get('Placeholder')
self.asset = get_asset_name()
self.category = get_export_path()
self.instance_type_dict = {}
self.temp_copy = {}
@classmethod
def poll(cls, context):
col = bpy.data.collections.get('Placeholder')
if col is not None and bpy.data.is_saved:
return True
def execute(self, context):
bpy.ops.object.select_all(action='DESELECT')
# Make a check if the file are saved on the disk
if not bpy.data.is_saved:
self.report({'ERROR'}, 'Your blend file is not saved.')
return {'CANCELLED'}
if not self.category:
self.report({'ERROR'}, 'Can\'t find the asset category.')
return {'CANCELLED'}
if not len(self.coll_layout.children):
self.report({'WARNING'}, 'No children collection, nothing can be exported.')
return {'CANCELLED'}
for coll in self.coll_layout.children:
print(f'[Pipeline] Update "{coll.name}" mesh')
child = bpy.data.collections.get(coll.name)
for ob in child.all_objects:
print(f'\tLook "{ob.name}", his type are "{type(ob.data)}"')
# TODO Support another type object, not only SM/SK
if ob.type == 'MESH' or 'EMPTY' or 'CURVE':
print(f'[Pipeline] Check ob {ob.name} and is type {type(ob)}')
ob.select_set(True)
if ob.type == 'EMPTY':
if ob.instance_type != 'NONE':
self.instance_type_dict[ob.name] = ob.instance_type
ob.instance_type = 'NONE'
if ob.type == 'CURVE':
# Make a new objet with the Geo
bpy.ops.object.convert(target='CURVE')
abs_export = self.category.joinpath(self.asset, "Meshes")
if not abs_export.exists():
abs_export.mkdir(parents=True)
if coll.name != 'Socket':
asset_name = f"SM_{coll.name}.fbx"
else:
asset_name = f"{coll.name}.fbx"
# TODO Use the preset system
bpy.ops.export_scene.fbx(filepath=abs_export.joinpath(asset_name).as_posix(),
use_selection=True,
use_visible=False,
use_active_collection=False,
global_scale=1.0,
apply_unit_scale=True,
apply_scale_options='FBX_SCALE_NONE',
use_space_transform=True,
bake_space_transform=True,
object_types={'MESH', 'EMPTY'},
use_mesh_modifiers=True,
use_mesh_modifiers_render=True,
mesh_smooth_type='OFF',
colors_type='SRGB',
prioritize_active_color=False,
use_subsurf=False,
use_mesh_edges=False,
use_tspace=False,
use_triangles=False,
use_custom_props=False,
add_leaf_bones=True,
primary_bone_axis='Y',
secondary_bone_axis='X',
use_armature_deform_only=False,
armature_nodetype='NULL',
bake_anim=False,
bake_anim_use_all_bones=True,
bake_anim_use_nla_strips=True,
bake_anim_use_all_actions=True,
bake_anim_force_startend_keying=True,
bake_anim_step=1.0,
bake_anim_simplify_factor=1.0,
path_mode='AUTO',
embed_textures=False,
batch_mode='OFF',
use_batch_own_dir=True,
axis_forward='X',
axis_up='Y'
)
print(f'[Pipeline] Export here "{abs_export}"')
bpy.ops.object.select_all(action='DESELECT')
self.set_instance_type()
self.report({'INFO'}, 'Placeholder exported')
return {'FINISHED'}
def set_instance_type(self):
for key, value in self.instance_type_dict.items():
ob = bpy.data.objects.get(key)
ob.instance_type = value
self.instance_type_dict.clear()
+64
View File
@@ -0,0 +1,64 @@
import bpy
from pathlib import Path
class ConfigLighting(bpy.types.Operator):
"""Add or conform a lighting build"""
bl_idname = 'graou.lighting'
bl_label = 'Config or update a lighting'
def execute(self, context):
# Look if a light object are in the scene to clear
self.clear_light_on_scene()
r = self.get_blend_resources_file()
world = bpy.data.worlds.get('WorldIconRendering')
if not world:
with bpy.data.libraries.load(r, link=True) as (data_from, data_to):
data_to.worlds = data_from.worlds
world = bpy.data.worlds.get('WorldIconRendering')
context.scene.world = world
if not bpy.data.collections.get('Lighting'):
print(f'[Pipeline] Need to import the lighting collection')
with bpy.data.libraries.load(r, link=False) as (data_from, data_to):
for collection in data_from.collections:
print(f'[Pipeline] Collection can be import "{collection}"')
if 'Lighting' in collection:
print(f'[Pipeline] Append {collection}.')
data_to.collections.append(collection)
print('[Pipeline] Link lighting collection with the scene collection')
bpy.data.collections['Scene'].children.link(bpy.data.collections.get('Lighting'))
return {'FINISHED'}
@staticmethod
def get_blend_resources_file():
"""Get the blend file shared with the addon"""
addon_folder = Path(bpy.utils.user_resource('SCRIPTS'))
addon_name = __name__.split(".")[0]
return addon_folder.joinpath("addons", addon_name, "resources", "Lighting.blend").as_posix()
def clear_light_on_scene(self):
bpy.ops.object.select_all(action='DESELECT')
for ob in bpy.data.objects:
if ob.type == 'LIGHT' and not self.find_collection(ob):
ob.select_set(True)
bpy.ops.object.delete()
else:
ob.select_set(False)
@staticmethod
def find_collection(ob, name='Lighting'):
"""Check if an object are attached with the Lighting collection"""
for collection in ob.users_collection:
if collection.name == name:
return True
@@ -11,4 +11,5 @@ class MakeBasicCollision(bpy.types.Operator):
return bpy.context.object
def execute(self, context):
# TODO
return {'FINISHED'}
+92
View File
@@ -0,0 +1,92 @@
import bpy
from ..properties.models import Outline
class ConfigBlendScene(bpy.types.Operator):
"""
This operator init a news blend file, or update it.
Prepare a set of collection (from the models in `properties/models/Outline`.
Hierarchy design give that:
- Placeholder
| ${StaticMesh}
| Socket (Optional)
- Icon
- Game Object
"""
bl_idname = 'graou.build_scene'
bl_label = 'Config or update the outline'
def __init__(self):
self._outline = Outline()
# Main property
self._settings = bpy.context.scene.graou_props
self._socket = self._settings.socket_collection
def execute(self, context):
for key, value in self._outline.collections.items():
collection = bpy.data.collections.get(key)
# Make the collection if this item not exist
if collection is None:
collection = bpy.data.collections.new(value.name)
context.scene.collection.children.link(collection)
# Check if the color are correctly setup, if not update-it
if collection.color_tag is not value.color:
collection.color_tag = value.color
# Check child collection color
if collection.children:
for child in collection.children:
if isinstance(child, bpy.types.Collection):
child.color_tag = value.color
# Set or update socket collection
if self._socket:
self.set_socket_collection()
else:
self.del_socket_collection()
return {'FINISHED'}
def set_socket_collection(self):
"""Make or update the socket collection"""
col_socket = bpy.data.collections.get(self._outline.socket.name)
col_placeholder = self._outline.get_placeholder_collection
col_game_object = self._outline.get_game_object_collection
if col_socket is None:
col_socket = bpy.data.collections.new(self._outline.socket.name)
# Attach to Placeholder and Game Icon if they collection exist
if col_placeholder.children.get(self._outline.socket.name) is None:
col_placeholder.children.link(col_socket)
if col_game_object.children.get(self._outline.socket.name) is None:
col_game_object.children.link(col_socket)
# Set the COLOR Tag
col_socket.color_tag = self._outline.socket.color
def del_socket_collection(self):
"""Remove the socket collection, however, if the collection doesn't exist, terminate the function"""
socket = bpy.data.collections.get(self._outline.socket.name)
if socket is not None:
bpy.data.collections.remove(socket)
class SetCollectionSocket(bpy.types.Operator):
"""Configure a/the collection with socket param"""
bl_idname = 'graou.collection.socket_setup'
bl_label = 'Set param to be socket functional'
def __init__(self):
self.socket = bpy.data.collections.get('Socket')
def execute(self, context):
# TODO
return {'FINISHED'}
+44
View File
@@ -0,0 +1,44 @@
import bpy
from ..utils import get_export_path, get_asset_name
from pathlib import Path
class ConfigRendering(bpy.types.Operator):
"""Setup camera and rendering config"""
bl_idname = 'graou_config.rendering_thumbnail'
bl_label = 'Setup the blend file to be ready'
def __init__(self):
self.scene = bpy.data.scenes['Scene']
self.path_export = get_export_path()
self.asset_name = get_asset_name()
self.filename_export = Path(self.path_export, self.asset_name, f'TX_Icon{self.asset_name}.tga')
def execute(self, context):
self.set_camera_used()
self.set_rendering_panel()
self.set_output_file()
bpy.ops.render.render(write_still=True, use_viewport=True)
return {'FINISHED'}
def set_rendering_panel(self):
self.scene.render.engine = 'BLENDER_EEVEE'
self.scene.eevee.use_gtao = True
self.scene.eevee.use_ssr = True
self.scene.render.use_high_quality_normals = True
self.scene.render.film_transparent = True
def set_output_file(self):
self.scene.render.resolution_x = self.scene.render.resolution_y = 512
self.scene.render.image_settings.file_format = 'TARGA'
self.scene.render.image_settings.color_mode = 'RGBA'
self.scene.render.filepath = self.filename_export.as_posix()
def set_camera_used(self):
"""Find the best camera position"""
# TODO
pass
+10
View File
@@ -0,0 +1,10 @@
import bpy
class FangeProperties(bpy.types.PropertyGroup):
socket_collection: bpy.props.BoolProperty(
name='State Socket use',
description='Use the socket collection setup',
default=False
)
@@ -49,7 +49,25 @@ class Outline:
'Game Object': Collection(name='Game Object', color='COLOR_05')
}
self._socket = Collection(name='Socket', color='NONE')
@property
def collections(self) -> [str]:
"""Returns all collections in a dict"""
return self._collections
@property
def get_placeholder_collection(self):
return bpy.data.collections.get(self.collections['Placeholder'].name)
@property
def get_icon_collection(self):
return bpy.data.collections.get(self.collections['Icon'].name)
@property
def get_game_object_collection(self):
return bpy.data.collections.get(self.collections['Game Object'].name)
@property
def socket(self) -> Collection:
return self._socket
Binary file not shown.
View File
+12
View File
@@ -0,0 +1,12 @@
from .main import GraouPanel
class GraouPanel_asset(GraouPanel):
bl_idname = 'GRAOU_PT_asset'
bl_label = 'Generate Assets'
def draw(self, context):
layout = self.layout
layout.label(text='Asset:')
layout.operator('graou.make_collision', text='Generate collision', icon='MOD_PHYSICS')
+14
View File
@@ -0,0 +1,14 @@
from .main import GraouPanel
class GRAOU_PT_export(GraouPanel):
bl_idname = 'GRAOU_PT_MAIN'
bl_label = 'Export'
def draw(self, context):
layout = self.layout
layout.label(text='Export scene:')
box = layout.box()
box.label(text='Sanity Check')
layout.operator('graou.building_export', text='Export Placeholder', icon='EXPORT')
+13
View File
@@ -0,0 +1,13 @@
from .main import GraouPanel
class GraouPanel_thumbnail(GraouPanel):
bl_idname = 'GRAOU_PT_thumbnail'
bl_label = 'Thumbnail'
def draw(self, context):
layout = self.layout
layout.label(text='Thumbnail:')
layout.operator('graou_config.rendering_thumbnail', text='Generate Thumbnail', icon='FILE_IMAGE')
# TODO Add the thumbnail view
Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

+25
View File
@@ -0,0 +1,25 @@
import bpy
# import os
# from pathlib import Path
#
# preview_collection = {}
# icon_sauropod_path = Path(os.path.dirname(os.path.abspath(__file__)), "icons")
#
# pcoll = bpy.utils.previews.new()
#
# for entry in os.scandir(icon_sauropod_path):
# if entry.name.endswith(".png"):
# name = os.path.splitext(entry.name)[0]
# print(f'[Pipeline] Add icon "{name}"')
# pcoll.load(name.upper(), entry.path, "IMAGE")
# layout.label(text='Graou Pipeline', icon_value=pcoll["GRAOU"].icon_id)
class GraouPanel(bpy.types.Panel):
bl_idname = 'GRAOU_PT_MAIN'
bl_space_type = 'VIEW_3D'
bl_region_type = 'UI'
bl_label = 'Export'
bl_category = 'Graou Studio'
+15
View File
@@ -0,0 +1,15 @@
from .main import GraouPanel
class GRAOU_PT_setup(GraouPanel):
bl_idname = 'GRAOU_PT_setup'
bl_label = 'Setup Pipeline'
def draw(self, context):
layout = self.layout
col = layout.column(align=True)
col.label(text='Main Config:')
col.operator('graou.build_scene', text='Init Scene', icon='OUTLINER')
col.prop(context.scene.graou_props, 'socket_collection', text='Use socket', toggle=True)
col.operator('graou.lighting', text='Set basic lighting', icon='OUTLINER_OB_LIGHT')
+46
View File
@@ -0,0 +1,46 @@
import bpy
from .properties.models import FangeProject
from pathlib import Path
def get_export_preset():
"""
Select a FBX preset you want use.
"""
# TODO Subdir need to be exposed
fbx_preset_paths = bpy.utils.preset_paths(r"operator\export_scene.fbx")
# TODO Preset name need to be exposed
fbx_preset = Path(fbx_preset_paths[0], "sm-unity-building.py")
if fbx_preset_paths:
print(f'[Pipeline] Get the preset path "{fbx_preset}"')
return fbx_preset
else:
print(f'[Pipeline] Preset folder not found')
def get_export_path():
"""Look the file path, to understand if the asset are a Character, Buildings or Props"""
abs_blend_path = Path(bpy.data.filepath)
game_path = FangeProject()
if 'Buildings' in abs_blend_path.parts:
return game_path.buildings
elif 'Props' in abs_blend_path.parts:
return game_path.props
elif 'Characters' in abs_blend_path.parts:
return game_path.characters
else:
return Path()
def get_asset_name() -> str:
"""From the .blend file, return the blend name."""
abs_blend_path = Path(bpy.data.filepath)
return abs_blend_path.stem