mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 09:23:03 -04:00
more interfaces for querying animations
This commit is contained in:
parent
d502a2489e
commit
97d233303b
@ -116,8 +116,15 @@ get_anim() const {
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: AnimControl::get_channel_index
|
||||
// Access: Public
|
||||
// Description:
|
||||
// Access: Published
|
||||
// Description: Returns the particular channel index associated with
|
||||
// this AnimControl. This channel index is the slot on
|
||||
// which each AnimGroup is bound to its associated
|
||||
// PartGroup, for each joint in the animation.
|
||||
//
|
||||
// It will be true that
|
||||
// get_part()->find_child("n")->get_bound(get_channel_index())
|
||||
// == get_anim()->find_child("n"), for each joint "n".
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE int AnimControl::
|
||||
get_channel_index() const {
|
||||
|
@ -73,6 +73,7 @@ PUBLISHED:
|
||||
|
||||
PartBundle *get_part() const;
|
||||
INLINE AnimBundle *get_anim() const;
|
||||
INLINE int get_channel_index() const;
|
||||
|
||||
void output(ostream &out) const;
|
||||
|
||||
@ -86,8 +87,6 @@ public:
|
||||
bool channel_has_changed(AnimChannelBase *channel) const;
|
||||
void mark_channels();
|
||||
|
||||
INLINE int get_channel_index() const;
|
||||
|
||||
private:
|
||||
|
||||
enum ActionType {
|
||||
|
@ -29,3 +29,37 @@ MovingPartBase(const MovingPartBase ©) :
|
||||
{
|
||||
// We don't copy the bound channels.
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: MovingPartBase::get_max_bound
|
||||
// Access: Published
|
||||
// Description: Returns the number of channels that might be bound to
|
||||
// this PartGroup. This might not be the actual number
|
||||
// of channels, since there might be holes in the list;
|
||||
// it is one more than the index number of the highest
|
||||
// bound channel. Thus, it is called get_max_bound()
|
||||
// instead of get_num_bound().
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE int MovingPartBase::
|
||||
get_max_bound() const {
|
||||
return _channels.size();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: MovingPartBase::get_bound
|
||||
// Access: Published
|
||||
// Description: Returns the nth bound channel on this PartGroup. n
|
||||
// can be determined by iterating from 0 to one less
|
||||
// than get_max_bound(); or n might be
|
||||
// AnimControl::get_channel_index().
|
||||
//
|
||||
// This will return NULL if there is no channel bound on
|
||||
// the indicated index. It is an error to call this if
|
||||
// n is less than zero or greater than or equal to
|
||||
// get_max_bound().
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE AnimChannelBase *MovingPartBase::
|
||||
get_bound(int n) const {
|
||||
nassertr(n >= 0 && n < (int)_channels.size(), NULL);
|
||||
return _channels[n];
|
||||
}
|
||||
|
@ -208,6 +208,10 @@ pick_channel_index(plist<int> &holes, int &next) const {
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void MovingPartBase::
|
||||
bind_hierarchy(AnimGroup *anim, int channel_index) {
|
||||
if (chan_cat.is_debug()) {
|
||||
chan_cat.debug()
|
||||
<< "binding " << *this << " to " << *anim << "\n";
|
||||
}
|
||||
while ((int)_channels.size() <= channel_index) {
|
||||
_channels.push_back((AnimChannelBase*)0L);
|
||||
}
|
||||
|
@ -42,6 +42,11 @@ protected:
|
||||
public:
|
||||
MovingPartBase(PartGroup *parent, const string &name);
|
||||
|
||||
PUBLISHED:
|
||||
INLINE int get_max_bound() const;
|
||||
INLINE AnimChannelBase *get_bound(int n) const;
|
||||
|
||||
public:
|
||||
virtual TypeHandle get_value_type() const=0;
|
||||
virtual AnimChannelBase *make_initial_channel() const=0;
|
||||
virtual void write(ostream &out, int indent_level) const;
|
||||
|
@ -168,7 +168,7 @@ public:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void PartGroup::
|
||||
sort_descendants() {
|
||||
sort(_children.begin(), _children.end(), PartGroupAlphabeticalOrder());
|
||||
stable_sort(_children.begin(), _children.end(), PartGroupAlphabeticalOrder());
|
||||
|
||||
Children::iterator ci;
|
||||
for (ci = _children.begin(); ci != _children.end(); ++ci) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user