00001 /* 00002 * Copyright (c) 2012 00003 * Side Effects Software Inc. All rights reserved. 00004 * 00005 * Redistribution and use of Houdini Development Kit samples in source and 00006 * binary forms, with or without modification, are permitted provided that the 00007 * following conditions are met: 00008 * 1. Redistributions of source code must retain the above copyright notice, 00009 * this list of conditions and the following disclaimer. 00010 * 2. The name of Side Effects Software may not be used to endorse or 00011 * promote products derived from this software without specific prior 00012 * written permission. 00013 * 00014 * THIS SOFTWARE IS PROVIDED BY SIDE EFFECTS SOFTWARE `AS IS' AND ANY EXPRESS 00015 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00016 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN 00017 * NO EVENT SHALL SIDE EFFECTS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, 00018 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00019 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 00020 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00021 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00022 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 00023 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00024 */ 00025 00026 #ifndef __ROP_Dumper_h__ 00027 #define __ROP_Dumper_h__ 00028 00029 #include <ROP/ROP_Node.h> 00030 00031 #define STR_PARM(name, idx, vi, t) \ 00032 { evalString(str, name, &ifdIndirect[idx], vi, (float)t); } 00033 #define INT_PARM(name, idx, vi, t) \ 00034 { return evalInt(name, &ifdIndirect[idx], vi, t); } 00035 00036 #define STR_SET(name, idx, vi, t) \ 00037 { setString(str, name, ifdIndirect[idx], vi, (float)t); } 00038 #define STR_GET(name, idx, vi, t) \ 00039 { evalStringRaw(str, name, &ifdIndirect[idx], vi, (float)t); } 00040 00041 class OP_TemplatePair; 00042 class OP_VariablePair; 00043 00044 namespace HDK_Sample { 00045 00046 class ROP_Dumper : public ROP_Node { 00047 public: 00048 00049 /// Provides access to our parm templates. 00050 static OP_TemplatePair *getTemplatePair(); 00051 /// Provides access to our variables. 00052 static OP_VariablePair *getVariablePair(); 00053 /// Creates an instance of this node. 00054 static OP_Node *myConstructor(OP_Network *net, const char*name, 00055 OP_Operator *op); 00056 00057 protected: 00058 ROP_Dumper(OP_Network *net, const char *name, OP_Operator *entry); 00059 virtual ~ROP_Dumper(); 00060 00061 /// Called at the beginning of rendering to perform any intialization 00062 /// necessary. 00063 /// @param nframes Number of frames being rendered. 00064 /// @param s Start time, in seconds. 00065 /// @param e End time, in seconds. 00066 /// @return True of success, false on failure (aborts the render). 00067 virtual int startRender(int nframes, float s, float e); 00068 00069 /// Called once for every frame that is rendered. 00070 /// @param time The time to render at. 00071 /// @param boss Interrupt handler. 00072 /// @return Return a status code indicating whether to abort the 00073 /// render, continue, or retry the current frame. 00074 virtual ROP_RENDER_CODE renderFrame(float time, UT_Interrupt *boss); 00075 00076 /// Called after the rendering is done to perform any post-rendering steps 00077 /// required. 00078 /// @return Return a status code indicating whether to abort the 00079 /// render, continue, or retry. 00080 virtual ROP_RENDER_CODE endRender(); 00081 00082 public: 00083 00084 /// A convenience method to evaluate our custom file parameter. 00085 void OUTPUT(UT_String &str, float t) 00086 { STR_PARM("file", 0, 0, t) } 00087 00088 private: 00089 static int *ifdIndirect; 00090 float myEndTime; 00091 }; 00092 00093 } // End HDK_Sample namespace 00094 00095 00096 #undef STR_PARM 00097 #undef STR_SET 00098 #undef STR_GET 00099 00100 #endif
1.5.9