Operator preset save doesn't serialize PropertyGroups *Postponed after 2.63 release*, PATCH ATTACHED. #30905

Closed
opened 2012-04-11 08:23:06 +02:00 by Julien Rivaud · 7 comments

%%%When an operator has a PropertyGroup property (either via a PointerProperty or a CollectionProperty), then preset save (bpy.ops.wm.operator_preset_add) doesn's serialize the PropertyGroup but rather uses its "repr()", which means the preset file then contains 'op.item = <bpy_struct, Item("")>'

Steps to reproduce:

  • Open attached blend (only thing different from factory settings is the script)
  • Run the "Object Operator" operator (via space bar search)
  • Save a preset
  • Look at the produced file, or try to load back the preset

Expected result:
The property group is serialized as a dict

I do not have much time currently but I might write a patch, I found where the preset save is and it is straight python.%%%

%%%When an operator has a PropertyGroup property (either via a PointerProperty or a CollectionProperty), then preset save (bpy.ops.wm.operator_preset_add) doesn's serialize the PropertyGroup but rather uses its "repr()", which means the preset file then contains 'op.item = <bpy_struct, Item("")>' Steps to reproduce: - Open attached blend (only thing different from factory settings is the script) - Run the "Object Operator" operator (via space bar search) - Save a preset - Look at the produced file, or try to load back the preset Expected result: The property group is serialized as a dict I do not have much time currently but I might write a patch, I found where the preset save is and it is straight python.%%%
Author

Changed status to: 'Open'

Changed status to: 'Open'

%%%This is a known limitation, would be nice to add support though.%%%

%%%This is a known limitation, would be nice to add support though.%%%
Author

%%%At least the system shouldn't create erroneous python scripts. Currently it syntay errors%%%

%%%At least the system shouldn't create erroneous python scripts. Currently it syntay errors%%%
Author

%%%I wrote a patch, attached here.

Can you review it (coding style, walking method, ...) ? Thanks.%%%

%%%I wrote a patch, attached here. Can you review it (coding style, walking method, ...) ? Thanks.%%%

%%%Thanks for writing the patch, will check after release.%%%

%%%Thanks for writing the patch, will check after release.%%%

%%%applied fix based on your patch r46560.

closing.%%%

%%%applied fix based on your patch r46560. closing.%%%

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#30905
No description provided.