IPFAction.h

Go to the documentation of this file.
00001 
00005 /**********************************************************************
00006  *<
00007     CREATED BY: Oleg Bayborodin
00008 
00009     HISTORY: created 10-12-01
00010 
00011  *> Copyright (c) 2001, All Rights Reserved.
00012  **********************************************************************/
00013 
00014 #pragma once
00015 
00016 #include "PFExport.h"
00017 #include "ParticleChannelMask.h"
00018 #include "..\ifnpub.h"
00019 #include "..\object.h"
00020 // forward declarations
00021 class IParamBlock2;
00022 
00023 PFExport Object* GetPFObject(Object* obj);
00024 // interface ID
00025 #define PFACTION_INTERFACE Interface_ID(0x74f93d00, 0x1eb34500) 
00026 #define GetPFActionInterface(obj) ((IPFAction*)((GetPFObject(obj))->GetInterface(PFACTION_INTERFACE))) 
00027 
00028 // The propID is used by a particle group to define "final update time"
00029 // in particle actions; particle group sets object property with this id
00030 // to define the time value; later a particle action (operator or test)
00031 // can find out what is the final time of a particle system evaluation
00032 // and skip some steps in order to improve performance
00033 #define PROPID_FINALUPDATETIME  0x00635690
00034 
00035 class IPFAction : public FPMixinInterface
00036 {
00037 public:
00038 
00039     // function IDs
00040     enum {  kInit, 
00041             kRelease,
00042             kChannelsUsed, // reserved for future use
00043             kActivityInterval,
00044             kIsFertile,
00045             kIsNonExecutable,
00046             kSupportRand,
00047             kGetRand,
00048             kSetRand,
00049             kNewRand,
00050             kIsMaterialHolder,
00051             kGetMaterial,
00052             kSetMaterial,
00053             kSupportScriptWiring,
00054             kGetUseScriptWiring,
00055             kSetUseScriptWiring
00056     }; 
00057 
00058     // Function Map for Function Publish System 
00059     //***********************************
00060     #pragma warning(push)
00061     #pragma warning(disable:4239 4238)
00062     BEGIN_FUNCTION_MAP
00063 
00064         FN_5(kInit, TYPE_bool, Init, TYPE_IOBJECT, TYPE_OBJECT, TYPE_INODE, TYPE_OBJECT_TAB_BR, TYPE_INODE_TAB_BR);
00065         FN_1(kRelease, TYPE_bool, Release, TYPE_IOBJECT);
00066         VFN_2(kChannelsUsed, ChannelsUsed, TYPE_INTERVAL_BR, TYPE_FPVALUE); // reserved for future use
00067         FN_0(kActivityInterval, TYPE_INTERVAL_BV, ActivityInterval);
00068         FN_0(kIsFertile, TYPE_bool, IsFertile);
00069         FN_0(kIsNonExecutable, TYPE_bool, IsNonExecutable);
00070         FN_0(kSupportRand, TYPE_bool, SupportRand);
00071         FN_0(kGetRand, TYPE_INT, GetRand);
00072         VFN_1(kSetRand, SetRand, TYPE_INT);
00073         FN_0(kNewRand, TYPE_INT, NewRand);
00074         FN_0(kIsMaterialHolder, TYPE_bool, IsMaterialHolder);
00075         FN_0(kGetMaterial, TYPE_MTL, GetMaterial);
00076         FN_1(kSetMaterial, TYPE_bool, SetMaterial, TYPE_MTL);
00077         FN_0(kSupportScriptWiring, TYPE_bool, SupportScriptWiring);
00078         FN_0(kGetUseScriptWiring, TYPE_bool, GetUseScriptWiring);
00079         VFN_1(kSetUseScriptWiring, SetUseScriptWiring, TYPE_bool);
00080 
00081     END_FUNCTION_MAP
00082     #pragma warning(pop)
00083 
00104     virtual bool    Init(IObject* pCont, Object* pSystem, INode* node, Tab<Object*>& actions, Tab<INode*>& actionNodes) = 0;
00105 
00109     virtual bool    Release(IObject* pCont) = 0;
00110 
00114     virtual const ParticleChannelMask& ChannelsUsed(const Interval& time) const = 0;
00115 
00119     PFExport void   ChannelsUsed(const Interval& time, FPValue* channels) const;
00120 
00127     virtual const Interval ActivityInterval() const = 0;
00128 
00135     virtual bool IsFertile() const { return false; }
00136 
00141     virtual bool IsNonExecutable() const { return false; }
00142 
00147     virtual bool Has3dIcon() const { return false; }
00148 
00156     virtual int IsColorCoordinated() const { return -1; }
00157 
00162     virtual bool    SupportRand() const = 0;
00163 
00167     virtual int     GetRand() = 0;
00168 
00172     virtual void    SetRand(int seed) = 0;
00173 
00177     PFExport int    NewRand(); 
00178 
00182     PFExport static int NewRand(IParamBlock2* pblock, ParamID randomSeedParamID);
00183 
00187     virtual bool    IsMaterialHolder() const    { return false; }
00188 
00192     virtual Mtl*    GetMaterial()               { return NULL; }
00193 #pragma warning(push)
00194 #pragma warning(disable:4100)
00195 
00198     virtual bool    SetMaterial(Mtl* mtl)       { return false; }
00199 
00207     virtual bool SupportScriptWiring() const { return false; }
00208 
00212     virtual bool GetUseScriptWiring() const { return false; }
00213 
00217     virtual void SetUseScriptWiring(bool useScriptWiring) { ; }
00218 
00227     virtual bool IsEmitterTMDependent() const { return false; }
00228 
00232     virtual bool IsEmitterPropDependent() const { return false; }
00233 
00239     virtual IObject* GetCurrentState(IObject* pContainer) { return NULL; }
00240 
00244     virtual void SetCurrentState(IObject* actionState, IObject* pContainer) { ; }
00245 #pragma warning(pop)
00246 
00249     FPInterfaceDesc* GetDesc() { return GetDescByID(PFACTION_INTERFACE); }
00250 
00251 };
00252 
00253 // Codes for ClassDesc::Execute(...) method
00254 // The Execute method is used to extract action description from the ClassDesc
00255 enum {  kPF_GetActionDescription = 781,
00256 // defines an action name to be shown in the action depot area in PView
00257 // if the method is not supported then the class name of the action is used
00258         kPF_GetActionName,
00259 // defines if the action is shown in ParticleView Action Depot window
00260 // if the execute is not implemented then it is assumed that the action is
00261 // public
00262         kPF_PViewPublic,
00263 // defines a category for the action to be placed in the Action Depot
00264 // the call is reserved for future use. If the execute is not implemented
00265 // then the category is assigned according to the action type (operator or test)
00266         kPF_PViewCategory,
00267 // defines if the action is "fertile". It means it is able to generate particles
00268 // from nothing. If the execute is not implemented then it is assumed
00269 // that the action is not "fertile".
00270         kPF_IsFertile,
00271 // defines if the action is "non-executable". Non-executable action doesn't
00272 // affect particle behavior. The action is present in the action schematics
00273 // but its presence doesn't change how the particles are shown or rendered.
00274 // If the execute is not implemented then it is assumed that the action is
00275 // executable.
00276         kPF_IsNonExecutable,
00277 // returns bitmap with icon for the depot window of ParticleView
00278 // if the execute is not implemented then a default icon is used
00279         kPF_PViewDepotIcon 
00280     };
00281 
00285 inline IPFAction* PFActionInterface(Object* obj) {
00286     return ((obj == NULL) ? NULL : GetPFActionInterface(obj));
00287 };
00288 
00292 inline IPFAction* PFActionInterface(INode* node) {
00293     return ((node == NULL) ? NULL : PFActionInterface(node->GetObjectRef()));
00294 };
00295 
00302 PFExport int IsPFActionActive(INode* actionNode);
00303