CurtisN
(CurtisN)
April 5, 2015, 1:47pm
1
hello,
I have set some properties for a dialog box in python
and I wanted to know if there was a way to save them so I dont have to change these values everytime I run the script
class PickupTextureDialog(bpy.types.Operator):
...
imagesEnum = EnumProperty(name="imagesEnum",items = _images)
deleteImages = BoolProperty(name = "deleteImages", description = "delete images ?") ;
subDivisions = IntProperty(name = "subDivisions", description = "subdivisions") ;
saveImages = BoolProperty(name = "saveImages", description = "save images ?") ;
thanks
Mackraken
(Mackraken)
April 5, 2015, 2:49pm
2
I think there is, using bl_options, values are saved per session. When you start over blender will reset to their default values.
class MyOperator(bpy.types.Operator):
bl_idname = "mesh.do_something"
bl_label = "My ausum operator"
bl_options = {"REGISTER", "UNDO"} (check bl_options reference)
myprop = StringProperty(default = "Hey there")
CurtisN
(CurtisN)
April 5, 2015, 2:55pm
3
presets ?
bl_optionsOptions for this operator type
REGISTER Register, Display in the info window and support the redo toolbar panel.
UNDO Undo, Push an undo event (needed for operator redo).
BLOCKING Blocking, Block anything else from using the cursor.
MACRO Macro, Use to check if an operator is a macro.
GRAB_POINTER Grab Pointer, Use so the operator grabs the mouse focus, enables wrapping when continuous grab is enabled.
PRESET Preset, Display a preset button with the operators settings.
INTERNAL Internal, Removes the operator from search results.
[TABLE=“class: docutils field-list”]
[TR=“class: field-odd field”]
[TH=“class: field-name”]Type :[/TH]
enum set in {‘REGISTER’, ‘UNDO’, ‘BLOCKING’, ‘MACRO’, ‘GRAB_POINTER’, ‘PRESET’, ‘INTERNAL’}, default {‘REGISTER’}
[/TR]
[/TABLE]
Mackraken
(Mackraken)
April 5, 2015, 3:03pm
4
Can’t tell, or register, cant remember. You can also fake the save by storing the lastest values somewhere, the scene for example and setting them back when the operator is called. “execute” or “invoke”.