Commit Graph

433 Commits

Author SHA1 Message Date
f86565c90e whitespace edits for bpy api, split some really long lines. 2011-04-30 13:58:31 +00:00
f9f771cd01 converted more mixed tab/space indentations to tabs. only whitespace changes. 2011-04-21 15:53:30 +00:00
6bb626f253 minor changes
- remove some warnings
- fix typos
- cmake allow in-source build (when WITH_IN_SOURCE_BUILD is defined)
- cmake, use an explicit list of rna files (don't glob)
2011-04-21 05:49:47 +00:00
70cd0803ab add new subtype PROP_COORDS, for generic coordinates that are not to be changed by units. 2011-04-08 13:32:56 +00:00
6b3f5ecd18 change to fcurve keyframe coords broke simplify addon since the property
was no longer wrapped by python as a vector. now fixed size float arrays
with PROP_NONE subtype are wrapped as vectors since its convenient to
have x/y access.
2011-04-08 01:40:54 +00:00
371a7b477d Fix register method order. Was broken when Campbell moved it to the C implementation.
register has to be called AFTER the type is registered while unregister has to be called BEFORE it's unregistered.
2011-04-02 14:58:58 +00:00
66a1259153 fix for crash when running blender with define WITH_PYTHON_SAFETY & no startup.blend was found.
was calling python function when python was not initialized.
2011-03-31 04:43:26 +00:00
bf1e2ce41e color gamma (such as theme colors), were not being wrapped by python as 'mathutils.Color' types 2011-03-28 13:47:39 +00:00
587bbc4213 fix [#26616] Line of code make Blender crash 2011-03-27 06:56:37 +00:00
f87b37b3ef allow unregistered rna classes to have rna properties assigned before registration.
this is useful for the register() class method which is called before the class gets structRNA assigned.

eg:

class MyClass(bpy.types.PropertyGroup):
    @classmethod
    def register(cls):
        cls.name = StringProperty()  # assigned but registration is delayed.
2011-03-23 12:44:22 +00:00
1b80538fea fix [#25688] undocumted functions in pyapi
expose collection function docs.
2011-03-22 04:28:51 +00:00
f3686b5885 py/api registration:
move calls to the classes register/unregister function into register_class() / unregister_class() and add docs.

also other minor changes:
- remove face sorting keybinding, was Ctrl+Alt+F, this is quite and obscure feature and face order normally doesn't matter, so access from Face menu is enough.
- add commented out call to mesh.validate() in addon template since its useful to correct incomplete meshes during development.
2011-03-22 01:38:26 +00:00
cadc1218c8 C, style changes (mostly white space edits), no functional change. 2011-03-19 11:12:48 +00:00
3ac925b7d1 fix own error - missing NULL check [#26523] Crash when load factory settings ( linked to rigify add-on ? ) 2011-03-16 22:25:31 +00:00
dc5a78ac25 fix own error [#26522] Api autocomplete return many errors
collections were getting __call__ attribute from the StructRNA, now ignore all starting with '_'
2011-03-16 21:58:45 +00:00
f2b1645a75 fix/disallow [#26502] segmentationfault on pressing button to browse existing images for UV window
creating RNA within draw functions can free existing RNA, crashing blender when this is already used in the UI.
disallowing this so it raises a python exception.

This was being used to dynamically generate addon categories so for now they are hard coded and we need proper enum-functions for python to do this.
2011-03-14 23:02:47 +00:00
4a747bebf4 fix [#26489] Auto completion in console broken
own mistake in r35492.
2011-03-14 05:39:07 +00:00
90d42e114c py/rna: BPy_reports_to_error() now takes the exception type as an argument and returns -1 as an error value 2011-03-12 15:18:08 +00:00
c678bd2d7d py/rna, ability to have python static methods in collections. 2011-03-12 14:32:30 +00:00
d7257a983f bugfix [#26454] WITH_PYTHON_SAFETY crash. 2011-03-11 02:43:30 +00:00
Nathan Letwory
5b6223fdeb Py_hash_t is new typedef in Python 3.2, typedeffing Py_ssize_t. Changing to that to keep "slow adaptors" happy ;) 2011-03-04 11:08:22 +00:00
Nathan Letwory
292f633698 long hash caused stack corruption in _PySet_NextEntry. This wanted a Py_hash_t, so made hash into such. 2011-03-04 10:37:49 +00:00
e197cc95e6 fix crash from own recent changes [#26271] Crash when accessing bpy.data.node_groups 2011-03-03 13:55:15 +00:00
b6b77b8426 Py/RNA api:
fix for crash when iterating over a collection which allocates the collection and frees on when finished.

The ability for BPy_StructRNA to hold a reference to other PyObject's was added to support this.
2011-03-03 09:16:06 +00:00
3a2ce2be83 Py/RNA api - real collection iterator
Previously the api just converted the collection to a list and got the iterator from the list to return.

This has the advantage that it uses minimal memory on large collections where before it would make an array.

Though the main reason for this change is to support a bugfix for collections which free memory when they are done, this currently crashes the python api since once the list is built, the data is freed which is used by the list items in some cases (dynamic enums for eg).
2011-03-03 07:41:09 +00:00
5f5fb5061b formatting edits. (no functional changes) 2011-03-03 05:42:16 +00:00
9c45fed287 Change RNA weakref code to use a ghash rather then a PyList, removing items from the list was far too slow. 2011-03-02 18:59:43 +00:00
415e8df10e simplify rna internal weakref use. 2011-03-02 16:56:13 +00:00
7159bc0b1c minor fixes to weakref validation before making bigger changes 2011-03-02 06:56:21 +00:00
e2304a4dbb move anim functions out of bpy_rna.c, its getting too big. 2011-03-02 04:51:43 +00:00
623822626a Py/RNA Stability: don't allow python to reference freed ID's and crash.
Second method for not having python crash blender on invalid access (ifdef'd out ATM, so no functional change).

This uses a weakref list per ID, and invalidates all members of that list when the ID is freed.
the list is not stores in the ID pointer but using a hash table since storing python in DNA data is not acceptable.

This is more correct then the previous method but shows down execution of scripts significantly since its always adding and removing from lists when data is created and freed.
2011-03-01 14:53:26 +00:00
c9ee017fb5 Py/RNA API test code to prevent crashing blender when python references freed ID's.
This uses pythons GC so its no overhead during runtime but makes removing ID's slower.

Commented definition 'USE_PYRNA_INVALIDATE_GC' for now, so no functional change.
2011-03-01 09:02:54 +00:00
7b636c717d bpy/rna support for invalidating objects.
access will raise an error.
2011-02-28 22:56:29 +00:00
55268331f6 missed these last commit. 2011-02-28 21:06:09 +00:00
7348a50d79 change return values from mathutils callbacks to match pythons (-1 is error), so error macro's can be used in both. 2011-02-28 18:42:41 +00:00
Nathan Letwory
5a760e22fc doxygen: blender/python tagged. 2011-02-27 20:10:08 +00:00
cd615f6fcc found moving verts in pythons 2.5 api is approx 10x slower because the multi-dimensional array assignment reads the array 3 times (typecheck, length-check & for-real).
the length check was running sequence checks on every number which would fail, small speedup by avoiding this.

should eventually get this working faster by reading once into an allocated array.
2011-02-24 08:47:58 +00:00
31c7d694e0 remove 2 unnecessary checks for array type before assignment. 2011-02-24 07:25:47 +00:00
65bb4ff8d1 py/rna api:
ifdef'd out weakref for blender/py api, worth testing to see if it adds much overhead.
2011-02-23 13:43:45 +00:00
Nathan Letwory
5b607701a7 doxygen: prevent GPL license block from being parsed as doxygen comment. 2011-02-23 10:52:22 +00:00
1e120098fc pyapi, use direct access to the frame rather then python attributes. 2011-02-22 07:57:18 +00:00
dd8383e469 make doc generation close files (py3.2 complains about this),
minor formatting changes for C docstrings.
2011-02-22 05:23:20 +00:00
6524d27462 py api was raising SystemError exception incorrectly, this is intended for internal interpreter problems.
Replace most with RuntimeError.
2011-02-18 06:04:05 +00:00
2ae5c3932d Change to how python classes are initialized when blender calls them.
Annoyance was that operators that defined and __init__ function would need to do...
    def __init__(self, another_self):
        ....

py/rna was calling the class directly with PyObject_Call() but needed to pass the pre-allocated object only so __init__() would run .
This works OK internally but becomes messy since __new__ and __init__ always get the same args there was no way to avoid a superfluous self argument to __init__.
2011-02-17 07:21:44 +00:00
73df566b4a error case not being handled when calling python classes from RNA 2011-02-17 06:56:24 +00:00
f5217afd18 Ugly hack to get PoseLib UI working ok (problem mentioned in log for
r34883).

Full description:
When defining an operator button in the UI layout code, trying to set
the value for such an operator's enum properties, where said enum uses
a dynamically generated list of items (which depends on using context
info), will "fail". No context info will be passed to the callbacks
used to generate this list of items, as PROP_ENUM_NO_CONTEXT is still
set on the operator properties (it seems these will only get cleared
when the operator actually runs, which is far too late already for
this usage) so RNA_property_enum_items() will pass NULL instead of a
context pointer *even* when one exists!

I'm not sure of why we even need this flag. It seems to have caused a
few other rounds of problems already, from quick searches I did on
this matter...
2011-02-16 01:46:32 +00:00
8b7482892b made most variables which are only used in a single file and not defined in header static for blenlib, blenkernel and editors. 2011-02-14 17:55:27 +00:00
d845d6308a comments for how py-rna calls api new classes. small speedup for StructRNA.__new__(...) used for creating new classes and corrected exception type. 2011-02-14 11:30:35 +00:00
a3c2ad34b1 improve py/rna exception messages. 2011-02-14 08:14:52 +00:00
a6765280f9 py rna api: turn class.is_register into a class property rather then a class method.
eg:

if MySybclass.is_registered:
    ...
2011-02-14 07:26:07 +00:00