guiParticleGraphCtrl.cpp
Engine/source/gui/editor/guiParticleGraphCtrl.cpp
Public Variables
Public Functions
ConsoleDocClass(GuiParticleGraphCtrl , "@brief Legacy remnant from old Torque particle <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">editor\n\n</a>" "Editor use <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">only.\n\n</a>" "@internal" )
DefineEngineMethod(GuiParticleGraphCtrl , addPlotPoint , S32 , (S32 plotID, F32 x, F32 y, bool setAdded) , (true) , "(int plotID, float x, float y, bool setAdded = true;)" "Add <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> data point <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the given plot." "@return" )
DefineEngineMethod(GuiParticleGraphCtrl , changePlotPoint , S32 , (S32 plotID, S32 i, F32 x, F32 y) , "(int plotID, int <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1acb559820d9ca11295b4500f179ef6392">i</a>, float x, float y)" "Change <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> data point <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the given plot and plot <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">position.\n</a>" "@param plotID The plot you want <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">access\n</a>" "@param <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1acb559820d9ca11295b4500f179ef6392">i</a> The data <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">point.\n</a>" "@param x, y The plot <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">position.\n</a>" " @return No return value." )
DefineEngineMethod(GuiParticleGraphCtrl , clearAllGraphs , void , () , "()" "Clear all of the graphs." "@return No return <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a>" )
DefineEngineMethod(GuiParticleGraphCtrl , clearGraph , void , (S32 plotID) , "(int plotID)" "Clear the graph of the given plot." "@return No return <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a>" )
DefineEngineMethod(GuiParticleGraphCtrl , getGraphColor , LinearColorF , (S32 plotID) , "(int plotID)" "Get the color of the graph passed." "@return Returns the color of the graph as <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> string of RGB values formatted as \"R G B\"" )
DefineEngineMethod(GuiParticleGraphCtrl , getGraphMax , Point2F , (S32 plotID) , "(int plotID) " "Get the maximum values of the graph <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">ranges.\n</a>" "@return Returns the maximum of the range formatted as \"x-max y-max\"" )
DefineEngineMethod(GuiParticleGraphCtrl , getGraphMin , Point2F , (S32 plotID) , "(int plotID) " "Get the minimum values of the graph <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">ranges.\n</a>" "@return Returns the minimum of the range formatted as \"x-min y-min\"" )
DefineEngineMethod(GuiParticleGraphCtrl , getGraphName , const char * , (S32 plotID) , "(int plotID) " "Get the name of the graph <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">passed.\n</a>" "@return Returns the name of the plot" )
DefineEngineMethod(GuiParticleGraphCtrl , getPlotIndex , S32 , (S32 plotID, F32 x, F32 y) , "(int plotID, float x, float y)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "Gets the index of the point passed on the plotID passed (graph ID).\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@param plotID The plot you wish <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">check.\n</a>" "@param x, y The coordinates of the point <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">get.\n</a>" " @return Returns the index of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">point.\n</a>" )
DefineEngineMethod(GuiParticleGraphCtrl , getPlotPoint , Point2F , (S32 plotID, S32 samples) , "(int plotID, int samples)" "Get <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> data point from the plot specified, samples from the start of the graph." " @return The data point ID" )
DefineEngineMethod(GuiParticleGraphCtrl , getSelectedPlot , S32 , () , "() " "Gets the selected Plot (a.k.a. graph).\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@return The plot's ID." )
DefineEngineMethod(GuiParticleGraphCtrl , getSelectedPoint , S32 , () , "()" "Gets the selected Point on the Plot (a.k.a. graph)." "@return The last selected point ID" )
DefineEngineMethod(GuiParticleGraphCtrl , insertPlotPoint , void , (S32 plotID, S32 i, F32 x, F32 y) , "(int plotID, int <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1acb559820d9ca11295b4500f179ef6392">i</a>, float x, float y)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "Insert <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> data point <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the given plot and plot <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">position.\n</a>" "@param plotID The plot you want <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">access\n</a>" "@param <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1acb559820d9ca11295b4500f179ef6392">i</a> The data <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">point.\n</a>" "@param x, y The plot <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">position.\n</a>" " @return No return value." )
DefineEngineMethod(GuiParticleGraphCtrl , isExistingPoint , bool , (S32 plotID, S32 samples) , "(int plotID, int samples)" "@return Returns true or false whether or not the point in the plot passed is an existing point." )
DefineEngineMethod(GuiParticleGraphCtrl , resetSelectedPoint , void , () , "()" "This will reset the currently selected point <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> nothing." "@return No return value." )
DefineEngineMethod(GuiParticleGraphCtrl , setAutoGraphMax , void , (bool autoMax) , "(bool autoMax) " "Set whether the max will automatically be set when adding points " "(ie <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> you add <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> over the current max, the max is increased <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> that <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a>).\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@return No return value." )
DefineEngineMethod(GuiParticleGraphCtrl , setAutoRemove , void , (bool autoRemove) , "(bool autoRemove) " "Set whether or not <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> point should be deleted when you drag another one over it." "@return No return value." )
DefineEngineMethod(GuiParticleGraphCtrl , setGraphHidden , void , (S32 plotID, bool isHidden) , "(int plotID, bool isHidden)" "Set whether the graph number passed is hidden or not." "@return No return value." )
DefineEngineMethod(GuiParticleGraphCtrl , setGraphMax , void , (S32 plotID, F32 maxX, F32 maxY) , "(int plotID, float maxX, float maxY) " "Set the max values of the graph of plotID." "@param plotID The plot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify\n</a>" "@param maxX, maxY The maximum bound of the <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">range.\n</a>" " @return No return value." )
DefineEngineMethod(GuiParticleGraphCtrl , setGraphMaxX , void , (S32 plotID, F32 maxX) , "(int plotID, float maxX)" "Set the max X <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> of the graph of plotID." "@param plotID The plot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify.\n</a>" "@param maxX The maximum x <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">value.\n</a>" "@return No return Value." )
DefineEngineMethod(GuiParticleGraphCtrl , setGraphMaxY , void , (S32 plotID, F32 maxX) , "(int plotID, float maxY)" "Set the max Y <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> of the graph of plotID." "@param plotID The plot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify.\n</a>" "@param maxY The maximum y <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">value.\n</a>" "@return No return Value." )
DefineEngineMethod(GuiParticleGraphCtrl , setGraphMin , void , (S32 plotID, F32 minX, F32 minY) , "(int plotID, float minX, float minY) " "Set the min values of the graph of <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">plotID.\n</a>" "@param plotID The plot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify\n</a>" "@param minX, minY The minimum bound of the <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">range.\n</a>" " @return No return value." )
DefineEngineMethod(GuiParticleGraphCtrl , setGraphMinX , void , (S32 plotID, F32 minX) , "(int plotID, float minX) " "Set the min X <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> of the graph of <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">plotID.\n</a>" "@param plotID The plot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify.\n</a>" "@param minX The minimum x <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">value.\n</a>" "@return No return Value." )
DefineEngineMethod(GuiParticleGraphCtrl , setGraphMinY , void , (S32 plotID, F32 minX) , "(int plotID, float minY) " "Set the min Y <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> of the graph of plotID." "@param plotID The plot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify.\n</a>" "@param minY The minimum y <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">value.\n</a>" "@return No return Value." )
DefineEngineMethod(GuiParticleGraphCtrl , setGraphName , void , (S32 plotID, const char *graphName) , "(int plotID, string graphName) " "Set the name of the given <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">plot.\n</a>" "@param plotID The plot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify.\n</a>" "@param graphName The name <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> set on the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">plot.\n</a>" "@return No return value." )
DefineEngineMethod(GuiParticleGraphCtrl , setPointXMovementClamped , void , (bool autoRemove) , "(bool clamped)" "Set whether the x position of the selected graph point should be clamped" "@return No return value." )
DefineEngineMethod(GuiParticleGraphCtrl , setRenderAll , void , (bool autoRemove) , "(bool renderAll)" "Set whether or not <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> position should be rendered on every point or just the last selected." "@return No return value." )
DefineEngineMethod(GuiParticleGraphCtrl , setRenderGraphTooltip , void , (bool autoRemove) , "(bool renderGraphTooltip)" "Set whether or not <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/editortool_8cpp/#editortool_8cpp_1a4cb041169a32ea3d4cacadbb955e06b4">render</a> the graph tooltip." "@return No return value." )
DefineEngineMethod(GuiParticleGraphCtrl , setSelectedPlot , void , (S32 plotID) , "(int plotID)" "Set the selected plot (a.k.a. graph)." "@return No return <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a>" )
DefineEngineMethod(GuiParticleGraphCtrl , setSelectedPoint , void , (S32 point) , "(int point)" "Set the selected point on the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">graph.\n</a>" "@return No return <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a>" )
ImplementEnumType(GuiParticleGraphType , "\n\n" "@ingroup GuiCore" "@internal" )
Detailed Description
Public Variables
EndImplementEnumType
Public Functions
ConsoleDocClass(GuiParticleGraphCtrl , "@brief Legacy remnant from old Torque particle <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">editor\n\n</a>" "Editor use <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">only.\n\n</a>" "@internal" )
DefineEngineMethod(GuiParticleGraphCtrl , addPlotPoint , S32 , (S32 plotID, F32 x, F32 y, bool setAdded) , (true) , "(int plotID, float x, float y, bool setAdded = true;)" "Add <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> data point <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the given plot." "@return" )
DefineEngineMethod(GuiParticleGraphCtrl , changePlotPoint , S32 , (S32 plotID, S32 i, F32 x, F32 y) , "(int plotID, int <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1acb559820d9ca11295b4500f179ef6392">i</a>, float x, float y)" "Change <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> data point <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the given plot and plot <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">position.\n</a>" "@param plotID The plot you want <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">access\n</a>" "@param <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1acb559820d9ca11295b4500f179ef6392">i</a> The data <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">point.\n</a>" "@param x, y The plot <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">position.\n</a>" " @return No return value." )
DefineEngineMethod(GuiParticleGraphCtrl , clearAllGraphs , void , () , "()" "Clear all of the graphs." "@return No return <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a>" )
DefineEngineMethod(GuiParticleGraphCtrl , clearGraph , void , (S32 plotID) , "(int plotID)" "Clear the graph of the given plot." "@return No return <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a>" )
DefineEngineMethod(GuiParticleGraphCtrl , getGraphColor , LinearColorF , (S32 plotID) , "(int plotID)" "Get the color of the graph passed." "@return Returns the color of the graph as <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> string of RGB values formatted as \"R G B\"" )
DefineEngineMethod(GuiParticleGraphCtrl , getGraphMax , Point2F , (S32 plotID) , "(int plotID) " "Get the maximum values of the graph <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">ranges.\n</a>" "@return Returns the maximum of the range formatted as \"x-max y-max\"" )
DefineEngineMethod(GuiParticleGraphCtrl , getGraphMin , Point2F , (S32 plotID) , "(int plotID) " "Get the minimum values of the graph <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">ranges.\n</a>" "@return Returns the minimum of the range formatted as \"x-min y-min\"" )
DefineEngineMethod(GuiParticleGraphCtrl , getGraphName , const char * , (S32 plotID) , "(int plotID) " "Get the name of the graph <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">passed.\n</a>" "@return Returns the name of the plot" )
DefineEngineMethod(GuiParticleGraphCtrl , getPlotIndex , S32 , (S32 plotID, F32 x, F32 y) , "(int plotID, float x, float y)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "Gets the index of the point passed on the plotID passed (graph ID).\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@param plotID The plot you wish <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">check.\n</a>" "@param x, y The coordinates of the point <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">get.\n</a>" " @return Returns the index of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">point.\n</a>" )
DefineEngineMethod(GuiParticleGraphCtrl , getPlotPoint , Point2F , (S32 plotID, S32 samples) , "(int plotID, int samples)" "Get <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> data point from the plot specified, samples from the start of the graph." " @return The data point ID" )
DefineEngineMethod(GuiParticleGraphCtrl , getSelectedPlot , S32 , () , "() " "Gets the selected Plot (a.k.a. graph).\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@return The plot's ID." )
DefineEngineMethod(GuiParticleGraphCtrl , getSelectedPoint , S32 , () , "()" "Gets the selected Point on the Plot (a.k.a. graph)." "@return The last selected point ID" )
DefineEngineMethod(GuiParticleGraphCtrl , insertPlotPoint , void , (S32 plotID, S32 i, F32 x, F32 y) , "(int plotID, int <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1acb559820d9ca11295b4500f179ef6392">i</a>, float x, float y)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "Insert <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> data point <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the given plot and plot <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">position.\n</a>" "@param plotID The plot you want <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">access\n</a>" "@param <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1acb559820d9ca11295b4500f179ef6392">i</a> The data <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">point.\n</a>" "@param x, y The plot <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">position.\n</a>" " @return No return value." )
DefineEngineMethod(GuiParticleGraphCtrl , isExistingPoint , bool , (S32 plotID, S32 samples) , "(int plotID, int samples)" "@return Returns true or false whether or not the point in the plot passed is an existing point." )
DefineEngineMethod(GuiParticleGraphCtrl , resetSelectedPoint , void , () , "()" "This will reset the currently selected point <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> nothing." "@return No return value." )
DefineEngineMethod(GuiParticleGraphCtrl , setAutoGraphMax , void , (bool autoMax) , "(bool autoMax) " "Set whether the max will automatically be set when adding points " "(ie <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> you add <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> over the current max, the max is increased <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> that <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a>).\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@return No return value." )
DefineEngineMethod(GuiParticleGraphCtrl , setAutoRemove , void , (bool autoRemove) , "(bool autoRemove) " "Set whether or not <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> point should be deleted when you drag another one over it." "@return No return value." )
DefineEngineMethod(GuiParticleGraphCtrl , setGraphHidden , void , (S32 plotID, bool isHidden) , "(int plotID, bool isHidden)" "Set whether the graph number passed is hidden or not." "@return No return value." )
DefineEngineMethod(GuiParticleGraphCtrl , setGraphMax , void , (S32 plotID, F32 maxX, F32 maxY) , "(int plotID, float maxX, float maxY) " "Set the max values of the graph of plotID." "@param plotID The plot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify\n</a>" "@param maxX, maxY The maximum bound of the <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">range.\n</a>" " @return No return value." )
DefineEngineMethod(GuiParticleGraphCtrl , setGraphMaxX , void , (S32 plotID, F32 maxX) , "(int plotID, float maxX)" "Set the max X <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> of the graph of plotID." "@param plotID The plot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify.\n</a>" "@param maxX The maximum x <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">value.\n</a>" "@return No return Value." )
DefineEngineMethod(GuiParticleGraphCtrl , setGraphMaxY , void , (S32 plotID, F32 maxX) , "(int plotID, float maxY)" "Set the max Y <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> of the graph of plotID." "@param plotID The plot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify.\n</a>" "@param maxY The maximum y <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">value.\n</a>" "@return No return Value." )
DefineEngineMethod(GuiParticleGraphCtrl , setGraphMin , void , (S32 plotID, F32 minX, F32 minY) , "(int plotID, float minX, float minY) " "Set the min values of the graph of <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">plotID.\n</a>" "@param plotID The plot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify\n</a>" "@param minX, minY The minimum bound of the <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">range.\n</a>" " @return No return value." )
DefineEngineMethod(GuiParticleGraphCtrl , setGraphMinX , void , (S32 plotID, F32 minX) , "(int plotID, float minX) " "Set the min X <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> of the graph of <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">plotID.\n</a>" "@param plotID The plot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify.\n</a>" "@param minX The minimum x <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">value.\n</a>" "@return No return Value." )
DefineEngineMethod(GuiParticleGraphCtrl , setGraphMinY , void , (S32 plotID, F32 minX) , "(int plotID, float minY) " "Set the min Y <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> of the graph of plotID." "@param plotID The plot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify.\n</a>" "@param minY The minimum y <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">value.\n</a>" "@return No return Value." )
DefineEngineMethod(GuiParticleGraphCtrl , setGraphName , void , (S32 plotID, const char *graphName) , "(int plotID, string graphName) " "Set the name of the given <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">plot.\n</a>" "@param plotID The plot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify.\n</a>" "@param graphName The name <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> set on the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">plot.\n</a>" "@return No return value." )
DefineEngineMethod(GuiParticleGraphCtrl , setPointXMovementClamped , void , (bool autoRemove) , "(bool clamped)" "Set whether the x position of the selected graph point should be clamped" "@return No return value." )
DefineEngineMethod(GuiParticleGraphCtrl , setRenderAll , void , (bool autoRemove) , "(bool renderAll)" "Set whether or not <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> position should be rendered on every point or just the last selected." "@return No return value." )
DefineEngineMethod(GuiParticleGraphCtrl , setRenderGraphTooltip , void , (bool autoRemove) , "(bool renderGraphTooltip)" "Set whether or not <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/editortool_8cpp/#editortool_8cpp_1a4cb041169a32ea3d4cacadbb955e06b4">render</a> the graph tooltip." "@return No return value." )
DefineEngineMethod(GuiParticleGraphCtrl , setSelectedPlot , void , (S32 plotID) , "(int plotID)" "Set the selected plot (a.k.a. graph)." "@return No return <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a>" )
DefineEngineMethod(GuiParticleGraphCtrl , setSelectedPoint , void , (S32 point) , "(int point)" "Set the selected point on the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">graph.\n</a>" "@return No return <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a>" )
IMPLEMENT_CONOBJECT(GuiParticleGraphCtrl )
ImplementEnumType(GuiParticleGraphType , "\n\n" "@ingroup GuiCore" "@internal" )
1 2//----------------------------------------------------------------------------- 3// Copyright (c) 2012 GarageGames, LLC 4// 5// Permission is hereby granted, free of charge, to any person obtaining a copy 6// of this software and associated documentation files (the "Software"), to 7// deal in the Software without restriction, including without limitation the 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 9// sell copies of the Software, and to permit persons to whom the Software is 10// furnished to do so, subject to the following conditions: 11// 12// The above copyright notice and this permission notice shall be included in 13// all copies or substantial portions of the Software. 14// 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21// IN THE SOFTWARE. 22//----------------------------------------------------------------------------- 23 24#include "gfx/gfxInit.h" 25#include "gfx/primBuilder.h" 26#include "gfx/gfxDrawUtil.h" 27#include "console/console.h" 28#include "console/consoleTypes.h" 29#include "console/engineAPI.h" 30#include "gui/core/guiCanvas.h" 31 32#include "gui/editor/guiParticleGraphCtrl.h" 33 34IMPLEMENT_CONOBJECT(GuiParticleGraphCtrl); 35 36ConsoleDocClass( GuiParticleGraphCtrl, 37 "@brief Legacy remnant from old Torque particle editor\n\n" 38 "Editor use only.\n\n" 39 "@internal" 40); 41 42GuiParticleGraphCtrl::GuiParticleGraphCtrl() 43{ 44 45 for(S32 i = 0; i < MaxPlots; i++) 46 { 47 mPlots[i].mGraphColor = LinearColorF(1.0, 1.0, 1.0); 48 VECTOR_SET_ASSOCIATION(mPlots[i].mGraphData); 49 mPlots[i].mGraphMax.x = 1; 50 mPlots[i].mGraphMax.y = 50; 51 mPlots[i].mGraphMin.x = 0; 52 mPlots[i].mGraphMin.y = 0; 53 mPlots[i].mGraphType = Polyline; 54 mPlots[i].mGraphName = StringTable->EmptyString(); 55 mPlots[i].mHidden = false; 56 mPlots[i].mGraphScale = 0.05f; 57 } 58 59 mPlots[0].mGraphColor = LinearColorF(1.0f, 0.2f, 0.2f); 60 mPlots[1].mGraphColor = LinearColorF(1.0f, 0.5f, 0.5f); 61 mPlots[2].mGraphColor = LinearColorF(0.0f, 1.0f, 0.0f); 62 mPlots[3].mGraphColor = LinearColorF(0.0f, 0.0f, 1.0f); 63 mPlots[4].mGraphColor = LinearColorF(0.0f, 1.0f, 1.0f); 64 mPlots[5].mGraphColor = LinearColorF(0.0f, 0.0f, 0.0f); 65 mPlots[6].mGraphColor = LinearColorF(0.5f, 0.5f, 0.5f); 66 mPlots[7].mGraphColor = LinearColorF(0.5f, 0.0f, 0.0f); 67 mPlots[8].mGraphColor = LinearColorF(0.0f, 0.5f, 0.0f); 68 mPlots[9].mGraphColor = LinearColorF(0.0f, 0.0f, 0.5f); 69 mPlots[10].mGraphColor = LinearColorF(0.0f, 0.5f, 0.5f); 70 mPlots[11].mGraphColor = LinearColorF(0.25f, 0.25f, 0.25f); 71 mPlots[12].mGraphColor = LinearColorF(0.5f, 0.5f, 0.5f); 72 mPlots[13].mGraphColor = LinearColorF(0.5f, 0.0f, 0.0f); 73 mPlots[14].mGraphColor = LinearColorF(0.0f, 0.5f, 0.0f); 74 mPlots[15].mGraphColor = LinearColorF(0.0f, 0.0f, 0.5f); 75 mPlots[16].mGraphColor = LinearColorF(0.0f, 0.5f, 0.5f); 76 mPlots[17].mGraphColor = LinearColorF(0.25f, 0.25f, 0.25f); 77 mPlots[18].mGraphColor = LinearColorF(1.0f, 0.2f, 0.2f); 78 mPlots[19].mGraphColor = LinearColorF(1.0f, 0.5f, 0.5f); 79 mPlots[20].mGraphColor = LinearColorF(0.0f, 1.0f, 0.0f); 80 mPlots[21].mGraphColor = LinearColorF(0.0f, 0.0f, 1.0f); 81 mPlots[22].mGraphColor = LinearColorF(0.0f, 1.0f, 1.0f); 82 mPlots[23].mGraphColor = LinearColorF(0.0f, 0.0f, 0.0f); 83 mPlots[24].mGraphColor = LinearColorF(0.5f, 0.5f, 0.5f); 84 mPlots[25].mGraphColor = LinearColorF(0.5f, 0.0f, 0.0f); 85 mPlots[26].mGraphColor = LinearColorF(0.0f, 0.5f, 0.0f); 86 mPlots[27].mGraphColor = LinearColorF(0.0f, 0.0f, 0.5f); 87 mPlots[28].mGraphColor = LinearColorF(1.0f, 0.0f, 0.0f); 88 mPlots[29].mGraphColor = LinearColorF(0.0f, 1.0f, 0.0f); 89 mPlots[30].mGraphColor = LinearColorF(0.0f, 0.0f, 1.0f); 90 mPlots[31].mGraphColor = LinearColorF(0.5f, 0.0f, 0.0f); 91 92 mVertexClickSize = 6; 93 mSelectedPlot = 0; 94 mSelectedPoint = -1; 95 mOriginalSelectedPoint = -1; 96 mLastSelectedPoint = -1; 97 mAddedPointIndex = -1; 98 mAutoMax = false; 99 mAutoRemove = false; 100 mRenderAllPoints = false; 101 mRenderGraphTooltip = true; 102 mPointWasAdded = false; 103 mPointXMovementClamped = false; 104 mOutlineColor = ColorI(1, 1, 1); 105 mCursorPos = Point2I(0, 0); 106 mTooltipSelectedPlot = 0; 107 mRenderNextGraphTooltip = false; 108} 109 110ImplementEnumType( GuiParticleGraphType, 111 "\n\n" 112 "@ingroup GuiCore" 113 "@internal") 114 { GuiParticleGraphCtrl::Bar, "bar" }, 115 { GuiParticleGraphCtrl::Filled, "filled" }, 116 { GuiParticleGraphCtrl::Point, "point" }, 117 { GuiParticleGraphCtrl::Polyline , "polyline" }, 118EndImplementEnumType; 119 120bool GuiParticleGraphCtrl::onWake() 121{ 122 if (! Parent::onWake()) 123 return false; 124 setActive(true); 125 return true; 126} 127 128void GuiParticleGraphCtrl::onRender(Point2I offset, const RectI &updateRect) 129{ 130 // Fetch Draw Utility. 131 GFXDrawUtil* pDrawUtil = GFX->getDrawUtil(); 132 133 if (mProfile->mBorder) 134 { 135 const RectI bounds = getBounds(); 136 RectI rect(offset.x, offset.y, bounds.extent.x, bounds.extent.y); 137 pDrawUtil->drawRect(rect, mProfile->mBorderColor); 138 } 139 140 GuiControlProfile* profile = dynamic_cast<GuiControlProfile*>(Sim::findObject("GuiDefaultProfile")); 141 Resource<GFont> font = profile->mFont; 142 GFXVideoMode videoMode = GFXInit::getDesktopResolution(); 143 144 ColorI color(255, 255, 255, 128); 145 pDrawUtil->drawRectFill(updateRect, color); 146 147 for (S32 k = 0; k < MaxPlots; k++) 148 { 149 // Nothing to graph 150 if ((mPlots[k].mGraphData.size() == 0) || (mPlots[k].mHidden == true)) 151 continue; 152 153 Point2F graphExtent = getGraphExtent(k); 154 155 // Adjust scale to max value + 5% so we can see high value 156 F32 ScaleX = (F32(getExtent().x) / (graphExtent.x*(1.00 + (mPlots[k].mGraphScale)))); 157 F32 ScaleY = (F32(getExtent().y) / (graphExtent.y*(1.00 + (mPlots[k].mGraphScale)))); 158 159 if((mPlots[k].mGraphType == Point) || (mPlots[k].mGraphType == Polyline)) 160 { 161 S32 posX; 162 S32 posY; 163 S32 lastPosX = 0; 164 S32 lastPosY = 0; 165 Point2F plotPoint; 166 167 S32 size = 32; 168 169 for (S32 sample = 0; sample < mPlots[k].mGraphData.size(); sample++) 170 { 171 S32 temp; 172 173 temp = (S32)(((F32)getExtent().x / (F32)mPlots[k].mGraphData.size()) * (F32)sample); 174 175 // calculate the point positions 176 plotPoint = getPlotPoint(k, sample); 177 178 posX = (S32)((plotPoint.x - mPlots[k].mGraphMin.x) * (ScaleX /(1.00 + mPlots[k].mGraphScale))); 179 posY = (getExtent().y) - (S32)((plotPoint.y - mPlots[k].mGraphMin.y) * ScaleY); 180 181 posX += getExtent().x * (mPlots[k].mGraphScale); 182 posY /= (1.00 + (mPlots[k].mGraphScale)); 183 184 posX = localToGlobalCoord(Point2I(posX, posY)).x; 185 posY = localToGlobalCoord(Point2I(posX, posY)).y; 186 187 // check if this isn't our first loop through, if it is we won't have starting points 188 if(sample > 0) 189 { 190 pDrawUtil->drawLine( lastPosX, lastPosY , posX, posY , mPlots[k].mGraphColor.toColorI() ); 191 } else 192 { 193 mPlots[k].mNutList.clear(); 194 } 195 196 mPlots[k].mNutList.push_back( Point2F(posX, posY) ); 197 198 // store the last positions to be the starting points drawn into a line next loop 199 lastPosX = posX; 200 lastPosY = posY; 201 202 //Con::printf("red %f green %f blue %f", mPlots[k].mGraphColor.red, mPlots[k].mGraphColor.green, mPlots[k].mGraphColor.blue); 203 204 205 206 if(mSelectedPoint != -1) 207 { 208 mLastSelectedPoint = mSelectedPoint; 209 } 210 211 ColorI nutColor (mPlots[k].mGraphColor.toColorI()); 212 213 if(k == mSelectedPlot && sample == mLastSelectedPoint) 214 { 215 // grab the colors for the nut 216 F32 red = mPlots[k].mGraphColor.red; 217 F32 green = mPlots[k].mGraphColor.green; 218 F32 blue = mPlots[k].mGraphColor.blue; 219 220 // invert the colors for the nut since this is a selected nut 221 red = 1.0 - red; 222 green = 1.0 - green; 223 blue = 1.0 - blue; 224 // nut color 225 226 nutColor = LinearColorF(red, green, blue).toColorI(); 227 } 228 229 // draw the seleciton nut 230 drawNut( Point2I(posX, posY), 3, mOutlineColor, nutColor ); 231 232 if((mLastSelectedPoint != -1) || (mRenderAllPoints == true)) 233 { 234 if((k == mSelectedPlot && sample == mLastSelectedPoint) || (mRenderAllPoints == true)) 235 { 236 char number[32]; 237 238 Point2I comparePos = localToGlobalCoord(Point2I(getPosition().x, getPosition().y)); 239 240 dSprintf(number, 32, "%4.3f %4.3f", plotPoint.x, plotPoint.y); 241 242 S32 textWidth = (S32)font->getStrWidth((const UTF8*)number);; 243 textWidth /= 2; 244 245 if((((S32)posX - (textWidth/2)) < comparePos.x) || (((S32)posX - textWidth) <= 0)) 246 { 247 posX += (textWidth/1.5); 248 } else if((posX + (textWidth * 1.8)) > (comparePos.x + getExtent().x) || ((posX + textWidth) >= videoMode.resolution.x)) 249 { 250 posX -= (textWidth * 1.5); 251 } 252 253 if((((S32)posY) < comparePos.y) || (((S32)posY - textWidth) <= 0)) 254 { 255 posY += 40; 256 } 257 258 pDrawUtil->setBitmapModulation( profile->mFontColor ); 259 pDrawUtil->drawText( font, Point2I(posX, posY + 5) - Point2I(size >> 1, size), number ); 260 pDrawUtil->clearBitmapModulation(); 261 } 262 } 263 } 264 } 265 } 266 267 if(mRenderNextGraphTooltip == true && mRenderGraphTooltip == true) 268 { 269 char argBuffer[1][32]; 270 271 dSprintf(argBuffer[0], 32, "%s", getGraphName(mTooltipSelectedPlot)); 272 273 renderGraphTooltip(mCursorPos, argBuffer[0]); 274 } 275} 276 277S32 GuiParticleGraphCtrl::addPlotPoint(S32 plotID, Point2F v, bool setAdded) 278{ 279 S32 mPlotIndex = 0; 280 bool plotChanged = false; 281 bool plotAdded = false; 282 283 if(mAutoMax == false) 284 { 285 if(v.x < mPlots[plotID].mGraphMin.x) 286 { 287 v.x = mPlots[plotID].mGraphMin.x; 288 } 289 290 if(v.x > mPlots[plotID].mGraphMax.x) 291 { 292 v.x = mPlots[plotID].mGraphMax.x; 293 } 294 295 if(v.y < mPlots[plotID].mGraphMin.y) 296 { 297 v.y = mPlots[plotID].mGraphMin.y; 298 } 299 300 if(v.y > mPlots[plotID].mGraphMax.y) 301 { 302 v.y = mPlots[plotID].mGraphMax.y; 303 } 304 } 305 306 for(S32 i = 0; i < mPlots[plotID].mGraphData.size(); i++) 307 { 308 if(mFabs(v.x - mPlots[plotID].mGraphData[i].x) < 0.001) 309 { 310 if(mAutoRemove == true) 311 { 312 changePlotPoint(plotID, i, v); 313 plotChanged = true; 314 mPlotIndex = i; 315 } else 316 { 317 mPlotIndex = -1; 318 } 319 320 plotAdded = true; 321 322 break; 323 } else if(v.x < mPlots[plotID].mGraphData[i].x) 324 { 325 insertPlotPoint(plotID, i, v); 326 plotAdded = true; 327 mPlotIndex = i; 328 break; 329 } 330 } 331 332 if(plotAdded == false) 333 { 334 mPlots[plotID].mGraphData.push_back( v ); 335 mPlotIndex = mPlots[plotID].mGraphData.size() - 1; 336 } 337 338 if(mAutoMax == true) 339 { 340 // Keep record of maximum data value for scaling purposes. 341 if(v.y > mPlots[plotID].mGraphMax.y) 342 mPlots[plotID].mGraphMax.y = v.y; 343 344 if(v.x > mPlots[plotID].mGraphMax.x) 345 mPlots[plotID].mGraphMax.x = v.x; 346 } 347 348 if(plotChanged == true) 349 { 350 mPointWasAdded = false; 351 } else if(mPlotIndex != -1 && setAdded) 352 { 353 mPointWasAdded = true; 354 mAddedPoint = v; 355 mAddedPointIndex = mPlotIndex; 356 } 357 358 return mPlotIndex; 359} 360 361void GuiParticleGraphCtrl::insertPlotPoint(S32 plotID, S32 i, Point2F v) 362{ 363 //AssertFatal(plotID > -1 && plotID < MaxPlots, "Invalid plot specified!"); 364 365 // Add the data and trim the vector... 366 mPlots[plotID].mGraphData.insert( i ); 367 mPlots[plotID].mGraphData[ i ] = v; 368 369 if(mAutoMax == true) 370 { 371 // Keep record of maximum data value for scaling purposes. 372 if(v.y > mPlots[plotID].mGraphMax.y) 373 mPlots[plotID].mGraphMax.y = v.y; 374 375 if(v.x > mPlots[plotID].mGraphMax.x) 376 mPlots[plotID].mGraphMax.x = v.x; 377 } 378 379 // Argument Buffer. 380 char argBuffer[2][32]; 381 382 dSprintf(argBuffer[0], 32, "%d", plotID); 383 dSprintf(argBuffer[1], 32, "%f %f", v.x, v.y); 384 385 // Call Scripts. 386 Con::executef(this, "onPlotPointInserted", argBuffer[0], argBuffer[1]); 387} 388 389S32 GuiParticleGraphCtrl::changePlotPoint(S32 plotID, S32 i, Point2F v) 390{ 391 //AssertFatal(plotID > -1 && plotID < MaxPlots, "Invalid plot specified!"); 392 393 // Add the data and trim the vector... 394 S32 point = removePlotPoint(plotID, i); 395 396 // Argument Buffer. 397 char argBuffer[3][32]; 398 399 dSprintf(argBuffer[0], 32, "%d", mSelectedPlot); 400 dSprintf(argBuffer[1], 32, "%d", point); 401 dSprintf(argBuffer[2], 32, "%f %f", v.x, v.y); 402 403 // Call Scripts. 404 Con::executef(this, "onPlotPointRemoved", argBuffer[0], argBuffer[1], argBuffer[2]); 405 406 // call the insert function 407 S32 index = addPlotPoint(plotID, v); 408 409 return index; 410} 411 412S32 GuiParticleGraphCtrl::removePlotPoint(S32 plotID, S32 i) 413{ 414 if((plotID < MaxPlots && plotID >= 0) && (i < mPlots[plotID].mGraphData.size())) 415 { 416 Point2F v = mPlots[plotID].mGraphData[i]; 417 418 mPlots[plotID].mGraphData.erase(i); 419 420 if(i == mPlots[plotID].mGraphData.size() && mSelectedPlot == plotID && mLastSelectedPoint == i) 421 { 422 setSelectedPoint(i-1); 423 } else if(i < mLastSelectedPoint) 424 { 425 setSelectedPoint(mLastSelectedPoint-1); 426 } 427 } 428 429 return i; 430} 431 432S32 GuiParticleGraphCtrl::getSelectedPlot() 433{ 434 return mSelectedPlot; 435} 436 437S32 GuiParticleGraphCtrl::getSelectedPoint() 438{ 439 return mLastSelectedPoint; 440} 441 442bool GuiParticleGraphCtrl::isExistingPoint(S32 plotID, S32 sample) 443{ 444 if (((plotID < 0) || (plotID >= MaxPlots)) || ((sample < 0) || (sample > MaxDataPoints)) || (sample >= mPlots[plotID].mGraphData.size())) 445 { 446 return false; 447 } else 448 { 449 return true; 450 } 451} 452 453Point2F GuiParticleGraphCtrl::getPlotPoint(S32 plotID, S32 sample) 454{ 455 Point2F val; 456 val.x = -1; 457 val.y = -1; 458 459 if (((plotID < 0) || (plotID >= MaxPlots)) || ((sample < 0) || (sample > MaxDataPoints))) 460 { 461 return val; 462 } 463 464 return mPlots[plotID].mGraphData[sample]; 465} 466 467S32 GuiParticleGraphCtrl::getPlotIndex(S32 plotID, F32 x, F32 y) 468{ 469 if ((plotID < 0) || (plotID >= MaxPlots)) 470 { 471 return -1; 472 } 473 474 F32 compareX = 0.0; 475 F32 compareY = 0.0; 476 477 for(S32 i = 0; i < mPlots[plotID].mGraphData.size(); i++) 478 { 479 compareX = mPlots[plotID].mGraphData[i].x; 480 compareY = mPlots[plotID].mGraphData[i].y; 481 482 // 483 //if((x == compareX) && (y == compareY)) 484 if((mFabs(x - compareX) < 0.001) && (mFabs(y - compareY) < 0.001)) 485 return i; 486 } 487 488 return -1; 489} 490 491void GuiParticleGraphCtrl::setGraphType(S32 plotID, const char *graphType) 492{ 493 AssertFatal(plotID > -1 && plotID < MaxPlots, "Invalid plot specified!"); 494 if(!dStricmp(graphType,"Bar")) 495 mPlots[plotID].mGraphType = Bar; 496 else if(!dStricmp(graphType,"Filled")) 497 mPlots[plotID].mGraphType = Filled; 498 else if(!dStricmp(graphType,"Point")) 499 mPlots[plotID].mGraphType = Point; 500 else if(!dStricmp(graphType,"Polyline")) 501 mPlots[plotID].mGraphType = Polyline; 502 else AssertWarn(true, "Invalid graph type!"); 503} 504 505void GuiParticleGraphCtrl::setSelectedPlot(S32 plotID) 506{ 507 mSelectedPlot = plotID; 508 509 // Argument Buffer. 510 char argBuffer[32]; 511 512 dSprintf(argBuffer, 32, "%d", plotID); 513 514 // Call Scripts. 515 Con::executef(this, "onSetSelected", argBuffer); 516} 517 518void GuiParticleGraphCtrl::setSelectedPoint(S32 point) 519{ 520 if(point != mSelectedPoint && point < mPlots[mSelectedPlot].mGraphData.size() && point >= 0) 521 { 522 mSelectedPoint = point; 523 mLastSelectedPoint = point; 524 char argBuffer[32]; 525 526 dSprintf(argBuffer, 32, "%d", point); 527 528 // Call Scripts. 529 Con::executef(this, "onPlotPointSelected", argBuffer); 530 } 531} 532 533void GuiParticleGraphCtrl::resetSelectedPoint() 534{ 535 mSelectedPoint = -1; 536} 537 538void GuiParticleGraphCtrl::setAutoGraphMax(bool autoMax) 539{ 540 mAutoMax = autoMax; 541} 542 543void GuiParticleGraphCtrl::setAutoRemove(bool autoRemove) 544{ 545 mAutoRemove = autoRemove; 546} 547 548void GuiParticleGraphCtrl::setGraphHidden(S32 plotID, bool isHidden) 549{ 550 mPlots[plotID].mHidden = isHidden; 551} 552 553void GuiParticleGraphCtrl::setRenderAll(bool renderAll) 554{ 555 mRenderAllPoints = renderAll; 556} 557 558void GuiParticleGraphCtrl::setPointXMovementClamped(bool clamped) 559{ 560 mPointXMovementClamped = clamped; 561} 562 563void GuiParticleGraphCtrl::setRenderGraphTooltip(bool renderGraphTooltip) 564{ 565 mRenderGraphTooltip = renderGraphTooltip; 566} 567 568 569void GuiParticleGraphCtrl::drawNut(const Point2I &nut, S32 size, ColorI &outlineColor, ColorI &nutColor) 570{ 571 // Fetch Draw Utility. 572 GFXDrawUtil* pDrawUtil = GFX->getDrawUtil(); 573 574 //Con::printf("r %d g %d b %d", nutColor.red, nutColor.green, nutColor.blue); 575 S32 NUT_SIZE = size; 576 RectI r(nut.x - NUT_SIZE, nut.y - NUT_SIZE, 2 * NUT_SIZE + 1, 2 * NUT_SIZE + 1); 577 r.inset(1, 1); 578 pDrawUtil->drawRectFill(r, nutColor); 579 r.inset(-1, -1); 580 pDrawUtil->drawRect(r, outlineColor); 581} 582 583bool GuiParticleGraphCtrl::inNut(const Point2I &pt, S32 x, S32 y) 584{ 585 S32 dx = pt.x - x; 586 S32 dy = pt.y - y; 587 return dx <= mVertexClickSize && dx >= -mVertexClickSize && dy <= mVertexClickSize && dy >= -mVertexClickSize; 588} 589 590Point2I GuiParticleGraphCtrl::findHitNut( Point2I hitPoint ) 591{ 592 for(S32 i = 0; i < MaxPlots; i++) 593 { 594 if ( (mPlots[i].mGraphData.size() == 0) || (mPlots[i].mHidden == true)) 595 continue; 596 597 for (S32 j = 0 ; j < mPlots[i].mNutList.size(); j++ ) 598 { 599 if( inNut (Point2I( mPlots[i].mNutList[j].x, mPlots[i].mNutList[j].y), hitPoint.x, hitPoint.y) ) 600 { 601 mTooltipSelectedPlot = i; 602 return Point2I(i,j); 603 } 604 } 605 } 606 607 return Point2I(-1,-1); 608} 609 610Point2F GuiParticleGraphCtrl::convertToGraphCoord(S32 plotID, Point2I v) 611{ 612 Point2F resultV; 613 614 v = globalToLocalCoord( v ); 615 v.y = getExtent().y - v.y; 616 resultV = Point2F(v.x, v.y); 617 resultV.x /= getExtent().x; 618 resultV.y /= getExtent().y; 619 resultV.x *= getGraphExtent(plotID).x; 620 resultV.y *= getGraphExtent(plotID).y; 621 resultV.x *= 1.00 + (mPlots[plotID].mGraphScale*2); 622 resultV.y *= 1.00 + (mPlots[plotID].mGraphScale*2); 623 resultV.x -= getGraphExtent(plotID).x * ((mPlots[plotID].mGraphScale)); 624 resultV.y -= getGraphExtent(plotID).y * ((mPlots[plotID].mGraphScale)); 625 resultV.x += mPlots[plotID].mGraphMin.x; 626 resultV.y += mPlots[plotID].mGraphMin.y; 627 628 if(mAutoMax == false) 629 { 630 if(resultV.x < mPlots[plotID].mGraphMin.x) 631 { 632 resultV.x = mPlots[plotID].mGraphMin.x; 633 } 634 635 if(resultV.x > mPlots[plotID].mGraphMax.x) 636 { 637 resultV.x = mPlots[plotID].mGraphMax.x; 638 } 639 640 if(resultV.y < mPlots[plotID].mGraphMin.y) 641 { 642 resultV.y = mPlots[plotID].mGraphMin.y; 643 } 644 645 if(resultV.y > mPlots[plotID].mGraphMax.y) 646 { 647 resultV.y = mPlots[plotID].mGraphMax.y; 648 } 649 } 650 651 652 653 return resultV; 654} 655 656Point2F GuiParticleGraphCtrl::getGraphExtent(S32 plotID) 657{ 658 Point2F resultV; 659 660 resultV.x = mPlots[plotID].mGraphMax.x - mPlots[plotID].mGraphMin.x; 661 resultV.y = mPlots[plotID].mGraphMax.y - mPlots[plotID].mGraphMin.y; 662 663 return resultV; 664} 665 666LinearColorF GuiParticleGraphCtrl::getGraphColor(S32 plotID) 667{ 668 return mPlots[plotID].mGraphColor; 669} 670 671Point2F GuiParticleGraphCtrl::getGraphMax(S32 plotID) 672{ 673 return mPlots[plotID].mGraphMax; 674} 675 676Point2F GuiParticleGraphCtrl::getGraphMin(S32 plotID) 677{ 678 return mPlots[plotID].mGraphMin; 679} 680 681void GuiParticleGraphCtrl::setGraphMin(S32 plotID, Point2F graphMin) 682{ 683 mPlots[plotID].mGraphMin = graphMin; 684} 685 686void GuiParticleGraphCtrl::setGraphMax(S32 plotID, Point2F graphMax) 687{ 688 mPlots[plotID].mGraphMax = graphMax; 689} 690 691void GuiParticleGraphCtrl::setGraphMinX(S32 plotID, F32 graphMinX) 692{ 693 mPlots[plotID].mGraphMin.x = graphMinX; 694} 695 696void GuiParticleGraphCtrl::setGraphMinY(S32 plotID, F32 graphMinY) 697{ 698 mPlots[plotID].mGraphMin.y = graphMinY; 699} 700 701void GuiParticleGraphCtrl::setGraphMaxX(S32 plotID, F32 graphMaxX) 702{ 703 mPlots[plotID].mGraphMax.x = graphMaxX; 704} 705 706void GuiParticleGraphCtrl::setGraphMaxY(S32 plotID, F32 graphMaxY) 707{ 708 mPlots[plotID].mGraphMax.y = graphMaxY; 709} 710 711void GuiParticleGraphCtrl::setGraphName(S32 plotID, StringTableEntry graphName) 712{ 713 mPlots[plotID].mGraphName = StringTable->insert(graphName); 714} 715 716StringTableEntry GuiParticleGraphCtrl::getGraphName(S32 plotID) 717{ 718 return mPlots[plotID].mGraphName; 719} 720 721void GuiParticleGraphCtrl::onMouseMove(const GuiEvent &event) 722{ 723 mCursorPos = event.mousePoint; 724 725 Point2I hitNut = findHitNut(event.mousePoint); 726 727 if( hitNut != Point2I(-1,-1) ) 728 { 729 mRenderNextGraphTooltip = true; 730 } else 731 { 732 mRenderNextGraphTooltip = false; 733 } 734 735 // Argument Buffer. 736 char argBuffer[32]; 737 738 dSprintf(argBuffer, 32, "%f %f", convertToGraphCoord(mSelectedPlot, event.mousePoint).x, convertToGraphCoord(mSelectedPlot, event.mousePoint).y); 739 740 741 // Call Scripts. 742 Con::executef(this, "onMouseMove", argBuffer); 743} 744 745void GuiParticleGraphCtrl::onMouseDown(const GuiEvent &event) 746{ 747 Point2I hitNut = findHitNut(event.mousePoint); 748 749 if( hitNut != Point2I(-1,-1) ) 750 { 751 if(event.mouseClickCount == 2) 752 { 753 Point2F plotPoint = getPlotPoint(hitNut.x, hitNut.y); 754 S32 point = removePlotPoint(hitNut.x, hitNut.y); 755 756 // Argument Buffer. 757 char argBuffer[3][32]; 758 759 dSprintf(argBuffer[0], 32, "%d", mSelectedPlot); 760 dSprintf(argBuffer[1], 32, "%d", point); 761 dSprintf(argBuffer[2], 32, "%f %f", plotPoint.x, plotPoint.y); 762 763 764 765 // Call Scripts. 766 Con::executef(this, "onPlotPointRemoved", argBuffer[0], argBuffer[1], argBuffer[2]); 767 } else 768 { 769 setSelectedPlot(hitNut.x); 770 setSelectedPoint(hitNut.y); 771 mOriginalSelectedPoint = hitNut.y; 772 773 char argBuffer[32]; 774 775 dSprintf(argBuffer, 32, "%d", hitNut.y); 776 777 // Call Scripts. 778 Con::executef(this, "onPlotPointSelectedMouseDown", argBuffer); 779 } 780 } else if( mSelectedPlot != -1 ) 781 { 782 Point2F mousePos = convertToGraphCoord(mSelectedPlot, event.mousePoint); 783 mLastSelectedPoint = addPlotPoint(mSelectedPlot, mousePos); 784 785 // Argument Buffer. 786 char argBuffer[32]; 787 788 dSprintf(argBuffer, 32, "%f %f", convertToGraphCoord(mSelectedPlot, event.mousePoint).x, convertToGraphCoord(mSelectedPlot, event.mousePoint).y); 789 790 // Call Scripts. 791 Con::executef(this, "onMouseDragged", argBuffer); 792 793 return; 794 } 795} 796 797void GuiParticleGraphCtrl::onMouseUp(const GuiEvent &event) 798{ 799 if(mSelectedPoint != -1) 800 mLastSelectedPoint = mSelectedPoint; 801 802 if(mPointWasAdded == true) 803 { 804 if(mSelectedPoint == -1) 805 { 806 // Argument Buffer. 807 char argBuffer[3][32]; 808 809 dSprintf(argBuffer[0], 32, "%d", mSelectedPlot); 810 dSprintf(argBuffer[1], 32, "%f %f", mAddedPoint.x, mAddedPoint.y); 811 dSprintf(argBuffer[2], 32, "%d", mAddedPointIndex); 812 813 // Call Scripts. 814 Con::executef(this, "onPlotPointAdded", argBuffer[0], argBuffer[1], argBuffer[2]); 815 } else 816 { 817 // Argument Buffer. 818 char argBuffer[4][32]; 819 820 dSprintf(argBuffer[0], 32, "%d", mSelectedPlot); 821 dSprintf(argBuffer[1], 32, "%f %f", mAddedPoint.x, mAddedPoint.y); 822 dSprintf(argBuffer[2], 32, "%d", mOriginalSelectedPoint); 823 dSprintf(argBuffer[3], 32, "%d", mAddedPointIndex); 824 825 // Call Scripts. 826 Con::executef(this, "onPlotPointChangedUp", argBuffer[0], argBuffer[1], argBuffer[2], argBuffer[3]); 827 } 828 } 829 830 mPointWasAdded = false; 831 832 mSelectedPoint = -1; 833} 834 835void GuiParticleGraphCtrl::onMouseDragged(const GuiEvent &event) 836{ 837 mRenderNextGraphTooltip = false; 838 839 if(mSelectedPoint != -1) 840 { 841 Point2F mousePos = convertToGraphCoord(mSelectedPlot, event.mousePoint); 842 843 if(mPointXMovementClamped == true) 844 { 845 F32 prevXPos = getPlotPoint(mSelectedPlot, mSelectedPoint).x; 846 if(mousePos.x != prevXPos) 847 { 848 mousePos.x = prevXPos; 849 } 850 } 851 852 removePlotPoint(mSelectedPlot, mSelectedPoint); 853 S32 point = addPlotPoint(mSelectedPlot, mousePos); 854 if(point != -1) 855 { 856 setSelectedPoint(point); 857 mLastMousePos = mousePos; 858 859 // Argument Buffer. 860 char argBuffer[3][32]; 861 862 dSprintf(argBuffer[0], 32, "%d", mSelectedPlot); 863 dSprintf(argBuffer[1], 32, "%f %f", mAddedPoint.x, mAddedPoint.y); 864 dSprintf(argBuffer[2], 32, "%d", point); 865 866 // Call Scripts. 867 Con::executef(this, "onPlotPointChangedMove", argBuffer[0], argBuffer[1], argBuffer[2]); 868 } else 869 { 870 point = addPlotPoint(mSelectedPlot, mLastMousePos); 871 } 872 } 873 874 // Argument Buffer. 875 char argBuffer[32]; 876 877 dSprintf(argBuffer, 32, "%f %f", convertToGraphCoord(mSelectedPlot, event.mousePoint).x, convertToGraphCoord(mSelectedPlot, event.mousePoint).y); 878 879 // Call Scripts. 880 Con::executef(this, "onMouseDragged", argBuffer); 881} 882 883void GuiParticleGraphCtrl::onRightMouseDown(const GuiEvent &event) 884{ 885 Point2I hitNut = findHitNut(event.mousePoint); 886 887 if( hitNut != Point2I(-1,-1) ) 888 { 889 Point2F plotPoint = getPlotPoint(hitNut.x, hitNut.y); 890 S32 point = removePlotPoint(hitNut.x, hitNut.y); 891 892 // Argument Buffer. 893 char argBuffer[3][32]; 894 895 dSprintf(argBuffer[0], 32, "%d", mSelectedPlot); 896 dSprintf(argBuffer[1], 32, "%d", point); 897 dSprintf(argBuffer[2], 32, "%f %f", plotPoint.x, plotPoint.y); 898 899 // Call Scripts. 900 Con::executef(this, "onPlotPointRemoved", argBuffer[0], argBuffer[1], argBuffer[2]); 901 } 902} 903 904void GuiParticleGraphCtrl::onRightMouseUp(const GuiEvent &event) 905{ 906 907} 908 909void GuiParticleGraphCtrl::onRightMouseDragged(const GuiEvent &event) 910{ 911 Point2I hitNut = findHitNut(event.mousePoint); 912 913 if( hitNut != Point2I(-1,-1) ) 914 { 915 Point2F plotPoint = getPlotPoint(hitNut.x, hitNut.y); 916 S32 point = removePlotPoint(hitNut.x, hitNut.y); 917 918 // Argument Buffer. 919 char argBuffer[3][32]; 920 921 dSprintf(argBuffer[0], 32, "%d", mSelectedPlot); 922 dSprintf(argBuffer[1], 32, "%d", point); 923 dSprintf(argBuffer[2], 32, "%f %f", plotPoint.x, plotPoint.y); 924 925 // Call Scripts. 926 Con::executef(this, "onPlotPointRemoved", argBuffer[0], argBuffer[1], argBuffer[2]); 927 } 928} 929 930void GuiParticleGraphCtrl::clearAllGraphs() 931{ 932 for(S32 i = 0;i < MaxPlots;i++) 933 { 934 clearGraph(i); 935 } 936} 937 938void GuiParticleGraphCtrl::clearGraph(S32 plotID) 939{ 940 mPlots[plotID].mGraphData.clear(); 941 mPlots[plotID].mNutList.clear(); 942} 943 944bool GuiParticleGraphCtrl::renderGraphTooltip(Point2I cursorPos, StringTableEntry tooltip) 945{ 946 // Short Circuit. 947 if (!mAwake) 948 return false; 949 if ( dStrlen( tooltip ) == 0 ) 950 return false; 951 952 // Need to have root. 953 GuiCanvas *root = getRoot(); 954 if ( !root ) 955 return false; 956 957 if (!mTooltipProfile) 958 setTooltipProfile( mProfile ); 959 960 GFont *font = mTooltipProfile->mFont; 961 962 // Fetch Canvas. 963 GuiCanvas *pCanvas = getRoot(); 964 965 //Vars used: 966 //Screensize (for position check) 967 //Offset to get position of cursor 968 //textBounds for text extent. 969 Point2I screensize = pCanvas->getWindowSize(); 970 Point2I offset = cursorPos; 971 Point2I textBounds; 972 S32 textWidth = font->getStrWidth(tooltip); 973 974 //Offset below cursor image 975 offset.y -= root->getCursorExtent().y; 976 //Create text bounds. 977 textBounds.x = textWidth+8; 978 textBounds.y = font->getHeight() + 4; 979 980 // Check position/width to make sure all of the tooltip will be rendered 981 // 5 is given as a buffer against the edge 982 if (screensize.x < offset.x + textBounds.x + 5) 983 offset.x = screensize.x - textBounds.x - 5; 984 985 // And ditto for the height 986 if(screensize.y < offset.y + textBounds.y + 5) 987 offset.y = cursorPos.y - textBounds.y - 5; 988 989 // Set rectangle for the box, and set the clip rectangle. 990 RectI rect(offset, textBounds); 991 GFX->setClipRect(rect); 992 993 // Fetch Draw Utility. 994 GFXDrawUtil* pDrawUtil = GFX->getDrawUtil(); 995 996 // Draw Filler bit, then border on top of that 997 pDrawUtil->drawRectFill(rect, ColorI(mTooltipProfile->mFillColor.red, mTooltipProfile->mFillColor.green, mTooltipProfile->mFillColor.blue, 200) ); 998 pDrawUtil->drawRect( rect, mTooltipProfile->mBorderColor ); 999 1000 // Draw the text centered in the tool tip box 1001 pDrawUtil->setBitmapModulation( mTooltipProfile->mFontColor ); 1002 Point2I start; 1003 start.set( ( textBounds.x - textWidth) / 2, ( textBounds.y - font->getHeight() ) / 2 ); 1004 pDrawUtil->drawText( font, start + offset, tooltip, mProfile->mFontColors ); 1005 pDrawUtil->clearBitmapModulation(); 1006 1007 return true; 1008} 1009 1010DefineEngineMethod(GuiParticleGraphCtrl, setSelectedPoint, void, (S32 point), , "(int point)" 1011 "Set the selected point on the graph.\n" 1012 "@return No return value") 1013{ 1014 if(point >= object->mPlots[object->mSelectedPlot].mGraphData.size() || point < 0) 1015 { 1016 Con::errorf("Invalid point to select."); 1017 return; 1018 } 1019 object->setSelectedPoint( point ); 1020} 1021 1022DefineEngineMethod(GuiParticleGraphCtrl, setSelectedPlot, void, (S32 plotID), , "(int plotID)" 1023 "Set the selected plot (a.k.a. graph)." 1024 "@return No return value" ) 1025{ 1026 if(plotID >= object->MaxPlots) 1027 { 1028 Con::errorf("Invalid plotID."); 1029 return; 1030 } 1031 object->setSelectedPlot( plotID ); 1032} 1033 1034DefineEngineMethod(GuiParticleGraphCtrl, clearGraph, void, (S32 plotID), , "(int plotID)" 1035 "Clear the graph of the given plot." 1036 "@return No return value") 1037{ 1038 if(plotID >= object->MaxPlots) 1039 { 1040 Con::errorf("Invalid plotID."); 1041 return; 1042 } 1043 object->clearGraph( plotID ); 1044} 1045 1046DefineEngineMethod(GuiParticleGraphCtrl, clearAllGraphs, void, (), , "()" 1047 "Clear all of the graphs." 1048 "@return No return value") 1049{ 1050 object->clearAllGraphs(); 1051} 1052 1053DefineEngineMethod(GuiParticleGraphCtrl, addPlotPoint, S32, (S32 plotID, F32 x, F32 y, bool setAdded), (true), "(int plotID, float x, float y, bool setAdded = true;)" 1054 "Add a data point to the given plot." 1055 "@return") 1056{ 1057 1058 if(plotID >= object->MaxPlots) 1059 { 1060 Con::errorf("Invalid plotID."); 1061 return -2; 1062 } 1063 return object->addPlotPoint( plotID, Point2F(x, y), setAdded); 1064} 1065 1066DefineEngineMethod(GuiParticleGraphCtrl, insertPlotPoint, void, (S32 plotID, S32 i, F32 x, F32 y), , "(int plotID, int i, float x, float y)\n" 1067 "Insert a data point to the given plot and plot position.\n" 1068 "@param plotID The plot you want to access\n" 1069 "@param i The data point.\n" 1070 "@param x,y The plot position.\n" 1071 "@return No return value.") 1072{ 1073 if(plotID >= object->MaxPlots) 1074 { 1075 Con::errorf("Invalid plotID."); 1076 return; 1077 } 1078 object->insertPlotPoint( plotID, i, Point2F(x, y)); 1079} 1080 1081DefineEngineMethod(GuiParticleGraphCtrl, changePlotPoint, S32, (S32 plotID, S32 i, F32 x, F32 y), , "(int plotID, int i, float x, float y)" 1082 "Change a data point to the given plot and plot position.\n" 1083 "@param plotID The plot you want to access\n" 1084 "@param i The data point.\n" 1085 "@param x,y The plot position.\n" 1086 "@return No return value.") 1087{ 1088 if(plotID >= object->MaxPlots) 1089 { 1090 Con::errorf("Invalid plotID."); 1091 return -1; 1092 } 1093 return object->changePlotPoint( plotID, i, Point2F(x, y)); 1094} 1095 1096DefineEngineMethod(GuiParticleGraphCtrl, getSelectedPlot, S32, (), , "() " 1097 "Gets the selected Plot (a.k.a. graph).\n" 1098 "@return The plot's ID.") 1099{ 1100 return object->getSelectedPlot(); 1101} 1102 1103DefineEngineMethod(GuiParticleGraphCtrl, getSelectedPoint, S32, (), , "()" 1104 "Gets the selected Point on the Plot (a.k.a. graph)." 1105 "@return The last selected point ID") 1106{ 1107 return object->getSelectedPoint(); 1108} 1109 1110DefineEngineMethod(GuiParticleGraphCtrl, isExistingPoint, bool, (S32 plotID, S32 samples), , "(int plotID, int samples)" 1111 "@return Returns true or false whether or not the point in the plot passed is an existing point.") 1112{ 1113 1114 if(plotID >= object->MaxPlots) 1115 { 1116 Con::errorf("Invalid plotID."); 1117 } 1118 if(samples > object->MaxDataPoints) 1119 { 1120 Con::errorf("Invalid sample."); 1121 } 1122 return object->isExistingPoint(plotID, samples); 1123} 1124 1125DefineEngineMethod(GuiParticleGraphCtrl, getPlotPoint, Point2F, (S32 plotID, S32 samples), , "(int plotID, int samples)" 1126 "Get a data point from the plot specified, samples from the start of the graph." 1127 "@return The data point ID") 1128{ 1129 1130 if(plotID >= object->MaxPlots) 1131 { 1132 Con::errorf("Invalid plotID."); 1133 } 1134 if(samples > object->MaxDataPoints) 1135 { 1136 Con::errorf("Invalid sample."); 1137 } 1138 1139 1140 return object->getPlotPoint(plotID, samples); 1141} 1142 1143DefineEngineMethod(GuiParticleGraphCtrl, getPlotIndex, S32, (S32 plotID, F32 x, F32 y), , "(int plotID, float x, float y)\n" 1144 "Gets the index of the point passed on the plotID passed (graph ID).\n" 1145 "@param plotID The plot you wish to check.\n" 1146 "@param x,y The coordinates of the point to get.\n" 1147 "@return Returns the index of the point.\n") 1148{ 1149 1150 if(plotID >= object->MaxPlots) 1151 { 1152 Con::errorf("Invalid plotID."); 1153 } 1154 return object->getPlotIndex(plotID, x, y); 1155} 1156 1157DefineEngineMethod(GuiParticleGraphCtrl, getGraphColor, LinearColorF, (S32 plotID), , "(int plotID)" 1158 "Get the color of the graph passed." 1159 "@return Returns the color of the graph as a string of RGB values formatted as \"R G B\"") 1160{ 1161 1162 if(plotID >= object->MaxPlots) 1163 { 1164 Con::errorf("Invalid plotID."); 1165 } 1166 1167 return object->getGraphColor(plotID); 1168 1169} 1170 1171DefineEngineMethod(GuiParticleGraphCtrl, getGraphMin, Point2F, (S32 plotID), , "(int plotID) " 1172 "Get the minimum values of the graph ranges.\n" 1173 "@return Returns the minimum of the range formatted as \"x-min y-min\"") 1174{ 1175 1176 if(plotID >= object->MaxPlots) 1177 { 1178 Con::errorf("Invalid plotID."); 1179 } 1180 return object->getGraphMin(plotID); 1181} 1182 1183DefineEngineMethod(GuiParticleGraphCtrl, getGraphMax, Point2F, (S32 plotID), , "(int plotID) " 1184 "Get the maximum values of the graph ranges.\n" 1185 "@return Returns the maximum of the range formatted as \"x-max y-max\"") 1186{ 1187 1188 if(plotID >= object->MaxPlots) 1189 { 1190 Con::errorf("Invalid plotID."); 1191 } 1192 return object->getGraphMax(plotID); 1193 1194} 1195 1196DefineEngineMethod(GuiParticleGraphCtrl, getGraphName, const char*, (S32 plotID), , "(int plotID) " 1197 "Get the name of the graph passed.\n" 1198 "@return Returns the name of the plot") 1199{ 1200 1201 if(plotID >= object->MaxPlots) 1202 { 1203 Con::errorf("Invalid plotID."); 1204 } 1205 1206 const U32 bufSize = 64; 1207 char *retBuffer = Con::getReturnBuffer(bufSize); 1208 const StringTableEntry graphName = object->getGraphName(plotID); 1209 dSprintf(retBuffer, bufSize, "%s", graphName); 1210 return retBuffer; 1211} 1212 1213DefineEngineMethod(GuiParticleGraphCtrl, setGraphMin, void, (S32 plotID, F32 minX, F32 minY), , "(int plotID, float minX, float minY) " 1214 "Set the min values of the graph of plotID.\n" 1215 "@param plotID The plot to modify\n" 1216 "@param minX,minY The minimum bound of the value range.\n" 1217 "@return No return value.") 1218{ 1219 1220 if(plotID >= object->MaxPlots) 1221 { 1222 Con::errorf("Invalid plotID."); 1223 return; 1224 } 1225 1226 object->setGraphMin(plotID, Point2F(minX, minY)); 1227} 1228 1229DefineEngineMethod(GuiParticleGraphCtrl, setGraphMinX, void, (S32 plotID, F32 minX), , "(int plotID, float minX) " 1230 "Set the min X value of the graph of plotID.\n" 1231 "@param plotID The plot to modify.\n" 1232 "@param minX The minimum x value.\n" 1233 "@return No return Value.") 1234{ 1235 1236 if(plotID >= object->MaxPlots) 1237 { 1238 Con::errorf("Invalid plotID."); 1239 return; 1240 } 1241 1242 object->setGraphMinX(plotID, minX); 1243} 1244 1245DefineEngineMethod(GuiParticleGraphCtrl, setGraphMinY, void, (S32 plotID, F32 minX), , "(int plotID, float minY) " 1246 "Set the min Y value of the graph of plotID." 1247 "@param plotID The plot to modify.\n" 1248 "@param minY The minimum y value.\n" 1249 "@return No return Value.") 1250{ 1251 1252 if(plotID >= object->MaxPlots) 1253 { 1254 Con::errorf("Invalid plotID."); 1255 return; 1256 } 1257 1258 object->setGraphMinY(plotID, minX); 1259} 1260 1261DefineEngineMethod(GuiParticleGraphCtrl, setGraphMax, void, (S32 plotID, F32 maxX, F32 maxY), , "(int plotID, float maxX, float maxY) " 1262 "Set the max values of the graph of plotID." 1263 "@param plotID The plot to modify\n" 1264 "@param maxX,maxY The maximum bound of the value range.\n" 1265 "@return No return value.") 1266{ 1267 1268 if(plotID >= object->MaxPlots) 1269 { 1270 Con::errorf("Invalid plotID."); 1271 return; 1272 } 1273 1274 object->setGraphMax(plotID, Point2F(maxX, maxY)); 1275} 1276 1277DefineEngineMethod(GuiParticleGraphCtrl, setGraphMaxX, void, (S32 plotID, F32 maxX), , "(int plotID, float maxX)" 1278 "Set the max X value of the graph of plotID." 1279 "@param plotID The plot to modify.\n" 1280 "@param maxX The maximum x value.\n" 1281 "@return No return Value.") 1282{ 1283 1284 if(plotID >= object->MaxPlots) 1285 { 1286 Con::errorf("Invalid plotID."); 1287 return; 1288 } 1289 1290 object->setGraphMaxX(plotID, maxX); 1291} 1292 1293DefineEngineMethod(GuiParticleGraphCtrl, setGraphMaxY, void, (S32 plotID, F32 maxX), , "(int plotID, float maxY)" 1294 "Set the max Y value of the graph of plotID." 1295 "@param plotID The plot to modify.\n" 1296 "@param maxY The maximum y value.\n" 1297 "@return No return Value.") 1298{ 1299 1300 if(plotID >= object->MaxPlots) 1301 { 1302 Con::errorf("Invalid plotID."); 1303 return; 1304 } 1305 1306 object->setGraphMaxY(plotID, maxX); 1307} 1308 1309DefineEngineMethod(GuiParticleGraphCtrl, setGraphHidden, void, (S32 plotID, bool isHidden), , "(int plotID, bool isHidden)" 1310 "Set whether the graph number passed is hidden or not." 1311 "@return No return value.") 1312{ 1313 1314 if(plotID >= object->MaxPlots) 1315 { 1316 Con::errorf("Invalid plotID."); 1317 return; 1318 } 1319 1320 object->setGraphHidden(plotID, isHidden); 1321} 1322 1323DefineEngineMethod(GuiParticleGraphCtrl, setAutoGraphMax, void, (bool autoMax), , "(bool autoMax) " 1324 "Set whether the max will automatically be set when adding points " 1325 "(ie if you add a value over the current max, the max is increased to that value).\n" 1326 "@return No return value.") 1327{ 1328 object->setAutoGraphMax(autoMax); 1329} 1330 1331DefineEngineMethod(GuiParticleGraphCtrl, setAutoRemove, void, (bool autoRemove), , "(bool autoRemove) " 1332 "Set whether or not a point should be deleted when you drag another one over it." 1333 "@return No return value.") 1334{ 1335 object->setAutoRemove(autoRemove); 1336} 1337 1338DefineEngineMethod(GuiParticleGraphCtrl, setRenderAll, void, (bool autoRemove), , "(bool renderAll)" 1339 "Set whether or not a position should be rendered on every point or just the last selected." 1340 "@return No return value.") 1341{ 1342 object->setRenderAll(autoRemove); 1343} 1344 1345DefineEngineMethod(GuiParticleGraphCtrl, setPointXMovementClamped, void, (bool autoRemove), , "(bool clamped)" 1346 "Set whether the x position of the selected graph point should be clamped" 1347 "@return No return value.") 1348{ 1349 object->setPointXMovementClamped(autoRemove); 1350} 1351 1352DefineEngineMethod(GuiParticleGraphCtrl, setRenderGraphTooltip, void, (bool autoRemove), , "(bool renderGraphTooltip)" 1353 "Set whether or not to render the graph tooltip." 1354 "@return No return value.") 1355{ 1356 object->setRenderGraphTooltip(autoRemove); 1357} 1358 1359DefineEngineMethod(GuiParticleGraphCtrl, setGraphName, void, (S32 plotID, const char * graphName), , "(int plotID, string graphName) " 1360 "Set the name of the given plot.\n" 1361 "@param plotID The plot to modify.\n" 1362 "@param graphName The name to set on the plot.\n" 1363 "@return No return value.") 1364{ 1365 1366 if(plotID >= object->MaxPlots) 1367 { 1368 Con::errorf("Invalid plotID."); 1369 return; 1370 } 1371 1372 object->setGraphName(plotID, graphName); 1373} 1374 1375DefineEngineMethod(GuiParticleGraphCtrl, resetSelectedPoint, void, (), , "()" 1376 "This will reset the currently selected point to nothing." 1377 "@return No return value.") 1378{ 1379 object->resetSelectedPoint(); 1380} 1381