There is no way to replicate the same behaviour of Colour / Menu Palettes / Link to External to an external and existent palette.
PaletteList::createPaletteAtLocation() doesnt works when location is EXTERNAL
and these functions don’t work either (at least they are docummented with ocation : One of the valid [PaletteLocation] constants in that context. Any value except [PaletteLocation.EXTERNAL])
PaletteList::addPaletteAtLocation()
PaletteList::insertPaletteAtLocation()
We, the tools/pipeline developers, try to improve the efficience of productions trying to make the life easier for animators and trying to reduce the human caused errors, usually executing/configuring a lot of things on scenes automatically instead doing manually by a person.
The problem (I have already reported several times this kind of message) is that currently we are very limited by the Harmony API.
Update: After digging more in the docs I have found this class PaletteLocator
It has this function that seems that is what I need:
bool importPaletteAtLocation (String palettePath, int location, int elementId, String paletteName)
but the doc is wrong because to get the PaletteLocator in scene we have to do it through a function that doesnt exist:
PaletteObjectManager.getLocator()
Checking dinamically the properties of the PaletteObjectManager I have seen that its have a Locator property, so trying to use it to use its importPaletteAtLocation function but there is not any luck. It always returns false.
This is the code I use to test it:
var p = PaletteObjectManager;
MessageLog.trace("PaletteObjectManager Properties");
MessageLog.trace(JSON.stringify(p));
MessageLog.trace("----------------------------");
var locator = PaletteObjectManager.Locator;
MessageLog.trace("PaletteObjectManager.Locator -> " + locator.toString());
MessageLog.trace("----------------------------");
var success = locator.importPaletteAtLocation("c:/ZinkiaWorks/bpy_ch0001.plt", PaletteObjectManager.Constants.Location.EXTERNAL, -1, "bpy_ch0001");
MessageLog.trace(success);
and this is the output
T: 13:47:48.012 PaletteObjectManager Properties
T: 13:47:48.013 {"objectName":"PaletteObjectManager","Constants":{"objectName":"","Location":{"objectName":"","ENVIRONMENT":86,"JOB":74,"SCENE":83,"ELEMENT":69,"EXTERNAL":88},"ColorType":{"objectName":"","SOLID_COLOR":0,"LINEAR_GRADIENT":1,"RADIAL_GRADIENT":2},"PaletteListType":{"objectName":"","Scene":2,"Element":1,"Hidden":8,"Unspecified":4}},"Locator":{"objectName":""}}
T: 13:47:48.014 ----------------------------
T: 13:47:48.014 PaletteObjectManager.Locator -> SCR_PaletteLocator(0x201da4b0fc0)
T: 13:47:48.015 ----------------------------
T: 13:47:48.015 false
Note: In every call, the pointer to the PaletteLocator changes.
Any clue to achieve this? Or I have to edit programatically the PALETTE_LIST file and add the link manually?