Commit Graph

3101 Commits

Author SHA1 Message Date
8186ba15ab last commit used py3.2 function, inline for py3.1 2011-02-22 08:29:25 +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
9ef0eed4b6 build python module without binreloc, add dummy argv[0] to initialize bprogname. 2011-02-21 13:13:08 +00:00
Nathan Letwory
cff782e5f1 Missed this in battle against BLO vs MEM storm. 2011-02-21 12:54:40 +00:00
Nathan Letwory
322ff7dfe4 I swear, it was just an innocence change in guardedalloc!
The butterfly wing flap, causing a nice storm in the rest of blender.

Now all dependencies should point ok again. CMakers, do double-test.
2011-02-21 12:35:04 +00:00
Nathan Letwory
8c8ae3dedf doxygen: entry for gpu, modifiers, nodes, python and render 2011-02-21 06:58:46 +00:00
c30149991c Experimental option to build blender as a python module, rather then blender embedding python.
CMake build option WITH_PYTHON_MODULE, will build ./bin/bpy.so

This allows 'bpy' to be imported from python or other applications/IDE's which embed python, eg:
   python -c "import bpy ; bpy.ops.render.render(write_still=True)"

This runs in background mode and has similar restrictions to running a script:
   blender --background --python test.py

TODO:
 - install to site-packages with blender scripts
 - add support for imp.reload()
