- finally a way to force removal of images (Shift+Click on the X)
authorCampbell Barton <ideasman42@gmail.com>
Tue, 23 Feb 2010 15:34:02 +0000 (15:34 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 23 Feb 2010 15:34:02 +0000 (15:34 +0000)
- generic modal operator now works with int's

release/scripts/op/wm.py
source/blender/editors/interface/interface_templates.c
source/blender/makesrna/intern/rna_access.c

index f033efc..4325475 100644 (file)
@@ -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
index 0c44b15..e2804ef 100644 (file)
@@ -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)
index 3aa1576..9176dcf 100644 (file)
@@ -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);