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.
This commit is contained in:
Campbell Barton 2010-09-17 05:58:06 +00:00
parent 5ae75d5dc8
commit e546d7666b
5 changed files with 29 additions and 14 deletions

View File

@ -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);

View File

@ -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 */

View File

@ -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_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<<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_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

View File

@ -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 */

View File

@ -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) {