Exemplo n.º 1
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";
        }