Jump to content

LinkValuesBasedOnBoolean not working for FileTypes?


Recommended Posts

I ran into a strange issue with the LinkValuesBasedOnBooleanRule when updating my Image Tiling FileType plugin.

 

The values remain linked even when the checkbox is unchecked.

My code appears to match the samples for this rule, so I am not sure if this is a bug in my code or Paint.NET.

 

OnCreateSavePropertyCollection:

Spoiler

public override PropertyCollection OnCreateSavePropertyCollection()
{
    const int DefaultTileSize = 256;
    const int MinTileSize = 8;
    const int MaxTileSize = 2048;

    List<Property> props = new List<Property> {
        new Int32Property(PropertyNames.TileHeight, DefaultTileSize, MinTileSize, MaxTileSize),
        new Int32Property(PropertyNames.TileWidth, DefaultTileSize, MinTileSize, MaxTileSize),
        new BooleanProperty(PropertyNames.SquareTiles, true)
    };

    List<PropertyCollectionRule> rules = new List<PropertyCollectionRule> {
        new LinkValuesBasedOnBooleanRule<int, Int32Property>(
            new object[] { PropertyNames.TileHeight, PropertyNames.TileWidth },
            PropertyNames.SquareTiles,
            false)
    };

    return new PropertyCollection(props, rules);
}

 

 

Here is the compiled DLL.

 

TileImageFileType.zip

PdnSig.png

Plugin Pack | PSFilterPdn | Content Aware Fill | G'MICPaint Shop Pro Filetype | RAW Filetype | WebP Filetype

The small increase in performance you get coding in C++ over C# is hardly enough to offset the headache of coding in the C++ language. ~BoltBait

 

Link to comment
Share on other sites

  • 2 months later...

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