RNA
* Object has some more properties wrapped, mostly game related. * Scene frame changes now send a notifier. * Added functions to create/free operator properties for calling operators. This also simplifies some duplicated code that did this. Ideally though this kind of thing should use the properties pointer provided by buttons and keymap items. Example code: PointerRNA ptr; WM_operator_properties_create(&ptr, "SOME_OT_name"); RNA_int_set(&ptr, "value", 42); WM_operator_name_call(C, "SOME_OT_name", WM_OP_EXEC_DEFAULT, &ptr); WM_operator_properties_free(&ptr);
This commit is contained in:
@@ -174,7 +174,6 @@ static PyGetSetDef pyop_func_getseters[] = {
|
||||
|
||||
static PyObject * pyop_func_call(BPy_OperatorFunc * self, PyObject *args, PyObject *kw)
|
||||
{
|
||||
IDProperty *properties = NULL;
|
||||
wmOperatorType *ot;
|
||||
|
||||
int error_val = 0;
|
||||
@@ -191,18 +190,16 @@ static PyObject * pyop_func_call(BPy_OperatorFunc * self, PyObject *args, PyObje
|
||||
return NULL;
|
||||
}
|
||||
|
||||
RNA_pointer_create(NULL, NULL, ot->srna, &properties, &ptr);
|
||||
WM_operator_properties_create(&ptr, self->name);
|
||||
|
||||
error_val= PYOP_props_from_dict(&ptr, kw);
|
||||
|
||||
if (error_val==0) {
|
||||
WM_operator_name_call(self->C, self->name, WM_OP_EXEC_DEFAULT, properties);
|
||||
WM_operator_name_call(self->C, self->name, WM_OP_EXEC_DEFAULT, &ptr);
|
||||
}
|
||||
|
||||
if (properties) {
|
||||
IDP_FreeProperty(properties);
|
||||
MEM_freeN(properties);
|
||||
}
|
||||
WM_operator_properties_free(&ptr);
|
||||
|
||||
#if 0
|
||||
/* if there is some way to know an operator takes args we should use this */
|
||||
{
|
||||
|
Reference in New Issue
Block a user