예제 #1
0
        private static void GetValues(this HoudiniGeoAttribute attr, out string[] values)
        {
            if (!attr.ValidateForGetValues <string>(HoudiniGeoAttributeType.String, 1))
            {
                values = new string[0];
                return;
            }

            values = attr.stringValues;
        }
예제 #2
0
        private static void GetValues(this HoudiniGeoAttribute attr, out int[] values)
        {
            if (!attr.ValidateForGetValues <int>(HoudiniGeoAttributeType.Integer, 1))
            {
                values = new int[0];
                return;
            }

            values = attr.intValues;
        }
예제 #3
0
        private static void GetValues(this HoudiniGeoAttribute attr, out float[] values)
        {
            if (!attr.ValidateForGetValues <float>(HoudiniGeoAttributeType.Float, 1))
            {
                values = new float[0];
                return;
            }

            values = attr.floatValues;
        }
예제 #4
0
        private static void GetValues(this HoudiniGeoAttribute attr, out Vector2[] values)
        {
            if (!attr.ValidateForGetValues <Vector2>(HoudiniGeoAttributeType.Float, 2))
            {
                values = new Vector2[0];
                return;
            }

            // Convert to Vector2
            float[] rawValues = attr.floatValues;
            values = new Vector2[rawValues.Length / attr.tupleSize];
            for (int i = 0; i < values.Length; i++)
            {
                values[i].x = rawValues[i * attr.tupleSize];
                values[i].y = rawValues[i * attr.tupleSize + 1];
            }
        }
예제 #5
0
        private static void GetValues(this HoudiniGeoAttribute attr, out Color[] values)
        {
            if (!attr.ValidateForGetValues <Color>(HoudiniGeoAttributeType.Float, 3))
            {
                values = new Color[0];
                return;
            }

            // Convert to Color
            float[] rawValues = attr.floatValues;
            values = new Color[rawValues.Length / attr.tupleSize];
            for (int i = 0; i < values.Length; i++)
            {
                values[i].r = rawValues[i * attr.tupleSize];
                values[i].g = rawValues[i * attr.tupleSize + 1];
                values[i].b = rawValues[i * attr.tupleSize + 2];
                values[i].a = 1;
                if (attr.tupleSize == 4)
                {
                    values[i].a = rawValues[i * attr.tupleSize + 3];
                }
            }
        }