diff options
author | Ton Roosendaal <ton@blender.org> | 2006-11-11 19:45:17 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2006-11-11 19:45:17 +0300 |
commit | feb210f08ebd5d6283624996883719b00fa590eb (patch) | |
tree | f08814d79d54c87810a320a0f6f101ba5e1a1175 /source/blender/blenloader | |
parent | 97f892b86b9b31e8165c27c698da7996dfd2d0a2 (diff) |
Experimental feature, especially for the animation department:
THE OBJECT PROXY
Or simple said; local control of referenced data from libraries.
Having library files with references is a very common studio setup, and
Blender did do quite well in that area. Were it not that for character
setups it was impossible to use still.
This commit will enable a full rig+character to remain in the library,
and still have - under strict control - local access for animation edits.
Full log:
http://www.blender3d.org/cms/Proxy_Objects.824.0.html
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 29 | ||||
-rw-r--r-- | source/blender/blenloader/intern/writefile.c | 1 |
2 files changed, 27 insertions, 3 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index ddbacb1ef23..fd80536dea1 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -1589,18 +1589,29 @@ static void lib_link_pose(FileData *fd, Object *ob, bPose *pose) { bPoseChannel *pchan; bArmature *arm= ob->data; - int rebuild= 0; + int rebuild; + if (!pose || !arm) return; + /* always rebuild to match lib changes */ + rebuild= (ob->id.lib==NULL && arm->id.lib); for (pchan = pose->chanbase.first; pchan; pchan=pchan->next) { lib_link_constraints(fd, (ID *)ob, &pchan->constraints); - // hurms... loop in a loop, but yah... later... (ton) + + /* hurms... loop in a loop, but yah... later... (ton) */ pchan->bone= get_named_bone(arm, pchan->name); + pchan->custom= newlibadr(fd, arm->id.lib, pchan->custom); if(pchan->bone==NULL) rebuild= 1; + else if(ob->id.lib==NULL && arm->id.lib) { + /* local pose selection copied to armature, bit hackish */ + pchan->bone->flag &= ~(BONE_SELECTED|BONE_ACTIVE); + pchan->bone->flag |= pchan->selectflag; + } } + if(rebuild) { ob->recalc= OB_RECALC; pose->flag |= POSE_RECALC; @@ -2407,7 +2418,19 @@ static void lib_link_object(FileData *fd, Main *main) ob->ipo= newlibadr_us(fd, ob->id.lib, ob->ipo); ob->action = newlibadr_us(fd, ob->id.lib, ob->action); ob->dup_group= newlibadr_us(fd, ob->id.lib, ob->dup_group); - + if(ob->id.lib) { + /* no proxy in library data, is default local data */ + ob->proxy= NULL; ob->proxy_group= NULL; + } + else { + ob->proxy= newlibadr_us(fd, ob->id.lib, ob->proxy); + if(ob->proxy) { + ob->proxy->proxy= ob; + /* force proxy updates after load/undo, a bit weak */ + ob->recalc= ob->proxy->recalc= OB_RECALC; + } + ob->proxy_group= newlibadr_us(fd, ob->id.lib, ob->proxy_group); + } poin= ob->data; ob->data= newlibadr_us(fd, ob->id.lib, ob->data); diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index e92101e10e7..5577c7aa8a6 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -710,6 +710,7 @@ static void write_pose(WriteData *wd, bPose *pose) // Write channels for (chan=pose->chanbase.first; chan; chan=chan->next) { write_constraints(wd, &chan->constraints); + chan->selectflag= chan->bone->flag & (BONE_SELECTED|BONE_ACTIVE); // gets restored on read, for library armatures writestruct(wd, DATA, "bPoseChannel", 1, chan); } |