Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2010-12-13 09:31:49 +0300
committerJoshua Leung <aligorith@gmail.com>2010-12-13 09:31:49 +0300
commit1474b32456f26ead36b50d787d99f9b1769b27e8 (patch)
treea3726096ee36713a817df8492c97bda6ba4899d2 /source/blender/makesrna/intern/rna_lattice.c
parentdec478957114ddaed1512a47a590ff7fa52ade70 (diff)
Lattices now have AnimData
This allows manual (point by point) animation of their control verts, although many other settings cannot really be animated with any visible effects yet. Interestingly, lattices also had IPO block pointers, though they were never really used (AFAIK). Todo: - Animation Editor support has yet to be added. I've got a few other things to add to, so will group those changes together.
Diffstat (limited to 'source/blender/makesrna/intern/rna_lattice.c')
-rw-r--r--source/blender/makesrna/intern/rna_lattice.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_lattice.c b/source/blender/makesrna/intern/rna_lattice.c
index c9e7da414e5..1678201dec2 100644
--- a/source/blender/makesrna/intern/rna_lattice.c
+++ b/source/blender/makesrna/intern/rna_lattice.c
@@ -180,6 +180,33 @@ static void rna_Lattice_vg_name_set(PointerRNA *ptr, const char *value)
strcpy(lt->editlatt->latt->vgroup, value);
}
+/* annoying, but is a consequence of RNA structures... */
+static char *rna_LatticePoint_path(PointerRNA *ptr)
+{
+ Lattice *lt= (Lattice*)ptr->id.data;
+ void *point= ptr->data;
+ BPoint *points = NULL;
+
+ if (lt->editlatt && lt->editlatt->latt->def)
+ points = lt->editlatt->latt->def;
+ else
+ points = lt->def;
+
+ if (points && point) {
+ int tot= lt->pntsu*lt->pntsv*lt->pntsw;
+
+ /* only return index if in range */
+ if ((point >= (void *)points) && (point < (void *)(points + tot))) {
+ int pt_index = (int)((BPoint *)point - points);
+
+ return BLI_sprintfN("points[%d]", pt_index);
+ }
+ }
+ else {
+ return BLI_strdup("");
+ }
+}
+
#else
@@ -191,6 +218,7 @@ static void rna_def_latticepoint(BlenderRNA *brna)
srna= RNA_def_struct(brna, "LatticePoint", NULL);
RNA_def_struct_sdna(srna, "BPoint");
RNA_def_struct_ui_text(srna, "LatticePoint", "Point in the lattice grid");
+ RNA_def_struct_path_func(srna, "rna_LatticePoint_path");
prop= RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
RNA_def_property_array(prop, 3);
@@ -287,6 +315,9 @@ static void rna_def_lattice(BlenderRNA *brna)
RNA_def_property_struct_type(prop, "LatticePoint");
RNA_def_property_collection_funcs(prop, "rna_Lattice_points_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", 0, 0, 0);
RNA_def_property_ui_text(prop, "Points", "Points of the lattice");
+
+ /* pointers */
+ rna_def_animdata_common(srna);
}
void RNA_def_lattice(BlenderRNA *brna)