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
This commit is contained in:
Ton Roosendaal
2011-01-06 11:16:35 +00:00
parent a4c0d644c9
commit 5cef085f77
4 changed files with 24 additions and 3 deletions

View File

@@ -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:

View File

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

View File

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

View File

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