Esempio n. 1
0
        public override void onColorChanged()
        {
            if (!settings.hasIndividualMaterial)
            {
                settings.hasIndividualMaterial = true;
                setupMaterials();
                m_ObjectsManager.reload();
                updateToFrame(internalFrameNumber, true);
            }
            else
            {
                // TODO: Wait for first bugs.

                var multiplier = GAFTransform.combineColor(gafTransform.colorMultiplier, settings.animationColorMultiplier);
                var offset     = GAFTransform.combineColorOffset(gafTransform.colorOffset, settings.animationColorOffset, settings.animationColorMultiplier);

                if (parent == null)
                {
                    foreach (var _pair in m_BaseMaterials)
                    {
                        _pair.Value.SetColor("_CustomColorMultiplier", multiplier);
                        _pair.Value.SetVector("_CustomColorOffset", offset);
                    }

                    foreach (var _material in m_RegisteredMaterials)
                    {
                        _material.SetColor("_CustomColorMultiplier", multiplier);
                        _material.SetVector("_CustomColorOffset", offset);
                    }
                }
                else
                {
                    foreach (var _pair in parent.baseMaterials)
                    {
                        _pair.Value.SetColor("_CustomColorMultiplier", multiplier);
                        _pair.Value.SetVector("_CustomColorOffset", offset);
                    }

                    foreach (var _material in parent.registeredMaterials)
                    {
                        _material.SetColor("_CustomColorMultiplier", multiplier);
                        _material.SetVector("_CustomColorOffset", offset);
                    }
                }
            }

            //foreach (var item in m_ObjectsManager.timelines)
            //{
            //	foreach (var child in item.gafChilds)
            //	{
            //		var movieClip = child.Value.GetComponent<GAFMovieClipInternal<ObjectsManagerType>>();
            //		movieClip.onColorChanged();
            //	}
            //}
        }
Esempio n. 2
0
        private void onColorChanged()
        {
            if (!settings.hasIndividualMaterial)
            {
                settings.hasIndividualMaterial = true;
                setupMaterials();
                m_ObjectsManager.reload();
                updateToFrameAnimatorWithRefresh((int)internalFrameNumber);
            }
            else
            {
                //var multiplier = gafTransform.colorMultiplier * settings.animationColorMultiplier;
                //var accumulated = gafTransform.colorOffset;
                //accumulated.x *= settings.animationColorMultiplier.r;
                //accumulated.y *= settings.animationColorMultiplier.g;
                //accumulated.z *= settings.animationColorMultiplier.b;
                //accumulated.w *= settings.animationColorMultiplier.a;
                //var offset = settings.animationColorOffset + accumulated;

                //foreach (var _pair in m_BaseMaterials)
                //{
                //	_pair.Value.SetColor("_CustomColorMultiplier", multiplier);
                //	_pair.Value.SetVector("_CustomColorOffset", offset);
                //}

                //foreach (var _material in m_RegisteredMaterials)
                //{
                //	_material.SetColor("_CustomColorMultiplier", multiplier);
                //	_material.SetVector("_CustomColorOffset", offset);
                //}

                var multiplier = GAFTransform.combineColor(gafTransform.colorMultiplier, settings.animationColorMultiplier);
                var offset     = GAFTransform.combineColorOffset(gafTransform.colorOffset, settings.animationColorOffset, settings.animationColorMultiplier);

                if (parent == null)
                {
                    foreach (var _pair in m_BaseMaterials)
                    {
                        _pair.Value.SetColor("_CustomColorMultiplier", multiplier);
                        _pair.Value.SetVector("_CustomColorOffset", offset);
                    }

                    foreach (var _material in m_RegisteredMaterials)
                    {
                        _material.SetColor("_CustomColorMultiplier", multiplier);
                        _material.SetVector("_CustomColorOffset", offset);
                    }
                }
                else
                {
                    foreach (var _pair in parent.baseMaterials)
                    {
                        _pair.Value.SetColor("_CustomColorMultiplier", multiplier);
                        _pair.Value.SetVector("_CustomColorOffset", offset);
                    }

                    foreach (var _material in parent.registeredMaterials)
                    {
                        _material.SetColor("_CustomColorMultiplier", multiplier);
                        _material.SetVector("_CustomColorOffset", offset);
                    }
                }
            }
        }