Commit Graph

28 Commits

Author SHA1 Message Date
Campbell Barton
9d96399eeb - panel python template
- nicer syntax to capitalize words
2010-01-23 18:51:56 +00:00
Campbell Barton
3b09e73e58 - bugfix (user supplied fix) [#20745] makesrna with rename error.
- error with last commit, length had an index arg.
2010-01-22 14:59:01 +00:00
Campbell Barton
c6979aa0f4 continue when there are errors on reloading scripts 2010-01-22 14:43:08 +00:00
Campbell Barton
7f1a8a947d initial sphinx doc generation support for python and C modules.
python modules bpy.app, bpy.utils are now included in docs.
C defined python module bpy.props has its docstrings extracted and written directly into sphinx docs since the C methods cant be inspected.

added docstrings to bpy.props and improved some in bpy.utils.

will update online docs tomorrow.
2010-01-22 02:04:25 +00:00
Campbell Barton
0568f608c4 Patch from Jochen Schmitt, (various distro's had patched this)
- modify the path in python rather then C
- filter returns an object in python 3, set using slice.

also import sys as _sys so it doesnt appier in aytocompleation.
2010-01-20 19:26:23 +00:00
Campbell Barton
e723b060fc python script reloading (f8)
- reload modules from types that are not directly included. for example wm.py uses classes from modules/rna_prop_ui.py which wasnt reloaded.
- script paths were being added to sys.path multiple times.

note: now the second reload gives a crash right away but this is a bug elsewhere.
2010-01-18 10:02:55 +00:00
Campbell Barton
f6c79c553b [#20646] 2.5 does not load python scripts with multiple dots in the filename
- not a bug so add a warning if people add scripts with invalid names like this.
2010-01-12 10:04:03 +00:00
Campbell Barton
04d0261c37 new python submodule. eg.
from bpy.app import binary_path, version, version_string, home

can add constant variables from blender here as needed (maybe functions too... bpy.app.memory_usage() ?)
2010-01-02 23:14:01 +00:00
Campbell Barton
453945e9e3 remove python api cruft from custom operator registration 2009-12-30 22:51:44 +00:00
Martin Poirier
b00cddeb66 Macro registration using the normal rna registration methods (like operators).
bpy.types.register(MacroClass)

instead of

bpy.ops.add_macro(MacroClass)

The rest is unchanged.

Also remove some now unused code for the old registration methods (there's still some remaining).
2009-12-30 22:14:32 +00:00
Campbell Barton
98f1d6957e new python module constants
* bpy.home - result of BLI_gethome()
* bpy.version - BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION
* bpy.version_string, as above, formatted: "%d.%02d (sub %d)"
2009-12-28 10:00:04 +00:00
Campbell Barton
944a4f2a3f pep8 edits, removed MakeCursor.py and rna_array.py, not important to make pep8 2009-12-26 09:36:50 +00:00
Campbell Barton
bbe13e7823 * register operators like other classes
* operators now return sets (converted into flags)
* can't remove bpy_operator_wrap.c since macro's still use the custom register funcs
2009-12-24 19:50:43 +00:00
Campbell Barton
a1656300ba script for automating pep8 checks.
On ubuntu/debian install these tools...

   sudo apt-get install pylint pyflakes python-setuptools python-pip
   sudo pip install pep8

then run from blenders source dir...
   python release/test/pep8.py

This searches for the comments "# <pep8 compliant>" and "# <pep8-80 compliant>", running the checking tools on these scripts only.

* some minor pep8 corrections too.
2009-12-13 13:59:16 +00:00
Campbell Barton
fb28896cf7 * added an armature submenu where python defined armatures can go.
* bpy.utils.display_name(), which makes filenames and module names look nicer in menus eg... /home/me/foo_bar.py  --> "Foo Bar"
* missing rna_path --> data_path renaming
2009-12-11 14:16:59 +00:00
Campbell Barton
5ebe54f470 pep8 edits and fix some warnings 2009-12-05 22:03:07 +00:00
Campbell Barton
651336d5df fixes for automatic tests and some errors in last commit 2009-12-05 20:45:51 +00:00
Martin Poirier
bcd1ab54cd Support for the C Macro system in Python.
Basic definition works like a python operator but you derive from "bpy.types.Macro" instead.
Operators are added to the macro after it has been added with "bpy.ops.add_macro" through the class method "define" which takes an operator id and returns an OperatorMacroType (new RNA type) for which properties can then be defined to be passed to the operator when run.

Example: http://blenderartists.org/~theeth/bf/macro.py

Using this system, it should be easy to add an operator to the console that converts selected lines into a macro or even a more generic record macro system.
2009-12-05 19:27:26 +00:00
Campbell Barton
e2450e4dd9 multiple script paths broke text template menu 2009-12-02 16:11:10 +00:00
Campbell Barton
33c444f965 User Script support added back.
- the scripts path set in the user preferences or ~/.blender/scripts/ui (io, op, io etc..) will be used to load scripts.
- the default home dir part probably only works in *nix os's

- Added a missing sync callback to vector.toTuple()
2009-11-30 22:32:04 +00:00
Campbell Barton
2e61294cbc simple fixes
[#20123] "Import" menu entry becomes empty
[#20141] In Object menu Make Links appears twice - SVN 24970

also moved OBJs name cleaning func to bpy.utils.clean_name(name, replace="_")
2009-11-28 20:50:31 +00:00
Campbell Barton
e9db9f2a91 - made properties in the view3d panel only show when there are some properties available since this the option to add props isnt in this panel
- remove print on startup
2009-11-23 13:06:26 +00:00
Campbell Barton
771406df94 - hide members of bpy from dir() and autocomp.
- path functions bpy.utils.script_paths(), bpy.utils_preset_paths(subdir)
- further simplified presets, use a generic draw function for preset menus and define the preset subdir and operator in the class
2009-11-22 11:23:19 +00:00
Campbell Barton
1dfbf3a9f6 - aspectx wasnt saved in the render preset
- define a preset base class
- cleanup some comments and whitespace
2009-11-21 23:55:14 +00:00
Campbell Barton
3f10b91235 operator properties were not the correct type 2009-11-19 16:15:22 +00:00
Campbell Barton
d04f94d0c6 skip rna property & function lookups for members starting with "_" (since makesrna disallows this)
added a way profile python startup in bpy/__init__.py, if'd out by default.
2009-11-14 23:11:46 +00:00
Campbell Barton
5a322bd67c F8 reload works again, script errors are printed but dont stop loading every other script 2009-11-13 11:10:29 +00:00
Campbell Barton
4c7dc3e5c5 changes python initialization
- bpy is now a python package, this makes it easier to add utility modules and adjust python startup which was previously using verbose Py/C api. Access should not be any slower since both C and Python modules use dictionary access.
- loop over scripts and load via python (currently F8 reload isnt working, will add back shortly)
- the C module is kept but renamed to _bpy and not meant for direct access from anything but the bpy package.
- bpy_types.py is an exception since it runs before the bpy package is initialized.
2009-11-13 09:28:05 +00:00