Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-11-15 16:11:40 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-11-15 16:11:40 +0300
commit070f38a6d036068b56d0bf3c9e1f58b1724cc21b (patch)
treee2b5f07b34cc294cdc91b82173c58c389adfd842 /release/scripts/modules/bpy_types.py
parentb9b95be37438198fc484e37fc240114111216175 (diff)
bugfix [#24696] Export OBJ - Selection Only toggle button has the wrong default state.
Added convenience function to operators, 'as_keywords()', so operator settings can be passed directly to a function as keyword arguments. The problem in this case was that dictionary access to operator properties was not returning rna-property defaults, so as_keywords() ensures all defaults are set.
Diffstat (limited to 'release/scripts/modules/bpy_types.py')
-rw-r--r--release/scripts/modules/bpy_types.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py
index 6c1c86c3eae..31450031c6b 100644
--- a/release/scripts/modules/bpy_types.py
+++ b/release/scripts/modules/bpy_types.py
@@ -660,6 +660,12 @@ class Operator(StructRNA, metaclass=OrderedMeta):
return delattr(properties, attr)
return super().__delattr__(attr)
+ def as_keywords(self, ignore=()):
+ """ Return a copy of the properties as a dictionary.
+ """
+ ignore = ignore + ("rna_type",)
+ return {attr: getattr(self, attr) for attr in self.properties.rna_type.properties.keys() if attr not in ignore}
+
class Macro(StructRNA, metaclass=OrderedMeta):
# bpy_types is imported before ops is defined