예제 #1
0
LLColor4U lggBeamMaps::beamColorFromData(lggBeamsColors data)
{

	F32 r, g, b;
	LLColor4 output;
	LLColor4U toReturn;
	F32 timeinc =  timer.getElapsedTimeF32()*0.3f*((data.rotateSpeed+.01f)) * (360/(data.endHue-data.startHue));

	S32 diference = llround(data.endHue  - data.startHue);
	if(diference == 360 || diference == 720)
	{
		//full rainbow
		//liner one
		hslToRgb(fmod(timeinc,1.0f), 1.0f, 0.5f, r, g, b);

	}else
	{
		F32 variance = ((data.endHue/360.0f)-(data.startHue/360.0f))/2.0f;
		hslToRgb((data.startHue/360.0f) + variance + (sinf(timeinc)*(variance)), 1.0f, 0.5f, r, g, b);
	}
	output.set(r, g, b);

	toReturn.setVecScaleClamp(output);
	return toReturn;

}
예제 #2
0
BOOL LLPartData::pack(LLDataPacker &dp)
{
	LLColor4U coloru;
	dp.packU32(mFlags, "pdflags");
	dp.packFixed(mMaxAge, "pdmaxage", FALSE, 8, 8);
	coloru.setVec(mStartColor);
	dp.packColor4U(coloru, "pdstartcolor");
	coloru.setVec(mEndColor);
	dp.packColor4U(coloru, "pdendcolor");
	dp.packFixed(mStartScale.mV[0], "pdstartscalex", FALSE, 3, 5);
	dp.packFixed(mStartScale.mV[1], "pdstartscaley", FALSE, 3, 5);
	dp.packFixed(mEndScale.mV[0], "pdendscalex", FALSE, 3, 5);
	dp.packFixed(mEndScale.mV[1], "pdendscaley", FALSE, 3, 5);
	return TRUE;
}
예제 #3
0
파일: llcontrol.cpp 프로젝트: Boy/netbook
void LLControlGroup::setColor4U(const LLString& name, const LLColor4U &val)
{
	LLControlBase* control = getControl(name);
	
	if (control && control->isType(TYPE_COL4U))
	{
		control->set(val.getValue());
	}
	else
	{
		CONTROL_ERRS << "Invalid LLColor4 control " << name << llendl;
	}
}
예제 #4
0
void LLControlGroup::setColor4U(const std::string& name, const LLColor4U &val)
{
	LLControlVariable* control = getControl(name);
	
	if (control && control->isType(TYPE_COL4U))
	{
		control->set(val.getValue());
		if(mChangeCallback)
			mChangeCallback(name,llformat("<%f,%f,%f,%f>",val.mV[VX],val.mV[VY],val.mV[VZ],val.mV[VW]));
	}
	else
	{
		CONTROL_ERRS << "Invalid LLColor4 control " << name << llendl;
	}
}
예제 #5
0
// Fill the buffer with a constant color
void LLImageRaw::fill( const LLColor4U& color )
{
	S32 pixels = getWidth() * getHeight();
	if( 4 == getComponents() )
	{
		U32* data = (U32*) getData();
		U32 mColor = color.asRGBA();

		for( S32 i = 0; i < pixels; i++ )
			data[i] = mColor;
	}
	else
	if( 3 == getComponents() )
	{
		U8* data = getData();
		for( S32 i = 0; i < pixels; i++ )
		{
			data[0] = color.mV[0];
			data[1] = color.mV[1];
			data[2] = color.mV[2];
			data += 3;
		}
	}
}
예제 #6
0
// we've switched controls, or doing per-frame update, so update spinners, etc.
void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp)
{
	LLSpinCtrl* spinner1 = getChild<LLSpinCtrl>("val_spinner_1");
	LLSpinCtrl* spinner2 = getChild<LLSpinCtrl>("val_spinner_2");
	LLSpinCtrl* spinner3 = getChild<LLSpinCtrl>("val_spinner_3");
	LLSpinCtrl* spinner4 = getChild<LLSpinCtrl>("val_spinner_4");
	LLColorSwatchCtrl* color_swatch = getChild<LLColorSwatchCtrl>("color_swatch");

	if (!spinner1 || !spinner2 || !spinner3 || !spinner4 || !color_swatch)
	{
		llwarns << "Could not find all desired controls by name"
			<< llendl;
		return;
	}

	spinner1->setVisible(FALSE);
	spinner2->setVisible(FALSE);
	spinner3->setVisible(FALSE);
	spinner4->setVisible(FALSE);
	color_swatch->setVisible(FALSE);
	childSetVisible("val_text", FALSE);
	mComment->setText(LLStringUtil::null);

	if (controlp)
	{
		eControlType type = controlp->type();

		//hide combo box only for non booleans, otherwise this will result in the combo box closing every frame
		childSetVisible("boolean_combo", type == TYPE_BOOLEAN);
		

		mComment->setText(controlp->getComment());
		spinner1->setMaxValue(F32_MAX);
		spinner2->setMaxValue(F32_MAX);
		spinner3->setMaxValue(F32_MAX);
		spinner4->setMaxValue(F32_MAX);
		spinner1->setMinValue(-F32_MAX);
		spinner2->setMinValue(-F32_MAX);
		spinner3->setMinValue(-F32_MAX);
		spinner4->setMinValue(-F32_MAX);
		if (!spinner1->hasFocus())
		{
			spinner1->setIncrement(0.1f);
		}
		if (!spinner2->hasFocus())
		{
			spinner2->setIncrement(0.1f);
		}
		if (!spinner3->hasFocus())
		{
			spinner3->setIncrement(0.1f);
		}
		if (!spinner4->hasFocus())
		{
			spinner4->setIncrement(0.1f);
		}

		LLSD sd = controlp->get();
		switch(type)
		{
		  case TYPE_U32:
			spinner1->setVisible(TRUE);
			spinner1->setLabel(std::string("value")); // Debug, don't translate
			if (!spinner1->hasFocus())
			{
				spinner1->setValue(sd);
				spinner1->setMinValue((F32)U32_MIN);
				spinner1->setMaxValue((F32)U32_MAX);
				spinner1->setIncrement(1.f);
				spinner1->setPrecision(0);
			}
			break;
		  case TYPE_S32:
			spinner1->setVisible(TRUE);
			spinner1->setLabel(std::string("value")); // Debug, don't translate
			if (!spinner1->hasFocus())
			{
				spinner1->setValue(sd);
				spinner1->setMinValue((F32)S32_MIN);
				spinner1->setMaxValue((F32)S32_MAX);
				spinner1->setIncrement(1.f);
				spinner1->setPrecision(0);
			}
			break;
		  case TYPE_F32:
			spinner1->setVisible(TRUE);
			spinner1->setLabel(std::string("value")); // Debug, don't translate
			if (!spinner1->hasFocus())
			{
				spinner1->setPrecision(3);
				spinner1->setValue(sd);
			}
			break;
		  case TYPE_BOOLEAN:
			if (!childHasFocus("boolean_combo"))
			{
				if (sd.asBoolean())
				{
					childSetValue("boolean_combo", LLSD("true"));
				}
				else
				{
					childSetValue("boolean_combo", LLSD(""));
				}
			}
			break;
		  case TYPE_STRING:
			childSetVisible("val_text", TRUE);
			if (!childHasFocus("val_text"))
			{
				childSetValue("val_text", sd);
			}
			break;
		  case TYPE_VEC3:
		  {
			LLVector3 v;
			v.setValue(sd);
			spinner1->setVisible(TRUE);
			spinner1->setLabel(std::string("X"));
			spinner2->setVisible(TRUE);
			spinner2->setLabel(std::string("Y"));
			spinner3->setVisible(TRUE);
			spinner3->setLabel(std::string("Z"));
			if (!spinner1->hasFocus())
			{
				spinner1->setPrecision(3);
				spinner1->setValue(v[VX]);
			}
			if (!spinner2->hasFocus())
			{
				spinner2->setPrecision(3);
				spinner2->setValue(v[VY]);
			}
			if (!spinner3->hasFocus())
			{
				spinner3->setPrecision(3);
				spinner3->setValue(v[VZ]);
			}
			break;
		  }
		  case TYPE_VEC3D:
		  {
			LLVector3d v;
			v.setValue(sd);
			spinner1->setVisible(TRUE);
			spinner1->setLabel(std::string("X"));
			spinner2->setVisible(TRUE);
			spinner2->setLabel(std::string("Y"));
			spinner3->setVisible(TRUE);
			spinner3->setLabel(std::string("Z"));
			if (!spinner1->hasFocus())
			{
				spinner1->setPrecision(3);
				spinner1->setValue(v[VX]);
			}
			if (!spinner2->hasFocus())
			{
				spinner2->setPrecision(3);
				spinner2->setValue(v[VY]);
			}
			if (!spinner3->hasFocus())
			{
				spinner3->setPrecision(3);
				spinner3->setValue(v[VZ]);
			}
			break;
		  }
		  case TYPE_RECT:
		  {
			LLRect r;
			r.setValue(sd);
			spinner1->setVisible(TRUE);
			spinner1->setLabel(std::string("Left"));
			spinner2->setVisible(TRUE);
			spinner2->setLabel(std::string("Right"));
			spinner3->setVisible(TRUE);
			spinner3->setLabel(std::string("Bottom"));
			spinner4->setVisible(TRUE);
			spinner4->setLabel(std::string("Top"));
			if (!spinner1->hasFocus())
			{
				spinner1->setPrecision(0);
				spinner1->setValue(r.mLeft);
			}
			if (!spinner2->hasFocus())
			{
				spinner2->setPrecision(0);
				spinner2->setValue(r.mRight);
			}
			if (!spinner3->hasFocus())
			{
				spinner3->setPrecision(0);
				spinner3->setValue(r.mBottom);
			}
			if (!spinner4->hasFocus())
			{
				spinner4->setPrecision(0);
				spinner4->setValue(r.mTop);
			}

			spinner1->setMinValue((F32)S32_MIN);
			spinner1->setMaxValue((F32)S32_MAX);
			spinner1->setIncrement(1.f);

			spinner2->setMinValue((F32)S32_MIN);
			spinner2->setMaxValue((F32)S32_MAX);
			spinner2->setIncrement(1.f);

			spinner3->setMinValue((F32)S32_MIN);
			spinner3->setMaxValue((F32)S32_MAX);
			spinner3->setIncrement(1.f);

			spinner4->setMinValue((F32)S32_MIN);
			spinner4->setMaxValue((F32)S32_MAX);
			spinner4->setIncrement(1.f);
			break;
		  }
		  case TYPE_COL4:
		  {
			LLColor4 clr;
			clr.setValue(sd);
			color_swatch->setVisible(TRUE);
			// only set if changed so color picker doesn't update
			if(clr != LLColor4(color_swatch->getValue()))
			{
				color_swatch->set(LLColor4(sd), TRUE, FALSE);
			}
			spinner4->setVisible(TRUE);
			spinner4->setLabel(std::string("Alpha"));
			if (!spinner4->hasFocus())
			{
				spinner4->setPrecision(3);
				spinner4->setMinValue(0.0);
				spinner4->setMaxValue(1.f);
				spinner4->setValue(clr.mV[VALPHA]);
			}
			break;
		  }
		  case TYPE_COL3:
		  {
			LLColor3 clr;
			clr.setValue(sd);
			color_swatch->setVisible(TRUE);
			color_swatch->setValue(sd);
			break;
		  }
		  case TYPE_COL4U:
		  {
			LLColor4U clr;
			clr.setValue(sd);
			color_swatch->setVisible(TRUE);
			if(LLColor4(clr) != LLColor4(color_swatch->getValue()))
			{
				color_swatch->set(LLColor4(clr), TRUE, FALSE);
			}
			spinner4->setVisible(TRUE);
			spinner4->setLabel(std::string("Alpha"));
			if(!spinner4->hasFocus())
			{
				spinner4->setPrecision(0);
				spinner4->setValue(clr.mV[VALPHA]);
			}

			spinner4->setMinValue(0);
			spinner4->setMaxValue(255);
			spinner4->setIncrement(1.f);

			break;
		  }
		  default:
			mComment->setText(std::string("unknown"));
			break;
		}
	}

}
void LLVOClouds::getGeometry(S32 idx,
								LLStrider<LLVector4a>& verticesp,
								LLStrider<LLVector3>& normalsp, 
								LLStrider<LLVector2>& texcoordsp,
								LLStrider<LLColor4U>& colorsp, 
								LLStrider<U16>& indicesp)
{

	if (idx >= mCloudGroupp->getNumPuffs())
	{
		return;
	}

	LLDrawable* drawable = mDrawable;
	LLFace *facep = drawable->getFace(idx);

	if (!facep->hasGeometry())
	{
		return;
	}
	

	const LLCloudPuff &puff = mCloudGroupp->getPuff(idx);

	LLColor4 float_color(LLColor3(gSky.getSunDiffuseColor() + gSky.getSunAmbientColor()),puff.getAlpha());
	LLColor4U color;
	color.setVec(float_color);
	facep->setFaceColor(float_color);
	
	U32 vert_offset = facep->getGeomIndex();
		
	LLVector4a part_pos_agent;
	part_pos_agent.load3(facep->mCenterLocal.mV);	
	LLVector4a at;
	at.load3(LLViewerCamera::getInstance()->getAtAxis().mV);
	LLVector4a up(0, 0, 1);
	LLVector4a right;

	right.setCross3(at, up);
	right.normalize3fast();
	up.setCross3(right, at);
	up.normalize3fast();
	right.mul(0.5f*CLOUD_PUFF_WIDTH);
	up.mul(0.5f*CLOUD_PUFF_HEIGHT);
		

	LLVector3 normal(0.f,0.f,-1.f);

	//HACK -- the verticesp->mV[3] = 0.f here are to set the texture index to 0 (particles don't use texture batching, maybe they should)
	// this works because there is actually a 4th float stored after the vertex position which is used as a texture index
	// also, somebody please VECTORIZE THIS

	LLVector4a ppapu;
	LLVector4a ppamu;
	
	ppapu.setAdd(part_pos_agent, up);
	ppamu.setSub(part_pos_agent, up);
	
	verticesp->setSub(ppapu, right);
	(*verticesp++).getF32ptr()[3] = 0.f;
	verticesp->setSub(ppamu, right);
	(*verticesp++).getF32ptr()[3] = 0.f;
	verticesp->setAdd(ppapu, right);
	(*verticesp++).getF32ptr()[3] = 0.f;
	verticesp->setAdd(ppamu, right);
	(*verticesp++).getF32ptr()[3] = 0.f;

	// *verticesp++ = puff_pos_agent - right + up;
	// *verticesp++ = puff_pos_agent - right - up;
	// *verticesp++ = puff_pos_agent + right + up;
	// *verticesp++ = puff_pos_agent + right - up;

	*colorsp++ = color;
	*colorsp++ = color;
	*colorsp++ = color;
	*colorsp++ = color;

	*texcoordsp++ = LLVector2(0.f, 1.f);
	*texcoordsp++ = LLVector2(0.f, 0.f);
	*texcoordsp++ = LLVector2(1.f, 1.f);
	*texcoordsp++ = LLVector2(1.f, 0.f);

	*normalsp++   = normal;
	*normalsp++   = normal;
	*normalsp++   = normal;
	*normalsp++   = normal;

	*indicesp++ = vert_offset + 0;
	*indicesp++ = vert_offset + 1;
	*indicesp++ = vert_offset + 2;

	*indicesp++ = vert_offset + 1;
	*indicesp++ = vert_offset + 3;
	*indicesp++ = vert_offset + 2;
}
예제 #8
0
void LLNetMap::renderPoint(const LLVector3 &pos_local, const LLColor4U &color, 
						   S32 diameter, S32 relative_height)
{
	if (diameter <= 0)
	{
		return;
	}

	const S32 image_width = (S32)mObjectImagep->getWidth();
	const S32 image_height = (S32)mObjectImagep->getHeight();

	S32 x_offset = llround(pos_local.mV[VX] * mObjectMapTPM + image_width / 2);
	S32 y_offset = llround(pos_local.mV[VY] * mObjectMapTPM + image_height / 2);

	if ((x_offset < 0) || (x_offset >= image_width))
	{
		return;
	}
	if ((y_offset < 0) || (y_offset >= image_height))
	{
		return;
	}

	U8 *datap = mObjectRawImagep->getData();

	S32 neg_radius = diameter / 2;
	S32 pos_radius = diameter - neg_radius;
	S32 x, y;

	if (relative_height > 0)
	{
		// ...point above agent
		S32 px, py;

		// vertical line
		px = x_offset;
		for (y = -neg_radius; y < pos_radius; y++)
		{
			py = y_offset + y;
			if ((py < 0) || (py >= image_height))
			{
				continue;
			}
			S32 offset = px + py * image_width;
			((U32*)datap)[offset] = color.asRGBA();
		}

		// top line
		py = y_offset + pos_radius - 1;
		for (x = -neg_radius; x < pos_radius; x++)
		{
			px = x_offset + x;
			if ((px < 0) || (px >= image_width))
			{
				continue;
			}
			S32 offset = px + py * image_width;
			((U32*)datap)[offset] = color.asRGBA();
		}
	}
	else
	{
		// ...point level with agent
		for (x = -neg_radius; x < pos_radius; x++)
		{
			S32 p_x = x_offset + x;
			if ((p_x < 0) || (p_x >= image_width))
			{
				continue;
			}

			for (y = -neg_radius; y < pos_radius; y++)
			{
				S32 p_y = y_offset + y;
				if ((p_y < 0) || (p_y >= image_height))
				{
					continue;
				}
				S32 offset = p_x + p_y * image_width;
				((U32*)datap)[offset] = color.asRGBA();
			}
		}
	}
}
예제 #9
0
void LLVOClouds::getGeometry(S32 te, 
							LLStrider<LLVector3>& verticesp, 
							LLStrider<LLVector3>& normalsp, 
							LLStrider<LLVector2>& texcoordsp, 
							LLStrider<LLColor4U>& colorsp, 
							LLStrider<U16>& indicesp)
{

	if (te >= mCloudGroupp->getNumPuffs())
	{
		return;
	}

	LLDrawable* drawable = mDrawable;
	LLFace *facep = drawable->getFace(te);

	if (!facep->hasGeometry())
	{
		return;
	}
	
	LLVector3 normal(0.f,0.f,-1.f);

	const LLCloudPuff &puff = mCloudGroupp->getPuff(te);
	S32 index_offset = facep->getGeomIndex();
	LLColor4 float_color(LLColor3(gSky.getSunDiffuseColor() + gSky.getSunAmbientColor()),puff.getAlpha());
	LLColor4U color;
	color.setVec(float_color);
	facep->setFaceColor(float_color);
		
	
	LLVector3 up;
	LLVector3 right;
	LLVector3 at;

	const LLVector3& puff_pos_agent = facep->mCenterLocal;
	LLVector2 uvs[4];

	uvs[0].setVec(0.f, 1.f);
	uvs[1].setVec(0.f, 0.f);
	uvs[2].setVec(1.f, 1.f);
	uvs[3].setVec(1.f, 0.f);

	LLVector3 vtx[4];

	at = LLViewerCamera::getInstance()->getAtAxis();
	right = at % LLVector3(0.f, 0.f, 1.f);
	right.normVec();
	up = right % at;
	up.normVec();
	right *= 0.5f*CLOUD_PUFF_WIDTH;
	up *= 0.5f*CLOUD_PUFF_HEIGHT;;
		
	*colorsp++ = color;
	*colorsp++ = color;
	*colorsp++ = color;
	*colorsp++ = color;

	vtx[0] = puff_pos_agent - right + up;
	vtx[1] = puff_pos_agent - right - up;
	vtx[2] = puff_pos_agent + right + up;
	vtx[3] = puff_pos_agent + right - up;

	verticesp->mV[3] = 0.f;
	*verticesp++  = vtx[0];
	verticesp->mV[3] = 0.f;
	*verticesp++  = vtx[1];
	verticesp->mV[3] = 0.f;
	*verticesp++  = vtx[2];
	verticesp->mV[3] = 0.f;
	*verticesp++  = vtx[3];

	*texcoordsp++ = uvs[0];
	*texcoordsp++ = uvs[1];
	*texcoordsp++ = uvs[2];
	*texcoordsp++ = uvs[3];

	*normalsp++   = normal;
	*normalsp++   = normal;
	*normalsp++   = normal;
	*normalsp++   = normal;

	*indicesp++ = index_offset + 0;
	*indicesp++ = index_offset + 1;
	*indicesp++ = index_offset + 2;

	*indicesp++ = index_offset + 1;
	*indicesp++ = index_offset + 3;
	*indicesp++ = index_offset + 2;
}
예제 #10
0
파일: llcontrol.cpp 프로젝트: Boy/netbook
// Returns number of controls loaded, so 0 if failure
U32 LLControlGroup::loadFromFile(const LLString& filename, BOOL require_declaration, eControlType declare_as)
{
	LLString name;

	LLXmlTree xml_controls;

	if (!xml_controls.parseFile(filename))
	{
		llwarns << "Unable to open control file " << filename << llendl;
		return 0;
	}

	LLXmlTreeNode* rootp = xml_controls.getRoot();
	if (!rootp || !rootp->hasAttribute("version"))
	{
		llwarns << "No valid settings header found in control file " << filename << llendl;
		return 0;
	}

	U32		item = 0;
	U32		validitems = 0;
	S32 version;
	
	rootp->getAttributeS32("version", version);

	// Check file version
	if (version != CURRENT_VERSION)
	{
		llinfos << filename << " does not appear to be a version " << CURRENT_VERSION << " controls file" << llendl;
		return 0;
	}

	LLXmlTreeNode* child_nodep = rootp->getFirstChild();
	while(child_nodep)
	{
		name = child_nodep->getName();		
		
		BOOL declared = controlExists(name);

		if (require_declaration && !declared)
		{
			// Declaration required, but this name not declared.
			// Complain about non-empty names.
			if (!name.empty())
			{
				//read in to end of line
				llwarns << "LLControlGroup::loadFromFile() : Trying to set \"" << name << "\", setting doesn't exist." << llendl;
			}
			child_nodep = rootp->getNextChild();
			continue;
		}

		// Got an item.  Load it up.
		item++;

		// If not declared, assume it's a string
		if (!declared)
		{
			switch(declare_as)
			{
			case TYPE_COL4:
				declareColor4(name, LLColor4::white, "", NO_PERSIST);
				break;
			case TYPE_COL4U:
				declareColor4U(name, LLColor4U::white, "", NO_PERSIST);
				break;
			case TYPE_STRING:
			default:
				declareString(name, LLString::null, "", NO_PERSIST);
				break;
			}
		}

		// Control name has been declared in code.
		LLControlBase *control = getControl(name);

		llassert(control);

		mLoadedSettings.insert(name);
		
		switch(control->mType)
		{
		case TYPE_F32:
			{
				F32 initial = 0.f;

				child_nodep->getAttributeF32("value", initial);

				control->set(initial);
				validitems++;
			}
			break;
		case TYPE_S32:
			{
				S32 initial = 0;

				child_nodep->getAttributeS32("value", initial);

				control->set(initial);
				validitems++;
			}
			break;
		case TYPE_U32:
			{
				U32 initial = 0;
				child_nodep->getAttributeU32("value", initial);
				control->set((LLSD::Integer) initial);
				validitems++;
			}
			break;
		case TYPE_BOOLEAN:
			{
				BOOL initial = FALSE;

				child_nodep->getAttributeBOOL("value", initial);
				control->set(initial);

				validitems++;
			}
			break;
		case TYPE_STRING:
			{
				LLString string;
				child_nodep->getAttributeString("value", string);
				if (string == LLString::null)
				{
					string = "";
				}
				control->set(string);
				validitems++;
			}
			break;
		case TYPE_VEC3:
			{
				LLVector3 vector;

				child_nodep->getAttributeVector3("value", vector);
				control->set(vector.getValue());
				validitems++;
			}
			break;
		case TYPE_VEC3D:
			{
				LLVector3d vector;

				child_nodep->getAttributeVector3d("value", vector);

				control->set(vector.getValue());
				validitems++;
			}
			break;
		case TYPE_RECT:
			{
				//RN: hack to support reading rectangles from a string
				LLString rect_string;

				child_nodep->getAttributeString("value", rect_string);
				std::istringstream istream(rect_string);
				S32 left, bottom, width, height;

				istream >> left >> bottom >> width >> height;

				LLRect rect;
				rect.setOriginAndSize(left, bottom, width, height);

				control->set(rect.getValue());
				validitems++;
			}
			break;
		case TYPE_COL4U:
			{
				LLColor4U color;

				child_nodep->getAttributeColor4U("value", color);
				control->set(color.getValue());
				validitems++;
			}
			break;
		case TYPE_COL4:
			{
				LLColor4 color;
				
				child_nodep->getAttributeColor4("value", color);
				control->set(color.getValue());
				validitems++;
			}
			break;
		case TYPE_COL3:
			{
				LLVector3 color;
				
				child_nodep->getAttributeVector3("value", color);
                control->set(LLColor3(color.mV).getValue());
				validitems++;
			}
			break;
		}

		child_nodep = rootp->getNextChild();
	}

	return validitems;
}
예제 #11
0
파일: llcontrol.cpp 프로젝트: Boy/netbook
U32 LLControlGroup::loadFromFileLegacy(const LLString& filename, BOOL require_declaration, eControlType declare_as)
{
	U32		item = 0;
	U32		validitems = 0;
	llifstream file;
	S32 version;
	
	file.open(filename.c_str());		/*Flawfinder: ignore*/ 

	if (!file)
	{
		llinfos << "LLControlGroup::loadFromFile unable to open." << llendl;
		return 0;
	}

	// Check file version
	LLString name;
	file >> name;
	file >> version;
	if (name != "version" || version != CURRENT_VERSION)
	{
		llinfos << filename << " does not appear to be a version " << CURRENT_VERSION << " controls file" << llendl;
		return 0;
	}

	while (!file.eof())
	{
		file >> name;
		
		if (name.empty())
		{
			continue;
		}

		if (name.substr(0,2) == "//")
		{
			// This is a comment.
			char buffer[MAX_STRING];		/*Flawfinder: ignore*/
			file.getline(buffer, MAX_STRING);
			continue;
		}

		BOOL declared = mNameTable.find(name) != mNameTable.end();

		if (require_declaration && !declared)
		{
			// Declaration required, but this name not declared.
			// Complain about non-empty names.
			if (!name.empty())
			{
				//read in to end of line
				char buffer[MAX_STRING];		/*Flawfinder: ignore*/
				file.getline(buffer, MAX_STRING);
				llwarns << "LLControlGroup::loadFromFile() : Trying to set \"" << name << "\", setting doesn't exist." << llendl;
			}
			continue;
		}

		// Got an item.  Load it up.
		item++;

		// If not declared, assume it's a string
		if (!declared)
		{
			switch(declare_as)
			{
			case TYPE_COL4:
				declareColor4(name, LLColor4::white, LLString::null, NO_PERSIST);
				break;
			case TYPE_COL4U:
				declareColor4U(name, LLColor4U::white, LLString::null, NO_PERSIST);
				break;
			case TYPE_STRING:
			default:
				declareString(name, LLString::null, LLString::null, NO_PERSIST);
				break;
			}
		}

		// Control name has been declared in code.
		LLControlBase *control = getControl(name);

		llassert(control);

		mLoadedSettings.insert(name);
		
		switch(control->mType)
		{
		case TYPE_F32:
			{
				F32 initial;

				file >> initial;

				control->set(initial);
				validitems++;
			}
			break;
		case TYPE_S32:
			{
				S32 initial;

				file >> initial;

				control->set(initial);
				validitems++;
			}
			break;
		case TYPE_U32:
			{
				U32 initial;

				file >> initial;
				control->set((LLSD::Integer) initial);
				validitems++;
			}
			break;
		case TYPE_BOOLEAN:
			{
				char boolstring[256];		/*Flawfinder: ignore*/
				BOOL valid = FALSE;
				BOOL initial = FALSE;

				file >> boolstring;
				if (!strcmp("TRUE", boolstring))
				{
					initial = TRUE;
					valid = TRUE;
				}
				else if (!strcmp("FALSE", boolstring))
				{
					initial = FALSE;
					valid = TRUE;
				}

				if (valid)
				{
					control->set(initial);
				}
				else
				{
					llinfos << filename << "Item " << item << ": Invalid BOOL control " << name << ", " << boolstring << llendl; 
				}

				validitems++;
			}
			break;
		case TYPE_STRING:
			{
				LLString string;
				
				file >> string;
				
				control->set(string);
				validitems++;
			}
			break;
		case TYPE_VEC3:
			{
				F32 x, y, z;

				file >> x >> y >> z;

				LLVector3 vector(x, y, z);

				control->set(vector.getValue());
				validitems++;
			}
			break;
		case TYPE_VEC3D:
			{
				F64 x, y, z;

				file >> x >> y >> z;

				LLVector3d vector(x, y, z);

				control->set(vector.getValue());
				validitems++;
			}
			break;
		case TYPE_RECT:
			{
				S32 left, bottom, width, height;

				file >> left >> bottom >> width >> height;

				LLRect rect;
				rect.setOriginAndSize(left, bottom, width, height);

				control->set(rect.getValue());
				validitems++;
			}
			break;
		case TYPE_COL4U:
			{
				S32 red, green, blue, alpha;
				LLColor4U color;
				file >> red >> green >> blue >> alpha;
				color.setVec(red, green, blue, alpha);
				control->set(color.getValue());
				validitems++;
			}
			break;
		case TYPE_COL4:
			{
				LLColor4 color;
				file >> color.mV[VRED] >> color.mV[VGREEN]
					 >> color.mV[VBLUE] >> color.mV[VALPHA];
				control->set(color.getValue());
				validitems++;
			}
			break;
		case TYPE_COL3:
			{
				LLColor3 color;
				file >> color.mV[VRED] >> color.mV[VGREEN]
					 >> color.mV[VBLUE];
				control->set(color.getValue());
				validitems++;
			}
			break;
		}
	}

	file.close();

	return validitems;
}
예제 #12
0
파일: llcontrol.cpp 프로젝트: Boy/netbook
BOOL LLControlGroup::declareColor4U(const LLString& name, const LLColor4U &initial_val, const LLString& comment, BOOL persist )
{
	return declareControl(name, TYPE_COL4U, initial_val.getValue(), comment, persist);
}
// we've switched controls, or doing per-frame update, so update spinners, etc.
void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp)
{
	LLSpinCtrl* spinner1 = getChild<LLSpinCtrl>("val_spinner_1");
	LLSpinCtrl* spinner2 = getChild<LLSpinCtrl>("val_spinner_2");
	LLSpinCtrl* spinner3 = getChild<LLSpinCtrl>("val_spinner_3");
	LLSpinCtrl* spinner4 = getChild<LLSpinCtrl>("val_spinner_4");
	LLColorSwatchCtrl* color_swatch = getChild<LLColorSwatchCtrl>("color_swatch");

	if (!spinner1 || !spinner2 || !spinner3 || !spinner4 || !color_swatch)
	{
		llwarns << "Could not find all desired controls by name"
			<< llendl;
		return;
	}

	spinner1->setVisible(FALSE);
	spinner2->setVisible(FALSE);
	spinner3->setVisible(FALSE);
	spinner4->setVisible(FALSE);
	color_swatch->setVisible(FALSE);
	childSetVisible("val_text", FALSE);
	mComment->setText(LLStringUtil::null);

	if (controlp)
	{
// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) | Modified: RLVa-0.2.1d
		if (rlv_handler_t::isEnabled())
		{
			// Don't allow changing DBG_WRITE debug settings under @setdebug=n
			bool fEnable = !( (gRlvHandler.hasBehaviour(RLV_BHVR_SETDEBUG)) && 
				(RlvExtGetSet::getDebugSettingFlags(controlp->getName()) & RlvExtGetSet::DBG_WRITE) );
			// Don't allow toggling "Basic Shaders" and/or "Atmopsheric Shaders" through the debug settings under @setenv=n
			fEnable &= !((gRlvHandler.hasBehaviour(RLV_BHVR_SETENV)) && 
				(("VertexShaderEnable" == controlp->getName()) || ("WindLightUseAtmosShaders" == controlp->getName())));
			#ifdef RLV_EXTENSION_STARTLOCATION
				// Don't allow toggling RLVaLoginLastLocation
				fEnable &= !(RLV_SETTING_LOGINLASTLOCATION == controlp->getName());
			#endif // RLV_EXTENSION_STARTLOCATION

			// NOTE: this runs per-frame so there's no need to explictly handle onCommitSettings() or onClickDefault()
			spinner1->setEnabled(fEnable);
			spinner2->setEnabled(fEnable);
			spinner3->setEnabled(fEnable);
			spinner4->setEnabled(fEnable);
			color_swatch->setEnabled(fEnable);
			childSetEnabled("val_text", fEnable);
			childSetEnabled("boolean_combo", fEnable);
			childSetEnabled("default_btn", fEnable);
		}
// [/RLVa:KB]

		controlp = controlp->getCOAActive();
		eControlType type = controlp->type();

		//hide combo box only for non booleans, otherwise this will result in the combo box closing every frame
		childSetVisible("boolean_combo", type == TYPE_BOOLEAN);
		

		mComment->setText(controlp->getComment());
		spinner1->setMaxValue(F32_MAX);
		spinner2->setMaxValue(F32_MAX);
		spinner3->setMaxValue(F32_MAX);
		spinner4->setMaxValue(F32_MAX);
		spinner1->setMinValue(-F32_MAX);
		spinner2->setMinValue(-F32_MAX);
		spinner3->setMinValue(-F32_MAX);
		spinner4->setMinValue(-F32_MAX);
		if (!spinner1->hasFocus())
		{
			spinner1->setIncrement(0.1f);
		}
		if (!spinner2->hasFocus())
		{
			spinner2->setIncrement(0.1f);
		}
		if (!spinner3->hasFocus())
		{
			spinner3->setIncrement(0.1f);
		}
		if (!spinner4->hasFocus())
		{
			spinner4->setIncrement(0.1f);
		}

		LLSD sd = controlp->get();
		switch(type)
		{
		  case TYPE_U32:
			spinner1->setVisible(TRUE);
			spinner1->setLabel(std::string("value")); // Debug, don't translate
			if (!spinner1->hasFocus())
			{
				spinner1->setValue(sd);
				spinner1->setMinValue((F32)U32_MIN);
				spinner1->setMaxValue((F32)U32_MAX);
				spinner1->setIncrement(1.f);
				spinner1->setPrecision(0);
			}
			break;
		  case TYPE_S32:
			spinner1->setVisible(TRUE);
			spinner1->setLabel(std::string("value")); // Debug, don't translate
			if (!spinner1->hasFocus())
			{
				spinner1->setValue(sd);
				spinner1->setMinValue((F32)S32_MIN);
				spinner1->setMaxValue((F32)S32_MAX);
				spinner1->setIncrement(1.f);
				spinner1->setPrecision(0);
			}
			break;
		  case TYPE_F32:
			spinner1->setVisible(TRUE);
			spinner1->setLabel(std::string("value")); // Debug, don't translate
			if (!spinner1->hasFocus())
			{
				spinner1->setPrecision(3);
				spinner1->setValue(sd);
			}
			break;
		  case TYPE_BOOLEAN:
			if (!childHasFocus("boolean_combo"))
			{
				if (sd.asBoolean())
				{
					childSetValue("boolean_combo", LLSD("true"));
				}
				else
				{
					childSetValue("boolean_combo", LLSD(""));
				}
			}
			break;
		  case TYPE_STRING:
			childSetVisible("val_text", TRUE);
			if (!childHasFocus("val_text"))
			{
				childSetValue("val_text", sd);
			}
			break;
		  case TYPE_VEC3:
		  {
			LLVector3 v;
			v.setValue(sd);
			spinner1->setVisible(TRUE);
			spinner1->setLabel(std::string("X"));
			spinner2->setVisible(TRUE);
			spinner2->setLabel(std::string("Y"));
			spinner3->setVisible(TRUE);
			spinner3->setLabel(std::string("Z"));
			if (!spinner1->hasFocus())
			{
				spinner1->setPrecision(3);
				spinner1->setValue(v[VX]);
			}
			if (!spinner2->hasFocus())
			{
				spinner2->setPrecision(3);
				spinner2->setValue(v[VY]);
			}
			if (!spinner3->hasFocus())
			{
				spinner3->setPrecision(3);
				spinner3->setValue(v[VZ]);
			}
			break;
		  }
		  case TYPE_VEC3D:
		  {
			LLVector3d v;
			v.setValue(sd);
			spinner1->setVisible(TRUE);
			spinner1->setLabel(std::string("X"));
			spinner2->setVisible(TRUE);
			spinner2->setLabel(std::string("Y"));
			spinner3->setVisible(TRUE);
			spinner3->setLabel(std::string("Z"));
			if (!spinner1->hasFocus())
			{
				spinner1->setPrecision(3);
				spinner1->setValue(v[VX]);
			}
			if (!spinner2->hasFocus())
			{
				spinner2->setPrecision(3);
				spinner2->setValue(v[VY]);
			}
			if (!spinner3->hasFocus())
			{
				spinner3->setPrecision(3);
				spinner3->setValue(v[VZ]);
			}
			break;
		  }
		  case TYPE_RECT:
		  {
			LLRect r;
			r.setValue(sd);
			spinner1->setVisible(TRUE);
			spinner1->setLabel(std::string("Left"));
			spinner2->setVisible(TRUE);
			spinner2->setLabel(std::string("Right"));
			spinner3->setVisible(TRUE);
			spinner3->setLabel(std::string("Bottom"));
			spinner4->setVisible(TRUE);
			spinner4->setLabel(std::string("Top"));
			if (!spinner1->hasFocus())
			{
				spinner1->setPrecision(0);
				spinner1->setValue(r.mLeft);
			}
			if (!spinner2->hasFocus())
			{
				spinner2->setPrecision(0);
				spinner2->setValue(r.mRight);
			}
			if (!spinner3->hasFocus())
			{
				spinner3->setPrecision(0);
				spinner3->setValue(r.mBottom);
			}
			if (!spinner4->hasFocus())
			{
				spinner4->setPrecision(0);
				spinner4->setValue(r.mTop);
			}

			spinner1->setMinValue((F32)S32_MIN);
			spinner1->setMaxValue((F32)S32_MAX);
			spinner1->setIncrement(1.f);

			spinner2->setMinValue((F32)S32_MIN);
			spinner2->setMaxValue((F32)S32_MAX);
			spinner2->setIncrement(1.f);

			spinner3->setMinValue((F32)S32_MIN);
			spinner3->setMaxValue((F32)S32_MAX);
			spinner3->setIncrement(1.f);

			spinner4->setMinValue((F32)S32_MIN);
			spinner4->setMaxValue((F32)S32_MAX);
			spinner4->setIncrement(1.f);
			break;
		  }
		  case TYPE_COL4:
		  {
			LLColor4 clr;
			clr.setValue(sd);
			color_swatch->setVisible(TRUE);
			// only set if changed so color picker doesn't update
			if(clr != LLColor4(color_swatch->getValue()))
			{
				color_swatch->set(LLColor4(sd), TRUE, FALSE);
			}
			spinner4->setVisible(TRUE);
			spinner4->setLabel(std::string("Alpha"));
			if (!spinner4->hasFocus())
			{
				spinner4->setPrecision(3);
				spinner4->setMinValue(0.0);
				spinner4->setMaxValue(1.f);
				spinner4->setValue(clr.mV[VALPHA]);
			}
			break;
		  }
		  case TYPE_COL3:
		  {
			LLColor3 clr;
			clr.setValue(sd);
			color_swatch->setVisible(TRUE);
			color_swatch->setValue(sd);
			break;
		  }
		  case TYPE_COL4U:
		  {
			LLColor4U clr;
			clr.setValue(sd);
			color_swatch->setVisible(TRUE);
			if(LLColor4(clr) != LLColor4(color_swatch->getValue()))
			{
				color_swatch->set(LLColor4(clr), TRUE, FALSE);
			}
			spinner4->setVisible(TRUE);
			spinner4->setLabel(std::string("Alpha"));
			if(!spinner4->hasFocus())
			{
				spinner4->setPrecision(0);
				spinner4->setValue(clr.mV[VALPHA]);
			}

			spinner4->setMinValue(0);
			spinner4->setMaxValue(255);
			spinner4->setIncrement(1.f);

			break;
		  }
		  default:
			mComment->setText(std::string("unknown"));
			break;
		}
	}

}
예제 #14
0
template <> eControlType get_control_type<LLColor4U>(const LLColor4U& in, LLSD& out) 
{ 
	out = in.getValue();
	return TYPE_COL4U; 
}
예제 #15
0
template <> LLSD convert_to_llsd<LLColor4U>(const LLColor4U& in)
{
    return in.getValue();
}
예제 #16
0
// we've switched controls, so update spinners, etc.
void LLFloaterSettingsDebug::updateControl()
{
    LLSpinCtrl* spinner1 = getChild<LLSpinCtrl>("val_spinner_1");
    LLSpinCtrl* spinner2 = getChild<LLSpinCtrl>("val_spinner_2");
    LLSpinCtrl* spinner3 = getChild<LLSpinCtrl>("val_spinner_3");
    LLSpinCtrl* spinner4 = getChild<LLSpinCtrl>("val_spinner_4");
    LLColorSwatchCtrl* color_swatch = getChild<LLColorSwatchCtrl>("val_color_swatch");
    LLUICtrl* bool_ctrl = getChild<LLUICtrl>("boolean_combo");

    if (!spinner1 || !spinner2 || !spinner3 || !spinner4 || !color_swatch)
    {
        llwarns << "Could not find all desired controls by name"
                << llendl;
        return;
    }

    spinner1->setVisible(FALSE);
    spinner2->setVisible(FALSE);
    spinner3->setVisible(FALSE);
    spinner4->setVisible(FALSE);
    color_swatch->setVisible(FALSE);
    getChildView("val_text")->setVisible( FALSE);
    mComment->setText(LLStringUtil::null);
    childSetEnabled("copy_btn", false);
    childSetEnabled("default_btn", false);
    bool_ctrl->setVisible(false);

    if (mCurrentControlVariable)
    {
// [RLVa:KB] - Checked: 2011-05-28 (RLVa-1.4.0a) | Modified: RLVa-1.4.0a
        // If "HideFromEditor" was toggled while the floater is open then we need to manually disable access to the control
        mOldVisibility = mCurrentControlVariable->isHiddenFromSettingsEditor();
        spinner1->setEnabled(!mOldVisibility);
        spinner2->setEnabled(!mOldVisibility);
        spinner3->setEnabled(!mOldVisibility);
        spinner4->setEnabled(!mOldVisibility);
        color_swatch->setEnabled(!mOldVisibility);
        childSetEnabled("val_text", !mOldVisibility);
        bool_ctrl->setEnabled(!mOldVisibility);
        childSetEnabled("default_btn", !mOldVisibility);
// [/RLVa:KB]

        childSetEnabled("copy_btn", true);

        eControlType type = mCurrentControlVariable->type();

        mComment->setText(mCurrentControlVariable->getName() + std::string(": ") + mCurrentControlVariable->getComment());

        spinner1->setMaxValue(F32_MAX);
        spinner2->setMaxValue(F32_MAX);
        spinner3->setMaxValue(F32_MAX);
        spinner4->setMaxValue(F32_MAX);
        spinner1->setMinValue(-F32_MAX);
        spinner2->setMinValue(-F32_MAX);
        spinner3->setMinValue(-F32_MAX);
        spinner4->setMinValue(-F32_MAX);
        if (!spinner1->hasFocus())
        {
            spinner1->setIncrement(0.1f);
        }
        if (!spinner2->hasFocus())
        {
            spinner2->setIncrement(0.1f);
        }
        if (!spinner3->hasFocus())
        {
            spinner3->setIncrement(0.1f);
        }
        if (!spinner4->hasFocus())
        {
            spinner4->setIncrement(0.1f);
        }

        LLSD sd = mCurrentControlVariable->get();
        switch(type)
        {
        case TYPE_U32:
            spinner1->setVisible(TRUE);
            spinner1->setLabel(std::string("value")); // Debug, don't translate
            if (!spinner1->hasFocus())
            {
                spinner1->setValue(sd);
                spinner1->setMinValue((F32)U32_MIN);
                spinner1->setMaxValue((F32)U32_MAX);
                spinner1->setIncrement(1.f);
                spinner1->setPrecision(0);
            }
            break;
        case TYPE_S32:
            spinner1->setVisible(TRUE);
            spinner1->setLabel(std::string("value")); // Debug, don't translate
            if (!spinner1->hasFocus())
            {
                spinner1->setValue(sd);
                spinner1->setMinValue((F32)S32_MIN);
                spinner1->setMaxValue((F32)S32_MAX);
                spinner1->setIncrement(1.f);
                spinner1->setPrecision(0);
            }
            break;
        case TYPE_F32:
            spinner1->setVisible(TRUE);
            spinner1->setLabel(std::string("value")); // Debug, don't translate
            if (!spinner1->hasFocus())
            {
                spinner1->setPrecision(3);
                spinner1->setValue(sd);
            }
            break;
        case TYPE_BOOLEAN:
            bool_ctrl->setVisible(true);
            if (!bool_ctrl->hasFocus())
            {
                if (sd.asBoolean())
                {
                    bool_ctrl->setValue(LLSD("TRUE"));
                }
                else
                {
                    bool_ctrl->setValue(LLSD("FALSE"));
                }
            }
            break;
        case TYPE_STRING:
            getChildView("val_text")->setVisible( TRUE);
            if (!getChild<LLUICtrl>("val_text")->hasFocus())
            {
                getChild<LLUICtrl>("val_text")->setValue(sd);
            }
            break;
        case TYPE_VEC3:
        {
            LLVector3 v;
            v.setValue(sd);
            spinner1->setVisible(TRUE);
            spinner1->setLabel(std::string("X"));
            spinner2->setVisible(TRUE);
            spinner2->setLabel(std::string("Y"));
            spinner3->setVisible(TRUE);
            spinner3->setLabel(std::string("Z"));
            if (!spinner1->hasFocus())
            {
                spinner1->setPrecision(3);
                spinner1->setValue(v[VX]);
            }
            if (!spinner2->hasFocus())
            {
                spinner2->setPrecision(3);
                spinner2->setValue(v[VY]);
            }
            if (!spinner3->hasFocus())
            {
                spinner3->setPrecision(3);
                spinner3->setValue(v[VZ]);
            }
            break;
        }
        case TYPE_VEC3D:
        {
            LLVector3d v;
            v.setValue(sd);
            spinner1->setVisible(TRUE);
            spinner1->setLabel(std::string("X"));
            spinner2->setVisible(TRUE);
            spinner2->setLabel(std::string("Y"));
            spinner3->setVisible(TRUE);
            spinner3->setLabel(std::string("Z"));
            if (!spinner1->hasFocus())
            {
                spinner1->setPrecision(3);
                spinner1->setValue(v[VX]);
            }
            if (!spinner2->hasFocus())
            {
                spinner2->setPrecision(3);
                spinner2->setValue(v[VY]);
            }
            if (!spinner3->hasFocus())
            {
                spinner3->setPrecision(3);
                spinner3->setValue(v[VZ]);
            }
            break;
        }
        case TYPE_RECT:
        {
            LLRect r;
            r.setValue(sd);
            spinner1->setVisible(TRUE);
            spinner1->setLabel(std::string("Left"));
            spinner2->setVisible(TRUE);
            spinner2->setLabel(std::string("Right"));
            spinner3->setVisible(TRUE);
            spinner3->setLabel(std::string("Bottom"));
            spinner4->setVisible(TRUE);
            spinner4->setLabel(std::string("Top"));
            if (!spinner1->hasFocus())
            {
                spinner1->setPrecision(0);
                spinner1->setValue(r.mLeft);
            }
            if (!spinner2->hasFocus())
            {
                spinner2->setPrecision(0);
                spinner2->setValue(r.mRight);
            }
            if (!spinner3->hasFocus())
            {
                spinner3->setPrecision(0);
                spinner3->setValue(r.mBottom);
            }
            if (!spinner4->hasFocus())
            {
                spinner4->setPrecision(0);
                spinner4->setValue(r.mTop);
            }

            spinner1->setMinValue((F32)S32_MIN);
            spinner1->setMaxValue((F32)S32_MAX);
            spinner1->setIncrement(1.f);

            spinner2->setMinValue((F32)S32_MIN);
            spinner2->setMaxValue((F32)S32_MAX);
            spinner2->setIncrement(1.f);

            spinner3->setMinValue((F32)S32_MIN);
            spinner3->setMaxValue((F32)S32_MAX);
            spinner3->setIncrement(1.f);

            spinner4->setMinValue((F32)S32_MIN);
            spinner4->setMaxValue((F32)S32_MAX);
            spinner4->setIncrement(1.f);
            break;
        }
        case TYPE_COL4:
        {
            LLColor4 clr;
            clr.setValue(sd);
            color_swatch->setVisible(TRUE);
            // only set if changed so color picker doesn't update
            if(clr != LLColor4(color_swatch->getValue()))
            {
                color_swatch->set(LLColor4(sd), TRUE, FALSE);
            }
            spinner4->setVisible(TRUE);
            spinner4->setLabel(std::string("Alpha"));
            if (!spinner4->hasFocus())
            {
                spinner4->setPrecision(3);
                spinner4->setMinValue(0.0);
                spinner4->setMaxValue(1.f);
                spinner4->setValue(clr.mV[VALPHA]);
            }
            break;
        }
        case TYPE_COL3:
        {
            LLColor3 clr;
            clr.setValue(sd);
            color_swatch->setVisible(TRUE);
            color_swatch->setValue(sd);
            break;
        }
        case TYPE_COL4U:
        {
            LLColor4U clr;
            clr.setValue(sd);
            color_swatch->setVisible(TRUE);
            if(LLColor4(clr) != LLColor4(color_swatch->getValue()))
            {
                color_swatch->set(LLColor4(clr), TRUE, FALSE);
            }
            spinner4->setVisible(TRUE);
            spinner4->setLabel(std::string("Alpha"));
            if(!spinner4->hasFocus())
            {
                spinner4->setPrecision(0);
                spinner4->setValue(clr.mV[VALPHA]);
            }

            spinner4->setMinValue(0);
            spinner4->setMaxValue(255);
            spinner4->setIncrement(1.f);

            break;
        }
        default:
            mComment->setText(std::string("unknown"));
            break;
        }
    }

}