forked from bartvdbraak/blender
- finally a way to force removal of images (Shift+Click on the X)
- generic modal operator now works with int's
This commit is contained in:
parent
78bb45931c
commit
9e2e528c36
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user