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
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-12-02 08:51:15 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-12-02 08:51:15 +0400
commitf7f4148b4004c225a30bb80794094b574fbea744 (patch)
treed8ede9dbd62d0558a303c0d0634b8efd1f0a95ae
parent9865ee7637cd58622329c7dbe05c78bc4fe65308 (diff)
change uiButGetStrInfo() to use a trailing NULL arg rather then passing the number of args as an arg.
-rw-r--r--doc/python_api/rst/info_tips_and_tricks.rst8
-rw-r--r--source/blender/editors/include/UI_interface.h2
-rw-r--r--source/blender/editors/interface/interface.c8
-rw-r--r--source/blender/editors/interface/interface_handlers.c4
-rw-r--r--source/blender/editors/interface/interface_ops.c5
-rw-r--r--source/blender/editors/interface/interface_regions.c12
-rw-r--r--source/blender/python/mathutils/mathutils.c2
-rw-r--r--source/blender/python/mathutils/mathutils.h2
8 files changed, 26 insertions, 17 deletions
diff --git a/doc/python_api/rst/info_tips_and_tricks.rst b/doc/python_api/rst/info_tips_and_tricks.rst
index 521031f5e61..4dcbf431724 100644
--- a/doc/python_api/rst/info_tips_and_tricks.rst
+++ b/doc/python_api/rst/info_tips_and_tricks.rst
@@ -218,6 +218,14 @@ The next example is an equivalent single line version of the script above which
``code.interact`` can be added at any line in the script and will pause the script an launch an interactive interpreter in the terminal, when you're done you can quit the interpreter and the script will continue execution.
+If you have **IPython** installed you can use their ``embed()`` function which will implicitly use the current namespace, this has autocomplete and some useful features that the standard python eval-loop doesn't have.
+
+.. code-block:: python
+
+ import IPython
+ IPython.embed()
+
+
Admittedly this highlights the lack of any python debugging support built into blender, but its still handy to know.
.. note::
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index f5c943fbb87..12db9b93772 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -542,7 +542,7 @@ typedef struct uiStringInfo {
/* Note: Expects pointers to uiStringInfo structs as parameters.
* Will fill them with translated strings, when possible.
* Strings in uiStringInfo must be MEM_freeN'ed by caller. */
-void uiButGetStrInfo(struct bContext *C, uiBut *but, int nbr, ...);
+void uiButGetStrInfo(struct bContext *C, uiBut *but, ...);
/* Edit i18n stuff. */
/* Name of the main py op from i18n addon. */
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 9037afc472a..ce82e064531 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -3797,16 +3797,16 @@ void uiButSetFocusOnEnter(wmWindow *win, uiBut *but)
wm_event_add(win, &event);
}
-void uiButGetStrInfo(bContext *C, uiBut *but, int nbr, ...)
+void uiButGetStrInfo(bContext *C, uiBut *but, ...)
{
va_list args;
+ uiStringInfo *si;
EnumPropertyItem *items = NULL, *item = NULL;
int totitems, free_items = FALSE;
- va_start(args, nbr);
- while (nbr--) {
- uiStringInfo *si = (uiStringInfo *) va_arg(args, void *);
+ va_start(args, but);
+ while ((si = (uiStringInfo *) va_arg(args, void *))) {
int type = si->type;
char *tmp = NULL;
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index ea53bbba70a..8aa35acc33c 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -4634,7 +4634,7 @@ static int ui_but_menu(bContext *C, uiBut *but)
uiPopupMenu *pup;
uiLayout *layout;
int length;
- char *name;
+ const char *name;
uiStringInfo label = {BUT_GET_LABEL, NULL};
/* if ((but->rnapoin.data && but->rnaprop) == 0 && but->optype == NULL)*/
@@ -4642,7 +4642,7 @@ static int ui_but_menu(bContext *C, uiBut *but)
button_timers_tooltip_remove(C, but);
- uiButGetStrInfo(C, but, 1, &label);
+ uiButGetStrInfo(C, but, &label, NULL);
name = label.strinfo;
pup = uiPupMenuBegin(C, name, ICON_NONE);
diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c
index e7a5f993d32..e57e52d74b6 100644
--- a/source/blender/editors/interface/interface_ops.c
+++ b/source/blender/editors/interface/interface_ops.c
@@ -960,7 +960,6 @@ static int edittranslation_exec(bContext *C, wmOperator *op)
const char *root = U.i18ndir;
const char *uilng = BLF_lang_get();
- const int bufs_nbr = 10;
uiStringInfo but_label = {BUT_GET_LABEL, NULL};
uiStringInfo rna_label = {BUT_GET_RNA_LABEL, NULL};
uiStringInfo enum_label = {BUT_GET_RNAENUM_LABEL, NULL};
@@ -990,8 +989,8 @@ static int edittranslation_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- uiButGetStrInfo(C, but, bufs_nbr, &but_label, &rna_label, &enum_label, &but_tip, &rna_tip, &enum_tip,
- &rna_struct, &rna_prop, &rna_enum, &rna_ctxt);
+ uiButGetStrInfo(C, but, &but_label, &rna_label, &enum_label, &but_tip, &rna_tip, &enum_tip,
+ &rna_struct, &rna_prop, &rna_enum, &rna_ctxt, NULL);
WM_operator_properties_create(&ptr, EDTSRC_I18N_OP_NAME);
RNA_string_set(&ptr, "lang", uilng);
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index 7c099de9c1e..2c4f2e1d33b 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -426,7 +426,6 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
rctf rect_fl;
rcti rect_i;
- const int nbr_info = 6;
uiStringInfo but_tip = {BUT_GET_TIP, NULL};
uiStringInfo enum_label = {BUT_GET_RNAENUM_LABEL, NULL};
uiStringInfo enum_tip = {BUT_GET_RNAENUM_TIP, NULL};
@@ -440,7 +439,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
/* create tooltip data */
data = MEM_callocN(sizeof(uiTooltipData), "uiTooltipData");
- uiButGetStrInfo(C, but, nbr_info, &but_tip, &enum_label, &enum_tip, &op_keymap, &rna_struct, &rna_prop);
+ uiButGetStrInfo(C, but, &but_tip, &enum_label, &enum_tip, &op_keymap, &rna_struct, &rna_prop, NULL);
/* special case, enum rna buttons only have enum item description,
* use general enum description too before the specific one */
@@ -616,13 +615,16 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
}
#else
if ((U.flag & USER_TOOLTIPS_PYTHON) == 0 && !but->optype && rna_struct.strinfo) {
- if (rna_prop.strinfo)
+ if (rna_prop.strinfo) {
/* Struct and prop */
BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]),
TIP_("Python: %s.%s"), rna_struct.strinfo, rna_prop.strinfo);
- else
+ }
+ else {
/* Only struct (e.g. menus) */
- BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Python: %s"), rna_struct.strinfo);
+ BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]),
+ TIP_("Python: %s"), rna_struct.strinfo);
+ }
data->color_id[data->totline] = UI_TIP_LC_PYTHON;
data->totline++;
}
diff --git a/source/blender/python/mathutils/mathutils.c b/source/blender/python/mathutils/mathutils.c
index a4a4010005a..bc9b747f05e 100644
--- a/source/blender/python/mathutils/mathutils.c
+++ b/source/blender/python/mathutils/mathutils.c
@@ -302,7 +302,7 @@ int EXPP_FloatsAreEqual(float af, float bf, int maxDiff)
/*---------------------- EXPP_VectorsAreEqual -------------------------
* Builds on EXPP_FloatsAreEqual to test vectors */
-int EXPP_VectorsAreEqual(float *vecA, float *vecB, int size, int floatSteps)
+int EXPP_VectorsAreEqual(const float *vecA, const float *vecB, int size, int floatSteps)
{
int x;
for (x = 0; x < size; x++) {
diff --git a/source/blender/python/mathutils/mathutils.h b/source/blender/python/mathutils/mathutils.h
index d4673d14823..92a4aac7093 100644
--- a/source/blender/python/mathutils/mathutils.h
+++ b/source/blender/python/mathutils/mathutils.h
@@ -74,7 +74,7 @@ void BaseMathObject_dealloc(BaseMathObject * self);
PyMODINIT_FUNC PyInit_mathutils(void);
int EXPP_FloatsAreEqual(float A, float B, int floatSteps);
-int EXPP_VectorsAreEqual(float *vecA, float *vecB, int size, int floatSteps);
+int EXPP_VectorsAreEqual(const float *vecA, const float *vecB, int size, int floatSteps);
#define Py_NEW 1
#define Py_WRAP 2