xod

Unfinished plugins

Recommended Posts

16 minutes ago, xod said:

1. I can't figure out how to disable 'Inner circle', 'Outer circle' and 'Pen width' when I uncheck 'Draw the circles'.

 

Did you take a look at the example in my 'Graph Paper' plugin?

https://github.com/toehead2001/pdn-graph-paper/blob/master/GraphPaper/GraphPaper.cs#L204

 

19 minutes ago, xod said:

2. If I modify the Alpha channel for any Colors tab and then run the Pan or Rotator controls (not the sliders) the canvas is not updated with the chosen color.

I'm guessing the Effect Token only gets updated when Focus leaves the Alpha textbox.  When you click on the Pan or the Rotator, the Focus remains in the textbox (as evidenced by the blinking text caret).

You might be able to create a work-around, but I'd have to take a close look at it to be sure.

Share this post


Link to post
Share on other sites

I'm trying to translate my plugins into my language and everything goes right except for the title in the

window that remains unchanged. Is there a trick I should know?

Spoiler

public string DisplayName => LangStrings.EffectName;

using System.Globalization;

namespace TestEffect
{
    internal static class LangStrings
    {
        private static readonly string UICulture = CultureInfo.CurrentUICulture.Name;

        internal static string EffectName
        {
            get
            {
                switch (UICulture)
                {
                    case "ro":
                        return "The effect name in my language";
                    default:
                        return "The effect name in english";
                }
            }
        }
...

 

 

Share this post


Link to post
Share on other sites

Try

 

Spoiler

using System.Globalization;

namespace TestEffect
{
    public class PluginSupportInfo : IPluginSupportInfo
    {
        public string DisplayName => LangStrings.EffectName;
    }

    internal static class LangStrings
    {
        private static readonly string UICulture = CultureInfo.CurrentUICulture.Name;

        internal static string EffectName
        {
            get
            {
                switch (UICulture)
                {
                    case "ro":
                        return "The effect name in my language";
                    default:
                        return "The effect name in english";
                }
            }
        }
...

 

 

Share this post


Link to post
Share on other sites

Thanks ReMake but I already have these lines of code:

Spoiler

 public class PluginSupportInfo : IPluginSupportInfo
    {
        public string Author => base.GetType().Assembly.GetCustomAttribute<AssemblyCopyrightAttribute>().Copyright;
        public string Copyright => LangStrings.EffectDescription;
        public string DisplayName => LangStrings.EffectName;
        public Version Version => base.GetType().Assembly.GetName().Version;
        public Uri WebsiteUri => new Uri("http://www.getpaint.net/redirect/plugins.html");
     }

 

 
 
 
 
 
29/5000
 
 
 
 
 
 
 
29/5

Share this post


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

... the title in the window that remains unchanged.

 

Is the title hardcoded in the plugin's constructor?

Example:

public RulerEffectPlugin()
  : base("My Plugin Title", null, null, EffectFlags.Configurable)
{
}

 

 

Does your plugin override OnCustomizeConfigUIWindowProperties?

Example:

protected override void OnCustomizeConfigUIWindowProperties(PropertyCollection props)
{
    props[ControlInfoPropertyNames.WindowTitle].Value = "My Plugin Title";
  
    base.OnCustomizeConfigUIWindowProperties(props);
}

 

  • Upvote 1

Share this post


Link to post
Share on other sites

Thanks again @toe_head2001. I don't know what I would do without your help.
I changed the folowing line and everything works fine now.

props[ControlInfoPropertyNames.WindowTitle].Value = "Test";

props[ControlInfoPropertyNames.WindowTitle].Value = LangStrings.EffectName;

 

Edited by xod

Share this post


Link to post
Share on other sites

This plugin is a remake of the ImageInText plugin.
You need the OptionBasedLibrary v0.7.9 dll and dlc to be in the paint.net folder.

Location: Effects > Text Formations submenu.

 

The UI:

 

d7e7Pqe.png

 

 

TextMask.zip

