Example #1
0
        // Start is called before the first frame update
        void OnEnable()
        {
            this.name = "ShaderStrippingConfig";
            var tree = AssetDatabase.LoadAssetAtPath <VisualTreeAsset>("Packages/com.utj.stripvariant/Editor/UXML/ConfigUI.uxml");

            this.rootVisualElement.Add(tree.CloneTree());

            enableToggle      = this.rootVisualElement.Q <Toggle>("Enabled");
            logToggle         = this.rootVisualElement.Q <Toggle>("LogEnable");
            strictModeToggle  = this.rootVisualElement.Q <Toggle>("StrictVariantStripping");
            disableUnityStrip = this.rootVisualElement.Q <Toggle>("DisableUnityStrip");

            orderIntField      = this.rootVisualElement.Q <IntegerField>("ExecuteOrder");
            executeOrderMinBtn = this.rootVisualElement.Q <Button>("ExecOrderMinBtn");
            executeOrderMaxBtn = this.rootVisualElement.Q <Button>("ExecOrderMaxBtn");

            resetTimestampBtn = this.rootVisualElement.Q <Button>("ResetTimestampBtn");

            addExcludeBtn          = this.rootVisualElement.Q <Button>("AppendExcludeBtn");
            excludeVariantListView = this.rootVisualElement.Q <ListView>("ExcludeList");

            debugListViewBtn = this.rootVisualElement.Q <Button>("DebugListProcessorBtn");


            enableToggle.SetValueWithoutNotify(StripShaderConfig.IsEnable);
            logToggle.SetValueWithoutNotify(StripShaderConfig.IsLogEnable);
            strictModeToggle.SetValueWithoutNotify(StripShaderConfig.StrictVariantStripping);
            disableUnityStrip.SetValueWithoutNotify(StripShaderConfig.DisableUnityStrip);
            orderIntField.SetValueWithoutNotify(StripShaderConfig.Order);

            enableToggle.RegisterValueChangedCallback(OnChangeEnabbleToggle);
            logToggle.RegisterValueChangedCallback(OnChangeLogEnabbleToggle);
            strictModeToggle.RegisterValueChangedCallback(OnChangeStrictModeToggle);
            disableUnityStrip.RegisterValueChangedCallback(OnChangeDisableUnityStripToggle);

            resetTimestampBtn.clicked += OnClickResetTimestamp;

            debugListViewBtn.clicked += OnClickDebugListViewBtn;

            orderIntField.RegisterCallback <FocusOutEvent>(OnLostFocusIntField);
            executeOrderMinBtn.clicked += OnClickMinButton;
            executeOrderMaxBtn.clicked += OnClickMaxButton;
            addExcludeBtn.clicked      += OnClickAddExclude;

            SetUIActiveAtEnabled(enableToggle.value);
            SetUIActiveAtStrictMode(strictModeToggle.value);

            SetupExcludeRules();
            StrippingByVariantCollection.ResetData();
        }
Example #2
0
 void OnClickResetTimestamp()
 {
     StrippingByVariantCollection.ResetData();
 }