Commit Graph

2146 Commits

Author SHA1 Message Date
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 572b1a644f Merge branch 'master' into blender2.8 2017-09-05 22:56:03 +10:00
Campbell Barton f4fb329808 RNA/PyAPI: Expose Py classes in bpy.types
Operators and their properties are two different types

Previously both operators and their properties are added
causing C operators to access the properties, Python the classes.

Favor consistency in this case so only Python classes are added.
2017-09-04 14:49:27 +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 58a4c767a1 Merge branch 'master' into blender2.8 2017-08-23 16:10:45 +10:00
Campbell Barton f09dee5aed Fix error in PointerProperty argument list
Regression in a7b3047
2017-08-23 02:14:33 +10:00
Campbell Barton f4fe405da9 Manipulator: Add API target_get/set/range wrappers
Allows Python manipulators access the values of target properties
needed for Python to make use of the general target property interface.
2017-08-22 18:57:38 +10:00
Campbell Barton bd935b5aed Merge branch 'master' into blender2.8 2017-08-22 18:21:05 +10:00
Campbell Barton 691ed21842 PyAPI: replace PyC_FromArray with typed functions
This was meant to be generic but introduced possible type errors
and unnecessary complication.
Replace with typed PyC_Tuple_PackArray_* functions.

Also add PyC_Tuple_Pack_* macro which replaces some uses of
Py_BuildValue, with the advantage of not having to parse a string.
2017-08-22 18:10:57 +10:00
Campbell Barton adabc315e9 PyAPI: add gpu.select (initial module)
This only exposes load_id, it's needed for Python manipulator drawing.
2017-08-20 23:13:42 +10:00
Campbell Barton 2530ae6c74 Merge branch 'master' into blender2.8 2017-08-20 21:22:00 +10:00
Campbell Barton cb03cc6600 PyAPI: gpu.matrix.push_pop context manager
Avoid un-balanced push/pop usage (which can interfere with Blender's
internal state) using a context manager.
2017-08-20 19:42:31 +10:00
Campbell Barton f6825d333b Fix bpy library load: invalid function signature 2017-08-20 19:04:16 +10:00
Campbell Barton 8037f3602f PyAPI: Add exceptions to stack push/pop
Raise exception when stack limits are reached.
2017-08-20 17:26:51 +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 64c7cf2036 PyAPI: correct int range checking 2017-08-20 10:34:21 +10:00
Campbell Barton 4e4e872478 PyAPI: Add gpu.matrix API 2017-08-20 00:01:19 +10:00
Campbell Barton 2332051419 Merge branch 'master' into blender2.8 2017-08-19 21:54:05 +10:00
Campbell Barton 1cc4033df8 PyAPI: expose matrix parsing function 2017-08-19 21:36:50 +10:00
Campbell Barton 4e468ceb71 PyAPI: Fix memory leak w/ empty, allocated enums 2017-08-18 18:29:27 +10:00
Campbell Barton cb67873ac5 PyAPI: Iniital gawain API for Python
Wraps vertex-format, vertex-buffer and batch's (enough for drawing).

Doesn't yet expose index-buffers or shaders.
2017-08-18 08:45:41 +10:00
Campbell Barton 73df38a879 RNA: don't register manipulator properties by name
Matching behavior for operators.
2017-08-18 07:50:31 +10:00
Campbell Barton 9567529b8f Merge branch 'master' into blender2.8 2017-08-12 00:23:49 +10:00
Campbell Barton daa834bc11 RNA: Operators were excluded from struct map
Recent changes meant structs that were registered without a name
wouldn't get added to the map.
Now assigning identifiers manages the struct-map.
2017-08-11 20:11:01 +10:00
Sybren A. Stüvel 01ee88563b Fix T46329: scene_update_{pre,post} doc needs clarification
The documentation for the bpy.app.handlers.scene_update_{pre,post}
handlers states that they're called "on updating the scenes data".
However, they're called even when the data hasn't changed. Of course
such handlers are useful, but the documentation should reflect the
current behaviour.

Reviewers: mont29, sergey

Subscribers: Blendify

Maniphest Tasks: T46329

Differential Revision: https://developer.blender.org/D1535
2017-08-08 15:16:51 +02: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 0e26707bce Merge branch 'master' into blender2.8 2017-07-29 06:44:04 +10:00
Campbell Barton 87d5e34453 Fix T52213: Enum drivers no longer work
Regression in D1812: PyDriver variables as Objects

Taking the Python representation is nice in general
but for enums it would convert them into strings,
breaking some existing drivers.
2017-07-29 02:39:16 +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 b97bf844b3 Merge branch 'master' into blender2.8 2017-07-25 20:53:10 +10:00
Campbell Barton edc6bec9d6 PyAPI: Skip user scripts w/ factory-startup
Adds bpy.app.factory_startup,
used to check if user scripts should be loaded.
2017-07-25 20:52:08 +10:00
Sergey Sharybin 5605c26fcd Fix function declaration of some modifiers
Those functions did not use evaluation context.

Also fixed lots of unused variables warnings caused by commented out code which
needs to be ported away from DerivedMesh and to evaluation context.
2017-07-21 15:54:42 +02:00
Luna Rood 1c4c288727 Pass EvaluationContext argument everywhere
Note that some little parts of code have been dissabled because eval_ctx
was not available there. This should be resolved once DerivedMesh is
replaced.
2017-07-21 14:47:26 +02: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 2475dbdc94 Merge branch 'master' into blender2.8 2017-07-18 13:09:36 +10:00
Brecht Van Lommel d268cad06a Fix T52090: clarify meaning of EnumProperty number when using ENUM_FLAG. 2017-07-17 18:31:19 +02:00
Campbell Barton 193d7d6333 Merge branch 'master' into blender2.8 2017-07-17 13:21:05 +10:00
Campbell Barton 3d1e5bca88 PyAPI: don't use deprecated PyModule_GetFilename
Allows compiling with newer Python versions.
Also add missing decref when compiling as a py-module.
2017-07-17 12:53:55 +10:00
Campbell Barton a11808a248 Manipulator: allow py manipulators w/o properties
These could be used for manipulators that run operators.
2017-07-17 12:29:37 +10:00
Sergey Sharybin c9aef27326 Depsgraph: Begin work on making depsgraph per-scene-layer
This is a first step towards proper depsgraph "ownership", where
we would allow scene to be in multiple states dependent on active
workspace or scene layer.

This commit introduces a basic API to get proper dependency graph
for a given scene layer. It also renames scene->depsgraph to
depsgraph_legacy, so it's easier to search0-n-replace in the future.
2017-07-13 15:43:36 +02:00
Campbell Barton 21f088018a Used Py3.6 feature by accident, check version 2017-06-26 19:57:48 +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 6d1ae5897f Merge branch 'master' into blender2.8 2017-06-26 13:43:56 +10:00