Write a basic operator to generate the thumbnail

This commit is contained in:
2024-06-06 22:03:56 +02:00
parent 83d321c69d
commit c61ba477ad
3 changed files with 37 additions and 1 deletions
+2 -1
View File
@@ -10,6 +10,7 @@ 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
@@ -28,7 +29,7 @@ bl_info = {
modules_class = [
# Main operators property
ExportForFange, MakeBasicCollision, ConfigBlendScene, ConfigLighting,
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
+34
View File
@@ -0,0 +1,34 @@
import bpy
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']
def execute(self, context):
self.set_camera_used()
self.set_rendering_panel()
self.set_output_file()
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.filepath = Path()
def set_camera_used(self):
"""Find the best camera position"""
pass
+1
View File
@@ -9,3 +9,4 @@ class GraouPanel_thumbnail(GraouPanel):
layout = self.layout
layout.label(text='Thumbnail:')
layout.operator('graou_config.rendering_thumbnail', text='Generate Thumbnail', icon='FILE_IMAGE')