mirror of
https://github.com/aap/librw.git
synced 2025-02-16 17:26:18 +00:00
different way of attaching hanim nodes to frames
This commit is contained in:
parent
dbb131d92b
commit
2721f48793
@ -78,11 +78,23 @@ findById(Frame *f, int32 id)
|
|||||||
return findById(f->child, id);
|
return findById(f->child, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Frame*
|
||||||
|
findUnattachedById(HAnimHierarchy *hier, Frame *f, int32 id)
|
||||||
|
{
|
||||||
|
if(f == nil) return nil;
|
||||||
|
HAnimData *hanim = HAnimData::get(f);
|
||||||
|
if(hanim->id >= 0 && hanim->id == id && hier->getIndex(f) == -1) return f;
|
||||||
|
Frame *ff = findUnattachedById(hier, f->next, id);
|
||||||
|
if(ff) return ff;
|
||||||
|
return findUnattachedById(hier, f->child, id);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
HAnimHierarchy::attachByIndex(int32 idx)
|
HAnimHierarchy::attachByIndex(int32 idx)
|
||||||
{
|
{
|
||||||
int32 id = this->nodeInfo[idx].id;
|
int32 id = this->nodeInfo[idx].id;
|
||||||
Frame *f = findById(this->parentFrame, id);
|
// Frame *f = findById(this->parentFrame, id);
|
||||||
|
Frame *f = findUnattachedById(this, this->parentFrame, id);
|
||||||
this->nodeInfo[idx].frame = f;
|
this->nodeInfo[idx].frame = f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,6 +114,15 @@ HAnimHierarchy::getIndex(int32 id)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32
|
||||||
|
HAnimHierarchy::getIndex(Frame *f)
|
||||||
|
{
|
||||||
|
for(int32 i = 0; i < this->numNodes; i++)
|
||||||
|
if(this->nodeInfo[i].frame == f)
|
||||||
|
return i;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
HAnimHierarchy*
|
HAnimHierarchy*
|
||||||
HAnimHierarchy::get(Frame *f)
|
HAnimHierarchy::get(Frame *f)
|
||||||
{
|
{
|
||||||
|
@ -45,6 +45,7 @@ struct HAnimHierarchy
|
|||||||
void attachByIndex(int32 id);
|
void attachByIndex(int32 id);
|
||||||
void attach(void);
|
void attach(void);
|
||||||
int32 getIndex(int32 id);
|
int32 getIndex(int32 id);
|
||||||
|
int32 getIndex(Frame *f);
|
||||||
void updateMatrices(void);
|
void updateMatrices(void);
|
||||||
|
|
||||||
static HAnimHierarchy *get(Frame *f);
|
static HAnimHierarchy *get(Frame *f);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user