Ejemplo n.º 1
0
        private void onMaskingChanged()
        {
            if (!settings.hasIndividualMaterial)
            {
                settings.hasIndividualMaterial = true;
                setupMaterials();
                m_ObjectsManager.reload();
                updateToFrame(internalFrameNumber, true);
            }
            else
            {
                var combinedStencil = GAFTransform.combineStencil(gafTransform.stencilValue, settings.stencilValue);

                if (parent == null)
                {
                    foreach (var _pair in m_BaseMaterials)
                    {
                        _pair.Value.SetInt("_StencilID", combinedStencil);
                    }

                    foreach (var _material in m_RegisteredMaterials)
                    {
                        _material.SetInt("_StencilID", combinedStencil);
                    }
                }
                else
                {
                    foreach (var _pair in parent.baseMaterials)
                    {
                        _pair.Value.SetInt("_StencilID", combinedStencil);
                    }

                    foreach (var _material in parent.registeredMaterials)
                    {
                        _material.SetInt("_StencilID", combinedStencil);
                    }
                }
            }
        }
Ejemplo 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);
                    }
                }
            }
        }