  • Like 1

Share this post


Link to post
Share on other sites

Very cool!

 

Lorem Ipsum is out of date - you need to use Zombie Ipsum! 🧟‍♂️

 

Zombie ipsum reversus ab viral inferno, nam rick grimes malum cerebro. De carne lumbering animata corpora quaeritis. Summus brains sit, morbo vel maleficia? De apocalypsi gorger omero undead survivor dictum mauris. Hi mindless mortuis soulless creaturas, imo evil stalking monstra adventus resi dentevil vultus comedat cerebella viventium. Qui animated corpse, cricket bat max brucks terribilem incessu zomby. The voodoo sacerdos flesh eater, suscitat mortuos comedere carnem virus. Zonbi tattered for solum oculi eorum defunctis go lum cerebro. Nescio brains an Undead zombies. Sicut malus putrid voodoo horror. Nigh tofth eliv ingdead. 🧟‍♀️

 

😀

 

Share this post


Link to post
Share on other sites
3 hours ago, Ego Eram Reputo said:

Very cool!

 

Lorem Ipsum is out of date - you need to use Zombie Ipsum! 🧟‍♂️

 

Zombie ipsum reversus ab viral inferno, nam rick grimes malum cerebro. De carne lumbering animata corpora quaeritis. Summus brains sit, morbo vel maleficia? De apocalypsi gorger omero undead survivor dictum mauris. Hi mindless mortuis soulless creaturas, imo evil stalking monstra adventus resi dentevil vultus comedat cerebella viventium. Qui animated corpse, cricket bat max brucks terribilem incessu zomby. The voodoo sacerdos flesh eater, suscitat mortuos comedere carnem virus. Zonbi tattered for solum oculi eorum defunctis go lum cerebro. Nescio brains an Undead zombies. Sicut malus putrid voodoo horror. Nigh tofth eliv ingdead. 🧟‍♀️

 

😀

 

 

That's bizarre and fantastic, although it looks like Daryl Dixon was editing Latin while having a sneezing fit. I love it!

 

  • Like 1

Share this post


Link to post
Share on other sites
On 5/8/2017 at 1:30 PM, xod said:

In this place we would like to post unfinished plugins made with CodeLab but which could be a source of inspiration for beginners.
I'll start with a fun(?) plug-in that can be further developed by those who want to do it.

  Reveal hidden contents


        // Name: LongiStripes
        // Submenu: Render
        // Author: xod 
        // Title: LongiStripes
        // Version: 1.0
        // Desc: 
        // Keywords: 
        // URL: 
        // Help: 
        
        #region UICode
        DoubleSliderControl Amount1 = 0.75; // [0,1] Size
        IntSliderControl Amount2 = 100; // [0,400] Thickness
        ColorWheelControl Amount3 = ColorBgra.FromBgr(205,0,0); // [MediumBlue] Color
        DoubleSliderControl Amount4 = 0; // [0,1] Stripe1
        DoubleSliderControl Amount5 = 0.1; // [0,1] 
        DoubleSliderControl Amount6 = 0.3; // [0,1] Stripe2
        DoubleSliderControl Amount7 = 0.7; // [0,1] 
        DoubleSliderControl Amount8 = 0.9; // [0,1] Stripe3
        DoubleSliderControl Amount9 = 1; // [0,1] 
        DoubleSliderControl Amount10 = 1; // [0,1] X Distorsion
        DoubleSliderControl Amount11 = 1; // [0,1] Y Distorsion
        ListBoxControl Amount12 = 0; // Shapes|Ellipse|Rectangle|Triangle
        #endregion
        