2011-02-20 23:39:29 +00:00
9ee1b3930f set main() argv functions to be const char *
also set minimum cmake version to 2.8
2011-02-19 12:05:20 +00:00
d17df68c24 - clear some warnings
- rename layout.operator_enums -> operator_enum (since we have operator_menu_enum, only called in 4 places)
2011-02-18 06:07:41 +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
4c35d8d5a8 rename IDPropertyGroup to PropertyGroup
also renamed IDProperty to PropertyGroupItem (these are not referenced for common usage and we already have 'Property' defined).
2011-02-16 02:51:56 +00:00
669cffdb1e fix [#26098] python API: quaternion.rotate never seems to work. 2011-02-16 02:05:36 +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
d5316768c3 corrention for bpy.props docstrings. 2011-02-15 11:43:35 +00:00
be8c8942f4 fix for own error with image info display, also dont draw if the mouse is outside the image. 2011-02-15 04:06:13 +00:00
07e9cfef81 fix warnings. 2011-02-15 03:20:12 +00:00
ba0d167d2a more vars made static 2011-02-14 18:20:10 +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
7b201c7693 SVN maintenance. 2011-02-14 04:47:55 +00:00
72bc3f22b7 python api renaming and added headers for some files which didnt have one, no functionality change. 2011-02-14 04:15:25 +00:00
8ea0b4685c misc small changes:
- rename rna collection structs Main prefix to BlendData: eg, MainObjects --> BlendDataObjects
- printing python collection now prints its type (when available)
- renamed shadowed vars in bpy_rna.c.
- when making functions static I also made debugging/test functions static, reverse and add definitions to headers instead.
2011-02-14 03:15:55 +00:00
0955c664aa fix for warnings from Sparse static source code checker, mostly BKE/BLI and python functions.
- use NULL rather then 0 where possible (makes code & function calls more readable IMHO).
- set static variables and functions (exposed some unused vars/funcs).
- use func(void) rather then func() for definitions.
2011-02-13 10:52:18 +00:00
867fc4b463 enforce string limits (reported by pedantic checking tools & some developers).
mostly replace strcpy with BLI_strncpy and multiple strcat's with a BLI_snprintf().
also fix possible crash if CWD isnt available.
2011-02-13 03:21:27 +00:00
55f68c3657 fix for more warnings.
- modifier code was using sizeof() without knowing the sizeof the array when clearing the modifier type array.
- use BLI_snprintf rather then sprintf where the size of the string is known.
- particle drawing code kept a reference to stack float values (not a problem at the moment but would crash if accessed later).
2011-02-12 16:54:24 +00:00
65b922ad88 cls.is_registered() class method for python subclasses of internal types.
Synonymous with ('bl_rna' in cls.__dict__)
2011-02-11 02:40:14 +00:00
fb8c135584 minor python register changes.
- KeyingSetInfo classes are now collected like Panels, Operators etc so bpy.utils.register_module() can be used.
- move bpy.types.register() to bpy.utils.register_class
2011-02-11 00:11:17 +00:00
81a00cf2eb use static functions rather then defines for internal matrix__apply_to_copy() and similar.
+ other minor internal changes.
2011-02-09 09:20:17 +00:00
914e2ee01f problem with blender and python 3.2
- python 3.2 does 'import site' on startup which now tries to parse pyconfig.h which isn't copied. so for now just run without importing 'site', alternative would be to copy the header file for posix systems.
- cache PYTHON_VERSION variable so it can be set to 3.2, needed for copying python installation's other then 3.1.
2011-02-08 06:22:06 +00:00
53afd19808 fix [#25975] Quaternion/Vector.negated() isn't available
theres no need for value.negated(), better use -vec / -quat. however -quat didn't exist.
2011-02-08 03:37:49 +00:00
33265983da fix own error in recent commit [#25970] cannot create scale matrix after mathutils updates 2011-02-08 00:10:30 +00:00
d272b70ee0 rename ID.update() --> update_tag() since this function only tags for updating and scene.update() executes the update. 2011-02-07 08:13:28 +00:00
d9aa3f66a6 mathutils.Matrix.Scale(factor, size, axis)
- 'axis' arg was not coerced from a tuple like other args now do.
- 'axis' arg was being modified in-place (VERY BAD).
- also made new function matrix_3x3_as_4x4().
2011-02-06 11:17:22 +00:00
1cdab667bc - cmake was missing an inclide (IDE's wouldnt index)
- made doc generation always sumlink newly built docs to static URL. http://www.blender.org/documentation/250PythonDoc/
2011-02-06 10:18:20 +00:00
d694115ac4 mathutils fixes noticed when refactoring.
- comparing eulers was ignoring the order.
- printing Euler()'s now prints the order too.
- un-orderable types (all except for Vector's), were not raising an exception when compared with >=, >, <, <=.
2011-02-05 10:40:42 +00:00
998198a041 mathutils rotate functions for Euler/Quaternion/Matrix/Vector types.
each accept Euler/Quaternion/Matrix types.

eg:
  Euler.rotate(Quaternion(axis, angle))
  Vector.rotate(Euler((pi/2, 0, 0)))

matrix.resize_4x4() and euler.make_compatible() were still returning an instance of themselves, now return None.
2011-02-05 09:57:02 +00:00
dd08305e75 Rename python mathutils functions and split in-place methods from those that return new values.
http://wiki.blender.org/index.php/Dev:2.5/Source/Python/Mathutils
This completes the changes proposed.

This will break scripts (fixing coming up next), for full list of changes see mathutils.c comments.
2011-02-05 06:14:50 +00:00
2ef93b1d92 swap Matrix.Shear(...) arguments so matrix size is the second argument, matching other constructors. 2011-02-04 09:41:59 +00:00
feed9c3d1f mathutils.Matrix.OrthoProjection(plane, size, axis), merged axis and plane args. since axis was only allowed when plane was 'R'.
This was already done with Matrix.Rotation().
2011-02-04 09:35:20 +00:00
4be9583894 small mathutils changes.
- fix for returning empty slices (was returning list rather then tuple).
- report invalid type when mathutils_array_parse_fast() fails.
2011-02-04 03:39:06 +00:00
36786c18d7 PyAPI: coerce mathutils values. (vectors, quats, eulers) as proposed here:
http://wiki.blender.org/index.php/Dev:2.5/Source/Python/Mathutils#Coerce_Method_Arguments
2011-02-04 03:06:23 +00:00
19efa4301a fix crash from report [#25746] Adding keyframes to nested custom properties (IDProperties) of a bone causes segfault
though keyframing still doesn't work, it gives an error instead.
also use const char * in more parts of the py/rna api.
2011-02-01 23:53:54 +00:00
1c2bb084ac partial revert for r34590, exclude render() from enabling the read-only state.
will re-open [#25845] and assign to Brecht.
2011-02-01 20:38:24 +00:00
ffe7bde02c correct fix for bug #23871, __main__ module was being overwritten in nested functions, so on returning from calling operators the __main__ module could be cleared and imported modules turn into None
calling
  bpy.ops.wm.read_factory_settings()
... would clear a scripts namespace if running directly, not in a module.


Fix by backing up and restoring the __main__ module.

Also found BKE_reportf wasnt printing all reports in background mode as BKE_report() was doing.
2011-02-01 12:37:53 +00:00
549b190566 own fix for bug #23871 (r33277), crashes when running multiple operators in a batch script with a double free.
Cant see why this happens but this different fix doesn't crash so using it instead.
2011-02-01 09:02:49 +00:00