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>2009-02-11 15:19:42 +0300
committerJoshua Leung <aligorith@gmail.com>2009-02-11 15:19:42 +0300
commit7d3c88772b4cdf9cec8966390e84bdd21802395f (patch)
tree9b3545b7c16ff34b7dcc25b1b59348221f1d9b29 /source/blender/blenloader
parentba32199b23fb1b745109d7b25b8d7c6cdf903cd1 (diff)
Keying Sets: Initial commit of skeleton code
When fully implemented, these will be the clearest demonstration of 'Everything is Animateable', as they will allow users to define an arbitary group of settings through selecting items in the Datablocks (RNA-Viewer) View of the Outliner to define custom 'sets'. Such Keying Sets are known as the 'absolute' ones, which are created for a custom purpose. Of course, 'builtin' Keying Sets will still be provided. Such built-in ones will not work on any particular paths, but will use context info to maintain the legacy method of inserting keyframes (via IKEY menu). Currently, KeyingSets cannot be created/edited through the UI, though the backend code is in place to do this.
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r--source/blender/blenloader/intern/readfile.c52
-rw-r--r--source/blender/blenloader/intern/writefile.c25
2 files changed, 75 insertions, 2 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 2a0f98cfe8d..b3eee6e552e 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -1929,6 +1929,39 @@ static void direct_link_action(FileData *fd, bAction *act)
/* ------- */
+static void lib_link_keyingsets(FileData *fd, ID *id, ListBase *list)
+{
+ KeyingSet *ks;
+ KS_Path *ksp;
+
+ /* here, we're only interested in the ID pointer stored in some of the paths */
+ for (ks= list->first; ks; ks= ks->next) {
+ for (ksp= ks->paths.first; ksp; ksp= ksp->next) {
+ ksp->id= newlibadr(fd, id->lib, ksp->id);
+ }
+ }
+}
+
+/* NOTE: this assumes that link_list has already been called on the list */
+static void direct_link_keyingsets(FileData *fd, ListBase *list)
+{
+ KeyingSet *ks;
+ KS_Path *ksp;
+
+ /* link KeyingSet data to KeyingSet again (non ID-libs) */
+ for (ks= list->first; ks; ks= ks->next) {
+ /* paths */
+ link_list(fd, &ks->paths);
+
+ for (ksp= ks->paths.first; ksp; ksp= ksp->next) {
+ /* rna path */
+ ksp->rna_path= newdataadr(fd, ksp->rna_path);
+ }
+ }
+}
+
+/* ------- */
+
static void lib_link_animdata(FileData *fd, ID *id, AnimData *adt)
{
if (adt == NULL)
@@ -3698,6 +3731,8 @@ static void lib_link_scene(FileData *fd, Main *main)
if (sce->id.properties) IDP_LibLinkProperty(sce->id.properties, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
if (sce->adt) lib_link_animdata(fd, &sce->id, sce->adt);
+ lib_link_keyingsets(fd, &sce->id, &sce->keyingsets);
+
sce->camera= newlibadr(fd, sce->id.lib, sce->camera);
sce->world= newlibadr_us(fd, sce->id.lib, sce->world);
sce->set= newlibadr(fd, sce->id.lib, sce->set);
@@ -3791,6 +3826,9 @@ static void direct_link_scene(FileData *fd, Scene *sce)
sce->adt= newdataadr(fd, sce->adt);
direct_link_animdata(fd, sce->adt);
+ link_list(fd, &sce->keyingsets);
+ direct_link_keyingsets(fd, &sce->keyingsets);
+
sce->basact= newdataadr(fd, sce->basact);
sce->radio= newdataadr(fd, sce->radio);
@@ -9124,6 +9162,19 @@ static void expand_action(FileData *fd, Main *mainvar, bAction *act)
}
}
+static void expand_keyingsets(FileData *fd, Main *mainvar, ListBase *list)
+{
+ KeyingSet *ks;
+ KS_Path *ksp;
+
+ /* expand the ID-pointers in KeyingSets's paths */
+ for (ks= list->first; ks; ks= ks->next) {
+ for (ksp= ks->paths.first; ksp; ksp= ksp->next) {
+ expand_doit(fd, mainvar, ksp->id);
+ }
+ }
+}
+
static void expand_animdata(FileData *fd, Main *mainvar, AnimData *adt)
{
FCurve *fcd;
@@ -9655,6 +9706,7 @@ static void expand_scene(FileData *fd, Main *mainvar, Scene *sce)
if(sce->adt)
expand_animdata(fd, mainvar, sce->adt);
+ expand_keyingsets(fd, mainvar, &sce->keyingsets);
if(sce->nodetree)
expand_nodetree(fd, mainvar, sce->nodetree);
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 9c94842ac08..623d1eebe31 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -855,6 +855,26 @@ static void write_actions(WriteData *wd, ListBase *idbase)
mywrite(wd, MYWRITE_FLUSH, 0);
}
+static void write_keyingsets(WriteData *wd, ListBase *list)
+{
+ KeyingSet *ks;
+ KS_Path *ksp;
+
+ for (ks= list->first; ks; ks= ks->next) {
+ /* KeyingSet */
+ writestruct(wd, DATA, "KeyingSet", 1, ks);
+
+ /* Paths */
+ for (ksp= ks->paths.first; ksp; ksp= ksp->next) {
+ /* Path */
+ writestruct(wd, DATA, "KS_Path", 1, ksp);
+
+ if (ksp->rna_path)
+ writedata(wd, DATA, strlen(ksp->rna_path)+1, ksp->rna_path);
+ }
+ }
+}
+
static void write_animdata(WriteData *wd, AnimData *adt)
{
AnimOverride *aor;
@@ -1533,6 +1553,7 @@ static void write_scenes(WriteData *wd, ListBase *scebase)
if (sce->id.properties) IDP_WriteProperty(sce->id.properties, wd);
if (sce->adt) write_animdata(wd, sce->adt);
+ write_keyingsets(wd, &sce->keyingsets);
/* direct data */
base= sce->base.first;
@@ -1616,9 +1637,9 @@ static void write_scenes(WriteData *wd, ListBase *scebase)
writestruct(wd, DATA, "MetaStack", 1, ms);
}
}
-
+
write_scriptlink(wd, &sce->scriptlink);
-
+
if (sce->r.avicodecdata) {
writestruct(wd, DATA, "AviCodecData", 1, sce->r.avicodecdata);
if (sce->r.avicodecdata->lpFormat) writedata(wd, DATA, sce->r.avicodecdata->cbFormat, sce->r.avicodecdata->lpFormat);