Jump to content
How to Install Plugins ×

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


Recommended Posts

What type of code does it use?

Please read the first post in this thread. It gives an overview of this coding environment.

Then, if you are ready, you can read a series of tutorials on my web site on how to create effects with Paint.NET CodeLab.

Link to comment
Share on other sites

  • 2 weeks later...

I have a user interface problem. I'm writing a codelab plugin that has three color wheels. It works when I run the source code, but when I build the DLL, instead of using the assigned colors, the first color wheel uses the primary color and the other two use the secondary color. The compiled code shows that those are the colors that get initialized. I'm using codelab verson 1.8, which is, I believe, the current version. Am I doing something wrong, or, if not, is there a fix or workaround?

 

Source code:

#region UICode
ColorBgra Amount1 = ColorBgra.FromBgr(60,140,170); // Surface Color
ColorBgra Amount2 = ColorBgra.FromBgr(0,0,0); // Lowlight Color
ColorBgra Amount3 = ColorBgra.FromBgr(255,255,255); // Highlight Color
double Amount4 = 0.4; // [0,1] Lowlight Upper Limit
double Amount5 = 0; // [-1,1] Lowlight Nonlinearity
double Amount6 = 0.8; // [0,1] Highlight Lower Limit
double Amount7 = 0; // [-1,1] Highlight Nonlinearity
double Amount8 = 0.299; // [0,1] Red Weight
double Amount9 = 0.587; // [0,1] Green Weight
double Amount10 = 0.114; // [0,1] Blue Weight
#endregion

Compiled code:

        protected override PropertyCollection OnCreatePropertyCollection()
        {
            List<Property> props = new List<Property>();

            props.Add(new Int32Property(PropertyNames.Amount1, ColorBgra.ToOpaqueInt32(ColorBgra.FromBgra(EnvironmentParameters.PrimaryColor.B,EnvironmentParameters.PrimaryColor.G,EnvironmentParameters.PrimaryColor.R,255)), 0, 0xffffff));
            props.Add(new Int32Property(PropertyNames.Amount2, ColorBgra.ToOpaqueInt32(ColorBgra.FromBgra(EnvironmentParameters.SecondaryColor.B,EnvironmentParameters.SecondaryColor.G,EnvironmentParameters.SecondaryColor.R,255)), 0, 0xffffff));
            props.Add(new Int32Property(PropertyNames.Amount3, ColorBgra.ToOpaqueInt32(ColorBgra.FromBgra(EnvironmentParameters.SecondaryColor.B,EnvironmentParameters.SecondaryColor.G,EnvironmentParameters.SecondaryColor.R,255)), 0, 0xffffff));
            props.Add(new DoubleProperty(PropertyNames.Amount4, 0.4, 0, 1));
            props.Add(new DoubleProperty(PropertyNames.Amount5, 0, -1, 1));
            props.Add(new DoubleProperty(PropertyNames.Amount6, 0.8, 0, 1));
            props.Add(new DoubleProperty(PropertyNames.Amount7, 0, -1, 1));
            props.Add(new DoubleProperty(PropertyNames.Amount8, 0.299, 0, 1));
            props.Add(new DoubleProperty(PropertyNames.Amount9, 0.587, 0, 1));
            props.Add(new DoubleProperty(PropertyNames.Amount10, 0.114, 0, 1));

            return new PropertyCollection(props);
        }
Edited by MJW
Link to comment
Share on other sites

Hello MJW,

Codelab always does that - and sets the double vector position boxes to the centre too.

If you take the code output from codelab, then copy and  paste it into the plugin template for Visual Studio you can then set the initial colors to what you want.

Have read through this thread if setting up Visual Studio is a problem.

http://forums.getpaint.net/index.php?/topic/25828-help-needed-using-visual-studio-instead-of-codelab-for-developing/

 

Best of luck!

  • Upvote 1

 

Red ochre Plugin pack.............. Diabolical Drawings ................Real Paintings

 

PdnForumSig2.jpg

Link to comment
Share on other sites

