Should be able to save QColor based QVariant too.

--HG--
branch : gsoc2013-dfighter
hg/feature/gsoc2013-dfighter
dfighter1985 12 years ago
parent c8147b301c
commit fb3f069a38

@ -245,6 +245,10 @@ namespace NLMISC
void CVariant::fromString( const std::string &s, EVarType t ) void CVariant::fromString( const std::string &s, EVarType t )
{ {
type = t;
sval = "";
std::fill( uvalue.vval, uvalue.vval + VARIANT_VVAL_END, 0.0 );
if( s.empty() ) if( s.empty() )
return; return;
@ -282,7 +286,6 @@ namespace NLMISC
case Vector4: case Vector4:
{ {
std::fill( uvalue.vval, uvalue.vval + VARIANT_VVAL_END, 0.0 );
std::stringstream ss = s; std::stringstream ss = s;
for( int i = 0; i < 4; i++ ) for( int i = 0; i < 4; i++ )
@ -297,7 +300,6 @@ namespace NLMISC
case Matrix4: case Matrix4:
{ {
std::fill( uvalue.vval, uvalue.vval + VARIANT_VVAL_END, 0.0 );
std::stringstream ss = s; std::stringstream ss = s;
for( int i = 0; i < 16; i++ ) for( int i = 0; i < 16; i++ )
@ -310,8 +312,6 @@ namespace NLMISC
} }
} }
type = t;
} }
} }

@ -287,6 +287,15 @@ namespace MaterialEditor
{ {
QString label = p->propertyName(); QString label = p->propertyName();
std::string value = p->valueText().toUtf8().data(); std::string value = p->valueText().toUtf8().data();
if( v.type() == QVariant::Color )
{
QColor c = v.value< QColor >();
value.clear();
QString val = "%1 %2 %3 %4";
val = val.arg( c.red() ).arg( c.green() ).arg( c.blue() ).arg( c.alpha() );
value = val.toUtf8().data();
}
CNelMaterialProxy m = nel3dIface->getMaterial(); CNelMaterialProxy m = nel3dIface->getMaterial();
CRenderPassProxy pass = m.getPass( currentPass.toUtf8().data() ); CRenderPassProxy pass = m.getPass( currentPass.toUtf8().data() );

Loading…
Cancel
Save