Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Global/Bake Output presets cannot store batch names with mixed caps #90

Closed
2 tasks done
KirilStrezikozin opened this issue Mar 18, 2024 · 5 comments · Fixed by #92
Closed
2 tasks done

BUG: Global/Bake Output presets cannot store batch names with mixed caps #90

KirilStrezikozin opened this issue Mar 18, 2024 · 5 comments · Fixed by #92
Assignees
Labels
bug your old lawnmower broke down solved How could you? GPT helped?

Comments

@KirilStrezikozin
Copy link
Owner

KirilStrezikozin commented Mar 18, 2024

This bug report is:

  • not a duplicate
  • fixed

Describe the bug
mike_fr reported on Discord:

The global preset does not store my [batch name] preference, it stores the letter but not if it is uppercase or lowercase - so maybe it is the reason I thought you cannot mix uppercase and lowercase. So there is a bug in preset storing.

To Reproduce
Steps to reproduce the behavior:

  1. Use T-$objectname_$mapname
  2. Save the preset (global)
  3. Load the preset
  4. Bug: you get t-$objectname_$mapname

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):

  • OS Any
  • Blender Version 4.0.2
  • BakeMaster Version <= 2.6.2
@KirilStrezikozin KirilStrezikozin added the bug your old lawnmower broke down label Mar 18, 2024
@KirilStrezikozin KirilStrezikozin self-assigned this Mar 18, 2024
@KirilStrezikozin KirilStrezikozin added this to the BakeMaster 2.6.3 milestone Mar 18, 2024
@KirilStrezikozin KirilStrezikozin added the in progress All night I stay not sleeping because I'm thinking about this label Mar 18, 2024
@KirilStrezikozin
Copy link
Owner Author

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

@KirilStrezikozin
Copy link
Owner Author

Interesting. The batch name value gets transformed to lowercase exactly at

bpy.utils.execfile(filepath)

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

@KirilStrezikozin
Copy link
Owner Author

There is nothing wrong with batchname's update.

@KirilStrezikozin
Copy link
Owner Author

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.

@KirilStrezikozin
Copy link
Owner Author

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.

KirilStrezikozin added a commit that referenced this issue Mar 18, 2024
… to False when not batchname.isupper() on batchname udpate

related: #90
@KirilStrezikozin KirilStrezikozin added solved How could you? GPT helped? close on release done here, but let's wait for the release migrate: public->dev I'm doing cps now until I manage my repos better. and removed in progress All night I stay not sleeping because I'm thinking about this migrate: public->dev I'm doing cps now until I manage my repos better. labels Mar 18, 2024
@KirilStrezikozin KirilStrezikozin removed the close on release done here, but let's wait for the release label Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug your old lawnmower broke down solved How could you? GPT helped?
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant