Jump to content

Need Help: Reformatting EffectFlags plugin to EffectOptions


-Mari-

Recommended Posts

I am trying to change the output of the CopySelectionCoords plugin from 
 

left, top, width, height

to

{ "X": left, "Y": top, "Width": width, "Height": height }

I've come across a few issues, but most of it boils down to me not knowing how to properly convert EffectFlags to EffectOptions. I've read this thread and downloaded and looked through OptionBasedLibrary v0.7.9. I've read through all the CodeLab tutorials and searched through the forum using GetPaint's custom search page. I'm a C# novice and I'm trying to use Visual Studio 2019 to edit this plugin for my own use; I've tried using CodeLab, but I'm not sure how to use it to get the output I need.

 

I would greatly appreciate some help since I'm obviously in over my head.

Link to comment
Share on other sites

For the output string change:

string selectionCoords = $"{selection.Left}, {selection.Top}, {selection.Width}, {selection.Height}";

To:

string selectionCoords = $"X: {selection.Left}, Y: {selection.Top}, Width: {selection.Width}, Height: {selection.Height}";

 

(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

If you want to switch to CodeLab, all you need is this:

 

void PreRender(Surface dst, Surface src)
{
    Rectangle selection = EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt();
    string selectionCoords = "X: " + selection.Left + ", Y: " + selection.Top + ", Width: " + selection.Width + ", Height: " + selection.Height;

    Services.GetService<IClipboardService>().SetText(selectionCoords);
}

void Render(Surface dst, Surface src, Rectangle rect)
{
    dst.CopySurface(src, rect.Location, rect);
}

 

(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

Thank you! I tried your first solution, but I thought I'd done something incorrectly. After looking at your original plugin, I think that I must've misunderstood what its purpose was. I was trying to make a selection and have the (x,y) of the top left corner of that selection and the width and height of the selection shown in the output. I appreciate your time.

Link to comment
Share on other sites

3 minutes ago, -Mari- said:

I was trying to make a selection and have the (x,y) of the top left corner of that selection and the width and height of the selection shown in the output.

 

Um, that's exactly what the plugin does.

(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

I figured out what I was messing up. I was selecting the effect then making my selection instead of making my selection and then choosing the effect. Selection -> Copy Selection. I don't know what I was thinking. Thank you so much for your help and for writing the original plugin.

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