Commit Graph

1583 Commits

Author SHA1 Message Date
Bastien Montagne
74361eebe6 Fix T58772: Stray "forward" and "up" options in 2.8 import addons?
Nice side-effect of using new __annotations__ thingy to store
dynamically-generated fields in a class: __annotations__ dict is not
ensured to exist for a given class, so we may end up modifying on of the
parents' one!
2018-12-05 11:08:57 +01:00
Campbell Barton
9b933ccdf6 Fix error reloading scripts
Operator.is_registered needs to use RNAMeta class.
2018-12-04 17:54:54 +11:00
Campbell Barton
e1b8645c6a Keymap: use strict format for keymap definitions
Ensure we use lists for keymap items and item properties.

This means scripts can access keymap definitions from other layouts,
manipulating them without sometimes encountering a tuple that needs
to be converted into a list.
2018-12-02 14:02:03 +11:00
Brecht Van Lommel
e03eaf5b81 Fix wrong property name in preview render Python script. 2018-11-29 18:26:48 +01:00
Sergey Sharybin
7c7f3776dd Use collection and instance terminology in Python API
This follows naming convention agreed on in T56648.
2018-11-28 18:22:51 +01:00
Campbell Barton
1b870bce85 Tool System: remove custom tool registration
API is not ready for beta (likely to change).
2018-11-28 10:40:02 +11:00
Campbell Barton
c906cdc197 Cleanup: remove unused code & add comments 2018-11-26 16:07:03 +11:00
Campbell Barton
7493848008 3D View: remove 3D cursor
Use 3D cursor from the scene (was previously used for local-view).
2018-11-26 14:02:09 +11:00
Campbell Barton
48b0695806 Cleanup: unused vars, imports 2018-11-26 09:27:25 +11:00
Campbell Barton
811814b60c Keymap: remove redundant keys from toolbar popup
Adjust the keymap so tools that don't exist wont use keys
from the default keymap.
2018-11-23 15:46:47 +11:00
Campbell Barton
ca5dd63618 Fix toolbar keymap accumulating items
Create a temporary keymap with items from the original.
2018-11-23 15:19:57 +11:00
Campbell Barton
5155572fc7 Keymap: add popup keymap
Allow manually mapping keys for the popup toolbar.

Useful for tools that don't have immediate access,
add transform, annotate & measure.
2018-11-22 16:52:57 +11:00
Campbell Barton
d0ac13d6b1 Cleanup: minor simplification of keyconfig merge 2018-11-22 16:33:57 +11:00
Campbell Barton
d5f1d4f789 Cleanup: utility function to avoid duplicate keys 2018-11-22 11:54:53 +11:00
Campbell Barton
553307bec1 Tool System: auto-assign A-Z keys for toolbar popup
Assign keys based on tool name when they're free, allows:
Space-T for Transform, Space-A for Annotate.
2018-11-22 11:35:46 +11:00
Campbell Barton
120be7740d Fix toolbar popup keymap not allowing 'A' key 2018-11-22 11:33:10 +11:00
Campbell Barton
3b7daa5bf4 Tool System: Updates for keymap stored as string 2018-11-22 11:13:53 +11:00
Campbell Barton
a9bf6a3b3a UI: hide keymap preferences when filter is used 2018-11-22 07:52:34 +11:00
Bastien Montagne
ed1ee89288 I18N: tweak some UI labels and tips. 2018-11-21 12:06:59 +01:00
Bastien Montagne
76d602f38d Add option not to print debug/info in ngon_tessellate.
That func can be called a lot, generating a lot of noise in the
console...
2018-11-20 12:35:05 +01:00
Campbell Barton
9d85cf0d54 Theme: avoid right-shift in XML files
Use 2 space indent for attributes, ~20% smaller files.
2018-11-20 13:15:26 +11:00
Campbell Barton
9a1796797e Keymap: update addon register/unregister utilities
Use the same data format and loader that the default key-maps use.

This supports nested properties (needed for macros)
and fixes modal key-maps which weren't supported.

This format still needs to be documented.
2018-11-20 12:37:04 +11:00
Campbell Barton
916446e83f Cleanup: move keymap hierarchy into own file 2018-11-20 11:38:13 +11:00
Campbell Barton
bb5a96e76e Cleanup: move toolbar keymap generation to bl_keymap_utils
The function is getting complicated, any refactoring
would be best done outside of 'space_toolsystem_common'.
2018-11-20 11:17:36 +11:00
Campbell Barton
f8c16b0175 Cleanup: move bpy_extras.keyconfig_utils to own module
bpy_extras were meant to be useful high-level helper functions for
script authors to perform common operations,
to avoid writing to verbose API's.

bpy_extras.keymap_utils contains some specialized API calls
mainly intended for Blender's own internal use.

Move keymap import export to internal API.
2018-11-20 11:06:01 +11:00
Campbell Barton
5f9de429ac UI: show keyconfig prefs directly under preset
The keyconfig preset and it's preferences were too far apart,
show the preferences under the preset in a collapsible box.
2018-11-20 09:15:53 +11:00
Campbell Barton
3b48620098 Cleanup: naming 2018-11-19 07:04:24 +11:00
Campbell Barton
0f1a63d34c PyAPI: add bpy.utils.execfile
Wraps `importlib.util`, avoids duplicate preset loading calls.
2018-11-18 11:49:03 +11:00
Bastien Montagne
2589263b6e Fix related to T57851: broken normalmap handling in py shader wrapper.
Pretty stupid mistake...
2018-11-16 14:59:30 +01:00
Campbell Barton
c1f5ccb11a Keymap: allow filling in existing key-configs
Needed so we can get the preferences of a key-config
which are sent to a function that generates the contents.
2018-11-16 16:00:37 +11:00
Campbell Barton
0f21b64b1a WM: fix hard coded rename
Currently the filenames are used when setting keymaps.
This hard coded naming meant the preset and setting function
need to be kept in sync.

