MJW Posted August 31, 2015 Share Posted August 31, 2015 Is there some rule or whatever to make the range of a control 0 to width-1 or height-1? I was thinking of writing some plugins in VS instead of CodeLab to achieve that result, then realized I didn't even know whether it could be done. Having arbitrary, and necessarily large, ranges for controls whose only valid values are within the canvas lacks polish. While I'm at it, is there any organized documentation of IndirectUI? I only know that controls can be linked and disabled because Simon Brown started a thread about it. Quote Link to comment Share on other sites More sharing options...
ArgusMagnus Posted August 31, 2015 Share Posted August 31, 2015 I don't know about CodeLab, but it can be done in VS in the OnCreateConfigUI method, just pass the values when creating the properties. You can get the values from EnvironmentParameters.SourceSurface. 1 Quote My batch Image Processor: https://imagenator.codeplex.com Link to comment Share on other sites More sharing options...
BoltBait Posted August 31, 2015 Share Posted August 31, 2015 My dream plugin uses a Gaussian blur to create a dream like picture. The thing I never liked was the fact that the default blur level (10) looks great on 800x600 pictures but you can't really see the effect on my camera's pictures 2560x1920. I solved it by having a different default based on the picture size: 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); }And, you're right, CodeLab can't do something like this. 2 Quote Download: BoltBait's Plugin Pack | CodeLab | and a Computer Dominos Game Link to comment Share on other sites More sharing options...
MJW Posted August 31, 2015 Author Share Posted August 31, 2015 (edited) Thank you, ArgusMagnus and BoltBait! I looked at the CodeLab generated code, but couldn't see how to the get the surface size from the arguments passed to the property routines. I should have thought of using EnvironmentParameters (though I wouldn't have been sure the surface size was valid at the time OnCreateConfigUI and OnCreatePropertyCollection are called). I'll probably give it a try today. Edited August 31, 2015 by MJW Quote Link to comment Share on other sites More sharing options...
ArgusMagnus Posted August 31, 2015 Share Posted August 31, 2015 (edited) I remembered wrong, OnCreatePropertyCollection is the place to do it. You can even get the selection, If memory serves rigt it was with the this.GetSelection(EnvironmentParameters.SourceSurface.Bounds).GetIntBounds() method. (Im writing from my phone, so I cant check right now) Edited August 31, 2015 by ArgusMagnus Quote My batch Image Processor: https://imagenator.codeplex.com Link to comment Share on other sites More sharing options...
MJW Posted August 31, 2015 Author Share Posted August 31, 2015 (edited) I'm concerned about something. Suppose the plugin is used on a 1000x1000 window, and the control is set to 800. Then, in the same PDN session, the next time it's used on a 500x500 window. The control value is usually the same as the previous setting, so since there seems to be no way to programmatically reset the current control value, unless IndirectIU clamps it itself, it would seem like the value would be out of range. Past experience makes me think IndirectIU might throw an exception. Edited August 31, 2015 by MJW Quote Link to comment Share on other sites More sharing options...
BoltBait Posted August 31, 2015 Share Posted August 31, 2015 I'm concerned about something. Suppose the plugin is used on a 1000x1000, and the control is set to 800. Then, in the same PDN session, the next time it's used on a 500x500 window. The control value is usually the same as the previous setting, so since there seems to be no way to programmatically reset the current control value, unless IndirectIU clamps it itself, it would seem like the value would be out of range. Past experience makes me think IndirectIU might throw an exception. Seems like an experiment you could try in just a few minutes. Quote Download: BoltBait's Plugin Pack | CodeLab | and a Computer Dominos Game Link to comment Share on other sites More sharing options...
BoltBait Posted August 31, 2015 Share Posted August 31, 2015 Here is another scenario for you: 1000x1000 image, run the effect at 800. Resize the image to 100x100, press Ctrl-F to repeat your effect. And another: Open 2 images, 1000x1000 and 100x100. Select the large image and run your effect at 800. Switch to the smaller image and run your effect again. Quote Download: BoltBait's Plugin Pack | CodeLab | and a Computer Dominos Game Link to comment Share on other sites More sharing options...
MJW Posted August 31, 2015 Author Share Posted August 31, 2015 To my surprise, IndirectIU clamps the the value to the range when run with a smaller image. That's good news. When run with repeat-effect on a smaller window, it appears to use both the old value and range (which is sort of what I expected). That should not be a problem. Quote 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.