diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-02-23 18:34:02 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-02-23 18:34:02 +0300 |
commit | 9e2e528c36c4e01ff2fd88250d81d32733e675eb (patch) | |
tree | a0c5472124943ee50b67dad8aacd0898d947402a | |
parent | 78bb45931ca6dbb51833e44efe99ed7ed2240412 (diff) |
- finally a way to force removal of images (Shift+Click on the X)
- generic modal operator now works with int's
-rw-r--r-- | release/scripts/op/wm.py | 5 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_templates.c | 6 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_access.c | 1 |
3 files changed, 9 insertions, 3 deletions
diff --git a/release/scripts/op/wm.py b/release/scripts/op/wm.py index f033efc6b69..4325475c130 100644 --- a/release/scripts/op/wm.py +++ b/release/scripts/op/wm.py @@ -338,7 +338,10 @@ class WM_OT_context_modal_mouse(bpy.types.Operator): path_item = self.properties.path_item for item, value_orig in self._values.items(): - exec("item.%s = %s" % (path_item, value_orig + delta)) + if type(value_orig) == int: + exec("item.%s = int(%d)" % (path_item, round(value_orig + delta))) + else: + exec("item.%s = %f" % (path_item, value_orig + delta)) def _values_restore(self): path_item = self.properties.path_item diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 0c44b15296a..e2804efe040 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -284,6 +284,10 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event) memset(&idptr, 0, sizeof(idptr)); RNA_property_pointer_set(&template->ptr, template->prop, idptr); RNA_property_update(C, &template->ptr, template->prop); + + if(id && CTX_wm_window(C)->eventstate->shift) /* useful hidden functionality, */ + id->us= 0; + break; case UI_ID_FAKE_USER: if(id) { @@ -450,7 +454,7 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str but= uiDefIconButO(block, BUT, unlinkop, WM_OP_INVOKE_REGION_WIN, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL); } else { - but= uiDefIconBut(block, BUT, 0, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL); + but= uiDefIconBut(block, BUT, 0, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, "Unlink datablock, Shift + Click to force removal on save"); uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_DELETE)); if(RNA_property_flag(template->prop) & PROP_NEVER_NULL) diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 3aa1576dc80..9176dcf0334 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -1145,7 +1145,6 @@ int RNA_property_editable(PointerRNA *ptr, PropertyRNA *prop) int RNA_property_editable_flag(PointerRNA *ptr, PropertyRNA *prop) { - ID *id= ptr->id.data; int flag; prop= rna_ensure_property(prop); |