avoid operator type lookups when its known
This commit is contained in:
@@ -2963,7 +2963,7 @@ PointerRNA *uiButGetOperatorPtrRNA(uiBut *but)
|
||||
{
|
||||
if(but->optype && !but->opptr) {
|
||||
but->opptr= MEM_callocN(sizeof(PointerRNA), "uiButOpPtr");
|
||||
WM_operator_properties_create(but->opptr, but->optype->idname);
|
||||
WM_operator_properties_create_ptr(but->opptr, but->optype);
|
||||
}
|
||||
|
||||
return but->opptr;
|
||||
|
||||
@@ -230,7 +230,9 @@ static PyObject *pyop_getrna(PyObject *self, PyObject *value)
|
||||
//RNA_pointer_create(NULL, &RNA_Struct, ot->srna, &ptr);
|
||||
|
||||
/* XXX - should call WM_operator_properties_free */
|
||||
WM_operator_properties_create(&ptr, ot->idname);
|
||||
WM_operator_properties_create_ptr(&ptr, ot);
|
||||
|
||||
|
||||
pyrna= (BPy_StructRNA *)pyrna_struct_CreatePyObject(&ptr);
|
||||
pyrna->freeptr= TRUE;
|
||||
return (PyObject *)pyrna;
|
||||
|
||||
@@ -193,6 +193,7 @@ int WM_operator_call_py(struct bContext *C, struct wmOperatorType *ot, int con
|
||||
|
||||
void WM_operator_properties_alloc(struct PointerRNA **ptr, struct IDProperty **properties, const char *opstring); /* used for keymap and macro items */
|
||||
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);
|
||||
void WM_operator_properties_filesel(struct wmOperatorType *ot, int filter, short type);
|
||||
void WM_operator_properties_gesture_border(wmOperatorType *ot, int extend);
|
||||
|
||||
@@ -466,7 +466,7 @@ char *WM_operator_pystring(bContext *C, wmOperatorType *ot, PointerRNA *opptr, i
|
||||
PropertyRNA *prop_default;
|
||||
char *buf_default;
|
||||
if(!all_args) {
|
||||
WM_operator_properties_create(&opptr_default, ot->idname);
|
||||
WM_operator_properties_create_ptr(&opptr_default, ot);
|
||||
}
|
||||
|
||||
|
||||
@@ -520,12 +520,17 @@ char *WM_operator_pystring(bContext *C, wmOperatorType *ot, PointerRNA *opptr, i
|
||||
return cstring;
|
||||
}
|
||||
|
||||
void WM_operator_properties_create_ptr(PointerRNA *ptr, wmOperatorType *ot)
|
||||
{
|
||||
RNA_pointer_create(NULL, ot->srna, NULL, ptr);
|
||||
}
|
||||
|
||||
void WM_operator_properties_create(PointerRNA *ptr, const char *opstring)
|
||||
{
|
||||
wmOperatorType *ot= WM_operatortype_find(opstring, 0);
|
||||
|
||||
if(ot)
|
||||
RNA_pointer_create(NULL, ot->srna, NULL, ptr);
|
||||
WM_operator_properties_create_ptr(ptr, ot);
|
||||
else
|
||||
RNA_pointer_create(NULL, &RNA_OperatorProperties, NULL, ptr);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user