for example auto smooth set angle value fails when pie is run as an add-on enter image description here but it works when run from the text editor enter image description here

this makes no sense to me or I cannot figure out what is wrong. here is a link to the code of the complete pie script.


  • 1
    $\begingroup$ Error message? AttributeError: '_RestrictContext' object has no attribute 'scene' ? If yes, see: wiki.blender.org/index.php/Extensions:2.6/Py/API_Changes Blender now restricts access to bpy.context and bpy.data while register() / unregister(). $\endgroup$ – p2or Jan 28 '16 at 8:14
  • $\begingroup$ Sometimes when figuring ot what causes a bug you stumble into other potential bugs, you define UV_scale_X class multiple times - make each unique. $\endgroup$ – zeffii Jan 28 '16 at 9:12
  • $\begingroup$ don't have a space in your python file name. name it something like some_pie_menu.py. it seems to work here, and does set the angle. In the event you get no warnings / errors you should start to look more carefully at other potential bugs and fixing those first. $\endgroup$ – zeffii Jan 28 '16 at 9:22
  • $\begingroup$ @poor there is sadly no error message with the set autosmooth. What seems to be the issue is the step to check the angel degree and if 180 set it to 30. If I only use set to 30 anyway it all works fine. Sometimes the 180 check works but more often it does not. $\endgroup$ – Claas Kuhnen Jan 28 '16 at 15:26
  • 1
    $\begingroup$ Claas a common and time-tested technique to locate bugs is to remove as much as possible from your code while still being able to demonstrate the problem. You are trying to debug it as a whole, this takes more effort. If you've removed everything you can, and it works as an Add-on and a Script, then gradually add back sections of code, you might find the solution is counter intuitive. $\endgroup$ – zeffii Jan 28 '16 at 15:45

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.