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>2010-09-17 09:58:06 +0400
committerCampbell Barton <ideasman42@gmail.com>2010-09-17 09:58:06 +0400
commite546d7666b753480995dc54c0cf68a3011dd28f0 (patch)
tree006c822d9c4bd9133636aa11dc0964eeb25aa7b3
parent5ae75d5dc841a6fa33b8ead55bc6fbe89bb8b767 (diff)
minor changes needed for the next commit.
- BKE_add_image_extension now sets the extension rather then appending. (no more image.jpg.tga) - py/rna functions which have no return value now raise an error if a non-None value is returned. - added back the red-alert flag so buttons can have a red highlight if somethings wrong.
-rw-r--r--source/blender/blenkernel/BKE_image.h2
-rw-r--r--source/blender/blenkernel/intern/image.c11
-rw-r--r--source/blender/editors/include/UI_interface.h19
-rw-r--r--source/blender/editors/interface/interface_widgets.c5
-rw-r--r--source/blender/python/intern/bpy_rna.c8
5 files changed, 30 insertions, 15 deletions
diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h
index c842efaa3b2..e246b51af09 100644
--- a/source/blender/blenkernel/BKE_image.h
+++ b/source/blender/blenkernel/BKE_image.h
@@ -48,7 +48,7 @@ void BKE_stamp_info(struct Scene *scene, struct ImBuf *ibuf);
void BKE_stamp_buf(struct Scene *scene, unsigned char *rect, float *rectf, int width, int height, int channels);
int BKE_write_ibuf(struct Scene *scene, struct ImBuf *ibuf, char *name, int imtype, int subimtype, int quality);
void BKE_makepicstring(char *string, char *base, int frame, int imtype, int use_ext);
-void BKE_add_image_extension(char *string, int imtype);
+int BKE_add_image_extension(char *string, int imtype);
int BKE_ftype_to_imtype(int ftype);
int BKE_imtype_to_ftype(int imtype);
int BKE_imtype_is_movie(int imtype);
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index e77183d785f..f3dfd4292c6 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -757,9 +757,9 @@ int BKE_imtype_is_movie(int imtype)
return 0;
}
-void BKE_add_image_extension(char *string, int imtype)
+int BKE_add_image_extension(char *string, int imtype)
{
- char *extension="";
+ char *extension= NULL;
if(imtype== R_IRIS) {
if(!BLI_testextensie(string, ".rgb"))
@@ -830,7 +830,12 @@ void BKE_add_image_extension(char *string, int imtype)
extension= ".jpg";
}
- strcat(string, extension);
+ if(extension) {
+ return BLI_replace_extension(string, FILE_MAX, extension);
+ }
+ else {
+ return FALSE;
+ }
}
/* could allow access externally - 512 is for long names, 64 is for id names */
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 1c79a621ecc..7d56698f7b9 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -146,15 +146,16 @@ typedef struct uiLayout uiLayout;
#define UI_BUT_ANIMATED (1<<20)
#define UI_BUT_ANIMATED_KEY (1<<21)
#define UI_BUT_DRIVEN (1<<22)
-#define UI_BUT_INACTIVE (1<<23)
-#define UI_BUT_LAST_ACTIVE (1<<24)
-#define UI_BUT_UNDO (1<<25)
-#define UI_BUT_IMMEDIATE (1<<26)
-#define UI_BUT_NO_TOOLTIP (1<<27)
-#define UI_BUT_NO_UTF8 (1<<28)
-
-#define UI_BUT_VEC_SIZE_LOCK (1<<29) /* used to flag if color hsv-circle should keep luminance */
-#define UI_BUT_COLOR_CUBIC (1<<30) /* cubic saturation for the color wheel */
+#define UI_BUT_REDALERT (1<<23)
+#define UI_BUT_INACTIVE (1<<24)
+#define UI_BUT_LAST_ACTIVE (1<<25)
+#define UI_BUT_UNDO (1<<26)
+#define UI_BUT_IMMEDIATE (1<<27)
+#define UI_BUT_NO_TOOLTIP (1<<28)
+#define UI_BUT_NO_UTF8 (1<<29)
+
+#define UI_BUT_VEC_SIZE_LOCK (1<<30) /* used to flag if color hsv-circle should keep luminance */
+#define UI_BUT_COLOR_CUBIC (1<<31) /* cubic saturation for the color wheel */
#define UI_PANEL_WIDTH 340
#define UI_COMPACT_PANEL_WIDTH 160
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index c5f0913e35d..08ce130a300 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -1437,6 +1437,11 @@ static void widget_state(uiWidgetType *wt, int state)
wt->wcol.inner[2]= wt->wcol.inner[2]>=240? 255 : wt->wcol.inner[2]+15;
}
}
+
+ if(state & UI_BUT_REDALERT) {
+ char red[4]= {255, 0, 0};
+ widget_state_blend(wt->wcol.inner, red, 0.4f);
+ }
}
/* sliders use special hack which sets 'item' as inner when drawing filling */
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index c20bb3deaee..d2234963927 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -5121,13 +5121,17 @@ static int bpy_class_call(PointerRNA *ptr, FunctionRNA *func, ParameterList *par
err= -1;
}
else {
- if(ret_len==1) {
+ if(ret_len==0 && ret != Py_None) {
+ PyErr_Format(PyExc_RuntimeError, "expected class %.200s, function %.200s to return None, got a %.200s type instead.", RNA_struct_identifier(ptr->type), RNA_function_identifier(func), Py_TYPE(ret)->tp_name);
+ err= -1;
+ }
+ else if(ret_len==1) {
err= pyrna_py_to_prop(&funcptr, pret_single, parms, retdata_single, ret, "calling class function:");
}
else if (ret_len > 1) {
if(PyTuple_Check(ret)==0) {
- PyErr_Format(PyExc_RuntimeError, "expected class %.200s, function %.200s to return a tuple of size %d.", RNA_struct_identifier(ptr->type), RNA_function_identifier(func), ret_len);
+ PyErr_Format(PyExc_RuntimeError, "expected class %.200s, function %.200s to return a tuple of size %d, got a %.200s type instead.", RNA_struct_identifier(ptr->type), RNA_function_identifier(func), ret_len, Py_TYPE(ret)->tp_name);
err= -1;
}
else if (PyTuple_GET_SIZE(ret) != ret_len) {