llviewervisualparam.cpp

Go to the documentation of this file.
00001 
00032 //-----------------------------------------------------------------------------
00033 // Header Files
00034 //-----------------------------------------------------------------------------
00035 #include "llviewerprecompiledheaders.h"
00036 
00037 #include "llviewervisualparam.h"
00038 #include "llxmltree.h"
00039 #include "llui.h"
00040 #include "llwearable.h"
00041 
00042 //-----------------------------------------------------------------------------
00043 // LLViewerVisualParamInfo()
00044 //-----------------------------------------------------------------------------
00045 LLViewerVisualParamInfo::LLViewerVisualParamInfo()
00046         :
00047         mWearableType( WT_INVALID ),
00048         mCamDist( 0.5f ),
00049         mCamAngle( 0.f ),
00050         mCamElevation( 0.f ),
00051         mEditGroupDisplayOrder( 0 ),
00052         mShowSimple(FALSE),
00053         mSimpleMin(0.f),
00054         mSimpleMax(100.f)
00055 {
00056 }
00057 
00058 LLViewerVisualParamInfo::~LLViewerVisualParamInfo()
00059 {
00060 }
00061 
00062 //-----------------------------------------------------------------------------
00063 // parseXml()
00064 //-----------------------------------------------------------------------------
00065 BOOL LLViewerVisualParamInfo::parseXml(LLXmlTreeNode *node)
00066 {
00067         llassert( node->hasName( "param" ) );
00068 
00069         if (!LLVisualParamInfo::parseXml(node))
00070                 return FALSE;
00071         
00072         // VIEWER SPECIFIC PARAMS
00073         
00074         LLString wearable;
00075         static LLStdStringHandle wearable_string = LLXmlTree::addAttributeString("wearable");
00076         if( node->getFastAttributeString( wearable_string, wearable) )
00077         {
00078                 mWearableType = LLWearable::typeNameToType( wearable );
00079         }
00080 
00081         static LLStdStringHandle edit_group_string = LLXmlTree::addAttributeString("edit_group");
00082         if (!node->getFastAttributeString( edit_group_string, mEditGroup))
00083         {
00084                 mEditGroup = "";
00085         }
00086 
00087         // Optional camera offsets from the current joint center.  Used for generating "hints" (thumbnails).
00088         static LLStdStringHandle camera_distance_string = LLXmlTree::addAttributeString("camera_distance");
00089         node->getFastAttributeF32( camera_distance_string, mCamDist );
00090         static LLStdStringHandle camera_angle_string = LLXmlTree::addAttributeString("camera_angle");
00091         node->getFastAttributeF32( camera_angle_string, mCamAngle );    // in degrees
00092         static LLStdStringHandle camera_elevation_string = LLXmlTree::addAttributeString("camera_elevation");
00093         node->getFastAttributeF32( camera_elevation_string, mCamElevation );
00094         static LLStdStringHandle camera_target_string = LLXmlTree::addAttributeString("camera_target");
00095         node->getFastAttributeString( camera_target_string, mCamTargetName );
00096 
00097         mCamAngle += 180;
00098 
00099         static S32 params_loaded = 0;
00100 
00101         // By default, parameters are displayed in the order in which they appear in the xml file.
00102         // "edit_group_order" overriddes.
00103         static LLStdStringHandle edit_group_order_string = LLXmlTree::addAttributeString("edit_group_order");
00104         if( !node->getFastAttributeF32( edit_group_order_string, mEditGroupDisplayOrder ) )
00105         {
00106                 mEditGroupDisplayOrder = (F32)params_loaded;
00107         }
00108 
00109         params_loaded++;
00110         
00111         return TRUE;
00112 }
00113 
00114 //-----------------------------------------------------------------------------
00115 // LLViewerVisualParam()
00116 //-----------------------------------------------------------------------------
00117 LLViewerVisualParam::LLViewerVisualParam()
00118 {
00119 }
00120 
00121 /*
00122 //=============================================================================
00123 // These virtual functions should always be overridden,
00124 // but are included here for use as templates
00125 //=============================================================================
00126 
00127 //-----------------------------------------------------------------------------
00128 // setInfo()
00129 //-----------------------------------------------------------------------------
00130 
00131 BOOL LLViewerVisualParam::setInfo(LLViewerVisualParamInfo *info)
00132 {
00133         llassert(mInfo == NULL);
00134         if (info->mID < 0)
00135                 return FALSE;
00136         mInfo = info;
00137         mID = info->mID;
00138         setWeight(getDefaultWeight(), FALSE );
00139         return TRUE;
00140 }
00141 
00142 //-----------------------------------------------------------------------------
00143 // parseData()
00144 //-----------------------------------------------------------------------------
00145 BOOL LLViewerVisualParam::parseData(LLXmlTreeNode *node)
00146 {
00147         LLViewerVisualParamInfo* info = new LLViewerVisualParamInfo;
00148 
00149         info->parseXml(node);
00150         if (!setInfo(info))
00151                 return FALSE;
00152         
00153         return TRUE;
00154 }
00155 */

Generated on Thu Jul 1 06:09:34 2010 for Second Life Viewer by  doxygen 1.4.7