        void Render(Surface dst, Surface src, Rectangle rect)
        {
           Rectangle selection = EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt();
           dst.CopySurface(src, rect.Location, rect);
           
            float centX = ((selection.Right - selection.Left) / 2f) + selection.Left;
            float centY = ((selection.Bottom - selection.Top) / 2f) + selection.Top;
            float size = (float)Amount1 * Math.Min(selection.Width - 4, selection.Height - 4);
            float half = size/2f;
            float sp1 = (float)Amount4;
            float sp2 = (float)Amount5;
            float sp3 = (float)Amount6;
            float sp4 = (float)Amount7;
            float sp5 = (float)Amount8;
            float sp6 = (float)Amount9;
            float xDis = (float) Amount10;
            float yDis = (float) Amount11;
            byte shapes = Amount12;
            
               using (RenderArgs ra = new RenderArgs(dst))
               { 
                Graphics g = ra.Graphics;
                g.SmoothingMode = SmoothingMode.AntiAlias;
                g.Clip = new Region(rect);
                 {
                  using (Pen penel = new Pen (Amount3, Amount2))
                  {
                    PointF[] points =
                    {
                    new PointF (centX-half*xDis, centY-half*yDis),
                    new PointF (size,centY-half*yDis),
                    new PointF (centX-half*xDis,size)
                    };
                    
                    if(sp1>=sp2){sp2=sp1;}
                    if(sp2>=sp3){sp3=sp2;}
                    if(sp3>=sp4){sp4=sp3;}
                    if(sp4>=sp5){sp5=sp4;}
                    if(sp5>=sp6){sp6=sp5;}
                    
                    penel.Width = Amount2;
                    penel.CompoundArray = new float[] {sp1, sp2, sp3, sp4, sp5, sp6};
           
           switch (shapes)
                   {
                    case 0: //ellipse          
                    {
                    g.DrawEllipse(penel, centX-half*xDis, centY-half*yDis, size*xDis, size*yDis);
                    }
                    break;
        
                    case 1: //rectangle
                    {
                    g.DrawRectangle(penel, centX-half*xDis, centY-half*yDis, size*xDis, size*yDis);
                    }
                    break;
                    
                    case 2: //triangle
                    {   
                    g.DrawPolygon(penel, points);
                    }
                    break;
                   }
                  }
                 }
               }
        }



 

 

LongiStripes.zip

Whatever it is, I bet it's gonna be very cool.

Share this post


Link to post
Share on other sites
6 hours ago, AndrewDavid said:

... your labels for gradient horizontal and vertical needs to be switched.

 

 

I don't understand what you mean.
A horizontal gradient means that we start with a color on the left and finish on the right with the other color (or vice versa = swap colors).
A vertical gradient means that we start with a color on the top and finish on the bottom with the other color (or vice versa = swap colors).
Same on the reflected case but now we start with the first color in the center of the shape and the second color appears at the edges (or vice versa = swap colors).

 

7 hours ago, Ego Eram Reputo said:

I like the link option for Height & Width. Any chance you could do the same for the four Radii?

 

For pairs 1-2, 3-4 is very simple, but for 3 corners or other combinations, I think the UI is unnecessarily complicated.
4 checkboxes must be created to enable the assigned sliders and a checkbox for their link.
I'm trying to keep the UI as small as possible.

Share this post


Link to post
Share on other sites

Maybe I need an education :)

Think of when you draw a vertical or horizontal line. In my mind I thought they were the same.

Here are the 2 gradients I create

image.png.a133f3308162727e5dd134936ee3b0b1.png

Back to art school 😁

Share this post


Link to post
Share on other sites
8 hours ago, AndrewDavid said:

Maybe I need an education :)

Think of when you draw a vertical or horizontal line. In my mind I thought they were the same.

Here are the 2 gradients I create

image.png.a133f3308162727e5dd134936ee3b0b1.png

Back to art school 😁

 

Your "vertical" line has a "horizontal" gradient.

  • Like 1

Share this post


Link to post
Share on other sites
On 12/9/2018 at 11:24 PM, xod said:

For pairs 1-2, 3-4 is very simple, but for 3 corners or other combinations, I think the UI is unnecessarily complicated.
4 checkboxes must be created to enable the assigned sliders and a checkbox for their link.
I'm trying to keep the UI as small as possible.

 

One checkbox to link all four is what I'm after.

  • Like 1

Share this post


Link to post
Share on other sites

How can I dimmer two sliders?
I can do that but some flickering appear.
There is another way?

 

Spoiler

public enum PropertyNames
        {
            Slider1,
            Slider2,
            Slider3,
            KeepInSync
        }

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

            props.Add(new Int32Property("Slider1", 0,0,100));
            props.Add(new Int32Property("Slider2", 0,0,100));
            props.Add(new Int32Property("Slider3", 0,0,100));
            props.Add(new BooleanProperty("KeepInSync", false));

            List<PropertyCollectionRule> rules = new List<PropertyCollectionRule>();

            rules.Add(new LinkValuesBasedOnBooleanRule<int, Int32Property>(new string[] { "Slider1", "Slider2", "Slider3" }, "KeepInSync", false));
            rules.Add(new ReadOnlyBoundToBooleanRule("Slider2", "KeepInSync", false));
            rules.Add(new ReadOnlyBoundToBooleanRule("Slider3", "KeepInSync", false));

            return new PropertyCollection(props, rules);
        }

 

 

Share this post


Link to post
Share on other sites

In your code, the same condition (KeepInSync) causes the three sliders to be linked and two of them to be hidden, but these two sliders still remain connected.  While the sliders are linked, the hidden sliders will move and flicker all the same.

 

I have the same problem, but I haven't found a solution yet.

Share this post


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