Esempio n. 1
0
    public NPVoxFrame(NPVoxAnimation animation)
    {
        this.animation = animation;

        output           = (NPVoxMeshOutput)animation.MeshFactory.Clone();
        output.hideFlags = HideFlags.HideInHierarchy;

//        Debug.Log("invalidating");
#if UNITY_EDITOR
        AssetDatabase.AddObjectToAsset(output, AssetDatabase.GetAssetPath(animation));
        preOutput = (NPVoxModelForwarder)NPVoxModelForwarder.CreateInstance <NPVoxModelForwarder>();
        NPipelineUtils.CreateAttachedPipe(AssetDatabase.GetAssetPath(animation), preOutput);
        preOutput.Input = null;
#endif
        output.Input = preOutput;
        output.Invalidate();
        preOutput.Invalidate();
    }
Esempio n. 2
0
    public void FixStuff()
    {
        #if UNITY_EDITOR
        if (!preOutput)
        {
            Debug.LogWarning("Added Preoutput");
            preOutput = (NPVoxModelForwarder)NPVoxModelForwarder.CreateInstance <NPVoxModelForwarder>();

            NPipelineUtils.CreateAttachedPipe(AssetDatabase.GetAssetPath(animation), preOutput);
//            AssetDatabase.AddObjectToAsset(preOutput, AssetDatabase.GetAssetPath(animation));
            preOutput.Invalidate();
            EditorUtility.SetDirty(animation);
        }

        if (output.Input == null || output.Input != preOutput as NPipeIImportable)
        {
            Debug.LogWarning("Fixed output");
            output.Input = preOutput;
            output.Invalidate();
            EditorUtility.SetDirty(animation);
        }

        int invalidateFrom = -1;
        for (int i = 0; i < this.transformers.Length; i++)
        {
            if (i == 0)
            {
                if (((NPipeIComposite)this.transformers[i]).Input != Source)
                {
                    ((NPipeIComposite)this.transformers[i]).Input = Source;
                    if (invalidateFrom == -1 || invalidateFrom > i)
                    {
                        invalidateFrom = i;
                    }
                    Debug.LogWarning("Fixed source of transformer 0");
                }
            }
            else
            {
                if (((NPipeIComposite)this.transformers[i]).Input != ((NPipeIComposite)this.transformers[i - 1]))
                {
                    ((NPipeIComposite)this.transformers[i]).Input = ((NPipeIComposite)this.transformers[i - 1]);
                    if (invalidateFrom == -1 || invalidateFrom > i)
                    {
                        invalidateFrom = i;
                    }
                    Debug.LogWarning("Fixed source of transformer " + i);
                }
            }
        }

        if (transformers.Length > 0)
        {
            if (preOutput.Input != ((NPipeIComposite)this.transformers[transformers.Length - 1]))
            {
                if (invalidateFrom == -1)
                {
                    invalidateFrom = transformers.Length;
                }
                preOutput.Input = ((NPipeIComposite)this.transformers[transformers.Length - 1]);
                Debug.LogWarning("Fixed source of preOutput");
            }
        }
        else if (preOutput.Input != Source)
        {
            preOutput.Input = Source;
            Debug.LogWarning("Fixed source of preOutput");
        }

        if (invalidateFrom > -1)
        {
            this.InvalidateFromStep(invalidateFrom);
        }
        #endif
    }