00001 //**************************************************************************/ 00002 // Copyright (c) 1998-2006 Autodesk, Inc. 00003 // All rights reserved. 00004 // 00005 // These coded instructions, statements, and computer programs contain 00006 // unpublished proprietary information written by Autodesk, Inc., and are 00007 // protected by Federal copyright law. They may not be disclosed to third 00008 // parties or copied or duplicated in any form, in whole or in part, without 00009 // the prior written consent of Autodesk, Inc. 00010 //**************************************************************************/ 00011 #pragma once 00012 00013 #include <WTypes.h> 00014 #include "maxheap.h" 00015 #include "Animatable.h" 00016 00017 // Callback for EnumAnimTree: 00018 // 00019 // Scope values: 00020 00021 #define SCOPE_DOCLOSED 1 //!< Enumerate "closed" animatables. 00022 #define SCOPE_SUBANIM 2 //!< Enumerate sub-anims 00023 #define SCOPE_CHILDREN 4 //!< Enumerate node children 00024 #define SCOPE_OPEN (SCOPE_SUBANIM|SCOPE_CHILDREN) //!< Enumerate all open animatables 00025 #define SCOPE_ALL (SCOPE_OPEN|SCOPE_DOCLOSED) //!< do all animatables 00026 00027 // Return values for AnimEnum procs 00028 #define ANIM_ENUM_PROCEED 1 00029 #define ANIM_ENUM_STOP 2 00030 #define ANIM_ENUM_ABORT 3 00031 00032 // R5 and later only 00033 #define ANIM_ENUM_SKIP 4 //!< Do not include this anim in the hierarchy. 00034 #define ANIM_ENUM_SKIP_NODE 5 //!< Do not include this node and its subAnims, but include its children. 00035 00040 class AnimEnum: public MaxHeapOperators { 00041 protected: 00042 int depth; 00043 int scope; 00044 DWORD tv; 00045 public: 00048 AnimEnum(int s = SCOPE_OPEN, int deep = 0, DWORD tv=0xffffffff) 00049 {scope = s; depth = deep; this->tv = tv;} 00051 virtual ~AnimEnum() {;} 00055 void SetScope(int s) { scope = s; } 00071 int Scope() { return scope; } 00074 void IncDepth() { depth++; } 00077 void DecDepth() { depth--; } 00080 int Depth() { return depth; } 00081 DWORD TVBits() {return tv;} 00095 virtual int proc(Animatable *anim, Animatable *client, int subNum)=0; 00096 }; 00097 00099 class ClearAnimFlagEnumProc : public AnimEnum 00100 { 00101 DWORD flag; 00102 public: 00104 ClearAnimFlagEnumProc(DWORD f) 00105 : flag(f) 00106 { 00107 // empty 00108 } 00109 int proc(Animatable* anim, Animatable* client, int subNum) 00110 { 00111 UNUSED_PARAM(client); 00112 UNUSED_PARAM(subNum); 00113 anim->ClearAFlag(flag); 00114 return ANIM_ENUM_PROCEED; 00115 } 00116 };