Exemple #1
0
 public override void CopyFromMaterial(Material m)
 {
     MaterialHelper.CopyPropertyValueFromMaterial(materialProperty, m);
     if (keyword != null)
     {
         SetKeyword(shaderEditor.materials, m.GetFloat(materialProperty.name) == 1);
     }
     if (is_animatable)
     {
         ShaderOptimizer.CopyAnimatedTagFromMaterial(m, materialProperty);
     }
     this.is_animated = is_animatable && ShaderOptimizer.GetAnimatedTag(materialProperty) != "";
     this.is_renaming = is_animatable && ShaderOptimizer.GetAnimatedTag(materialProperty) == "2";
 }
Exemple #2
0
 public override void TransferFromMaterialAndGroup(Material m, ShaderPart p)
 {
     if (materialProperty.type != p.materialProperty.type)
     {
         return;
     }
     MaterialHelper.CopyMaterialValueFromProperty(materialProperty, p.materialProperty);
     if (keyword != null)
     {
         SetKeyword(shaderEditor.materials, m.GetFloat(p.materialProperty.name) == 1);
     }
     if (is_animatable && p.is_animatable)
     {
         ShaderOptimizer.CopyAnimatedTagFromProperty(p.materialProperty, materialProperty);
     }
     this.is_animated = is_animatable && ShaderOptimizer.GetAnimatedTag(materialProperty) != "";
     this.is_renaming = is_animatable && ShaderOptimizer.GetAnimatedTag(materialProperty) == "2";
 }
Exemple #3
0
        public bool has_not_searchedFor = false; //used for property search

        public ShaderPart(ShaderEditor shaderEditor, MaterialProperty prop, int xOffset, string displayName, PropertyOptions options)
        {
            this.shaderEditor               = shaderEditor;
            this.materialProperty           = prop;
            this.xOffset                    = xOffset;
            this.options                    = options;
            this.content                    = new GUIContent(displayName);
            this.tooltip                    = new BetterTooltips.Tooltip(options.tooltip);
            this.reference_properties_exist = options.reference_properties != null && options.reference_properties.Length > 0;
            this.reference_property_exists  = options.reference_property != null;
            this.is_preset                  = shaderEditor._isPresetEditor && Presets.IsPreset(shaderEditor.materials[0], prop);

            if (prop == null)
            {
                return;
            }
            bool   propHasDuplicate = shaderEditor.GetMaterialProperty(prop.name + "_" + shaderEditor.animPropertySuffix) != null;
            string tag = null;

            //If prop is og, but is duplicated (locked) dont have it animateable
            if (propHasDuplicate)
            {
                this.is_animatable = false;
            }
            else
            {
                //if prop is a duplicated or renamed get og property to check for animted status
                if (prop.name.Contains(shaderEditor.animPropertySuffix))
                {
                    string ogName = prop.name.Substring(0, prop.name.Length - shaderEditor.animPropertySuffix.Length - 1);
                    tag = ShaderOptimizer.GetAnimatedTag(materialProperty.targets[0] as Material, ogName);
                }
                else
                {
                    tag = ShaderOptimizer.GetAnimatedTag(materialProperty);
                }
                this.is_animatable = true;
            }


            this.is_animated = is_animatable && tag != "";
            this.is_renaming = is_animatable && tag == "2";
        }