Exemple #1
0
    public bool endBakeAnimation(GameObject parent_object)
    {
        try
        {
            bool found_non_const_curve = false;
            for (int ii = 0; ii < myNumInstances; ++ii)
            {
                GameObject child = transform.GetChild(ii).gameObject;

                HoudiniCurvesCollection curves = myCurvesCollection[ii];

                AnimationClip clip = curves.assignCurvesToClip();

                if (clip != null)
                {
                    Animation anim_component = child.GetComponent <Animation>();
                    if (anim_component == null)
                    {
                        child.AddComponent <Animation>();
                        anim_component = child.GetComponent <Animation>();
                    }

                    anim_component.clip   = clip;
                    found_non_const_curve = true;
                }
            }

            return(found_non_const_curve);
        }
        catch (HoudiniError error)
        {
            Debug.LogWarning(error.ToString());
            return(false);
        }
    }
    public bool endBakeAnimation()
    {
        try
        {
            HoudiniCurvesCollection curves = myCurveCollection;
            AnimationClip           clip   = curves.assignCurvesToClip();

            if (clip != null)
            {
                Animation anim_component = gameObject.GetComponent <Animation>();
                if (anim_component == null)
                {
                    gameObject.AddComponent <Animation>();
                    anim_component = gameObject.GetComponent <Animation>();
                }

                anim_component.clip = clip;
                return(true);
            }

            return(false);
        }
        catch (HoudiniError error)
        {
            Debug.LogWarning(error.ToString());
            return(false);
        }
    }