Jump to content

CodeLab v6.0 (for advanced users) Released June 25, 2020


Recommended Posts

  • 4 weeks later...

CodeLab 5.4 Released

This is only for Paint.NET 4.2.11+!

 

Small (but important) update today...

 

Changes:
▪ Improved suggested variable names (toe_head2001)

▪ Improvemens in Autocomplete and Intellisense (toe_head2001)

▪ Generate Type Definitions on F12. You can now see definitions inside of libraries. (toe_head2001)

▪ Remember scroll positions (and other things) when switching tabs (toe_head2001)

▪ Rewrite File New Template for up to 2 Scratch Surfaces, also bug fixes and better code (BoltBait)

 


Grab the CodeLab DLL here:

 

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

 

 

File New Template Improvements:

 

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

 

In previous versions, the blend modes had the top and bottom layers swapped--that's fixed in this build.  The code generated should also be easier to understand.

 

(This is the last update before toe_head2001 rewrites the entire compiler section.)

  • Like 1
  • Upvote 3
Link to post
Share on other sites
  • BoltBait changed the title to CodeLab v5.4 (for advanced users) Released May 21, 2020
  • 4 weeks later...

Is there any way to make autocomplete less aggressive? It's driving me crazy. I try to type "x = ", and it changes "x" to "BinaryPixelOp" (?) when I press the space bar (even though "x" is a defined, in-scope variable at the time). The only way I can find to prevent it is to left click the mouse after every variable I type. I'd far rather have no autocomplete at all than too much.

Link to post
Share on other sites
21 minutes ago, MJW said:

... I try to type "x = ", and it changes "x" to ...

 

There does appear to be a bug here. I'll investigate.

 

22 minutes ago, MJW said:

The only way I can find to prevent it is to left click the mouse after every variable I type.

 

You can also press the Esc key.

Link to post
Share on other sites
24 minutes ago, MJW said:

Is there any way to make autocomplete less aggressive? It's driving me crazy. I try to type "x = ", and it changes "x" to "BinaryPixelOp" (?) when I press the space bar (even though "x" is a defined, in-scope variable at the time). The only way I can find to prevent it is to left click the mouse after every variable I type. I'd far rather have no autocomplete at all than too much.

 

I can not get this to fail as you describe. Can you show me the script you're editing and where your cursor is when you type "x ="?

Link to post
Share on other sites

I wish it worked the other way around: press Esc or something very specific like that to do the autocomplete, otherwise, skip it. Most of the time, I'd rather just type stuff in myself. (And I'm not even a good typist.)

Link to post
Share on other sites
void XYCoords(int ix, int iy, out double x, out double y)
{
    x = (double)ix; y = (double)iy;
    x = zoomScale * (x - centerX);
    y = zoomScale * (y - centerY);
}

 When I got to the point of typing "x =".

 

But that's just one of many times autocomplete inserted something I didn't want.

Link to post
Share on other sites

Yeah, the auto complete box just needs to prioritize exact matches. Should be easy to fix.

 

5 minutes ago, MJW said:

I wish it worked the other way around

 

We are doing the "standard" way. I don't know of any editor that does it the inverse way.

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

Yeah, the auto complete box just needs to prioritize exact matches. Should be easy to fix.

 

It may be more complicated than that.  When I entered his example, the autocomplete box didn't list "x" in it.

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

When I entered his example, the autocomplete box didn't list "x" in it.

 

Did you resolve the build errors before trying?

Method parameters are "parsed" through Reflection of the built effect. So, if there are build errors, those parameters won't get parsed.

Link to post
Share on other sites

I think prioritizing the exact match would greatly improve it. However, as BoltBait just mentioned, currently the list doesn't always include the actual thing. Another example of this is that I have a class-level variable called c2. When I type it, the only autocomplete selection is some "Func2" thing.

Link to post
Share on other sites

User-Defined types and type members are also parsed via Reflection.

Make sure the code was successfully compiled at least once before you try to get an AutoComplete for a field.

 

(The build can fail afterwards, since a build failure won't clear out the previously set AutoComplete items.)

Link to post
Share on other sites
6 minutes ago, BoltBait said:

This can happen if the code hasn't compiled yet

 

How can I compile code that's incomplete and therefore has a number of syntax errors?

Link to post
Share on other sites
6 minutes ago, MJW said:

 

How can I compile code that's incomplete and therefore has a number of syntax errors?

 

Well, in the second example, of adding "int c2;" you can build.

 

In the case of adding a function:

 

void XYCoords(int ix, int iy, out double x, out double y)
{
    x = (double)ix; y = (double)iy;
    x = zoomScale * (x - centerX);
    y = zoomScale * (y - centerY);
}

 

There's not much that you can do about it except don't type "out" both times, compile, then put them in.

 

Type it in like this:

 

void XYCoords(int ix, int iy, double x, double y)
{
    
}

Build, then type "out" before both out variables.  It works then.

 

Pain in the butt, I know.

 

As I said in a previous post, this situation is a paradox for CodeLab and I'm not sure we could correct something like that.

Link to post
Share on other sites

XYCoords() is just one function among many that might not compile. If autocomplete doesn't work properly until the code is complied, perhaps it should be disabled until then.

Link to post
Share on other sites
  • BoltBait changed the title to CodeLab v6.0 (for advanced users) Released June 25, 2020

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