Пример #1
0
        public void SetFieldValueSTR(string name, string value, string x3dType)
        {
            if (HasErrors)
            {
                return;
            }

            object v;
            Type   type;

            v = X3DTypeConverters.StringToX3DSimpleTypeInstance(value, x3dType, out type);

            if (type == typeof(int))
            {
                SetFieldValue(name, (int)v);
            }
            if (type == typeof(float))
            {
                SetFieldValue(name, (float)v);
            }
            if (type == typeof(Vector3))
            {
                SetFieldValue(name, (Vector3)v);
            }
            if (type == typeof(Vector4))
            {
                SetFieldValue(name, (Vector4)v);
            }
            if (type == typeof(Matrix3))
            {
                Matrix3 m = (Matrix3)v;
                SetFieldValue(name, ref m);
            }
            if (type == typeof(Matrix4))
            {
                Matrix4 m = (Matrix4)v;
                SetFieldValue(name, ref m);
            }
        }