kromar / blender_Shelves

Custom Header Buttons
41 stars 4 forks source link

Invalid syntax error on operator commands with parameters #14

Open ExpnandBanana opened 2 years ago

ExpnandBanana commented 2 years ago

Trying to set up one-click extrapolation types using these buttons but inserting a command with a parameter throws out a syntax error.

In the preset shelf itself, the code reads item_sub_1.button_operator = 'graph.interpolation_type(type='BEZIER')'

Which results in the error Failed to execute the preset: SyntaxError('invalid syntax', ('C:\\Users\\Username\\AppData\\Roaming\\Blender Foundation\\Blender\\3.0\\scripts\\presets\\shelves\\test.py', 16, 62, "item_sub_1.button_operator = 'graph.extrapolation_type(type='BEZIER')'\n"))

Using the code item_sub_1.button_operator = 'graph.interpolation_type' Wont cause any errors but that only brings up the interpolation type menu instead of setting it to Bezier automatically.