Jump to content
How to Install Plugins ×

CodeLab v6.12 for Paint.NET 5.0.12 (Updated February 11, 2024)


Recommended Posts

It's not just the out variables. For instance, if I intend to define new variables at class level, meaning to type "double a, b;", when I get to the point of typing the "b", it unhelpfully replaces the "b" with "double" unless I left click or press escape. Because I'm not much of a typist, I spend most of my time looking at the keyboard, so I end up with all kinds of senseless stuff due to autocomplete.

Link to comment
Share on other sites

13 minutes ago, BoltBait said:

Well, CodeLab can offer suggestion for everything that was valid as of the last successful compile.

 

But that doesn't help much when I'm initially entering a new program, so there isn't yet a compilation.

Link to comment
Share on other sites

  • 2 weeks later...

CodeLab 6.0 Released

This is only for Paint.NET 4.2.12+!

 

HUGE update today...

 

Changes:
 Switch to the Roslyn compiler to support C# 7.3 syntax (toe_head2001)
Added new Settings screen (BoltBait)
Build can now be executed by pressing F6 (BoltBait)
Syntax highlighting for Escape characters in strings is now enabled (toe_head2001)
Compiler Warning Level can now be changed (0-4) (toe_head2001)
Individual compiler warnings can be ignored (toe_head2001)
Added support for Extended Color syntax highlighting (VS '19 colors) (toe_head2001)
Added Spellchecking. Checks strings and comments in C# code, and plain text documents (toe_head2001)
Other new Settings include: Indent Spaces (2 or 4) and Current Line Frame (toe_head2001)
Minor code refactoring and bug fixes (toe_head2001 and BoltBait)

 


Grab the CodeLab DLL here:

 

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

 

 

File New Template Improvements:

 

(This feature was fixed in CodeLab v5.4, but I wanted to remind you of this change here as this was going to be saved for the 6.0 release. I did tweak it a bit for this release just to finish it.)

 

When I completely rewrote the File New Templates in CodeLab 5.0, I was under the assumption that it was OK to use the DST surface as a scratch surface during the calculation of your final results.  This is OK under some very narrow circumstances, but generally this should be avoided.  (This could cause your effects to have different results when previewing your effect and when clicking OK to finalize your image.)  In this release, I have removed this capability and replaced it with a second scratch surface called AUX.  So, now you have access to the source surface (SRC) which is your layer before any changes are made, a working surface (WRK) to use as a scratch surface if necessary, a second working surface (AUX) to use if necessary, and of course the destination surface (DST) where you store your final calculated pixels.

 

NewComplexUI.png

 

 

New Features:

 

  • Spellchecking:  

 

The Spellcheck feature does not work on Windows 7, since the required Windows Spellcheck competent is not present there.

Additional language dictionaries can be added in the Windows Settings. Languages that display an ABC✓ icon are compatible with Spellcheck.

Misspelled words can be ignored via the light bulb menu.  The ignore list can be managed on the Settings screen.

 

image.png

 

How to add additional spellcheck enabled languages from your Windows Settings screen:

 

Win10-Langs.png

 

  • Roslyn Compiler:

 

By switching to the Roslyn compiler, we now support up to C# 7.3 syntax.  So, EER will be happy to know that the following script will compile without error in CodeLab v6.0:

 

// Name: Roslyn Test
#region UICode
#endregion

void Render(Surface dst, Surface src, Rectangle rect)
{
    ColorBgra CurrentPixel;
    for (int y = rect.Top; y < rect.Bottom; y++)
    {
        if (IsCancelRequested) return;
        for (int x = rect.Left; x < rect.Right; x++)
        {
            CurrentPixel = src[x,y];

            // Roslyn C# v7.0 syntax:
            switch (x)
            {
                case int n when (n >= 0 && n <= 25):
                    CurrentPixel = ColorBgra.Yellow;
                    break;
                case int n when (n >= 26 && n <= 50 ):
                    CurrentPixel = ColorBgra.Brown;
                    break;
                default:
                    CurrentPixel = ColorBgra.Gray;
                    break;
            }
            // End Test

            dst[x,y] = CurrentPixel;
        }
    }
}

 

It is not required to have Visual Studio on your system in order to take advantage of the Roslyn compiler... we are shipping a copy built-in to CodeLab, just like Visual Studio does.

 

As a side benefit to using the Roslyn compiler, we get better location information for syntax errors.  So, look for more accurate placing of those red underlines.

 

(BTW, we do not support C# 8.0 language features yet as that requires the Core library.  But, that will be easy for us to add once Paint.NET switches over to Core.)

 

  • Settings Screen:

 

In previous versions of CodeLab, there was lots of stuff in the View menu.  I have moved all of those settings into the new Settings screen.  Toe_head2001 moved his Snippets Manager in here as well.

 

image.png

 

 

  • Compiler Warnings:

 

Compiler warnings are now underlined in green. If you wish to ignore specific warning messages, right-click on one of those warnings and choose "Ignore this Warning" from the context menu. 

 

image.png

 

You can manage your ignore list on the settings screen:

 

image.png

 

Enjoy! 😎 :beer:

 

  • Like 1
  • Upvote 5
Link to comment
Share on other sites

  • BoltBait changed the title to CodeLab v6.0 (for advanced users) Released June 25, 2020
#region UICode
MultiLineTextboxControl text = "Some text here"; // [32767]
#endregion

In Preview Effect mode ► MultiLineTextboxControl is initialized with the empty string.
It is possible to keep the entered text?

Link to comment
Share on other sites

3 hours ago, NSD said:

#region UICode
MultiLineTextboxControl text = "Some text here"; // [32767]
#endregion

In Preview Effect mode ► MultiLineTextboxControl is initialized with the empty string.
It is possible to keep the entered text?

 

You can easily do this by converting your CodeLab script to a Visual Studio project.

 

We will consider this for the next release of CodeLab. But, barring a catastrophic error, the plan is for CodeLab v6.0 to live for a long time.  This will give us time to focus on other things, like update our individual plugin packs and tutorials, and develop new plugins, etc.

  • Upvote 2
Link to comment
Share on other sites

  • 2 weeks later...

Couple of questions, maybe someone can redirect where to ask this if this isn't the right place.

 

Would anyone be interested in helping me port my Nuget package DataJuggler.PixelDatabase to a plug in for Paint.Net.

 

I installed Code Lab, but the examples I have seen all use sliders, I need a text box, and a button, not a slider, and I gave up when I hit a 'What do I know'.

 

Currently the most up to date version of my library is the .Net Core version that powers my site built in Blazor called PixelDatabase.Net.

 

I have a .Net Framework version, but I stopped support it due to everything is moving to .Net Core in VNext.

 

Is a .Net Framework the only Nuget I can link to?

 

I tried and didn't get very far due to sliders. Can someone recommend a plug in project that uses a text box instead of a slider?

 

Users all like controls such as sliders, but text is more powerful to me as you don't have to change your GUI to add new features.

 

PixelDatabase uses Bitmap Query Language, and I think some Paint.Net users will find it useful because I sure do.

 

Thanks

Link to comment
Share on other sites

On 3/11/2006 at 6:59 PM, BuzzKill said:

Thanks for the post!

For advanced users is correct! I myself have no idea how to write code.

However, there are some cool effects in the "Samples" folder included in the .zip file that you can fool around with. If for nothing else, grab this plugin for the included effects!

I know exactly how you feel BuzzKill. I know how to write code, even C# image processing code, but I don't know how to write this code, yet.

 

I did my first plug in, but it doesn't do what the tutorial said it would do.

 

The problem with computers is, they don't what you tell them. This is not to be confused with what you want it do.

Link to comment
Share on other sites

On 6/26/2020 at 3:47 PM, BoltBait said:

Thank you. How do I convert the CodeLab project to a VS project? I read that somewhere.

Edit: Here is the link, I found it: https://boltbait.com/pdn/CodeLab/help/tutorial5.asp

FYI this page still mentions: 'I am using Visual Studio 2010 Express.' It is 2020 now and VS 2019 has been out for a quite a while.

 

 

Quote

 

You can easily do this by converting your CodeLab script to a Visual Studio project.

 

We will consider this for the next release of CodeLab. But, barring a catastrophic error, the plan is for CodeLab v6.0 to live for a long time.  This will give us time to focus on other things, like update our individual plugin packs and tutorials, and develop new plugins, etc.

 

Edited by DataJuggler
Link to comment
Share on other sites

22 minutes ago, DataJuggler said:

Edit: Here is the link, I found it: https://boltbait.com/pdn/CodeLab/help/tutorial5.asp

 

Don't waste your time with that. The process was automated a few years ago. Just click on the 'Generate VS Solution' in CodeLab.

(September 25th, 2023)  Sorry about any broken images in my posts. I am aware of the issue.

bp-sig.png
My Gallery  |  My Plugin Pack

Layman's Guide to CodeLab

Link to comment
Share on other sites

20 minutes ago, toe_head2001 said:

 

Don't waste your time with that. The process was automated a few years ago. Just the click on the 'Generate VS Solution' in CodeLab.

Just so you are aware my vision is not very good, but that being said, I do not see a 'Generate VS Solution' in CodeLab.

 

This is an old adage, but a picture is worth a thousand words here, and I will add 3 more. Please Show Me.

 

I found it. You have to click Build DLL, and at the bottom there is a Generate VS Solution. Sorry, I am new to all this.

 

Thanks

 

Generate VS Solution.png

 

Edited by DataJuggler
Link to comment
Share on other sites

1 hour ago, toe_head2001 said:

Don't waste your time with that. The process was automated a few years ago.

 

This is exactly why we want v6.0 to live for a long time so we can have time to update all of the outdated tutorials.

 

1 hour ago, DataJuggler said:

I found it. You have to click Build DLL, and at the bottom there is a Generate VS Solution.

 

I'm glad you found it. Yes, that's exactly it.  Just be sure to fill out the form completely before pressing that button so that the info on that form makes it's way to the new project.

Link to comment
Share on other sites

  • 3 weeks later...

It is possible to set this in CodeLab?

new EffectOptions () {Flags = EffectFlags.Configurable, RenderingSchedule = EffectRenderingSchedule.Tiles1024x1024})

This seems to offer the highest rendering speed on my system.

Link to comment
Share on other sites

  • 2 months later...

I just made my first plugin. What an awesome tool! Thank you.

 

One question. I'm not sure what I'm doing wrong, but I can't figure out what enables the other radio buttons in the Build DLL dialog so that I can write up a short summary of how to use my plugin.

image.png.ad8a4add9fb518c891c8148dc8e0841b.png

Link to comment
Share on other sites

1 hour ago, grandoth said:

I'm not sure what I'm doing wrong, but I can't figure out what enables the other radio buttons in the Build DLL dialog so that I can write up a short summary of how to use my plugin.

 

Looks like there is a bug in CodeLab.  Here's probably what you did: When you clicked File > New, you selected the "Custom Help" checkbox.  From that moment on, CodeLab assumes you're going to write your own help system.  Even if you delete all the source code that it generates because of that, it still thinks you're going to write your own.  I'll file a bug for this and take a look at it this weekend (if @toe_head2001doesn't beat me to it).

Link to comment
Share on other sites

18 minutes ago, BoltBait said:

 

Looks like there is a bug in CodeLab.  Here's probably what you did: When you clicked File > New, you selected the "Custom Help" checkbox.  From that moment on, CodeLab assumes you're going to write your own help system.  Even if you delete all the source code that it generates because of that, it still thinks you're going to write your own.  I'll file a bug for this and take a look at it this weekend (if @toe_head2001doesn't beat me to it).

I believe I simply opened CodeLab (Effects-Advanced-CodeLab...), started with the code that defaulted in the editor, made my changes and saved it. However, when I do the same thing now, it works fine 🤷‍♂️. You may be right. Perhaps my short term memory is failing 😄. Thanks for looking.

 

UPDATE:
I've tried a few more times using default code, new through the menu, and the new toolbar ensuring it was unchecked (trying first ticking it and unticking it). I have only gotten the radio buttons enabled a few times. I can't find any repeatable behavior enabled vs disabled. I'll update again if I find something repeatable.

Edited by grandoth
Link to comment
Share on other sites

29 minutes ago, toe_head2001 said:

The radio buttons are also disabled if your plugin has no Controls.

 

No Controls -> No  Dialog -> No Help

I just discovered that myself 😁 reviewing the git repo source. Makes sense now that I understand what it's for. Sorry for the confusion.

Link to comment
Share on other sites

23 minutes ago, NSD said:

Is it legal to use this control in our plugins created in VisualStudio?

 

Yes, you can use the control in a Visual Studio plugin.

The CodeLab source code license can be found at https://github.com/BoltBait/CodeLab/blob/master/LICENSE.

PdnSig.png

Plugin Pack | PSFilterPdn | Content Aware Fill | G'MICPaint 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

2 hours ago, NSD said:

CodeLab source contains a very useful custom control - PdnColor.
Is it legal to use this control in our plugins created in VisualStudio?


You can use it, but it’s pretty big. You might have better luck with this one: 

 

https://forums.getpaint.net/topic/31390-hex-color-wheel/

 

Hope this helps. 

Link to comment
Share on other sites

2 hours ago, BoltBait said:

You can use it, but it’s pretty big. You might have better luck with this one: 

 

The one in CodeLab shouldn't be too difficult to resize.

 

If you want a simplified Color Wheel based on the same code, take a look at the Tartan plugin.

 

That original one from TR is sooo buggy.  I do not recommend it.

(September 25th, 2023)  Sorry about any broken images in my posts. I am aware of the issue.

bp-sig.png
My Gallery  |  My Plugin Pack

Layman's Guide to CodeLab

Link to comment
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.

×
×
  • Create New...