From 5cef085f770056b9f35ee6d203dc62b5db6cde23 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Thu, 6 Jan 2011 11:16:35 +0000 Subject: Todo item: Auto-texture space now is more responsive and correct. - on transforming it, the buttons get redrawn to show option was reset - on enabling option, texture space is recalculated/reset --- source/blender/editors/space_buttons/space_buttons.c | 1 + source/blender/editors/transform/transform.c | 5 +++-- source/blender/makesrna/intern/rna_curve.c | 11 ++++++++++- source/blender/makesrna/intern/rna_mesh.c | 10 ++++++++++ 4 files changed, 24 insertions(+), 3 deletions(-) (limited to 'source/blender') diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index 171dad4bed9..b09137f084e 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -259,6 +259,7 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn) switch(wmn->data) { case ND_TRANSFORM: buttons_area_redraw(sa, BCONTEXT_OBJECT); + buttons_area_redraw(sa, BCONTEXT_DATA); /* autotexpace flag */ break; case ND_POSE: case ND_BONE_ACTIVE: diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 2b1746f0e96..3f21b9bc702 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -1499,8 +1499,9 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int t->state = TRANS_STARTING; - if(RNA_boolean_get(op->ptr, "texture_space")) - options |= CTX_TEXTURE; + if(RNA_struct_find_property(op->ptr, "texture_space")) + if(RNA_boolean_get(op->ptr, "texture_space")) + options |= CTX_TEXTURE; t->options = options; diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index e61ac34b0aa..8b9166b919f 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -175,6 +175,14 @@ static void rna_BezTriple_ctrlpoint_set(PointerRNA *ptr, const float *values) bt->vec[1][2]= values[2]; } +static void rna_Curve_texspace_set(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + Curve *cu= (Curve*)ptr->data; + + if (cu->texflag & CU_AUTOSPACE) + tex_space_curve(cu); +} + static int rna_Curve_texspace_editable(PointerRNA *ptr) { Curve *cu= (Curve*)ptr->data; @@ -1355,7 +1363,8 @@ static void rna_def_curve(BlenderRNA *brna) prop= RNA_def_property(srna, "use_auto_texspace", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "texflag", CU_AUTOSPACE); RNA_def_property_ui_text(prop, "Auto Texture Space", "Adjusts active object's texture space automatically when transforming object"); - + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Curve_texspace_set"); + prop= RNA_def_property(srna, "texspace_location", PROP_FLOAT, PROP_TRANSLATION); RNA_def_property_array(prop, 3); RNA_def_property_ui_text(prop, "Texture Space Location", "Texture space location"); diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index 1eaf3d599db..192825e3afa 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -229,6 +229,15 @@ static void rna_MeshColor_color4_set(PointerRNA *ptr, const float *values) (&mcol[3].r)[0]= (char)(CLAMPIS(values[2]*255.0f, 0, 255)); } +static void rna_Mesh_texspace_set(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + Mesh *me= (Mesh*)ptr->data; + + if (me->texflag & AUTOSPACE) + tex_space_mesh(me); +} + + static int rna_Mesh_texspace_editable(PointerRNA *ptr) { Mesh *me= (Mesh*)ptr->data; @@ -1903,6 +1912,7 @@ static void rna_def_mesh(BlenderRNA *brna) prop= RNA_def_property(srna, "use_auto_texspace", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "texflag", AUTOSPACE); RNA_def_property_ui_text(prop, "Auto Texture Space", "Adjusts active object's texture space automatically when transforming object"); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Mesh_texspace_set"); prop= RNA_def_property(srna, "texspace_location", PROP_FLOAT, PROP_TRANSLATION); RNA_def_property_array(prop, 3); -- cgit v1.2.3