Force Reloading of Assets
Check against existing requests
- [X] I have checked existing feature requests, and my idea is different
Describe the context
Right now MCprep seems to have issues with some assets (mostly effects) not loading in properly. It's been found that a lot of times, opening a new file helps with the issue.
My guess is that it's due to something happening with MCprep's properties, so it would be nice to force reload them
How do you imagine your feature works?
An operator in the advanced panel that allows force reloading
What existing workaround (or closest thing to a workaround) do you have today (within Blender, MCprep, or any software)? If there is no workaround, explain why you feel this way.
Right now, the following Python script has to be created:
import bpy
class GU_OT_property_remove_all_in_file(bpy.types.Operator):
bl_idname = "property.remove_all_in_file"
bl_label = "Remove ALL Custom Properties from the file"
bl_options = {"REGISTER", "UNDO"}
def execute(self, context):
for attr in dir(bpy.data):
if "bpy_prop_collection" in str(type(getattr(bpy.data, attr))):
for obj in getattr(bpy.data, attr):
for custom_prop_name in list(obj.keys()):
del obj[custom_prop_name]
return {"FINISHED"}
if __name__ == "__main__":
bpy.utils.register_class(GU_OT_property_remove_all_in_file)
Which removes all properties from the file. This makes MCprep think the file is new, allowing assets to be reloaded
Commenting here so that the convo is line.
@TheDuckCow To be honest, I'm not sure I'm totally following what the force reload script is fixing for.
@StandingPadAnimations In files where assets have been loaded in, it's not possible to reload assets, hence force reloading
Is this just a UI problem then? The reload assets button is only there as a consequence of not pre-assigning values to assets. But there are always "reload X" in the advanced preferences underneath. If a user needs to reload these or something isn't showing up, that should be the action they take. I could understand the argument of putting a refresh icon more prominently if needed instead of only under "advanced". Let me know if that's not actually solving the problem at hand.
Is this just a UI problem then? The reload assets button is only there as a consequence of not pre-assigning values to assets. But there are always "reload X" in the advanced preferences underneath. If a user needs to reload these or something isn't showing up, that should be the action they take.
Yeah I think it's a UI problem then
Ok - would rather we resolve that than add other code. In your mind, what solutions do you think we have? We could add a little reload icon further up so it's next to each of the (?)'s or something like that in each of the spawner panels.
Coming back to this - there actually already is a bpy.ops.mcprep.reload_effects() reload operator in the advanced panel of the effects spawner. Are you aware if pressing this button doesn't already work? Or is it just a discoverability issue?
Are you aware if pressing this button doesn't already work? Or is it just a discoverability issue?
Discoverability, I've never seen this button until now