Closed KirilStrezikozin closed 5 months ago
Preset saving works correctly, I can see that a mixed-caps batch name was written down in a bake output preset example below generated in 2.6.2:
import bpy
bm_item = bpy.context.scene.bm_table_of_objects[bpy.context.scene.bm_props.global_active_index]
bm_item.bake_save_internal = True
bm_item.bake_output_filepath = ''
bm_item.bake_create_subfolder = False
bm_item.bake_subfolder_name = 'Maps'
bm_item.bake_batchname = 'T_$materialname_$mapname'
bm_item.bake_batchname_use_caps = False
bm_item.bake_create_material = False
bm_item.bake_assign_modifiers = True
bm_item.bake_device = 'CPU'
bm_item.bake_view_from = 'ABOVE_SURFACE'
bm_item.bake_hide_when_inactive = True
bm_item.bake_vg_index = 0
Interesting. The batch name value gets transformed to lowercase exactly at https://github.com/KirilStrezikozin/BakeMaster-Blender-Addon/blob/acf0b5b1b9dc1f2d77e06d0ac4fbb2b2a74e6808/presets.py#L1548
With a small debug test, the following sample:
print(bpy.data.scenes["Scene"].bm_table_of_objects[1].bake_batchname)
bpy.utils.execfile(filepath)
print(bpy.data.scenes["Scene"].bm_table_of_objects[1].bake_batchname)
Produces:
T_$materialname_$mapname
t_$materialname_$mapname
There is nothing wrong with batchname's update.
The reason for batch name turning to lowercase on preset load is because batchname_use_caps
was doing batchanme.lower()
on update. batchname_use_caps
is also written after batchname
, hence it changes batchname
's value.
My solution is to update batchname
to uppercase only if batchname_use_caps
is True
, otherwise do nothing. Also, set batchname_use_caps
to False
whenever the batchname
is no longer in uppercase.
This bug report is:
Describe the bug __mike_fr__ reported on Discord:
To Reproduce Steps to reproduce the behavior:
Expected behavior Mixed cap letters should be allowed in BakeMaster's batch name. The batch name itself does, but presets miss it.
Screenshots Not relevant for now.
Desktop (please complete the following information):