Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions baker.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,19 @@ class Baker(PropertyGroup):

def initialize(self):
"""Initialize baker instance after creation in PropertyCollection."""
# NOTE: engine property must exist on class for all instances
if not hasattr(self.__class__, 'engine'):
self.__class__.engine = EnumProperty(
name='Render Engine',
items=self.__class__.SUPPORTED_ENGINES,
update=self.__class__.apply_render_settings
)

if self.index != -1:
return
self.set_available_index()
self.node_setup()

# NOTE: Unique due to dynamic items/enum
self.__class__.engine = EnumProperty(
name='Render Engine',
items=self.__class__.SUPPORTED_ENGINES,
update=self.__class__.apply_render_settings
)

self.node_input = None
self.node_output = None
if len(self.REQUIRED_SOCKETS) > 0 or self.ID == 'custom':
Expand Down Expand Up @@ -160,9 +161,10 @@ def draw(self, context: Context, layout: UILayout):
col_set.prop(self, 'reimport')
col_set.prop(self, 'disable_filtering')
prop = 'samples'
if self.engine == 'blender_workbench':
engine = getattr(self, 'engine', None)
if engine == 'blender_workbench':
prop = 'samples_workbench'
elif self.engine == 'cycles':
elif engine == 'cycles':
prop = 'samples_cycles'
col_set.prop(self, prop, text='Samples')
col_set.prop(self, 'contrast')
Expand Down Expand Up @@ -345,7 +347,7 @@ def draw_properties(self, context: Context, layout: UILayout):
col = layout.column()
col.prop(self, 'flip_y')
if context.scene.gd.engine == 'grabdoc':
if self.engine == 'cycles':
if getattr(self, 'engine', None) == 'cycles':
col.prop(self, 'bevel_weight')

def update_flip_y(self, _context: Context):
Expand Down