Tracker: style fixes to PoseList class
This commit is contained in:
@@ -49,12 +49,13 @@ PoseList::FindPose(const node_ref* node, int32* resultingIndex) const
|
|||||||
BPose* pose = ItemAt(index);
|
BPose* pose = ItemAt(index);
|
||||||
ASSERT(pose->TargetModel());
|
ASSERT(pose->TargetModel());
|
||||||
if (*pose->TargetModel()->NodeRef() == *node) {
|
if (*pose->TargetModel()->NodeRef() == *node) {
|
||||||
if (resultingIndex)
|
if (resultingIndex != NULL)
|
||||||
*resultingIndex = index;
|
*resultingIndex = index;
|
||||||
|
|
||||||
return pose;
|
return pose;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,7 +68,7 @@ PoseList::FindPose(const entry_ref* entry, int32* resultingIndex) const
|
|||||||
BPose* pose = ItemAt(index);
|
BPose* pose = ItemAt(index);
|
||||||
ASSERT(pose->TargetModel());
|
ASSERT(pose->TargetModel());
|
||||||
if (*pose->TargetModel()->EntryRef() == *entry) {
|
if (*pose->TargetModel()->EntryRef() == *entry) {
|
||||||
if (resultingIndex)
|
if (resultingIndex != NULL)
|
||||||
*resultingIndex = index;
|
*resultingIndex = index;
|
||||||
|
|
||||||
return pose;
|
return pose;
|
||||||
@@ -92,7 +93,7 @@ PoseList::DeepFindPose(const node_ref* node, int32* resultingIndex) const
|
|||||||
BPose* pose = ItemAt(index);
|
BPose* pose = ItemAt(index);
|
||||||
Model* model = pose->TargetModel();
|
Model* model = pose->TargetModel();
|
||||||
if (*model->NodeRef() == *node) {
|
if (*model->NodeRef() == *node) {
|
||||||
if (resultingIndex)
|
if (resultingIndex != NULL)
|
||||||
*resultingIndex = index;
|
*resultingIndex = index;
|
||||||
|
|
||||||
return pose;
|
return pose;
|
||||||
@@ -101,8 +102,8 @@ PoseList::DeepFindPose(const node_ref* node, int32* resultingIndex) const
|
|||||||
// of the link
|
// of the link
|
||||||
if (model->IsSymLink()) {
|
if (model->IsSymLink()) {
|
||||||
model = model->LinkTo();
|
model = model->LinkTo();
|
||||||
if (model && *model->NodeRef() == *node) {
|
if (model != NULL && *model->NodeRef() == *node) {
|
||||||
if (resultingIndex)
|
if (resultingIndex != NULL)
|
||||||
*resultingIndex = index;
|
*resultingIndex = index;
|
||||||
|
|
||||||
return pose;
|
return pose;
|
||||||
@@ -142,6 +143,7 @@ PoseList::FindAllPoses(const node_ref* node) const
|
|||||||
result->AddItem(pose);
|
result->AddItem(pose);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,11 +156,12 @@ PoseList::FindPoseByFileName(const char* name, int32* _index) const
|
|||||||
BPose* pose = ItemAt(index);
|
BPose* pose = ItemAt(index);
|
||||||
ASSERT(pose->TargetModel());
|
ASSERT(pose->TargetModel());
|
||||||
if (strcmp(pose->TargetModel()->EntryRef()->name, name) == 0) {
|
if (strcmp(pose->TargetModel()->EntryRef()->name, name) == 0) {
|
||||||
if (_index)
|
if (_index != NULL)
|
||||||
*_index = index;
|
*_index = index;
|
||||||
|
|
||||||
return pose;
|
return pose;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
+28
-16
@@ -31,15 +31,15 @@ of Be Incorporated in the United States and other countries. Other brand product
|
|||||||
names are registered trademarks or trademarks of their respective holders.
|
names are registered trademarks or trademarks of their respective holders.
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// PoseList is a commonly used instance of BObjectList<BPose>
|
||||||
|
// Defines convenience find and iteration calls
|
||||||
#ifndef _POSE_LIST_H
|
#ifndef _POSE_LIST_H
|
||||||
#define _POSE_LIST_H
|
#define _POSE_LIST_H
|
||||||
|
|
||||||
|
|
||||||
// PoseList is a commonly used instance of BObjectList<BPose>
|
#include <ObjectList.h>
|
||||||
// Defines convenience find and iteration calls
|
|
||||||
|
|
||||||
|
|
||||||
#include "ObjectList.h"
|
|
||||||
#include "Pose.h"
|
#include "Pose.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -50,15 +50,20 @@ namespace BPrivate {
|
|||||||
|
|
||||||
class Model;
|
class Model;
|
||||||
|
|
||||||
|
|
||||||
class PoseList : public BObjectList<BPose> {
|
class PoseList : public BObjectList<BPose> {
|
||||||
public:
|
public:
|
||||||
PoseList(int32 itemsPerBlock = 20, bool owning = false)
|
PoseList(int32 itemsPerBlock = 20, bool owning = false)
|
||||||
: BObjectList<BPose>(itemsPerBlock, owning)
|
:
|
||||||
{}
|
BObjectList<BPose>(itemsPerBlock, owning)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
PoseList(const PoseList &list)
|
PoseList(const PoseList &list)
|
||||||
: BObjectList<BPose>(list)
|
:
|
||||||
{}
|
BObjectList<BPose>(list)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
BPose* FindPose(const node_ref* node, int32* index = NULL) const;
|
BPose* FindPose(const node_ref* node, int32* index = NULL) const;
|
||||||
BPose* FindPose(const entry_ref* entry, int32* index = NULL) const;
|
BPose* FindPose(const entry_ref* entry, int32* index = NULL) const;
|
||||||
@@ -71,6 +76,7 @@ public:
|
|||||||
BPose* FindPoseByFileName(const char* name, int32* _index = NULL) const;
|
BPose* FindPoseByFileName(const char* name, int32* _index = NULL) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// iteration glue, add permutations as needed
|
// iteration glue, add permutations as needed
|
||||||
|
|
||||||
|
|
||||||
@@ -83,7 +89,7 @@ EachPoseAndModel(PoseList* list,
|
|||||||
for (int32 index = list->CountItems() - 1; index >= 0; index--) {
|
for (int32 index = list->CountItems() - 1; index >= 0; index--) {
|
||||||
BPose* pose = list->ItemAt(index);
|
BPose* pose = list->ItemAt(index);
|
||||||
Model* model = pose->TargetModel();
|
Model* model = pose->TargetModel();
|
||||||
if (model)
|
if (model != NULL)
|
||||||
(eachFunction)(pose, model, eachParam1);
|
(eachFunction)(pose, model, eachParam1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -98,7 +104,7 @@ EachPoseAndModel(PoseList* list,
|
|||||||
for (int32 index = list->CountItems() - 1; index >= 0; index--) {
|
for (int32 index = list->CountItems() - 1; index >= 0; index--) {
|
||||||
BPose* pose = list->ItemAt(index);
|
BPose* pose = list->ItemAt(index);
|
||||||
Model* model = pose->TargetModel();
|
Model* model = pose->TargetModel();
|
||||||
if (model)
|
if (model != NULL)
|
||||||
(eachFunction)(pose, model, index, eachParam1);
|
(eachFunction)(pose, model, index, eachParam1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -113,11 +119,12 @@ EachPoseAndModel(PoseList* list,
|
|||||||
for (int32 index = list->CountItems() - 1; index >= 0; index--) {
|
for (int32 index = list->CountItems() - 1; index >= 0; index--) {
|
||||||
BPose* pose = list->ItemAt(index);
|
BPose* pose = list->ItemAt(index);
|
||||||
Model* model = pose->TargetModel();
|
Model* model = pose->TargetModel();
|
||||||
if (model)
|
if (model != NULL)
|
||||||
(eachFunction)(pose, model, eachParam1, eachParam2);
|
(eachFunction)(pose, model, eachParam1, eachParam2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class EachParam1, class EachParam2>
|
template<class EachParam1, class EachParam2>
|
||||||
void
|
void
|
||||||
EachPoseAndModel(PoseList* list,
|
EachPoseAndModel(PoseList* list,
|
||||||
@@ -127,11 +134,12 @@ EachPoseAndModel(PoseList* list,
|
|||||||
for (int32 index = list->CountItems() - 1; index >= 0; index--) {
|
for (int32 index = list->CountItems() - 1; index >= 0; index--) {
|
||||||
BPose* pose = list->ItemAt(index);
|
BPose* pose = list->ItemAt(index);
|
||||||
Model* model = pose->TargetModel();
|
Model* model = pose->TargetModel();
|
||||||
if (model)
|
if (model != NULL)
|
||||||
(eachFunction)(pose, model, index, eachParam1, eachParam2);
|
(eachFunction)(pose, model, index, eachParam1, eachParam2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class EachParam1>
|
template<class EachParam1>
|
||||||
void
|
void
|
||||||
EachPoseAndResolvedModel(PoseList* list,
|
EachPoseAndResolvedModel(PoseList* list,
|
||||||
@@ -140,11 +148,12 @@ EachPoseAndResolvedModel(PoseList* list,
|
|||||||
for (int32 index = list->CountItems() - 1; index >= 0; index--) {
|
for (int32 index = list->CountItems() - 1; index >= 0; index--) {
|
||||||
BPose* pose = list->ItemAt(index);
|
BPose* pose = list->ItemAt(index);
|
||||||
Model* model = pose->TargetModel()->ResolveIfLink();
|
Model* model = pose->TargetModel()->ResolveIfLink();
|
||||||
if (model)
|
if (model != NULL)
|
||||||
(eachFunction)(pose, model, eachParam1);
|
(eachFunction)(pose, model, eachParam1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class EachParam1>
|
template<class EachParam1>
|
||||||
void
|
void
|
||||||
EachPoseAndResolvedModel(PoseList* list,
|
EachPoseAndResolvedModel(PoseList* list,
|
||||||
@@ -154,11 +163,12 @@ EachPoseAndResolvedModel(PoseList* list,
|
|||||||
for (int32 index = list->CountItems() - 1; index >= 0; index--) {
|
for (int32 index = list->CountItems() - 1; index >= 0; index--) {
|
||||||
BPose* pose = list->ItemAt(index);
|
BPose* pose = list->ItemAt(index);
|
||||||
Model* model = pose->TargetModel()->ResolveIfLink();
|
Model* model = pose->TargetModel()->ResolveIfLink();
|
||||||
if (model)
|
if (model != NULL)
|
||||||
(eachFunction)(pose, model, index, eachParam1);
|
(eachFunction)(pose, model, index, eachParam1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class EachParam1, class EachParam2>
|
template<class EachParam1, class EachParam2>
|
||||||
void
|
void
|
||||||
EachPoseAndResolvedModel(PoseList* list,
|
EachPoseAndResolvedModel(PoseList* list,
|
||||||
@@ -168,11 +178,12 @@ EachPoseAndResolvedModel(PoseList* list,
|
|||||||
for (int32 index = list->CountItems() - 1; index >= 0; index--) {
|
for (int32 index = list->CountItems() - 1; index >= 0; index--) {
|
||||||
BPose* pose = list->ItemAt(index);
|
BPose* pose = list->ItemAt(index);
|
||||||
Model* model = pose->TargetModel()->ResolveIfLink();
|
Model* model = pose->TargetModel()->ResolveIfLink();
|
||||||
if (model)
|
if (model != NULL)
|
||||||
(eachFunction)(pose, model, eachParam1, eachParam2);
|
(eachFunction)(pose, model, eachParam1, eachParam2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class EachParam1, class EachParam2>
|
template<class EachParam1, class EachParam2>
|
||||||
void
|
void
|
||||||
EachPoseAndResolvedModel(PoseList* list,
|
EachPoseAndResolvedModel(PoseList* list,
|
||||||
@@ -182,7 +193,7 @@ EachPoseAndResolvedModel(PoseList* list,
|
|||||||
for (int32 index = list->CountItems() - 1; index >= 0; index--) {
|
for (int32 index = list->CountItems() - 1; index >= 0; index--) {
|
||||||
BPose* pose = list->ItemAt(index);
|
BPose* pose = list->ItemAt(index);
|
||||||
Model* model = pose->TargetModel()->ResolveIfLink();
|
Model* model = pose->TargetModel()->ResolveIfLink();
|
||||||
if (model)
|
if (model != NULL)
|
||||||
(eachFunction)(pose, model, index, eachParam1, eachParam2);
|
(eachFunction)(pose, model, index, eachParam1, eachParam2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -191,4 +202,5 @@ EachPoseAndResolvedModel(PoseList* list,
|
|||||||
|
|
||||||
using namespace BPrivate;
|
using namespace BPrivate;
|
||||||
|
|
||||||
|
|
||||||
#endif // _POSE_LIST_H
|
#endif // _POSE_LIST_H
|
||||||
|
|||||||
Reference in New Issue
Block a user