Remove NO_CONTEXT flag from enum when copying operator properties to the operator itself.
This commit is contained in:
@@ -217,7 +217,7 @@ int WM_operator_name_call (struct bContext *C, const char *opstring, int
|
||||
int WM_operator_call_py(struct bContext *C, struct wmOperatorType *ot, int context, struct PointerRNA *properties, struct ReportList *reports);
|
||||
|
||||
void WM_operator_properties_alloc(struct PointerRNA **ptr, struct IDProperty **properties, const char *opstring); /* used for keymap and macro items */
|
||||
void WM_operator_properties_sanitize(struct PointerRNA *ptr); /* make props not context sensitive */
|
||||
void WM_operator_properties_sanitize(struct PointerRNA *ptr, int val); /* make props context sensitive or not */
|
||||
void WM_operator_properties_create(struct PointerRNA *ptr, const char *opstring);
|
||||
void WM_operator_properties_create_ptr(struct PointerRNA *ptr, struct wmOperatorType *ot);
|
||||
void WM_operator_properties_free(struct PointerRNA *ptr);
|
||||
|
||||
@@ -512,6 +512,8 @@ static wmOperator *wm_operator_create(wmWindowManager *wm, wmOperatorType *ot, P
|
||||
motherop= NULL;
|
||||
}
|
||||
|
||||
WM_operator_properties_sanitize(op->ptr, 0);
|
||||
|
||||
return op;
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
static void keymap_properties_set(wmKeyMapItem *kmi)
|
||||
{
|
||||
WM_operator_properties_alloc(&(kmi->ptr), &(kmi->properties), kmi->idname);
|
||||
WM_operator_properties_sanitize(kmi->ptr);
|
||||
WM_operator_properties_sanitize(kmi->ptr, 1);
|
||||
}
|
||||
|
||||
void WM_keymap_properties_reset(wmKeyMapItem *kmi)
|
||||
|
||||
@@ -391,7 +391,7 @@ wmOperatorTypeMacro *WM_operatortype_macro_define(wmOperatorType *ot, const char
|
||||
|
||||
/* do this on first use, since operatordefinitions might have been not done yet */
|
||||
WM_operator_properties_alloc(&(otmacro->ptr), &(otmacro->properties), idname);
|
||||
WM_operator_properties_sanitize(otmacro->ptr);
|
||||
WM_operator_properties_sanitize(otmacro->ptr, 1);
|
||||
|
||||
BLI_addtail(&ot->macro, otmacro);
|
||||
|
||||
@@ -593,12 +593,15 @@ void WM_operator_properties_alloc(PointerRNA **ptr, IDProperty **properties, con
|
||||
|
||||
}
|
||||
|
||||
void WM_operator_properties_sanitize(PointerRNA *ptr)
|
||||
void WM_operator_properties_sanitize(PointerRNA *ptr, int val)
|
||||
{
|
||||
RNA_STRUCT_BEGIN(ptr, prop) {
|
||||
switch(RNA_property_type(prop)) {
|
||||
case PROP_ENUM:
|
||||
RNA_def_property_flag(prop, PROP_ENUM_NO_CONTEXT);
|
||||
if (val)
|
||||
RNA_def_property_flag(prop, PROP_ENUM_NO_CONTEXT);
|
||||
else
|
||||
RNA_def_property_clear_flag(prop, PROP_ENUM_NO_CONTEXT);
|
||||
break;
|
||||
case PROP_POINTER:
|
||||
{
|
||||
@@ -607,7 +610,7 @@ void WM_operator_properties_sanitize(PointerRNA *ptr)
|
||||
/* recurse into operator properties */
|
||||
if (RNA_struct_is_a(ptype, &RNA_OperatorProperties)) {
|
||||
PointerRNA opptr = RNA_property_pointer_get(ptr, prop);
|
||||
WM_operator_properties_sanitize(&opptr);
|
||||
WM_operator_properties_sanitize(&opptr, val);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user