I got this code from my info window when I rotate my object at a certain angle:

bpy.ops.transform.rotate(value=-0.744767, orient_axis='Y', orient_type='GLOBAL',
 orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL',
 constraint_axis=(False, True, False), mirror=True, proportional='DISABLED',
 proportional_edit_falloff='SMOOTH', proportional_size=1, release_confirm=True)

How do I save this as an add-on once I paste it in the text editor? I'd like to map it to a hotkey afterwards so I can perform it often.

  • 1
    $\begingroup$ This would require a tutorial, keep in mind that Blender 2.8 API is not finalized yet, it's being amended a lot recently, and there's really no documentation and many features are still not made yet. $\endgroup$ – Georges Apr 4 at 11:08
  • $\begingroup$ Thank you for the honest response. So I take it there is no tutorial available right now to find out how to save it to a button? $\endgroup$ – GoodNight Apr 4 at 20:51
  • 1
    $\begingroup$ No, that's not what I meant, I'm sure there is a way, but since the API will most probably see further modification, there's a chance that any development you do now, might not work later. I developed an addon for 2.7X amended it for 2.8 a month ago, then after a more recent update it stopped working. $\endgroup$ – Georges Apr 4 at 21:24
  • $\begingroup$ Ah, got it. Well, putting updates and future problems aside, do you have any ideas how to accomplish this at the moment? I've spent the last 5 days watching every tutorial I could find on how to do this, but so far I haven't found any tutorial that answers this problem. Thank you for your time- $\endgroup$ – GoodNight Apr 4 at 22:45
  • 1
    $\begingroup$ I don't have my computer in front of me ATM, but you can check python templates in the text editor, there are many templates of UI elements, but you need to have some knowledge in python, and Blender API (bpy), also keep in mind that some code in the info listener might not run in the console or scripts, Blender uses python as an intermediate language, the core is written in C and some parts in C++, for instance, if you change the transform orientation, you'll see in the listener something like bpy.context.scene.type = "GLOBAL" , if you copy paste this in a script and run, you'll get an error $\endgroup$ – Georges Apr 4 at 22:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.