Simon Brown Posted March 5, 2008 Share Posted March 5, 2008 How do I access the destination canvas to render an image to from the effect configuration dialog box? Or how do I access the dialog box from SetRenderInfo? Quote Link to comment Share on other sites More sharing options...
pyrochild Posted March 5, 2008 Share Posted March 5, 2008 How do I access the destination canvas to render an image to from the effect configuration dialog box?You don't Or how do I access the dialog box from SetRenderInfo?SetRenderInfo gives you the token, no? So just set the token via the dialog, then get the data you need from setrenderinfo. Quote ambigram signature by Kemaru [i write plugins and stuff] If you like a post, upvote it! Link to comment Share on other sites More sharing options...
Simon Brown Posted March 5, 2008 Author Share Posted March 5, 2008 Thanks for your help. Quote Link to comment Share on other sites More sharing options...
Simon Brown Posted March 5, 2008 Author Share Posted March 5, 2008 I have another problem. Render() only seems to be called when the dialog first shows. How can I call it when I close the dialog so that the data automatically goes to the correct RenderArgs destination object? Thanks. Quote Link to comment Share on other sites More sharing options...
jchunn Posted March 5, 2008 Share Posted March 5, 2008 I have another problem. Render() only seems to be called when the dialog first shows. Unless I am misunderstanding what you are saying, Render is called when the dialog shows, and anytime a setting is changed, and anytime the "ok" button is clicked. Quote Total hack. Link to comment Share on other sites More sharing options...
Simon Brown Posted March 5, 2008 Author Share Posted March 5, 2008 I have another problem. Render() only seems to be called when the dialog first shows. Unless I am misunderstanding what you are saying, Render is called when the dialog shows, and anytime a setting is changed, and anytime the "ok" button is clicked. But how do I get it to re-render. I am not using DirectUI by the way. Quote Link to comment Share on other sites More sharing options...
pyrochild Posted March 5, 2008 Share Posted March 5, 2008 call FinishTokenUpdate to cause a the token to be updated, and sent to setrenderinfo and render. Quote ambigram signature by Kemaru [i write plugins and stuff] If you like a post, upvote it! Link to comment Share on other sites More sharing options...
Simon Brown Posted March 5, 2008 Author Share Posted March 5, 2008 When the user clicks OK I set the parameters object in the dialog to the config token and call the method you talked about but in OnSetRenderInfo() the parameters object is null. Quote Link to comment Share on other sites More sharing options...
pyrochild Posted March 5, 2008 Share Posted March 5, 2008 In the dialog you need to override InitTokenFromDialog. In that, you need to create a casted reference to theEffectToken, and set your variables in that. protected override void InitTokenFromDialog() { YourCustomToken token = theEffectToken as YourCustomToken; token.val1 = slider1.Value; token.val2 = checkbox1.Checked; //etc... } Quote ambigram signature by Kemaru [i write plugins and stuff] If you like a post, upvote it! Link to comment Share on other sites More sharing options...
Simon Brown Posted March 5, 2008 Author Share Posted March 5, 2008 In the dialog you need to override InitTokenFromDialog.In that, you need to create a casted reference to theEffectToken, and set your variables in that. protected override void InitTokenFromDialog() { YourCustomToken token = theEffectToken as YourCustomToken; token.val1 = slider1.Value; token.val2 = checkbox1.Checked; //etc... } I have added that and the parameters object is still null and I have checked the status of that in the override and it is not null. Quote Link to comment Share on other sites More sharing options...
Simon Brown Posted March 6, 2008 Author Share Posted March 6, 2008 I can't get this to work so I have given up on trying to do it that way. Quote Link to comment Share on other sites More sharing options...
Rick Brewster Posted March 6, 2008 Share Posted March 6, 2008 Now do you see why I developed and highly recommend IndirectUI instead of all this WinForms stuff? Quote The Paint.NET Blog: https://blog.getpaint.net/ Donations are always appreciated! https://www.getpaint.net/donate.html Link to comment Share on other sites More sharing options...
Simon Brown Posted March 6, 2008 Author Share Posted March 6, 2008 Now do you see why I developed and highly recommend IndirectUI instead of all this WinForms stuff? I see - but it won't be suitable for this purpose. Quote Link to comment Share on other sites More sharing options...
Rick Brewster Posted March 6, 2008 Share Posted March 6, 2008 What are you trying to do? Why do you need to force a re-render when the user clicks OK? The rendering workflow is automatically handled by the effect hosting system. If the token doesn't change as a result of clicking OK, then there's really no reason to do any re-rendering. Quote The Paint.NET Blog: https://blog.getpaint.net/ Donations are always appreciated! https://www.getpaint.net/donate.html Link to comment Share on other sites More sharing options...
pyrochild Posted March 6, 2008 Share Posted March 6, 2008 I can't get this to work so I have given up on trying to do it that way. Instead of giving up, you should look at other people's source code. Also, the C# template available has all the grunt-work done for you. All you have to do is update the references (PdnLib.dll was renamed to PaintDotNet.Core.dll), and start stuffing your own code in there. Quote ambigram signature by Kemaru [i write plugins and stuff] If you like a post, upvote it! Link to comment Share on other sites More sharing options...
Simon Brown Posted March 6, 2008 Author Share Posted March 6, 2008 you should look at other people's source code Can you give me a link to a plugin with source available? Quote Link to comment Share on other sites More sharing options...
pyrochild Posted March 6, 2008 Share Posted March 6, 2008 All of MadJik's plugins are source-available. Most of them use IndirectUI, but I believe LightRays still uses the traditional method. As well as my own Splatter, which will also provide insight as to a more correct way to implement a brush-based renderer. Quote ambigram signature by Kemaru [i write plugins and stuff] If you like a post, upvote it! Link to comment Share on other sites More sharing options...
Simon Brown Posted March 6, 2008 Author Share Posted March 6, 2008 All of MadJik's plugins are source-available.Most of them use IndirectUI, but I believe LightRays still uses the traditional method. As well as my own Splatter, which will also provide insight as to a more correct way to implement a brush-based renderer. Thank for your help. Quote Link to comment Share on other sites More sharing options...
Simon Brown Posted March 8, 2008 Author Share Posted March 8, 2008 I have another problem - the OnSetRenderInfo() method only seems to be called when the effect is started - not when that method is called. Quote Link to comment Share on other sites More sharing options...
pyrochild Posted March 8, 2008 Share Posted March 8, 2008 it will be called whenever FinishTokenUpdate is. One thing I forgot to tell you earlier is that you have to override InitialInitToken. protected override void InitialInitToken() { theEffectToken = new WhateverConfigToken(); } Quote ambigram signature by Kemaru [i write plugins and stuff] If you like a post, upvote it! Link to comment Share on other sites More sharing options...
Simon Brown Posted March 8, 2008 Author Share Posted March 8, 2008 it will be called whenever FinishTokenUpdate is.One thing I forgot to tell you earlier is that you have to override InitialInitToken. protected override void InitialInitToken() { theEffectToken = new WhateverConfigToken(); } I did that after following your advice and looking at the splatter source. ----- I have realised it is being called when I do that, but the code I am using to set the canvas to the image of the dialog isn't working: CustomBrushesConfigToken cbct = (CustomBrushesConfigToken)parameters; dstArgs.Surface.CopySurface(Surface.CopyFromBitmap(cbct.TheImage)); Quote Link to comment Share on other sites More sharing options...
Simon Brown Posted March 9, 2008 Author Share Posted March 9, 2008 Further testing reveals that the second time SetRenderInfo() is called but the canvas is not written to with the image on the destination canvas specified in OnSetRenderInfo(). Quote Link to comment Share on other sites More sharing options...
pyrochild Posted March 9, 2008 Share Posted March 9, 2008 What is SetRenderInfo? And the canvas will not be updated until the user presses OK and the dialog returns a DialogResult of DialogResult.OK. Quote ambigram signature by Kemaru [i write plugins and stuff] If you like a post, upvote it! Link to comment Share on other sites More sharing options...
Simon Brown Posted March 9, 2008 Author Share Posted March 9, 2008 What is SetRenderInfo? If you type in override you will see it in the intellisense list. Quote Link to comment Share on other sites More sharing options...
pyrochild Posted March 10, 2008 Share Posted March 10, 2008 You must be referencing some old dll's to be able to override SetRenderInfo. OnSetRenderInfo is the one you shoukld be overriding. Quote ambigram signature by Kemaru [i write plugins and stuff] If you like a post, upvote it! 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.