generated from stilobique/BlenderTemplate
Setup thumbnail param
Update export to find export path without the operator
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import bpy
|
import bpy
|
||||||
|
|
||||||
from ..properties.models import FangeProject
|
from ..properties.models import FangeProject
|
||||||
|
from ..utils import get_export_path, get_asset_name
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
@@ -12,9 +13,8 @@ Requiert your blend file are write on your hard-drive."""
|
|||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.coll_layout = bpy.data.collections.get('Placeholder')
|
self.coll_layout = bpy.data.collections.get('Placeholder')
|
||||||
self.path = FangeProject()
|
self.asset = get_asset_name()
|
||||||
self.asset = self.get_asset_name()
|
self.category = get_export_path()
|
||||||
self.category = self.get_asset_type()
|
|
||||||
|
|
||||||
self.instance_type_dict = {}
|
self.instance_type_dict = {}
|
||||||
self.temp_copy = {}
|
self.temp_copy = {}
|
||||||
@@ -120,32 +120,6 @@ Requiert your blend file are write on your hard-drive."""
|
|||||||
self.report({'INFO'}, 'Placeholder exported')
|
self.report({'INFO'}, 'Placeholder exported')
|
||||||
return {'FINISHED'}
|
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)
|
|
||||||
|
|
||||||
if 'Buildings' in abs_blend_path.parts:
|
|
||||||
print(f'[Pipeline] Export here "{self.path.buildings}"')
|
|
||||||
return self.path.buildings
|
|
||||||
|
|
||||||
elif 'Props' 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() -> str:
|
|
||||||
"""From the .blend file, return the blend name."""
|
|
||||||
abs_blend_path = Path(bpy.data.filepath)
|
|
||||||
return abs_blend_path.stem
|
|
||||||
|
|
||||||
def set_instance_type(self):
|
def set_instance_type(self):
|
||||||
for key, value in self.instance_type_dict.items():
|
for key, value in self.instance_type_dict.items():
|
||||||
ob = bpy.data.objects.get(key)
|
ob = bpy.data.objects.get(key)
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import bpy
|
import bpy
|
||||||
|
|
||||||
|
from ..utils import get_export_path, get_asset_name
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
@@ -11,6 +12,10 @@ class ConfigRendering(bpy.types.Operator):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.scene = bpy.data.scenes['Scene']
|
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):
|
def execute(self, context):
|
||||||
self.set_camera_used()
|
self.set_camera_used()
|
||||||
self.set_rendering_panel()
|
self.set_rendering_panel()
|
||||||
@@ -27,7 +32,8 @@ class ConfigRendering(bpy.types.Operator):
|
|||||||
|
|
||||||
def set_output_file(self):
|
def set_output_file(self):
|
||||||
self.scene.render.resolution_x = self.scene.render.resolution_y = 512
|
self.scene.render.resolution_x = self.scene.render.resolution_y = 512
|
||||||
self.scene.render.filepath = Path()
|
self.scene.render.image_settings.file_format = 'TARGA'
|
||||||
|
self.scene.render.filepath = self.filename_export.as_posix()
|
||||||
|
|
||||||
def set_camera_used(self):
|
def set_camera_used(self):
|
||||||
"""Find the best camera position"""
|
"""Find the best camera position"""
|
||||||
|
|||||||
@@ -10,3 +10,4 @@ class GraouPanel_thumbnail(GraouPanel):
|
|||||||
|
|
||||||
layout.label(text='Thumbnail:')
|
layout.label(text='Thumbnail:')
|
||||||
layout.operator('graou_config.rendering_thumbnail', text='Generate Thumbnail', icon='FILE_IMAGE')
|
layout.operator('graou_config.rendering_thumbnail', text='Generate Thumbnail', icon='FILE_IMAGE')
|
||||||
|
# TODO Add the thumbnail view
|
||||||
|
|||||||
+23
-5
@@ -1,5 +1,6 @@
|
|||||||
import bpy
|
import bpy
|
||||||
|
|
||||||
|
from .properties.models import FangeProject
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
@@ -21,8 +22,25 @@ def get_export_preset():
|
|||||||
print(f'[Pipeline] Preset folder not found')
|
print(f'[Pipeline] Preset folder not found')
|
||||||
|
|
||||||
|
|
||||||
def apply_mesh_and_join():
|
def get_export_path():
|
||||||
"""
|
"""Look the file path, to understand if the asset are a Character, Buildings or Props"""
|
||||||
This function make a new mesh with all selected asset.
|
abs_blend_path = Path(bpy.data.filepath)
|
||||||
"""
|
game_path = FangeProject()
|
||||||
pass
|
|
||||||
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user