Rick Brewster

CodeLab v4.3 (for advanced users) Released July 13, 2019

Recommended Posts

I have a question about next ver of CodeLab.

 

The plug-ins that are built by next ver of codeLab at pdn v4, Can I use it at pdn v3.5?

 

Now ,The plug-ins that are built by codeLab in v4, it does not appear in Paint.net3.5. 

I needed to rebuild  by CodeLab in Paint.net3.5 In order to use plugin at 3.5. 

Share this post


Link to post
Share on other sites

... plug-ins that are built by codeLab in v4, it does not appear in Paint.net3.5.

I needed to rebuild by CodeLab in Paint.net3.5 In order to use plugin at 3.5.

Correct. Building in 3.5.11 should be compatible with both 3.5.11 and 4.0.

Building in 4.0 means the plugin will not work in 3.5.11

Share this post


Link to post
Share on other sites

Correct. Building in 3.5.11 should be compatible with both 3.5.11 and 4.0.

Building in 4.0 means the plugin will not work in 3.5.11

OK. I understand.

thank you EER :) 

Share this post


Link to post
Share on other sites

CodeLab 1.9 Released

This is only for Paint.NET 4.0 Beta*!

Changes:

- 3D roll control added to UI builder

- Compiled DLL files now placed on user's desktop

- Default script now contains "if (IsCancelRequested) return;" in the y loop

Good news:

Since the DLL is placed on the desktop instead of the Effects folder, the user no longer has to run Paint.NET as an Administrator in order to do plugin development. This allows drag-and-drop images into Paint.NET (which running as Admin prevents).

Bad news:

The compiled DLL files must be installed after being built. If you keep a shortcut to the Effects folder on your desktop, it is an easy drag-and-drop to install. This is a small price to pay for what you gain.

Grab the CodeLab DLL here:

http://www.boltbait.com/pdn/CodeLab/

Sample code for the Roll Control:

#region UICode
Tuple<double, double, double> Amount1 = Tuple.Create<double, double, double>( 0.0 , 0.0 , 0.0 ); // Roll
#endregion

void Render(Surface dst, Surface src, Rectangle rect)
{
    Rectangle selection = EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt();

    dst.CopySurface(src,rect.Location,rect);
    SolidBrush Brush1 = new SolidBrush(Color.Red);
    Graphics g = new RenderArgs(dst).Graphics;
    g.Clip = new Region(rect);
    Font SelectedFont = new Font("Arial", 16);
    // Item 1 is direction outer ring
    g.DrawString("D: "+Amount1.Item1.ToString(), SelectedFont, Brush1, selection.Left, selection.Top);
    // Items 2 and 3 are the ball
    g.DrawString("X: "+Amount1.Item2.ToString(), SelectedFont, Brush1, selection.Left, selection.Top+25);
    g.DrawString("Y: "+Amount1.Item3.ToString(), SelectedFont, Brush1, selection.Left, selection.Top+50);
}
Limits of the controls are:

D: -180 to 180

X: -180 to 180

Y: 0 to 90

RollControl.png

Build the sample code to a DLL and play with the new roll control. Not sure what it would be used for yet. But, it looks cool.

New CodeLab Tutorial

I have written a new CodeLab tutorial in my series. Check it out here: CodeLab Tutorial - Part 5 - Beyond CodeLab

Support the development of CodeLab

$

*Please note that this is being shipped before the official 4.0 release. Some changes may need to be made depending on the final release of 4.0.

**I will keep CodeLab 1.8 available on the web site until Paint.NET 4.0 ships.

post-44727-0-28813700-1400303349_thumb.p

  • Upvote 1

Share this post


Link to post
Share on other sites

CodeLab 2.0 Released

This is only for Paint.NET 4.0!

Changes:

▪ File>New Templates updated: more effects available for complex effects, better clipboard code, etc.

▪ UI Builder updated: no more ascii art!

▪ Script generation updated for Paint.NET 4.0**

  • Complex effects utilizing clouds has been updated
  • BlendOps have been changed from UserBlendOp to BinaryPixelOp.
