Commit Graph

634 Commits

Author SHA1 Message Date
3ce4a58aa9 Cleanup: duplicate includes 2015-06-18 06:32:01 +10:00
08687ee380 Correct typos
D1337 by @lichtwerk
2015-06-10 17:28:43 +10:00
097862cb26 GHash: avoid redundant casts 2015-05-11 12:39:39 +10:00
db710e6c0d Fix crash using removed data as function arguments 2015-03-18 15:52:36 +11:00
f60b4228b9 BPY RNA: add is_property_readonly().
This property may be defined dynamically, so mere access to static flag value
through `bl_rna.properties[...].is_readonly` is not enough.
2015-02-11 17:13:16 +01:00
bf0c8e116d PyAPI: add PyList_APPEND
This appends while giving ownership to the list, avoiding temp assignment.
This matches PyList_SET_ITEM which bypasses refcount's

Note, this also reduce code-size, Py_DECREF is a rather heavy macro.
2015-01-06 19:09:53 +11:00
9fd569a654 PyAPI: add utilities PyTuple_SET_ITEMS, Py_INCREF_RET
Setting all values of a tuple is such a common operation that it deserves its own macro.
Also added Py_INCREF_RET to avoid confusing use of comma operator.
2015-01-06 19:09:11 +11:00
8106a6b75d mathutils: refactor instantiation
remove 'type' argument, very few mathutils objects are wrapped,
add new function for creating wrapped objects.

