コード例 #1
0
 public void AddTargets(FieldAtlas at, ShaderProperty.TextureValue target)
 {
     if (!atlasFields.Contains(at.atlasedField))
     {
         atlasFields.Add(at.atlasedField);
     }
     if (!targetFields.Contains(target))
     {
         targetFields.Add(target);
     }
 }
コード例 #2
0
        private void OnChangeMaterial(PlaytimePainter painter)
        {
            #if UNITY_EDITOR
            if (originalMaterial)
            {
                originalTextures = originalMaterial.MyGetTextureProperties();
            }

            if ((DestinationMaterial) && (DestinationMaterial.HasProperty(PainterDataAndConfig.isAtlasedProperty)))
            {
                var aTextures = DestinationMaterial.MyGetTextureProperties();
                _fields.Clear();
                foreach (var t in aTextures)
                {
                    var ac = new FieldAtlas();
                    _fields.Add(ac);
                    ac.atlasedField = t.NameForDisplayPEGI();
                }

                _atlasedShader = DestinationMaterial.shader;


                foreach (var p in MaterialEditor.GetMaterialProperties(new Object[] { DestinationMaterial }))
                {
                    if (p.displayName.Contains(PainterDataAndConfig.isAtlasableDisaplyNameTag))
                    {
                        foreach (var f in _fields)
                        {
                            if (f.atlasedField.SameAs(p.name))
                            {
                                f.enabled = true;
                            }
                        }
                    }
                }


                if (!_atlasedMaterial)
                {
                    for (var i = 0; i < _fields.Count; i++)
                    {
                        _fields[i].originField = i;
                    }
                }
                else if (originalMaterial)
                {
                    var orTexts = originalMaterial.MyGetTextureProperties();
                    foreach (var f in _fields)
                    {
                        for (var i = 0; i < orTexts.Count; i++)
                        {
                            if (orTexts[i].NameForDisplayPEGI().SameAs(f.atlasedField))
                            {
                                f.originField = i;
                            }
                        }
                    }
                }
            }

            if (!originalMaterial)
            {
                return;
            }

            for (var i = 0; i < _fields.Count; i++)
            {
                FindAtlas(i);
            }
#endif
        }