Prefer to not have hard coded replacements which need to be duplicated.
2018-11-16 09:37:18 +11:00
Brecht Van Lommel
088be7eb2f Keymaps: replace select / action mouse system
For Blender builtin configurations the option to choose the select mouse remains
and is now also in the splash screen. It works by changing the keymap dynamically
in the script, rather than using special events.

The system of automatic switching of events was not flexible enough to deal with
side effects that require further keymap changes, so it is now under more manual
control in the script.

This breaks compatibility for some scripts and exported key configurations.
These can be fixed by replacing SELECTMOUSE, ACTIONMOUSE, EVT_TWEAK_S and
EVT_TWEAK_A with appropriate LEFTMOUSE, RIGHTMOUSE, EVT_TWEAK_L and
EVT_TWEAK_R events.

Other than that, there should be no functional changes.
2018-11-16 08:31:00 +11:00
Philipp Oeser
cfb6f14616 Fix node_shader_utils: "Specular Tint" is a float (not a color) 2018-11-15 17:52:40 +01:00
Campbell Barton
48c137ad5d UI: remove node tree panels
This duplicates items in the add menu and uses a lot of vertical space.

This should be used for tools or disabled.
2018-11-15 19:36:32 +11:00
Campbell Barton
5ec1d709e7 WM: use Python bytecode cache to run presets
Key-maps can be very large, avoid parsing on every startup.
2018-11-15 18:46:00 +11:00
Campbell Barton
b3d84853ac Keymap: remove keymap export that wrote API calls
Use new keymap format which defines data to be loaded.
2018-11-15 13:51:55 +11:00
Campbell Barton
8734a09379 Tool System: use preset keymap loading logic
The data structures for tool keymaps and presets were different,
use the same structure and expose function publicly.
2018-11-15 13:38:27 +11:00
Jacques Lucke
46ac317a29 Py API Docs: documentation for gpu_extras.presets 2018-11-14 16:43:48 +01:00
Brecht Van Lommel
7aae28af2d Keymaps: refactor loading of default keymap, fix bugs.
This refactors loading of key configurations to clear and refill existing
ones, rather than adding a new one and then removing the old one.

This fixes broken loading of non-default configurations after recent changes,
and prepares for future changes to make it possible to dynamically change
key configurations based on user preferences.
2018-11-13 18:22:07 +01:00
Jacques Lucke
77238819f4 Python GPU API: gpu_extras.presets.draw_texture_2d
Review wasn't finished yet, but I just commit this for now so that I can make some progress..

Differential Revision: https://developer.blender.org/D3901
2018-11-13 16:20:16 +01:00
Jacques Lucke
7f2401532e style fix 2018-11-12 18:04:48 +01:00
Jacques Lucke
bb39e33d25 Fix: draw_circle_2d not using the segment count from parameter list 2018-11-12 17:54:51 +01:00
Bastien Montagne
fd65ebf39a Fix T57776: Error when adding a Torus to the scene.
Not all Object.select_set() cases had been updated to new API... Tsst. ;)
2018-11-11 11:22:38 +01:00
Jacques Lucke
7c227e4740 Py API Docs: Warnings for some properties that are slower to access than expected. 2018-11-09 12:07:10 +01:00
Campbell Barton
04cdf8d040 Keymap: skip loading the keymap preset in background mode
Caused a crash on exit and isn't needed.
2018-11-09 11:43:45 +11:00
Brecht Van Lommel
3064da1200 Keymap: move builtin keymaps from C to Python
This should be purely an implementation change,
for end users there should be no functional difference.

The entire key configuration is in one file with ~5000 lines of code.
Mostly avoiding code duplication and preserve comments and utility
functions from the C code.
It's a bit long but for searching and editing it's also convenient to
have it all in one file.

Notes:

- Actual keymap is shared by blender / blender_legacy
  and stored in `keymap_data/blender_default.py`

  This only generates JSON-like data to be passed into
  `keyconfig_import_from_data`, allowing other presets to load and
  manipulate the default keymap.

- Each preset defines 'keyconfig_data'
  which can be shared between presets.

- Some of the utility functions for generating keymap items still
  need to be ported over to Python.

- Some keymap items can be made into loops (marked as TODO).

See: D3907
2018-11-09 11:33:06 +11:00
Jacques Lucke
9a38526be0 Py API Docs: show gpu_extras module 2018-11-07 15:45:28 +01:00
Bastien Montagne
7b38df41ae Fix/cleanup RNA viewlayer API.
RNA's ViewLayer would present 'first level' of layer collection as a
list (collection property), when it is actually now only a single item,
same as the scene's master collection.

Note: did not try to update view_layer python tests, those are already
fully broken for quiet some time I guess (they still assume
view_layer.collections to be mutable e.g.)...
2018-11-06 17:20:49 +01:00
Campbell Barton
10d7ebc469 Merge branch 'master' into blender2.8 2018-11-01 16:20:52 +11:00
Campbell Barton
38f57734ea Cleanup: move progress utility module into bpy_extras
Try avoid having too many toplevel modules with generic names.
2018-11-01 16:19:49 +11:00