null54 Posted November 25, 2018 Share Posted November 25, 2018 There are some cases where it would be useful to allow FileType plugins to disable or change parts of their UI based on the properties the current Document (such as Size, layer count, Metadata etc). For example, if I added cube map support to to DDS FileType Plus the accompanying checkbox would only apply to images with 6 layers. While I can set the checkbox description to state that requirement and ignore it if the images do not meet it, I think it would be more user friendly (and easier lo localize) if there was a way to uncheck and disable the checkbox when the image does not have 6 layers. Example: Spoiler protected override void OnUpdateSaveConfigUIForDocument(ControlInfo configUI, Document document) { if (document.Layers.Count != 6) { BooleanProperty prop = configUI.FindControlForPropertyName(PropertyNames.CubeMaps).Property as BooleanProperty; prop.Value = false; prop.ReadOnly = true; } } Quote Plugin Pack | PSFilterPdn | Content Aware Fill | G'MIC | Paint Shop Pro Filetype | RAW Filetype | WebP Filetype The small increase in performance you get coding in C++ over C# is hardly enough to offset the headache of coding in the C++ language. ~BoltBait Link to comment Share on other sites More sharing options...
BoltBait Posted November 25, 2018 Share Posted November 25, 2018 One of my plugins has a different default based on the size of the image. protected override PropertyCollection OnCreatePropertyCollection() { List<Property> props = new List<Property>(); if (EnvironmentParameters.SourceSurface.Width < 1000) { props.Add(new Int32Property(PropertyNames.Amount1, 10, 0, 100)); } else { props.Add(new Int32Property(PropertyNames.Amount1, 50, 0, 100)); } return new PropertyCollection(props); } That answers half your question. I don't know about filetype plugins; I've never made one. Quote Click to play: Download: BoltBait's Plugin Pack | CodeLab | and how about a Computer Dominos Game Link to comment Share on other sites More sharing options...
null54 Posted November 25, 2018 Author Share Posted November 25, 2018 10 minutes ago, BoltBait said: One of my plugins has a different default based on the size of the image. Interesting, I was unaware the EnvironmentParameters are defined in OnCreatePropertyCollection. I updated the first post to remove the Effect plugin code. Quote Plugin Pack | PSFilterPdn | Content Aware Fill | G'MIC | Paint Shop Pro Filetype | RAW Filetype | WebP Filetype The small increase in performance you get coding in C++ over C# is hardly enough to offset the headache of coding in the C++ language. ~BoltBait Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.