Commit Graph

713 Commits

Author SHA1 Message Date
Campbell Barton 039b11f349 PyRNA: all optional args now must be keyword args
In some cases the RNA API should be updated to make arguments use the
'required' flag, instead of adjusting Python scripts.

See T47811
2018-08-28 13:55:11 +10:00
Philipp Oeser 77d70c7f1d Merge branch 'master' into blender2.8 2018-07-16 15:16:00 +02:00
Philipp Oeser 43f0af734e Fix T55944: fbx export error with smoothing face
ddee0931b8 added PROP_RAW_BOOLEAN case for foreach_set, but missed
foreach_get

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D3534
2018-07-16 15:03:21 +02:00
Campbell Barton 5ebebcfbff WM: rename manipulator to gizmo internally 2018-07-14 23:49:00 +02:00
Campbell Barton 415018778c PyAPI: show line, not call-stack for field warning
Was too noisy and hard to tell warnings from exceptions.
2018-07-12 15:22:55 +02:00
Campbell Barton 55354d734e Merge branch 'master' into blender2.8 2018-07-12 08:31:19 +02:00
Campbell Barton 1db47a2ccd Fix PyRNA class registration w/ Python 3.7
In Python3.7 this now raises an error.
2018-07-12 08:30:39 +02:00
Campbell Barton 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
Campbell Barton 36a9436d80 Merge branch 'master' into blender2.8 2018-07-01 16:22:06 +02:00
Campbell Barton ddee0931b8 RNA: use bool for boolean RNA types
We were using int's for bool arguments in BKE,
just to avoid having wrapper functions.
2018-07-01 15:57:59 +02:00
Bastien Montagne 646412004b Merge branch 'master' into blender2.8
Conflicts:
	source/blender/makesrna/intern/rna_image.c
	source/blender/makesrna/intern/rna_object.c
	source/blender/makesrna/intern/rna_object_force.c
	source/blender/makesrna/intern/rna_screen.c
	source/blender/makesrna/intern/rna_sculpt_paint.c
	source/blender/makesrna/intern/rna_space.c
	source/blender/python/bmesh/bmesh_py_types.c
	source/blender/python/generic/bpy_internal_import.h
	source/blender/python/intern/bpy_rna_anim.c
	source/blender/python/intern/gpu_offscreen.c
2018-06-22 12:46:16 +02:00
Bastien Montagne cbf5c738d6 Cleanup: get rid of last G.main's in bpy area.
Essentially 'validating' them as G_MAIN, and adding some asserts in
dubious places, that handled IDs are actually in G_MAIN.
2018-06-22 11:37:47 +02:00
Campbell Barton f91e9529da Merge branch 'master' into blender2.8 2018-05-05 09:57:45 +02:00
Campbell Barton d83681807e PyAPI: add pop method to RNA struct types
This fits in with existing dict style access.
2018-05-05 09:53:30 +02:00
Bastien Montagne 1913322402 Add generic bpy API to check if a property is overridable, and to set overridable status of custom props. 2018-04-17 18:07:08 +02:00
Campbell Barton a2c0a382cd Merge branch 'master' into blender2.8 2018-04-03 14:19:51 +02:00
Campbell Barton 692aeb6fe0 Cleanup: newlines left in messages 2018-04-02 15:46:31 +02:00
Campbell Barton 89fdd88906 Merge branch 'master' into blender2.8 2018-04-02 15:18:10 +02:00
Campbell Barton 017c731cf3 Logging: use for Python API
Adds categories "bpy.context" & "bpy.rna"
2018-04-02 13:13:57 +02:00
Campbell Barton d937d06c02 WorkSpace: UI filtering for add-ons
Allows for each workspace to have it's own add-ons on display.

Filtering for: Panels, Menus, Keymaps & Manipulators.
Automatically applies to add-ons at the moment.

Access from workspace, toggled off by default
once enabled, add-ons can be white-listed.

