diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2010-08-10 10:36:42 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2010-08-10 10:36:42 +0400 |
commit | c0e39df6ac42d137fd51eeea463aace856bf97d4 (patch) | |
tree | 86be54ecb6f01b8192905a05707b12402970d5a4 /source/blender/makesrna/intern | |
parent | 41531e4fb6547df543a80d62b473c250d5b78753 (diff) |
- Enable shape key switching in edit mode for curves, surfaces and latticies
- Disable changing of lattice size if there are shape keys
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r-- | source/blender/makesrna/intern/rna_lattice.c | 44 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_object.c | 22 |
2 files changed, 48 insertions, 18 deletions
diff --git a/source/blender/makesrna/intern/rna_lattice.c b/source/blender/makesrna/intern/rna_lattice.c index c5132844016..9f979582165 100644 --- a/source/blender/makesrna/intern/rna_lattice.c +++ b/source/blender/makesrna/intern/rna_lattice.c @@ -79,8 +79,8 @@ static void rna_Lattice_points_begin(CollectionPropertyIterator *iter, PointerRN Lattice *lt= (Lattice*)ptr->data; int tot= lt->pntsu*lt->pntsv*lt->pntsw; - if(lt->editlatt && lt->editlatt->def) - rna_iterator_array_begin(iter, (void*)lt->editlatt->def, sizeof(BPoint), tot, 0, NULL); + if(lt->editlatt && lt->editlatt->latt->def) + rna_iterator_array_begin(iter, (void*)lt->editlatt->latt->def, sizeof(BPoint), tot, 0, NULL); else if(lt->def) rna_iterator_array_begin(iter, (void*)lt->def, sizeof(BPoint), tot, 0, NULL); else @@ -111,7 +111,7 @@ static void rna_Lattice_update_size(Main *bmain, Scene *scene, PointerRNA *ptr) if(ob->data == lt) { resizelattice(lt, newu, newv, neww, ob); if(lt->editlatt) - resizelattice(lt->editlatt, newu, newv, neww, ob); + resizelattice(lt->editlatt->latt, newu, newv, neww, ob); break; } } @@ -120,7 +120,7 @@ static void rna_Lattice_update_size(Main *bmain, Scene *scene, PointerRNA *ptr) if(!ob) { resizelattice(lt, newu, newv, neww, NULL); if(lt->editlatt) - resizelattice(lt->editlatt, newu, newv, neww, NULL); + resizelattice(lt->editlatt->latt, newu, newv, neww, NULL); } rna_Lattice_update_data(bmain, scene, ptr); @@ -136,26 +136,39 @@ static void rna_Lattice_outside_set(PointerRNA *ptr, int value) outside_lattice(lt); if(lt->editlatt) { - if(value) lt->editlatt->flag |= LT_OUTSIDE; - else lt->editlatt->flag &= ~LT_OUTSIDE; + if(value) lt->editlatt->latt->flag |= LT_OUTSIDE; + else lt->editlatt->latt->flag &= ~LT_OUTSIDE; - outside_lattice(lt->editlatt); + outside_lattice(lt->editlatt->latt); } } +static int rna_Lattice_size_editable(PointerRNA *ptr) +{ + Lattice *lt= (Lattice*)ptr->data; + + return lt->key == NULL; +} + static void rna_Lattice_points_u_set(PointerRNA *ptr, int value) { - ((Lattice*)ptr->data)->opntsu= CLAMPIS(value, 1, 64); + Lattice *lt= (Lattice*)ptr->data; + + lt->opntsu= CLAMPIS(value, 1, 64); } static void rna_Lattice_points_v_set(PointerRNA *ptr, int value) { - ((Lattice*)ptr->data)->opntsv= CLAMPIS(value, 1, 64); + Lattice *lt= (Lattice*)ptr->data; + + lt->opntsv= CLAMPIS(value, 1, 64); } static void rna_Lattice_points_w_set(PointerRNA *ptr, int value) { - ((Lattice*)ptr->data)->opntsw= CLAMPIS(value, 1, 64); + Lattice *lt= (Lattice*)ptr->data; + + lt->opntsw= CLAMPIS(value, 1, 64); } static void rna_Lattice_vg_name_set(PointerRNA *ptr, const char *value) @@ -164,7 +177,7 @@ static void rna_Lattice_vg_name_set(PointerRNA *ptr, const char *value) strcpy(lt->vgroup, value); if(lt->editlatt) - strcpy(lt->editlatt->vgroup, value); + strcpy(lt->editlatt->latt->vgroup, value); } @@ -216,22 +229,25 @@ static void rna_def_lattice(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "pntsu"); RNA_def_property_int_funcs(prop, NULL, "rna_Lattice_points_u_set", NULL); RNA_def_property_range(prop, 1, 64); - RNA_def_property_ui_text(prop, "U", "Points in U direction"); + RNA_def_property_ui_text(prop, "U", "Points in U direction (can't be changed when there are shape keys)"); RNA_def_property_update(prop, 0, "rna_Lattice_update_size"); + RNA_def_property_editable_func(prop, "rna_Lattice_size_editable"); prop= RNA_def_property(srna, "points_v", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "pntsv"); RNA_def_property_int_funcs(prop, NULL, "rna_Lattice_points_v_set", NULL); RNA_def_property_range(prop, 1, 64); - RNA_def_property_ui_text(prop, "V", "Points in V direction"); + RNA_def_property_ui_text(prop, "V", "Points in V direction (can't be changed when there are shape keys)"); RNA_def_property_update(prop, 0, "rna_Lattice_update_size"); + RNA_def_property_editable_func(prop, "rna_Lattice_size_editable"); prop= RNA_def_property(srna, "points_w", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "pntsw"); RNA_def_property_int_funcs(prop, NULL, "rna_Lattice_points_w_set", NULL); RNA_def_property_range(prop, 1, 64); - RNA_def_property_ui_text(prop, "W", "Points in W direction"); + RNA_def_property_ui_text(prop, "W", "Points in W direction (can't be changed when there are shape keys)"); RNA_def_property_update(prop, 0, "rna_Lattice_update_size"); + RNA_def_property_editable_func(prop, "rna_Lattice_size_editable"); prop= RNA_def_property(srna, "interpolation_type_u", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "typeu"); diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 51e2fc38014..ee38505d792 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -128,6 +128,8 @@ EnumPropertyItem object_type_curve_items[] = { #include "ED_mesh.h" #include "ED_object.h" #include "ED_particle.h" +#include "ED_curve.h" +#include "ED_lattice.h" static void rna_Object_internal_update(Main *bmain, Scene *scene, PointerRNA *ptr) { @@ -182,12 +184,24 @@ void rna_Object_internal_update_data(Main *bmain, Scene *scene, PointerRNA *ptr) void rna_Object_active_shape_update(Main *bmain, Scene *scene, PointerRNA *ptr) { Object *ob= ptr->id.data; - int editmode= (scene->obedit == ob && ob->type == OB_MESH); - if(editmode) { + if(scene->obedit == ob) { /* exit/enter editmode to get new shape */ - load_editMesh(scene, ob); - make_editMesh(scene, ob); + switch(ob->type) { + case OB_MESH: + load_editMesh(scene, ob); + make_editMesh(scene, ob); + break; + case OB_CURVE: + case OB_SURF: + load_editNurb(ob); + make_editNurb(ob); + break; + case OB_LATTICE: + load_editLatt(ob); + make_editLatt(ob); + break; + } } rna_Object_internal_update_data(bmain, scene, ptr); |