Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/animation/keyframes_edit.c2
-rw-r--r--source/blender/editors/include/ED_keyframes_edit.h2
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c12
-rw-r--r--source/blender/makesrna/intern/rna_wm.c59
-rw-r--r--source/blender/python/intern/bpy_operator.c4
-rw-r--r--source/blender/python/intern/bpy_operator_wrap.c71
-rw-r--r--source/blender/python/intern/bpy_rna.c12
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c6
8 files changed, 103 insertions, 65 deletions
diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c
index 9476aa479a7..413f01590ed 100644
--- a/source/blender/editors/animation/keyframes_edit.c
+++ b/source/blender/editors/animation/keyframes_edit.c
@@ -562,7 +562,7 @@ short bezt_to_cfraelem(BeztEditData *bed, BezTriple *bezt)
/* used to remap times from one range to another
* requires: bed->data = BeztEditCD_Remap
*/
-short bezt_remap_times(BeztEditData *bed, BezTriple *bezt)
+void bezt_remap_times(BeztEditData *bed, BezTriple *bezt)
{
BeztEditCD_Remap *rmap= (BeztEditCD_Remap*)bed->data;
const float scale = (rmap->newMax - rmap->newMin) / (rmap->oldMax - rmap->oldMin);
diff --git a/source/blender/editors/include/ED_keyframes_edit.h b/source/blender/editors/include/ED_keyframes_edit.h
index 26290d8771c..9e29d747d4a 100644
--- a/source/blender/editors/include/ED_keyframes_edit.h
+++ b/source/blender/editors/include/ED_keyframes_edit.h
@@ -154,7 +154,7 @@ short bezt_to_cfraelem(BeztEditData *bed, struct BezTriple *bezt);
/* used to remap times from one range to another
* requires: bed->custom = BeztEditCD_Remap
*/
-short bezt_remap_times(BeztEditData *bed, struct BezTriple *bezt);
+void bezt_remap_times(BeztEditData *bed, struct BezTriple *bezt);
/* ************************************************ */
/* Destructive Editing API (keyframes_general.c) */
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index bfb7d139074..f174e96120c 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -2102,7 +2102,7 @@ static int sequencer_meta_make_exec(bContext *C, wmOperator *op)
Sequence *seq, *seqm, *next;
- int tot, channel_max= 1;
+ int channel_max= 1;
if(ed==NULL)
return OPERATOR_CANCELLED;
@@ -2241,10 +2241,10 @@ void SEQUENCER_OT_meta_separate(wmOperatorType *ot)
/* view_all operator */
static int sequencer_view_all_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
+ //Scene *scene= CTX_data_scene(C);
bScreen *sc= CTX_wm_screen(C);
ScrArea *area= CTX_wm_area(C);
- ARegion *ar= CTX_wm_region(C);
+ //ARegion *ar= CTX_wm_region(C);
View2D *v2d= UI_view2d_fromcontext(C);
v2d->cur= v2d->tot;
@@ -2275,11 +2275,11 @@ void SEQUENCER_OT_view_all(wmOperatorType *ot)
static int sequencer_view_all_preview_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
- bScreen *sc= CTX_wm_screen(C);
+ //bScreen *sc= CTX_wm_screen(C);
ScrArea *area= CTX_wm_area(C);
ARegion *ar= CTX_wm_region(C);
SpaceSeq *sseq= area->spacedata.first;
- View2D *v2d= UI_view2d_fromcontext(C);
+ //View2D *v2d= UI_view2d_fromcontext(C);
/* Like zooming on an image view */
@@ -2735,7 +2735,7 @@ static int sequencer_copy_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
Editing *ed= seq_give_editing(scene, FALSE);
- Sequence *seq, *seq_act;
+ Sequence *seq;
if(ed==NULL)
return OPERATOR_CANCELLED;
diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c
index fdad021291a..51cd9d5d3ac 100644
--- a/source/blender/makesrna/intern/rna_wm.c
+++ b/source/blender/makesrna/intern/rna_wm.c
@@ -605,39 +605,6 @@ static void rna_Operator_unregister(const bContext *C, StructRNA *type)
WM_main_add_notifier(NC_SCREEN|NA_EDITED, NULL);
}
-void operator_wrapper(wmOperatorType *ot, void *userdata)
-{
- /* take care not to overwrite anything set in
- * WM_operatortype_append_ptr before opfunc() is called */
- StructRNA *srna = ot->srna;
- *ot= *((wmOperatorType *)userdata);
- ot->srna= srna; /* restore */
-
- RNA_struct_blender_type_set(ot->ext.srna, ot);
-}
-
-#if 0
-static int PYTHON_OT_invoke(bContext *C, wmOperator *op, wmEvent *event)
-{
- return PYTHON_OT_generic(PYOP_INVOKE, C, op->type, op, event, NULL);
-}
-
-static int PYTHON_OT_execute(bContext *C, wmOperator *op)
-{
- return PYTHON_OT_generic(PYOP_EXEC, C, op->type, op, NULL, NULL);
-}
-
-static int PYTHON_OT_poll(bContext *C, wmOperatorType *ot)
-{
- return PYTHON_OT_generic(PYOP_POLL, C, ot, NULL, NULL, NULL);
-}
-
-static void PYTHON_OT_draw(bContext *C, wmOperator *op, uiLayout *layout)
-{
- PYTHON_OT_generic(PYOP_DRAW, C, op->type, op, NULL, layout);
-}
-#endif
-
static int operator_poll(bContext *C, wmOperatorType *ot)
{
PointerRNA ptr;
@@ -708,7 +675,11 @@ static int operator_invoke(bContext *C, wmOperator *op, wmEvent *event)
return result;
}
+
+void operator_wrapper(wmOperatorType *ot, void *userdata);
+
static char _operator_idname[OP_MAX_TYPENAME];
+static char _operator_name[OP_MAX_TYPENAME];
static char _operator_descr[1024];
static StructRNA *rna_Operator_register(const bContext *C, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
{
@@ -720,6 +691,7 @@ static StructRNA *rna_Operator_register(const bContext *C, ReportList *reports,
/* setup dummy operator & operator type to store static properties in */
dummyop.type= &dummyot;
dummyot.idname= _operator_idname; /* only assigne the pointer, string is NULL'd */
+ dummyot.name= _operator_name; /* only assigne the pointer, string is NULL'd */
dummyot.description= _operator_descr; /* only assigne the pointer, string is NULL'd */
RNA_pointer_create(NULL, &RNA_Operator, &dummyop, &dummyotr);
@@ -729,12 +701,19 @@ static StructRNA *rna_Operator_register(const bContext *C, ReportList *reports,
{ /* convert foo.bar to FOO_OT_bar
* allocate the description and the idname in 1 go */
- int idlen = strlen(_operator_idname);
- int desclen = strlen(_operator_descr);
- dummyot.idname= MEM_callocN(sizeof(char) * (idlen + desclen + 2 + 3), "_operator_idname"); /* 2 terminators and 3 to convert a.b -> A_OT_b */
- WM_operator_bl_idname(dummyot.idname, _operator_idname); /* convert the idname from python */
- dummyot.description = dummyot.idname + (idlen + 4);
- strcpy(dummyot.description, _operator_descr);
+ int idlen = strlen(_operator_idname) + 4;
+ int namelen = strlen(_operator_name) + 1;
+ int desclen = strlen(_operator_descr) + 1;
+ char *ch, *ch_arr;
+ ch_arr= ch= MEM_callocN(sizeof(char) * (idlen + namelen + desclen), "_operator_idname"); /* 2 terminators and 3 to convert a.b -> A_OT_b */
+ WM_operator_bl_idname(ch, _operator_idname); /* convert the idname from python */
+ dummyot.idname= ch;
+ ch += idlen;
+ strcpy(ch, _operator_name);
+ dummyot.name = ch;
+ ch += namelen;
+ strcpy(ch, _operator_descr);
+ dummyot.description = ch;
}
if(strlen(identifier) >= sizeof(dummyop.idname)) {
@@ -806,7 +785,7 @@ static void rna_def_operator(BlenderRNA *brna)
RNA_def_property_flag(prop, PROP_REGISTER);
prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "type->description");
+ RNA_def_property_string_sdna(prop, NULL, "type->name");
RNA_def_property_string_maxlength(prop, 1024); /* else it uses the pointer size! */
RNA_def_property_flag(prop, PROP_REGISTER);
diff --git a/source/blender/python/intern/bpy_operator.c b/source/blender/python/intern/bpy_operator.c
index 7ccbe1c16a4..101f3619da4 100644
--- a/source/blender/python/intern/bpy_operator.c
+++ b/source/blender/python/intern/bpy_operator.c
@@ -244,7 +244,7 @@ PyObject *BPY_operator_module( void )
static PyMethodDef pyop_as_string_meth ={"as_string", (PyCFunction) pyop_as_string, METH_VARARGS, NULL};
static PyMethodDef pyop_dir_meth = {"dir", (PyCFunction) pyop_dir, METH_NOARGS, NULL};
static PyMethodDef pyop_getrna_meth = {"get_rna", (PyCFunction) pyop_getrna, METH_O, NULL};
- static PyMethodDef pyop_add_meth = {"add", (PyCFunction) PYOP_wrap_add, METH_O, NULL};
+// static PyMethodDef pyop_add_meth = {"add", (PyCFunction) PYOP_wrap_add, METH_O, NULL};
static PyMethodDef pyop_add_macro_meth ={"add_macro", (PyCFunction) PYOP_wrap_add_macro, METH_O, NULL};
static PyMethodDef pyop_macro_def_meth ={"macro_define", (PyCFunction) PYOP_wrap_macro_define, METH_VARARGS, NULL};
static PyMethodDef pyop_remove_meth = {"remove", (PyCFunction) PYOP_wrap_remove, METH_O, NULL};
@@ -256,7 +256,7 @@ PyObject *BPY_operator_module( void )
PyModule_AddObject( submodule, "as_string",PyCFunction_New(&pyop_as_string_meth,NULL) );
PyModule_AddObject( submodule, "dir", PyCFunction_New(&pyop_dir_meth, NULL) );
PyModule_AddObject( submodule, "get_rna", PyCFunction_New(&pyop_getrna_meth, NULL) );
- PyModule_AddObject( submodule, "add", PyCFunction_New(&pyop_add_meth, NULL) );
+// PyModule_AddObject( submodule, "add", PyCFunction_New(&pyop_add_meth, NULL) );
PyModule_AddObject( submodule, "add_macro", PyCFunction_New(&pyop_add_macro_meth, NULL) );
PyModule_AddObject( submodule, "macro_define",PyCFunction_New(&pyop_macro_def_meth, NULL) );
PyModule_AddObject( submodule, "remove", PyCFunction_New(&pyop_remove_meth, NULL) );
diff --git a/source/blender/python/intern/bpy_operator_wrap.c b/source/blender/python/intern/bpy_operator_wrap.c
index cd5b0756531..3bd18d98563 100644
--- a/source/blender/python/intern/bpy_operator_wrap.c
+++ b/source/blender/python/intern/bpy_operator_wrap.c
@@ -105,7 +105,7 @@ static int PYTHON_OT_generic(int mode, bContext *C, wmOperatorType *ot, wmOperat
py_class_instance = PyObject_Call(py_class, args, NULL);
Py_DECREF(args);
-
+
if (py_class_instance==NULL) { /* Initializing the class worked, now run its invoke function */
PyErr_Print();
PyErr_Clear();
@@ -128,7 +128,7 @@ static int PYTHON_OT_generic(int mode, bContext *C, wmOperatorType *ot, wmOperat
else if (mode==PYOP_EXEC) {
item= PyObject_GetAttrString(py_class, "execute");
args = PyTuple_New(2);
-
+
PyTuple_SET_ITEM(args, 1, pyrna_struct_CreatePyObject(&ptr_context));
}
else if (mode==PYOP_POLL) {
@@ -173,7 +173,7 @@ static int PYTHON_OT_generic(int mode, bContext *C, wmOperatorType *ot, wmOperat
Py_DECREF(args);
Py_DECREF(item);
}
-
+
if (ret == NULL) { /* covers py_class_instance failing too */
if(op)
BPy_errors_to_report(op->reports);
@@ -202,7 +202,7 @@ static int PYTHON_OT_generic(int mode, bContext *C, wmOperatorType *ot, wmOperat
* If we ever want to do this and use the props again,
* it can be done with - pyrna_pydict_to_props(op->ptr, kw, "")
*/
-
+
Py_DECREF(ret);
}
@@ -215,7 +215,7 @@ static int PYTHON_OT_generic(int mode, bContext *C, wmOperatorType *ot, wmOperat
BPY_flag_def *flag_def = pyop_ret_flags;
strcpy(flag_str, "");
-
+
while(flag_def->name) {
if (ret_flag & flag_def->flag) {
if(flag_str[1])
@@ -260,6 +260,49 @@ static void PYTHON_OT_draw(bContext *C, wmOperator *op, uiLayout *layout)
PYTHON_OT_generic(PYOP_DRAW, C, op->type, op, NULL, layout);
}
+
+
+void operator_wrapper(wmOperatorType *ot, void *userdata)
+{
+ /* take care not to overwrite anything set in
+ * WM_operatortype_append_ptr before opfunc() is called */
+ StructRNA *srna = ot->srna;
+ *ot= *((wmOperatorType *)userdata);
+ ot->srna= srna; /* restore */
+
+ RNA_struct_blender_type_set(ot->ext.srna, ot);
+
+
+ /* Can't use this because it returns a dict proxy
+ *
+ * item= PyObject_GetAttrString(py_class, "__dict__");
+ */
+ {
+ PyObject *py_class = ot->ext.data;
+ PyObject *item= ((PyTypeObject*)py_class)->tp_dict;
+ if(item) {
+ /* only call this so pyrna_deferred_register_props gives a useful error
+ * WM_operatortype_append_ptr will call RNA_def_struct_identifier
+ * later */
+ RNA_def_struct_identifier(ot->srna, ot->idname);
+
+ if(pyrna_deferred_register_props(ot->srna, item)!=0) {
+ /* failed to register operator props */
+ PyErr_Print();
+ PyErr_Clear();
+
+ }
+ }
+ else {
+ PyErr_Clear();
+ }
+ }
+}
+
+
+
+
+
void PYTHON_OT_wrapper(wmOperatorType *ot, void *userdata)
{
PyObject *py_class = (PyObject *)userdata;
@@ -283,8 +326,8 @@ void PYTHON_OT_wrapper(wmOperatorType *ot, void *userdata)
item= PyObject_GetAttrString(py_class, PYOP_ATTR_DESCRIPTION);
ot->description= (item && PyUnicode_Check(item)) ? _PyUnicode_AsString(item):"undocumented python operator";
Py_XDECREF(item);
-
- /* api callbacks, detailed checks dont on adding */
+
+ /* api callbacks, detailed checks dont on adding */
if (PyObject_HasAttrString(py_class, "invoke"))
ot->invoke= PYTHON_OT_invoke;
//else
@@ -296,9 +339,9 @@ void PYTHON_OT_wrapper(wmOperatorType *ot, void *userdata)
ot->pyop_poll= PYTHON_OT_poll;
if (PyObject_HasAttrString(py_class, "draw"))
ot->ui= PYTHON_OT_draw;
-
+
ot->pyop_data= userdata;
-
+
/* flags */
ot->flag= 0;
@@ -419,11 +462,11 @@ void PYTHON_OT_MACRO_wrapper(wmOperatorType *ot, void *userdata)
/* pyOperators - Operators defined IN Python */
PyObject *PYOP_wrap_add(PyObject *self, PyObject *py_class)
-{
+{
PyObject *base_class, *item;
wmOperatorType *ot;
-
-
+
+
char *idname= NULL;
char idname_bl[OP_MAX_TYPENAME]; /* converted to blender syntax */
@@ -466,7 +509,7 @@ PyObject *PYOP_wrap_add(PyObject *self, PyObject *py_class)
Py_DECREF(item);
/* end annoying conversion! */
-
+
/* remove if it already exists */
if ((ot=WM_operatortype_exists(idname))) {
if(ot->pyop_data) {
@@ -474,7 +517,7 @@ PyObject *PYOP_wrap_add(PyObject *self, PyObject *py_class)
}
WM_operatortype_remove(idname);
}
-
+
Py_INCREF(py_class);
WM_operatortype_append_ptr(PYTHON_OT_wrapper, py_class);
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index d0cc3e95097..8eda19d8198 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -3912,7 +3912,18 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun
}
}
+#if 0
+ if(strcmp(identifier, "bl_label") == 0) {
+ item= PyObject_GetAttrString(py_class, "__doc__");
+ if(item) {
+ Py_DECREF(item); /* no need to keep a ref, the class owns it */
+
+ if(pyrna_py_to_prop(dummyptr, prop, NULL, item, "validating class error:") != 0)
+ return -1;
+ }
+ }
+#endif
if (item == NULL && (((flag & PROP_REGISTER_OPTIONAL) != PROP_REGISTER_OPTIONAL))) {
PyErr_Format( PyExc_AttributeError, "expected %.200s, %.200s class to have an \"%.200s\" attribute", class_type, py_class_name, identifier);
return -1;
@@ -4092,6 +4103,7 @@ void pyrna_free_types(void)
}
}
RNA_PROP_END;
+
}
/* Note! MemLeak XXX
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 4ad067e8743..6d008d5cbb3 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -2655,9 +2655,13 @@ void wm_operatortype_free(void)
{
wmOperatorType *ot;
- for(ot= global_ops.first; ot; ot= ot->next)
+ for(ot= global_ops.first; ot; ot= ot->next) {
if(ot->macro.first)
wm_operatortype_free_macro(ot);
+
+ if(ot->ext.srna) /* python operator, allocs own string */
+ MEM_freeN(ot->idname);
+ }
BLI_freelistN(&global_ops);
}