Face Transfer Automation - Referencing Existing Widgets - Help
I am trying to automate the process of face transfer.
The idea is to pass the file path and gender type to a function. The function will then use the image and generate the model.
My initial approach was to use the DzFaceTransferSelectImageAction. But this prompts the browse to locate image dialogue, which beats the whole purpose of automation.
In order to bypass, I need to either get the function that is invoked by the Action (which I don't know due to the lack of documentation). The second option is to reference the combo box widget, and populate it with the file path without ever interacting with the locate image dialogue. The rest of the steps are easy.
Here is the code:
oPaneMgr = MainWindow.getPaneMgr()actionMgr = MainWindow.getActoinMgr()// Reference the paneoFTPane = oPaneMgr.findPane("DzFaceTransferPane")// Reference the options menuoptions = oFTPane.getOptionsMenu().getItemList()// Trigger the select image// This is the part I want to change since it prompts the select image dialogueactionMgr.findAction("DzFaceTransferSelectImageAction").trigger()// Generate model (I will add a conditional whether the passed parameter for gender is male or female)actionMgr.findAction("DzFaceTransferGenerateMaleAction").trigger()
I have tried to get the reference to the combo box using this method
var CMB = oFTPane.findChild("FaceTransferSourceImageCmb")
However, this doesn't work. It results in the following error:
TypeError: Result of expression oFTPane.findChild [undefined] is not a function
I am not sure why. It seems that the findChild() method is not included in the DzPane, even though it inherits from the QObject class which does have this method.
I have looked up Rob's examples for making a silenced importer/exporter and they will come very handy at a later stage. But, I can't apply them here. To change the image dialogue settings, I need to call the function directly, not the action itself.
So, to summaerize:
- Is there a way for me to locate an existing widget on a pane?
- Is there a way to get the function names the are executed by an Action? CallBack methods?
- Is there a different way to achieve the desired effect (silencing the image dialogue and passing a file path)?
Any help is much appreciated. Thanks in advance.
Comments
Do bear in mind that not every function of a plug-in is necessarily exposed to scripting.
You mean that these functions could be private?
In that case, I believe my best option would be to locate the combo box widget and pass variables to it directly. Maybe use a general approach to loop thorough all QObjects till I locate this one (not sure if this is even possible).
I have tried looking into the Face Transfer script files but they seem to be encrypted. Makes sense, since there is a free and unlimited version of this plug-in. Will purchasing the interactive license give me access to the plug-in's source code? I have read the description of the interactive license but it seems vague to me, not really sure what it unlocks.
Not sure if this means access to the source code or something else.