Max 8.6 + Live color theme issues (locked_bgcolor with dynamic color)

tyler mazaika's icon

In this configuration I'm having problems with the locked_bgcolor attribute when set to a Dynamic color name ("Device Background").

Live 11.3.20

Max 8.6

Trouble is, it's only happening in .amxd that I froze/exported a while back, and which have worked correctly for more than a year.

I've tried to reproduce the issue from scratch by mixing and matching devices exported from Max as old as 8.3.3, but I can't seem to cause the problem.

Pictures of the issue below. Is anyone else able to reproduce something like this?

Thanks,

Tyler

Expected display. locked_bgcolor is "Device Background" Live 11.3.20 using Max 8.5.7

locked_bgcolor lost it's dynamic color setting (?). Live 11.3.20 using Max 8.6.


Joshua Kit Clayton's icon

Hi Tyler,

Can you attach a copy of the device, or send to support ?

We'd love to know exactly what circumstances lead to this so that we can solve it.

Thanks,

Joshua

tyler mazaika's icon

Emailed support a different (and somewhat simpler) device that also reproduces the issue. It's affecting quite a few of mine.

FWIW changing Live's theme updates the color correctly.

tyler mazaika's icon

Aaaah. Very simple I think:

1) Set a custom locked_bgcolor dynamic color value to the patcher

2) Apply a theme preset which has a "Locked Patcher Background Color" as part of its style.

3) Export.

Joshua Kit Clayton's icon

Thank you! We'll look into a fix!

tyler mazaika's icon

Hi Joshua, is there a fix for this regression in the pipeline? I notice this issue still isn't fixed with Max 9.0.5 + Live 12 and I've received emails from users of my device about this issue now. I filed a support ticket for this, concurrent with this forum post, with the following result:

This request was closed and merged into request #97372 "Re: New reply on "Max 8.6 + Live...".

I can workaround this in new devices but due to the weird nature of updating Max for Live device files I was really hoping this unsightly issue would've been resolved without needing to push an update to users and have them replace any/all copies of the device that may exist on their system.

Joshua Kit Clayton's icon

Sorry! There is still no true support for dynamic colors being part of a style. Unfortunately, as far as I am aware, they will be loaded once and then stored as a specific color within the style. Resolving this is a complicated task and I don't have any time estimate.

For now, I would recommend using your patcher's color default attributes (optionally via template) rather than styles for managing this. I know that the multiple ways to determine color in Max is confusing and frustrating, and that there could be big improvements to reconcile styles, themes, and dynamic colors. It's just a very big project.

tyler mazaika's icon

Hi Joshua,

I get that the terminology is confusing: To be clear, the dynamic color is not part of the patcher's style setting.

The style was part of (or referenced from) the patch template, and it's called "LiveUI_DeepSpring". LiveUI_DeepSpring uses only static colors. I then overrode the locked_bgcolor attribute of the patcher to be "Device Background" using the Inspector.

It seems to me like there is just some order-of-operations or precedence that doesn't play out logically when the device loads.

Notice the "theme" from the patcher has colors overrides shown in the toolbar.

Also, this only happens if the patcher color override uses a dynamic color e.g. "Device Background".

Left side is static color override test (works). Right side is "Device Background", which doesn't work, revealing the text which is colored with "Device Background"
Max865 patcher style override locked_bgcolor (dynamic).amxd
amxd
Max865 patcher style override locked_bgcolor (static).amxd
amxd

It's difficult to fathom a justification for the behavior of the attribute overrides to behave differently. And indeed, they did not until Max 8.6 arrived. Is the order of precedence/operations in determining the locked_bgcolor really different in the two cases?

My original ticket #97371 was closed "Solved", referencing a ticket which is cloned from this forum thread, #97372. That ticket is also marked as "Solved", without marking any related issues tracking this AFAIC. So I don't know where this issue is being tracked or if the test app I supplied has ever been opened.

tyler mazaika's icon

Unfortunately, as far as I am aware, they will be loaded once and then stored as a specific color within the style.

That's doesn't seem to be what's happening in this case, because the "Device Background" locked_bgcolor is not getting stored as any specific color. If it were, it would likely be a gray Live-ish theme color, rather than the fixed rgba hospital-greenish color that appears. (And that was the static color defined in the "LiveUI_DeepSpring" style).

Joshua Kit Clayton's icon

Ah thank you for the clarification. This does seem to be some order of operations loading and applying the patcher's style attribute after the dynamic color has been set.

In our bug backlog this issue is #18995, and I've also added this thread to that ticket (which has other cases that are similar).

To be honest, for the time being, I would simply avoid combining styles and dynamic colors in any way. Either use a style and have everything a fixed color, or only use dynamic colors/default colors on the top level patcher's default colors and any specific objects. At this point, styles poison dynamic theme compatibility.

Here's a little 9.0.5 example for flushing everything in a patcher to eliminate custom styles and colors that might be helpful in whatever logic you want to have for setting colors in a patcher hierarchy. Hope this helps.

function bang()
{
	force_patcher_colors(this.patcher);
	this.patcher.applydeep(apply_colors);
}

function apply_colors(o)
{
	var p = o.subpatcher();
	if (p) {
		force_patcher_colors(p);
	} 

	setallcolordefaults(o);

    return true;
}

function setallcolordefaults(o)
{
	var attrnames = o.getboxattrnames();
	
	//post(o.maxclass, "-----------------\n");
	for (const name of attrnames) {
		var style = o.getboxattrattr(name, "style");
		// post(name, style, "\n");
		if (style == "rgba") {
			o.setattrdefault(name);
		}
	}
}

function force_patcher_colors(p)
{
	p.setattr("style", "");
	
	var attrnames = p.getattrnames();
	
	for (const name of attrnames) {
		var style = p.getattrattr(name, "style");
		if (style == "rgba") {
			p.setattrdefault(name);
		}
	}
	
    return true;
}

Max Patch
Copy patch and select New From Clipboard in Max.