diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-12-27 15:05:49 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-12-27 15:05:49 +0400 |
commit | 76b562237f31a804cd2eba9e3af6effa54f31b5b (patch) | |
tree | d789e373995ad0ab4ca0fb5668937c5b7814bb2d /source/blender/editors | |
parent | 03e388127034c35c82ed0f84b2239125111db5a4 (diff) | |
parent | d09a8ea9e7a8ad208326b99a0631e9efc7119fbd (diff) |
Merge branch 'master' into soc-2013-depsgraph_mtsoc-2013-depsgraph_mt
Conflicts:
source/blender/blenkernel/intern/constraint.c
source/blender/blenkernel/intern/depsgraph.c
source/blender/blenkernel/intern/object.c
source/blender/blenkernel/intern/scene.c
source/blender/blenkernel/intern/shrinkwrap.c
source/blender/collada/AnimationExporter.cpp
source/blender/editors/space_image/image_ops.c
source/blender/editors/space_view3d/view3d_view.c
source/blender/makesrna/intern/rna_scene.c
source/blender/modifiers/intern/MOD_util.c
source/blender/render/intern/source/pipeline.c
Diffstat (limited to 'source/blender/editors')
24 files changed, 375 insertions, 127 deletions
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index ad745155286..5e93fda0cd4 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -1042,9 +1042,11 @@ static FCurve *animfilter_fcurve_next(bDopeSheet *ads, FCurve *first, bActionGro * - this will also affect things like Drivers, and also works for Bone Constraints */ if (ads && owner_id) { - if ((ads->filterflag & ADS_FILTER_ONLYSEL) || (ads->filterflag & ADS_FILTER_INCL_HIDDEN) == 0) { - if (skip_fcurve_selected_data(ads, fcu, owner_id, filter_mode)) - continue; + if ((filter_mode & ANIMFILTER_TMP_IGNORE_ONLYSEL) == 0) { + if ((ads->filterflag & ADS_FILTER_ONLYSEL) || (ads->filterflag & ADS_FILTER_INCL_HIDDEN) == 0) { + if (skip_fcurve_selected_data(ads, fcu, owner_id, filter_mode)) + continue; + } } } @@ -1541,21 +1543,17 @@ static size_t animdata_filter_ds_nodetree(bAnimContext *ac, ListBase *anim_data, { bNode *node; size_t items = 0; - int group_filter_mode = filter_mode & ~ADS_FILTER_ONLYSEL; items += animdata_filter_ds_nodetree_group(ac, anim_data, ads, owner_id, ntree, filter_mode); for (node = ntree->nodes.first; node; node = node->next) { if (node->type == NODE_GROUP) { if (node->id) { - int filterflag = ads->filterflag; - if ((filter_mode & ADS_FILTER_ONLYSEL) && (node->flag & NODE_SELECT) == 0) { + if ((ads->filterflag & ADS_FILTER_ONLYSEL) && (node->flag & NODE_SELECT) == 0) { continue; } - /* TODO(sergey): A bit creepy, but this flag is not used from threads anyway. */ - ads->filterflag &= ~ADS_FILTER_ONLYSEL; - items += animdata_filter_ds_nodetree_group(ac, anim_data, ads, owner_id, (bNodeTree *) node->id, group_filter_mode); - ads->filterflag = filterflag; + items += animdata_filter_ds_nodetree_group(ac, anim_data, ads, owner_id, (bNodeTree *) node->id, + filter_mode | ANIMFILTER_TMP_IGNORE_ONLYSEL); } } } diff --git a/source/blender/editors/include/BIF_glutil.h b/source/blender/editors/include/BIF_glutil.h index dd1995a5428..48440d10ae3 100644 --- a/source/blender/editors/include/BIF_glutil.h +++ b/source/blender/editors/include/BIF_glutil.h @@ -59,6 +59,7 @@ extern const unsigned char stipple_halftone[128]; extern const unsigned char stipple_quarttone[128]; extern const unsigned char stipple_diag_stripes_pos[128]; extern const unsigned char stipple_diag_stripes_neg[128]; +extern const unsigned char stipple_checker_8px[128]; /** * Draw a lined (non-looping) arc with the given diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h index 8b9bb0a4ab0..dff5069d991 100644 --- a/source/blender/editors/include/ED_anim_api.h +++ b/source/blender/editors/include/ED_anim_api.h @@ -225,7 +225,10 @@ typedef enum eAnimFilter_Flags { ANIMFILTER_NODUPLIS = (1 << 11), /* for checking if we should keep some collapsed channel around (internal use only!) */ - ANIMFILTER_TMP_PEEK = (1 << 30) + ANIMFILTER_TMP_PEEK = (1 << 30), + + /* ignore ONLYSEL flag from filterflag, (internal use only!) */ + ANIMFILTER_TMP_IGNORE_ONLYSEL = (1 << 31) } eAnimFilter_Flags; /* ---------- Flag Checking Macros ------------ */ diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index cfd6d74dcef..735e7f35d61 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -726,8 +726,8 @@ void UI_exit(void); #define UI_LAYOUT_MENU 2 #define UI_LAYOUT_TOOLBAR 3 -#define UI_UNIT_X U.widget_unit -#define UI_UNIT_Y U.widget_unit +#define UI_UNIT_X ((void)0, U.widget_unit) +#define UI_UNIT_Y ((void)0, U.widget_unit) #define UI_LAYOUT_ALIGN_EXPAND 0 #define UI_LAYOUT_ALIGN_LEFT 1 @@ -748,6 +748,10 @@ void UI_exit(void); #define UI_LAYOUT_OP_SHOW_TITLE 1 #define UI_LAYOUT_OP_SHOW_EMPTY 2 +/* used for transp checkers */ +#define UI_ALPHA_CHECKER_DARK 100 +#define UI_ALPHA_CHECKER_LIGHT 160 + /* flags to set which corners will become rounded: * * 1------2 diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index b6f93726bfc..3301f1f1e5a 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -935,11 +935,11 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti /* first background, to show tranparency */ - glColor4ub(UI_TRANSP_DARK, UI_TRANSP_DARK, UI_TRANSP_DARK, 255); + glColor4ub(UI_ALPHA_CHECKER_DARK, UI_ALPHA_CHECKER_DARK, UI_ALPHA_CHECKER_DARK, 255); glRectf(x1, y1, x1 + sizex, y1 + sizey); glEnable(GL_POLYGON_STIPPLE); - glColor4ub(UI_TRANSP_LIGHT, UI_TRANSP_LIGHT, UI_TRANSP_LIGHT, 255); - glPolygonStipple(checker_stipple_sml); + glColor4ub(UI_ALPHA_CHECKER_LIGHT, UI_ALPHA_CHECKER_LIGHT, UI_ALPHA_CHECKER_LIGHT, 255); + glPolygonStipple(stipple_checker_8px); glRectf(x1, y1, x1 + sizex, y1 + sizey); glDisable(GL_POLYGON_STIPPLE); diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index e11b93ca69b..5500df624cf 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -544,11 +544,6 @@ void ui_widget_color_init(struct ThemeUI *tui); void ui_draw_menu_item(struct uiFontStyle *fstyle, rcti *rect, const char *name, int iconid, int state, bool use_sep); void ui_draw_preview_item(struct uiFontStyle *fstyle, rcti *rect, const char *name, int iconid, int state); -extern const unsigned char checker_stipple_sml[32 * 32 / 8]; -/* used for transp checkers */ -#define UI_TRANSP_DARK 100 -#define UI_TRANSP_LIGHT 160 - #define UI_TEXT_MARGIN_X 0.4f /* interface_style.c */ diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 5c2ce7ad635..477b7c4e8f3 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -181,18 +181,6 @@ static const unsigned int check_tria_face[4][3] = { {3, 2, 4}, {3, 4, 5}, {1, 0, 3}, {0, 2, 3} }; -GLubyte const checker_stipple_sml[32 * 32 / 8] = -{ - 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, - 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, - 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, - 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, - 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, - 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, - 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, - 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, -}; - /* ************************************************* */ void ui_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y3) @@ -681,15 +669,15 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol) float x_mid = 0.0f; /* used for dumb clamping of values */ /* dark checkers */ - glColor4ub(UI_TRANSP_DARK, UI_TRANSP_DARK, UI_TRANSP_DARK, 255); + glColor4ub(UI_ALPHA_CHECKER_DARK, UI_ALPHA_CHECKER_DARK, UI_ALPHA_CHECKER_DARK, 255); glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(2, GL_FLOAT, 0, wtb->inner_v); glDrawArrays(GL_POLYGON, 0, wtb->totvert); /* light checkers */ glEnable(GL_POLYGON_STIPPLE); - glColor4ub(UI_TRANSP_LIGHT, UI_TRANSP_LIGHT, UI_TRANSP_LIGHT, 255); - glPolygonStipple(checker_stipple_sml); + glColor4ub(UI_ALPHA_CHECKER_LIGHT, UI_ALPHA_CHECKER_LIGHT, UI_ALPHA_CHECKER_LIGHT, 255); + glPolygonStipple(stipple_checker_8px); glVertexPointer(2, GL_FLOAT, 0, wtb->inner_v); glDrawArrays(GL_POLYGON, 0, wtb->totvert); diff --git a/source/blender/editors/mask/mask_draw.c b/source/blender/editors/mask/mask_draw.c index 6b60e5ed390..4cf4cd1ddba 100644 --- a/source/blender/editors/mask/mask_draw.c +++ b/source/blender/editors/mask/mask_draw.c @@ -590,8 +590,6 @@ static float *threaded_mask_rasterize(Mask *mask, const int width, const int hei task_pool = BLI_task_pool_create(task_scheduler, &state); - BLI_begin_threaded_malloc(); - scanlines_per_thread = height / num_threads; for (i = 0; i < num_threads; i++) { ThreadedMaskRasterizeData *data = MEM_mallocN(sizeof(ThreadedMaskRasterizeData), @@ -614,7 +612,6 @@ static float *threaded_mask_rasterize(Mask *mask, const int width, const int hei /* Free memory. */ BLI_task_pool_free(task_pool); - BLI_end_threaded_malloc(); BKE_maskrasterize_handle_free(handle); return buffer; diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index 64175c133ea..0d1e43a709b 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -2237,6 +2237,7 @@ static void knife_make_chain_cut(KnifeTool_OpData *kcd, BMFace *f, ListBase *cha BMesh *bm = kcd->em->bm; KnifeEdge *kfe, *kfelast; BMVert *v1, *v2; + BMLoop *l_v1, *l_v2; BMFace *f_new; Ref *ref; KnifeVert *kfv, *kfvprev; @@ -2262,28 +2263,36 @@ static void knife_make_chain_cut(KnifeTool_OpData *kcd, BMFace *f, ListBase *cha } BLI_assert(i == nco); l_new = NULL; - if (nco == 0) { - /* Want to prevent creating two-sided polygons */ - if (v1 == v2 || BM_edge_exists(v1, v2)) { - f_new = NULL; + + if ((l_v1 = BM_face_vert_share_loop(f, v1)) && + (l_v2 = BM_face_vert_share_loop(f, v2))) + { + if (nco == 0) { + /* Want to prevent creating two-sided polygons */ + if (v1 == v2 || BM_edge_exists(v1, v2)) { + f_new = NULL; + } + else { + f_new = BM_face_split(bm, f, l_v1, l_v2, &l_new, NULL, true); + } } else { - f_new = BM_face_split(bm, f, v1, v2, &l_new, NULL, true); - } - } - else { - f_new = BM_face_split_n(bm, f, v1, v2, cos, nco, &l_new, NULL); - if (f_new) { - /* Now go through lnew chain matching up chain kv's and assign real v's to them */ - for (l_iter = l_new->next, i = 0; i < nco; l_iter = l_iter->next, i++) { - BLI_assert(equals_v3v3(cos[i], l_iter->v->co)); - if (kcd->select_result) { - BM_edge_select_set(bm, l_iter->e, true); + f_new = BM_face_split_n(bm, f, l_v1, l_v2, cos, nco, &l_new, NULL); + if (f_new) { + /* Now go through lnew chain matching up chain kv's and assign real v's to them */ + for (l_iter = l_new->next, i = 0; i < nco; l_iter = l_iter->next, i++) { + BLI_assert(equals_v3v3(cos[i], l_iter->v->co)); + if (kcd->select_result) { + BM_edge_select_set(bm, l_iter->e, true); + } + kverts[i]->v = l_iter->v; } - kverts[i]->v = l_iter->v; } } } + else { + f_new = NULL; + } /* the select chain above doesnt account for the first loop */ if (kcd->select_result) { diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c index 55564703a87..b8a96bba874 100644 --- a/source/blender/editors/object/object_bake.c +++ b/source/blender/editors/object/object_bake.c @@ -209,7 +209,7 @@ static DerivedMesh *multiresbake_create_loresdm(Scene *scene, Object *ob, int *l MultiresModifierData *mmd = get_multires_modifier(scene, ob, 0); Mesh *me = (Mesh *)ob->data; MultiresModifierData tmp_mmd = *mmd; - DerivedMesh *cddm = CDDM_from_mesh(me, ob); + DerivedMesh *cddm = CDDM_from_mesh(me); if (mmd->lvl > 0) { *lvl = mmd->lvl; @@ -234,7 +234,7 @@ static DerivedMesh *multiresbake_create_hiresdm(Scene *scene, Object *ob, int *l Mesh *me = (Mesh *)ob->data; MultiresModifierData *mmd = get_multires_modifier(scene, ob, 0); MultiresModifierData tmp_mmd = *mmd; - DerivedMesh *cddm = CDDM_from_mesh(me, ob); + DerivedMesh *cddm = CDDM_from_mesh(me); DerivedMesh *dm; DM_set_only_copy(cddm, CD_MASK_BAREMESH); diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c index 230c3a11108..9cdb6de99b0 100644 --- a/source/blender/editors/screen/glutil.c +++ b/source/blender/editors/screen/glutil.c @@ -137,6 +137,16 @@ const GLubyte stipple_diag_stripes_neg[128] = { 0x0f, 0xf0, 0x0f, 0xf0, 0x1f, 0xe0, 0x1f, 0xe0, 0x3f, 0xc0, 0x3f, 0xc0, 0x7f, 0x80, 0x7f, 0x80}; +const GLubyte stipple_checker_8px[128] = { + 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, + 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, + 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, + 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, + 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, + 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, + 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, + 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255}; + void fdrawbezier(float vec[4][3]) { @@ -204,22 +214,12 @@ void fdrawcheckerboard(float x1, float y1, float x2, float y2) { unsigned char col1[4] = {40, 40, 40}, col2[4] = {50, 50, 50}; - GLubyte checker_stipple[32 * 32 / 8] = { - 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, - 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, - 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, - 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, - 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, - 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, - 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, - 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255}; - glColor3ubv(col1); glRectf(x1, y1, x2, y2); glColor3ubv(col2); glEnable(GL_POLYGON_STIPPLE); - glPolygonStipple(checker_stipple); + glPolygonStipple(stipple_checker_8px); glRectf(x1, y1, x2, y2); glDisable(GL_POLYGON_STIPPLE); } diff --git a/source/blender/editors/space_clip/clip_graph_draw.c b/source/blender/editors/space_clip/clip_graph_draw.c index 80b844464db..16845bb10fb 100644 --- a/source/blender/editors/space_clip/clip_graph_draw.c +++ b/source/blender/editors/space_clip/clip_graph_draw.c @@ -116,7 +116,7 @@ static void tracking_segment_start_cb(void *userdata, MovieTrackingTrack *track, glBegin(GL_LINE_STRIP); } -static void tracking_segment_end_cb(void *UNUSED(userdata)) +static void tracking_segment_end_cb(void *UNUSED(userdata), int UNUSED(coord)) { glEnd(); @@ -151,7 +151,7 @@ static void tracking_segment_knot_cb(void *userdata, MovieTrackingTrack *track, } } -static void draw_tracks_curves(View2D *v2d, SpaceClip *sc) +static void draw_tracks_motion_curves(View2D *v2d, SpaceClip *sc) { MovieClip *clip = ED_space_clip_get_clip(sc); MovieTracking *tracking = &clip->tracking; @@ -191,6 +191,108 @@ static void draw_tracks_curves(View2D *v2d, SpaceClip *sc) &userdata, tracking_segment_knot_cb, NULL, NULL); } +typedef struct TrackErrorCurveUserData { + MovieTracking *tracking; + MovieTrackingObject *tracking_object; + MovieTrackingTrack *active_track; + bool matrix_initialized; + int matrix_frame; + float projection_matrix[4][4]; + int width, height; + float aspy; +} TrackErrorCurveUserData; + +static void tracking_error_segment_point_cb(void *userdata, + MovieTrackingTrack *track, MovieTrackingMarker *marker, + int coord, int scene_framenr, float UNUSED(value)) +{ + if (coord == 1) { + TrackErrorCurveUserData *data = (TrackErrorCurveUserData *) userdata; + float reprojected_position[4], bundle_position[4], marker_position[2], delta[2]; + float reprojection_error; + + if (!data->matrix_initialized || data->matrix_frame != scene_framenr) { + BKE_tracking_get_projection_matrix(data->tracking, data->tracking_object, + scene_framenr, data->width, data->height, + data->projection_matrix); + } + + copy_v3_v3(bundle_position, track->bundle_pos); + bundle_position[3] = 1; + + mul_v4_m4v4(reprojected_position, data->projection_matrix, bundle_position); + reprojected_position[0] = (reprojected_position[0] / + (reprojected_position[3] * 2.0f) + 0.5f) * data->width; + reprojected_position[1] = (reprojected_position[1] / + (reprojected_position[3] * 2.0f) + 0.5f) * data->height * data->aspy; + + BKE_tracking_distort_v2(data->tracking, reprojected_position, reprojected_position); + + marker_position[0] = (marker->pos[0] + track->offset[0]) * data->width; + marker_position[1] = (marker->pos[1] + track->offset[1]) * data->height * data->aspy; + + sub_v2_v2v2(delta, reprojected_position, marker_position); + reprojection_error = len_v2(delta); + + glVertex2f(scene_framenr, reprojection_error); + } +} + +static void tracking_error_segment_start_cb(void *userdata, MovieTrackingTrack *track, int coord) +{ + if (coord == 1) { + TrackErrorCurveUserData *data = (TrackErrorCurveUserData *) userdata; + float col[4] = {0.0f, 0.0f, 1.0f, 1.0f}; + + if (track == data->active_track) { + col[3] = 1.0f; + glLineWidth(2.0f); + } + else { + col[3] = 0.5f; + glLineWidth(1.0f); + } + + glColor4fv(col); + + glBegin(GL_LINE_STRIP); + } +} + +static void tracking_error_segment_end_cb(void *UNUSED(userdata), int coord) +{ + if (coord == 1) { + glEnd(); + glLineWidth(1.0f); + } +} + +static void draw_tracks_error_curves(SpaceClip *sc) +{ + MovieClip *clip = ED_space_clip_get_clip(sc); + MovieTracking *tracking = &clip->tracking; + TrackErrorCurveUserData data; + + data.tracking = tracking; + data.tracking_object = BKE_tracking_object_get_active(tracking); + data.active_track = BKE_tracking_track_get_active(tracking); + data.matrix_initialized = false; + BKE_movieclip_get_size(clip, &sc->user, &data.width, &data.height); + data.aspy = 1.0f / tracking->camera.pixel_aspect; + + if (!data.width || !data.height) { + return; + } + + clip_graph_tracking_values_iterate(sc, + (sc->flag & SC_SHOW_GRAPH_SEL_ONLY) != 0, + (sc->flag & SC_SHOW_GRAPH_HIDDEN) != 0, + &data, + tracking_error_segment_point_cb, + tracking_error_segment_start_cb, + tracking_error_segment_end_cb); +} + static void draw_frame_curves(SpaceClip *sc) { MovieClip *clip = ED_space_clip_get_clip(sc); @@ -237,8 +339,11 @@ void clip_draw_graph(SpaceClip *sc, ARegion *ar, Scene *scene) UI_view2d_grid_free(grid); if (clip) { - if (sc->flag & SC_SHOW_GRAPH_TRACKS) - draw_tracks_curves(v2d, sc); + if (sc->flag & SC_SHOW_GRAPH_TRACKS_MOTION) + draw_tracks_motion_curves(v2d, sc); + + if (sc->flag & SC_SHOW_GRAPH_TRACKS_ERROR) + draw_tracks_error_curves(sc); if (sc->flag & SC_SHOW_GRAPH_FRAMES) draw_frame_curves(sc); diff --git a/source/blender/editors/space_clip/clip_graph_ops.c b/source/blender/editors/space_clip/clip_graph_ops.c index e0062ecd243..44261b8b500 100644 --- a/source/blender/editors/space_clip/clip_graph_ops.c +++ b/source/blender/editors/space_clip/clip_graph_ops.c @@ -72,6 +72,16 @@ static int ED_space_clip_graph_poll(bContext *C) return FALSE; } +static int clip_graph_knots_poll(bContext *C) +{ + if (ED_space_clip_graph_poll(C)) { + SpaceClip *sc = CTX_wm_space_clip(C); + + return (sc->flag & SC_SHOW_GRAPH_TRACKS_MOTION) != 0; + } + return FALSE; +} + typedef struct { int action; } SelectUserData; @@ -130,7 +140,7 @@ static void find_nearest_tracking_segment_cb(void *userdata, MovieTrackingTrack copy_v2_v2(data->prev_co, co); } -static void find_nearest_tracking_segment_end_cb(void *userdata) +static void find_nearest_tracking_segment_end_cb(void *userdata, int UNUSED(coord)) { MouseSelectUserData *data = userdata; @@ -302,7 +312,7 @@ void CLIP_OT_graph_select(wmOperatorType *ot) /* api callbacks */ ot->exec = select_exec; ot->invoke = select_invoke; - ot->poll = ED_space_clip_graph_poll; + ot->poll = clip_graph_knots_poll; /* flags */ ot->flag = OPTYPE_UNDO; @@ -394,7 +404,7 @@ void CLIP_OT_graph_select_border(wmOperatorType *ot) ot->invoke = WM_border_select_invoke; ot->exec = border_select_graph_exec; ot->modal = WM_border_select_modal; - ot->poll = ED_space_clip_graph_poll; + ot->poll = clip_graph_knots_poll; /* flags */ ot->flag = OPTYPE_UNDO; @@ -461,7 +471,7 @@ void CLIP_OT_graph_select_all_markers(wmOperatorType *ot) /* api callbacks */ ot->exec = graph_select_all_markers_exec; - ot->poll = ED_space_clip_graph_poll; + ot->poll = clip_graph_knots_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -496,7 +506,7 @@ void CLIP_OT_graph_delete_curve(wmOperatorType *ot) /* api callbacks */ ot->invoke = WM_operator_confirm; ot->exec = delete_curve_exec; - ot->poll = ED_space_clip_tracking_poll; + ot->poll = clip_graph_knots_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -536,7 +546,7 @@ void CLIP_OT_graph_delete_knot(wmOperatorType *ot) /* api callbacks */ ot->exec = delete_knot_exec; - ot->poll = ED_space_clip_graph_poll; + ot->poll = clip_graph_knots_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; diff --git a/source/blender/editors/space_clip/clip_intern.h b/source/blender/editors/space_clip/clip_intern.h index af9d8f97138..811f8e2eaab 100644 --- a/source/blender/editors/space_clip/clip_intern.h +++ b/source/blender/editors/space_clip/clip_intern.h @@ -125,12 +125,12 @@ void ED_clip_tool_props_register(struct ARegionType *art); void clip_graph_tracking_values_iterate_track(struct SpaceClip *sc, struct MovieTrackingTrack *track, void *userdata, void (*func)(void *userdata, struct MovieTrackingTrack *track, struct MovieTrackingMarker *marker, int coord, int scene_framenr, float val), void (*segment_start)(void *userdata, struct MovieTrackingTrack *track, int coord), - void (*segment_end)(void *userdata)); + void (*segment_end)(void *userdata, int coord)); void clip_graph_tracking_values_iterate(struct SpaceClip *sc, bool selected_only, bool include_hidden, void *userdata, void (*func)(void *userdata, struct MovieTrackingTrack *track, struct MovieTrackingMarker *marker, int coord, int scene_framenr, float val), void (*segment_start)(void *userdata, struct MovieTrackingTrack *track, int coord), - void (*segment_end)(void *userdata)); + void (*segment_end)(void *userdata, int coord)); void clip_graph_tracking_iterate(struct SpaceClip *sc, bool selected_only, bool include_hidden, void *userdata, void (*func)(void *userdata, struct MovieTrackingMarker *marker)); diff --git a/source/blender/editors/space_clip/clip_utils.c b/source/blender/editors/space_clip/clip_utils.c index 060531ae82c..4b90fa5839f 100644 --- a/source/blender/editors/space_clip/clip_utils.c +++ b/source/blender/editors/space_clip/clip_utils.c @@ -70,7 +70,7 @@ void clip_graph_tracking_values_iterate_track( void (*func)(void *userdata, MovieTrackingTrack *track, MovieTrackingMarker *marker, int coord, int scene_framenr, float val), void (*segment_start)(void *userdata, MovieTrackingTrack *track, int coord), - void (*segment_end)(void *userdata)) + void (*segment_end)(void *userdata, int coord)) { MovieClip *clip = ED_space_clip_get_clip(sc); int width, height, coord; @@ -89,7 +89,7 @@ void clip_graph_tracking_values_iterate_track( if (marker->flag & MARKER_DISABLED) { if (open) { if (segment_end) - segment_end(userdata); + segment_end(userdata, coord); open = false; } @@ -121,7 +121,7 @@ void clip_graph_tracking_values_iterate_track( if (open) { if (segment_end) - segment_end(userdata); + segment_end(userdata, coord); } } } @@ -131,7 +131,7 @@ void clip_graph_tracking_values_iterate( void (*func)(void *userdata, MovieTrackingTrack *track, MovieTrackingMarker *marker, int coord, int scene_framenr, float val), void (*segment_start)(void *userdata, MovieTrackingTrack *track, int coord), - void (*segment_end)(void *userdata)) + void (*segment_end)(void *userdata, int coord)) { MovieClip *clip = ED_space_clip_get_clip(sc); MovieTracking *tracking = &clip->tracking; diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c index 2cabb595fb7..e1262d0d7b8 100644 --- a/source/blender/editors/space_clip/space_clip.c +++ b/source/blender/editors/space_clip/space_clip.c @@ -247,7 +247,7 @@ static SpaceLink *clip_new(const bContext *C) sc = MEM_callocN(sizeof(SpaceClip), "initclip"); sc->spacetype = SPACE_CLIP; sc->flag = SC_SHOW_MARKER_PATTERN | SC_SHOW_TRACK_PATH | SC_MANUAL_CALIBRATION | - SC_SHOW_GRAPH_TRACKS | SC_SHOW_GRAPH_FRAMES | SC_SHOW_GPENCIL; + SC_SHOW_GRAPH_TRACKS_MOTION | SC_SHOW_GRAPH_FRAMES | SC_SHOW_GPENCIL; sc->zoom = 1.0f; sc->path_length = 20; sc->scopes.track_preview_height = 120; diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index 76305aaabaa..672549f0402 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -165,8 +165,10 @@ static void draw_render_info(Scene *scene, Image *ima, ARegion *ar, float zoomx, void ED_image_draw_info(Scene *scene, ARegion *ar, int color_manage, int use_default_view, int channels, int x, int y, const unsigned char cp[4], const float fp[4], const float linearcol[4], int *zp, float *zpf) { + rcti color_rect; char str[256]; - float dx = 6; + int dx = 6; + const int dy = 0.3f * UI_UNIT_Y; /* text colors */ /* XXX colored text not allowed in Blender UI */ #if 0 @@ -193,21 +195,21 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, int color_manage, int use_def glColor3ub(255, 255, 255); BLI_snprintf(str, sizeof(str), "X:%-4d Y:%-4d |", x, y); - BLF_position(blf_mono_font, dx, 0.3f * UI_UNIT_Y, 0); + BLF_position(blf_mono_font, dx, dy, 0); BLF_draw_ascii(blf_mono_font, str, sizeof(str)); dx += BLF_width(blf_mono_font, str, sizeof(str)); if (zp) { glColor3ub(255, 255, 255); BLI_snprintf(str, sizeof(str), " Z:%-.4f |", 0.5f + 0.5f * (((float)*zp) / (float)0x7fffffff)); - BLF_position(blf_mono_font, dx, 0.3f * UI_UNIT_X, 0); + BLF_position(blf_mono_font, dx, dy, 0); BLF_draw_ascii(blf_mono_font, str, sizeof(str)); dx += BLF_width(blf_mono_font, str, sizeof(str)); } if (zpf) { glColor3ub(255, 255, 255); BLI_snprintf(str, sizeof(str), " Z:%-.3f |", *zpf); - BLF_position(blf_mono_font, dx, 0.3f * UI_UNIT_X, 0); + BLF_position(blf_mono_font, dx, dy, 0); BLF_draw_ascii(blf_mono_font, str, sizeof(str)); dx += BLF_width(blf_mono_font, str, sizeof(str)); } @@ -220,7 +222,7 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, int color_manage, int use_def BLI_snprintf(str, sizeof(str), " R:%-3d", cp[0]); else BLI_snprintf(str, sizeof(str), " R:-"); - BLF_position(blf_mono_font, dx, 0.3f * UI_UNIT_X, 0); + BLF_position(blf_mono_font, dx, dy, 0); BLF_draw_ascii(blf_mono_font, str, sizeof(str)); dx += BLF_width(blf_mono_font, str, sizeof(str)); @@ -231,7 +233,7 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, int color_manage, int use_def BLI_snprintf(str, sizeof(str), " G:%-3d", cp[1]); else BLI_snprintf(str, sizeof(str), " G:-"); - BLF_position(blf_mono_font, dx, 0.3f * UI_UNIT_X, 0); + BLF_position(blf_mono_font, dx, dy, 0); BLF_draw_ascii(blf_mono_font, str, sizeof(str)); dx += BLF_width(blf_mono_font, str, sizeof(str)); @@ -242,7 +244,7 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, int color_manage, int use_def BLI_snprintf(str, sizeof(str), " B:%-3d", cp[2]); else BLI_snprintf(str, sizeof(str), " B:-"); - BLF_position(blf_mono_font, dx, 0.3f * UI_UNIT_X, 0); + BLF_position(blf_mono_font, dx, dy, 0); BLF_draw_ascii(blf_mono_font, str, sizeof(str)); dx += BLF_width(blf_mono_font, str, sizeof(str)); @@ -254,7 +256,7 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, int color_manage, int use_def BLI_snprintf(str, sizeof(str), " A:%-3d", cp[3]); else BLI_snprintf(str, sizeof(str), "- "); - BLF_position(blf_mono_font, dx, 0.3f * UI_UNIT_X, 0); + BLF_position(blf_mono_font, dx, dy, 0); BLF_draw_ascii(blf_mono_font, str, sizeof(str)); dx += BLF_width(blf_mono_font, str, sizeof(str)); } @@ -274,7 +276,7 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, int color_manage, int use_def IMB_colormanagement_pixel_to_display_space_v4(rgba, rgba, &scene->view_settings, &scene->display_settings); BLI_snprintf(str, sizeof(str), " | CM R:%-.4f G:%-.4f B:%-.4f", rgba[0], rgba[1], rgba[2]); - BLF_position(blf_mono_font, dx, 0.3f * UI_UNIT_X, 0); + BLF_position(blf_mono_font, dx, dy, 0); BLF_draw_ascii(blf_mono_font, str, sizeof(str)); dx += BLF_width(blf_mono_font, str, sizeof(str)); } @@ -316,23 +318,47 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, int color_manage, int use_def } glDisable(GL_BLEND); - glColor3fv(finalcol); dx += 0.25f * UI_UNIT_X; - glBegin(GL_QUADS); - glVertex2f(dx, 0.15f * UI_UNIT_Y); - glVertex2f(dx, 0.85f * UI_UNIT_Y); - glVertex2f(dx + 1.5f * UI_UNIT_X, 0.85 * UI_UNIT_Y); - glVertex2f(dx + 1.5f * UI_UNIT_X, 0.15f * UI_UNIT_Y); - glEnd(); + + BLI_rcti_init(&color_rect, dx, dx + (1.5f * UI_UNIT_X), 0.15f * UI_UNIT_Y, 0.85f * UI_UNIT_Y); + + if (channels == 4) { + rcti color_rect_half; + int color_quater_x, color_quater_y; + + color_rect_half = color_rect; + color_rect_half.xmax = BLI_rcti_cent_x(&color_rect); + glRecti(color_rect.xmin, color_rect.ymin, color_rect.xmax, color_rect.ymax); + + color_rect_half = color_rect; + color_rect_half.xmin = BLI_rcti_cent_x(&color_rect); + + color_quater_x = BLI_rcti_cent_x(&color_rect_half); + color_quater_y = BLI_rcti_cent_y(&color_rect_half); + + glColor4ub(UI_ALPHA_CHECKER_DARK, UI_ALPHA_CHECKER_DARK, UI_ALPHA_CHECKER_DARK, 255); + glRecti(color_rect_half.xmin, color_rect_half.ymin, color_rect_half.xmax, color_rect_half.ymax); + + glColor4ub(UI_ALPHA_CHECKER_LIGHT, UI_ALPHA_CHECKER_LIGHT, UI_ALPHA_CHECKER_LIGHT, 255); + glRecti(color_quater_x, color_quater_y, color_rect_half.xmax, color_rect_half.ymax); + glRecti(color_rect_half.xmin, color_rect_half.ymin, color_quater_x, color_quater_y); + + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glColor4f(UNPACK3(finalcol), fp ? fp[3] : (cp[3] / 255.0f)); + glRecti(color_rect.xmin, color_rect.ymin, color_rect.xmax, color_rect.ymax); + glDisable(GL_BLEND); + } + else { + glColor3fv(finalcol); + glRecti(color_rect.xmin, color_rect.ymin, color_rect.xmax, color_rect.ymax); + } /* draw outline */ glColor3ub(128, 128, 128); - glBegin(GL_LINE_LOOP); - glVertex2f(dx, 0.15f * UI_UNIT_Y); - glVertex2f(dx, 0.85f * UI_UNIT_Y); - glVertex2f(dx + 1.5f * UI_UNIT_X, 0.85f * UI_UNIT_Y); - glVertex2f(dx + 1.5f * UI_UNIT_X, 0.15f * UI_UNIT_Y); - glEnd(); + glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); + glRecti(color_rect.xmin, color_rect.ymin, color_rect.xmax, color_rect.ymax); + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); dx += 1.75f * UI_UNIT_X; @@ -348,12 +374,12 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, int color_manage, int use_def } BLI_snprintf(str, sizeof(str), "V:%-.4f", val); - BLF_position(blf_mono_font, dx, 0.3f * UI_UNIT_X, 0); + BLF_position(blf_mono_font, dx, dy, 0); BLF_draw_ascii(blf_mono_font, str, sizeof(str)); dx += BLF_width(blf_mono_font, str, sizeof(str)); BLI_snprintf(str, sizeof(str), " L:%-.4f", lum); - BLF_position(blf_mono_font, dx, 0.3f * UI_UNIT_X, 0); + BLF_position(blf_mono_font, dx, dy, 0); BLF_draw_ascii(blf_mono_font, str, sizeof(str)); dx += BLF_width(blf_mono_font, str, sizeof(str)); } @@ -362,22 +388,22 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, int color_manage, int use_def rgb_to_yuv(finalcol[0], finalcol[1], finalcol[2], &lum, &u, &v); BLI_snprintf(str, sizeof(str), "H:%-.4f", hue); - BLF_position(blf_mono_font, dx, 0.3f * UI_UNIT_X, 0); + BLF_position(blf_mono_font, dx, dy, 0); BLF_draw_ascii(blf_mono_font, str, sizeof(str)); dx += BLF_width(blf_mono_font, str, sizeof(str)); BLI_snprintf(str, sizeof(str), " S:%-.4f", sat); - BLF_position(blf_mono_font, dx, 0.3f * UI_UNIT_X, 0); + BLF_position(blf_mono_font, dx, dy, 0); BLF_draw_ascii(blf_mono_font, str, sizeof(str)); dx += BLF_width(blf_mono_font, str, sizeof(str)); BLI_snprintf(str, sizeof(str), " V:%-.4f", val); - BLF_position(blf_mono_font, dx, 0.3f * UI_UNIT_X, 0); + BLF_position(blf_mono_font, dx, dy, 0); BLF_draw_ascii(blf_mono_font, str, sizeof(str)); dx += BLF_width(blf_mono_font, str, sizeof(str)); BLI_snprintf(str, sizeof(str), " L:%-.4f", lum); - BLF_position(blf_mono_font, dx, 0.3f * UI_UNIT_X, 0); + BLF_position(blf_mono_font, dx, dy, 0); BLF_draw_ascii(blf_mono_font, str, sizeof(str)); dx += BLF_width(blf_mono_font, str, sizeof(str)); } diff --git a/source/blender/editors/space_info/info_intern.h b/source/blender/editors/space_info/info_intern.h index b5426fe15e1..967bcec57c5 100644 --- a/source/blender/editors/space_info/info_intern.h +++ b/source/blender/editors/space_info/info_intern.h @@ -37,6 +37,7 @@ struct SpaceInfo; struct wmOperatorType; struct ReportList; +void FILE_OT_autopack_toggle(struct wmOperatorType *ot); void FILE_OT_pack_all(struct wmOperatorType *ot); void FILE_OT_unpack_all(struct wmOperatorType *ot); void FILE_OT_unpack_item(struct wmOperatorType *ot); diff --git a/source/blender/editors/space_info/info_ops.c b/source/blender/editors/space_info/info_ops.c index 6c76ba64893..ace3b8d5393 100644 --- a/source/blender/editors/space_info/info_ops.c +++ b/source/blender/editors/space_info/info_ops.c @@ -70,7 +70,7 @@ #include "info_intern.h" -/********************* pack blend file libararies operator *********************/ +/********************* pack blend file libaries operator *********************/ static int pack_libraries_exec(bContext *C, wmOperator *op) { @@ -124,6 +124,36 @@ void FILE_OT_unpack_libraries(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } +/********************* toogle auto-pack operator *********************/ + +static int autopack_toggle_exec(bContext *C, wmOperator *op) +{ + Main *bmain = CTX_data_main(C); + + if (G.fileflags & G_AUTOPACK) { + G.fileflags &= ~G_AUTOPACK; + } + else { + packAll(bmain, op->reports); + G.fileflags |= G_AUTOPACK; + } + + return OPERATOR_FINISHED; +} + +void FILE_OT_autopack_toggle(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Automatically Pack Into .blend"; + ot->idname = "FILE_OT_autopack_toggle"; + ot->description = "Automatically pack all external files into the .blend file"; + + /* api callbacks */ + ot->exec = autopack_toggle_exec; + + /* flags */ + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; +} /********************* pack all operator *********************/ @@ -168,7 +198,7 @@ static int pack_all_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(ev void FILE_OT_pack_all(wmOperatorType *ot) { /* identifiers */ - ot->name = "Pack All"; + ot->name = "Pack All Into .blend"; ot->idname = "FILE_OT_pack_all"; ot->description = "Pack all used external files into the .blend"; @@ -214,7 +244,7 @@ static int unpack_all_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED( count = countPackedFiles(bmain); if (!count) { - BKE_report(op->reports, RPT_WARNING, "No packed files (auto-pack disabled)"); + BKE_report(op->reports, RPT_WARNING, "No packed files to unpack"); G.fileflags &= ~G_AUTOPACK; return OPERATOR_CANCELLED; } @@ -238,7 +268,7 @@ static int unpack_all_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED( void FILE_OT_unpack_all(wmOperatorType *ot) { /* identifiers */ - ot->name = "Unpack All"; + ot->name = "Unpack All Into Files"; ot->idname = "FILE_OT_unpack_all"; ot->description = "Unpack all files packed into this .blend to external ones"; diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.c index 96e0de17918..c029a4bf0bc 100644 --- a/source/blender/editors/space_info/space_info.c +++ b/source/blender/editors/space_info/space_info.c @@ -179,6 +179,7 @@ static void info_main_area_draw(const bContext *C, ARegion *ar) static void info_operatortypes(void) { + WM_operatortype_append(FILE_OT_autopack_toggle); WM_operatortype_append(FILE_OT_pack_all); WM_operatortype_append(FILE_OT_pack_libraries); WM_operatortype_append(FILE_OT_unpack_all); diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 5b8c4a92555..02e981f2ffd 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -6201,7 +6201,7 @@ static void get_local_bounds(Object *ob, float center[3], float size[3]) } #endif -static void draw_bb_quadric(BoundBox *bb, char type) +static void draw_bb_quadric(BoundBox *bb, char type, bool around_origin) { float size[3], cent[3]; GLUquadricObj *qobj = gluNewQuadric(); @@ -6212,9 +6212,14 @@ static void draw_bb_quadric(BoundBox *bb, char type) size[1] = 0.5f * fabsf(bb->vec[0][1] - bb->vec[2][1]); size[2] = 0.5f * fabsf(bb->vec[0][2] - bb->vec[1][2]); - cent[0] = 0.5f * (bb->vec[0][0] + bb->vec[4][0]); - cent[1] = 0.5f * (bb->vec[0][1] + bb->vec[2][1]); - cent[2] = 0.5f * (bb->vec[0][2] + bb->vec[1][2]); + if (around_origin) { + zero_v3(cent); + } + else { + cent[0] = 0.5f * (bb->vec[0][0] + bb->vec[4][0]); + cent[1] = 0.5f * (bb->vec[0][1] + bb->vec[2][1]); + cent[2] = 0.5f * (bb->vec[0][2] + bb->vec[1][2]); + } glPushMatrix(); if (type == OB_BOUND_SPHERE) { @@ -6278,11 +6283,37 @@ static void draw_bounding_volume(Scene *scene, Object *ob, char type) BKE_boundbox_init_from_minmax(bb, min, max); } - if (bb == NULL) return; - - if (type == OB_BOUND_BOX) draw_box(bb->vec); - else draw_bb_quadric(bb, type); + if (bb == NULL) + return; + if (ob->gameflag & OB_BOUNDS) { /* bounds need to be drawn around origin for game engine */ + + if (type == OB_BOUND_BOX) { + float vec[8][3], size[3]; + + size[0] = 0.5f * fabsf(bb->vec[0][0] - bb->vec[4][0]); + size[1] = 0.5f * fabsf(bb->vec[0][1] - bb->vec[2][1]); + size[2] = 0.5f * fabsf(bb->vec[0][2] - bb->vec[1][2]); + + vec[0][0] = vec[1][0] = vec[2][0] = vec[3][0] = -size[0]; + vec[4][0] = vec[5][0] = vec[6][0] = vec[7][0] = +size[0]; + vec[0][1] = vec[1][1] = vec[4][1] = vec[5][1] = -size[1]; + vec[2][1] = vec[3][1] = vec[6][1] = vec[7][1] = +size[1]; + vec[0][2] = vec[3][2] = vec[4][2] = vec[7][2] = -size[2]; + vec[1][2] = vec[2][2] = vec[5][2] = vec[6][2] = +size[2]; + + draw_box(vec); + } + else { + draw_bb_quadric(bb, type, true); + } + } + else { + if (type == OB_BOUND_BOX) + draw_box(bb->vec); + else + draw_bb_quadric(bb, type, false); + } } static void drawtexspace(Object *ob) @@ -6565,6 +6596,48 @@ static void draw_object_matcap_check(Scene *scene, View3D *v3d, Object *ob) } +static void draw_rigidbody_shape(Object *ob) +{ + BoundBox *bb = NULL; + float size[3], vec[8][3]; + + if (ob->type == OB_MESH) { + bb = BKE_mesh_boundbox_get(ob); + } + + if (bb == NULL) + return; + + switch (ob->rigidbody_object->shape) { + case RB_SHAPE_BOX: + size[0] = 0.5f * fabsf(bb->vec[0][0] - bb->vec[4][0]); + size[1] = 0.5f * fabsf(bb->vec[0][1] - bb->vec[2][1]); + size[2] = 0.5f * fabsf(bb->vec[0][2] - bb->vec[1][2]); + + vec[0][0] = vec[1][0] = vec[2][0] = vec[3][0] = -size[0]; + vec[4][0] = vec[5][0] = vec[6][0] = vec[7][0] = +size[0]; + vec[0][1] = vec[1][1] = vec[4][1] = vec[5][1] = -size[1]; + vec[2][1] = vec[3][1] = vec[6][1] = vec[7][1] = +size[1]; + vec[0][2] = vec[3][2] = vec[4][2] = vec[7][2] = -size[2]; + vec[1][2] = vec[2][2] = vec[5][2] = vec[6][2] = +size[2]; + + draw_box(vec); + break; + case RB_SHAPE_SPHERE: + draw_bb_quadric(bb, OB_BOUND_SPHERE, true); + break; + case RB_SHAPE_CONE: + draw_bb_quadric(bb, OB_BOUND_CONE, true); + break; + case RB_SHAPE_CYLINDER: + draw_bb_quadric(bb, OB_BOUND_CYLINDER, true); + break; + case RB_SHAPE_CAPSULE: + draw_bb_quadric(bb, OB_BOUND_CAPSULE, true); + break; + } +} + /** * main object drawing function, draws in selection * \param dflag (draw flag) can be DRAW_PICKING and/or DRAW_CONSTCOLOR, DRAW_SCENESET @@ -7129,6 +7202,9 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short setlinestyle(0); } } + if (ob->rigidbody_object) { + draw_rigidbody_shape(ob); + } /* draw extra: after normal draw because of makeDispList */ if (dtx && (G.f & G_RENDER_OGL) == 0) { diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 2e98058639b..dcbcb127f5c 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -1543,7 +1543,7 @@ static int game_engine_exec(bContext *C, wmOperator *op) //XXX restore_all_scene_cfra(scene_cfra_store); BKE_scene_set_background(CTX_data_main(C), startscene); - //XXX BKE_scene_update_for_newframe_viewport(bmain, scene, scene->lay); + //XXX BKE_scene_update_for_newframe(bmain->eval_ctx, bmain, scene, scene->lay); BLI_callback_exec(bmain, &startscene->id, BLI_CB_EVT_GAME_POST); diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index e6e46c569e9..4bd4db9849b 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -6382,6 +6382,10 @@ static void createTransTrackingCurvesData(bContext *C, TransInfo *t) /* count */ t->total = 0; + if ((sc->flag & SC_SHOW_GRAPH_TRACKS_MOTION) == 0) { + return; + } + track = tracksbase->first; while (track) { if (TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED) == 0) { diff --git a/source/blender/editors/util/crazyspace.c b/source/blender/editors/util/crazyspace.c index ff65e11f53e..e8146c34f5e 100644 --- a/source/blender/editors/util/crazyspace.c +++ b/source/blender/editors/util/crazyspace.c @@ -344,7 +344,7 @@ int sculpt_get_first_deform_matrices(Scene *scene, Object *ob, float (**deformma if (mti->type == eModifierTypeType_OnlyDeform) { if (!defmats) { Mesh *me = (Mesh *)ob->data; - dm = mesh_create_derived(me, ob, NULL); + dm = mesh_create_derived(me, NULL); deformedVerts = BKE_mesh_vertexCos_get(me, &numVerts); defmats = MEM_callocN(sizeof(*defmats) * numVerts, "defmats"); |