extern private void SetValueSheet(VFXExpressionValuesSheetInternal sheet);
Ejemplo n.º 2
0
        private static VFXExpressionValuesSheetInternal CreateValueSheet(VFXExpressionValueContainerDesc[] values)
        {
            var internalSheet = new VFXExpressionValuesSheetInternal();

            foreach (var group in values.GroupBy(o => o.GetType()))
            {
                if (group.Key == typeof(VFXExpressionValueContainerDesc <int>))
                {
                    var v = group.Cast <VFXExpressionValueContainerDesc <int> >().ToArray();
                    internalSheet.intValues            = v.Select(o => o.value).ToArray();
                    internalSheet.intValuesExpressions = v.Select(o => o.expressionIndex).ToArray();
                }
                else if (group.Key == typeof(VFXExpressionValueContainerDesc <UInt32>))
                {
                    var v = group.Cast <VFXExpressionValueContainerDesc <UInt32> >().ToArray();
                    internalSheet.uintValues            = v.Select(o => o.value).ToArray();
                    internalSheet.uintValuesExpressions = v.Select(o => o.expressionIndex).ToArray();
                }
                else if (group.Key == typeof(VFXExpressionValueContainerDesc <float>))
                {
                    var v = group.Cast <VFXExpressionValueContainerDesc <float> >().ToArray();
                    internalSheet.floatValues            = v.Select(o => o.value).ToArray();
                    internalSheet.floatValuesExpressions = v.Select(o => o.expressionIndex).ToArray();
                }
                else if (group.Key == typeof(VFXExpressionValueContainerDesc <Vector2>))
                {
                    var v = group.Cast <VFXExpressionValueContainerDesc <Vector2> >().ToArray();
                    internalSheet.vector2Values            = v.Select(o => o.value).ToArray();
                    internalSheet.vector2ValuesExpressions = v.Select(o => o.expressionIndex).ToArray();
                }
                else if (group.Key == typeof(VFXExpressionValueContainerDesc <Vector3>))
                {
                    var v = group.Cast <VFXExpressionValueContainerDesc <Vector3> >().ToArray();
                    internalSheet.vector3Values            = v.Select(o => o.value).ToArray();
                    internalSheet.vector3ValuesExpressions = v.Select(o => o.expressionIndex).ToArray();
                }
                else if (group.Key == typeof(VFXExpressionValueContainerDesc <Vector4>))
                {
                    var v = group.Cast <VFXExpressionValueContainerDesc <Vector4> >().ToArray();
                    internalSheet.vector4Values            = v.Select(o => o.value).ToArray();
                    internalSheet.vector4ValuesExpressions = v.Select(o => o.expressionIndex).ToArray();
                }
                else if (group.Key == typeof(VFXExpressionValueContainerDesc <Matrix4x4>))
                {
                    var v = group.Cast <VFXExpressionValueContainerDesc <Matrix4x4> >().ToArray();
                    internalSheet.matrix4x4Values            = v.Select(o => o.value).ToArray();
                    internalSheet.matrix4x4ValuesExpressions = v.Select(o => o.expressionIndex).ToArray();
                }
                else if (group.Key == typeof(VFXExpressionObjectValueContainerDesc <Texture>))
                {
                    var v = group.Cast <VFXExpressionObjectValueContainerDesc <Texture> >().ToArray();
                    internalSheet.textureValues            = v.Select(o => o.instanceID).ToArray();
                    internalSheet.textureValuesExpressions = v.Select(o => o.expressionIndex).ToArray();
                }
                else if (group.Key == typeof(VFXExpressionObjectValueContainerDesc <Mesh>))
                {
                    var v = group.Cast <VFXExpressionObjectValueContainerDesc <Mesh> >().ToArray();
                    for (int i = 0; i < v.Length; ++i)
                    {
                    }
                    internalSheet.meshValues            = v.Select(o => o.instanceID).ToArray();
                    internalSheet.meshValuesExpressions = v.Select(o => o.expressionIndex).ToArray();
                }
                else if (group.Key == typeof(VFXExpressionValueContainerDesc <Gradient>))
                {
                    var v = group.Cast <VFXExpressionValueContainerDesc <Gradient> >().ToArray();
                    internalSheet.gradientValues            = v.Select(o => o.value).ToArray();
                    internalSheet.gradientValuesExpressions = v.Select(o => o.expressionIndex).ToArray();
                }
                else if (group.Key == typeof(VFXExpressionValueContainerDesc <AnimationCurve>))
                {
                    var v = group.Cast <VFXExpressionValueContainerDesc <AnimationCurve> >().ToArray();
                    internalSheet.animationCurveValues            = v.Select(o => o.value).ToArray();
                    internalSheet.animationCurveValuesExpressions = v.Select(o => o.expressionIndex).ToArray();
                }
                else if (group.Key == typeof(VFXExpressionValueContainerDesc <bool>))
                {
                    var v = group.Cast <VFXExpressionValueContainerDesc <bool> >().ToArray();
                    internalSheet.boolValues            = v.Select(o => o.value).ToArray();
                    internalSheet.boolValuesExpressions = v.Select(o => o.expressionIndex).ToArray();
                }
                //For backward compatibility, Obsoleted by compile on import PR
                else if (group.Key == typeof(VFXExpressionValueContainerDesc <Texture>))
                {
                    var v = group.Cast <VFXExpressionValueContainerDesc <Texture> >().ToArray();
                    internalSheet.textureValues            = v.Select(o => o.value != null ? o.value.GetInstanceID() : 0).ToArray();
                    internalSheet.textureValuesExpressions = v.Select(o => o.expressionIndex).ToArray();
                }
                //For backward compatibility, Obsoleted by compile on import PR
                else if (group.Key == typeof(VFXExpressionValueContainerDesc <Mesh>))
                {
                    var v = group.Cast <VFXExpressionValueContainerDesc <Mesh> >().ToArray();
                    internalSheet.meshValues            = v.Select(o => o.value != null ? o.value.GetInstanceID() : 0).ToArray();
                    internalSheet.meshValuesExpressions = v.Select(o => o.expressionIndex).ToArray();
                }
                else
                {
                    throw new Exception("Unknown VFXExpressionValueContainerDesc type : " + group.Key);
                }
            }
            return(internalSheet);
        }
        private static VFXExpressionValuesSheetInternal CreateValueSheet(VFXExpressionValueContainerDesc[] values)
        {
            var internalSheet = new VFXExpressionValuesSheetInternal();

            foreach (var group in values.GroupBy(o => o.GetType()))
            {
                if (group.Key == typeof(VFXExpressionValueContainerDesc <int>))
                {
                    var v = group.Cast <VFXExpressionValueContainerDesc <int> >().ToArray();
                    internalSheet.intValues            = v.Select(o => o.value).ToArray();
                    internalSheet.intValuesExpressions = v.Select(o => o.expressionIndex).ToArray();
                }
                else if (group.Key == typeof(VFXExpressionValueContainerDesc <UInt32>))
                {
                    var v = group.Cast <VFXExpressionValueContainerDesc <UInt32> >().ToArray();
                    internalSheet.uintValues            = v.Select(o => o.value).ToArray();
                    internalSheet.uintValuesExpressions = v.Select(o => o.expressionIndex).ToArray();
                }
                else if (group.Key == typeof(VFXExpressionValueContainerDesc <float>))
                {
                    var v = group.Cast <VFXExpressionValueContainerDesc <float> >().ToArray();
                    internalSheet.floatValues            = v.Select(o => o.value).ToArray();
                    internalSheet.floatValuesExpressions = v.Select(o => o.expressionIndex).ToArray();
                }
                else if (group.Key == typeof(VFXExpressionValueContainerDesc <Vector2>))
                {
                    var v = group.Cast <VFXExpressionValueContainerDesc <Vector2> >().ToArray();
                    internalSheet.vector2Values            = v.Select(o => o.value).ToArray();
                    internalSheet.vector2ValuesExpressions = v.Select(o => o.expressionIndex).ToArray();
                }
                else if (group.Key == typeof(VFXExpressionValueContainerDesc <Vector3>))
                {
                    var v = group.Cast <VFXExpressionValueContainerDesc <Vector3> >().ToArray();
                    internalSheet.vector3Values            = v.Select(o => o.value).ToArray();
                    internalSheet.vector3ValuesExpressions = v.Select(o => o.expressionIndex).ToArray();
                }
                else if (group.Key == typeof(VFXExpressionValueContainerDesc <Vector4>))
                {
                    var v = group.Cast <VFXExpressionValueContainerDesc <Vector4> >().ToArray();
                    internalSheet.vector4Values            = v.Select(o => o.value).ToArray();
                    internalSheet.vector4ValuesExpressions = v.Select(o => o.expressionIndex).ToArray();
                }
                else if (group.Key == typeof(VFXExpressionValueContainerDesc <Matrix4x4>))
                {
                    var v = group.Cast <VFXExpressionValueContainerDesc <Matrix4x4> >().ToArray();
                    internalSheet.matrix4x4Values            = v.Select(o => o.value).ToArray();
                    internalSheet.matrix4x4ValuesExpressions = v.Select(o => o.expressionIndex).ToArray();
                }
                else if (group.Key == typeof(VFXExpressionValueContainerDesc <Texture>))
                {
                    var v = group.Cast <VFXExpressionValueContainerDesc <Texture> >().ToArray();
                    internalSheet.textureValues            = v.Select(o => o.value).ToArray();
                    internalSheet.textureValuesExpressions = v.Select(o => o.expressionIndex).ToArray();
                }
                else if (group.Key == typeof(VFXExpressionValueContainerDesc <Mesh>))
                {
                    var v = group.Cast <VFXExpressionValueContainerDesc <Mesh> >().ToArray();
                    internalSheet.meshValues            = v.Select(o => o.value).ToArray();
                    internalSheet.meshValuesExpressions = v.Select(o => o.expressionIndex).ToArray();
                }
                else if (group.Key == typeof(VFXExpressionValueContainerDesc <Gradient>))
                {
                    var v = group.Cast <VFXExpressionValueContainerDesc <Gradient> >().ToArray();
                    internalSheet.gradientValues            = v.Select(o => o.value).ToArray();
                    internalSheet.gradientValuesExpressions = v.Select(o => o.expressionIndex).ToArray();
                }
                else if (group.Key == typeof(VFXExpressionValueContainerDesc <AnimationCurve>))
                {
                    var v = group.Cast <VFXExpressionValueContainerDesc <AnimationCurve> >().ToArray();
                    internalSheet.animationCurveValues            = v.Select(o => o.value).ToArray();
                    internalSheet.animationCurveValuesExpressions = v.Select(o => o.expressionIndex).ToArray();
                }
                else if (group.Key == typeof(VFXExpressionValueContainerDesc <bool>))
                {
                    var v = group.Cast <VFXExpressionValueContainerDesc <bool> >().ToArray();
                    internalSheet.boolValues            = v.Select(o => o.value).ToArray();
                    internalSheet.boolValuesExpressions = v.Select(o => o.expressionIndex).ToArray();
                }
                else
                {
                    throw new Exception("Unknown VFXExpressionValueContainerDesc type : " + group.Key);
                }
            }
            return(internalSheet);
        }
        private static VFXExpressionValuesSheetInternal CreateValueSheet(VFXExpressionValueContainerDesc[] values)
        {
            var internalSheet = new VFXExpressionValuesSheetInternal();

            foreach (var group in values.GroupBy(o => o.GetType()))
            {
                if (group.Key == typeof(VFXExpressionValueContainerDesc <int>))
                {
                    var v = group.Cast <VFXExpressionValueContainerDesc <int> >().ToArray();
                    internalSheet.intValues            = v.Select(o => o.value).ToArray();
                    internalSheet.intValuesExpressions = v.Select(o => o.expressionIndex).ToArray();
                }
                else if (group.Key == typeof(VFXExpressionValueContainerDesc <UInt32>))
                {
                    var v = group.Cast <VFXExpressionValueContainerDesc <UInt32> >().ToArray();
                    internalSheet.uintValues            = v.Select(o => o.value).ToArray();
                    internalSheet.uintValuesExpressions = v.Select(o => o.expressionIndex).ToArray();
                }
                else if (group.Key == typeof(VFXExpressionValueContainerDesc <float>))
                {
                    var v = group.Cast <VFXExpressionValueContainerDesc <float> >().ToArray();
                    internalSheet.floatValues            = v.Select(o => o.value).ToArray();
                    internalSheet.floatValuesExpressions = v.Select(o => o.expressionIndex).ToArray();
                }
                else if (group.Key == typeof(VFXExpressionValueContainerDesc <Vector2>))
                {
                    var v = group.Cast <VFXExpressionValueContainerDesc <Vector2> >().ToArray();
                    internalSheet.vector2Values            = v.Select(o => o.value).ToArray();
                    internalSheet.vector2ValuesExpressions = v.Select(o => o.expressionIndex).ToArray();
                }
                else if (group.Key == typeof(VFXExpressionValueContainerDesc <Vector3>))
                {
                    var v = group.Cast <VFXExpressionValueContainerDesc <Vector3> >().ToArray();
                    internalSheet.vector3Values            = v.Select(o => o.value).ToArray();
                    internalSheet.vector3ValuesExpressions = v.Select(o => o.expressionIndex).ToArray();
                }
                else if (group.Key == typeof(VFXExpressionValueContainerDesc <Vector4>))
                {
                    var v = group.Cast <VFXExpressionValueContainerDesc <Vector4> >().ToArray();
                    internalSheet.vector4Values            = v.Select(o => o.value).ToArray();
                    internalSheet.vector4ValuesExpressions = v.Select(o => o.expressionIndex).ToArray();
                }
                else if (group.Key == typeof(VFXExpressionValueContainerDesc <Matrix4x4>))
                {
                    var v = group.Cast <VFXExpressionValueContainerDesc <Matrix4x4> >().ToArray();
                    internalSheet.matrix4x4Values            = v.Select(o => o.value).ToArray();
                    internalSheet.matrix4x4ValuesExpressions = v.Select(o => o.expressionIndex).ToArray();
                }
                else if (group.Key == typeof(VFXExpressionObjectValueContainerDesc <Texture>))
                {
                    var v = group.Cast <VFXExpressionObjectValueContainerDesc <Texture> >().ToArray();
                    internalSheet.textureValues            = v.Select(o => o.instanceID).ToArray();
                    internalSheet.textureValuesExpressions = v.Select(o => o.expressionIndex).ToArray();
                }
                else if (group.Key == typeof(VFXExpressionObjectValueContainerDesc <Mesh>))
                {
                    var v = group.Cast <VFXExpressionObjectValueContainerDesc <Mesh> >().ToArray();
                    internalSheet.meshValues            = v.Select(o => o.instanceID).ToArray();
                    internalSheet.meshValuesExpressions = v.Select(o => o.expressionIndex).ToArray();
                }
                else if (group.Key == typeof(VFXExpressionObjectValueContainerDesc <SkinnedMeshRenderer>))
                {
                    var v = group.Cast <VFXExpressionObjectValueContainerDesc <SkinnedMeshRenderer> >().ToArray();
                    internalSheet.skinnedMeshRendererValues            = v.Select(o => o.instanceID).ToArray();
                    internalSheet.skinnedMeshRendererValuesExpressions = v.Select(o => o.expressionIndex).ToArray();
                }
                else if (group.Key == typeof(VFXExpressionValueContainerDesc <Gradient>))
                {
                    var v = group.Cast <VFXExpressionValueContainerDesc <Gradient> >().ToArray();
                    internalSheet.gradientValues            = v.Select(o => o.value).ToArray();
                    internalSheet.gradientValuesExpressions = v.Select(o => o.expressionIndex).ToArray();
                }
                else if (group.Key == typeof(VFXExpressionValueContainerDesc <AnimationCurve>))
                {
                    var v = group.Cast <VFXExpressionValueContainerDesc <AnimationCurve> >().ToArray();
                    internalSheet.animationCurveValues            = v.Select(o => o.value).ToArray();
                    internalSheet.animationCurveValuesExpressions = v.Select(o => o.expressionIndex).ToArray();
                }
                else if (group.Key == typeof(VFXExpressionValueContainerDesc <bool>))
                {
                    var v = group.Cast <VFXExpressionValueContainerDesc <bool> >().ToArray();
                    internalSheet.boolValues            = v.Select(o => o.value).ToArray();
                    internalSheet.boolValuesExpressions = v.Select(o => o.expressionIndex).ToArray();
                }
                //For backward compatibility, Obsoleted by compile on import PR
                else if (group.Key == typeof(VFXExpressionValueContainerDesc <Texture>))
                {
                    var v = group.Cast <VFXExpressionValueContainerDesc <Texture> >().ToArray();
                    internalSheet.textureValues            = v.Select(o => o.value != null ? o.value.GetInstanceID() : 0).ToArray();
                    internalSheet.textureValuesExpressions = v.Select(o => o.expressionIndex).ToArray();
                }
                //For backward compatibility, Obsoleted by compile on import PR
                else if (group.Key == typeof(VFXExpressionValueContainerDesc <Mesh>))
                {
                    var v = group.Cast <VFXExpressionValueContainerDesc <Mesh> >().ToArray();
                    internalSheet.meshValues            = v.Select(o => o.value != null ? o.value.GetInstanceID() : 0).ToArray();
                    internalSheet.meshValuesExpressions = v.Select(o => o.expressionIndex).ToArray();
                }
                else if (group.Key == typeof(VFXExpressionValueContainerDesc <GraphicsBuffer>))
                {
                    //Nothing to do, graphicsBufferValues are always null, simply ignore
                    //internalSheet.graphicsBufferValues = v.Select(o => null).ToArray();
                    //internalSheet.graphicsBufferValuesExpressions = values.Select(o => o.expressionIndex).ToArray();
                }
                else
                {
                    throw new InvalidOperationException("Unknown VFXExpressionValueContainerDesc type : " + group.Key);
                }
            }
            return(internalSheet);
        }