▪ Two new fields added to Save as DLL screen
  • Description (This shows up as a tooltip in Paint.NET 4.0)
  • Key words (This doesn't show up anywhere yet, but eventually plugins will be searchable by keyword.)
▪ Added "using System.Linq;" to user scripts.

▪ Font size of editor now remembered between runs

▪ Editor font selection added to View menu (Download fonts here: Consolas, Envy Code R)

Grab the CodeLab DLL here:

http://www.boltbait.com/pdn/CodeLab/

Support the development of CodeLab

$

I haven't gotten a donation for CodeLab in a while. Is anyone out there using it?

**I don't recommend using CodeLab 1.8 for developing plugins that you think will work in both PdN 3.5 and 4.0. With the release of Paint.NET 4.0, it is time to rebuild all of your plugins using this new version of CodeLab. If you used a template before, start from generating a new template and then edit it with your specific algorithm code.

  • Upvote 1

Share this post


Link to post
Share on other sites

I just updated CodeLab again.

I got tired of looking a Courier New, so... I added the ability to choose a font for the editor.

That was the only change so I didn't bother revving the version number. All the code generation is still the same. I just updated my previous post in this thread with the details.

Grab a new copy here: CodeLab for Paint.NET

Download fonts here: Consolas, Envy Code R

CodeLab users... tell me, which is your favorite of the 3 available fonts?

I scoured the Internet for opinions on which were the best programming fonts. I checked them all out and picked the 3 I liked best. If you have a different favorite, tell me what it is and where to download a free copy. If I like it, I'll add it to the next build. (Comic Sans will not be considered.)

BTW, if you don't have a font installed, when you select it you'll just get Courier New.

Share this post


Link to post
Share on other sites

CodeLab 2.1 Released

This is only for Paint.NET 4.0!

Changes:

▪ When a effect dll is created on your desktop an install batch file is also created. This is only for your system. It can be used to quickly install the dll you just built. It is not flexible enough to be shipped with your effect.

▪ A bug was fixed when locating bugs in your own code (double clicking on error message)

▪ On build dll page, an option was added for forcing aliased selection edges.

  • Normally in Paint.NET 4.0, the user can set the edge behavior (aliased or anti-aliased)
  • Setting this option will force the edges to be treated aliased.
  • This is only helpful when setting or adjusting the alpha values of selected pixels.
  • Usually you'll just leave this turned off unless you're specifically calculating the alpha values of the edge pixels.
  • This can be specified in the script as a comment: // Force Aliased Selection

Grab the CodeLab DLL here:

http://www.boltbait.com/pdn/CodeLab/

Support the development of CodeLab

$

I haven't gotten a donation for CodeLab in a while. Is anyone out there using it?

Share this post


Link to post
Share on other sites

CodeLab 2.2 Released

This is only for Paint.NET 4.0!

Changes:

▪ When opening a .cs file the directory is now remembered for next time. (Why did I take so long to implement this?!)

▪ Build form has a new section: Forced Settings (Rarely used)

  • The option for forcing aliased selection was moved into this section

    This can be specified in the script as a comment:

    // Force Aliased Selection

  • A new option was added for forcing the effect to run in a single thread

    This can be added to a script using the following comment:

    // Force Single Threaded

    This only works once the dll has been built. While in the editor the effect is still running multi-threaded.

Grab the CodeLab DLL here:

http://www.boltbait.com/pdn/CodeLab/

Support the development of CodeLab

$

I haven't gotten a donation for CodeLab in a while. Is anyone out there using it?

Share this post


Link to post
Share on other sites

This causes Paint.Net to reliably crash

With CodeLab v1.8 or 2.2 and with Paint.Net 4.x,

 

Open the CodeLab effect and go to gui designer and make a "reseed" button (or just type out the code for it)

byte amount1 = 0;

Deleting the description that supplies the default number and name will cause Paint.Net to simply crash.  This also happens when you begin typing the description if the effect tries to update the preview.

Share this post


Link to post
Share on other sites

Thanks for the report. I can reproduce the problem.

 

Exception details:

System.NullReferenceException: Object reference not set to an instance of an object.

   at PaintDotNet.Effects.CodeLabConfigDialog.Build(Boolean toDll, String submenuname, String menuname, String iconpath, String Author, Int32 MajorVersion, Int32 MinorVersion, String SupportURL, String WindowTitleStr, Boolean isAdjustment, Boolean ShowSource, String Description, String KeyWords, Boolean ForceAliasSelection, Boolean ForceSingleThreaded)

   at PaintDotNet.Effects.CodeLabConfigDialog.tmrCompile_Tick(Object sender, EventArgs e)

   at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)

   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