also fixes unlikely memory leak if the data-array can't be allocated.
2015-01-04 17:43:57 +11:00
915235c87a Cleanup: unused headers 2014-11-28 22:16:14 +01:00
e18906bda2 remove invalid comments 2014-09-09 12:21:28 +10:00
3ba28a2609 Python API: support thick wrapped int arrays
add bpy.data.version, needed for Python versioning code.
2014-08-25 23:57:03 +10:00
00b29156e0 Defines: replace ELEM3-16 with ELEM(...), that can take varargs 2014-07-20 01:33:40 +10:00
9f05588b68 Python: remove redundant casts 2014-07-01 14:10:59 +10:00
4ca67869cc Code cleanup: remove unused includes
Opted to keep includes if they are used indirectly (even if removing is possible).
2014-05-01 04:47:51 +10:00
e73d0f57a3 Code cleanup: use 'const' for arrays (python) 2014-04-27 00:25:15 +10:00
a91247c2b4 Code cleanup: unreachable break/return 2014-03-19 12:47:09 +11:00
a5c35fb27f Code cleanup: use booleans where appropriate 2014-01-28 04:00:04 +11:00
85a3d51078 Fix for own refcount error in recent commit 2014-01-21 14:23:39 +11:00
2e01f38885 Python API: fix for help() failing on bpy instances
Caused by missing __name__ from bpy.types (alternate method to patch D232)
2014-01-20 18:13:15 +11:00
a696a0ff1e Python API: create args for meta-classes directly (a little faster).
Also add some new interned strings.
2014-01-20 18:09:00 +11:00
6734936c13 RNA API: use bool's for enum itemf callbacks. 2014-01-04 18:10:01 +11:00
85bbef0f4e python api internals: no need to set the stop-iter exception string. 2013-11-17 15:09:57 +11:00
b6631b8be7 fixes for python api docs.
also move foreach_get/set examples into their own py example files (prefer not to have example code built into blenders binary).
2013-09-18 05:20:43 +00:00
9d6f05edb8 fix relating to bug [#36758],
When printing operator reports, ommit unset properties.
This is needed because in some cases operators check if a value is set or not, so filling in default arguments may change behavior.
2013-09-18 01:22:28 +00:00
daa87ff0b4 Update foreach_get/_set doc. 2013-09-17 14:02:13 +00:00
365c368b5f add back library linking warning when renaming library datablocks in the outliner, also typo corrections. 2013-09-12 22:08:56 +00:00
1679cd7f96 This commit adds optional parameters for pyfunc implementations of RNA API (i.e. callbacks, e.g. draw functions of panels, uiLists, or exec/poll/etc. of operators). Thanks to Brecht for he review!
Any parameter after the first flagged with PROP_PYFUNC_OPTIONAL will be considered as optional, hence the python code does not have to define/use it. This will ease API evolutions by avoiding to break existing code when adding non-essential new parameters.

Note: this will need some update to API doc generation, patch is ready, will have it reviewed by Campbell asap.
2013-08-26 21:11:52 +00:00
4f29aeeff2 code cleanup: some structs were declaring data when only typedef's were intended, make local vars and functions static. 2013-08-07 03:44:05 +00:00
b8c3efc8c3 code cleanup: compiler warnings 2013-07-21 16:40:34 +00:00
7db1d6556d code cleanup: add break statements in switch ()'s, (even at the last case). 2013-07-21 08:16:37 +00:00
65047099b2 fix for pythons __dir__ returning registrable functions on class instances (which may not have the functions defined).
gave odd behavior of including members in __dir__ that couldn't getattr()
2013-06-13 11:35:25 +00:00
71775dc2a4 Fix another cases where painting long brush strokes with small radius was slowed
down, this time by the operator properties getting converted to a string for
display in the info window.

With 1000+ stroke points this can get slow, and takes up too much space anyway,
so now it's (somewhat arbitrarily) limited to printing only 10 points.
2013-05-15 14:37:01 +00:00
3e1e76a2c1 Fix #35289: UV layout export to image was extremely slow for large meshes. This
was due to slow implementation of slice operation for things like mesh uv data.
Made that faster now for cases where the internal storage is an array.
2013-05-10 22:05:47 +00:00
a9fb183901 rename BLI_ghashIterator_notDone() -> BLI_ghashIterator_done()
was renamed fairly recently but other similar iterators not negated
	like this, would prefer to keep it as it was
2013-05-08 12:58:11 +00:00
858ff6b696 Fix for [#34898] Typo in error message of mathutils.Vector
* Also fixed some more cases of "more then" -> "more than".
2013-04-07 15:09:06 +00:00
98752a1f30 py api additions needed for fixing [#34864].
- add rna property 'as_bytes' method so you can get a string property as python bytes (bypass encoding).
- make bpy.path.abspath/relpath compatible with bytes.
- add 'relpath' option to bpy_extras.image_utils.load_image(), so you can load an image relative to a path.
2013-04-05 00:30:32 +00:00
13ec0cd6c3 Fix #34856: crash passing an object rather than a mesh to bpy.data.mesh.remove(),
this should give an error message but it didn't.
2013-04-03 13:43:12 +00:00
cb1d26d794 code cleanup: shadowing, adjust type. 2013-03-22 15:47:02 +00:00
d466e1d3b4 add BLI_rcti,f_recenter()
fix for uninitialized variable use in radial_control_get_properties() and bad cast in bpy api's foreach_parse_args()
2013-03-19 10:54:52 +00:00
Lukas Toenne
4638e5f99a Merge of the PyNodes branch (aka "custom nodes") into trunk.
PyNodes opens up the node system in Blender to scripters and adds a number of UI-level improvements.

=== Dynamic node type registration ===
Node types can now be added at runtime, using the RNA registration mechanism from python. This enables addons such as render engines to create a complete user interface with nodes.

Examples of how such nodes can be defined can be found in my personal wiki docs atm [1] and as a script template in release/scripts/templates_py/custom_nodes.py [2].

=== Node group improvements ===
Each node editor now has a tree history of edited node groups, which allows opening and editing nested node groups. The node editor also supports pinning now, so that different spaces can be used to edit different node groups simultaneously. For more ramblings and rationale see (really old) blog post on code.blender.org [3].

The interface of node groups has been overhauled. Sockets of a node group are no longer displayed in columns on either side, but instead special input/output nodes are used to mirror group sockets inside a node tree. This solves the problem of long node lines in groups and allows more adaptable node layout. Internal sockets can be exposed from a group by either connecting to the extension sockets in input/output nodes (shown as empty circle) or by adding sockets from the node property bar in the "Interface" panel. Further details such as the socket name can also be changed there.

[1] http://wiki.blender.org/index.php/User:Phonybone/Python_Nodes
[2] http://projects.blender.org/scm/viewvc.php/trunk/blender/release/scripts/templates_py/custom_nodes.py?view=markup&root=bf-blender
[3] http://code.blender.org/index.php/2012/01/improving-node-group-interface-editing/
2013-03-18 16:34:57 +00:00
16b82845ee code cleanup: add 'const' to headers to quiet msvc warnings, also remove (char *) casts that aren't needed now we're on Python3.3 2013-03-17 18:30:31 +00:00
284e59d608 Add the possibility to define the translation context for py rna classes (operators, panels and menus).
Thanks to Campell and Brecht for the reviews!
2013-03-15 14:32:29 +00:00
f9f7070336 add STREQ macro (commonly used macro like CLAMP, MAX2, STRINGIFY). Use for some areas of the python api, bmesh. 2013-03-10 06:18:03 +00:00
53b7bc8f1f Change !BLI_ghashIterator_isDone to BLI_ghashIterator_notDone. It is
always used in that context so we can at least avoid reverting it twice
:p.
2013-03-06 20:55:04 +00:00
a62eeb9d8f fix [#34423] Foreach_get crash for any non existant attribute
also improve exception messages.
2013-02-26 00:31:36 +00:00
95b28a65f3 Cleanup: happily remove no-more-used PY_TRANSLATE RNA prop flag, and related code (just realized that flag value was wrong, probably own typo in a previous commit :/ ).
That "trick" was nice when introduced, but it became kind of a pita since we added translation contexts...
2013-02-08 15:16:57 +00:00
6fca85780b style cleanup: also correct doc example for 'foreach_get/set' 2013-02-02 00:34:34 +00:00
2a71e4e4f0 make WITH_HEADLESS build again. 2013-02-01 08:24:18 +00:00
Lukas Toenne
c8d29c1af8 Fix for RNA FUNC_REGISTER/FUNC_REGISTER_OPTIONAL flags: The test in bpy validation of classes actually always passed for mandatory functions. This only worked since they all use fallback default implementations internally. 2013-01-28 12:17:49 +00:00
38cee985bb code cleanup: style & warnings. 2013-01-21 02:30:40 +00:00