RNA + Animation:

* Added missing RNA wrapping for Scene -> AnimData
* Fixed bug (with temp-fix) where sequence strips with no names couldn't be animated properly. Currently, this will just use the index of the strip, although that is likely to be mutable (adding/removing strips will change it).

* Removed some old unused code from action.c
This commit is contained in:
Joshua Leung 2009-09-27 09:38:13 +00:00
parent 4363132788
commit 6e0c1cd4e5
5 changed files with 15 additions and 133 deletions

@ -1181,138 +1181,6 @@ static void blend_pose_offset_bone(bActionStrip *strip, bPose *dst, bPose *src,
VecAddf(dst->cyclic_offset, dst->cyclic_offset, src->cyclic_offset); VecAddf(dst->cyclic_offset, dst->cyclic_offset, src->cyclic_offset);
} }
typedef struct NlaIpoChannel {
struct NlaIpoChannel *next, *prev;
float val;
void *poin;
int type;
} NlaIpoChannel;
static void extract_ipochannels_from_action(ListBase *lb, ID *id, bAction *act, const char *name, float ctime)
{
bActionChannel *achan= get_action_channel(act, name);
IpoCurve *icu;
NlaIpoChannel *nic;
if(achan==NULL) return;
if(achan->ipo) {
calc_ipo(achan->ipo, ctime);
for(icu= achan->ipo->curve.first; icu; icu= icu->next) {
/* skip IPO_BITS, is for layers and cannot be blended */
if(icu->vartype != IPO_BITS) {
nic= MEM_callocN(sizeof(NlaIpoChannel), "NlaIpoChannel");
BLI_addtail(lb, nic);
nic->val= icu->curval;
nic->poin= get_ipo_poin(id, icu, &nic->type);
}
}
}
/* constraint channels only for objects */
if(GS(id->name)==ID_OB) {
Object *ob= (Object *)id;
bConstraint *con;
bConstraintChannel *conchan;
for (con=ob->constraints.first; con; con=con->next) {
conchan = get_constraint_channel(&achan->constraintChannels, con->name);
if(conchan && conchan->ipo) {
calc_ipo(conchan->ipo, ctime);
icu= conchan->ipo->curve.first; // only one ipo now
if(icu) {
nic= MEM_callocN(sizeof(NlaIpoChannel), "NlaIpoChannel constr");
BLI_addtail(lb, nic);
nic->val= icu->curval;
nic->poin= &con->enforce;
nic->type= IPO_FLOAT;
}
}
}
}
}
static NlaIpoChannel *find_nla_ipochannel(ListBase *lb, void *poin)
{
NlaIpoChannel *nic;
if(poin) {
for(nic= lb->first; nic; nic= nic->next) {
if(nic->poin==poin)
return nic;
}
}
return NULL;
}
static void blend_ipochannels(ListBase *dst, ListBase *src, float srcweight, int mode)
{
NlaIpoChannel *snic, *dnic, *next;
float dstweight;
switch (mode){
case ACTSTRIPMODE_BLEND:
dstweight = 1.0F - srcweight;
break;
case ACTSTRIPMODE_ADD:
dstweight = 1.0F;
break;
default :
dstweight = 1.0F;
}
for(snic= src->first; snic; snic= next) {
next= snic->next;
dnic= find_nla_ipochannel(dst, snic->poin);
if(dnic==NULL) {
/* remove from src list, and insert in dest */
BLI_remlink(src, snic);
BLI_addtail(dst, snic);
}
else {
/* we do the blend */
dnic->val= dstweight*dnic->val + srcweight*snic->val;
}
}
}
static int execute_ipochannels(ListBase *lb)
{
NlaIpoChannel *nic;
int count = 0;
for(nic= lb->first; nic; nic= nic->next) {
if(nic->poin) {
write_ipo_poin(nic->poin, nic->type, nic->val);
count++;
}
}
return count;
}
/* nla timing */
/* this now only used for repeating cycles, to enable fields and blur. */
/* the whole time control in blender needs serious thinking... */
static float nla_time(Scene *scene, float cfra, float unit)
{
extern float bluroffs; // bad construct, borrowed from object.c for now
extern float fieldoffs;
/* motion blur & fields */
cfra+= unit*(bluroffs+fieldoffs);
/* global time */
cfra*= scene->r.framelen;
return cfra;
}
/* added "sizecorr" here, to allow armatures to be scaled and still have striding. /* added "sizecorr" here, to allow armatures to be scaled and still have striding.
Only works for uniform scaling. In general I'd advise against scaling armatures ever though! (ton) Only works for uniform scaling. In general I'd advise against scaling armatures ever though! (ton)
*/ */

@ -1344,6 +1344,8 @@ static int graphkeys_euler_filter_exec (bContext *C, wmOperator *op)
* - first check if id-blocks are compatible * - first check if id-blocks are compatible
*/ */
if ((euf) && (ale->id != euf->id)) { if ((euf) && (ale->id != euf->id)) {
/* if the paths match, add this curve to the set of curves */
// NOTE: simple string compare for now... could be a bit more fancy...
} }
else { else {

@ -592,6 +592,7 @@ static void rna_def_armature(BlenderRNA *brna)
RNA_def_struct_ui_icon(srna, ICON_ARMATURE_DATA); RNA_def_struct_ui_icon(srna, ICON_ARMATURE_DATA);
RNA_def_struct_sdna(srna, "bArmature"); RNA_def_struct_sdna(srna, "bArmature");
/* Animation Data */
rna_def_animdata_common(srna); rna_def_animdata_common(srna);
/* Collections */ /* Collections */

@ -2041,6 +2041,9 @@ void RNA_def_scene(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Stamp Note", "User define note for the render stamping."); RNA_def_property_ui_text(prop, "Stamp Note", "User define note for the render stamping.");
RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
/* Animation Data (for Scene) */
rna_def_animdata_common(srna);
/* Nodes (Compositing) */ /* Nodes (Compositing) */
prop= RNA_def_property(srna, "nodetree", PROP_POINTER, PROP_NONE); prop= RNA_def_property(srna, "nodetree", PROP_POINTER, PROP_NONE);
RNA_def_property_ui_text(prop, "Node Tree", "Compositing node tree."); RNA_def_property_ui_text(prop, "Node Tree", "Compositing node tree.");

@ -228,7 +228,15 @@ static char *rna_Sequence_path(PointerRNA *ptr)
/* sequencer data comes from scene... /* sequencer data comes from scene...
* TODO: would be nice to make SequenceEditor data a datablock of its own (for shorter paths) * TODO: would be nice to make SequenceEditor data a datablock of its own (for shorter paths)
*/ */
return BLI_sprintfN("sequence_editor.sequences[\"%s\"]", seq->name+2); if (seq->name+2)
return BLI_sprintfN("sequence_editor.sequences[\"%s\"]", seq->name+2);
else {
/* compromise for the frequent sitation when strips don't have names... */
Scene *sce= (Scene*)ptr->id.data;
Editing *ed= seq_give_editing(sce, FALSE);
return BLI_sprintfN("sequence_editor.sequences[%d]", BLI_findindex(&ed->seqbase, seq));
}
} }
static PointerRNA rna_SequenceEdtior_meta_stack_get(CollectionPropertyIterator *iter) static PointerRNA rna_SequenceEdtior_meta_stack_get(CollectionPropertyIterator *iter)