Thank you very much, Red ocre. If I can't find a some trick using codelab to get around the UI bug, I may give the idea of building in Visual Studio a try. I'd prefer to do something within codelab, just because that's what I'm used to. Probably once I got things working under Visual Studio, I'd be glad I switched over, but it seems like quite a bit of effort just to get one silly little plugin working.

Link to comment
Share on other sites

  • 4 weeks later...

Hey, great work. Very easy to work with and well documented.

However, I feel a feature this is lacking (or perhaps I missed the documentation of it) is utilizing the new drop-down feature for presets.

 

I know, you technically can select and use psedo-presets but I'd like Codelab to have a method of updating the users sliders to reflect values set from a preset (or the randomize button)

 

It appears the Amountx values are written to by the users sliders but not vice-versa (makes sense though I wish there was a way to write to the sliders)

 

Example (ignoring that Amounts2-4 would keep getting reassigned without a hypothetical detectChange() and updateSliders() method.

#region UICode
byte Amount1 = 0; // Use Preset|Custom|First Preset
...

if (Amount1 != 0) //not custom
    {
        Amount2 = 5; //preset values (does not update sliders intuitively for user to tweak)
        Amount3 = 10; //preset values (does not update sliders intuitively for user to tweak)
        Amount4 = 15; //preset values (does not update sliders intuitively for user to tweak)
    }

Again hopefully there is a way I just failed to notice but if not this would be much appreciated functionality for many.

Edited by Felix The Ghost
Link to comment
Share on other sites

  • 2 months later...

While this may be fun, hasn't just about everything been done already (other than bug fixes & UI alterations)?

Every time I think that, I'm surprised by the creativity of the programmers here at the forums.

By the way, I've just started making changes to CodeLab to support Paint.NET 4.0. I added the 3D Roll Control last night and I've got some more ideas on the way. (BTW, this is not published yet. I will publish it all together when 4.0 is launched.)

  • Upvote 1
Link to comment
Share on other sites

While this may be fun, hasn't just about everything been done already (other than bug fixes & UI alterations)?

 

In 1898, the commissioner of the US Patent Office reportedly said, "Everything that can be invented has been invented."*

 

In 1943, the CEO of IBM reportedly said, "I think there is a world market for maybe five computers."*

 

In 1962, the Decca Recording Company rejected the Beatles, saying "Guitar groups are on the way out."

 

If you ever think you've seen it all, you're probably wrong.  :-)

 

*(Full disclosure: the first two quotes have contested attribution to those men, but the Decca Beatles rejection is very well documented.)

  • Upvote 1

 

The Doctor: There was a goblin, or a trickster, or a warrior... A nameless, terrible thing, soaked in the blood of a billion galaxies. The most feared being in all the cosmos. And nothing could stop it, or hold it, or reason with it. One day it would just drop out of the sky and tear down your world.
Amy: But how did it end up in there?
The Doctor: You know fairy tales. A good wizard tricked it.
River Song: I hate good wizards in fairy tales; they always turn out to be him.

Link to comment
Share on other sites

Personally, I find that every new plugin I write (or attempt to), leads to ideas for atleast another three! :/

