guiObjectView.cpp
Engine/source/T3D/guiObjectView.cpp
Public Functions
ConsoleDocClass(GuiObjectView , "@brief GUI <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> which displays <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> 3D <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">model.\n\n</a>" "Model displayed in the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> can have other objects mounted onto it, and the light settings can be <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">adjusted.\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" " <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> <a href="/coding/class/classguiobjectview/">GuiObjectView</a>(ObjectPreview)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " {\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " shapeFile=\"art/shapes/items/kit/healthkit.dts\";\n" " mountedNode = \"mount0\";\n" " lightColor = \"1 1 1 1\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " lightAmbient = \"0.5 0.5 0.5 1\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " lightDirection = \"0 0.707 -0.707\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " orbitDiststance = \"2\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " minOrbitDiststance = \"0.917688\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " maxOrbitDiststance = \"5\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " cameraSpeed = \"0.01\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " cameraZRot = \"0\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " forceFOV = \"0\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " reflectPriority = \"0\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " };\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">GuiControl\n\n</a>" "@ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Gui3D\n</a>" )
DefineEngineMethod(GuiObjectView , getCameraSpeed , F32 , () )
DefineEngineMethod(GuiObjectView , getModel , const char * , () )
DefineEngineMethod(GuiObjectView , getMountedModel , const char * , () )
DefineEngineMethod(GuiObjectView , getMountSkin , const char * , (S32 param1, S32 param2) )
DefineEngineMethod(GuiObjectView , getOrbitDistance , F32 , () )
DefineEngineMethod(GuiObjectView , getSkin , const char * , () )
DefineEngineMethod(GuiObjectView , setCameraSpeed , void , (F32 factor) , "@brief Sets the multiplier <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the camera rotation and zoom <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">speed.\n\n</a>" "@param factor Multiplier <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> camera rotation and zoom <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">speed.\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "// Set the factor <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">value\n</a>" "% factor)
DefineEngineMethod(GuiObjectView , setLightAmbient , void , (LinearColorF color) , "@brief Set the light ambient color on the sun object used <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/editortool_8cpp/#editortool_8cpp_1a4cb041169a32ea3d4cacadbb955e06b4">render</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">model.\n\n</a>" "@param color Ambient color of <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sunlight.\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "// Define the sun ambient color <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">value\n</a>" "% color)
DefineEngineMethod(GuiObjectView , setLightColor , void , (LinearColorF color) , "@brief Set the light color on the sun object used <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/editortool_8cpp/#editortool_8cpp_1a4cb041169a32ea3d4cacadbb955e06b4">render</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">model.\n\n</a>" "@param color Color of <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sunlight.\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "// Set the color <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sun\n</a>" "% color)
DefineEngineMethod(GuiObjectView , setLightDirection , void , (Point3F direction) , "@brief Set the light direction from which <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> light the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">model.\n\n</a>" "@param direction XYZ direction from which the light will shine on the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">model\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "// Set the light <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">direction\n</a>" "% direction)
DefineEngineMethod(GuiObjectView , setModel , void , (const char *shapeName) , "@brief Sets the model <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> be displayed in this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">control.\n\n</a>" "@param shapeName Name of the model <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">display.\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "// Define the model we want <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">display\n</a>" "% shapeName)
DefineEngineMethod(GuiObjectView , setMount , void , (const char *shapeName, const char *mountNodeIndexOrName) , "@brief Mounts the given model <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the specified mount point of the primary model displayed in this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">control.\n\n</a>" "Detailed <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">description\n\n</a>" "@param shapeName Name of the model <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">mount.\n</a>" "@param mountNodeIndexOrName Index or name of the mount point <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> be mounted to. If index, corresponds <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> \"mountN\" in your shape where N is the number passed <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">here.\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "// Set the shapeName <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">mount\n</a>" "% shapeName)
DefineEngineMethod(GuiObjectView , setMountedModel , void , (const char *shapeName) , "@brief Sets the model <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> be mounted on the primary <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">model.\n\n</a>" "@param shapeName Name of the model <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">mount.\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "// Define the model name <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">mount\n</a>" "% modelToMount)
DefineEngineMethod(GuiObjectView , setMountSkin , void , (const char *skinName) , "@brief Sets the skin <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> use on the mounted <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">model.\n\n</a>" "@param skinName Name of the skin <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> set on the model mounted <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the <a href="/coding/file/x86unixmain_8cpp/#x86unixmain_8cpp_1a217dbf8b442f20279ea00b898af96f52">main</a> model in the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">control\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "// Define the name of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">skin\n</a>" "% skinName)
DefineEngineMethod(GuiObjectView , setOrbitDistance , void , (F32 distance) , "@brief Sets the distance at which the camera orbits the object. Clamped <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the acceptable range defined in the class by min and max orbit <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">distances.\n\n</a>" "Detailed <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">description\n\n</a>" "@param distance The distance <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> set the orbit <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> (will be clamped).\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "// Define the orbit distance <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">value\n</a>" "% orbitDistance)
DefineEngineMethod(GuiObjectView , setSeq , void , (const char *indexOrName) , "@brief Sets the animation <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> play <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the viewed <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object.\n\n</a>" "@param indexOrName The index or name of the animation <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">play.\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "// Set the animation index value, or animation sequence <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">name.\n</a>" "% indexVal)
DefineEngineMethod(GuiObjectView , setSkin , void , (const char *skinName) , "@brief Sets the skin <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> use on the model being <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">displayed.\n\n</a>" "@param skinName Name of the skin <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">use.\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "// Define the skin we want <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> apply <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the <a href="/coding/file/x86unixmain_8cpp/#x86unixmain_8cpp_1a217dbf8b442f20279ea00b898af96f52">main</a> model in the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">control\n</a>" "% skinName)
IMPLEMENT_CALLBACK(GuiObjectView , onMouseEnter , void , () , () , "@brief Called whenever the mouse enters the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">control.\n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "// The mouse has entered the control, causing the callback <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">occur\n</a>" "<a href="/coding/class/classguiobjectview/#classguiobjectview_1a9a5be1754120ef9edd208eba85f58bfc">GuiObjectView::onMouseEnter</a>(%this)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " {\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//Code <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> run when the mouse enters this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">control\n</a>" " }\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">GuiControl\n\n</a>" )
IMPLEMENT_CALLBACK(GuiObjectView , onMouseLeave , void , () , () , "@brief Called whenever the mouse leaves the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">control.\n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "// The mouse has left the control, causing the callback <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">occur\n</a>" "<a href="/coding/class/classguiobjectview/#classguiobjectview_1a868f43fbd235f9f2cc5817fea8f637f3">GuiObjectView::onMouseLeave</a>(%this)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " {\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//Code <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> run when the mouse leaves this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">control\n</a>" " }\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">GuiControl\n\n</a>" )
Detailed Description
Public Functions
ConsoleDocClass(GuiObjectView , "@brief GUI <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> which displays <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> 3D <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">model.\n\n</a>" "Model displayed in the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> can have other objects mounted onto it, and the light settings can be <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">adjusted.\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" " <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> <a href="/coding/class/classguiobjectview/">GuiObjectView</a>(ObjectPreview)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " {\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " shapeFile=\"art/shapes/items/kit/healthkit.dts\";\n" " mountedNode = \"mount0\";\n" " lightColor = \"1 1 1 1\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " lightAmbient = \"0.5 0.5 0.5 1\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " lightDirection = \"0 0.707 -0.707\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " orbitDiststance = \"2\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " minOrbitDiststance = \"0.917688\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " maxOrbitDiststance = \"5\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " cameraSpeed = \"0.01\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " cameraZRot = \"0\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " forceFOV = \"0\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " reflectPriority = \"0\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " };\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">GuiControl\n\n</a>" "@ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Gui3D\n</a>" )
DefineEngineMethod(GuiObjectView , getCameraSpeed , F32 , () )
DefineEngineMethod(GuiObjectView , getModel , const char * , () )
DefineEngineMethod(GuiObjectView , getMountedModel , const char * , () )
DefineEngineMethod(GuiObjectView , getMountSkin , const char * , (S32 param1, S32 param2) )
DefineEngineMethod(GuiObjectView , getOrbitDistance , F32 , () )
DefineEngineMethod(GuiObjectView , getSkin , const char * , () )
DefineEngineMethod(GuiObjectView , setCameraSpeed , void , (F32 factor) , "@brief Sets the multiplier <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the camera rotation and zoom <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">speed.\n\n</a>" "@param factor Multiplier <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> camera rotation and zoom <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">speed.\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "// Set the factor <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">value\n</a>" "% factor)
DefineEngineMethod(GuiObjectView , setLightAmbient , void , (LinearColorF color) , "@brief Set the light ambient color on the sun object used <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/editortool_8cpp/#editortool_8cpp_1a4cb041169a32ea3d4cacadbb955e06b4">render</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">model.\n\n</a>" "@param color Ambient color of <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sunlight.\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "// Define the sun ambient color <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">value\n</a>" "% color)
DefineEngineMethod(GuiObjectView , setLightColor , void , (LinearColorF color) , "@brief Set the light color on the sun object used <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/editortool_8cpp/#editortool_8cpp_1a4cb041169a32ea3d4cacadbb955e06b4">render</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">model.\n\n</a>" "@param color Color of <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sunlight.\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "// Set the color <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sun\n</a>" "% color)
DefineEngineMethod(GuiObjectView , setLightDirection , void , (Point3F direction) , "@brief Set the light direction from which <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> light the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">model.\n\n</a>" "@param direction XYZ direction from which the light will shine on the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">model\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "// Set the light <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">direction\n</a>" "% direction)
DefineEngineMethod(GuiObjectView , setModel , void , (const char *shapeName) , "@brief Sets the model <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> be displayed in this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">control.\n\n</a>" "@param shapeName Name of the model <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">display.\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "// Define the model we want <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">display\n</a>" "% shapeName)
DefineEngineMethod(GuiObjectView , setMount , void , (const char *shapeName, const char *mountNodeIndexOrName) , "@brief Mounts the given model <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the specified mount point of the primary model displayed in this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">control.\n\n</a>" "Detailed <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">description\n\n</a>" "@param shapeName Name of the model <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">mount.\n</a>" "@param mountNodeIndexOrName Index or name of the mount point <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> be mounted to. If index, corresponds <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> \"mountN\" in your shape where N is the number passed <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">here.\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "// Set the shapeName <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">mount\n</a>" "% shapeName)
DefineEngineMethod(GuiObjectView , setMountedModel , void , (const char *shapeName) , "@brief Sets the model <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> be mounted on the primary <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">model.\n\n</a>" "@param shapeName Name of the model <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">mount.\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "// Define the model name <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">mount\n</a>" "% modelToMount)
DefineEngineMethod(GuiObjectView , setMountSkin , void , (const char *skinName) , "@brief Sets the skin <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> use on the mounted <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">model.\n\n</a>" "@param skinName Name of the skin <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> set on the model mounted <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the <a href="/coding/file/x86unixmain_8cpp/#x86unixmain_8cpp_1a217dbf8b442f20279ea00b898af96f52">main</a> model in the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">control\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "// Define the name of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">skin\n</a>" "% skinName)
DefineEngineMethod(GuiObjectView , setOrbitDistance , void , (F32 distance) , "@brief Sets the distance at which the camera orbits the object. Clamped <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the acceptable range defined in the class by min and max orbit <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">distances.\n\n</a>" "Detailed <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">description\n\n</a>" "@param distance The distance <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> set the orbit <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> (will be clamped).\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "// Define the orbit distance <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">value\n</a>" "% orbitDistance)
DefineEngineMethod(GuiObjectView , setSeq , void , (const char *indexOrName) , "@brief Sets the animation <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> play <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the viewed <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object.\n\n</a>" "@param indexOrName The index or name of the animation <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">play.\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "// Set the animation index value, or animation sequence <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">name.\n</a>" "% indexVal)
DefineEngineMethod(GuiObjectView , setSkin , void , (const char *skinName) , "@brief Sets the skin <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> use on the model being <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">displayed.\n\n</a>" "@param skinName Name of the skin <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">use.\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "// Define the skin we want <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> apply <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the <a href="/coding/file/x86unixmain_8cpp/#x86unixmain_8cpp_1a217dbf8b442f20279ea00b898af96f52">main</a> model in the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">control\n</a>" "% skinName)
IMPLEMENT_CALLBACK(GuiObjectView , onMouseEnter , void , () , () , "@brief Called whenever the mouse enters the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">control.\n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "// The mouse has entered the control, causing the callback <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">occur\n</a>" "<a href="/coding/class/classguiobjectview/#classguiobjectview_1a9a5be1754120ef9edd208eba85f58bfc">GuiObjectView::onMouseEnter</a>(%this)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " {\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//Code <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> run when the mouse enters this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">control\n</a>" " }\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">GuiControl\n\n</a>" )
IMPLEMENT_CALLBACK(GuiObjectView , onMouseLeave , void , () , () , "@brief Called whenever the mouse leaves the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">control.\n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "// The mouse has left the control, causing the callback <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">occur\n</a>" "<a href="/coding/class/classguiobjectview/#classguiobjectview_1a868f43fbd235f9f2cc5817fea8f637f3">GuiObjectView::onMouseLeave</a>(%this)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " {\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//Code <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> run when the mouse leaves this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">control\n</a>" " }\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">GuiControl\n\n</a>" )
IMPLEMENT_CONOBJECT(GuiObjectView )
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 "T3D/guiObjectView.h" 25#include "renderInstance/renderPassManager.h" 26#include "lighting/lightManager.h" 27#include "lighting/lightInfo.h" 28#include "core/resourceManager.h" 29#include "scene/sceneManager.h" 30#include "scene/sceneRenderState.h" 31#include "console/consoleTypes.h" 32#include "math/mathTypes.h" 33#include "gfx/gfxTransformSaver.h" 34#include "console/engineAPI.h" 35 36IMPLEMENT_CONOBJECT( GuiObjectView ); 37 38ConsoleDocClass( GuiObjectView, 39 "@brief GUI control which displays a 3D model.\n\n" 40 41 "Model displayed in the control can have other objects mounted onto it, and the light settings can be adjusted.\n\n" 42 43 "@tsexample\n" 44 " new GuiObjectView(ObjectPreview)\n" 45 " {\n" 46 " shapeFile = \"art/shapes/items/kit/healthkit.dts\";\n" 47 " mountedNode = \"mount0\";\n" 48 " lightColor = \"1 1 1 1\";\n" 49 " lightAmbient = \"0.5 0.5 0.5 1\";\n" 50 " lightDirection = \"0 0.707 -0.707\";\n" 51 " orbitDiststance = \"2\";\n" 52 " minOrbitDiststance = \"0.917688\";\n" 53 " maxOrbitDiststance = \"5\";\n" 54 " cameraSpeed = \"0.01\";\n" 55 " cameraZRot = \"0\";\n" 56 " forceFOV = \"0\";\n" 57 " reflectPriority = \"0\";\n" 58 " };\n" 59 "@endtsexample\n\n" 60 61 "@see GuiControl\n\n" 62 63 "@ingroup Gui3D\n" 64); 65 66IMPLEMENT_CALLBACK( GuiObjectView, onMouseEnter, void, (),(), 67 "@brief Called whenever the mouse enters the control.\n\n" 68 "@tsexample\n" 69 "// The mouse has entered the control, causing the callback to occur\n" 70 "GuiObjectView::onMouseEnter(%this)\n" 71 " {\n" 72 " // Code to run when the mouse enters this control\n" 73 " }\n" 74 "@endtsexample\n\n" 75 "@see GuiControl\n\n" 76); 77 78IMPLEMENT_CALLBACK( GuiObjectView, onMouseLeave, void, (),(), 79 "@brief Called whenever the mouse leaves the control.\n\n" 80 "@tsexample\n" 81 "// The mouse has left the control, causing the callback to occur\n" 82 "GuiObjectView::onMouseLeave(%this)\n" 83 " {\n" 84 " // Code to run when the mouse leaves this control\n" 85 " }\n" 86 "@endtsexample\n\n" 87 "@see GuiControl\n\n" 88); 89 90//------------------------------------------------------------------------------ 91 92GuiObjectView::GuiObjectView() 93 : mMouseState( None ), 94 mLastMousePoint( 0, 0 ), 95 mModel( NULL ), 96 mMaxOrbitDist( 5.0f ), 97 mMinOrbitDist( 0.0f ), 98 mCameraRotation( 0.0f, 0.0f, 0.0f ), 99 mOrbitDist( 5.0f ), 100 mCameraSpeed( 0.01f ), 101 mMountNode( -1 ), 102 mMountNodeName( "mount0" ), 103 mMountedModel( NULL ), 104 mAnimationSeq( -1 ), 105 mRunThread( NULL ), 106 mLastRenderTime( 0 ), 107 mLight( NULL ), 108 mLightColor( 1.0f, 1.0f, 1.0f ), 109 mLightAmbient( 0.5f, 0.5f, 0.5f ), 110 mLightDirection( 0.f, 0.707f, -0.707f ) 111{ 112 mCameraMatrix.identity(); 113 mCameraRot.set( 0.0f, 0.0f, 3.9f ); 114 mCameraPos.set( 0.0f, 0.0f, 0.0f ); 115 mCameraMatrix.setColumn( 3, mCameraPos ); 116 mOrbitPos.set( 0.0f, 0.0f, 0.0f ); 117 118 // By default don't do dynamic reflection 119 // updates for this viewport. 120 mReflectPriority = 0.0f; 121} 122 123//------------------------------------------------------------------------------ 124 125GuiObjectView::~GuiObjectView() 126{ 127 if( mModel ) 128 SAFE_DELETE( mModel ); 129 if( mMountedModel ) 130 SAFE_DELETE( mMountedModel ); 131 if( mLight ) 132 SAFE_DELETE( mLight ); 133} 134 135//------------------------------------------------------------------------------ 136 137void GuiObjectView::initPersistFields() 138{ 139 addGroup( "Model" ); 140 141 addField( "shapeFile", TypeStringFilename, Offset( mModelName, GuiObjectView ), 142 "The object model shape file to show in the view." ); 143 addField( "skin", TypeRealString, Offset( mSkinName, GuiObjectView ), 144 "The skin to use on the object model." ); 145 146 endGroup( "Model" ); 147 148 addGroup( "Animation" ); 149 150 addField( "animSequence", TypeRealString, Offset( mAnimationSeqName, GuiObjectView ), 151 "The animation sequence to play on the model." ); 152 153 endGroup( "Animation" ); 154 155 addGroup( "Mounting" ); 156 157 addField( "mountedShapeFile", TypeStringFilename, Offset( mMountedModelName, GuiObjectView ), 158 "Optional shape file to mount on the primary model (e.g. weapon)." ); 159 addField( "mountedSkin", TypeRealString, Offset( mMountSkinName, GuiObjectView ), 160 "Skin name used on mounted shape file." ); 161 addField( "mountedNode", TypeRealString, Offset( mMountNodeName, GuiObjectView ), 162 "Name of node on primary model to which to mount the secondary shape." ); 163 164 endGroup( "Mounting" ); 165 166 addGroup( "Lighting" ); 167 168 addField( "lightColor", TypeColorF, Offset( mLightColor, GuiObjectView ), 169 "Diffuse color of the sunlight used to render the model." ); 170 addField( "lightAmbient", TypeColorF, Offset( mLightAmbient, GuiObjectView ), 171 "Ambient color of the sunlight used to render the model." ); 172 addField( "lightDirection", TypePoint3F, Offset( mLightDirection, GuiObjectView ), 173 "Direction from which the model is illuminated." ); 174 175 endGroup( "Lighting" ); 176 177 addGroup( "Camera" ); 178 179 addField( "orbitDiststance", TypeF32, Offset( mOrbitDist, GuiObjectView ), 180 "Distance from which to render the model." ); 181 addField( "minOrbitDiststance", TypeF32, Offset( mMinOrbitDist, GuiObjectView ), 182 "Maxiumum distance to which the camera can be zoomed out." ); 183 addField( "maxOrbitDiststance", TypeF32, Offset( mMaxOrbitDist, GuiObjectView ), 184 "Minimum distance below which the camera will not zoom in further." ); 185 addField( "cameraSpeed", TypeF32, Offset( mCameraSpeed, GuiObjectView ), 186 "Multiplier for mouse camera operations." ); 187 addField( "cameraRotation", TypePoint3F, Offset( mCameraRotation, GuiObjectView ), 188 "Set the camera rotation." ); 189 endGroup( "Camera" ); 190 191 Parent::initPersistFields(); 192} 193 194//------------------------------------------------------------------------------ 195 196void GuiObjectView::onStaticModified( StringTableEntry slotName, const char* newValue ) 197{ 198 Parent::onStaticModified( slotName, newValue ); 199 200 static StringTableEntry sShapeFile = StringTable->insert( "shapeFile" ); 201 static StringTableEntry sSkin = StringTable->insert( "skin" ); 202 static StringTableEntry sMountedShapeFile = StringTable->insert( "mountedShapeFile" ); 203 static StringTableEntry sMountedSkin = StringTable->insert( "mountedSkin" ); 204 static StringTableEntry sMountedNode = StringTable->insert( "mountedNode" ); 205 static StringTableEntry sLightColor = StringTable->insert( "lightColor" ); 206 static StringTableEntry sLightAmbient = StringTable->insert( "lightAmbient" ); 207 static StringTableEntry sLightDirection = StringTable->insert( "lightDirection" ); 208 static StringTableEntry sOrbitDistance = StringTable->insert( "orbitDistance" ); 209 static StringTableEntry sMinOrbitDistance = StringTable->insert( "minOrbitDistance" ); 210 static StringTableEntry sMaxOrbitDistance = StringTable->insert( "maxOrbitDistance" ); 211 static StringTableEntry sCameraRotation = StringTable->insert( "cameraRotation" ); 212 static StringTableEntry sAnimSequence = StringTable->insert( "animSequence" ); 213 214 if( slotName == sShapeFile ) 215 setObjectModel( String( mModelName ) ); 216 else if( slotName == sSkin ) 217 setSkin( String( mSkinName ) ); 218 else if( slotName == sMountedShapeFile ) 219 setMountedObject( String( mMountedModelName ) ); 220 else if( slotName == sMountedSkin ) 221 setMountSkin( String( mMountSkinName ) ); 222 else if( slotName == sMountedNode ) 223 setMountNode( String( mMountNodeName ) ); 224 else if( slotName == sLightColor ) 225 setLightColor( mLightColor ); 226 else if( slotName == sLightAmbient ) 227 setLightAmbient( mLightAmbient ); 228 else if( slotName == sLightDirection ) 229 setLightDirection( mLightDirection ); 230 else if( slotName == sOrbitDistance || slotName == sMinOrbitDistance || slotName == sMaxOrbitDistance ) 231 setOrbitDistance( mOrbitDist ); 232 else if( slotName == sCameraRotation ) 233 setCameraRotation( mCameraRotation ); 234 else if( slotName == sAnimSequence ) 235 setObjectAnimation( String( mAnimationSeqName ) ); 236} 237 238//------------------------------------------------------------------------------ 239 240bool GuiObjectView::onWake() 241{ 242 if( !Parent::onWake() ) 243 return false; 244 245 if( !mLight ) 246 { 247 mLight = LIGHTMGR->createLightInfo(); 248 249 mLight->setColor( mLightColor ); 250 mLight->setAmbient( mLightAmbient ); 251 mLight->setDirection( mLightDirection ); 252 } 253 254 return true; 255} 256 257//------------------------------------------------------------------------------ 258 259void GuiObjectView::onMouseDown( const GuiEvent &event ) 260{ 261 if( !mActive || !mVisible || !mAwake ) 262 return; 263 264 mMouseState = Rotating; 265 mLastMousePoint = event.mousePoint; 266 mouseLock(); 267} 268 269//------------------------------------------------------------------------------ 270 271void GuiObjectView::onMouseUp( const GuiEvent &event ) 272{ 273 mouseUnlock(); 274 mMouseState = None; 275} 276 277//------------------------------------------------------------------------------ 278 279void GuiObjectView::onMouseDragged( const GuiEvent &event ) 280{ 281 if( mMouseState != Rotating ) 282 return; 283 284 Point2I delta = event.mousePoint - mLastMousePoint; 285 mLastMousePoint = event.mousePoint; 286 287 mCameraRot.x += ( delta.y * mCameraSpeed ); 288 mCameraRot.z += ( delta.x * mCameraSpeed ); 289} 290 291//------------------------------------------------------------------------------ 292 293void GuiObjectView::onRightMouseDown( const GuiEvent &event ) 294{ 295 mMouseState = Zooming; 296 mLastMousePoint = event.mousePoint; 297 mouseLock(); 298} 299 300//------------------------------------------------------------------------------ 301 302void GuiObjectView::onRightMouseUp( const GuiEvent &event ) 303{ 304 mouseUnlock(); 305 mMouseState = None; 306} 307 308//------------------------------------------------------------------------------ 309 310void GuiObjectView::onRightMouseDragged( const GuiEvent &event ) 311{ 312 if( mMouseState != Zooming ) 313 return; 314 315 S32 delta = event.mousePoint.y - mLastMousePoint.y; 316 mLastMousePoint = event.mousePoint; 317 318 mOrbitDist += ( delta * mCameraSpeed ); 319} 320 321//------------------------------------------------------------------------------ 322 323void GuiObjectView::setObjectAnimation( S32 index ) 324{ 325 mAnimationSeq = index; 326 mAnimationSeqName = String(); 327 328 if( mModel ) 329 _initAnimation(); 330} 331 332//------------------------------------------------------------------------------ 333 334void GuiObjectView::setObjectAnimation( const String& sequenceName ) 335{ 336 mAnimationSeq = -1; 337 mAnimationSeqName = sequenceName; 338 339 if( mModel ) 340 _initAnimation(); 341} 342 343//------------------------------------------------------------------------------ 344 345void GuiObjectView::setObjectModel( const String& modelName ) 346{ 347 SAFE_DELETE( mModel ); 348 mRunThread = 0; 349 mModelName = String::EmptyString; 350 351 // Load the shape. 352 353 Resource< TSShape> model = ResourceManager::get().load( modelName ); 354 if( !model ) 355 { 356 Con::warnf( "GuiObjectView::setObjectModel - Failed to load model '%s'", modelName.c_str() ); 357 return; 358 } 359 360 // Instantiate it. 361 362 mModel = new TSShapeInstance( model, true ); 363 mModelName = modelName; 364 365 if( !mSkinName.isEmpty() ) 366 mModel->reSkin( mSkinName ); 367 368 // Initialize camera values. 369 370 mOrbitPos = mModel->getShape()->center; 371 mMinOrbitDist = mModel->getShape()->mRadius; 372 373 // Initialize animation. 374 375 _initAnimation(); 376 _initMount(); 377} 378 379//------------------------------------------------------------------------------ 380 381void GuiObjectView::setSkin( const String& name ) 382{ 383 if( mModel ) 384 mModel->reSkin( name, mSkinName ); 385 386 mSkinName = name; 387} 388 389//------------------------------------------------------------------------------ 390 391void GuiObjectView::setMountSkin( const String& name ) 392{ 393 if( mMountedModel ) 394 mMountedModel->reSkin( name, mMountSkinName ); 395 396 mMountSkinName = name; 397} 398 399//------------------------------------------------------------------------------ 400 401void GuiObjectView::setMountNode( S32 index ) 402{ 403 setMountNode( String::ToString( "mount%i", index ) ); 404} 405 406//------------------------------------------------------------------------------ 407 408void GuiObjectView::setMountNode( const String& name ) 409{ 410 mMountNodeName = name; 411 412 if( mModel ) 413 _initMount(); 414} 415 416//------------------------------------------------------------------------------ 417 418void GuiObjectView::setMountedObject( const String& modelName ) 419{ 420 SAFE_DELETE( mMountedModel ); 421 mMountedModelName = String::EmptyString; 422 423 // Load the model. 424 425 Resource< TSShape> model = ResourceManager::get().load( modelName ); 426 if( !model ) 427 { 428 Con::warnf( "GuiObjectView::setMountedObject - Failed to load object model '%s'", 429 modelName.c_str() ); 430 return; 431 } 432 433 mMountedModel = new TSShapeInstance( model, true ); 434 mMountedModelName = modelName; 435 436 if( !mMountSkinName.isEmpty() ) 437 mMountedModel->reSkin( mMountSkinName ); 438 439 if( mModel ) 440 _initMount(); 441} 442 443//------------------------------------------------------------------------------ 444 445bool GuiObjectView::processCameraQuery( CameraQuery* query ) 446{ 447 // Adjust the camera so that we are still facing the model. 448 449 Point3F vec; 450 MatrixF xRot, zRot; 451 xRot.set( EulerF( mCameraRot.x, 0.0f, 0.0f ) ); 452 zRot.set( EulerF( 0.0f, 0.0f, mCameraRot.z ) ); 453 454 mCameraMatrix.mul( zRot, xRot ); 455 mCameraMatrix.getColumn( 1, &vec ); 456 vec *= mOrbitDist; 457 mCameraPos = mOrbitPos - vec; 458 459 query->farPlane = 2100.0f; 460 query->nearPlane = query->farPlane / 5000.0f; 461 query->fov = 45.0f; 462 mCameraMatrix.setColumn( 3, mCameraPos ); 463 query->cameraMatrix = mCameraMatrix; 464 465 return true; 466} 467 468//------------------------------------------------------------------------------ 469 470void GuiObjectView::onMouseEnter( const GuiEvent & event ) 471{ 472 onMouseEnter_callback(); 473} 474 475//------------------------------------------------------------------------------ 476 477void GuiObjectView::onMouseLeave( const GuiEvent & event ) 478{ 479 onMouseLeave_callback(); 480} 481 482//------------------------------------------------------------------------------ 483 484void GuiObjectView::renderWorld( const RectI& updateRect ) 485{ 486 if( !mModel ) 487 return; 488 489 GFXTransformSaver _saveTransforms; 490 491 // Determine the camera position, and store off render state. 492 493 MatrixF modelview; 494 MatrixF mv; 495 Point3F cp; 496 497 modelview = GFX->getWorldMatrix(); 498 499 mv = modelview; 500 mv.inverse(); 501 mv.getColumn( 3, &cp ); 502 503 RenderPassManager* renderPass = gClientSceneGraph->getDefaultRenderPass(); 504 505 S32 time = Platform::getVirtualMilliseconds(); 506 S32 dt = time - mLastRenderTime; 507 mLastRenderTime = time; 508 509 LIGHTMGR->unregisterAllLights(); 510 LIGHTMGR->setSpecialLight( LightManager::slSunLightType, mLight ); 511 512 GFX->setStateBlock( mDefaultGuiSB ); 513 514 F32 left, right, top, bottom, nearPlane, farPlane; 515 bool isOrtho; 516 GFX->getFrustum( &left, &right, &bottom, &top, &nearPlane, &farPlane, &isOrtho ); 517 518 Frustum frust( false, left, right, top, bottom, nearPlane, farPlane, MatrixF::Identity ); 519 520 SceneRenderState state 521 ( 522 gClientSceneGraph, 523 SPT_Diffuse, 524 SceneCameraState( GFX->getViewport(), frust, MatrixF::Identity, GFX->getProjectionMatrix() ), 525 renderPass, 526 true 527 ); 528 529 // Set up our TS render state here. 530 TSRenderState rdata; 531 rdata.setSceneState( &state ); 532 533 // We might have some forward lit materials 534 // so pass down a query to gather lights. 535 LightQuery query; 536 query.init( SphereF( Point3F::Zero, 1.0f ) ); 537 rdata.setLightQuery( &query ); 538 539 // Render primary model. 540 541 if( mModel ) 542 { 543 if( mRunThread ) 544 { 545 mModel->advanceTime( dt / 1000.f, mRunThread ); 546 mModel->animate(); 547 } 548 549 mModel->render( rdata ); 550 } 551 552 // Render mounted model. 553 554 if( mMountedModel && mMountNode != -1 ) 555 { 556 GFX->pushWorldMatrix(); 557 GFX->multWorld( mModel->mNodeTransforms[ mMountNode ] ); 558 GFX->multWorld( mMountTransform ); 559 560 mMountedModel->render( rdata ); 561 562 GFX->popWorldMatrix(); 563 } 564 565 renderPass->renderPass( &state ); 566 567 // Make sure to remove our fake sun. 568 LIGHTMGR->unregisterAllLights(); 569} 570 571//------------------------------------------------------------------------------ 572 573void GuiObjectView::setOrbitDistance( F32 distance ) 574{ 575 // Make sure the orbit distance is within the acceptable range 576 mOrbitDist = mClampF( distance, mMinOrbitDist, mMaxOrbitDist ); 577} 578 579//------------------------------------------------------------------------------ 580 581void GuiObjectView::setCameraSpeed( F32 factor ) 582{ 583 mCameraSpeed = factor; 584} 585 586//------------------------------------------------------------------------------ 587 588void GuiObjectView::setCameraRotation( const EulerF& rotation ) 589{ 590 mCameraRot.set(rotation); 591} 592 593//------------------------------------------------------------------------------ 594void GuiObjectView::setLightColor( const LinearColorF& color ) 595{ 596 mLightColor = color; 597 if( mLight ) 598 mLight->setColor( color ); 599} 600 601//------------------------------------------------------------------------------ 602 603void GuiObjectView::setLightAmbient( const LinearColorF& color ) 604{ 605 mLightAmbient = color; 606 if( mLight ) 607 mLight->setAmbient( color ); 608} 609 610//------------------------------------------------------------------------------ 611 612void GuiObjectView::setLightDirection( const Point3F& direction ) 613{ 614 mLightDirection = direction; 615 if( mLight ) 616 mLight->setDirection( direction ); 617} 618 619//------------------------------------------------------------------------------ 620 621void GuiObjectView::_initAnimation() 622{ 623 AssertFatal( mModel, "GuiObjectView::_initAnimation - No model loaded!" ); 624 625 if( mAnimationSeqName.isEmpty() && mAnimationSeq == -1 ) 626 return; 627 628 // Look up sequence by name. 629 630 if( !mAnimationSeqName.isEmpty() ) 631 { 632 mAnimationSeq = mModel->getShape()->findSequence( mAnimationSeqName ); 633 634 if( mAnimationSeq == -1 ) 635 { 636 Con::errorf( "GuiObjectView::_initAnimation - Cannot find animation sequence '%s' on '%s'", 637 mAnimationSeqName.c_str(), 638 mModelName.c_str() 639 ); 640 641 return; 642 } 643 } 644 645 // Start sequence. 646 647 if( mAnimationSeq != -1 ) 648 { 649 if( mAnimationSeq >= mModel->getShape()->sequences.size() ) 650 { 651 Con::errorf( "GuiObjectView::_initAnimation - Sequence '%i' out of range for model '%s'", 652 mAnimationSeq, 653 mModelName.c_str() 654 ); 655 656 mAnimationSeq = -1; 657 return; 658 } 659 660 if( !mRunThread ) 661 mRunThread = mModel->addThread(); 662 663 mModel->setSequence( mRunThread, mAnimationSeq, 0.f ); 664 } 665 666 mLastRenderTime = Platform::getVirtualMilliseconds(); 667} 668 669//------------------------------------------------------------------------------ 670 671void GuiObjectView::_initMount() 672{ 673 AssertFatal( mModel, "GuiObjectView::_initMount - No model loaded!" ); 674 675 if( !mMountedModel ) 676 return; 677 678 mMountTransform.identity(); 679 680 // Look up the node to which to mount to. 681 682 if( !mMountNodeName.isEmpty() ) 683 { 684 mMountNode = mModel->getShape()->findNode( mMountNodeName ); 685 if( mMountNode == -1 ) 686 { 687 Con::errorf( "GuiObjectView::_initMount - No node '%s' on '%s'", 688 mMountNodeName.c_str(), 689 mModelName.c_str() 690 ); 691 692 return; 693 } 694 } 695 696 // Make sure mount node is valid. 697 698 if( mMountNode != -1 && mMountNode >= mModel->getShape()->nodes.size() ) 699 { 700 Con::errorf( "GuiObjectView::_initMount - Mount node index '%i' out of range for '%s'", 701 mMountNode, 702 mModelName.c_str() 703 ); 704 705 mMountNode = -1; 706 return; 707 } 708 709 // Look up node on the mounted model from 710 // which to mount to the primary model's node. 711 712 S32 mountPoint = mMountedModel->getShape()->findNode( "mountPoint" ); 713 if( mountPoint != -1 ) 714 { 715 mMountedModel->getShape()->getNodeWorldTransform( mountPoint, &mMountTransform ), 716 mMountTransform.inverse(); 717 } 718} 719 720//============================================================================= 721// Console Methods. 722//============================================================================= 723// MARK: ---- Console Methods ---- 724 725//----------------------------------------------------------------------------- 726 727DefineEngineMethod( GuiObjectView, getModel, const char*, (),, 728 "@brief Return the model displayed in this view.\n\n" 729 "@tsexample\n" 730 "// Request the displayed model name from the GuiObjectView object.\n" 731 "%modelName = %thisGuiObjectView.getModel();\n" 732 "@endtsexample\n\n" 733 "@return Name of the displayed model.\n\n" 734 "@see GuiControl") 735{ 736 return Con::getReturnBuffer( object->getModelName() ); 737} 738 739//----------------------------------------------------------------------------- 740 741DefineEngineMethod( GuiObjectView, setModel, void, (const char* shapeName),, 742 "@brief Sets the model to be displayed in this control.\n\n" 743 "@param shapeName Name of the model to display.\n" 744 "@tsexample\n" 745 "// Define the model we want to display\n" 746 "%shapeName = \"gideon.dts\";\n\n" 747 "// Tell the GuiObjectView object to display the defined model\n" 748 "%thisGuiObjectView.setModel(%shapeName);\n" 749 "@endtsexample\n\n" 750 "@see GuiControl") 751{ 752 object->setObjectModel( shapeName ); 753} 754 755//----------------------------------------------------------------------------- 756 757DefineEngineMethod( GuiObjectView, getMountedModel, const char*, (),, 758 "@brief Return the name of the mounted model.\n\n" 759 "@tsexample\n" 760 "// Request the name of the mounted model from the GuiObjectView object\n" 761 "%mountedModelName = %thisGuiObjectView.getMountedModel();\n" 762 "@endtsexample\n\n" 763 "@return Name of the mounted model.\n\n" 764 "@see GuiControl") 765{ 766 return Con::getReturnBuffer( object->getMountedModelName() ); 767} 768 769//----------------------------------------------------------------------------- 770 771DefineEngineMethod( GuiObjectView, setMountedModel, void, (const char* shapeName),, 772 "@brief Sets the model to be mounted on the primary model.\n\n" 773 "@param shapeName Name of the model to mount.\n" 774 "@tsexample\n" 775 "// Define the model name to mount\n" 776 "%modelToMount = \"GideonGlasses.dts\";\n\n" 777 "// Inform the GuiObjectView object to mount the defined model to the existing model in the control\n" 778 "%thisGuiObjectView.setMountedModel(%modelToMount);\n" 779 "@endtsexample\n\n" 780 "@see GuiControl") 781{ 782 object->setObjectModel(shapeName); 783} 784 785//----------------------------------------------------------------------------- 786 787DefineEngineMethod( GuiObjectView, getSkin, const char*, (),, 788 "@brief Return the name of skin used on the primary model.\n\n" 789 "@tsexample\n" 790 "// Request the name of the skin used on the primary model in the control\n" 791 "%skinName = %thisGuiObjectView.getSkin();\n" 792 "@endtsexample\n\n" 793 "@return Name of the skin used on the primary model.\n\n" 794 "@see GuiControl") 795{ 796 return Con::getReturnBuffer( object->getSkin() ); 797} 798 799//----------------------------------------------------------------------------- 800 801DefineEngineMethod( GuiObjectView, setSkin, void, (const char* skinName),, 802 "@brief Sets the skin to use on the model being displayed.\n\n" 803 "@param skinName Name of the skin to use.\n" 804 "@tsexample\n" 805 "// Define the skin we want to apply to the main model in the control\n" 806 "%skinName = \"disco_gideon\";\n\n" 807 "// Inform the GuiObjectView control to update the skin the to defined skin\n" 808 "%thisGuiObjectView.setSkin(%skinName);\n" 809 "@endtsexample\n\n" 810 "@see GuiControl") 811{ 812 object->setSkin( skinName ); 813} 814 815//----------------------------------------------------------------------------- 816 817DefineEngineMethod( GuiObjectView, getMountSkin, const char*, ( S32 param1, S32 param2),, 818 "@brief Return the name of skin used on the mounted model.\n\n" 819 "@tsexample\n" 820 "// Request the skin name from the model mounted on to the main model in the control\n" 821 "%mountModelSkin = %thisGuiObjectView.getMountSkin();\n" 822 "@endtsexample\n\n" 823 "@return Name of the skin used on the mounted model.\n\n" 824 "@see GuiControl") 825{ 826 return Con::getReturnBuffer( object->getMountSkin() ); 827} 828 829//----------------------------------------------------------------------------- 830 831DefineEngineMethod( GuiObjectView, setMountSkin, void, (const char* skinName),, 832 "@brief Sets the skin to use on the mounted model.\n\n" 833 "@param skinName Name of the skin to set on the model mounted to the main model in the control\n" 834 "@tsexample\n" 835 "// Define the name of the skin\n" 836 "%skinName = \"BronzeGlasses\";\n\n" 837 "// Inform the GuiObjectView Control of the skin to use on the mounted model\n" 838 "%thisGuiObjectViewCtrl.setMountSkin(%skinName);\n" 839 "@endtsexample\n\n" 840 "@see GuiControl") 841{ 842 object->setMountSkin(skinName); 843} 844 845//----------------------------------------------------------------------------- 846 847DefineEngineMethod( GuiObjectView, setSeq, void, (const char* indexOrName),, 848 "@brief Sets the animation to play for the viewed object.\n\n" 849 "@param indexOrName The index or name of the animation to play.\n" 850 "@tsexample\n" 851 "// Set the animation index value, or animation sequence name.\n" 852 "%indexVal = \"3\";\n" 853 "//OR:\n" 854 "%indexVal = \"idle\";\n\n" 855 "// Inform the GuiObjectView object to set the animation sequence of the object in the control.\n" 856 "%thisGuiObjectVew.setSeq(%indexVal);\n" 857 "@endtsexample\n\n" 858 "@see GuiControl") 859{ 860 if( dIsdigit( indexOrName[0] ) ) 861 object->setObjectAnimation( dAtoi( indexOrName ) ); 862 else 863 object->setObjectAnimation( indexOrName ); 864} 865 866//----------------------------------------------------------------------------- 867 868DefineEngineMethod( GuiObjectView, setMount, void, ( const char* shapeName, const char* mountNodeIndexOrName),, 869 "@brief Mounts the given model to the specified mount point of the primary model displayed in this control.\n\n" 870 "Detailed description\n\n" 871 "@param shapeName Name of the model to mount.\n" 872 "@param mountNodeIndexOrName Index or name of the mount point to be mounted to. If index, corresponds to \"mountN\" in your shape where N is the number passed here.\n" 873 "@tsexample\n" 874 "// Set the shapeName to mount\n" 875 "%shapeName = \"GideonGlasses.dts\"\n\n" 876 "// Set the mount node of the primary model in the control to mount the new shape at\n" 877 "%mountNodeIndexOrName = \"3\";\n" 878 "//OR:\n" 879 "%mountNodeIndexOrName = \"Face\";\n\n" 880 "// Inform the GuiObjectView object to mount the shape at the specified node.\n" 881 "%thisGuiObjectView.setMount(%shapeName,%mountNodeIndexOrName);\n" 882 "@endtsexample\n\n" 883 "@see GuiControl") 884{ 885 if( dIsdigit( mountNodeIndexOrName[0] ) ) 886 object->setMountNode( dAtoi( mountNodeIndexOrName ) ); 887 else 888 object->setMountNode( mountNodeIndexOrName ); 889 890 object->setMountedObject( shapeName ); 891} 892 893//----------------------------------------------------------------------------- 894 895DefineEngineMethod( GuiObjectView, getOrbitDistance, F32, (),, 896 "@brief Return the current distance at which the camera orbits the object.\n\n" 897 "@tsexample\n" 898 "// Request the current orbit distance\n" 899 "%orbitDistance = %thisGuiObjectView.getOrbitDistance();\n" 900 "@endtsexample\n\n" 901 "@return The distance at which the camera orbits the object.\n\n" 902 "@see GuiControl") 903{ 904 return object->getOrbitDistance(); 905} 906 907//----------------------------------------------------------------------------- 908 909DefineEngineMethod( GuiObjectView, setOrbitDistance, void, (F32 distance),, 910 "@brief Sets the distance at which the camera orbits the object. Clamped to the acceptable range defined in the class by min and max orbit distances.\n\n" 911 "Detailed description\n\n" 912 "@param distance The distance to set the orbit to (will be clamped).\n" 913 "@tsexample\n" 914 "// Define the orbit distance value\n" 915 "%orbitDistance = \"1.5\";\n\n" 916 "// Inform the GuiObjectView object to set the orbit distance to the defined value\n" 917 "%thisGuiObjectView.setOrbitDistance(%orbitDistance);\n" 918 "@endtsexample\n\n" 919 "@see GuiControl") 920{ 921 object->setOrbitDistance( distance ); 922} 923 924//----------------------------------------------------------------------------- 925 926DefineEngineMethod( GuiObjectView, getCameraSpeed, F32, (),, 927 "@brief Return the current multiplier for camera zooming and rotation.\n\n" 928 "@tsexample\n" 929 "// Request the current camera zooming and rotation multiplier value\n" 930 "%multiplier = %thisGuiObjectView.getCameraSpeed();\n" 931 "@endtsexample\n\n" 932 "@return Camera zooming / rotation multiplier value.\n\n" 933 "@see GuiControl") 934{ 935 return object->getCameraSpeed(); 936} 937 938//----------------------------------------------------------------------------- 939 940DefineEngineMethod( GuiObjectView, setCameraSpeed, void, (F32 factor),, 941 "@brief Sets the multiplier for the camera rotation and zoom speed.\n\n" 942 "@param factor Multiplier for camera rotation and zoom speed.\n" 943 "@tsexample\n" 944 "// Set the factor value\n" 945 "%factor = \"0.75\";\n\n" 946 "// Inform the GuiObjectView object to set the camera speed.\n" 947 "%thisGuiObjectView.setCameraSpeed(%factor);\n" 948 "@endtsexample\n\n" 949 "@see GuiControl") 950{ 951 object->setCameraSpeed( factor ); 952} 953 954//----------------------------------------------------------------------------- 955 956DefineEngineMethod( GuiObjectView, setLightColor, void, ( LinearColorF color),, 957 "@brief Set the light color on the sun object used to render the model.\n\n" 958 "@param color Color of sunlight.\n" 959 "@tsexample\n" 960 "// Set the color value for the sun\n" 961 "%color = \"1.0 0.4 0.5\";\n\n" 962 "// Inform the GuiObjectView object to change the sun color to the defined value\n" 963 "%thisGuiObjectView.setLightColor(%color);\n" 964 "@endtsexample\n\n" 965 "@see GuiControl") 966{ 967 object->setLightColor( color ); 968} 969 970//----------------------------------------------------------------------------- 971 972DefineEngineMethod( GuiObjectView, setLightAmbient, void, (LinearColorF color),, 973 "@brief Set the light ambient color on the sun object used to render the model.\n\n" 974 "@param color Ambient color of sunlight.\n" 975 "@tsexample\n" 976 "// Define the sun ambient color value\n" 977 "%color = \"1.0 0.4 0.6\";\n\n" 978 "// Inform the GuiObjectView object to set the sun ambient color to the requested value\n" 979 "%thisGuiObjectView.setLightAmbient(%color);\n" 980 "@endtsexample\n\n" 981 "@see GuiControl") 982{ 983 object->setLightAmbient( color ); 984} 985 986//----------------------------------------------------------------------------- 987 988DefineEngineMethod( GuiObjectView, setLightDirection, void, (Point3F direction),, 989 "@brief Set the light direction from which to light the model.\n\n" 990 "@param direction XYZ direction from which the light will shine on the model\n" 991 "@tsexample\n" 992 "// Set the light direction\n" 993 "%direction = \"1.0 0.2 0.4\"\n\n" 994 "// Inform the GuiObjectView object to change the light direction to the defined value\n" 995 "%thisGuiObjectView.setLightDirection(%direction);\n" 996 "@endtsexample\n\n" 997 "@see GuiControl") 998{ 999 object->setLightDirection( direction ); 1000} 1001