Compile Time Changes

MaterialLegend

The following fields, methods and functions have changed:

// materialLegend.cm
MaterialLegend
    Old: public Material[] used;
    New: final public Material{} usedMaterials();

// legacyMaterialLegends.cm
Old: public void legacyPreFetchPartsHook(Space space);
New: public void clearLegacyTempLegendsHook(Space space);

Runtime/Behavior Changes

Pre-fetch part hook for MaterialLegendController

We have identified several scenarios where material legends using MaterialLegendController were displaying excess materials. The solution is to register a pre-fetch part hook to clear temporary legend materials.

Old:

public FOMatLegendController foMatLegendController("FODataMaterialLegend");


/**
 * Append a SymbolMaterial to the DsMaterialLegend for the specified world.
 */
public void foDataAppendLegendMaterial(Material m, Snapper owner) {
    once {
	    appendPostFinalizeHook(function foDataPostFinalizeLegendHook);
    }

    foMatLegendController.appendLegendMaterial(m, owner, foDataMLCreator);
}

New:

public FOMatLegendController foMatLegendController("FODataMaterialLegend") : keep;


/**
 * Append a SymbolMaterial to the DsMaterialLegend for the specified world.
 */
public void foDataAppendLegendMaterial(Material m, Snapper owner) {
    once {
    	appendPreFetchPartsHook(function foDataPreFetchPartsLegendHook);  // new line
	    appendPostFinalizeHook(function foDataPostFinalizeLegendHook);
    }

    foMatLegendController.appendLegendMaterial(m, owner, foDataMLCreator);
}


/**
 * Pre fetch part hook for clearing temp legend materials.
 */
private void foDataPreFetchPartsLegendHook(Space space) {
    MaterialLegendController controller = foMatLegendController;
    if (controller) controller.clearTempLegendMaterials();
}

For a more generic code you can refer to cm/abstract/material/hooks.cm

Using OfficeMaterialLeg with MaterialLegendController

MaterialLegendController cannot be constructed using "OfficeMaterialLeg" as its auxillary key. If you are affected, you can migrate your old legends by extending MaterialLegendController and override previouslyUsingLegacyMLKey() to return true.

Old:

public MaterialLegendController foMatLegendController("OfficeMaterialLeg") : keep;

New:

public FOMatLegendController foMatLegendController("FOMaterialLegend") : keep;


/**
 * FO MaterialLegendController.
 */
public class FOMatLegendController extends MaterialLegendController {

    /**
     * Previously using OfficeMaterialLeg?
     */
    public bool previouslyUsingLegacyMLKey() {
	    return true;
    }
}