[API] There is no way to link to external palette via scripting

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?

Im trying also to execute the Action performed by the Colour / Menu Palettes / Link to External option through action class but the actions of **paletteView ** responder are not “public” or dont appear as available.

Executing a loop to show all available actions for all available responders, I dont see any of paletteView one, but they are defined in a file called menus.xml (screenshot attached)

var rList = Action.getResponderList();
for(var i=0; i < rList.length; ++i)
{
  	MessageLog.trace( "ResponderIdentity=" + rList[i] );
	var aList = Action.getActionList(rList[i]);
	for(var j=0; j<aList.length; ++j)
	{
	  MessageLog.trace( "      availableAction=" + aList[j] );
	}
}
...
T: 15:48:22.976       availableAction=onActionOnionSkinLinkSliders()
T: 15:48:22.977       availableAction=onActionOnionSkinToggleAdvancedNext(int)
T: 15:48:22.978       availableAction=onActionOnionSkinToggleAdvancedPrev(int)
T: 15:48:22.979       availableAction=onActionOnionSkinAdvancedNextSliderChanged(int,int)
T: 15:48:22.980       availableAction=onActionOnionSkinAdvancedPrevSliderChanged(int,int)
T: 15:48:22.981       availableAction=onActionMaxOpacitySliderChanged(int)
T: 15:48:22.982 ResponderIdentity=paletteView
T: 15:48:22.983 ResponderIdentity=scene
T: 15:48:22.984       availableAction=onActionHideSelection()
T: 15:48:22.985       availableAction=onActionShowHidden()
T: 15:48:22.986       availableAction=onActionRehideSelection()
T: 15:48:22.987       availableAction=onActionInsertPositionKeyframe()
T: 15:48:22.988       availableAction=onActionInsertKeyframe()
T: 15:48:22.989       availableAction=onActionSetKeyFrames()
T: 15:48:22.989       availableAction=onActionInsertControlPointAtFrame()
...