Age | Commit message (Collapse) | Author |
|
The bug was todo with bpy.data and bpy.types becoming invalid, temporary fix is to re-assign them to the bpy module before running python operators or panels.
will look into a nicer way to get this working.
|
|
own error with refcounting and raise an error when bpy.types cant generate a subtype (though it shouldn't happen)
|
|
made it crash when running the class functions. will look into this further.
|
|
this means it caches the compiled pyc files after importing fro the first time.
My times for importing 501 buttons_objects.py files were.
- running each as a script 1.9sec
- importing for the first time 1.8sec
- importing a second time (using pyc files) 0.57sec
Also added "bpy" to sys.modules so it can be imported.
|
|
* Added very basic loading of .py files on startup to define panels.
It now executes all .py files in .blender/ui on startup. Right now
this contains the object buttons, the C code for it is commented out.
These files should get embedded in the blender executable as well
eventually, that's a bit more complicated so this works for now.
* For scons and cmake it seems to copy & find the files OK, for make
only "make release" works (same with scripts/ folder it seems).
* Added BLI_gethome_folder function in BLI_util.h. This is adapted
from bpy_gethome, and gives the path to a folder in .blender like
scripts or ui.
There's plenty of things to figure out here about paths, embedding,
caching, user configs ...
|
|
|
|
own pytype.
If printing PyTypes becomes important we can do it a different way which is still less then 10 lines.
|
|
Added a check that a panel panel is a subclass of bpy.types.Panel (need a better way to access this type)
|
|
Since adding a new type gives quite a lot of extra boiler plate functions.
Return PyCFunction's main disadvantage is it does not have a uniqie name when you print it.
|
|
* Fix to make python panels callbacks get the actual
blender Panel as an argument, instead of any instance.
* Fix for callback validation in python 2.5, worked OK
in python 3.0 but gave error in 2.5 because it's a
method instead of a function there.
|
|
|
|
|
|
which can be defined to call C functions with defined parameters.
* Parameters are RNA properties, with the same types.
* Parameters are stored in a ParameterList, which is like a small
stack with the values. This is then used to call the C function.
* Includes Python integration.
* Only one test function is part of this commit, ID.rename.
* Integration with the editors/ module is not included in this
commit, there's some issues to be worked out for that still.
|
|
* Fix sometimes non-working close/open button.
* Fix panels being a bit out of the view on startup.
* Fix too large totrct region for view2d.
* Fix wrong panel order when changing vertical <-> horizontal.
* Fix wrong panel positions after switching contexts.
* Fix an access of freed memory when collapsing panels.
* Free align mode works again.
* Animations work again.
|
|
|
|
|
|
- Register python panels
- Added a generic class checking function BPY_class_validate() for panels/operators.
- No button drawing yet
Brecht, Added RNA_enum_value_from_id() and RNA_enum_id_from_value() to rna_access.c to do lookups between identifiers and values of EnumPropertyItem's, Not sure if these should go here.
|
|
|
|
using PyLong_FromSize_t rather than PyLong_FromSsize_t, this messed up the default values in documentation.
- renamed POSE_OT_select_hierarchy "add_to_sel" property to "extend"
- some property names were wrong (giving errors in the console at startup)
|
|
this can be brought back as a new space if someone decides to
work on it.
This also fixes remaining issues with the outliner tree open
and close buttons not working sometimes.
|
|
* Fix for not printing syntax error when running script
from the text editor, and crash on exit. Campbell, please
check if this is OK?
|
|
* Add support for setting RNA pointers.
* Fix __repr__ for structs and properties, it was printing
a garbage string here, but not sure I did what was intended.
|
|
|
|
at startup, which is slow and doesn't allow access to dynamically added types.
- bpy.types isnt a module anymore, defined as its own PyType, getattr looks up the rna collection each time.
- refcounting fixes
- fixe epydoc generation with undefined values
|
|
Makes older python's compile.
|
|
the missing file rna_context.c
|
|
* Made it based on string lookups rather than fixed enum, to make
it extensible by python scripts.
* Context callbacks now also have to specify RNA type when returning
pointers or collections. For non-RNA wrapped data, UnknownType can
be used.
* RNA wrapped context. The WM entries are fixed, for data context
only main and scene are defined properties. Other data entries have
to be dynamically looked up.
* I've added some special code in python for the dynamic context
lookups. Tried to hide it behind RNA but didn't find a clean way to
do it yet. Still unused/untested.
* Also minor fix for warning about propertional edit property in
transform code, and fix for usage of operator poll with checking if
it was NULL.
|
|
* operator class names
- Changed 'name' to '__label__' (since __name__ is already used for the class name)
- Changed 'properties' to '__props__'
* added a PyObject_GetAttrStringArgs(), utility function which Id like to see in pythons C api.
PyObject_GetAttrStringArgs(pyob, "someattr", "foo", "bar") /* pyob.someattr.foo.bar */
|
|
|
|
|
|
Support for subclassing blenders operator, to be registered as a new operator.
Still need to...
* add constants like Operator.FINISHED
* wrap context (with rna?)
* poll() cant work right now because there is no way to access the operatorType that holds the python class.
* Only float, int and bool properties can be added so far.
working example operator.
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/WinterCamp/TechnicalDesign#Operator_Example_Code
|
|
fix compile error with python on MSVC.
|
|
operator type
|
|
* As a test, used by:
* Object buttons, tried to make it match the mockup.
* Text window header.
* Text window properties panel.
* Panel interaction with view2d is still problematic, need to make
this work properly still.
* Templates are very basic, the ones there are simple but already
can follow the object buttons mockup quite closely.
* It's based on a three level system: panels, templates and items.
To get an idea of what that means in practice, see:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/UI_LayoutEngine#Panels.2C_Templates_and_Items
|
|
- rearranged modules bpyui -> bpy.ui, bpy -> bpy.data, remove bpydoc
- new module bpy.types, stores a list of all struct types
- added __rna__ attribute to types - eg bpy.types.World.__rna__ so you can access the rna data from a type. (so bpydoc.structs isnt needed anymore)
- removed unused subtyping method (use python subclassing rather then C PyTypeObject)
|
|
type, eventually allowing us to have python defined RNA classes in
python - lux/pov/renderman materials, lamps etc as well as operators.
At the moment there are 2 ways to do this, The first is like subclassing from python, another (disabled) method copies the base PyTypeObject struct
and makes some changes.
The PyType is stored in the RNA Struct for reuse, right now there are no access functions - needs to be improved.
Added a python script for printing all blend file data to the console which helps testing the api.
dir(rna) wont work for python 2.x now, use rna.__dir__() instead.
|
|
example...
bpyui.registerKey( C, bpyui.spaceTypes.SEQ, 0, "Sequencer", "SEQUENCER_OT_view_selected", bpyui.keyTypes.A, bpyui.keyValTypes.PRESS, 0,0, {})
May want to split this into multiple functions.
|
|
|
|
then an RNA struct when the ptr->data is NULL
|
|
removed epy docstrings from RNA python api, since Python can get this info from rna. (could be redone in python if getting doc's on RNA is needed)
epy_doc_gen works again
|
|
* a collection of small changes after review together with Campbell.
|
|
|
|
* added PyLineSpit(), useful for debugging so you can easily find the
line of the python script running.
|
|
* put back #if PY_VERSION_HEX check again, so we without Python 3.0 can still compile
- Campbell, please don't remove it again, ok?
|
|
Can draw panels in the scripts space containing RNA and operator buttons.
* Added bpyui.register() so scripts can draw buttons and panels into the scripts space type.
* wrapped drawBlock, drawPanels and matchPanelsView2d
* Operator buttons take a python dictionary used to set the button defaults.
* BPY_getFileAndNum utility function to get the filename and line number python is currently running.
|
|
with python 2.5 (< 3.0).
|
|
python UI, which just wraps C the functions.
|
|
richcompare functions to the operator api.
|
|
bpyui.pupMenuBegin, menuItemO and pupMenuEnd functions.
And a popup block with python callback with bpyui.pupBlock, beginBlock, popupBoundsBlock and endBlock funcions.
These functions should not be accessed by scripters directly.
|
|
ot->idname when defining ops.
* User interface uses this as a tooltip when NULL or "" is given.
* Python doc generation includes this description
* Python defined ops take the description as an argument.
* NULL check to image_ops.c, was crashing on exit when there was an image open.
|