I'll check out the code later tonight and see if I can code a fix.

EDIT: Would have been nice if the error message had included a line number. That's a huge functions and it took me a long time to find the issue.

  • Upvote 1

Share this post


Link to post
Share on other sites

Hey, I don't know if you're taking requests or if this is even possible with Indirect UI, but I was wondering if you could add a simple separator as a gui option. And I was hoping (because it's probably not possible) if you could have tabs (please with sugar)

Share this post


Link to post
Share on other sites

I can only expose what Rick has given us to work with. Sorry, Paint.NET doesn't have those controls.

Share this post


Link to post
Share on other sites

Hey, I don't know if you're taking requests or if this is even possible with Indirect UI, but I was wondering if you could add a simple separator as a gui option. And I was hoping (because it's probably not possible) if you could have tabs (please with sugar)

 

A not just CodeLab related response to this request is here

Share this post


Link to post
Share on other sites

Receiving this error:

File: C:\Program Files\paint.net\Effects\CodeLab.dll
      Name: PaintDotNet.Effects.CodeLab
      Version: 2.3.5341.33520
      Author: Copyright © 2014 BoltBait
      Copyright: C# Code Editor for Paint.NET Plugin Development
      Website: http://www.boltbait.com/pdn/CodeLab/
      Full error message: System.NotSupportedException: The invoked member is not supported in a dynamic assembly.
   at System.Reflection.Emit.InternalAssemblyBuilder.get_Location()
   at PaintDotNet.Effects.CodeLabConfigDialog..ctor()
   at PaintDotNet.Effects.CodeLab.CreateConfigDialog()
   at PaintDotNet.Menus.EffectMenuBase.RunEffectImpl(Type effectType) in d:\src\pdn\paintdotnet\src\PaintDotNet\Menus\EffectMenuBase.cs:line 910

FinalUpdate: Looks like StewienFilters.dll was the culprit, CodeLab opened with every other plugin except this one.

Edited by CentauriBoy

Share this post


Link to post
Share on other sites

I'm getting the same error as CentauriBoy, escpecially if I'm calling CodeLab after one of my own plugins (like PrintIt). :-(

 

It may be the case that the reason is that all my plugins are compiled against .NET 3.5 which has an effect to the CLR using 4.0.

Searching the web I found the following

 

http://vagif.bloggingabout.net/2010/07/02/net-4-0-and-notsupportedexception-complaining-about-dynamic-assemblies/

 

Maybe a simular modification would help to avoid these exceptions in CodeLab.

Edited by midora

Share this post


Link to post
Share on other sites

If I create an CodeLab Adjustment plugin without specifying a submenu when building the DLL, instead of putting the plugin in the main adjstment menu, it puts it in a submenu with a empty name. Perhaps that's what's intended, though I hope not.

Edited by MJW

Share this post


Link to post
Share on other sites

If I create an CodeLab Adjustment plugin without specifying a submenu when building the DLL, instead of putting the plugin in the main adjstment menu, it puts it in a submenu with a empty name. Perhaps that's what's intended, though I hope not.

Yeah, I messed that code up the last time I was in there. I'll fix and post a new version tomorrow.

Sorry about that!

Share this post


Link to post
Share on other sites

Thanks Boltbait! I've been out of the Paint.NET/CodeLab loop for a while, since because the version update, I had to wait till I finally replaced my ancient XP computer.

Share this post


Link to post
Share on other sites

CodeLab 2.4 Released

This is only for Paint.NET 4.0!

Changes:

▪ Fixed the bug described by MJW above that placed adjustments in the wrong submenu.

▪ May have fixed the bug CentauriBoy and midora reported above relating to loading dynamic assemblies.*

Grab the CodeLab DLL here:

http://www.boltbait.com/pdn/CodeLab/

*I can't reproduce on my machine. I did put a try/catch block around assembly loading to see if that fixes the issue.

  • Upvote 1

Share this post


Link to post
Share on other sites

CodeLab 2.4 in Russian

 

You can find the new version of CodeLab in Russian here.

 

Вы можете найти новую версию CodeLab на русском языке здесь.

Edited by ReMake

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.