Rick Brewster

CodeLab v4.1 (for advanced users) Released October 22, 2018

Recommended Posts

CodeLab 3.0 Released

This is only for Paint.NET 4.0.20+!

 

HUGE update today...

 

Editor Changes:

▪ PDN Dark Theme compatibility (toe_head2001)
▪ New 'Find & Replace' panel with expanded functionality (toe_head2001)
▪ Edit -> Format Document. Automatic line indentation, and whitespace trimming from line ends (toe_head2001)
▪ F12 to 'Go To Definition'. Objects from the .Net Framework open docs.microsoft.com; objects from UserScript go to location in document (toe_head2001)
▪ Proper "Intelligent Assistance" for User Defined type members (fields, methods, ect. in your script), and type members defined in the Effect class (EnvironmentParameters, IsCancelRequested, ect.) (toe_head2001)
▪ Autocomplete box can now be filtered object type (Class, Property, Keyword, ect.) (toe_head2001)

▪ Bug fix: Red underlines for errors are now correctly located (toe_head2001)
 

Code Generation Changes:

▪ Int and Double sliders can now have decorations (BoltBait)
▪ Users can have controls disabled based on the status of other controls (enable/disable checkbox, etc.) (BoltBait)
▪ OnSetRenderInfo can be optionally utilized in the UserScript via the PreRender method. (toe_head2001)
▪ All File > New templates rewritten to utilize the new PreRender() function (BoltBait)
▪ Bug fix: Radio buttons and Drop-down lists now properly set default values (toe_head2001)

 

 

Grab the CodeLab DLL here:

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

 

 

Big shout-out to @MJW for helping design and test all the new features!

 

CodeLabRules.png

 

 

  • Like 3
  • Upvote 2

Share this post


Link to post
Share on other sites

^^^ This is black magic! Pure witchcraft and wizardry!  :MagicWandTool:

Job well done! Those guys are awesome!   *tuts his own horn, and breaks his arm off patting himself on the back*  :lol:

Do we even need Visual Studio anymore? :P

 

 

Nearly 12 years ago, it was written:

Quote

Please note that this ... is not meant to provide a robust development environment.

 

I think it's safe to say that we now have the most robust development environment of any image manipulation program. :trophy:

 

11 hours ago, BoltBait said:

Autocomplete box can now be filtered object type (Class, Property, Keyword, ect.)

Here are the keyboard commands to invoke filtering within the AutoComplete box:

Alt+L    Local Variables and Parameters

Alt+O    Constants

Alt+P    Properties

Alt+F    Fields

Alt+M    Methods

Alt+C    Classes

Alt+S    Structs

Alt+E    Enums

Alt+K    Keywords

 

 

Enjoy the new features and bugfixes.

  • Like 2
  • Upvote 2

Share this post


Link to post
Share on other sites

Thank you very much for this wonderful tool!

 

Do you think it's possible to add a Classic Color control (existing in Windows) other than the pdn Color Wheel?
It would take up much less space in the UI.

Share this post


Link to post
Share on other sites
1 minute ago, xod said:

Do you think it's possible to add a Classic Color control (existing in Windows) other than the pdn Color Wheel?
It would take up much less space in the UI.

 

CodeLab only supports IndirectUI controls built-in to paint.net itself.

Share this post


Link to post
Share on other sites

Thanks!

 

I think @toe_head2001 and I make a good team.  He focuses on the Editor and I focus on the Code Generation.

Share this post


Link to post
Share on other sites
On 1/11/2018 at 9:14 PM, Ego Eram Reputo said:

... you guys rock!

Yeah, we rock... your socks off. :lol:

 

My ToDo list for CodeLab still isn't empty either. :P

Share this post


Link to post
Share on other sites

Some comments on formatting:
- if the comment ends in a bracket, below statement is wrongly indented
- also for more 'using' statements

 

N59iTeb.png

Share this post


Link to post
Share on other sites

Question from a total noob...

 

