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:
-rw-r--r--source/blender/blenkernel/intern/anim_sys.c5
-rw-r--r--source/blender/blenkernel/intern/lattice.c11
-rw-r--r--source/blender/blenkernel/intern/mball.c5
-rw-r--r--source/blender/blenloader/intern/readfile.c7
-rw-r--r--source/blender/blenloader/intern/writefile.c5
-rw-r--r--source/blender/makesdna/DNA_lattice_types.h4
-rw-r--r--source/blender/makesrna/intern/rna_lattice.c31
7 files changed, 60 insertions, 8 deletions
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c
index e48183ac479..b595d22e88c 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -73,7 +73,7 @@ short id_type_can_have_animdata (ID *id)
switch (GS(id->name)) {
/* has AnimData */
case ID_OB:
- case ID_ME: case ID_MB: case ID_CU: case ID_AR:
+ case ID_ME: case ID_MB: case ID_CU: case ID_AR: case ID_LT:
case ID_KE:
case ID_PA:
case ID_MA: case ID_TE: case ID_NT:
@@ -1913,6 +1913,9 @@ void BKE_animsys_evaluate_all_animation (Main *main, float ctime)
/* armatures */
EVAL_ANIM_IDS(main->armature.first, ADT_RECALC_ANIM);
+ /* lattices */
+ EVAL_ANIM_IDS(main->latt.first, ADT_RECALC_ANIM);
+
/* meshes */
EVAL_ANIM_IDS(main->mesh.first, ADT_RECALC_ANIM);
diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c
index 73d77e850fd..891d42c4a76 100644
--- a/source/blender/blenkernel/intern/lattice.c
+++ b/source/blender/blenkernel/intern/lattice.c
@@ -49,6 +49,7 @@
#include "DNA_curve_types.h"
#include "DNA_key_types.h"
+#include "BKE_animsys.h"
#include "BKE_anim.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_displist.h"
@@ -203,10 +204,6 @@ Lattice *copy_lattice(Lattice *lt)
ltn= copy_libblock(lt);
ltn->def= MEM_dupallocN(lt->def);
-
-#if 0 // XXX old animation system
- id_us_plus((ID *)ltn->ipo);
-#endif // XXX old animation system
ltn->key= copy_key(ltn->key);
if(ltn->key) ltn->key->from= (ID *)ltn;
@@ -233,6 +230,12 @@ void free_lattice(Lattice *lt)
MEM_freeN(editlt);
MEM_freeN(lt->editlatt);
}
+
+ /* free animation data */
+ if (lt->adt) {
+ BKE_free_animdata(&lt->id);
+ lt->adt= NULL;
+ }
}
diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c
index 94ffaaea947..03cbd9e41fd 100644
--- a/source/blender/blenkernel/intern/mball.c
+++ b/source/blender/blenkernel/intern/mball.c
@@ -86,7 +86,10 @@ void free_mball(MetaBall *mb)
{
unlink_mball(mb);
- if(mb->adt) BKE_free_animdata((ID *)mb);
+ if(mb->adt) {
+ BKE_free_animdata((ID *)mb);
+ mb->adt = NULL;
+ }
if(mb->mat) MEM_freeN(mb->mat);
if(mb->bb) MEM_freeN(mb->bb);
BLI_freelistN(&mb->elems);
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index c22cdb21899..44fbf9ef317 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -3421,6 +3421,7 @@ static void lib_link_latt(FileData *fd, Main *main)
lt= main->latt.first;
while(lt) {
if(lt->id.flag & LIB_NEEDLINK) {
+ if(lt->adt) lib_link_animdata(fd, &lt->id, lt->adt);
lt->ipo= newlibadr_us(fd, lt->id.lib, lt->ipo); // XXX depreceated - old animation system
lt->key= newlibadr_us(fd, lt->id.lib, lt->key);
@@ -3439,6 +3440,9 @@ static void direct_link_latt(FileData *fd, Lattice *lt)
direct_link_dverts(fd, lt->pntsu*lt->pntsv*lt->pntsw, lt->dvert);
lt->editlatt= NULL;
+
+ lt->adt = newdataadr(fd, lt->adt);
+ direct_link_animdata(fd, lt->adt);
}
@@ -11766,6 +11770,9 @@ static void expand_lattice(FileData *fd, Main *mainvar, Lattice *lt)
{
expand_doit(fd, mainvar, lt->ipo); // XXX depreceated - old animation system
expand_doit(fd, mainvar, lt->key);
+
+ if (lt->adt)
+ expand_animdata(fd, mainvar, lt->adt);
}
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 9d990d3ea30..6f6f7570df2 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -1557,7 +1557,10 @@ static void write_lattices(WriteData *wd, ListBase *idbase)
/* write LibData */
writestruct(wd, ID_LT, "Lattice", 1, lt);
if (lt->id.properties) IDP_WriteProperty(lt->id.properties, wd);
-
+
+ /* write animdata */
+ if (lt->adt) write_animdata(wd, lt->adt);
+
/* direct data */
writestruct(wd, DATA, "BPoint", lt->pntsu*lt->pntsv*lt->pntsw, lt->def);
diff --git a/source/blender/makesdna/DNA_lattice_types.h b/source/blender/makesdna/DNA_lattice_types.h
index 3d05acfbe0d..253846dfae5 100644
--- a/source/blender/makesdna/DNA_lattice_types.h
+++ b/source/blender/makesdna/DNA_lattice_types.h
@@ -31,6 +31,7 @@
#include "DNA_ID.h"
+struct AnimData;
struct BPoint;
struct Ipo;
struct Key;
@@ -46,6 +47,7 @@ typedef struct EditLatt {
typedef struct Lattice {
ID id;
+ struct AnimData *adt;
short pntsu, pntsv, pntsw, flag;
short opntsu, opntsv, opntsw, pad2;
@@ -56,7 +58,7 @@ typedef struct Lattice {
struct BPoint *def;
- struct Ipo *ipo;
+ struct Ipo *ipo; /* XXX: depreceated... old animation system */
struct Key *key;
struct MDeformVert *dvert;
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)