Commit Graph

19 Commits

Author SHA1 Message Date
f3fb1df192 Fix T86293: crash undoing after executing the python console in certain
scenarios

In general, I could not find a reason executing from the python console
should not do an Undo push. Running a script from the Text Editor does
this as well and this seems generally useful.

Without an Undo push, one can easily run into situations were IDs have
been added or removed and undo on would then cause trouble (e.g. first
selection then bpy.ops.object.duplicate() -- this crashed as reported in
T86293 -- duplicate does not get its own undo push because it is not the
last op in the list, wm->op_undo_depth is not zero). This has changed
with the Undo refactor, so in essence the root cause is the same as
T77557, Legacy Undo does not suffer from the crash (but misses
the generally useful undo push from the console still)

Now add Undo to CONSOLE_OT_execute bl_options ('UNDO_GROUPED' seems more
appropriate than plain 'UNDO' since pasting multiple lines of code will
call CONSOLE_OT_execute multiple times in a row).

Maniphest Tasks: T86293

Differential Revision: https://developer.blender.org/D10625
2021-03-05 12:50:55 +01:00
08dbc4f996 PyAPI: use postponed annotations to support Python 3.10
Support Python 3.10a5 or 3.9x with support explicitly enabled.

- Enable Python's postponed annotations for Blender's RNA classes
  types registered on startup.

- Using postponed annotations has implications for how they are defined,
  since they must evaluate in the modules name-space instead of the
  classes name-space. See changes to annotations in `release/scripts`.

- Use `from __future__ import annotations` at the top of the module
  to ensure the script will run with Python 3.10.

- Old logic is kept since it could be used if PEP-649 is supported.

Resolves T83626

Ref D10474
2021-02-21 22:37:53 +11:00
Yevgeny Makarov
622b30225a UI: Capitalization Corrections
Approximately 141 changes of capitalization to conform to MLA title style.

Differential Revision: https://developer.blender.org/D8392

Reviewed by Julian Eisel
2020-10-24 11:42:17 -07:00
09aa799e53 PyAPI: Use annotations for RNA definitions
- Logical use of fields since they define type information.
- Avoids using ordered-dict metaclass.

Properties using regular assignments will print a warning and load,
however the order is undefined.
2018-07-11 22:18:09 +02:00
532c8ac583 Cleanup: pep8 function indentation 2018-06-26 19:58:56 +02:00
ad7fb1c028 Cleanup: Python imports
Split over lines to diff more easily.
2017-11-29 18:05:41 +11:00
9bdda427e6 PyAPI: remove bpy.utils.register_module()
In preparation for it being removed, see: T47811
2017-03-18 20:03:24 +11:00
e17c6f79a5 cleanup: py imports 2015-01-28 16:50:51 +11:00
8e6ce736c4 disable auto indent when pasting text into the python console. 2013-05-24 01:04:37 +00:00
e77729f5dd Fix a few more cases where an operator should not show in the search menu. 2013-04-26 02:44:21 +00:00
9fa36b12cc style cleanup: pep8 2012-10-08 08:28:05 +00:00
257c6de9ac copy as script operator for the console, so you can copy input from a console for use in a textblock. 2012-08-19 21:32:18 +00:00
98e6912480 style cleanup 2012-06-19 22:17:19 +00:00
bb2b1694ab workaround for python3.3 alpha with the console. 2012-05-17 15:24:26 +00:00
bab7b47a71 code cleanup: minor edits, use function for getting console module. 2012-04-15 14:51:37 +00:00
fda2045150 correct spelling errors in comments 2011-10-17 06:58:07 +00:00
8a423f59ea pep8 cleanup and fix for keymap test operator from my own recent fix. 2011-09-26 15:39:15 +00:00
ea32492dd5 SVN maintenance. 2011-09-22 20:37:22 +00:00
e17ee1b415 2.6 Python UI files:
* Moved Operators from bl_ui into bl_operators.
* Renamed HELP_OT_operator_cheat_sheet to WM_OT_operator_cheat_sheet.
2011-09-22 19:50:41 +00:00