Пример #1
0
void AttrWidgetVectorFloat::Refresh(const XMLAttribute &attribute)
{
    AttributeWidget::Refresh(attribute);

    XMLAttribute::Type attrType = attribute.GetType();

    Array<float> vf;
    if (attrType == XMLAttribute::Type::Float)
    {
        float v = attribute.GetFloat();
        vf = {v};
    }
    else if (attrType == XMLAttribute::Type::Vector2)
    {
        Vector2 v = attribute.GetVector2();
        vf = {v.x, v.y};
    }
    else if (attrType == XMLAttribute::Type::Vector3)
    {
        Vector3 v = attribute.GetVector3();
        vf = {v.x, v.y, v.z};
    }
    else if (attrType == XMLAttribute::Type::Vector4 ||
             attrType == XMLAttribute::Type::Quaternion ||
             attrType == XMLAttribute::Type::Rect)
    {
        Vector4 v = attribute.GetVector4();
        vf = {v.x, v.y, v.z, v.w};
    }

    SetValue(vf);
}