diff options
author | Nicholas Bishop <nicholasbishop@gmail.com> | 2009-01-17 03:26:46 +0300 |
---|---|---|
committer | Nicholas Bishop <nicholasbishop@gmail.com> | 2009-01-17 03:26:46 +0300 |
commit | de9495e51915cae71ecdae05fdc21e5aef09ba4e (patch) | |
tree | 58618e69aac26d13b278fcfcd5a8553926c60e52 | |
parent | 87771829528569f207cedea236fcf12eaa870e9f (diff) |
Fixed a crash in sculptmode. Also replaced a degree sign with an underscore in view3d, not sure how that got in there.
-rw-r--r-- | source/blender/editors/sculpt/sculpt.c | 18 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_ops.c | 2 |
2 files changed, 12 insertions, 8 deletions
diff --git a/source/blender/editors/sculpt/sculpt.c b/source/blender/editors/sculpt/sculpt.c index 3ed12a379dd..ca7d5eeee14 100644 --- a/source/blender/editors/sculpt/sculpt.c +++ b/source/blender/editors/sculpt/sculpt.c @@ -1590,11 +1590,13 @@ static void sculpt_cache_free(StrokeCache *cache) } /* Initialize the stroke cache invariants from operator properties */ -static void sculpt_update_cache_invariants(SculptData *sd, wmOperator *op) +static void sculpt_update_cache_invariants(SculptData *sd, bContext *C, wmOperator *op) { - StrokeCache *cache = sd->session->cache; + StrokeCache *cache = MEM_callocN(sizeof(StrokeCache), "stroke cache"); int i; + sd->session->cache = cache; + RNA_float_get_array(op->ptr, "scale", cache->scale); cache->flag = RNA_int_get(op->ptr, "flag"); RNA_float_get_array(op->ptr, "clip_tolerance", cache->clip_tolerance); @@ -1603,6 +1605,8 @@ static void sculpt_update_cache_invariants(SculptData *sd, wmOperator *op) /* Truly temporary data that isn't stored in properties */ + view3d_set_viewcontext(C, &cache->vc); + cache->mats = MEM_callocN(sizeof(bglMats), "sculpt bglMats"); sculpt_load_mats(cache->mats, &cache->vc); @@ -1668,6 +1672,7 @@ static void sculpt_brush_stroke_init_properties(bContext *C, wmOperator *op, wmE SculptData *sd = &CTX_data_scene(C)->sculptdata; Object *ob= CTX_data_active_object(C); ModifierData *md; + ViewContext vc; float scale[3], clip_tolerance[3] = {0,0,0}; int mouse[2], flag = 0; @@ -1699,9 +1704,10 @@ static void sculpt_brush_stroke_init_properties(bContext *C, wmOperator *op, wmE RNA_int_set_array(op->ptr, "initial_mouse", mouse); /* Initial screen depth under the mouse */ - RNA_float_set(op->ptr, "depth", read_cached_depth(&sd->session->cache->vc, event->x, event->y)); + view3d_set_viewcontext(C, &vc); + RNA_float_set(op->ptr, "depth", read_cached_depth(&vc, event->x, event->y)); - sculpt_update_cache_invariants(sd, op); + sculpt_update_cache_invariants(sd, C, op); } static int sculpt_brush_stroke_invoke(bContext *C, wmOperator *op, wmEvent *event) @@ -1712,7 +1718,6 @@ static int sculpt_brush_stroke_invoke(bContext *C, wmOperator *op, wmEvent *even sd->session = MEM_callocN(sizeof(SculptSession), "test sculpt session"); sd->session->cache = MEM_callocN(sizeof(StrokeCache), "stroke cache"); - view3d_set_viewcontext(C, &sd->session->cache->vc); view3d_operator_needs_opengl(C); sculpt_brush_stroke_init_properties(C, op, event, sd->session); @@ -1795,8 +1800,7 @@ static int sculpt_brush_stroke_exec(bContext *C, wmOperator *op) SculptData *sd = &CTX_data_scene(C)->sculptdata; view3d_operator_needs_opengl(C); - view3d_set_viewcontext(C, &sd->session->cache->vc); - sculpt_update_cache_invariants(sd, op); + sculpt_update_cache_invariants(sd, C, op); RNA_BEGIN(op->ptr, itemptr, "stroke") { sculpt_update_cache_variants(sd, &itemptr); diff --git a/source/blender/editors/space_view3d/view3d_ops.c b/source/blender/editors/space_view3d/view3d_ops.c index 3b0b07123f1..8bf78a255bd 100644 --- a/source/blender/editors/space_view3d/view3d_ops.c +++ b/source/blender/editors/space_view3d/view3d_ops.c @@ -137,7 +137,7 @@ void view3d_keymap(wmWindowManager *wm) /* drawtype */ km = WM_keymap_add_item(keymap, "VIEW3D_OT_drawtype", ZKEY, KM_PRESS, 0, 0); RNA_int_set(km->ptr, "draw_type", OB_SOLID); - RNA_int_set(km->ptr, "draw°type_alternate", OB_WIRE); + RNA_int_set(km->ptr, "draw_type_alternate", OB_WIRE); km = WM_keymap_add_item(keymap, "VIEW3D_OT_drawtype", ZKEY, KM_PRESS, KM_ALT, 0); RNA_int_set(km->ptr, "draw_type", OB_TEXTURE); |