libmypaint icon indicating copy to clipboard operation
libmypaint copied to clipboard

mypaint_mapping_is_constant() doesn't catch inert input mappings

Open briend opened this issue 7 years ago • 1 comments

mypaint_mapping_is_constant() is supposed to be a way to check that an input has any dynamic inputs defined, however MyPaint seems to leave extra settings that are effectively disabled, like:

            "random": [
                [
                    0.0, 
                    0.0
                ], 
                [
                    1.0, 
                    0.0
                ]
            ]

So not only the does it seem to try to interpolate this (see #99 ), but mypaint_mapping_is_constant will return false if you've ever added an input and then erased it. SO, this can be a huge performance penalty because smudge gets turned on:

mypaint-brush.c:785 // update smudge color if (self->settings_value[MYPAINT_BRUSH_SETTING_SMUDGE_LENGTH] < 1.0 && // optimization, since normal brushes have smudge_length == 0.5 without actually smudging (self->settings_value[MYPAINT_BRUSH_SETTING_SMUDGE] != 0.0 || !mypaint_mapping_is_constant(self->settings[MYPAINT_BRUSH_SETTING_SMUDGE])))

So basically a lot of brushes might call get_color even when they shouldn't, unless you 1) manually delete any inputs for the Smudge setting from your brush files, or 2) set Smudge_Length to 1.0. Ack!!

briend avatar Jul 16 '17 06:07 briend

Even though https://github.com/mypaint/mypaint/issues/840 is closed I think we need to do something in the engine, since a lot of brushes will contain these bogus mappings forever. Is there an easy way to evaluate if a set of points is "inert" and can be ignored entirely?

briend avatar Jul 26 '17 06:07 briend