pymiere icon indicating copy to clipboard operation
pymiere copied to clipboard

Illegal Parameter type error with setValue

Open seo-rii opened this issue 2 years ago • 4 comments

Thank you for developing this module! I'd like to let you know because there's an issue. This issue occurs in the motion graphic template code in the example. The problem does not occur until mgt_component is obtained from the mgt clip, but if the value is of the dict type when the set value is called, the execution is stopped with an Illlegal Parameter type error. I am currently running Premier Pro 2021 and using Python 3.8 version. Below is an error message:

Position
{'pymiere_id': 'VCRAgJl6DO'}
Traceback (most recent call last):
  File "C:/Coding/premiere/main.py", line 70, in <module>
    prop.setValue(value, True)
  File "C:\Coding\venv\lib\site-packages\pymiere\objects\premiere_objects.py", line 4924, in setValue
    return self._eval_on_this_object("setValue({}, {})".format(_format_object_to_es(value), _format_object_to_es(updateUI)))
  File "C:\Coding\venv\lib\site-packages\pymiere\core.py", line 176, in _eval_on_this_object
    result = _eval_script_returning_object(line)
  File "C:\Coding\venv\lib\site-packages\pymiere\core.py", line 469, in _eval_script_returning_object
    result = eval_script(script, decode_json=True)
  File "C:\Coding\venv\lib\site-packages\pymiere\core.py", line 114, in eval_script
    raise ExtendScriptError(response_decoded)
pymiere.core.ExtendScriptError: 
Error at line 2 : Illegal Parameter type
 1	try{
 2	var tmp = $._pymiere['xa9jqbfCgf'].setValue({"""pymiere_id""": """VCRAgJl6DO"""}, true);
 3	if(typeof tmp === 'object' && tmp !== null){

I'd appreciate it if you could solve it!

seo-rii avatar Aug 06 '21 14:08 seo-rii

Hi @Seo-Rii, sorry for the long wait... Unfortunately setting a dict type on a properties is not supported, this part of the API is a bit new. Although in the error message {'pymiere_id': 'VCRAgJl6DO'} looks like one of pymiere's representation of an object which should not happen. Could you please share the Motion Graphic Template file you are using for testing purposes (you can send it to [email protected] if you don't wish to share it publicly). In the mean time I'm installing Premiere 2021 so I can test it in your condition.

qmasingarbe avatar Aug 26 '21 14:08 qmasingarbe

test.zip Here you are.

seo-rii avatar Aug 27 '21 02:08 seo-rii

Is there any update about this?

seo-rii avatar Dec 08 '21 11:12 seo-rii

Hi @Seo-Rii

There was indeed a bug where two dimmensional properties, like the Position, weren't properly considered as Array objects. I fixed it and can now manage to move the mogrt around. by editing this property

Two things to note about editing properties:

  • as the doc says, we can't currently set a 'Coumpound property' (like the Source Text in your case that combine, text, font, size etc...). If you want to be able to edit any one of these you have to promote it to another property through an expression in after effect. Due to this limitation, the example code will crash at this specific property in your case.
  • if you want to query or set a color field, you have to use the getColorValue() and setColorValue()

Let me now if you manage to make everything work this time!

qmasingarbe avatar Jan 15 '22 18:01 qmasingarbe