Commit Graph

650 Commits

Author SHA1 Message Date
fb1f7fad78 Cleanup: use proper RNA struct type for ListBase type
(otherwise all code using RNA has to link DNA_listbase.h, not clean at all!).
2016-06-22 18:04:04 +02:00
a9f7bbc9f8 PyRNA: Fix repr used /w arrays
RNA arrays now display their index, with support for multi-dimensional arrays.
2016-05-28 22:30:25 +10:00
4a64b36029 Cleanup: use bool 2016-04-12 11:26:06 +10:00
f4e1c1d135 Correct recent RNA array slicing commit
Broke slice assignment when used on an item from a multi-dimensional array,
eg: `array[i][:] = data`
2016-03-08 21:19:35 +11:00
ad98f00d1f PyAPI: Support multi-dimensional RNA slice assignment
This was already supported for getting slices.
2016-03-08 19:36:12 +11:00
63a718e50f Cleanup: warning, whitespace 2016-01-15 05:36:07 +11:00
4acf0f05a1 'users of ID' py API.
This mainly adds bpy.data.user_map() method, which goes over the whole Main database
to build a mapping (dict) {ID: {users_of_that_ID}}.

Very handy to check and debug ID usages, but could also be really valuable for py addons
creating temporary scenes, or some exporters, etc.

Note: current code in master's libquery misses some IDs (and reports some it should not,
like nodetrees), this is fixed in id-remap but still needs serious review before going to master.
This basically means that current bpy.data.user_map() **will not** report a complete and exhaustive
state of dependencies between IDs. Should work OK in most cases though.

Original work/idea comes from id-remap branch, was heavily reworked by @campbellbarton
and myself for master.

Reviewers: campbellbarton, sergey

Differential Revision: https://developer.blender.org/D1678
2016-01-06 19:48:10 +01:00
66123ef3ad Cleanup 2016-01-05 01:46:13 +11:00
70fa2f69c9 Fix T47046: Exporting Max and Maya keymap throws RNA warnings in console.
Totally harmless, but let's silence this bpyrna warning in case enum_items
is a DummyRNA_NULL_items, which is by definition empty...
2015-12-31 14:57:48 +01:00
c1f05c30f9 PyAPI: expose low level RNA to bpy.types 2015-11-30 11:03:49 +11:00
676d790d29 Cleanup: use rna_enum_ prefix for RNA enums
Definitions could shadow local vars.
2015-11-23 17:40:09 +11:00
54daeb185f PyAPI: add an update method for properties
This is called when modifying an RNA property,
however it can be useful to be able to make a properties
update callback run without having to change it.
2015-09-11 04:29:31 +10:00
477e81128d Show correct syntax for id-properties 2015-09-11 04:29:31 +10:00
d4a9da28e8 Doc fix: rather then -> rather than 2015-08-05 12:48:04 +02:00
339915a962 Optimize PySequence_Fast usage
Access arrays directly, avoiding type-check every time.
2015-07-29 10:49:35 +10:00
cf6002737d Don't make Python classes of StructRNA on startup
This gives small start time speedup, classes are lazy loaded instead.

Keep existing behavior in debug builds to catch any errors early.
2015-07-22 19:51:03 +10:00
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