See D3076
2018-03-01 01:31:07 +11:00
Sergey Sharybin df1c88b652 Merge branch 'master' into blender2.8 2018-02-15 14:15:55 +01:00
Campbell Barton ccdacf1c9b Cleanup: use '_len' instead of '_size' w/ BLI API
- When returning the number of items in a collection use BLI_*_len()
- Keep _size() for size in bytes.
- Keep _count() for data structures that don't store length
  (hint this isn't a simple getter).

See P611 to apply instead of manually resolving conflicts.
2018-02-15 23:39:08 +11:00
Campbell Barton 873a87c7e8 Merge branch 'master' into blender2.8 2018-01-16 14:56:03 +11:00
Campbell Barton e428ea3e00 Cleanup: indentation 2018-01-16 11:40:43 +11:00
Campbell Barton 129196dc32 Merge branch 'master' into blender2.8 2018-01-15 15:59:59 +11:00
Campbell Barton ec52e64a5d RNA: Add RNA_property_string_set_bytes
This is needed to set values that contain zero bytes
(where the length isn't fixed).
2018-01-15 15:59:10 +11:00
Campbell Barton dd4e0cd3e3 DNA/RNA: add 'py_instance' for ID types
Avoid creating new Python instances
every time a scene, object, mesh .. etc are accessed.

Also resolves crashes T28724, T53530
although it's only valid for ID types, not modifiers vertices etc.

Back-ported from blender2.8 branch.
2017-12-11 18:37:54 +11:00
Campbell Barton 28048f75ce Merge branch 'master' into blender2.8 2017-11-29 21:32:16 +11:00
Campbell Barton e32cfb0743 Cleanup: rename bpy_util -> bpy_capi_utils
This is for internal CAPI use only, avoid confusion w/ bpy.utils module.
2017-11-29 21:11:29 +11:00
Campbell Barton ec2bbc90e7 Merge branch 'master' into blender2.8 2017-10-18 17:09:41 +11:00
Campbell Barton ab7ebf2b10 Cleanup: Use const for RNA EnumPropertyItem args
Practically all access to enum data is read-only.
2017-10-18 16:04:07 +11:00
Campbell Barton 7d7741d25f Merge branch 'master' into blender2.8 2017-09-11 16:52:53 +10:00
Campbell Barton 11a9434c2d Resolve T52687: Add node label shows as 'Unknown'
Add type access method, need to extend to other types
for now just get node UI working properly again.
2017-09-09 22:56:58 +10:00
Campbell Barton a133b74709 Merge branch 'master' into blender2.8 2017-09-08 03:18:39 +10:00
Campbell Barton 60020f57d7 Correct function name in argument parsing 2017-09-08 00:59:27 +10:00
Campbell Barton e44bf43f6c PyAPI: add function to get an RNA subclass
This is inconvenient in regular Python, add a class-method
to perform the operation, eg:

bpy.types.Node.bl_rna_find_subclass("CustomNodeType")
2017-09-08 00:02:09 +10:00
Campbell Barton c843e84892 Merge branch 'master' into blender2.8 2017-09-01 02:30:48 +10:00
Campbell Barton 636baa598a RNA: Limit which classes struct-map contains
Only add subclasses of: Menu, Panel, Header, UIList, Operator

This helps avoid unnecessary naming collisions,

See T52599 for details
2017-08-31 23:49:50 +10:00
Campbell Barton 7497488149 Merge branch 'master' into blender2.8 2017-08-20 15:50:15 +10:00
Campbell Barton 46cf33bf01 PyAPI: Make use of PyC_LongAs... API
Avoids setting exceptions inline,
also use Matrix_ParseAny for bmesh.ops.

Some inline exceptions are kept because they show useful details.
2017-08-20 15:49:10 +10:00
Campbell Barton 2ff9c8a3bc PyAPI: avoid redundant PyLong_AsLong call
Assigning to an RNA array converted from Python to C twice.
2017-08-20 15:30:14 +10:00
Campbell Barton 2332051419 Merge branch 'master' into blender2.8 2017-08-19 21:54:05 +10:00
Campbell Barton 4e468ceb71 PyAPI: Fix memory leak w/ empty, allocated enums 2017-08-18 18:29:27 +10:00
Campbell Barton 5709021f52 Correct previous commit, instance should be cleared
Clear instance in case creating creating new instance fails.

In practice this shouldn't happen,
but better not cause further errors if it does.
2017-08-01 17:17:38 +10:00
Campbell Barton 5ac9e587d4 PyRNA: Ensure changed types creates a new instance
Changing lamp type for eg needs to create a new instance.
2017-08-01 17:14:09 +10:00
Campbell Barton 48e8a1a167 Fix crash in recent changes to instancing
Registrable classes already handled their own instancing,
changes to enable instancing everywhere conflicted.
2017-07-27 03:27:14 +10:00
Campbell Barton 40a45e393e PyAPI: Fix for instancing (Blender owns a reference)
Also set newly created values to the instance pointer.
2017-07-26 23:05:00 +10:00
Campbell Barton 6b0d4302be PyAPI: use instancing when supported
This means when a new data-type is returned it will use the same
instance as the previously created one (if it exists).
2017-07-21 00:50:18 +10:00
Campbell Barton 28b2f1c305 Manipulator: Python API
Initial support for Python/Manipulator integration
from 'custom-manipulators' branch.

Supports:

- Registering custom manipulators & manipulator-groups.
- Modifying RNA properties, custom values via get/set callbacks,
  or invoking an operator.
- Drawing shape presets for Python defined manipulators (arrow, circle, face-maps)

Limitations:

- Only float properties supported.
- Drawing only supported via shape presets.
  (we'll likely want a way to define custom geometry or draw directly).
- When to refresh, recalculate manipulators will likely need
  integration with notifier system.

Development will be continued in the 2.8 branch
2017-06-26 16:38:04 +10:00
Campbell Barton 5b51dcacbc PyAPI: add intern strings
Avoid string conversion on each use.
2017-06-21 12:43:19 +10:00