Is there a way to quickly preview the dialog without having to publish, move the effect to appropriate location, and run PDN to see if it works?  Or is this more for Visual Studio where the ability to use XML editor to customize the location of each interactive feature?

 

Thanks.

Share this post


Link to post
Share on other sites
4 hours ago, xod said:

Some comments on formatting:
- if the comment ends in a bracket, below statement is wrongly indented
- also for more 'using' statements

Thanks for the report. I'll get these fixed. I suspect there more small issues with it, yet to be discovered.

Once we make "bug free", I'd like to automatically execute the 'Format Document' feature.  For example, when you paste in code, 'Format Document' would just automatically run on that pasted code.

 

1 hour ago, TrevorOutlaw said:

Is there a way to quickly preview the dialog without having to publish, move the effect to appropriate location, and run PDN to see if it works? 

No there is not. Previewing the dialog from CodeLab would technically be possible, but that's very low on my list of priorities.

 

1 hour ago, TrevorOutlaw said:

Or is this more for Visual Studio where the ability to use XML editor to customize the location of each interactive feature?

When you derive from PropertyBasedEffect, you can't customize the dialog extensively. You literally declare a short list of properties, and paint.net generates a dialog at runtime based on those properties (this is colloquially  know as "IndirectUI").

 

If you need a fully custom dialog, you have to tediously build it from scratch with WinForms controls.

Share this post


Link to post
Share on other sites
12 minutes ago, toe_head2001 said:

Is Checked  OR  Is 0

Is Not Checked  OR  Is not 0

 

Thanks, these a lot of things has cleared at once.

Share this post


Link to post
Share on other sites

CodeLab 3.00 in Russian

 

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

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

  • Like 1

Share this post


Link to post
Share on other sites
4 hours ago, toe_head2001 said:

No there is not. Previewing the dialog from CodeLab would technically be possible, but that's very low on my list of priorities.

 

I figured as much.

Share this post


Link to post
Share on other sites

Can such object operations be defined, which let to change all of the channels together such these codes can to changed together as Instead of this

 

CurrentPixel.R = PrimaryColor.R + 25;
CurrentPixel.G = PrimaryColor.G + 25;
CurrentPixel.B = PrimaryColor.B + 25;
CurrentPixel.A = PrimaryColor.A + 25;

we can simply use.

CurrentPixel = PrimaryColor + 25;

 

Share this post


Link to post
Share on other sites
14 hours ago, Pratyush said:

Can such object operations be defined, which let to change all of the channels together such these codes can to changed together as Instead of this

 

You could create a function for that.

void Render(Surface dst, Surface src, Rectangle rect)
{
    ColorBgra PrimaryColorColor = EnvironmentParameters.PrimaryColor;

    ColorBgra CurrentPixel;
    for (int y = rect.Top; y < rect.Bottom; y++)
    {
        if (IsCancelRequested) return;
        for (int x = rect.Left; x < rect.Right; x++)
        {
            CurrentPixel = IncrementAllChannels(PrimaryColorColor, 25);
            
            dst[x,y] = CurrentPixel;
        }
    }
}

ColorBgra IncrementAllChannels(ColorBgra color, int amount)
{
    return ColorBgra.FromBgraClamped(color.B + amount, color.G + amount, color.B + amount, color.A + amount);
}

 

Share this post


Link to post
Share on other sites

You could even make it an extension method so you could use:

CurrenPixel = PrimaryColor.Add(25);

 

Share this post


Link to post
Share on other sites

You have to place the extension methods in a static, non-nested class. That's not possible with CodeLab.  Technically it could be, but it would "break" older versions of CodeLab.

Share this post


Link to post
Share on other sites
On 1/13/2018 at 10:14 AM, TrevorOutlaw said:

Is there a way to quickly preview the dialog without having to publish, move the effect to appropriate location, and run PDN to see if it works?

We got this working tonight.

You'll be able to run the script with a fully functional UI, directly from within CodeLab, without building a dll file and installing it.

preview-dialog.png

  • Like 2
  • Upvote 4

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now