diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2011-11-26 17:11:55 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2011-11-26 17:11:55 +0400 |
commit | b6569ee4e75de0a68d05278eee6fb10ecc3d7183 (patch) | |
tree | bd0304a2f9c387c4989901058848ffb9b534f0f0 /source/blender/editors | |
parent | 9bd9b7e958b86f4dda24d6d2af3bf42a751cd79a (diff) | |
parent | df22957bfce70b704b6b93958814c1ca8b2211f5 (diff) |
Merged changes in the trunk up to revision 42116.
Diffstat (limited to 'source/blender/editors')
61 files changed, 898 insertions, 800 deletions
diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c index d329874e1ba..05f9248e0a6 100644 --- a/source/blender/editors/animation/fmodifier_ui.c +++ b/source/blender/editors/animation/fmodifier_ui.c @@ -569,7 +569,7 @@ static void draw_modifier__limits(uiLayout *layout, ID *id, FModifier *fcm, shor /* draw settings for stepped interpolation modifier */ static void draw_modifier__stepped(uiLayout *layout, ID *id, FModifier *fcm, short UNUSED(width)) { - uiLayout *col, *subcol; + uiLayout *col, *sub; PointerRNA ptr; /* init the RNA-pointer */ @@ -584,17 +584,17 @@ static void draw_modifier__stepped(uiLayout *layout, ID *id, FModifier *fcm, sho col= uiLayoutColumn(layout, 1); uiItemR(col, &ptr, "use_frame_start", 0, NULL, ICON_NONE); - subcol = uiLayoutColumn(col, 1); - uiLayoutSetActive(subcol, RNA_boolean_get(&ptr, "use_frame_start")); - uiItemR(subcol, &ptr, "frame_start", 0, NULL, ICON_NONE); + sub = uiLayoutColumn(col, 1); + uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_frame_start")); + uiItemR(sub, &ptr, "frame_start", 0, NULL, ICON_NONE); /* block 3: end range settings */ col= uiLayoutColumn(layout, 1); uiItemR(col, &ptr, "use_frame_end", 0, NULL, ICON_NONE); - subcol = uiLayoutColumn(col, 1); - uiLayoutSetActive(subcol, RNA_boolean_get(&ptr, "use_frame_end")); - uiItemR(subcol, &ptr, "frame_end", 0, NULL, ICON_NONE); + sub = uiLayoutColumn(col, 1); + uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_frame_end")); + uiItemR(sub, &ptr, "frame_end", 0, NULL, ICON_NONE); } /* --------------- */ @@ -602,7 +602,7 @@ static void draw_modifier__stepped(uiLayout *layout, ID *id, FModifier *fcm, sho void ANIM_uiTemplate_fmodifier_draw (uiLayout *layout, ID *id, ListBase *modifiers, FModifier *fcm) { FModifierTypeInfo *fmi= fmodifier_get_typeinfo(fcm); - uiLayout *box, *row, *subrow, *col; + uiLayout *box, *row, *sub, *col; uiBlock *block; uiBut *but; short width= 314; @@ -620,30 +620,30 @@ void ANIM_uiTemplate_fmodifier_draw (uiLayout *layout, ID *id, ListBase *modifie block= uiLayoutGetBlock(row); // err... /* left-align -------------------------------------------- */ - subrow= uiLayoutRow(row, 1); - uiLayoutSetAlignment(subrow, UI_LAYOUT_ALIGN_LEFT); + sub= uiLayoutRow(row, 1); + uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT); uiBlockSetEmboss(block, UI_EMBOSSN); /* expand */ - uiItemR(subrow, &ptr, "show_expanded", UI_ITEM_R_ICON_ONLY, "", ICON_NONE); + uiItemR(sub, &ptr, "show_expanded", UI_ITEM_R_ICON_ONLY, "", ICON_NONE); /* checkbox for 'active' status (for now) */ - uiItemR(subrow, &ptr, "active", UI_ITEM_R_ICON_ONLY, "", ICON_NONE); + uiItemR(sub, &ptr, "active", UI_ITEM_R_ICON_ONLY, "", ICON_NONE); /* name */ if (fmi) - uiItemL(subrow, fmi->name, ICON_NONE); + uiItemL(sub, fmi->name, ICON_NONE); else - uiItemL(subrow, "<Unknown Modifier>", ICON_NONE); + uiItemL(sub, "<Unknown Modifier>", ICON_NONE); /* right-align ------------------------------------------- */ - subrow= uiLayoutRow(row, 1); - uiLayoutSetAlignment(subrow, UI_LAYOUT_ALIGN_RIGHT); + sub= uiLayoutRow(row, 1); + uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_RIGHT); /* 'mute' button */ - uiItemR(subrow, &ptr, "mute", UI_ITEM_R_ICON_ONLY, "", ICON_NONE); + uiItemR(sub, &ptr, "mute", UI_ITEM_R_ICON_ONLY, "", ICON_NONE); uiBlockSetEmboss(block, UI_EMBOSSN); diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c index def6cd61370..d40831f9e87 100644 --- a/source/blender/editors/gpencil/drawgpencil.c +++ b/source/blender/editors/gpencil/drawgpencil.c @@ -107,7 +107,7 @@ static void gp_draw_stroke_buffer (tGPspoint *points, int totpoints, short thick if (totpoints == 1) { /* draw point */ glBegin(GL_POINTS); - glVertex2f(points->x, points->y); + glVertex2iv(&points->x); glEnd(); } else if (sflag & GP_STROKE_ERASER) { @@ -132,18 +132,15 @@ static void gp_draw_stroke_buffer (tGPspoint *points, int totpoints, short thick glBegin(GL_LINE_STRIP); /* need to roll-back one point to ensure that there are no gaps in the stroke */ - if (i != 0) { - pt--; - glVertex2f(pt->x, pt->y); - pt++; - } + if (i != 0) glVertex2iv(&(pt - 1)->x); + /* now the point we want... */ - glVertex2f(pt->x, pt->y); + glVertex2iv(&pt->x); oldpressure = pt->pressure; } else - glVertex2f(pt->x, pt->y); + glVertex2iv(&pt->x); } glEnd(); @@ -162,7 +159,7 @@ static void gp_draw_stroke_point (bGPDspoint *points, short thickness, short dfl /* draw point */ if (sflag & GP_STROKE_3DSPACE) { glBegin(GL_POINTS); - glVertex3f(points->x, points->y, points->z); + glVertex3fv(&points->x); glEnd(); } else { @@ -228,18 +225,16 @@ static void gp_draw_stroke_3d (bGPDspoint *points, int totpoints, short thicknes glBegin(GL_LINE_STRIP); /* need to roll-back one point to ensure that there are no gaps in the stroke */ - if (i != 0) { - pt--; - glVertex3f(pt->x, pt->y, pt->z); - pt++; - } + if (i != 0) glVertex3fv(&(pt - 1)->x); + /* now the point we want... */ - glVertex3f(pt->x, pt->y, pt->z); + glVertex3fv(&pt->x); oldpressure = pt->pressure; } - else - glVertex3f(pt->x, pt->y, pt->z); + else { + glVertex3fv(&pt->x); + } } glEnd(); @@ -247,7 +242,7 @@ static void gp_draw_stroke_3d (bGPDspoint *points, int totpoints, short thicknes if (debug) { glBegin(GL_POINTS); for (i=0, pt=points; i < totpoints && pt; i++, pt++) - glVertex3f(pt->x, pt->y, pt->z); + glVertex3fv(&pt->x); glEnd(); } } @@ -461,7 +456,7 @@ static void gp_draw_stroke (bGPDspoint *points, int totpoints, short thickness_s glBegin(GL_POINTS); for (i=0, pt=points; i < totpoints && pt; i++, pt++) { if (sflag & GP_STROKE_2DSPACE) { - glVertex2f(pt->x, pt->y); + glVertex2fv(&pt->x); } else if (sflag & GP_STROKE_2DIMAGE) { const float x= (float)((pt->x * winx) + offsx); diff --git a/source/blender/editors/gpencil/gpencil_buttons.c b/source/blender/editors/gpencil/gpencil_buttons.c index 192f5c10d07..57dd1ef5572 100644 --- a/source/blender/editors/gpencil/gpencil_buttons.c +++ b/source/blender/editors/gpencil/gpencil_buttons.c @@ -95,8 +95,8 @@ static void gp_ui_dellayer_cb (bContext *C, void *gpd, void *gpl) static void gp_drawui_layer (uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl, const short is_v3d) { uiLayout *box=NULL, *split=NULL; - uiLayout *col=NULL, *subcol=NULL; - uiLayout *row=NULL, *subrow=NULL; + uiLayout *col=NULL; + uiLayout *row=NULL, *sub=NULL; uiBlock *block; uiBut *but; PointerRNA ptr; @@ -120,17 +120,17 @@ static void gp_drawui_layer (uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl, con uiBlockSetEmboss(block, UI_EMBOSSN); /* left-align ............................... */ - subrow= uiLayoutRow(row, 0); + sub= uiLayoutRow(row, 0); /* active */ - block= uiLayoutGetBlock(subrow); + block= uiLayoutGetBlock(sub); icon= (gpl->flag & GP_LAYER_ACTIVE) ? ICON_RADIOBUT_ON : ICON_RADIOBUT_OFF; but= uiDefIconBut(block, BUT, 0, icon, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, "Set active layer"); uiButSetFunc(but, gp_ui_activelayer_cb, gpd, gpl); /* locked */ icon= (gpl->flag & GP_LAYER_LOCKED) ? ICON_LOCKED : ICON_UNLOCKED; - uiItemR(subrow, &ptr, "lock", 0, "", icon); + uiItemR(sub, &ptr, "lock", 0, "", icon); /* when layer is locked or hidden, only draw header */ if (gpl->flag & (GP_LAYER_LOCKED|GP_LAYER_HIDE)) { @@ -138,7 +138,7 @@ static void gp_drawui_layer (uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl, con /* visibility button (only if hidden but not locked!) */ if ((gpl->flag & GP_LAYER_HIDE) && !(gpl->flag & GP_LAYER_LOCKED)) - uiItemR(subrow, &ptr, "hide", 0, "", ICON_RESTRICT_VIEW_ON); + uiItemR(sub, &ptr, "hide", 0, "", ICON_RESTRICT_VIEW_ON); /* name */ @@ -146,14 +146,14 @@ static void gp_drawui_layer (uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl, con sprintf(name, "%s (Hidden)", gpl->info); else sprintf(name, "%s (Locked)", gpl->info); - uiItemL(subrow, name, ICON_NONE); + uiItemL(sub, name, ICON_NONE); /* delete button (only if hidden but not locked!) */ if ((gpl->flag & GP_LAYER_HIDE) && !(gpl->flag & GP_LAYER_LOCKED)) { /* right-align ............................... */ - subrow= uiLayoutRow(row, 1); - uiLayoutSetAlignment(subrow, UI_LAYOUT_ALIGN_RIGHT); - block= uiLayoutGetBlock(subrow); // XXX... err... + sub= uiLayoutRow(row, 1); + uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_RIGHT); + block= uiLayoutGetBlock(sub); // XXX... err... but= uiDefIconBut(block, BUT, 0, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, "Delete layer"); uiButSetFunc(but, gp_ui_dellayer_cb, gpd, gpl); @@ -163,24 +163,24 @@ static void gp_drawui_layer (uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl, con else { /* draw rest of header -------------------------------- */ /* visibility button */ - uiItemR(subrow, &ptr, "hide", 0, "", ICON_RESTRICT_VIEW_OFF); + uiItemR(sub, &ptr, "hide", 0, "", ICON_RESTRICT_VIEW_OFF); /* frame locking */ // TODO: this needs its own icons... icon= (gpl->flag & GP_LAYER_FRAMELOCK) ? ICON_RENDER_STILL : ICON_RENDER_ANIMATION; - uiItemR(subrow, &ptr, "lock_frame", 0, "", icon); + uiItemR(sub, &ptr, "lock_frame", 0, "", icon); uiBlockSetEmboss(block, UI_EMBOSS); /* name */ - uiItemR(subrow, &ptr, "info", 0, "", ICON_NONE); + uiItemR(sub, &ptr, "info", 0, "", ICON_NONE); /* delete 'button' */ uiBlockSetEmboss(block, UI_EMBOSSN); /* right-align ............................... */ - subrow= uiLayoutRow(row, 1); - uiLayoutSetAlignment(subrow, UI_LAYOUT_ALIGN_RIGHT); - block= uiLayoutGetBlock(subrow); // XXX... err... + sub= uiLayoutRow(row, 1); + uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_RIGHT); + block= uiLayoutGetBlock(sub); // XXX... err... but= uiDefIconBut(block, BUT, 0, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, "Delete layer"); uiButSetFunc(but, gp_ui_dellayer_cb, gpd, gpl); @@ -196,32 +196,29 @@ static void gp_drawui_layer (uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl, con col= uiLayoutColumn(split, 0); /* color */ - subcol= uiLayoutColumn(col, 1); - uiItemR(subcol, &ptr, "color", 0, "", ICON_NONE); - uiItemR(subcol, &ptr, "alpha", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + sub= uiLayoutColumn(col, 1); + uiItemR(sub, &ptr, "color", 0, "", ICON_NONE); + uiItemR(sub, &ptr, "alpha", UI_ITEM_R_SLIDER, NULL, ICON_NONE); /* stroke thickness */ - subcol= uiLayoutColumn(col, 1); - uiItemR(subcol, &ptr, "line_width", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(col, &ptr, "line_width", UI_ITEM_R_SLIDER, NULL, ICON_NONE); /* debugging options */ if (G.f & G_DEBUG) { - subcol= uiLayoutColumn(col, 1); - uiItemR(subcol, &ptr, "show_points", 0, NULL, ICON_NONE); + uiItemR(col, &ptr, "show_points", 0, NULL, ICON_NONE); } /* right column ................... */ col= uiLayoutColumn(split, 0); /* onion-skinning */ - subcol= uiLayoutColumn(col, 1); - uiItemR(subcol, &ptr, "use_onion_skinning", 0, "Onion Skinning", ICON_NONE); - uiItemR(subcol, &ptr, "ghost_range_max", 0, "Frames", ICON_NONE); // XXX shorter name here? i.e. GStep + sub= uiLayoutColumn(col, 1); + uiItemR(sub, &ptr, "use_onion_skinning", 0, "Onion Skinning", ICON_NONE); + uiItemR(sub, &ptr, "ghost_range_max", 0, "Frames", ICON_NONE); // XXX shorter name here? i.e. GStep /* 3d-view specific drawing options */ if (is_v3d) { - subcol= uiLayoutColumn(col, 0); - uiItemR(subcol, &ptr, "show_x_ray", 0, "X-Ray", ICON_NONE); + uiItemR(col, &ptr, "show_x_ray", 0, "X-Ray", ICON_NONE); } } diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index f09797bf6f1..6c93727bf55 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -331,8 +331,7 @@ static short gp_stroke_addpoint (tGPsdata *p, const int mval[2], float pressure) pt= (tGPspoint *)(gpd->sbuffer); /* store settings */ - pt->x= mval[0]; - pt->y= mval[1]; + copy_v2_v2_int(&pt->x, mval); pt->pressure= pressure; /* increment buffer size */ @@ -345,8 +344,7 @@ static short gp_stroke_addpoint (tGPsdata *p, const int mval[2], float pressure) pt= ((tGPspoint *)(gpd->sbuffer) + 1); /* store settings */ - pt->x= mval[0]; - pt->y= mval[1]; + copy_v2_v2_int(&pt->x, mval); pt->pressure= pressure; /* if this is just the second point we've added, increment the buffer size @@ -369,8 +367,7 @@ static short gp_stroke_addpoint (tGPsdata *p, const int mval[2], float pressure) pt= ((tGPspoint *)(gpd->sbuffer) + gpd->sbuffer_size); /* store settings */ - pt->x= mval[0]; - pt->y= mval[1]; + copy_v2_v2_int(&pt->x, mval); pt->pressure= pressure; /* increment counters */ @@ -387,8 +384,7 @@ static short gp_stroke_addpoint (tGPsdata *p, const int mval[2], float pressure) pt= (tGPspoint *)(gpd->sbuffer); /* store settings */ - pt->x= mval[0]; - pt->y= mval[1]; + copy_v2_v2_int(&pt->x, mval); pt->pressure= pressure; /* if there's stroke for this poly line session add (or replace last) point @@ -475,9 +471,8 @@ static void gp_stroke_smooth (tGPsdata *p) /* second pass: apply smoothed coordinates */ for (i=0, spc=smoothArray; i < gpd->sbuffer_size; i++, spc++) { tGPspoint *pc= (((tGPspoint *)gpd->sbuffer) + i); - - pc->x = spc->x; - pc->y = spc->y; + + copy_v2_v2_int(&pc->x, &spc->x); } /* free temp array */ @@ -653,7 +648,7 @@ static void gp_stroke_newfrombuffer (tGPsdata *p) depth_arr= MEM_mallocN(sizeof(float) * gpd->sbuffer_size, "depth_points"); for (i=0, ptc=gpd->sbuffer; i < gpd->sbuffer_size; i++, ptc++, pt++) { - mval[0]= ptc->x; mval[1]= ptc->y; + copy_v2_v2_int(mval, &ptc->x); if ((ED_view3d_autodist_depth(p->ar, mval, depth_margin, depth_arr+i) == 0) && (i && (ED_view3d_autodist_depth_seg(p->ar, mval, mval_prev, depth_margin + 1, depth_arr+i) == 0)) diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h index d2ac24cd9da..2cd610e1fe4 100644 --- a/source/blender/editors/include/ED_mesh.h +++ b/source/blender/editors/include/ED_mesh.h @@ -205,6 +205,7 @@ void paintface_reveal(struct Object *ob); struct bDeformGroup *ED_vgroup_add(struct Object *ob); struct bDeformGroup *ED_vgroup_add_name(struct Object *ob, const char *name); void ED_vgroup_delete(struct Object *ob, struct bDeformGroup *defgroup); +void ED_vgroup_clear(struct Object *ob); void ED_vgroup_select_by_name(struct Object *ob, const char *name); int ED_vgroup_data_create(struct ID *id); int ED_vgroup_give_array(struct ID *id, struct MDeformVert **dvert_arr, int *dvert_tot); diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h index 4e0f59afc15..39d6ba8bc1b 100644 --- a/source/blender/editors/include/ED_object.h +++ b/source/blender/editors/include/ED_object.h @@ -139,6 +139,7 @@ enum { struct ModifierData *ED_object_modifier_add(struct ReportList *reports, struct Main *bmain, struct Scene *scene, struct Object *ob, const char *name, int type); int ED_object_modifier_remove(struct ReportList *reports, struct Main *bmain, struct Scene *scene, struct Object *ob, struct ModifierData *md); +void ED_object_modifier_clear(struct Main *bmain, struct Scene *scene, struct Object *ob); int ED_object_modifier_move_down(struct ReportList *reports, struct Object *ob, struct ModifierData *md); int ED_object_modifier_move_up(struct ReportList *reports, struct Object *ob, struct ModifierData *md); int ED_object_modifier_convert(struct ReportList *reports, struct Main *bmain, struct Scene *scene, struct Object *ob, struct ModifierData *md); diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index c2390d41d8c..26c3ffed91c 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -292,5 +292,6 @@ int ED_view3d_camera_lock_sync(struct View3D *v3d, struct RegionView3D *rv3d); struct BGpic *ED_view3D_background_image_new(struct View3D *v3d); void ED_view3D_background_image_remove(struct View3D *v3d, struct BGpic *bgpic); +void ED_view3D_background_image_clear(struct View3D *v3d); #endif /* ED_VIEW3D_H */ diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index a0b477413e4..d1f11d60999 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -115,12 +115,14 @@ typedef struct uiLayout uiLayout; #define UI_BLOCK_OUT_1 1024 #define UI_BLOCK_NO_FLIP 2048 #define UI_BLOCK_POPUP_MEMORY 4096 +#define UI_BLOCK_CLIP_EVENTS 8192 /* stop handling mouse events */ /* uiPopupBlockHandle->menuretval */ #define UI_RETURN_CANCEL 1 /* cancel all menus cascading */ #define UI_RETURN_OK 2 /* choice made */ #define UI_RETURN_OUT 4 /* left the menu */ #define UI_RETURN_UPDATE 8 /* update the button that opened */ +#define UI_RETURN_POPUP_OK 16 /* popup is ok to be handled */ /* block->flag bits 12-15 are identical to but->flag bits */ @@ -277,6 +279,30 @@ void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float #define UI_SCROLL_NO_OUTLINE 4 void uiWidgetScrollDraw(struct uiWidgetColors *wcol, struct rcti *rect, struct rcti *slider, int state); +/* Callbacks + * + * uiBlockSetHandleFunc/ButmFunc are for handling events through a callback. + * HandleFunc gets the retval passed on, and ButmFunc gets a2. The latter is + * mostly for compatibility with older code. + * + * uiButSetCompleteFunc is for tab completion. + * + * uiButSearchFunc is for name buttons, showing a popup with matches + * + * uiBlockSetFunc and uiButSetFunc are callbacks run when a button is used, + * in case events, operators or RNA are not sufficient to handle the button. + * + * uiButSetNFunc will free the argument with MEM_freeN. */ + +typedef struct uiSearchItems uiSearchItems; + +typedef void (*uiButHandleFunc)(struct bContext *C, void *arg1, void *arg2); +typedef void (*uiButHandleRenameFunc)(struct bContext *C, void *arg, char *origstr); +typedef void (*uiButHandleNFunc)(struct bContext *C, void *argN, void *arg2); +typedef void (*uiButCompleteFunc)(struct bContext *C, char *str, void *arg); +typedef void (*uiButSearchFunc)(const struct bContext *C, void *arg, const char *str, uiSearchItems *items); +typedef void (*uiBlockHandleFunc)(struct bContext *C, void *arg, int event); + /* Menu Callbacks */ typedef void (*uiMenuCreateFunc)(struct bContext *C, struct uiLayout *layout, void *arg1); @@ -312,7 +338,7 @@ typedef void (*uiBlockCancelFunc)(void *arg1); void uiPupBlock(struct bContext *C, uiBlockCreateFunc func, void *arg); void uiPupBlockO(struct bContext *C, uiBlockCreateFunc func, void *arg, const char *opname, int opcontext); -void uiPupBlockEx(struct bContext *C, uiBlockCreateFunc func, uiBlockCancelFunc cancel_func, void *arg); +void uiPupBlockEx(struct bContext *C, uiBlockCreateFunc func, uiBlockHandleFunc popup_func, uiBlockCancelFunc cancel_func, void *arg); /* void uiPupBlockOperator(struct bContext *C, uiBlockCreateFunc func, struct wmOperator *op, int opcontext); */ /* UNUSED */ void uiPupBlockClose(struct bContext *C, uiBlock *block); @@ -364,6 +390,7 @@ void uiTextBoundsBlock(uiBlock *block, int addval); void uiPopupBoundsBlock(uiBlock *block, int addval, int mx, int my); void uiMenuPopupBoundsBlock(uiBlock *block, int addvall, int mx, int my); void uiCenteredBoundsBlock(uiBlock *block, int addval); +void uiExplicitBoundsBlock(uiBlock *block, int minx, int miny, int maxx, int maxy); int uiBlocksGetYMin (struct ListBase *lb); @@ -515,7 +542,7 @@ uiBut *uiDefHotKeyevtButS(uiBlock *block, int retval, const char *str, int x1, i uiBut *uiDefSearchBut(uiBlock *block, void *arg, int retval, int icon, int maxlen, int x1, int y1, short x2, short y2, float a1, float a2, const char *tip); uiBut *uiDefAutoButR(uiBlock *block, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, const char *name, int icon, int x1, int y1, int x2, int y2); -int uiDefAutoButsRNA(uiLayout *layout, struct PointerRNA *ptr, int (*check_prop)(struct PropertyRNA *), const char label_align); +int uiDefAutoButsRNA(uiLayout *layout, struct PointerRNA *ptr, int (*check_prop)(struct PointerRNA *, struct PropertyRNA *), const char label_align); /* Links * @@ -527,30 +554,6 @@ void uiSetButLink(struct uiBut *but, void **poin, void ***ppoin, short *tot, void uiComposeLinks(uiBlock *block); uiBut *uiFindInlink(uiBlock *block, void *poin); -/* Callbacks - * - * uiBlockSetHandleFunc/ButmFunc are for handling events through a callback. - * HandleFunc gets the retval passed on, and ButmFunc gets a2. The latter is - * mostly for compatibility with older code. - * - * uiButSetCompleteFunc is for tab completion. - * - * uiButSearchFunc is for name buttons, showing a popup with matches - * - * uiBlockSetFunc and uiButSetFunc are callbacks run when a button is used, - * in case events, operators or RNA are not sufficient to handle the button. - * - * uiButSetNFunc will free the argument with MEM_freeN. */ - -typedef struct uiSearchItems uiSearchItems; - -typedef void (*uiButHandleFunc)(struct bContext *C, void *arg1, void *arg2); -typedef void (*uiButHandleRenameFunc)(struct bContext *C, void *arg, char *origstr); -typedef void (*uiButHandleNFunc)(struct bContext *C, void *argN, void *arg2); -typedef void (*uiButCompleteFunc)(struct bContext *C, char *str, void *arg); -typedef void (*uiButSearchFunc)(const struct bContext *C, void *arg, const char *str, uiSearchItems *items); -typedef void (*uiBlockHandleFunc)(struct bContext *C, void *arg, int event); - /* use inside searchfunc to add items */ int uiSearchItemAdd(uiSearchItems *items, const char *name, void *poin, int iconid); /* bfunc gets search item *poin as arg2, or if NULL the old string */ @@ -688,7 +691,7 @@ uiBlock *uiLayoutGetBlock(uiLayout *layout); void uiLayoutSetFunc(uiLayout *layout, uiMenuHandleFunc handlefunc, void *argv); void uiLayoutSetContextPointer(uiLayout *layout, const char *name, struct PointerRNA *ptr); const char *uiLayoutIntrospect(uiLayout *layout); // XXX - testing -void uiLayoutOperatorButs(const struct bContext *C, struct uiLayout *layout, struct wmOperator *op, int (*check_prop)(struct PropertyRNA *), const char label_align, const short flag); +void uiLayoutOperatorButs(const struct bContext *C, struct uiLayout *layout, struct wmOperator *op, int (*check_prop)(struct PointerRNA *, struct PropertyRNA *), const char label_align, const short flag); struct MenuType *uiButGetMenuType(uiBut *but); void uiLayoutSetOperatorContext(uiLayout *layout, int opcontext); @@ -748,6 +751,7 @@ void uiTemplateColorWheel(uiLayout *layout, struct PointerRNA *ptr, const char * void uiTemplateLayers(uiLayout *layout, struct PointerRNA *ptr, const char *propname, PointerRNA *used_ptr, const char *used_propname, int active_layer); void uiTemplateImage(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname, struct PointerRNA *userptr, int compact); +void uiTemplateImageSettings(uiLayout *layout, struct PointerRNA *imfptr); void uiTemplateImageLayers(uiLayout *layout, struct bContext *C, struct Image *ima, struct ImageUser *iuser); void uiTemplateRunningJobs(uiLayout *layout, struct bContext *C); void uiTemplateOperatorSearch(uiLayout *layout); diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 4b7adbc1064..a10de9a8a42 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -434,6 +434,15 @@ void uiCenteredBoundsBlock(uiBlock *block, int addval) block->dobounds= UI_BLOCK_BOUNDS_POPUP_CENTER; } +void uiExplicitBoundsBlock(uiBlock *block, int minx, int miny, int maxx, int maxy) +{ + block->minx = minx; + block->miny = miny; + block->maxx = maxx; + block->maxy = maxy; + block->dobounds = 0; +} + /* ************** LINK LINE DRAWING ************* */ /* link line drawing is not part of buttons or theme.. so we stick with it here */ @@ -1018,7 +1027,7 @@ void uiDrawBlock(const bContext *C, uiBlock *block) glMatrixMode(GL_MODELVIEW); glPopMatrix(); - if(multisample_enabled) + if(multisample_enabled) glEnable(GL_MULTISAMPLE_ARB); ui_draw_links(block); @@ -1028,25 +1037,25 @@ void uiDrawBlock(const bContext *C, uiBlock *block) static void ui_is_but_sel(uiBut *but, double *value) { - short push=0, true=1; + short is_push=0, is_true=1; - if(ELEM3(but->type, TOGN, ICONTOGN, OPTIONN)) true= 0; + if(ELEM3(but->type, TOGN, ICONTOGN, OPTIONN)) is_true= 0; if( but->bit ) { int lvalue; UI_GET_BUT_VALUE_INIT(but, *value) lvalue= (int)*value; - if( BTST(lvalue, (but->bitnr)) ) push= true; - else push= !true; + if( BTST(lvalue, (but->bitnr)) ) is_push= is_true; + else is_push= !is_true; } else { switch(but->type) { case BUT: - push= 2; + is_push= 2; break; case HOTKEYEVT: case KEYEVT: - push= 2; + is_push= 2; break; case TOGBUT: case TOG: @@ -1056,36 +1065,36 @@ static void ui_is_but_sel(uiBut *but, double *value) case ICONTOG: case OPTION: UI_GET_BUT_VALUE_INIT(but, *value) - if(*value != (double)but->hardmin) push= 1; + if(*value != (double)but->hardmin) is_push= 1; break; case ICONTOGN: case TOGN: case OPTIONN: UI_GET_BUT_VALUE_INIT(but, *value) - if(*value==0.0) push= 1; + if(*value==0.0) is_push= 1; break; case ROW: case LISTROW: UI_GET_BUT_VALUE_INIT(but, *value) /* support for rna enum buts */ if(but->rnaprop && (RNA_property_flag(but->rnaprop) & PROP_ENUM_FLAG)) { - if((int)*value & (int)but->hardmax) push= 1; + if((int)*value & (int)but->hardmax) is_push= 1; } else { - if(*value == (double)but->hardmax) push= 1; + if(*value == (double)but->hardmax) is_push= 1; } break; case COL: - push= 2; + is_push= 2; break; default: - push= 2; + is_push= 2; break; } } - if(push==2); - else if(push==1) but->flag |= UI_SELECT; + if(is_push==2); + else if(is_push==1) but->flag |= UI_SELECT; else but->flag &= ~UI_SELECT; } diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 1ed05bc54f0..da94fd9237a 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -377,37 +377,6 @@ void uiRoundRect(float minx, float miny, float maxx, float maxy, float rad) glDisable( GL_LINE_SMOOTH ); } -/* plain fake antialiased unfilled round rectangle */ -#if 0 /* UNUSED 2.5 */ -static void uiRoundRectFakeAA(float minx, float miny, float maxx, float maxy, float rad, float asp) -{ - float color[4], alpha; - float raddiff; - int i, passes=4; - - /* get the color and divide up the alpha */ - glGetFloatv(GL_CURRENT_COLOR, color); - alpha = 1; //color[3]; - color[3]= 0.5*alpha/(float)passes; - glColor4fv(color); - - /* set the 'jitter amount' */ - raddiff = (1/(float)passes) * asp; - - glEnable( GL_BLEND ); - - /* draw lots of lines on top of each other */ - for (i=passes; i>=(-passes); i--) { - uiDrawBox(GL_LINE_LOOP, minx, miny, maxx, maxy, rad+(i*raddiff)); - } - - glDisable( GL_BLEND ); - - color[3] = alpha; - glColor4fv(color); -} -#endif - /* (old, used in outliner) plain antialiased filled box */ void uiRoundBox(float minx, float miny, float maxx, float maxy, float rad) { diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 688e8f95ac7..cd3243bb9dc 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -5063,6 +5063,14 @@ static uiBut *ui_but_find_mouse_over(ARegion *ar, int x, int y) if(ui_but_contains_pt(but, mx, my)) butover= but; } + + /* CLIP_EVENTS prevents the event from reaching other blocks */ + if (block->flag & UI_BLOCK_CLIP_EVENTS) { + /* check if mouse is inside block */ + if(block->minx <= mx && block->maxx >= mx && + block->miny <= my && block->maxy >= my) + break; + } } return butover; @@ -5853,14 +5861,14 @@ static void ui_handle_button_return_submenu(bContext *C, wmEvent *event, uiBut * menu= data->menu; /* copy over return values from the closing menu */ - if(menu->menuretval == UI_RETURN_OK || menu->menuretval == UI_RETURN_UPDATE) { + if((menu->menuretval & UI_RETURN_OK) || (menu->menuretval & UI_RETURN_UPDATE)) { if(but->type == COL) copy_v3_v3(data->vec, menu->retvec); else if(ELEM3(but->type, MENU, ICONROW, ICONTEXTROW)) data->value= menu->retvalue; } - if(menu->menuretval == UI_RETURN_UPDATE) { + if(menu->menuretval & UI_RETURN_UPDATE) { if(data->interactive) ui_apply_button(C, but->block, but, data, 1); else ui_check_but(but); @@ -5868,13 +5876,13 @@ static void ui_handle_button_return_submenu(bContext *C, wmEvent *event, uiBut * } /* now change button state or exit, which will close the submenu */ - if(ELEM(menu->menuretval, UI_RETURN_OK, UI_RETURN_CANCEL)) { + if((menu->menuretval & UI_RETURN_OK) || (menu->menuretval & UI_RETURN_CANCEL)) { if(menu->menuretval != UI_RETURN_OK) data->cancel= 1; button_activate_exit(C, data, but, 1, 0); } - else if(menu->menuretval == UI_RETURN_OUT) { + else if(menu->menuretval & UI_RETURN_OUT) { if(event->type==MOUSEMOVE && ui_mouse_inside_button(data->region, but, event->x, event->y)) { button_activate_state(C, but, BUTTON_STATE_HIGHLIGHT); } @@ -6089,7 +6097,7 @@ static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle /* closing sublevels of pulldowns */ case LEFTARROWKEY: if(event->val==KM_PRESS && (block->flag & UI_BLOCK_LOOP)) - if(BLI_countlist(&block->saferct) > 0) + if(block->saferct.first) menu->menuretval= UI_RETURN_OUT; retval= WM_UI_HANDLER_BREAK; @@ -6322,7 +6330,7 @@ static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle /* enter will always close this block, we let the event * get handled by the button if it is activated, otherwise we cancel */ if(!ui_but_find_activated(ar)) - menu->menuretval= UI_RETURN_CANCEL; + menu->menuretval= UI_RETURN_CANCEL | UI_RETURN_POPUP_OK; } else { ui_mouse_motion_towards_check(block, menu, mx, my); @@ -6362,7 +6370,7 @@ static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle * buttons inside this region. disabled inside check .. not sure * anymore why it was there? but it meant enter didn't work * for example when mouse was not over submenu */ - if((/*inside &&*/ (!menu->menuretval || menu->menuretval == UI_RETURN_UPDATE) && retval == WM_UI_HANDLER_CONTINUE) || event->type == TIMER) { + if((/*inside &&*/ (!menu->menuretval || (menu->menuretval & UI_RETURN_UPDATE)) && retval == WM_UI_HANDLER_CONTINUE) || event->type == TIMER) { but= ui_but_find_activated(ar); if(but) { @@ -6411,14 +6419,14 @@ static int ui_handle_menu_return_submenu(bContext *C, wmEvent *event, uiPopupBlo if(submenu->menuretval) { /* first decide if we want to close our own menu cascading, if * so pass on the sub menu return value to our own menu handle */ - if(ELEM(submenu->menuretval, UI_RETURN_OK, UI_RETURN_CANCEL)) { + if((submenu->menuretval & UI_RETURN_OK) || (submenu->menuretval & UI_RETURN_CANCEL)) { if(!(block->flag & UI_BLOCK_KEEP_OPEN)) { menu->menuretval= submenu->menuretval; menu->butretval= data->retval; } } - update= (submenu->menuretval == UI_RETURN_UPDATE); + update= (submenu->menuretval & UI_RETURN_UPDATE); /* now let activated button in this menu exit, which * will actually close the submenu too */ @@ -6591,7 +6599,7 @@ static int ui_handler_popup(bContext *C, wmEvent *event, void *userdata) ui_popup_block_free(C, menu); UI_remove_popup_handlers(&CTX_wm_window(C)->modalhandlers, menu); - if(temp.menuretval == UI_RETURN_OK) { + if((temp.menuretval & UI_RETURN_OK) || (temp.menuretval & UI_RETURN_POPUP_OK)) { if(temp.popup_func) temp.popup_func(C, temp.popup_arg, temp.retvalue); if(temp.optype) diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 1b7308d328e..a7d8c688f43 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -509,7 +509,7 @@ static void init_internal_icons(void) bTheme *btheme= UI_GetTheme(); ImBuf *bbuf= NULL; int x, y, icontype; - char iconfilestr[FILE_MAXDIR+FILE_MAXFILE]; + char iconfilestr[FILE_MAX]; if ((btheme!=NULL) && btheme->tui.iconfile[0]) { char *icondir= BLI_get_folder(BLENDER_DATAFILES, "icons"); diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index c553c1e35ad..84f0c61cd0c 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -2743,7 +2743,7 @@ const char *uiLayoutIntrospect(uiLayout *layout) } /* this function does not initialize the layout, functions can be called on the layout before and after */ -void uiLayoutOperatorButs(const bContext *C, uiLayout *layout, wmOperator *op,int (*check_prop)(struct PropertyRNA *), const char label_align, const short flag) +void uiLayoutOperatorButs(const bContext *C, uiLayout *layout, wmOperator *op,int (*check_prop)(struct PointerRNA *, struct PropertyRNA *), const char label_align, const short flag) { if(!op->properties) { IDPropertyTemplate val = {0}; diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 47dde3f03f0..58c3c0130b8 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -385,7 +385,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) for(i=0; i<totitem; i++) { if(item[i].identifier[0] && item[i].value == value) { - if(item[i].description[0]) { + if(item[i].description && item[i].description[0]) { BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "%s: %s", item[i].name, item[i].description); data->color[data->totline]= 0xDDDDDD; data->totline++; @@ -2603,7 +2603,7 @@ void uiPupBlock(bContext *C, uiBlockCreateFunc func, void *arg) uiPupBlockO(C, func, arg, NULL, 0); } -void uiPupBlockEx(bContext *C, uiBlockCreateFunc func, uiBlockCancelFunc cancel_func, void *arg) +void uiPupBlockEx(bContext *C, uiBlockCreateFunc func, uiBlockHandleFunc popup_func, uiBlockCancelFunc cancel_func, void *arg) { wmWindow *window= CTX_wm_window(C); uiPopupBlockHandle *handle; @@ -2613,7 +2613,7 @@ void uiPupBlockEx(bContext *C, uiBlockCreateFunc func, uiBlockCancelFunc cancel_ handle->retvalue= 1; handle->popup_arg= arg; - // handle->popup_func= operator_cb; + handle->popup_func= popup_func; handle->cancel_func= cancel_func; // handle->opcontext= opcontext; diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c index 3caafe308d0..0e9dbaf3022 100644 --- a/source/blender/editors/interface/interface_style.c +++ b/source/blender/editors/interface/interface_style.c @@ -124,6 +124,7 @@ static uiStyle *ui_style_new(ListBase *styles, const char *name, short uifont_id style->buttonspacex= 8; style->buttonspacey= 2; style->panelspace= 8; + style->panelouter= 4; return style; } diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c index 23d5e77b78d..8335668a624 100644 --- a/source/blender/editors/interface/interface_utils.c +++ b/source/blender/editors/interface/interface_utils.c @@ -130,7 +130,7 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind return but; } -int uiDefAutoButsRNA(uiLayout *layout, PointerRNA *ptr, int (*check_prop)(PropertyRNA *), const char label_align) +int uiDefAutoButsRNA(uiLayout *layout, PointerRNA *ptr, int (*check_prop)(PointerRNA *, PropertyRNA *), const char label_align) { uiLayout *split, *col; int flag; @@ -141,7 +141,7 @@ int uiDefAutoButsRNA(uiLayout *layout, PointerRNA *ptr, int (*check_prop)(Proper RNA_STRUCT_BEGIN(ptr, prop) { flag= RNA_property_flag(prop); - if(flag & PROP_HIDDEN || (check_prop && check_prop(prop)==FALSE)) + if(flag & PROP_HIDDEN || (check_prop && check_prop(ptr, prop)==FALSE)) continue; if(label_align != '\0') { diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index fb2c7c154fc..4bae6afc2ef 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -4390,7 +4390,7 @@ useless: } look = look->next; } - } /* end uv layer loop */ + } /* end uv map loop */ } /* end uvlay_tot */ diff --git a/source/blender/editors/mesh/loopcut.c b/source/blender/editors/mesh/loopcut.c index 9bbfea1291f..42728eb7ea1 100644 --- a/source/blender/editors/mesh/loopcut.c +++ b/source/blender/editors/mesh/loopcut.c @@ -69,6 +69,7 @@ #include "ED_space_api.h" #include "ED_view3d.h" #include "ED_mesh.h" +#include "ED_numinput.h" #include "RNA_access.h" #include "RNA_define.h" @@ -95,6 +96,7 @@ typedef struct tringselOpData { Object *ob; EditMesh *em; EditEdge *eed; + NumInput num; int extend; int do_cut; @@ -345,6 +347,11 @@ static int ringsel_init (bContext *C, wmOperator *op, int do_cut) lcd->em= BKE_mesh_get_editmesh((Mesh *)lcd->ob->data); lcd->extend = do_cut ? 0 : RNA_boolean_get(op->ptr, "extend"); lcd->do_cut = do_cut; + + initNumInput(&lcd->num); + lcd->num.idx_max = 0; + lcd->num.flag |= NUM_NO_NEGATIVE | NUM_NO_FRACTION; + em_setup_viewcontext(C, &lcd->vc); ED_region_tag_redraw(lcd->ar); @@ -464,6 +471,7 @@ static int ringcut_modal (bContext *C, wmOperator *op, wmEvent *event) ED_region_tag_redraw(lcd->ar); break; case WHEELUPMOUSE: /* change number of cuts */ + case PADPLUSKEY: case PAGEUPKEY: if (event->val == KM_PRESS) { cuts++; @@ -474,6 +482,7 @@ static int ringcut_modal (bContext *C, wmOperator *op, wmEvent *event) } break; case WHEELDOWNMOUSE: /* change number of cuts */ + case PADMINUS: case PAGEDOWNKEY: if (event->val == KM_PRESS) { cuts=MAX2(cuts-1,1); @@ -501,6 +510,23 @@ static int ringcut_modal (bContext *C, wmOperator *op, wmEvent *event) } } + /* using the keyboard to input the number of cuts */ + if (event->val==KM_PRESS) { + float value; + + if (handleNumInput(&lcd->num, event)) + { + applyNumInput(&lcd->num, &value); + + cuts= CLAMPIS(value, 1, 32); + + RNA_int_set(op->ptr,"number_cuts",cuts); + ringsel_find_edge(lcd, cuts); + + ED_region_tag_redraw(lcd->ar); + } + } + /* keep going until the user confirms */ return OPERATOR_RUNNING_MODAL; } diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c index 46076d0bec4..aa94b48c1e9 100644 --- a/source/blender/editors/mesh/mesh_data.c +++ b/source/blender/editors/mesh/mesh_data.c @@ -337,8 +337,8 @@ static int uv_texture_add_exec(bContext *C, wmOperator *UNUSED(op)) void MESH_OT_uv_texture_add(wmOperatorType *ot) { /* identifiers */ - ot->name= "Add UV Texture"; - ot->description= "Add UV texture layer"; + ot->name= "Add UV Map"; + ot->description= "Add UV Map"; ot->idname= "MESH_OT_uv_texture_add"; /* api callbacks */ @@ -417,8 +417,8 @@ static int drop_named_image_invoke(bContext *C, wmOperator *op, wmEvent *event) void MESH_OT_drop_named_image(wmOperatorType *ot) { /* identifiers */ - ot->name= "Assign Image to UV Texture"; - ot->description= "Assigns Image to active UV layer, or creates a UV layer"; + ot->name= "Assign Image to UV Map"; + ot->description= "Assigns Image to active UV Map, or creates a UV Map"; ot->idname= "MESH_OT_drop_named_image"; /* api callbacks */ @@ -447,8 +447,8 @@ static int uv_texture_remove_exec(bContext *C, wmOperator *UNUSED(op)) void MESH_OT_uv_texture_remove(wmOperatorType *ot) { /* identifiers */ - ot->name= "Remove UV Texture"; - ot->description= "Remove UV texture layer"; + ot->name= "Remove UV Map"; + ot->description= "Remove UV Map"; ot->idname= "MESH_OT_uv_texture_remove"; /* api callbacks */ diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index a6d3365ad8a..bcd8b8903e7 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -1366,6 +1366,7 @@ static int convert_exec(bContext *C, wmOperator *op) makeDispListCurveTypes(scene, newob, 0); newob->type= OB_CURVE; + cu->type= OB_CURVE; if(cu->vfont) { cu->vfont->id.us--; diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c index 63a316e7f7b..5dc1c1b0f03 100644 --- a/source/blender/editors/object/object_bake.c +++ b/source/blender/editors/object/object_bake.c @@ -1039,7 +1039,7 @@ static void clear_images(MTFace *mtface, int totface) if((ima->id.flag&LIB_DOIT)==0) { ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL); - IMB_rectfill(ibuf, (ibuf->depth == 32) ? vec_alpha : vec_solid); + IMB_rectfill(ibuf, (ibuf->planes == R_IMF_PLANES_RGBA) ? vec_alpha : vec_solid); ima->id.flag|= LIB_DOIT; } } diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index 3c84b2df1d2..40d52e0b261 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -691,6 +691,7 @@ static int childof_set_inverse_exec (bContext *C, wmOperator *op) Object *ob = ED_object_active_context(C); bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_CHILDOF); bChildOfConstraint *data= (con) ? (bChildOfConstraint *)con->data : NULL; + bConstraint *lastcon = NULL; bPoseChannel *pchan= NULL; /* despite 3 layers of checks, we may still not be able to find a constraint */ @@ -703,27 +704,45 @@ static int childof_set_inverse_exec (bContext *C, wmOperator *op) /* nullify inverse matrix first */ unit_m4(data->invmat); - /* try to find a pose channel */ + /* try to find a pose channel - assume that this is the constraint owner */ // TODO: get from context instead? if (ob && ob->pose) pchan= get_active_posechannel(ob); - /* calculate/set inverse matrix */ + /* calculate/set inverse matrix: + * We just calculate all transform-stack eval up to but not including this constraint. + * This is because inverse should just inverse correct for just the constraint's influence + * when it gets applied; that is, at the time of application, we don't know anything about + * what follows. + */ if (pchan) { - float pmat[4][4], cinf; float imat[4][4], tmat[4][4]; + float pmat[4][4]; - /* make copy of pchan's original pose-mat (for use later) */ + /* 1. calculate posemat where inverse doesn't exist yet (inverse was cleared above), + * to use as baseline ("pmat") to derive delta from. This extra calc saves users + * from having pressing "Clear Inverse" first + */ + where_is_pose(scene, ob); copy_m4_m4(pmat, pchan->pose_mat); - /* disable constraint for pose to be solved without it */ - cinf= con->enforce; - con->enforce= 0.0f; + /* 2. knock out constraints starting from this one */ + lastcon = pchan->constraints.last; + pchan->constraints.last = con->prev; + + if (con->prev) { + /* new end must not point to this one, else this chain cutting is useless */ + con->prev->next = NULL; + } + else { + /* constraint was first */ + pchan->constraints.first = NULL; + } - /* solve pose without constraint */ + /* 3. solve pose without disabled constraints */ where_is_pose(scene, ob); - /* determine effect of constraint by removing the newly calculated + /* 4. determine effect of constraint by removing the newly calculated * pchan->pose_mat from the original pchan->pose_mat, thus determining * the effect of the constraint */ @@ -731,8 +750,19 @@ static int childof_set_inverse_exec (bContext *C, wmOperator *op) mul_m4_m4m4(tmat, imat, pmat); invert_m4_m4(data->invmat, tmat); - /* recalculate pose with new inv-mat */ - con->enforce= cinf; + /* 5. restore constraints */ + pchan->constraints.last = lastcon; + + if (con->prev) { + /* hook up prev to this one again */ + con->prev->next = con; + } + else { + /* set as first again */ + pchan->constraints.first = con; + } + + /* 6. recalculate pose with new inv-mat applied */ where_is_pose(scene, ob); } else if (ob) { diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index c39477cbf6c..722e7057ece 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -2056,10 +2056,8 @@ static int game_property_copy_exec(bContext *C, wmOperator *op) if(prop) { CTX_DATA_BEGIN(C, Object*, ob_iter, selected_editable_objects) { - if (ob != ob_iter) { - if (ob->data != ob_iter->data) - set_ob_property(ob_iter, prop); - } + if (ob != ob_iter) + set_ob_property(ob_iter, prop); } CTX_DATA_END; } } @@ -2067,17 +2065,13 @@ static int game_property_copy_exec(bContext *C, wmOperator *op) else { CTX_DATA_BEGIN(C, Object*, ob_iter, selected_editable_objects) { if (ob != ob_iter) { - if (ob->data != ob_iter->data){ - if (type == COPY_PROPERTIES_REPLACE) - copy_properties( &ob_iter->prop, &ob->prop ); - - /* merge - the default when calling with no argument */ - else { - for(prop = ob->prop.first; prop; prop= prop->next ) { - set_ob_property(ob_iter, prop); - } - } - } + if (type == COPY_PROPERTIES_REPLACE) + copy_properties(&ob_iter->prop, &ob->prop); + + /* merge - the default when calling with no argument */ + else + for(prop = ob->prop.first; prop; prop= prop->next) + set_ob_property(ob_iter, prop); } } CTX_DATA_END; diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index 7b747769e49..86477eb9dbd 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -157,10 +157,9 @@ ModifierData *ED_object_modifier_add(ReportList *reports, Main *bmain, Scene *sc return new_md; } -int ED_object_modifier_remove(ReportList *reports, Main *bmain, Scene *scene, Object *ob, ModifierData *md) +static int object_modifier_remove(Object *ob, ModifierData *md, int *sort_depsgraph) { ModifierData *obmd; - int sort_depsgraph = 0; /* It seems on rapid delete it is possible to * get called twice on same modifier, so make @@ -168,11 +167,9 @@ int ED_object_modifier_remove(ReportList *reports, Main *bmain, Scene *scene, Ob for(obmd=ob->modifiers.first; obmd; obmd=obmd->next) if(obmd==md) break; - - if(!obmd) { - BKE_reportf(reports, RPT_ERROR, "Modifier '%s' not in object '%s'", ob->id.name, md->name); + + if(!obmd) return 0; - } /* special cases */ if(md->type == eModifierType_ParticleSystem) { @@ -193,13 +190,13 @@ int ED_object_modifier_remove(ReportList *reports, Main *bmain, Scene *scene, Ob if(ob->pd) ob->pd->deflect= 0; - sort_depsgraph = 1; + *sort_depsgraph = 1; } else if(md->type == eModifierType_Surface) { if(ob->pd && ob->pd->shape == PFIELD_SHAPE_SURFACE) ob->pd->shape = PFIELD_SHAPE_PLANE; - sort_depsgraph = 1; + *sort_depsgraph = 1; } else if(md->type == eModifierType_Smoke) { ob->dt = OB_TEXTURE; @@ -238,6 +235,21 @@ int ED_object_modifier_remove(ReportList *reports, Main *bmain, Scene *scene, Ob BLI_remlink(&ob->modifiers, md); modifier_free(md); + return 1; +} + +int ED_object_modifier_remove(ReportList *reports, Main *bmain, Scene *scene, Object *ob, ModifierData *md) +{ + int sort_depsgraph = 0; + int ok; + + ok= object_modifier_remove(ob, md, &sort_depsgraph); + + if(!ok) { + BKE_reportf(reports, RPT_ERROR, "Modifier '%s' not in object '%s'", ob->id.name, md->name); + return 0; + } + DAG_id_tag_update(&ob->id, OB_RECALC_DATA); /* sorting has to be done after the update so that dynamic systems can react properly */ @@ -247,6 +259,31 @@ int ED_object_modifier_remove(ReportList *reports, Main *bmain, Scene *scene, Ob return 1; } +void ED_object_modifier_clear(Main *bmain, Scene *scene, Object *ob) +{ + ModifierData *md =ob->modifiers.first; + int sort_depsgraph = 0; + + if(!md) + return; + + while(md) { + ModifierData *next_md; + + next_md= md->next; + + object_modifier_remove(ob, md, &sort_depsgraph); + + md= next_md; + } + + DAG_id_tag_update(&ob->id, OB_RECALC_DATA); + + /* sorting has to be done after the update so that dynamic systems can react properly */ + if(sort_depsgraph) + DAG_scene_sort(bmain, scene); +} + int ED_object_modifier_move_up(ReportList *reports, Object *ob, ModifierData *md) { if(md->prev) { diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 94e2f0aae00..3a4cd6135cf 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -61,6 +61,7 @@ #include "BKE_constraint.h" #include "BKE_curve.h" #include "BKE_depsgraph.h" +#include "BKE_DerivedMesh.h" #include "BKE_displist.h" #include "BKE_global.h" #include "BKE_fcurve.h" @@ -128,7 +129,11 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op) load_editMesh(scene, obedit); make_editMesh(scene, obedit); - em = BKE_mesh_get_editmesh(me); + em= BKE_mesh_get_editmesh(me); + + /* derivedMesh might be needed for solving parenting, + so re-create it here */ + makeDerivedMesh(scene, obedit, em, CD_MASK_BAREMESH); eve= em->verts.first; while(eve) { diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index 936da90e8b7..d6300dc1fe3 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -138,6 +138,23 @@ void ED_vgroup_delete(Object *ob, bDeformGroup *defgroup) vgroup_delete_object_mode(ob, dg); } +void ED_vgroup_clear(Object *ob) +{ + bDeformGroup *dg= (bDeformGroup *)ob->defbase.first; + int edit_mode= ED_vgroup_object_is_edit_mode(ob); + + while (dg) { + bDeformGroup *next_dg= dg->next; + + if(edit_mode) + vgroup_delete_edit_mode(ob, dg); + else + vgroup_delete_object_mode(ob, dg); + + dg= next_dg; + } +} + int ED_vgroup_data_create(ID *id) { /* create deform verts */ diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c index 9dd4503414a..cc60f4a52fd 100644 --- a/source/blender/editors/physics/physics_fluid.c +++ b/source/blender/editors/physics/physics_fluid.c @@ -637,7 +637,7 @@ static int fluid_init_filepaths(Object *fsDomain, char *targetDir, char *targetF FluidsimSettings *domainSettings= fluidmd->fss; FILE *fileCfg; int dirExist = 0; - char newSurfdataPath[FILE_MAXDIR+FILE_MAXFILE]; // modified output settings + char newSurfdataPath[FILE_MAX]; // modified output settings const char *suffixConfig = FLUID_SUFFIX_CONFIG; int outStringsChanged = 0; @@ -667,15 +667,15 @@ static int fluid_init_filepaths(Object *fsDomain, char *targetDir, char *targetF } if(targetDir[0] == '\0' || (!dirExist)) { - char blendDir[FILE_MAXDIR+FILE_MAXFILE]; - char blendFile[FILE_MAXDIR+FILE_MAXFILE]; + char blendDir[FILE_MAX]; + char blendFile[FILE_MAX]; // invalid dir, reset to current/previous - BLI_strncpy(blendDir, G.main->name, FILE_MAXDIR+FILE_MAXFILE); + BLI_strncpy(blendDir, G.main->name, FILE_MAX); BLI_splitdirstring(blendDir, blendFile); - BLI_replace_extension(blendFile, FILE_MAXDIR+FILE_MAXFILE, ""); /* strip .blend */ + BLI_replace_extension(blendFile, FILE_MAX, ""); /* strip .blend */ - BLI_snprintf(newSurfdataPath, FILE_MAXDIR+FILE_MAXFILE ,"//fluidsimdata/%s_%s_", blendFile, fsDomain->id.name); + BLI_snprintf(newSurfdataPath, FILE_MAX ,"//fluidsimdata/%s_%s_", blendFile, fsDomain->id.name); BLI_snprintf(debugStrBuffer, 256, "fluidsimBake::error - warning resetting output dir to '%s'\n", newSurfdataPath); elbeemDebugOut(debugStrBuffer); @@ -685,7 +685,7 @@ static int fluid_init_filepaths(Object *fsDomain, char *targetDir, char *targetF // check if modified output dir is ok #if 0 if(outStringsChanged) { - char dispmsg[FILE_MAXDIR+FILE_MAXFILE+256]; + char dispmsg[FILE_MAX+256]; int selection=0; BLI_strncpy(dispmsg,"Output settings set to: '", sizeof(dispmsg)); strcat(dispmsg, newSurfdataPath); @@ -810,9 +810,9 @@ static void fluidbake_free_data(FluidAnimChannels *channels, ListBase *fobjects, /* copied from rna_fluidsim.c: fluidsim_find_lastframe() */ static void fluidsim_delete_until_lastframe(FluidsimSettings *fss, const char *relbase) { - char targetDir[FILE_MAXFILE+FILE_MAXDIR], targetFile[FILE_MAXFILE+FILE_MAXDIR]; - char targetDirVel[FILE_MAXFILE+FILE_MAXDIR], targetFileVel[FILE_MAXFILE+FILE_MAXDIR]; - char previewDir[FILE_MAXFILE+FILE_MAXDIR], previewFile[FILE_MAXFILE+FILE_MAXDIR]; + char targetDir[FILE_MAX], targetFile[FILE_MAX]; + char targetDirVel[FILE_MAX], targetFileVel[FILE_MAX]; + char previewDir[FILE_MAX], previewFile[FILE_MAX]; int curFrame = 1, exists = 0; BLI_join_dirfile(targetDir, sizeof(targetDir), fss->surfdataPath, OB_FLUIDSIM_SURF_FINAL_OBJ_FNAME); @@ -859,8 +859,8 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor const char *suffixConfig = FLUID_SUFFIX_CONFIG; const char *suffixSurface = FLUID_SUFFIX_SURFACE; - char targetDir[FILE_MAXDIR+FILE_MAXFILE]; // store & modify output settings - char targetFile[FILE_MAXDIR+FILE_MAXFILE]; // temp. store filename from targetDir for access + char targetDir[FILE_MAX]; // store & modify output settings + char targetFile[FILE_MAX]; // temp. store filename from targetDir for access int outStringsChanged = 0; // modified? copy back before baking float domainMat[4][4]; diff --git a/source/blender/editors/physics/physics_pointcache.c b/source/blender/editors/physics/physics_pointcache.c index f826d0ec41a..0cecfa05b49 100644 --- a/source/blender/editors/physics/physics_pointcache.c +++ b/source/blender/editors/physics/physics_pointcache.c @@ -321,7 +321,9 @@ static int ptcache_add_new_exec(bContext *C, wmOperator *UNUSED(op)) for(pid=pidlist.first; pid; pid=pid->next) { if(pid->cache == cache) { - *(pid->cache_ptr) = BKE_ptcache_add(pid->ptcaches); + PointCache *cache = BKE_ptcache_add(pid->ptcaches); + cache->step = pid->default_step; + *(pid->cache_ptr) = cache; break; } } diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c index 6931b0b86db..dbd1e27024e 100644 --- a/source/blender/editors/render/render_internal.c +++ b/source/blender/editors/render/render_internal.c @@ -235,7 +235,7 @@ static int screen_render_exec(bContext *C, wmOperator *op) /* custom scene and single layer re-render */ screen_render_scene_layer_set(op, mainp, &scene, &srl); - if(!is_animation && is_write_still && BKE_imtype_is_movie(scene->r.imtype)) { + if(!is_animation && is_write_still && BKE_imtype_is_movie(scene->r.im_format.imtype)) { BKE_report(op->reports, RPT_ERROR, "Can't write a single file with an animation format selected"); return OPERATOR_CANCELLED; } @@ -516,7 +516,7 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event) return OPERATOR_CANCELLED; } - if(!is_animation && is_write_still && BKE_imtype_is_movie(scene->r.imtype)) { + if(!is_animation && is_write_still && BKE_imtype_is_movie(scene->r.im_format.imtype)) { BKE_report(op->reports, RPT_ERROR, "Can't write a single file with an animation format selected"); return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index 188a61181ce..3a2d9f137d7 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -220,12 +220,12 @@ static void screen_opengl_render_apply(OGLRender *oglrender) char name[FILE_MAX]; int ok; - if(scene->r.planes == 8) { + if(scene->r.im_format.planes == R_IMF_CHAN_DEPTH_8) { IMB_color_to_bw(ibuf); } - BKE_makepicstring(name, scene->r.pic, oglrender->bmain->name, scene->r.cfra, scene->r.imtype, scene->r.scemode & R_EXTENSION, FALSE); - ok= BKE_write_ibuf(ibuf, name, scene->r.imtype, scene->r.subimtype, scene->r.quality); /* no need to stamp here */ + BKE_makepicstring(name, scene->r.pic, oglrender->bmain->name, scene->r.cfra, scene->r.im_format.imtype, scene->r.scemode & R_EXTENSION, FALSE); + ok= BKE_write_ibuf(ibuf, name, &scene->r.im_format); /* no need to stamp here */ if(ok) printf("OpenGL Render written to '%s'\n", name); else printf("OpenGL Render failed to write '%s'\n", name); } @@ -263,7 +263,7 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op) return 0; } - if(!is_animation && is_write_still && BKE_imtype_is_movie(scene->r.imtype)) { + if(!is_animation && is_write_still && BKE_imtype_is_movie(scene->r.im_format.imtype)) { BKE_report(op->reports, RPT_ERROR, "Can't write a single file with an animation format selected"); return 0; } @@ -332,7 +332,7 @@ static void screen_opengl_render_end(bContext *C, OGLRender *oglrender) Scene *scene= oglrender->scene; if(oglrender->mh) { - if(BKE_imtype_is_movie(scene->r.imtype)) + if(BKE_imtype_is_movie(scene->r.im_format.imtype)) oglrender->mh->end_movie(); } @@ -371,8 +371,8 @@ static int screen_opengl_render_anim_initialize(bContext *C, wmOperator *op) scene= oglrender->scene; oglrender->reports= op->reports; - oglrender->mh= BKE_get_movie_handle(scene->r.imtype); - if(BKE_imtype_is_movie(scene->r.imtype)) { + oglrender->mh= BKE_get_movie_handle(scene->r.im_format.imtype); + if(BKE_imtype_is_movie(scene->r.im_format.imtype)) { if(!oglrender->mh->start_movie(scene, &scene->r, oglrender->sizex, oglrender->sizey, oglrender->reports)) { screen_opengl_render_end(C, oglrender); return 0; @@ -392,7 +392,7 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op) Scene *scene= oglrender->scene; ImBuf *ibuf; void *lock; - char name[FILE_MAXDIR+FILE_MAXFILE]; + char name[FILE_MAX]; int ok= 0; const short view_context= (oglrender->v3d != NULL); Object *camera= NULL; @@ -440,7 +440,7 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op) if(ibuf) { /* color -> greyscale */ /* editing directly would alter the render view */ - if(scene->r.planes == 8) { + if(scene->r.im_format.planes == R_IMF_PLANES_BW) { ImBuf *ibuf_bw= IMB_dupImBuf(ibuf); IMB_color_to_bw(ibuf_bw); // IMB_freeImBuf(ibuf); /* owned by the image */ @@ -449,14 +449,14 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op) else { /* this is lightweight & doesnt re-alloc the buffers, only do this * to save the correct bit depth since the image is always RGBA */ - ImBuf *ibuf_cpy= IMB_allocImBuf(ibuf->x, ibuf->y, scene->r.planes, 0); + ImBuf *ibuf_cpy= IMB_allocImBuf(ibuf->x, ibuf->y, scene->r.im_format.planes, 0); ibuf_cpy->rect= ibuf->rect; ibuf_cpy->rect_float= ibuf->rect_float; ibuf_cpy->zbuf_float= ibuf->zbuf_float; ibuf= ibuf_cpy; } - if(BKE_imtype_is_movie(scene->r.imtype)) { + if(BKE_imtype_is_movie(scene->r.im_format.imtype)) { ok= oglrender->mh->append_movie(&scene->r, CFRA, (int*)ibuf->rect, oglrender->sizex, oglrender->sizey, oglrender->reports); if(ok) { printf("Append frame %d", scene->r.cfra); @@ -464,8 +464,8 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op) } } else { - BKE_makepicstring(name, scene->r.pic, oglrender->bmain->name, scene->r.cfra, scene->r.imtype, scene->r.scemode & R_EXTENSION, TRUE); - ok= BKE_write_ibuf_stamp(scene, camera, ibuf, name, scene->r.imtype, scene->r.subimtype, scene->r.quality); + BKE_makepicstring(name, scene->r.pic, oglrender->bmain->name, scene->r.cfra, scene->r.im_format.imtype, scene->r.scemode & R_EXTENSION, TRUE); + ok= BKE_write_ibuf_stamp(scene, camera, ibuf, name, &scene->r.im_format); if(ok==0) { printf("Write error: cannot save %s\n", name); diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index b516954cd4c..96018de130b 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -1222,7 +1222,7 @@ void TEXTURE_OT_slot_move(wmOperatorType *ot) /********************** environment map operators *********************/ -static int save_envmap(wmOperator *op, Scene *scene, EnvMap *env, char *path, int imtype) +static int save_envmap(wmOperator *op, Scene *scene, EnvMap *env, char *path, const char imtype) { float layout[12]; if ( RNA_struct_find_property(op->ptr, "layout") ) @@ -1244,7 +1244,7 @@ static int envmap_save_exec(bContext *C, wmOperator *op) Tex *tex= CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data; Scene *scene = CTX_data_scene(C); //int imtype = RNA_enum_get(op->ptr, "file_type"); - int imtype = scene->r.imtype; + char imtype = scene->r.im_format.imtype; char path[FILE_MAX]; RNA_string_get(op->ptr, "filepath", path); @@ -1271,7 +1271,7 @@ static int envmap_save_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event if(RNA_property_is_set(op->ptr, "filepath")) return envmap_save_exec(C, op); - //RNA_enum_set(op->ptr, "file_type", scene->r.imtype); + //RNA_enum_set(op->ptr, "file_type", scene->r.im_format.imtype); RNA_string_set(op->ptr, "filepath", G.main->name); WM_event_add_fileselect(C, op); diff --git a/source/blender/editors/render/render_update.c b/source/blender/editors/render/render_update.c index 72ea79fae7e..f353a090305 100644 --- a/source/blender/editors/render/render_update.c +++ b/source/blender/editors/render/render_update.c @@ -188,6 +188,10 @@ static int nodes_use_tex(bNodeTree *ntree, Tex *tex) if(node->id == (ID*)tex) { return 1; } + else if(GS(node->id->name) == ID_MA) { + if(mtex_use_tex(((Material*)node->id)->mtex, MAX_MTEX, tex)) + return 1; + } else if(node->type==NODE_GROUP) { if(nodes_use_tex((bNodeTree *)node->id, tex)) return 1; @@ -198,14 +202,46 @@ static int nodes_use_tex(bNodeTree *ntree, Tex *tex) return 0; } -static void material_changed(Main *UNUSED(bmain), Material *ma) +static int nodes_use_material(bNodeTree *ntree, Material *ma) +{ + bNode *node; + + for(node=ntree->nodes.first; node; node= node->next) { + if(node->id) { + if(node->id == (ID*)ma) { + return 1; + } + else if(node->type==NODE_GROUP) { + if(nodes_use_material((bNodeTree *)node->id, ma)) + return 1; + } + } + } + + return 0; +} + +static void material_changed(Main *bmain, Material *ma) { + Material *parent; + /* icons */ BKE_icon_changed(BKE_icon_getid(&ma->id)); /* glsl */ if(ma->gpumaterial.first) GPU_material_free(ma); + + /* find node materials using this */ + for(parent=bmain->mat.first; parent; parent=parent->id.next) { + if(parent->use_nodes && parent->nodetree && nodes_use_material(parent->nodetree, ma)); + else continue; + + BKE_icon_changed(BKE_icon_getid(&parent->id)); + + if(parent->gpumaterial.first) + GPU_material_free(parent); + } } static void texture_changed(Main *bmain, Tex *tex) diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c index 8a90aadbee2..7d0ec866456 100644 --- a/source/blender/editors/screen/screendump.c +++ b/source/blender/editors/screen/screendump.c @@ -160,13 +160,13 @@ static int screenshot_exec(bContext *C, wmOperator *op) /* BKE_add_image_extension() checks for if extension was already set */ if(scene->r.scemode & R_EXTENSION) - if(strlen(path)<FILE_MAXDIR+FILE_MAXFILE-5) - BKE_add_image_extension(path, scene->r.imtype); + if(strlen(path)<FILE_MAX-5) + BKE_add_image_extension(path, scene->r.im_format.imtype); ibuf= IMB_allocImBuf(scd->dumpsx, scd->dumpsy, 24, 0); ibuf->rect= scd->dumprect; - BKE_write_ibuf(ibuf, path, scene->r.imtype, scene->r.subimtype, scene->r.quality); + BKE_write_ibuf(ibuf, path, &scene->r.im_format); IMB_freeImBuf(ibuf); } @@ -261,14 +261,14 @@ static void screenshot_startjob(void *sjv, short *stop, short *do_update, float { ScreenshotJob *sj= sjv; RenderData rd= sj->scene->r; - bMovieHandle *mh= BKE_get_movie_handle(sj->scene->r.imtype); + bMovieHandle *mh= BKE_get_movie_handle(sj->scene->r.im_format.imtype); int cfra= 1; /* we need this as local variables for renderdata */ rd.frs_sec= U.scrcastfps; rd.frs_sec_base= 1.0f; - if(BKE_imtype_is_movie(rd.imtype)) { + if(BKE_imtype_is_movie(rd.im_format.imtype)) { if(!mh->start_movie(sj->scene, &rd, sj->dumpsx, sj->dumpsy, &sj->reports)) { printf("screencast job stopped\n"); return; @@ -294,14 +294,14 @@ static void screenshot_startjob(void *sjv, short *stop, short *do_update, float break; } else { - ImBuf *ibuf= IMB_allocImBuf(sj->dumpsx, sj->dumpsy, rd.planes, 0); - char name[FILE_MAXDIR+FILE_MAXFILE]; + ImBuf *ibuf= IMB_allocImBuf(sj->dumpsx, sj->dumpsy, rd.im_format.planes, 0); + char name[FILE_MAX]; int ok; - BKE_makepicstring(name, rd.pic, sj->bmain->name, cfra, rd.imtype, rd.scemode & R_EXTENSION, TRUE); + BKE_makepicstring(name, rd.pic, sj->bmain->name, cfra, rd.im_format.imtype, rd.scemode & R_EXTENSION, TRUE); ibuf->rect= sj->dumprect; - ok= BKE_write_ibuf(ibuf, name, rd.imtype, rd.subimtype, rd.quality); + ok= BKE_write_ibuf(ibuf, name, &rd.im_format); if(ok==0) { printf("Write error: cannot save %s\n", name); diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 9b256acbca9..d557a3bd144 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -263,7 +263,7 @@ typedef struct ProjPaintState { MVert *dm_mvert; MFace *dm_mface; MTFace *dm_mtface; - MTFace *dm_mtface_clone; /* other UV layer, use for cloning between layers */ + MTFace *dm_mtface_clone; /* other UV map, use for cloning between layers */ MTFace *dm_mtface_stencil; /* projection painting only */ @@ -300,6 +300,7 @@ typedef struct ProjPaintState { short do_occlude; /* Use raytraced occlusion? - ortherwise will paint right through to the back*/ short do_backfacecull; /* ignore faces with normals pointing away, skips a lot of raycasts if your normals are correctly flipped */ short do_mask_normal; /* mask out pixels based on their normals */ + short do_new_shading_nodes; /* cache scene_use_new_shading_nodes value */ float normal_angle; /* what angle to mask at*/ float normal_angle_inner; float normal_angle_range; /* difference between normal_angle and normal_angle_inner, for easy access */ @@ -518,17 +519,16 @@ static Image *imapaint_face_image(const ImagePaintState *s, int face_index) return ima; } -static Image *project_paint_face_image(const ProjPaintState *ps, int face_index) +static Image *project_paint_face_image(const ProjPaintState *ps, MTFace *dm_mtface, int face_index) { Image *ima; - if(scene_use_new_shading_nodes(ps->scene)) { + if(ps->do_new_shading_nodes) { /* cached scene_use_new_shading_nodes result */ MFace *mf = ps->dm_mface+face_index; ED_object_get_active_image(ps->ob, mf->mat_nr, &ima, NULL, NULL); } else { - MTFace *tf = ps->dm_mtface+face_index; - ima = tf->tpage; + ima = dm_mtface[face_index].tpage; } return ima; @@ -725,7 +725,7 @@ static int project_paint_PickColor(const ProjPaintState *ps, float pt[2], float interp_v2_v2v2v2(uv, tf->uv[0], tf->uv[2], tf->uv[3], w); } - ima = project_paint_face_image(ps, face_index); + ima = project_paint_face_image(ps, ps->dm_mtface, face_index); ibuf = ima->ibufs.first; /* we must have got the imbuf before getting here */ if (!ibuf) return 0; @@ -1091,8 +1091,8 @@ static int check_seam(const ProjPaintState *ps, const int orig_face, const int o /* Only need to check if 'i2_fidx' is valid because we know i1_fidx is the same vert on both faces */ if (i2_fidx != -1) { - Image *tpage = project_paint_face_image(ps, face_index); - Image *orig_tpage = project_paint_face_image(ps, orig_face); + Image *tpage = project_paint_face_image(ps, ps->dm_mtface, face_index); + Image *orig_tpage = project_paint_face_image(ps, ps->dm_mtface, orig_face); /* This IS an adjacent face!, now lets check if the UVs are ok */ tf = ps->dm_mtface + face_index; @@ -1347,9 +1347,9 @@ static float project_paint_uvpixel_mask( /* Image Mask */ if (ps->do_layer_stencil) { - /* another UV layers image is masking this one's */ + /* another UV maps image is masking this one's */ ImBuf *ibuf_other; - Image *other_tpage = project_paint_face_image(ps, face_index); + Image *other_tpage = project_paint_face_image(ps, ps->dm_mtface_stencil, face_index); const MTFace *tf_other = ps->dm_mtface_stencil + face_index; if (other_tpage && (ibuf_other = BKE_image_get_ibuf(other_tpage, NULL))) { @@ -1506,7 +1506,7 @@ static ProjPixel *project_paint_uvpixel_init( if (ps->tool==PAINT_TOOL_CLONE) { if (ps->dm_mtface_clone) { ImBuf *ibuf_other; - Image *other_tpage = project_paint_face_image(ps, face_index); + Image *other_tpage = project_paint_face_image(ps, ps->dm_mtface_clone, face_index); const MTFace *tf_other = ps->dm_mtface_clone + face_index; if (other_tpage && (ibuf_other = BKE_image_get_ibuf(other_tpage, NULL))) { @@ -2746,7 +2746,7 @@ static void project_bucket_init(const ProjPaintState *ps, const int thread_index face_index = GET_INT_FROM_POINTER(node->link); /* Image context switching */ - tpage = project_paint_face_image(ps, face_index); + tpage = project_paint_face_image(ps, ps->dm_mtface, face_index); if (tpage_last != tpage) { tpage_last = tpage; @@ -3249,7 +3249,7 @@ static void project_paint_begin(ProjPaintState *ps) } #endif - tpage = project_paint_face_image(ps, face_index); + tpage = project_paint_face_image(ps, ps->dm_mtface, face_index); if (tpage && ((((Mesh *)ps->ob->data)->editflag & ME_EDIT_PAINT_MASK)==0 || mf->flag & ME_FACE_SEL)) { @@ -4333,7 +4333,7 @@ static ImBuf *imapaint_lift_clone(ImBuf *ibuf, ImBuf *ibufb, int *pos) /* note: allocImbuf returns zero'd memory, so regions outside image will have zero alpha, and hence not be blended onto the image */ int w=ibufb->x, h=ibufb->y, destx=0, desty=0, srcx=pos[0], srcy=pos[1]; - ImBuf *clonebuf= IMB_allocImBuf(w, h, ibufb->depth, ibufb->flags); + ImBuf *clonebuf= IMB_allocImBuf(w, h, ibufb->planes, ibufb->flags); IMB_rectclip(clonebuf, ibuf, &destx, &desty, &srcx, &srcy, &w, &h); IMB_rectblend(clonebuf, ibuf, destx, desty, srcx, srcy, w, h, @@ -4714,6 +4714,7 @@ static void project_state_init(bContext *C, Object *ob, ProjPaintState *ps) ps->do_backfacecull = (settings->imapaint.flag & IMAGEPAINT_PROJECT_BACKFACE) ? 0 : 1; ps->do_occlude = (settings->imapaint.flag & IMAGEPAINT_PROJECT_XRAY) ? 0 : 1; ps->do_mask_normal = (settings->imapaint.flag & IMAGEPAINT_PROJECT_FLAT) ? 0 : 1; + ps->do_new_shading_nodes = scene_use_new_shading_nodes(scene); /* only cache the value */ if (ps->tool == PAINT_TOOL_CLONE) ps->do_layer_clone = (settings->imapaint.flag & IMAGEPAINT_PROJECT_LAYER_CLONE); diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c index 623cfc48827..dd7ea81d520 100644 --- a/source/blender/editors/sound/sound_ops.c +++ b/source/blender/editors/sound/sound_ops.c @@ -265,7 +265,7 @@ static int sound_mixdown_invoke(bContext *C, wmOperator *op, wmEvent *event) return WM_operator_filesel(C, op, event); } -static int sound_mixdown_draw_check_prop(PropertyRNA *prop) +static int sound_mixdown_draw_check_prop(PointerRNA *UNUSED(ptr), PropertyRNA *prop) { const char *prop_id= RNA_property_identifier(prop); return !( strcmp(prop_id, "filepath") == 0 || diff --git a/source/blender/editors/space_buttons/buttons_texture.c b/source/blender/editors/space_buttons/buttons_texture.c index 4446a2e848a..c0ccaeaea90 100644 --- a/source/blender/editors/space_buttons/buttons_texture.c +++ b/source/blender/editors/space_buttons/buttons_texture.c @@ -257,8 +257,8 @@ void buttons_texture_context_compute(const bContext *C, SpaceButs *sbuts) if(!scene_use_new_shading_nodes(scene)) { if(ct) { - MEM_freeN(ct); BLI_freelistN(&ct->users); + MEM_freeN(ct); sbuts->texuser= NULL; } diff --git a/source/blender/editors/space_clip/clip_buttons.c b/source/blender/editors/space_clip/clip_buttons.c index 43eb45b17a7..ddfd403806c 100644 --- a/source/blender/editors/space_clip/clip_buttons.c +++ b/source/blender/editors/space_clip/clip_buttons.c @@ -90,12 +90,14 @@ void uiTemplateMovieClip(uiLayout *layout, bContext *C, PointerRNA *ptr, const c prop= RNA_struct_find_property(ptr, propname); if(!prop) { - printf("uiTemplateMovieClip: property not found: %s.%s\n", RNA_struct_identifier(ptr->type), propname); + printf("%s: property not found: %s.%s\n", + __func__, RNA_struct_identifier(ptr->type), propname); return; } if(RNA_property_type(prop) != PROP_POINTER) { - printf("uiTemplateMovieClip: expected pointer property for %s.%s\n", RNA_struct_identifier(ptr->type), propname); + printf("%s: expected pointer property for %s.%s\n", + __func__, RNA_struct_identifier(ptr->type), propname); return; } @@ -136,12 +138,14 @@ void uiTemplateTrack(uiLayout *layout, PointerRNA *ptr, const char *propname) prop= RNA_struct_find_property(ptr, propname); if(!prop) { - printf("uiTemplateTrack: property not found: %s.%s\n", RNA_struct_identifier(ptr->type), propname); + printf("%s: property not found: %s.%s\n", + __func__, RNA_struct_identifier(ptr->type), propname); return; } if(RNA_property_type(prop) != PROP_POINTER) { - printf("uiTemplateTrack: expected pointer property for %s.%s\n", RNA_struct_identifier(ptr->type), propname); + printf("%s: expected pointer property for %s.%s\n", + __func__, RNA_struct_identifier(ptr->type), propname); return; } @@ -327,12 +331,14 @@ void uiTemplateMarker(uiLayout *layout, PointerRNA *ptr, const char *propname, P prop= RNA_struct_find_property(ptr, propname); if(!prop) { - printf("uiTemplateMarker: property not found: %s.%s\n", RNA_struct_identifier(ptr->type), propname); + printf("%s: property not found: %s.%s\n", + __func__, RNA_struct_identifier(ptr->type), propname); return; } if(RNA_property_type(prop) != PROP_POINTER) { - printf("uiTemplateMarker: expected pointer property for %s.%s\n", RNA_struct_identifier(ptr->type), propname); + printf("%s: expected pointer property for %s.%s\n", + __func__, RNA_struct_identifier(ptr->type), propname); return; } diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c index 43df8b0ea47..e5a5109d796 100644 --- a/source/blender/editors/space_clip/tracking_ops.c +++ b/source/blender/editors/space_clip/tracking_ops.c @@ -2251,7 +2251,7 @@ static int detect_features_exec(bContext *C, wmOperator *op) MovieTrackingTrack *track= clip->tracking.tracks.first; int placement= RNA_enum_get(op->ptr, "placement"); int margin= RNA_int_get(op->ptr, "margin"); - int min_trackness= RNA_int_get(op->ptr, "min_trackness"); + int min_trackability= RNA_int_get(op->ptr, "min_trackability"); int min_distance= RNA_int_get(op->ptr, "min_distance"); int place_outside_layer= 0; bGPDlayer *layer= NULL; @@ -2270,7 +2270,7 @@ static int detect_features_exec(bContext *C, wmOperator *op) track= track->next; } - BKE_tracking_detect_fast(&clip->tracking, ibuf, sc->user.framenr, margin, min_trackness, min_distance, layer, place_outside_layer); + BKE_tracking_detect_fast(&clip->tracking, ibuf, sc->user.framenr, margin, min_trackability, min_distance, layer, place_outside_layer); IMB_freeImBuf(ibuf); @@ -2303,7 +2303,7 @@ void CLIP_OT_detect_features(wmOperatorType *ot) /* properties */ RNA_def_enum(ot->srna, "placement", placement_items, 0, "Placement", "Placement for detected features"); RNA_def_int(ot->srna, "margin", 16, 0, INT_MAX, "Margin", "Only corners further than margin pixels from the image edges are considered", 0, 300); - RNA_def_int(ot->srna, "min_trackness", 16, 0, INT_MAX, "Trackness", "Minimum score to add a corner", 0, 300); + RNA_def_int(ot->srna, "min_trackability", 16, 0, INT_MAX, "Trackability", "Minimum trackability score to add a corner", 0, 300); RNA_def_int(ot->srna, "min_distance", 120, 0, INT_MAX, "Distance", "Minimal distance accepted between two corners", 0, 300); } diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c index 4867552cc52..c713317aa7e 100644 --- a/source/blender/editors/space_console/space_console.c +++ b/source/blender/editors/space_console/space_console.c @@ -192,7 +192,7 @@ static int path_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(eve static void path_drop_copy(wmDrag *drag, wmDropBox *drop) { - char pathname[FILE_MAXDIR+FILE_MAXFILE+2]; + char pathname[FILE_MAX+2]; BLI_snprintf(pathname, sizeof(pathname), "\"%s\"", drag->path); RNA_string_set(drop->ptr, "text", pathname); } diff --git a/source/blender/editors/space_file/file_panels.c b/source/blender/editors/space_file/file_panels.c index 7bcaf722827..26083cbe625 100644 --- a/source/blender/editors/space_file/file_panels.c +++ b/source/blender/editors/space_file/file_panels.c @@ -177,7 +177,7 @@ static void file_panel_operator_header(const bContext *C, Panel *pa) BLI_strncpy(pa->drawname, op->type->name, sizeof(pa->drawname)); } -static int file_panel_check_prop(PropertyRNA *prop) +static int file_panel_check_prop(PointerRNA *UNUSED(ptr), PropertyRNA *prop) { const char *prop_id= RNA_property_identifier(prop); return !( strcmp(prop_id, "filepath") == 0 || diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index 80537a4526e..4682ea3fb60 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -852,7 +852,7 @@ static void filelist_read_library(struct FileList* filelist) file = filelist->filelist; for(num=0; num<filelist->numfiles; num++, file++) { if(BLO_has_bfile_extension(file->relname)) { - char name[FILE_MAXDIR+FILE_MAXFILE]; + char name[FILE_MAX]; BLI_strncpy(name, filelist->dir, sizeof(name)); strcat(name, file->relname); @@ -988,7 +988,7 @@ void filelist_from_library(struct FileList* filelist) LinkNode *l, *names, *previews; struct ImBuf* ima; int ok, i, nprevs, nnames, idcode; - char filename[FILE_MAXDIR+FILE_MAXFILE]; + char filename[FILE_MAX]; char dir[FILE_MAX], group[GROUP_MAX]; /* name test */ @@ -1180,7 +1180,7 @@ void filelist_from_main(struct FileList *filelist) if(id->lib==NULL) files->relname= BLI_strdup(id->name+2); else { - files->relname= MEM_mallocN(FILE_MAXDIR+FILE_MAXFILE+32, "filename for lib"); + files->relname= MEM_mallocN(FILE_MAX+32, "filename for lib"); sprintf(files->relname, "%s | %s", id->lib->name, id->name+2); } files->type |= S_IFREG; diff --git a/source/blender/editors/space_file/fsmenu.c b/source/blender/editors/space_file/fsmenu.c index 6b3477d1fe5..9a952d22274 100644 --- a/source/blender/editors/space_file/fsmenu.c +++ b/source/blender/editors/space_file/fsmenu.c @@ -326,13 +326,13 @@ void fsmenu_read_system(struct FSMenu* fsmenu) for (i=1; err!=nsvErr; i++) { FSRef dir; - unsigned char path[FILE_MAXDIR+FILE_MAXFILE]; + unsigned char path[FILE_MAX]; err = FSGetVolumeInfo(kFSInvalidVolumeRefNum, i, NULL, kFSVolInfoNone, NULL, NULL, &dir); if (err != noErr) continue; - FSRefMakePath(&dir, path, FILE_MAXDIR+FILE_MAXFILE); + FSRefMakePath(&dir, path, FILE_MAX); if (strcmp((char*)path, "/home") && strcmp((char*)path, "/net")) { /* /net and /home are meaningless on OSX, home folders are stored in /Users */ fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM, (char *)path, 1, 0); @@ -414,7 +414,7 @@ void fsmenu_read_system(struct FSMenu* fsmenu) FSRef dir; FSVolumeRefNum volRefNum; struct GetVolParmsInfoBuffer volParmsBuffer; - unsigned char path[FILE_MAXDIR+FILE_MAXFILE]; + unsigned char path[FILE_MAX]; err = FSGetVolumeInfo(kFSInvalidVolumeRefNum, i, &volRefNum, kFSVolInfoNone, NULL, NULL, &dir); if (err != noErr) @@ -425,7 +425,7 @@ void fsmenu_read_system(struct FSMenu* fsmenu) continue; - FSRefMakePath(&dir, path, FILE_MAXDIR+FILE_MAXFILE); + FSRefMakePath(&dir, path, FILE_MAX); fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM, (char *)path, 1, 0); } diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c index 51a24044deb..c1dfa97a508 100644 --- a/source/blender/editors/space_graph/graph_buttons.c +++ b/source/blender/editors/space_graph/graph_buttons.c @@ -136,7 +136,7 @@ static void graph_panel_view(const bContext *C, Panel *pa) SpaceIpo *sipo= CTX_wm_space_graph(C); Scene *scene= CTX_data_scene(C); PointerRNA spaceptr, sceneptr; - uiLayout *col, *subcol, *row; + uiLayout *col, *sub, *row; /* get RNA pointers for use when creating the UI elements */ RNA_id_pointer_create(&scene->id, &sceneptr); @@ -146,16 +146,16 @@ static void graph_panel_view(const bContext *C, Panel *pa) col= uiLayoutColumn(pa->layout, 0); uiItemR(col, &spaceptr, "show_cursor", 0, NULL, ICON_NONE); - subcol= uiLayoutColumn(col, 1); - uiLayoutSetActive(subcol, RNA_boolean_get(&spaceptr, "show_cursor")); - uiItemO(subcol, "Cursor from Selection", ICON_NONE, "GRAPH_OT_frame_jump"); + sub= uiLayoutColumn(col, 1); + uiLayoutSetActive(sub, RNA_boolean_get(&spaceptr, "show_cursor")); + uiItemO(sub, "Cursor from Selection", ICON_NONE, "GRAPH_OT_frame_jump"); - subcol= uiLayoutColumn(col, 1); - uiLayoutSetActive(subcol, RNA_boolean_get(&spaceptr, "show_cursor")); - row= uiLayoutSplit(subcol, 0.7, 1); + sub= uiLayoutColumn(col, 1); + uiLayoutSetActive(sub, RNA_boolean_get(&spaceptr, "show_cursor")); + row= uiLayoutSplit(sub, 0.7, 1); uiItemR(row, &sceneptr, "frame_current", 0, "Cursor X", ICON_NONE); uiItemEnumO(row, "GRAPH_OT_snap", "To Keys", 0, "type", GRAPHKEYS_SNAP_CFRA); - row= uiLayoutSplit(subcol, 0.7, 1); + row= uiLayoutSplit(sub, 0.7, 1); uiItemR(row, &spaceptr, "cursor_position_y", 0, "Cursor Y", ICON_NONE); uiItemEnumO(row, "GRAPH_OT_snap", "To Keys", 0, "type", GRAPHKEYS_SNAP_VALUE); } @@ -168,7 +168,7 @@ static void graph_panel_properties(const bContext *C, Panel *pa) FCurve *fcu; PointerRNA fcu_ptr; uiLayout *layout = pa->layout; - uiLayout *col, *row, *subrow; + uiLayout *col, *row, *sub; uiBlock *block; char name[256]; int icon = 0; @@ -201,9 +201,9 @@ static void graph_panel_properties(const bContext *C, Panel *pa) row= uiLayoutRow(col, 1); uiItemR(row, &fcu_ptr, "color_mode", 0, "", ICON_NONE); - subrow= uiLayoutRow(row, 1); - uiLayoutSetEnabled(subrow, (fcu->color_mode==FCURVE_COLOR_CUSTOM)); - uiItemR(subrow, &fcu_ptr, "color", 0, "", ICON_NONE); + sub= uiLayoutRow(row, 1); + uiLayoutSetEnabled(sub, (fcu->color_mode==FCURVE_COLOR_CUSTOM)); + uiItemR(sub, &fcu_ptr, "color", 0, "", ICON_NONE); MEM_freeN(ale); } @@ -562,7 +562,7 @@ static void graph_panel_driverVar__transChan(uiLayout *layout, ID *id, DriverVar DriverTarget *dtar= &dvar->targets[0]; Object *ob = (Object *)dtar->id; PointerRNA dtar_ptr; - uiLayout *col, *subcol; + uiLayout *col, *sub; /* initialise RNA pointer to the target */ RNA_pointer_create(id, &RNA_DriverTarget, dtar, &dtar_ptr); @@ -578,9 +578,9 @@ static void graph_panel_driverVar__transChan(uiLayout *layout, ID *id, DriverVar uiItemPointerR(col, &dtar_ptr, "bone_target", &tar_ptr, "bones", "", ICON_BONE_DATA); } - subcol= uiLayoutColumn(layout, 1); - uiItemR(subcol, &dtar_ptr, "transform_type", 0, NULL, ICON_NONE); - uiItemR(subcol, &dtar_ptr, "transform_space", 0, "Space", ICON_NONE); + sub= uiLayoutColumn(layout, 1); + uiItemR(sub, &dtar_ptr, "transform_type", 0, NULL, ICON_NONE); + uiItemR(sub, &dtar_ptr, "transform_space", 0, "Space", ICON_NONE); } /* driver settings for active F-Curve (only for 'Drivers' mode) */ diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c index 5445f2e8c44..6c68ba0ea71 100644 --- a/source/blender/editors/space_image/image_buttons.c +++ b/source/blender/editors/space_image/image_buttons.c @@ -122,13 +122,13 @@ static void image_info(Scene *scene, ImageUser *iuser, Image *ima, ImBuf *ibuf, if(ibuf->channels!=4) { ofs+= sprintf(str+ofs, "%d float channel(s)", ibuf->channels); } - else if(ibuf->depth==32) + else if(ibuf->planes == R_IMF_PLANES_RGBA) ofs+= sprintf(str+ofs, " RGBA float"); else ofs+= sprintf(str+ofs, " RGB float"); } else { - if(ibuf->depth==32) + if(ibuf->planes == R_IMF_PLANES_RGBA) ofs+= sprintf(str+ofs, " RGBA byte"); else ofs+= sprintf(str+ofs, " RGB byte"); @@ -488,38 +488,6 @@ static void image_multi_decpass_cb(bContext *C, void *rr_v, void *iuser_v) } #if 0 -static void image_pack_cb(bContext *C, void *ima_v, void *iuser_v) -{ - if(ima_v) { - Image *ima= ima_v; - if(ima->source!=IMA_SRC_SEQUENCE && ima->source!=IMA_SRC_MOVIE) { - if (ima->packedfile) { - if (G.fileflags & G_AUTOPACK) { - if (okee("Disable AutoPack ?")) { - G.fileflags &= ~G_AUTOPACK; - } - } - - if ((G.fileflags & G_AUTOPACK) == 0) { - unpackImage(NULL, ima, PF_ASK); /* XXX report errors */ - ED_undo_push(C, "Unpack image"); - } - } - else { - ImBuf *ibuf= BKE_image_get_ibuf(ima, iuser_v); - if (ibuf && (ibuf->userflags & IB_BITMAPDIRTY)) { - // XXX error("Can't pack painted image. Save image or use Repack as PNG"); - } else { - ima->packedfile = newPackedFile(NULL, ima->name); /* XXX report errors */ - ED_undo_push(C, "Pack image"); - } - } - } - } -} -#endif - -#if 0 static void image_freecache_cb(bContext *C, void *ima_v, void *unused) { Scene *scene= CTX_data_scene(C); @@ -649,12 +617,14 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char prop= RNA_struct_find_property(ptr, propname); if(!prop) { - printf("uiTemplateImage: property not found: %s.%s\n", RNA_struct_identifier(ptr->type), propname); + printf("%s: property not found: %s.%s\n", + __func__, RNA_struct_identifier(ptr->type), propname); return; } if(RNA_property_type(prop) != PROP_POINTER) { - printf("uiTemplateImage: expected pointer property for %s.%s\n", RNA_struct_identifier(ptr->type), propname); + printf("%s: expected pointer property for %s.%s\n", + __func__, RNA_struct_identifier(ptr->type), propname); return; } @@ -674,8 +644,6 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char if(!compact) uiTemplateID(layout, C, ptr, propname, "IMAGE_OT_new", "IMAGE_OT_open", NULL); - // XXX missing: reload, pack - if(ima) { uiBlockSetNFunc(block, rna_update_cb, MEM_dupallocN(cb), NULL); @@ -815,6 +783,78 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char MEM_freeN(cb); } +void uiTemplateImageSettings(uiLayout *layout, PointerRNA *imfptr) +{ + ImageFormatData *imf= imfptr->data; + ID *id= imfptr->id.data; + const int depth_ok= BKE_imtype_valid_depths(imf->imtype); + /* some settings depend on this being a scene thats rendered */ + const short is_render_out= (id && GS(id->name) == ID_SCE); + + uiLayout *col, *row, *split, *sub; + + col= uiLayoutColumn(layout, 0); + + split= uiLayoutSplit(col, 0.5f, 0); + + uiItemR(split, imfptr, "file_format", 0, "", ICON_NONE); + sub= uiLayoutRow(split, 0); + uiItemR(sub, imfptr, "color_mode", UI_ITEM_R_EXPAND, "Color", ICON_NONE); + + /* only display depth setting if multiple depths can be used */ + if((ELEM6(depth_ok, + R_IMF_CHAN_DEPTH_1, + R_IMF_CHAN_DEPTH_8, + R_IMF_CHAN_DEPTH_12, + R_IMF_CHAN_DEPTH_16, + R_IMF_CHAN_DEPTH_24, + R_IMF_CHAN_DEPTH_32)) == 0) + { + row= uiLayoutRow(col, 0); + uiItemR(row, imfptr, "color_depth", UI_ITEM_R_EXPAND, NULL, ICON_NONE); + } + + if (BKE_imtype_supports_quality(imf->imtype)) { + uiItemR(col, imfptr, "quality", 0, NULL, ICON_NONE); + } + + if (BKE_imtype_supports_compress(imf->imtype)) { + uiItemR(col, imfptr, "compression", 0, NULL, ICON_NONE); + } + + if (ELEM(imf->imtype, R_IMF_IMTYPE_OPENEXR, R_IMF_IMTYPE_MULTILAYER)) { + uiItemR(col, imfptr, "exr_codec", 0, NULL, ICON_NONE); + } + + row= uiLayoutRow(col, 0); + if (BKE_imtype_supports_zbuf(imf->imtype)) { + uiItemR(row, imfptr, "use_zbuffer", 0, NULL, ICON_NONE); + } + + if (is_render_out && (imf->imtype == R_IMF_IMTYPE_OPENEXR)) { + uiItemR(row, imfptr, "use_preview", 0, NULL, ICON_NONE); + } + + if (imf->imtype == R_IMF_IMTYPE_JP2) { + row= uiLayoutRow(col, 0); + uiItemR(row, imfptr, "use_jpeg2k_cinema_preset", 0, NULL, ICON_NONE); + uiItemR(row, imfptr, "use_jpeg2k_cinema_48", 0, NULL, ICON_NONE); + + uiItemR(col, imfptr, "use_jpeg2k_ycc", 0, NULL, ICON_NONE); + } + + if (imf->imtype == R_IMF_IMTYPE_CINEON) { +#if 1 + uiItemL(col, "Hard coded Non-Linear, Gamma:1.0", ICON_NONE); +#else + uiItemR(col, imfptr, "use_cineon_log", 0, NULL, ICON_NONE); + uiItemR(col, imfptr, "cineon_black", 0, NULL, ICON_NONE); + uiItemR(col, imfptr, "cineon_white", 0, NULL, ICON_NONE); + uiItemR(col, imfptr, "cineon_gamma", 0, NULL, ICON_NONE); +#endif + } +} + void uiTemplateImageLayers(uiLayout *layout, bContext *C, Image *ima, ImageUser *iuser) { Scene *scene= CTX_data_scene(C); diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 77c92b2d9c3..0efc89e802a 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -707,40 +707,6 @@ void IMAGE_OT_view_zoom_ratio(wmOperatorType *ot) } /**************** load/replace/save callbacks ******************/ - -/* XXX make dynamic */ -static const EnumPropertyItem image_file_type_items[] = { - {R_TARGA, "TARGA", 0, "Targa", ""}, - {R_RAWTGA, "TARGA RAW", 0, "Targa Raw", ""}, - {R_PNG, "PNG", 0, "PNG", ""}, -#ifdef WITH_DDS - {R_DDS, "DDS", 0, "DirectDraw Surface", ""}, -#endif - {R_BMP, "BMP", 0, "BMP", ""}, - {R_JPEG90, "JPEG", 0, "Jpeg", ""}, -#ifdef WITH_OPENJPEG - {R_JP2, "JPEG_2000", 0, "Jpeg 2000", ""}, -#endif - {R_IRIS, "IRIS", 0, "Iris", ""}, -#ifdef WITH_TIFF - {R_TIFF, "TIFF", 0, "Tiff", ""}, -#endif -#ifdef WITH_DDS - {R_RADHDR, "RADIANCE_HDR", 0, "Radiance HDR", ""}, -#endif -#ifdef WITH_CINEON - {R_CINEON, "CINEON", 0, "Cineon", ""}, - {R_DPX, "DPX", 0, "DPX", ""}, -#endif -#ifdef WITH_OPENEXR - {R_OPENEXR, "OPENEXR", 0, "OpenEXR", ""}, - /* saving sequences of multilayer won't work, they copy buffers */ - /*if(ima->source==IMA_SRC_SEQUENCE && ima->type==IMA_TYPE_MULTILAYER); - else*/ - {R_MULTILAYER, "MULTILAYER", 0, "MultiLayer", ""}, -#endif - {0, NULL, 0, NULL, NULL}}; - static void image_filesel(bContext *C, wmOperator *op, const char *path) { RNA_string_set(op->ptr, "filepath", path); @@ -943,19 +909,42 @@ void IMAGE_OT_replace(wmOperatorType *ot) typedef struct { /* matching scene->r settings */ - short planes, imtype, subimtype, quality; + //short planes, imtype, subimtype, quality; + ImageFormatData im_format; char filepath[FILE_MAX]; /* keep absolute */ } SaveImageOptions; static void save_image_options_defaults(SaveImageOptions *simopts) { - simopts->planes= R_PLANES24; - simopts->imtype= R_PNG; - simopts->subimtype= 0; - simopts->quality= 90; + memset(&simopts->im_format, 0, sizeof(simopts->im_format)); + simopts->im_format.planes= R_IMF_PLANES_RGB; + simopts->im_format.imtype= R_IMF_IMTYPE_PNG; + simopts->im_format.quality= 90; + simopts->im_format.compress= 90; simopts->filepath[0]= '\0'; } +static char imtype_best_depth(ImBuf *ibuf, const char imtype) +{ + const char depth_ok= BKE_imtype_valid_depths(imtype); + + if (ibuf->rect_float) { + if (depth_ok & R_IMF_CHAN_DEPTH_32) return R_IMF_CHAN_DEPTH_32; + if (depth_ok & R_IMF_CHAN_DEPTH_24) return R_IMF_CHAN_DEPTH_24; + if (depth_ok & R_IMF_CHAN_DEPTH_16) return R_IMF_CHAN_DEPTH_16; + if (depth_ok & R_IMF_CHAN_DEPTH_12) return R_IMF_CHAN_DEPTH_12; + return R_IMF_CHAN_DEPTH_8; + } + else { + if (depth_ok & R_IMF_CHAN_DEPTH_8) return R_IMF_CHAN_DEPTH_8; + if (depth_ok & R_IMF_CHAN_DEPTH_12) return R_IMF_CHAN_DEPTH_12; + if (depth_ok & R_IMF_CHAN_DEPTH_16) return R_IMF_CHAN_DEPTH_16; + if (depth_ok & R_IMF_CHAN_DEPTH_24) return R_IMF_CHAN_DEPTH_24; + if (depth_ok & R_IMF_CHAN_DEPTH_32) return R_IMF_CHAN_DEPTH_32; + return R_IMF_CHAN_DEPTH_8; /* fallback, should not get here */ + } +} + static int save_image_options_init(SaveImageOptions *simopts, SpaceImage *sima, Scene *scene, const short guess_path) { void *lock; @@ -963,34 +952,41 @@ static int save_image_options_init(SaveImageOptions *simopts, SpaceImage *sima, if(ibuf) { Image *ima= sima->image; + short is_depth_set= FALSE; - simopts->planes= ibuf->depth; + simopts->im_format.planes= ibuf->planes; if(ELEM(ima->type, IMA_TYPE_R_RESULT, IMA_TYPE_COMPOSITE)) { - simopts->imtype= scene->r.imtype; - simopts->planes= scene->r.planes; + /* imtype */ + simopts->im_format= scene->r.im_format; + is_depth_set= TRUE; } else if (ima->source == IMA_SRC_GENERATED) { - simopts->imtype= R_PNG; + simopts->im_format.imtype= R_IMF_IMTYPE_PNG; } else { - simopts->imtype= BKE_ftype_to_imtype(ibuf->ftype); + simopts->im_format.imtype= BKE_ftype_to_imtype(ibuf->ftype); } - simopts->subimtype= scene->r.subimtype; /* XXX - this is lame, we need to make these available too! */ - simopts->quality= ibuf->ftype & 0xff; + //simopts->subimtype= scene->r.subimtype; /* XXX - this is lame, we need to make these available too! */ + simopts->im_format.quality= ibuf->ftype & 0xff; BLI_strncpy(simopts->filepath, ibuf->name, sizeof(simopts->filepath)); /* sanitize all settings */ /* unlikely but just incase */ - if (ELEM3(simopts->planes, R_PLANESBW, R_PLANES24, R_PLANES32) == 0) { - simopts->planes= R_PLANES32; + if (ELEM3(simopts->im_format.planes, R_IMF_PLANES_BW, R_IMF_PLANES_RGB, R_IMF_PLANES_RGBA) == 0) { + simopts->im_format.planes= R_IMF_PLANES_RGBA; + } + + /* depth, account for float buffer and format support */ + if (is_depth_set == FALSE) { + simopts->im_format.depth= imtype_best_depth(ibuf, simopts->im_format.imtype); } /* some formats dont use quality so fallback to scenes quality */ - if (simopts->quality == 0) { - simopts->quality= scene->r.quality; + if (simopts->im_format.quality == 0) { + simopts->im_format.quality= scene->r.im_format.quality; } /* check for empty path */ @@ -1009,18 +1005,11 @@ static int save_image_options_init(SaveImageOptions *simopts, SpaceImage *sima, return (ibuf != NULL); } -static void save_image_options_from_op(SaveImageOptions *simopts, wmOperator *op, Scene *evil_scene) +static void save_image_options_from_op(SaveImageOptions *simopts, wmOperator *op) { - if (RNA_property_is_set(op->ptr, "color_mode")) simopts->planes= RNA_enum_get(op->ptr, "color_mode"); - if (RNA_property_is_set(op->ptr, "file_format")) simopts->imtype= RNA_enum_get(op->ptr, "file_format"); - -#if 0 - if (RNA_property_is_set(op->ptr, "subimtype")) simopts->subimtype= RNA_enum_get(op->ptr, "subimtype"); // XXX -#else - simopts->subimtype= evil_scene->r.subimtype; -#endif - - if (RNA_property_is_set(op->ptr, "file_quality")) simopts->quality= RNA_int_get(op->ptr, "file_quality"); + if (op->customdata) { + simopts->im_format= *(ImageFormatData *)op->customdata; + } if (RNA_property_is_set(op->ptr, "filepath")) { RNA_string_get(op->ptr, "filepath", simopts->filepath); @@ -1030,10 +1019,9 @@ static void save_image_options_from_op(SaveImageOptions *simopts, wmOperator *op static void save_image_options_to_op(SaveImageOptions *simopts, wmOperator *op) { - RNA_enum_set(op->ptr, "color_mode", simopts->planes); - RNA_enum_set(op->ptr, "file_format", simopts->imtype); - // RNA_enum_set(op->ptr, "subimtype", simopts->subimtype); - RNA_int_set(op->ptr, "file_quality", simopts->quality); + if (op->customdata) { + *(ImageFormatData *)op->customdata= simopts->im_format; + } RNA_string_set(op->ptr, "filepath", simopts->filepath); } @@ -1059,26 +1047,26 @@ static void save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveI if(ima->type == IMA_TYPE_R_RESULT) { /* enforce user setting for RGB or RGBA, but skip BW */ - if(simopts->planes==R_PLANES32) { - ibuf->depth= 32; + if(simopts->im_format.planes==R_IMF_PLANES_RGBA) { + ibuf->planes= R_IMF_PLANES_RGBA; } - else if(simopts->planes==R_PLANES24) { - ibuf->depth= 24; + else if(simopts->im_format.planes==R_IMF_PLANES_RGB) { + ibuf->planes= R_IMF_PLANES_RGB; } } else { /* TODO, better solution, if a 24bit image is painted onto it may contain alpha */ if(ibuf->userflags & IB_BITMAPDIRTY) { /* it has been painted onto */ /* checks each pixel, not ideal */ - ibuf->depth= BKE_alphatest_ibuf(ibuf) ? 32 : 24; + ibuf->planes= BKE_alphatest_ibuf(ibuf) ? 32 : 24; } } - if(simopts->imtype==R_MULTILAYER) { + if(simopts->im_format.imtype==R_IMF_IMTYPE_MULTILAYER) { Scene *scene= CTX_data_scene(C); RenderResult *rr= BKE_image_acquire_renderresult(scene, ima); if(rr) { - RE_WriteRenderResult(op->reports, rr, simopts->filepath, simopts->quality); + RE_WriteRenderResult(op->reports, rr, simopts->filepath, simopts->im_format.quality); ok= TRUE; } else { @@ -1086,8 +1074,10 @@ static void save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveI } BKE_image_release_renderresult(scene, ima); } - else if (BKE_write_ibuf(ibuf, simopts->filepath, simopts->imtype, simopts->subimtype, simopts->quality)) { - ok= TRUE; + else { + if (BKE_write_ibuf_as(ibuf, simopts->filepath, &simopts->im_format, save_copy)) { + ok= TRUE; + } } if (ok) { @@ -1139,27 +1129,40 @@ static void save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveI ED_space_image_release_buffer(sima, lock); } +static void image_save_as_free(wmOperator *op) +{ + if (op->customdata) { + MEM_freeN(op->customdata); + op->customdata= NULL; + } +} + static int image_save_as_exec(bContext *C, wmOperator *op) { SpaceImage *sima= CTX_wm_space_image(C); SaveImageOptions simopts; + save_image_options_defaults(&simopts); + /* just incase to initialize values, * these should be set on invoke or by the caller. */ - save_image_options_defaults(&simopts); - save_image_options_from_op(&simopts, op, CTX_data_scene(C)); + save_image_options_init(&simopts, sima, CTX_data_scene(C), 0); + + save_image_options_from_op(&simopts, op); save_image_doit(C, sima, op, &simopts, TRUE); + image_save_as_free(op); return OPERATOR_FINISHED; } static int image_save_as_check(bContext *UNUSED(C), wmOperator *op) { + ImageFormatData *imf= op->customdata; char filepath[FILE_MAX]; RNA_string_get(op->ptr, "filepath", filepath); - if(BKE_add_image_extension(filepath, RNA_enum_get(op->ptr, "file_format"))) { + if(BKE_add_image_extension(filepath, imf->imtype)) { RNA_string_set(op->ptr, "filepath", filepath); return TRUE; } @@ -1185,15 +1188,51 @@ static int image_save_as_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(eve RNA_boolean_set(op->ptr, "copy", TRUE); } - // XXX note: we can give default menu enums to operator for this + op->customdata= MEM_mallocN(sizeof(simopts.im_format), __func__); + memcpy(op->customdata, &simopts.im_format, sizeof(simopts.im_format)); + image_filesel(C, op, simopts.filepath); return OPERATOR_RUNNING_MODAL; } +static int image_save_as_cancel(bContext *UNUSED(C), wmOperator *op) +{ + image_save_as_free(op); + + return OPERATOR_CANCELLED; +} + +static int image_save_as_draw_check_prop(PointerRNA *ptr, PropertyRNA *prop) +{ + const char *prop_id= RNA_property_identifier(prop); + + return !(strcmp(prop_id, "filepath") == 0 || + strcmp(prop_id, "directory") == 0 || + strcmp(prop_id, "filename") == 0 || + /* when saving a copy, relative path has no effect */ + ((strcmp(prop_id, "relative_path") == 0) && RNA_boolean_get(ptr, "copy")) + ); +} + +static void image_save_as_draw(bContext *UNUSED(C), wmOperator *op) +{ + uiLayout *layout= op->layout; + ImageFormatData *imf= op->customdata; + PointerRNA ptr; + + /* image template */ + RNA_pointer_create(NULL, &RNA_ImageFormatSettings, imf, &ptr); + uiTemplateImageSettings(layout, &ptr); + + /* main draw call */ + RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr); + uiDefAutoButsRNA(layout, &ptr, image_save_as_draw_check_prop, '\0'); +} + void IMAGE_OT_save_as(wmOperatorType *ot) { - PropertyRNA *prop; +// PropertyRNA *prop; /* identifiers */ ot->name= "Save As Image"; @@ -1203,22 +1242,17 @@ void IMAGE_OT_save_as(wmOperatorType *ot) ot->exec= image_save_as_exec; ot->check= image_save_as_check; ot->invoke= image_save_as_invoke; + ot->cancel= image_save_as_cancel; + ot->ui= image_save_as_draw; ot->poll= space_image_buffer_exists_poll; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; /* properties */ - - /* format options */ - RNA_def_enum(ot->srna, "file_format", image_file_type_items, R_PNG, "File Type", "File type to save image as"); - RNA_def_enum(ot->srna, "color_mode", image_color_mode_items, R_PLANES24, "Channels", "Image channels to save"); - prop= RNA_def_int(ot->srna, "file_quality", 90, 0, 100, "Quality", "", 0, 100); - RNA_def_property_subtype(prop, PROP_PERCENTAGE); + RNA_def_boolean(ot->srna, "copy", 0, "Copy", "Create a new image file without modifying the current image in blender"); WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH); - - RNA_def_boolean(ot->srna, "copy", 0, "Copy", "Create a new image file without modifying the current image in blender"); } /******************** save image operator ********************/ @@ -1231,7 +1265,7 @@ static int image_save_exec(bContext *C, wmOperator *op) if (save_image_options_init(&simopts, sima, scene, FALSE) == 0) return OPERATOR_CANCELLED; - save_image_options_from_op(&simopts, op, scene); + save_image_options_from_op(&simopts, op); if (BLI_exists(simopts.filepath) && BLI_file_is_writable(simopts.filepath)) { save_image_doit(C, sima, op, &simopts, FALSE); diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c index 2f69fc5f99f..e5255448ae9 100644 --- a/source/blender/editors/space_logic/logic_window.c +++ b/source/blender/editors/space_logic/logic_window.c @@ -3222,7 +3222,7 @@ static int is_sensor_linked(uiBlock *block, bSensor *sens) static void draw_sensor_header(uiLayout *layout, PointerRNA *ptr, PointerRNA *logic_ptr) { - uiLayout *box, *row, *subrow; + uiLayout *box, *row, *sub; bSensor *sens= (bSensor *)ptr->data; box= uiLayoutBox(layout); @@ -3237,15 +3237,15 @@ static void draw_sensor_header(uiLayout *layout, PointerRNA *ptr, PointerRNA *lo uiItemL(row, sens->name, ICON_NONE); } - subrow= uiLayoutRow(row, 0); - uiLayoutSetActive(subrow, ((RNA_boolean_get(logic_ptr, "show_sensors_active_states") + sub= uiLayoutRow(row, 0); + uiLayoutSetActive(sub, ((RNA_boolean_get(logic_ptr, "show_sensors_active_states") && RNA_boolean_get(ptr, "show_expanded")) || RNA_boolean_get(ptr, "pin"))); - uiItemR(subrow, ptr, "pin", UI_ITEM_R_NO_BG, "", ICON_NONE); + uiItemR(sub, ptr, "pin", UI_ITEM_R_NO_BG, "", ICON_NONE); if(RNA_boolean_get(ptr, "show_expanded")==0) { - subrow= uiLayoutRow(row, 1); - uiItemEnumO(subrow, "LOGIC_OT_sensor_move", "", ICON_TRIA_UP, "direction", 1); // up - uiItemEnumO(subrow, "LOGIC_OT_sensor_move", "", ICON_TRIA_DOWN, "direction", 2); // down + sub= uiLayoutRow(row, 1); + uiItemEnumO(sub, "LOGIC_OT_sensor_move", "", ICON_TRIA_UP, "direction", 1); // up + uiItemEnumO(sub, "LOGIC_OT_sensor_move", "", ICON_TRIA_DOWN, "direction", 2); // down } uiItemO(row, "", ICON_X, "LOGIC_OT_sensor_remove"); @@ -3253,7 +3253,7 @@ static void draw_sensor_header(uiLayout *layout, PointerRNA *ptr, PointerRNA *lo static void draw_sensor_internal_header(uiLayout *layout, PointerRNA *ptr) { - uiLayout *box, *split, *subrow, *row; + uiLayout *box, *split, *sub, *row; box= uiLayoutBox(layout); split = uiLayoutSplit(box, 0.45, 0); @@ -3262,17 +3262,16 @@ static void draw_sensor_internal_header(uiLayout *layout, PointerRNA *ptr) uiItemR(row, ptr, "use_pulse_true_level", 0, "", ICON_DOTSUP); uiItemR(row, ptr, "use_pulse_false_level", 0, "", ICON_DOTSDOWN); - subrow=uiLayoutRow(row, 0); - uiLayoutSetActive(subrow, (RNA_boolean_get(ptr, "use_pulse_true_level") + sub=uiLayoutRow(row, 0); + uiLayoutSetActive(sub, (RNA_boolean_get(ptr, "use_pulse_true_level") || RNA_boolean_get(ptr, "use_pulse_false_level"))); - uiItemR(subrow, ptr, "frequency", 0, "Freq", ICON_NONE); + uiItemR(sub, ptr, "frequency", 0, "Freq", ICON_NONE); row= uiLayoutRow(split, 1); uiItemR(row, ptr, "use_level", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); uiItemR(row, ptr, "use_tap", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - row= uiLayoutRow(split, 1); - uiItemR(row, ptr, "invert", UI_ITEM_R_TOGGLE, "Invert", ICON_NONE); + uiItemR(split, ptr, "invert", UI_ITEM_R_TOGGLE, "Invert", ICON_NONE); } /* sensors in alphabetical order */ @@ -3577,7 +3576,7 @@ static void draw_brick_sensor(uiLayout *layout, PointerRNA *ptr, bContext *C) /* Controller code */ static void draw_controller_header(uiLayout *layout, PointerRNA *ptr, int xco, int width, int yco) { - uiLayout *box, *row, *subrow; + uiLayout *box, *row, *sub; bController *cont= (bController *)ptr->data; char state[3]; @@ -3601,9 +3600,9 @@ static void draw_controller_header(uiLayout *layout, PointerRNA *ptr, int xco, i uiItemR(row, ptr, "use_priority", 0, "", ICON_NONE); if(RNA_boolean_get(ptr, "show_expanded")==0) { - subrow= uiLayoutRow(row, 1); - uiItemEnumO(subrow, "LOGIC_OT_controller_move", "", ICON_TRIA_UP, "direction", 1); // up - uiItemEnumO(subrow, "LOGIC_OT_controller_move", "", ICON_TRIA_DOWN, "direction", 2); // down + sub= uiLayoutRow(row, 1); + uiItemEnumO(sub, "LOGIC_OT_controller_move", "", ICON_TRIA_UP, "direction", 1); // up + uiItemEnumO(sub, "LOGIC_OT_controller_move", "", ICON_TRIA_DOWN, "direction", 2); // down } uiItemO(row, "", ICON_X, "LOGIC_OT_controller_remove"); } @@ -3615,7 +3614,7 @@ static void draw_controller_expression(uiLayout *layout, PointerRNA *ptr) static void draw_controller_python(uiLayout *layout, PointerRNA *ptr) { - uiLayout *split, *subsplit; + uiLayout *split, *sub; split = uiLayoutSplit(layout, 0.3, 1); uiItemR(split, ptr, "mode", 0, "", ICON_NONE); @@ -3623,9 +3622,9 @@ static void draw_controller_python(uiLayout *layout, PointerRNA *ptr) uiItemR(split, ptr, "text", 0, "", ICON_NONE); } else { - subsplit = uiLayoutSplit(split, 0.8, 0); - uiItemR(subsplit, ptr, "module", 0, "", ICON_NONE); - uiItemR(subsplit, ptr, "use_debug", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); + sub = uiLayoutSplit(split, 0.8, 0); + uiItemR(sub, ptr, "module", 0, "", ICON_NONE); + uiItemR(sub, ptr, "use_debug", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); } } @@ -3670,7 +3669,7 @@ static void draw_brick_controller(uiLayout *layout, PointerRNA *ptr) /* Actuator code */ static void draw_actuator_header(uiLayout *layout, PointerRNA *ptr, PointerRNA *logic_ptr) { - uiLayout *box, *row, *subrow; + uiLayout *box, *row, *sub; bActuator *act= (bActuator *)ptr->data; box= uiLayoutBox(layout); @@ -3685,15 +3684,15 @@ static void draw_actuator_header(uiLayout *layout, PointerRNA *ptr, PointerRNA * uiItemL(row, act->name, ICON_NONE); } - subrow= uiLayoutRow(row, 0); - uiLayoutSetActive(subrow, ((RNA_boolean_get(logic_ptr, "show_actuators_active_states") + sub= uiLayoutRow(row, 0); + uiLayoutSetActive(sub, ((RNA_boolean_get(logic_ptr, "show_actuators_active_states") && RNA_boolean_get(ptr, "show_expanded")) || RNA_boolean_get(ptr, "pin"))); - uiItemR(subrow, ptr, "pin", UI_ITEM_R_NO_BG, "", ICON_NONE); + uiItemR(sub, ptr, "pin", UI_ITEM_R_NO_BG, "", ICON_NONE); if(RNA_boolean_get(ptr, "show_expanded")==0) { - subrow= uiLayoutRow(row, 1); - uiItemEnumO(subrow, "LOGIC_OT_actuator_move", "", ICON_TRIA_UP, "direction", 1); // up - uiItemEnumO(subrow, "LOGIC_OT_actuator_move", "", ICON_TRIA_DOWN, "direction", 2); // down + sub= uiLayoutRow(row, 1); + uiItemEnumO(sub, "LOGIC_OT_actuator_move", "", ICON_TRIA_UP, "direction", 1); // up + uiItemEnumO(sub, "LOGIC_OT_actuator_move", "", ICON_TRIA_DOWN, "direction", 2); // down } uiItemO(row, "", ICON_X, "LOGIC_OT_actuator_remove"); } @@ -3702,20 +3701,20 @@ static void draw_actuator_action(uiLayout *layout, PointerRNA *ptr) { Object *ob = (Object *)ptr->id.data; PointerRNA settings_ptr; - uiLayout *row, *subrow, *col; + uiLayout *row, *sub; RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr); row= uiLayoutRow(layout, 0); uiItemR(row, ptr, "play_mode", 0, "", ICON_NONE); - subrow= uiLayoutRow(row, 1); - uiItemR(subrow, ptr, "use_force", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - uiItemR(subrow, ptr, "use_additive", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); + sub= uiLayoutRow(row, 1); + uiItemR(sub, ptr, "use_force", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); + uiItemR(sub, ptr, "use_additive", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - col = uiLayoutColumn(subrow, 0); - uiLayoutSetActive(col, (RNA_boolean_get(ptr, "use_additive") || RNA_boolean_get(ptr, "use_force"))); - uiItemR(col, ptr, "use_local", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); + row = uiLayoutColumn(sub, 0); + uiLayoutSetActive(row, (RNA_boolean_get(ptr, "use_additive") || RNA_boolean_get(ptr, "use_force"))); + uiItemR(row, ptr, "use_local", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); row= uiLayoutRow(layout, 0); uiItemR(row, ptr, "action", 0, "", ICON_NONE); @@ -3740,11 +3739,10 @@ static void draw_actuator_action(uiLayout *layout, PointerRNA *ptr) uiItemR(row, ptr, "layer", 0, NULL, ICON_NONE); uiItemR(row, ptr, "layer_weight", 0, NULL, ICON_NONE); - row= uiLayoutRow(layout, 0); uiItemPointerR(layout, ptr, "frame_property", &settings_ptr, "properties", NULL, ICON_NONE); #ifdef __NLA_ACTION_BY_MOTION_ACTUATOR - uiItemR(row, "stride_length", 0, NULL, ICON_NONE); + uiItemR(layout, "stride_length", 0, NULL, ICON_NONE); #endif } @@ -3829,7 +3827,7 @@ static void draw_actuator_camera(uiLayout *layout, PointerRNA *ptr) static void draw_actuator_constraint(uiLayout *layout, PointerRNA *ptr, bContext *C) { - uiLayout *row, *col, *subcol, *split; + uiLayout *row, *col, *sub, *split; PointerRNA main_ptr; RNA_main_pointer_create(CTX_data_main(C), &main_ptr); @@ -3855,15 +3853,15 @@ static void draw_actuator_constraint(uiLayout *layout, PointerRNA *ptr, bContext uiItemR(row, ptr, "use_normal", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); row = uiLayoutRow(layout, 0); - col = uiLayoutColumn(row, 0); + col = uiLayoutColumn(row, 1); uiItemL(col, "Range:", ICON_NONE); uiItemR(col, ptr, "range", 0, "", ICON_NONE); col = uiLayoutColumn(row, 1); uiItemR(col, ptr, "use_force_distance", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - subcol = uiLayoutColumn(col, 0); - uiLayoutSetActive(subcol, RNA_boolean_get(ptr, "use_force_distance")==1); - uiItemR(subcol, ptr, "distance", 0, "", ICON_NONE); + sub = uiLayoutColumn(col, 0); + uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_force_distance")==1); + uiItemR(sub, ptr, "distance", 0, "", ICON_NONE); uiItemR(layout, ptr, "damping", UI_ITEM_R_SLIDER , NULL, ICON_NONE); @@ -3931,7 +3929,7 @@ static void draw_actuator_constraint(uiLayout *layout, PointerRNA *ptr, bContext static void draw_actuator_edit_object(uiLayout *layout, PointerRNA *ptr) { Object *ob = (Object *)ptr->id.data; - uiLayout *row, *split, *subsplit; + uiLayout *row, *split, *sub; uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE); switch (RNA_enum_get(ptr, "mode")) @@ -3967,9 +3965,9 @@ static void draw_actuator_edit_object(uiLayout *layout, PointerRNA *ptr) case ACT_EDOB_TRACK_TO: split = uiLayoutSplit(layout, 0.5, 0); uiItemR(split, ptr, "track_object", 0, NULL, ICON_NONE); - subsplit = uiLayoutSplit(split, 0.7, 0); - uiItemR(subsplit, ptr, "time", 0, NULL, ICON_NONE); - uiItemR(subsplit, ptr, "use_3d_tracking", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); + sub = uiLayoutSplit(split, 0.7, 0); + uiItemR(sub, ptr, "time", 0, NULL, ICON_NONE); + uiItemR(sub, ptr, "use_3d_tracking", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); break; case ACT_EDOB_DYNAMICS: if(ob->type != OB_MESH) { @@ -4041,7 +4039,7 @@ static void draw_actuator_motion(uiLayout *layout, PointerRNA *ptr) { Object *ob; PointerRNA settings_ptr; - uiLayout *split, *row, *col, *subcol; + uiLayout *split, *row, *col, *sub; int physics_type; ob = (Object *)ptr->id.data; @@ -4100,24 +4098,24 @@ static void draw_actuator_motion(uiLayout *layout, PointerRNA *ptr) row = uiLayoutRow(layout, 0); col = uiLayoutColumn(row, 0); uiItemR(col, ptr, "use_servo_limit_x", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - subcol = uiLayoutColumn(col, 1); - uiLayoutSetActive(subcol, RNA_boolean_get(ptr, "use_servo_limit_x")==1); - uiItemR(subcol, ptr, "force_max_x", 0, NULL, ICON_NONE); - uiItemR(subcol, ptr, "force_min_x", 0, NULL, ICON_NONE); + sub = uiLayoutColumn(col, 1); + uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_servo_limit_x")==1); + uiItemR(sub, ptr, "force_max_x", 0, NULL, ICON_NONE); + uiItemR(sub, ptr, "force_min_x", 0, NULL, ICON_NONE); col = uiLayoutColumn(row, 0); uiItemR(col, ptr, "use_servo_limit_y", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - subcol = uiLayoutColumn(col, 1); - uiLayoutSetActive(subcol, RNA_boolean_get(ptr, "use_servo_limit_y")==1); - uiItemR(subcol, ptr, "force_max_y", 0, NULL, ICON_NONE); - uiItemR(subcol, ptr, "force_min_y", 0, NULL, ICON_NONE); + sub = uiLayoutColumn(col, 1); + uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_servo_limit_y")==1); + uiItemR(sub, ptr, "force_max_y", 0, NULL, ICON_NONE); + uiItemR(sub, ptr, "force_min_y", 0, NULL, ICON_NONE); col = uiLayoutColumn(row, 0); uiItemR(col, ptr, "use_servo_limit_z", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - subcol = uiLayoutColumn(col, 1); - uiLayoutSetActive(subcol, RNA_boolean_get(ptr, "use_servo_limit_z")==1); - uiItemR(subcol, ptr, "force_max_z", 0, NULL, ICON_NONE); - uiItemR(subcol, ptr, "force_min_z", 0, NULL, ICON_NONE); + sub = uiLayoutColumn(col, 1); + uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_servo_limit_z")==1); + uiItemR(sub, ptr, "force_max_z", 0, NULL, ICON_NONE); + uiItemR(sub, ptr, "force_min_z", 0, NULL, ICON_NONE); //XXXACTUATOR missing labels from original 2.49 ui (e.g. Servo, Min, Max, Fast) //Layout designers willing to help on that, please compare with 2.49 ui @@ -4133,7 +4131,7 @@ static void draw_actuator_motion(uiLayout *layout, PointerRNA *ptr) static void draw_actuator_parent(uiLayout *layout, PointerRNA *ptr) { - uiLayout *row, *subrow; + uiLayout *row, *sub; uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE); @@ -4142,9 +4140,9 @@ static void draw_actuator_parent(uiLayout *layout, PointerRNA *ptr) row = uiLayoutRow(layout, 0); uiItemR(row, ptr, "use_compound", 0, NULL, ICON_NONE); - subrow= uiLayoutRow(row, 0); - uiLayoutSetActive(subrow, RNA_boolean_get(ptr, "use_compound")==1); - uiItemR(subrow, ptr, "use_ghost", 0, NULL, ICON_NONE); + sub= uiLayoutRow(row, 0); + uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_compound")==1); + uiItemR(sub, ptr, "use_ghost", 0, NULL, ICON_NONE); } } @@ -4156,7 +4154,7 @@ static void draw_actuator_property(uiLayout *layout, PointerRNA *ptr) Object *ob_from= pa->ob; PointerRNA settings_ptr, obj_settings_ptr; - uiLayout *row, *subrow; + uiLayout *row, *sub; RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr); @@ -4181,9 +4179,9 @@ static void draw_actuator_property(uiLayout *layout, PointerRNA *ptr) uiItemPointerR(row, ptr, "object_property", &obj_settings_ptr, "properties", NULL, ICON_NONE); }else { - subrow= uiLayoutRow(row, 0); - uiLayoutSetActive(subrow, 0); - uiItemR(subrow, ptr, "object_property", 0, NULL, ICON_NONE); + sub= uiLayoutRow(row, 0); + uiLayoutSetActive(sub, 0); + uiItemR(sub, ptr, "object_property", 0, NULL, ICON_NONE); } break; } diff --git a/source/blender/editors/space_nla/nla_buttons.c b/source/blender/editors/space_nla/nla_buttons.c index 1d2d6b4f8a7..9bacdf8327b 100644 --- a/source/blender/editors/space_nla/nla_buttons.c +++ b/source/blender/editors/space_nla/nla_buttons.c @@ -295,7 +295,7 @@ static void nla_panel_properties(const bContext *C, Panel *pa) { PointerRNA strip_ptr; uiLayout *layout= pa->layout; - uiLayout *column, *row, *subcol; + uiLayout *column, *row, *sub; uiBlock *block; short showEvalProps = 1; @@ -340,10 +340,10 @@ static void nla_panel_properties(const bContext *C, Panel *pa) uiLayoutSetActive(column, RNA_boolean_get(&strip_ptr, "use_animated_influence")==0); uiItemR(column, &strip_ptr, "use_auto_blend", 0, NULL, ICON_NONE); // XXX as toggle? - subcol= uiLayoutColumn(column, 1); - uiLayoutSetActive(subcol, RNA_boolean_get(&strip_ptr, "use_auto_blend")==0); - uiItemR(subcol, &strip_ptr, "blend_in", 0, NULL, ICON_NONE); - uiItemR(subcol, &strip_ptr, "blend_out", 0, NULL, ICON_NONE); + sub= uiLayoutColumn(column, 1); + uiLayoutSetActive(sub, RNA_boolean_get(&strip_ptr, "use_auto_blend")==0); + uiItemR(sub, &strip_ptr, "blend_in", 0, NULL, ICON_NONE); + uiItemR(sub, &strip_ptr, "blend_out", 0, NULL, ICON_NONE); /* settings */ column= uiLayoutColumn(layout, 1); @@ -396,7 +396,7 @@ static void nla_panel_evaluation(const bContext *C, Panel *pa) { PointerRNA strip_ptr; uiLayout *layout= pa->layout; - uiLayout *column, *subcolumn, *subrow; + uiLayout *col, *sub; uiBlock *block; /* check context and also validity of pointer */ @@ -406,23 +406,21 @@ static void nla_panel_evaluation(const bContext *C, Panel *pa) block= uiLayoutGetBlock(layout); uiBlockSetHandleFunc(block, do_nla_region_buttons, NULL); - column= uiLayoutColumn(layout, 1); - uiItemR(column, &strip_ptr, "use_animated_influence", 0, NULL, ICON_NONE); - - subcolumn= uiLayoutColumn(column, 1); - uiLayoutSetEnabled(subcolumn, RNA_boolean_get(&strip_ptr, "use_animated_influence")); - uiItemR(subcolumn, &strip_ptr, "influence", 0, NULL, ICON_NONE); - + col= uiLayoutColumn(layout, 1); + uiItemR(col, &strip_ptr, "use_animated_influence", 0, NULL, ICON_NONE); - column= uiLayoutColumn(layout, 1); - subrow= uiLayoutRow(column, 0); - uiItemR(subrow, &strip_ptr, "use_animated_time", 0, NULL, ICON_NONE); - uiItemR(subrow, &strip_ptr, "use_animated_time_cyclic", 0, NULL, ICON_NONE); - - subcolumn= uiLayoutColumn(column, 1); - subrow= uiLayoutRow(subcolumn, 0); - uiLayoutSetEnabled(subrow, RNA_boolean_get(&strip_ptr, "use_animated_time")); - uiItemR(subcolumn, &strip_ptr, "strip_time", 0, NULL, ICON_NONE); + sub= uiLayoutColumn(col, 1); + uiLayoutSetEnabled(sub, RNA_boolean_get(&strip_ptr, "use_animated_influence")); + uiItemR(sub, &strip_ptr, "influence", 0, NULL, ICON_NONE); + + col= uiLayoutColumn(layout, 1); + sub= uiLayoutRow(col, 0); + uiItemR(sub, &strip_ptr, "use_animated_time", 0, NULL, ICON_NONE); + uiItemR(sub, &strip_ptr, "use_animated_time_cyclic", 0, NULL, ICON_NONE); + + sub= uiLayoutRow(col, 0); + uiLayoutSetEnabled(sub, RNA_boolean_get(&strip_ptr, "use_animated_time")); + uiItemR(sub, &strip_ptr, "strip_time", 0, NULL, ICON_NONE); } /* F-Modifiers for active NLA-Strip */ diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index 92592a7c071..4e9ac08d8c8 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -471,6 +471,7 @@ static void node_update_group(const bContext *C, bNodeTree *ntree, bNode *gnode) float locx, locy; rctf *rect= &gnode->totr; float node_group_frame= U.dpi*NODE_GROUP_FRAME/72; + float group_header= 26*U.dpi/72; int counter; int dy; @@ -594,6 +595,15 @@ static void node_update_group(const bContext *C, bNodeTree *ntree, bNode *gnode) gsock = gsock->next; } } + + /* Set the block bounds to clip mouse events from underlying nodes. + * Add margin for header and input/output columns. + */ + uiExplicitBoundsBlock(gnode->block, + rect->xmin - node_group_frame, + rect->ymin, + rect->xmax + node_group_frame, + rect->ymax + group_header); } } @@ -1001,7 +1011,6 @@ static void node_shader_buts_attribute(uiLayout *layout, bContext *UNUSED(C), Po static void node_shader_buts_tex_image(uiLayout *layout, bContext *C, PointerRNA *ptr) { - //uiItemR(layout, ptr, "image", 0, "", ICON_NONE); uiTemplateID(layout, C, ptr, "image", NULL, "IMAGE_OT_open", NULL); uiItemR(layout, ptr, "color_space", 0, "", ICON_NONE); } @@ -1633,24 +1642,17 @@ static void node_composit_buts_id_mask(uiLayout *layout, bContext *UNUSED(C), Po static void node_composit_buts_file_output(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - uiLayout *col, *row; + bNode *node= ptr->data; + NodeImageFile *nif= node->storage; + PointerRNA imfptr; + + uiLayout *row; + + uiItemR(layout, ptr, "filepath", 0, "", ICON_NONE); + + RNA_pointer_create(NULL, &RNA_ImageFormatSettings, &nif->im_format, &imfptr); + uiTemplateImageSettings(layout, &imfptr); - col= uiLayoutColumn(layout, 0); - uiItemR(col, ptr, "filepath", 0, "", ICON_NONE); - uiItemR(col, ptr, "image_type", 0, "", ICON_NONE); - - row= uiLayoutRow(layout, 0); - if (RNA_enum_get(ptr, "image_type")== R_OPENEXR) { - uiItemR(row, ptr, "use_exr_half", 0, NULL, ICON_NONE); - uiItemR(row, ptr, "exr_codec", 0, "", ICON_NONE); - } - else if (RNA_enum_get(ptr, "image_type")== R_JPEG90) { - uiItemR(row, ptr, "quality", UI_ITEM_R_SLIDER, "Quality", ICON_NONE); - } - else if (RNA_enum_get(ptr, "image_type")== R_PNG) { - uiItemR(row, ptr, "quality", UI_ITEM_R_SLIDER, "Compression", ICON_NONE); - } - row= uiLayoutRow(layout, 1); uiItemR(row, ptr, "frame_start", 0, "Start", ICON_NONE); uiItemR(row, ptr, "frame_end", 0, "End", ICON_NONE); diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index c4a7f2cb473..02a8b5cc9fb 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -197,28 +197,16 @@ static void node_uiblocks_init(const bContext *C, bNodeTree *ntree) bNode *node; char str[32]; - /* add node uiBlocks in reverse order - prevents events going to overlapping nodes */ + /* add node uiBlocks in drawing order - prevents events going to overlapping nodes */ - /* process selected nodes first so they're at the start of the uiblocks list */ - for(node= ntree->nodes.last; node; node= node->prev) { - - if (node->flag & NODE_SELECT) { - /* ui block */ - sprintf(str, "node buttons %p", (void *)node); - node->block= uiBeginBlock(C, CTX_wm_region(C), str, UI_EMBOSS); - uiBlockSetHandleFunc(node->block, do_node_internal_buttons, node); - } - } - - /* then the rest */ - for(node= ntree->nodes.last; node; node= node->prev) { - - if (!(node->flag & (NODE_GROUP_EDIT|NODE_SELECT))) { + for(node= ntree->nodes.first; node; node=node->next) { /* ui block */ sprintf(str, "node buttons %p", (void *)node); node->block= uiBeginBlock(C, CTX_wm_region(C), str, UI_EMBOSS); uiBlockSetHandleFunc(node->block, do_node_internal_buttons, node); - } + + /* this cancels events for background nodes */ + uiBlockSetFlag(node->block, UI_BLOCK_CLIP_EVENTS); } } @@ -339,6 +327,15 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node) node->totr.xmax= locx + node->width; node->totr.ymax= locy; node->totr.ymin= MIN2(dy, locy-2*NODE_DY); + + /* Set the block bounds to clip mouse events from underlying nodes. + * Add a margin for sockets on each side. + */ + uiExplicitBoundsBlock(node->block, + node->totr.xmin - NODE_SOCKSIZE, + node->totr.ymin, + node->totr.xmax + NODE_SOCKSIZE, + node->totr.ymax); } /* based on settings in node, sets drawing rect info. each redraw! */ @@ -391,6 +388,15 @@ static void node_update_hidden(bNode *node) rad+= drad; } } + + /* Set the block bounds to clip mouse events from underlying nodes. + * Add a margin for sockets on each side. + */ + uiExplicitBoundsBlock(node->block, + node->totr.xmin - NODE_SOCKSIZE, + node->totr.ymin, + node->totr.xmax + NODE_SOCKSIZE, + node->totr.ymax); } void node_update_default(const bContext *C, bNodeTree *ntree, bNode *node) @@ -927,15 +933,16 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d) if(snode->nodetree) { bNode *node; - /* init ui blocks for opened node group trees first - * so they're in the correct depth stack order */ + node_uiblocks_init(C, snode->nodetree); + + /* uiBlocks must be initialized in drawing order for correct event clipping. + * Node group internal blocks added after the main group block. + */ for(node= snode->nodetree->nodes.first; node; node= node->next) { if(node->flag & NODE_GROUP_EDIT) node_uiblocks_init(C, (bNodeTree *)node->id); } - node_uiblocks_init(C, snode->nodetree); - node_update_nodetree(C, snode->nodetree, 0.0f, 0.0f); node_draw_nodetree(C, ar, snode, snode->nodetree); diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c index 27ad2c4fd6d..f4e46d0255d 100644 --- a/source/blender/editors/space_outliner/outliner_tools.c +++ b/source/blender/editors/space_outliner/outliner_tools.c @@ -297,8 +297,6 @@ static void object_delete_cb(bContext *C, Scene *scene, TreeElement *te, TreeSto if(base==NULL) base= object_in_scene((Object *)tselem->id, scene); if(base) { - SpaceOops *soops= CTX_wm_space_outliner(C); - // check also library later if(scene->obedit==base->object) ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR|EM_DO_UNDO); @@ -306,15 +304,7 @@ static void object_delete_cb(bContext *C, Scene *scene, TreeElement *te, TreeSto ED_base_object_free_and_unlink(CTX_data_main(C), scene, base); te->directdata= NULL; tselem->id= NULL; - - /* XXX: tree management normally happens from draw_outliner(), but when - you're clicking to fast on Delete object from context menu in - outliner several mouse events can be handled in one cycle without - handling notifiers/redraw which leads to deleting the same object twice. - cleanup tree here to prevent such cases. */ - outliner_cleanup_tree(soops); } - } static void id_local_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeElement *UNUSED(te), TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem) @@ -579,6 +569,14 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op) } else if(event==4) { outliner_do_object_operation(C, scene, soops, &soops->tree, object_delete_cb); + + /* XXX: tree management normally happens from draw_outliner(), but when + you're clicking to fast on Delete object from context menu in + outliner several mouse events can be handled in one cycle without + handling notifiers/redraw which leads to deleting the same object twice. + cleanup tree here to prevent such cases. */ + outliner_cleanup_tree(soops); + DAG_scene_sort(bmain, scene); str= "Delete Objects"; WM_event_add_notifier(C, NC_SCENE|ND_OB_ACTIVE, scene); diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index ddfa2fd915f..2b59a02deae 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -512,7 +512,7 @@ static void draw_seq_extensions(Scene *scene, ARegion *ar, Sequence *seq) static void draw_seq_text(View2D *v2d, Sequence *seq, float x1, float x2, float y1, float y2, const unsigned char background_col[3]) { rctf rect; - char str[32 + FILE_MAXDIR+FILE_MAXFILE]; + char str[32 + FILE_MAX]; const char *name= seq->name+2; char col[4]; diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index e36cdd32ab8..16ee32d10a2 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -449,9 +449,9 @@ static void txt_write_file(Text *text, ReportList *reports) FILE *fp; TextLine *tmp; struct stat st; - char filepath[FILE_MAXDIR+FILE_MAXFILE]; + char filepath[FILE_MAX]; - BLI_strncpy(filepath, text->name, FILE_MAXDIR+FILE_MAXFILE); + BLI_strncpy(filepath, text->name, FILE_MAX); BLI_path_abs(filepath, G.main->name); fp= fopen(filepath, "w"); @@ -3053,12 +3053,12 @@ int text_file_modified(Text *text) { struct stat st; int result; - char file[FILE_MAXDIR+FILE_MAXFILE]; + char file[FILE_MAX]; if(!text || !text->name) return 0; - BLI_strncpy(file, text->name, FILE_MAXDIR+FILE_MAXFILE); + BLI_strncpy(file, text->name, FILE_MAX); BLI_path_abs(file, G.main->name); if(!BLI_exists(file)) @@ -3082,11 +3082,11 @@ static void text_ignore_modified(Text *text) { struct stat st; int result; - char file[FILE_MAXDIR+FILE_MAXFILE]; + char file[FILE_MAX]; if(!text || !text->name) return; - BLI_strncpy(file, text->name, FILE_MAXDIR+FILE_MAXFILE); + BLI_strncpy(file, text->name, FILE_MAX); BLI_path_abs(file, G.main->name); if(!BLI_exists(file)) return; diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 0ce2e891b6e..be3a599330b 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -112,6 +112,12 @@ ((ELEM(vd->drawtype, OB_TEXTURE, OB_MATERIAL) && dt>OB_SOLID) || \ (vd->drawtype==OB_SOLID && vd->flag2 & V3D_SOLID_TEX)) +typedef enum eWireDrawMode { + OBDRAW_WIRE_OFF= 0, + OBDRAW_WIRE_ON= 1, + OBDRAW_WIRE_ON_DEPTH= 2 +} eWireDrawMode; + static void draw_bounding_volume(Scene *scene, Object *ob, char type); static void drawcube_size(float size); @@ -1093,7 +1099,12 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, /* cone can't be drawn for duplicated lamps, because duplilist would be freed to */ /* the moment of view3d_draw_transp() call */ const short is_view= (rv3d->persp==RV3D_CAMOB && v3d->camera == base->object); - const short drawcone= (dt>OB_WIRE && !(G.f & G_PICKSEL) && (la->type == LA_SPOT) && (la->mode & LA_SHOW_CONE) && !(base->flag & OB_FROMDUPLI) && !is_view); + const short drawcone= ((dt > OB_WIRE) && + !(G.f & G_PICKSEL) && + (la->type == LA_SPOT) && + (la->mode & LA_SHOW_CONE) && + !(base->flag & OB_FROMDUPLI) && + !is_view); if(drawcone && !v3d->transp) { /* in this case we need to draw delayed */ @@ -1568,7 +1579,7 @@ static void draw_viewport_reconstruction(Scene *scene, Base *base, View3D *v3d, glBegin(GL_LINE_STRIP); for(a= 0; a<reconstruction->camnr; a++, camera++) { - glVertex3f(camera->mat[3][0], camera->mat[3][1], camera->mat[3][2]); + glVertex3fv(camera->mat[3]); } glEnd(); @@ -1806,7 +1817,7 @@ static void drawlattice__point(Lattice *lt, DispList *dl, int u, int v, int w, i float col[3]; MDeformWeight *mdw= defvert_find_index (lt->dvert+index, use_wcol-1); - weight_to_rgb(mdw?mdw->weight:0.0f, col, col+1, col+2); + weight_to_rgb(col, mdw?mdw->weight:0.0f); glColor3fv(col); } @@ -2747,35 +2758,29 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object if(dt>OB_WIRE) { if(CHECK_OB_DRAWTEXTURE(v3d, dt)) { if(draw_glsl_material(scene, ob, v3d, dt)) { - /* if em has no faces the drawMappedFaces callback will fail */ - if(em->faces.first) { - glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW); - - finalDM->drawMappedFacesGLSL(finalDM, GPU_enable_material, - draw_em_fancy__setGLSLFaceOpts, NULL); - GPU_disable_material(); - - glFrontFace(GL_CCW); - } + glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW); + + finalDM->drawMappedFacesGLSL(finalDM, GPU_enable_material, + draw_em_fancy__setGLSLFaceOpts, NULL); + GPU_disable_material(); + + glFrontFace(GL_CCW); } else { draw_mesh_textured(scene, v3d, rv3d, ob, finalDM, 0); } } else { - /* if em has no faces the drawMappedFaces callback will fail */ - if(em->faces.first) { - /* 3 floats for position, 3 for normal and times two because the faces may actually be quads instead of triangles */ - glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, me->flag & ME_TWOSIDED); - - glEnable(GL_LIGHTING); - glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW); - - finalDM->drawMappedFaces(finalDM, draw_em_fancy__setFaceOpts, NULL, 0, GPU_enable_material, NULL); - - glFrontFace(GL_CCW); - glDisable(GL_LIGHTING); - } + /* 3 floats for position, 3 for normal and times two because the faces may actually be quads instead of triangles */ + glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, me->flag & ME_TWOSIDED); + + glEnable(GL_LIGHTING); + glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW); + + finalDM->drawMappedFaces(finalDM, draw_em_fancy__setFaceOpts, NULL, 0, GPU_enable_material, NULL); + + glFrontFace(GL_CCW); + glDisable(GL_LIGHTING); } // Setup for drawing wire over, disable zbuffer @@ -2944,7 +2949,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D Mesh *me = ob->data; Material *ma= give_current_material(ob, 1); const short hasHaloMat = (ma && (ma->material_type == MA_TYPE_HALO)); - int draw_wire = 0; + eWireDrawMode draw_wire= OBDRAW_WIRE_OFF; int /* totvert,*/ totedge, totface; DerivedMesh *dm= mesh_get_derived_final(scene, ob, scene->customdata_mask); ModifierData *md = NULL; @@ -2967,9 +2972,13 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D } } } - - if (ob->dtx&OB_DRAWWIRE) { - draw_wire = 2; /* draw wire after solid using zoffset and depth buffer adjusment */ + + /* Unwanted combination */ + if (draw_flags & DRAW_FACE_SELECT) { + draw_wire= OBDRAW_WIRE_OFF; + } + else if (ob->dtx & OB_DRAWWIRE) { + draw_wire= OBDRAW_WIRE_ON_DEPTH; /* draw wire after solid using zoffset and depth buffer adjusment */ } /* totvert = dm->getNumVerts(dm); */ /*UNUSED*/ @@ -2979,9 +2988,6 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D /* vertexpaint, faceselect wants this, but it doesnt work for shaded? */ glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW); - // Unwanted combination. - if (draw_flags & DRAW_FACE_SELECT) draw_wire = 0; - if(dt==OB_BOUNDBOX) { if((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_WIRE)==0) draw_bounding_volume(scene, ob, ob->boundtype); @@ -2992,12 +2998,17 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D glPointSize(1.0); } else if(dt==OB_WIRE || totface==0) { - draw_wire = 1; /* draw wire only, no depth buffer stuff */ + draw_wire= OBDRAW_WIRE_ON; /* draw wire only, no depth buffer stuff */ } - else if( (draw_flags & DRAW_FACE_SELECT || (ob==OBACT && ob->mode & OB_MODE_TEXTURE_PAINT)) || - CHECK_OB_DRAWTEXTURE(v3d, dt)) + else if ( (draw_flags & DRAW_FACE_SELECT || (ob==OBACT && ob->mode & OB_MODE_TEXTURE_PAINT)) || + CHECK_OB_DRAWTEXTURE(v3d, dt)) { - if ((v3d->flag&V3D_SELECT_OUTLINE) && ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) && (base->flag&SELECT) && !(G.f&G_PICKSEL || (draw_flags & DRAW_FACE_SELECT)) && !draw_wire) { + if ( (v3d->flag & V3D_SELECT_OUTLINE) && + ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) && + (base->flag & SELECT) && + !(G.f & G_PICKSEL || (draw_flags & DRAW_FACE_SELECT)) && + (draw_wire == OBDRAW_WIRE_OFF)) + { draw_mesh_object_outline(v3d, ob, dm); } @@ -3049,7 +3060,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D GPU_disable_material(); /* since we already draw wire as wp guide, dont draw over the top */ - draw_wire= 0; + draw_wire= OBDRAW_WIRE_OFF; } else if (draw_flags & DRAW_DYNAMIC_PAINT_PREVIEW) { /* for object selection draws no shade */ @@ -3058,8 +3069,14 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D } else { /* draw outline */ - if((v3d->flag&V3D_SELECT_OUTLINE) && ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) && (base->flag&SELECT) && !draw_wire && !ob->sculpt) + if ( (v3d->flag & V3D_SELECT_OUTLINE) && + ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) && + (base->flag & SELECT) && + (draw_wire == OBDRAW_WIRE_OFF) && + (ob->sculpt == NULL)) + { draw_mesh_object_outline(v3d, ob, dm); + } /* materials arent compatible with vertex colors */ GPU_end_object_materials(); @@ -3086,8 +3103,14 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D else { Paint *p; - if((v3d->flag&V3D_SELECT_OUTLINE) && ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) && (base->flag&SELECT) && !draw_wire && !ob->sculpt) + if ( (v3d->flag & V3D_SELECT_OUTLINE) && + ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) && + (base->flag & SELECT) && + (draw_wire == OBDRAW_WIRE_OFF) && + (ob->sculpt == NULL)) + { draw_mesh_object_outline(v3d, ob, dm); + } glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, me->flag & ME_TWOSIDED ); @@ -3181,7 +3204,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D } } } - if (draw_wire) { + if (draw_wire != OBDRAW_WIRE_OFF) { /* When using wireframe object traw in particle edit mode * the mesh gets in the way of seeing the particles, fade the wire color @@ -3204,7 +3227,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D * if draw wire is 1 then just drawing wire, no need for depth buffer stuff, * otherwise this wire is to overlay solid mode faces so do some depth buffer tricks. */ - if (dt!=OB_WIRE && draw_wire==2) { + if (dt!=OB_WIRE && (draw_wire == OBDRAW_WIRE_ON_DEPTH)) { bglPolygonOffset(rv3d->dist, 1.0); glDepthMask(0); // disable write in zbuffer, selected edge wires show better } @@ -3212,7 +3235,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D if((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_SOLID)==0) dm->drawEdges(dm, (dt==OB_WIRE || totface==0), me->drawflag & ME_ALLEDGES); - if (dt!=OB_WIRE && draw_wire==2) { + if (dt!=OB_WIRE && (draw_wire == OBDRAW_WIRE_ON_DEPTH)) { glDepthMask(1); bglPolygonOffset(rv3d->dist, 0.0); } @@ -3267,15 +3290,11 @@ static int draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D if(dt>OB_WIRE) { glsl = draw_glsl_material(scene, ob, v3d, dt); - check_alpha = check_material_alpha(base, glsl); - GPU_begin_object_materials(v3d, rv3d, scene, ob, glsl, - (check_alpha)? &do_alpha_pass: NULL); + GPU_begin_object_materials(v3d, rv3d, scene, ob, glsl, NULL); } - // transp in editmode makes the fancy draw over go bad - if (!do_alpha_pass) - draw_em_fancy(scene, v3d, rv3d, ob, em, cageDM, finalDM, dt); + draw_em_fancy(scene, v3d, rv3d, ob, em, cageDM, finalDM, dt); GPU_end_object_materials(); @@ -3728,19 +3747,15 @@ static void draw_particle(ParticleKey *state, int draw_as, short draw, float pix float vec[3], vec2[3]; float *vd = NULL; float *cd = NULL; - float ma_r=0.0f; - float ma_g=0.0f; - float ma_b=0.0f; + float ma_col[3]= {0.0f, 0.0f, 0.0f}; /* null only for PART_DRAW_CIRC */ if(pdd) { vd = pdd->vd; cd = pdd->cd; - if(pdd->ma_r) { - ma_r = *pdd->ma_r; - ma_g = *pdd->ma_g; - ma_b = *pdd->ma_b; + if(pdd->ma_col) { + copy_v3_v3(ma_col, pdd->ma_col); } } @@ -3751,9 +3766,7 @@ static void draw_particle(ParticleKey *state, int draw_as, short draw, float pix copy_v3_v3(vd,state->co); pdd->vd+=3; } if(cd) { - cd[0]=ma_r; - cd[1]=ma_g; - cd[2]=ma_b; + copy_v3_v3(cd, pdd->ma_col); pdd->cd+=3; } break; @@ -3779,9 +3792,9 @@ static void draw_particle(ParticleKey *state, int draw_as, short draw, float pix } else { if(cd) { - cd[0]=cd[3]=cd[6]=cd[9]=cd[12]=cd[15]=ma_r; - cd[1]=cd[4]=cd[7]=cd[10]=cd[13]=cd[16]=ma_g; - cd[2]=cd[5]=cd[8]=cd[11]=cd[14]=cd[17]=ma_b; + cd[0]=cd[3]=cd[6]=cd[ 9]=cd[12]=cd[15]= ma_col[0]; + cd[1]=cd[4]=cd[7]=cd[10]=cd[13]=cd[16]= ma_col[1]; + cd[2]=cd[5]=cd[8]=cd[11]=cd[14]=cd[17]= ma_col[2]; pdd->cd+=18; } sub_v3_v3v3(vec2, state->co, vec); @@ -3826,9 +3839,9 @@ static void draw_particle(ParticleKey *state, int draw_as, short draw, float pix madd_v3_v3v3fl(pdd->vd, state->co, vec, -draw_line[0]); pdd->vd+=3; madd_v3_v3v3fl(pdd->vd, state->co, vec, draw_line[1]); pdd->vd+=3; if(cd) { - cd[0]=cd[3]=ma_r; - cd[1]=cd[4]=ma_g; - cd[2]=cd[5]=ma_b; + cd[0]=cd[3]= ma_col[0]; + cd[1]=cd[4]= ma_col[1]; + cd[2]=cd[5]= ma_col[2]; pdd->cd+=6; } break; @@ -3842,9 +3855,9 @@ static void draw_particle(ParticleKey *state, int draw_as, short draw, float pix { float xvec[3], yvec[3], zvec[3], bb_center[3]; if(cd) { - cd[0]=cd[3]=cd[6]=cd[9]=ma_r; - cd[1]=cd[4]=cd[7]=cd[10]=ma_g; - cd[2]=cd[5]=cd[8]=cd[11]=ma_b; + cd[0]=cd[3]=cd[6]=cd[ 9]= ma_col[0]; + cd[1]=cd[4]=cd[7]=cd[10]= ma_col[1]; + cd[2]=cd[5]=cd[8]=cd[11]= ma_col[2]; pdd->cd+=12; } @@ -3899,7 +3912,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv float timestep, pixsize=1.0, pa_size, r_tilt, r_length; float pa_time, pa_birthtime, pa_dietime, pa_health, intensity; float cfra; - float ma_r=0.0f, ma_g=0.0f, ma_b=0.0f; + float ma_col[3]= {0.0f, 0.0f, 0.0f}; int a, totpart, totpoint=0, totve=0, drawn, draw_as, totchild=0; int select=ob->flag&SELECT, create_cdata=0, need_v=0; GLint polygonmode[2]; @@ -3963,10 +3976,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv if((ma) && (part->draw_col == PART_DRAW_COL_MAT)) { rgb_float_to_byte(&(ma->r), tcol); - - ma_r = ma->r; - ma_g = ma->g; - ma_b = ma->b; + copy_v3_v3(ma_col, &ma->r); } glColor3ubv(tcol); @@ -4132,9 +4142,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv } if(pdd) { - pdd->ma_r = &ma_r; - pdd->ma_g = &ma_g; - pdd->ma_b = &ma_b; + pdd->ma_col= ma_col; } psys->lattice= psys_get_lattice(&sim); @@ -4176,7 +4184,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv intensity= 1.0f; /* should never happen */ } CLAMP(intensity, 0.f, 1.f); - weight_to_rgb(intensity, &ma_r, &ma_g, &ma_b); + weight_to_rgb(ma_col, intensity); } } else{ @@ -4437,7 +4445,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv } /* restore from select */ - glColor3f(ma_r,ma_g,ma_b); + glColor3fv(ma_col); glPointSize(part->draw_size ? part->draw_size : 2.0); glLineWidth(1.0); @@ -4502,7 +4510,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv if(pdd) { /* drop references to stack memory */ - pdd->ma_r= pdd->ma_g= pdd->ma_b= NULL; + pdd->ma_col= NULL; } if( (base->flag & OB_FROMDUPLI) && (ob->flag & OB_FROMGROUP) ) { diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index 70cf113384b..15494d73ea1 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -1365,142 +1365,6 @@ static void view3d_panel_preview(bContext *C, ARegion *ar, short cntrl) // VIEW3 } #endif -#if 0 // XXX not used -static void delete_sketch_armature(bContext *C, void *arg1, void *arg2) -{ - BIF_deleteSketch(C); -} - -static void convert_sketch_armature(bContext *C, void *arg1, void *arg2) -{ - BIF_convertSketch(C); -} - -static void assign_template_sketch_armature(bContext *C, void *arg1, void *arg2) -{ - int index = *(int*)arg1; - BIF_setTemplate(C, index); -} - - -static int view3d_panel_bonesketch_spaces_poll(const bContext *C, PanelType *pt) -{ - Object *obedit = CTX_data_edit_object(C); - - /* replace with check call to sketching lib */ - return (obedit && obedit->type == OB_ARMATURE); -} -static void view3d_panel_bonesketch_spaces(const bContext *C, Panel *pa) -{ - Scene *scene = CTX_data_scene(C); - static int template_index; - static char joint_label[128]; - uiBlock *block; - uiBut *but; - char *bone_name; - int yco = 130; - int nb_joints; - static char subdiv_tooltip[4][64] = { - "Subdivide arcs based on a fixed number of bones", - "Subdivide arcs in bones of equal length", - "Subdivide arcs based on correlation", - "Retarget template to stroke" - }; - - - block= uiLayoutAbsoluteBlock(pa->layout); - uiBlockSetHandleFunc(block, do_view3d_region_buttons, NULL); - - uiBlockBeginAlign(block); - - /* use real flag instead of 1 */ - uiDefButBitC(block, TOG, BONE_SKETCHING, B_REDR, "Use Bone Sketching", 10, yco, 160, 20, &scene->toolsettings->bone_sketching, 0, 0, 0, 0, "Use sketching to create and edit bones, (Ctrl snaps to mesh volume)"); - uiDefButBitC(block, TOG, BONE_SKETCHING_ADJUST, B_REDR, "A", 170, yco, 20, 20, &scene->toolsettings->bone_sketching, 0, 0, 0, 0, "Adjust strokes by drawing near them"); - uiDefButBitC(block, TOG, BONE_SKETCHING_QUICK, B_REDR, "Q", 190, yco, 20, 20, &scene->toolsettings->bone_sketching, 0, 0, 0, 0, "Automatically convert and delete on stroke end"); - yco -= 20; - - but = uiDefBut(block, BUT, B_REDR, "Convert", 10,yco,100,20, 0, 0, 0, 0, 0, "Convert sketch to armature"); - uiButSetFunc(but, convert_sketch_armature, NULL, NULL); - - but = uiDefBut(block, BUT, B_REDR, "Delete", 110,yco,100,20, 0, 0, 0, 0, 0, "Delete sketch"); - uiButSetFunc(but, delete_sketch_armature, NULL, NULL); - yco -= 20; - - uiBlockEndAlign(block); - - uiBlockBeginAlign(block); - - uiDefButC(block, MENU, B_REDR, "Subdivision Method%t|Length%x1|Adaptative%x2|Fixed%x0|Template%x3", 10,yco,60,19, &scene->toolsettings->bone_sketching_convert, 0, 0, 0, 0, subdiv_tooltip[(unsigned char)scene->toolsettings->bone_sketching_convert]); - - switch(scene->toolsettings->bone_sketching_convert) - { - case SK_CONVERT_CUT_LENGTH: - uiDefButF(block, NUM, B_REDR, "Lim:", 70, yco, 140, 19, &scene->toolsettings->skgen_length_limit,0.1,50.0, 10, 0, "Maximum length of the subdivided bones"); - yco -= 20; - break; - case SK_CONVERT_CUT_ADAPTATIVE: - uiDefButF(block, NUM, B_REDR, "Thres:", 70, yco, 140, 19, &scene->toolsettings->skgen_correlation_limit,0.0, 1.0, 0.01, 0, "Correlation threshold for subdivision"); - yco -= 20; - break; - default: - case SK_CONVERT_CUT_FIXED: - uiDefButC(block, NUM, B_REDR, "Num:", 70, yco, 140, 19, &scene->toolsettings->skgen_subdivision_number,1, 100, 1, 5, "Number of subdivided bones"); - yco -= 20; - break; - case SK_CONVERT_RETARGET: - uiDefButC(block, ROW, B_NOP, "No", 70, yco, 40,19, &scene->toolsettings->skgen_retarget_roll, 0, 0, 0, 0, "No special roll treatment"); - uiDefButC(block, ROW, B_NOP, "View", 110, yco, 50,19, &scene->toolsettings->skgen_retarget_roll, 0, SK_RETARGET_ROLL_VIEW, 0, 0, "Roll bones perpendicular to view"); - uiDefButC(block, ROW, B_NOP, "Joint", 160, yco, 50,19, &scene->toolsettings->skgen_retarget_roll, 0, SK_RETARGET_ROLL_JOINT, 0, 0, "Roll bones relative to joint bend"); - yco -= 30; - - uiBlockEndAlign(block); - - uiBlockBeginAlign(block); - /* button here to select what to do (copy or not), template, ...*/ - - BIF_makeListTemplates(C); - template_index = BIF_currentTemplate(C); - - but = uiDefButI(block, MENU, B_REDR, BIF_listTemplates(C), 10,yco,200,19, &template_index, 0, 0, 0, 0, "Template"); - uiButSetFunc(but, assign_template_sketch_armature, &template_index, NULL); - - yco -= 20; - - uiDefButF(block, NUM, B_NOP, "A:", 10, yco, 66,19, &scene->toolsettings->skgen_retarget_angle_weight, 0, 10, 1, 0, "Angle Weight"); - uiDefButF(block, NUM, B_NOP, "L:", 76, yco, 67,19, &scene->toolsettings->skgen_retarget_length_weight, 0, 10, 1, 0, "Length Weight"); - uiDefButF(block, NUM, B_NOP, "D:", 143,yco, 67,19, &scene->toolsettings->skgen_retarget_distance_weight, 0, 10, 1, 0, "Distance Weight"); - yco -= 20; - - uiDefBut(block, TEX,B_REDR,"S:", 10, yco, 90, 20, scene->toolsettings->skgen_side_string, 0.0, 8.0, 0, 0, "Text to replace &S with"); - uiDefBut(block, TEX,B_REDR,"N:", 100, yco, 90, 20, scene->toolsettings->skgen_num_string, 0.0, 8.0, 0, 0, "Text to replace &N with"); - uiDefIconButBitC(block, TOG, SK_RETARGET_AUTONAME, B_NOP, ICON_AUTO,190,yco,20,20, &scene->toolsettings->skgen_retarget_options, 0, 0, 0, 0, "Use Auto Naming"); - yco -= 20; - - /* auto renaming magic */ - uiBlockEndAlign(block); - - nb_joints = BIF_nbJointsTemplate(C); - - if (nb_joints == -1) - { - //XXX - //nb_joints = G.totvertsel; - } - - bone_name = BIF_nameBoneTemplate(C); - - BLI_snprintf(joint_label, 32, "%i joints: %s", nb_joints, bone_name); - - uiDefBut(block, LABEL, 1, joint_label, 10, yco, 200, 20, NULL, 0.0, 0.0, 0, 0, ""); - yco -= 20; - break; - } - - uiBlockEndAlign(block); -} - -#endif // XXX not used - void view3d_buttons_register(ARegionType *art) { PanelType *pt; diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 7dae02aba39..5dfb9cfb5b6 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -1329,7 +1329,7 @@ static void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d) v3d->zbuf= FALSE; glDisable(GL_DEPTH_TEST); glEnable(GL_DITHER); - if(multisample_enabled) + if(multisample_enabled) glEnable(GL_MULTISAMPLE_ARB); if(rv3d->rflag & RV3D_CLIPPING) diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 32e162fd09c..6d2a745fd67 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -3547,7 +3547,7 @@ BGpic *ED_view3D_background_image_new(View3D *v3d) return bgpic; } -void ED_view3D_background_image_remove(struct View3D *v3d, struct BGpic *bgpic) +void ED_view3D_background_image_remove(View3D *v3d, BGpic *bgpic) { BLI_remlink(&v3d->bgpicbase, bgpic); @@ -3559,3 +3559,16 @@ void ED_view3D_background_image_remove(struct View3D *v3d, struct BGpic *bgpic) MEM_freeN(bgpic); } + +void ED_view3D_background_image_clear(View3D *v3d) +{ + BGpic *bgpic= v3d->bgpicbase.first; + + while(bgpic) { + BGpic *next_bgpic= bgpic->next; + + ED_view3D_background_image_remove(v3d, bgpic); + + bgpic= next_bgpic; + } +} diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 35d9aed3691..a8d88f08b48 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -4740,7 +4740,7 @@ static int createSlideVerts(TransInfo *t) } look = look->next; } - } /* end uv layer loop */ + } /* end uv map loop */ } /* end uvlay_tot */ sld->uvhash = uvarray; diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c index fef42866e29..1a1022a5c7f 100644 --- a/source/blender/editors/util/ed_util.c +++ b/source/blender/editors/util/ed_util.c @@ -164,7 +164,7 @@ void unpack_menu(bContext *C, const char *opname, const char *id_name, const cha PointerRNA props_ptr; uiPopupMenu *pup; uiLayout *layout; - char line[FILE_MAXDIR + FILE_MAXFILE + 100]; + char line[FILE_MAX + 100]; pup= uiPupMenuBegin(C, "Unpack file", ICON_NONE); layout= uiPupMenuLayout(pup); diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c index 0f21aa3759c..0da3f66fc6f 100644 --- a/source/blender/editors/uvedit/uvedit_draw.c +++ b/source/blender/editors/uvedit/uvedit_draw.c @@ -219,7 +219,7 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, EditMesh *em, MTFac else areadiff = 1.0f-(area/uvarea); - weight_to_rgb(areadiff, col, col+1, col+2); + weight_to_rgb(col, areadiff); glColor3fv(col); glBegin(efa->v4?GL_QUADS:GL_TRIANGLES); @@ -298,19 +298,19 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, EditMesh *em, MTFac * 1.0-powf((1.0-a), 2) */ a = fabsf(uvang1-ang1)/(float)M_PI; - weight_to_rgb(1.0f-powf((1.0f-a), 2.0f), col, col+1, col+2); + weight_to_rgb(col, 1.0f-powf((1.0f-a), 2.0f)); glColor3fv(col); glVertex2fv(tf->uv[0]); a = fabsf(uvang2-ang2)/(float)M_PI; - weight_to_rgb(1.0f-powf((1.0f-a), 2.0f), col, col+1, col+2); + weight_to_rgb(col, 1.0f-powf((1.0f-a), 2.0f)); glColor3fv(col); glVertex2fv(tf->uv[1]); a = fabsf(uvang3-ang3)/(float)M_PI; - weight_to_rgb(1.0f-powf((1.0f-a), 2.0f), col, col+1, col+2); + weight_to_rgb(col, 1.0f-powf((1.0f-a), 2.0f)); glColor3fv(col); glVertex2fv(tf->uv[2]); a = fabsf(uvang4-ang4)/(float)M_PI; - weight_to_rgb(1.0f-powf((1.0f-a), 2.0f), col, col+1, col+2); + weight_to_rgb(col, 1.0f-powf((1.0f-a), 2.0f)); glColor3fv(col); glVertex2fv(tf->uv[3]); @@ -353,15 +353,15 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, EditMesh *em, MTFac glBegin(GL_TRIANGLES); a = fabsf(uvang1-ang1)/(float)M_PI; - weight_to_rgb(1.0f-powf((1.0f-a), 2.0f), col, col+1, col+2); + weight_to_rgb(col, 1.0f-powf((1.0f-a), 2.0f)); glColor3fv(col); glVertex2fv(tf->uv[0]); a = fabsf(uvang2-ang2)/(float)M_PI; - weight_to_rgb(1.0f-powf((1.0f-a), 2.0f), col, col+1, col+2); + weight_to_rgb(col, 1.0f-powf((1.0f-a), 2.0f)); glColor3fv(col); glVertex2fv(tf->uv[1]); a = fabsf(uvang3-ang3)/(float)M_PI; - weight_to_rgb(1.0f-powf((1.0f-a), 2.0f), col, col+1, col+2); + weight_to_rgb(col, 1.0f-powf((1.0f-a), 2.0f)); glColor3fv(col); glVertex2fv(tf->uv[2]); } diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index 7fc878de3f9..92bd74db68a 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -165,7 +165,7 @@ void ED_uvedit_assign_image(Main *bmain, Scene *scene, Object *obedit, Image *im else { /* old shading system, assign image to selected faces */ - /* ensure we have a uv layer */ + /* ensure we have a uv map */ if(!CustomData_has_layer(&em->fdata, CD_MTFACE)) { EM_add_data_layer(em, &em->fdata, CD_MTFACE, NULL); update= 1; diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index 11cd50a7d4e..c565e2fc305 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -896,7 +896,7 @@ static void uv_map_clip_correct(EditMesh *em, wmOperator *op) /* ******************** Unwrap operator **************** */ -/* assumes UV layer is checked, doesn't run update funcs */ +/* assumes UV Map is checked, doesn't run update funcs */ void ED_unwrap_lscm(Scene *scene, Object *obedit, const short sel) { EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data); |