Sadly I do not always have the skills to make them (aargh those nasty R.O.I.s!). The thought that interested and capable programmers have run out of ideas seems such a waste of talent. The forum rules stress that 'this is not a plugin request thread' (Plugin Developer's Central). Perhaps there should be a thread for (experienced) users to describe workable ideas for possible plugins ? - Any interested developers could express an interest in a project (to avoid duplication) and perhaps the combined knowledge and shared source code would be useful for all?

Regarding codelab - it does have limitations but is still very useful. I found codelab far less intimidating than Visual Studio as a place to start learning C#. It is inevitable that there will be duplication of ideas for the simpler plugins but sometimes having the choice of 2 or 3 similar plugins is a good thing. Small differences can be crucial for how useful an effect is. Plugins can easily be uninstalled if you have one that does what you need already. Also, I think it is good to encourage new plugin writers as you never know what they may come up with for their next plugin!

@David - Apparently the Victorians thought they had physics wrapped up but Einstein had other ideas!

  • Upvote 1

 

Red ochre Plugin pack.............. Diabolical Drawings ................Real Paintings

 

PdnForumSig2.jpg

Link to comment
Share on other sites

 

 

While this may be fun, hasn't just about everything been done already (other than bug fixes & UI alterations)?

You can't give up before you start. If you can't think of a new idea then build a better mouse trap ( you'll catch the smarter mice).

 

I come up with ideas just reading through the forum. I have several ideas I still want to try. Notice I said "try".  I don't predetermine my limits, and any failure is learning experience.

 

I use CodeLab for rapid prototyping - all my plugins started in CodeLab whether they ended up there or not. 

Edited by TechnoRobbo
  • Upvote 1

Go out there and be amazing. Have Fun, TR
TRsSig.png?raw=1
Some Pretty Pictures Some Cool Plugins

Link to comment
Share on other sites

Not every plugin is for everyone.

 

The Doctor: There was a goblin, or a trickster, or a warrior... A nameless, terrible thing, soaked in the blood of a billion galaxies. The most feared being in all the cosmos. And nothing could stop it, or hold it, or reason with it. One day it would just drop out of the sky and tear down your world.
Amy: But how did it end up in there?
The Doctor: You know fairy tales. A good wizard tricked it.
River Song: I hate good wizards in fairy tales; they always turn out to be him.

Link to comment
Share on other sites

By the way, I've just started making changes to CodeLab to support Paint.NET 4.0. I added the 3D Roll Control last night and I've got some more ideas on the way. (BTW, this is not published yet. I will publish it all together when 4.0 is launched.)

Then I'll wait until those are released or are revealed not to be. >thanks for the input, people.

I wish we'd all been ready.

Link to comment
Share on other sites

  • 1 month later...

I was developing the next version of CodeLab last night and I'm thinking of making a change of where the DLL file is generated. 

 

Currently, it puts the DLL file in the Paint.NET Effects folder.  This requires Paint.NET to be run as Administrator when developing plugins.  This causes other problems, like you can't drag-and-drop files onto Paint.NET in order to open them, etc.  I've never liked this limitation.

 

In the next version of CodeLab, I'm going to have CodeLab build DLL files to the user's desktop.  In order to see these newly built effects in Paint.NET you will need to move the DLL file to Paint.NET's Effects folder and restart Paint.NET.  I feel confident that plugin developers will not have any trouble handling this.

 

With this change, Paint.NET will no longer have to "run as" Administrator in order to use CodeLab.

 

Anyone have heartburn with this change?

  • Upvote 1
Link to comment
Share on other sites

I'm happy with this change because this was the reason why I never used the save as dll functionality.

But maybe you should allow to set a path (default to desktop). This could also satisfy the 'administrator' users.

  • Upvote 1

midoras signature.gif

Link to comment
Share on other sites

... maybe you should allow to set a path (default to desktop). This could also satisfy the 'administrator' users.

Great idea.

Link to comment
Share on other sites

I'll be the judge of that!

 

You are just the judge who decides what will be implemented.

Not the judge who decides what's a good idea.

;-)

 

Everything is better than writing the the dll into the Program files folder. Desktop just means that you always have to hide all windows and search where it is placed this time. Like looking for the crash log of the old Paint.NET.

midoras signature.gif

Link to comment
Share on other sites

you always have to hide all windows and search where it is placed this time

 

  1. Window+D
  2. Type first letter of plugin
  3. ???
  4. Profit!!

 

The Doctor: There was a goblin, or a trickster, or a warrior... A nameless, terrible thing, soaked in the blood of a billion galaxies. The most feared being in all the cosmos. And nothing could stop it, or hold it, or reason with it. One day it would just drop out of the sky and tear down your world.
Amy: But how did it end up in there?
The Doctor: You know fairy tales. A good wizard tricked it.
River Song: I hate good wizards in fairy tales; they always turn out to be him.

Link to comment
Share on other sites

I still like the idea. Lower-end users will have the desktop default. Power users will set the path of their innermost desire. Everybody happy.

If I have to copy the *.dll from the desktop every time I will cry :cry:

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...