Fixed a crash in sculptmode. Also replaced a degree sign with an underscore in view3d, not sure how that got in there.

This commit is contained in:
Nicholas Bishop
2009-01-17 00:26:46 +00:00
parent 8777182952
commit de9495e519
2 changed files with 12 additions and 8 deletions

View File

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

View File

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