Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2009-08-10remove python2.x supportCampbell Barton
2009-08-09- fix error in last commitCampbell Barton
- added better error feedback when registering operators fails. - added some python benchmark timers (prints on exit), times number of times py scripts run, average time and total % of time running py scripts.
2009-08-07bpy_context_set and bpy_context_clear to replace a number of functions (some ↵Campbell Barton
were not always called causing bugs). fix for a leak when trying to run a text with a syntax error too.
2009-07-26indentation error with some operators (strip the descriptions)Campbell Barton
if 0'd the exec() workaround for running python scripts incase windows devs want to test. theeth said the problem is when you compile a debug blender against a non debug python (or the ther way I assume), you can get a FILE struct mismatch. A quick way to test this on windows is to run this from the command line. blender -P somescript.py Somescript.py can be anything
2009-07-26misc py/rna changesCampbell Barton
- running a script from a file now uses the PyRun_File(FILE *, ...) rather then PyRun_String("exec(open(r'/somepath.py').read())"...), aparently FILE struct on windows could not ensured to be the same between blender and python, since we use our own python on windows now it should be ok. - generating docs works again (operator update for py style syntax broke them) - python operator doc strings was being overwritten - added rna property attribute "default" to get the default value of a property, not working on arrays currently because variable length arrays are not supported.
2009-07-212.5: python module name for import had trailing "."Brecht Van Lommel
2009-07-21BLI_setenv, use instead of copying ifdefs about for setting env vars.Campbell Barton
set PYTHONHOME as well as PYTHONPATH, quiets some warnings.
2009-07-21mistake in own recent change, errors with startup scripts didnt raise errorsCampbell Barton
2009-07-20cmake option to disable SDL,Campbell Barton
bpy_interface.c - change order of checking scripts to avoid calling stat on .py files.
2009-07-19d_type isnt a member of dirent on win32.Campbell Barton
2009-07-19- Support for importing python packages. (directories of python scripts ↵Campbell Barton
containing an __init__.py) - BLI_add_slash returns the new string length. - BLI_where_am_i() would often have /./ in the path (not incorrect but annoying, got into python exceptions) - release/ui/space_image.py, py error referencing invalid keyword args.
2009-07-18fixes for errors on startup and compiler errors and draw speedup.Campbell Barton
* Drawing the console text now skips all lines outside the view bounds. * Added dummy C operators for console.exec and console.autocomplete so blender wont complain at startup, its not really a problem but people testing reported it a few times. Eventually we should have some way python operators are initialized before the spaces operators are checked. * reordered the imports so the "ui" dir is imported before "io", for now this means bpy.ops is defined before exporters and importers need to use it, was causing a python error on startup. * fixed all compiler warnings for the console (gcc4.4) * stopped operators were printing out the return flag. * removed references to ACT_OT_test, TEXT_OT_console_exec and TEXT_OT_console_autocomplete
2009-07-17python access to operators now hides the _OT_ syntax, eg. SOME_OT_operator ↵Campbell Barton
-> some.operator this works for the calling operators from python and using the RNA api. bpy.ops.CONSOLE_exec() is now bpy.ops.console.exec() eg. split.itemO("PARTICLE_OT_editable_set", text="Free Edit") becomes... split.itemO("particle.editable_set", text="Free Edit") For now any operator thats called checks if its missing _OT_ and assumes its python syntax and converts it before doing the lookup. bpy.ops is a python class in release/ui/bpy_ops.py which does the fake submodules and conversion, the C operator api is at bpy.__ops__ personally Id still rather rename C id-names not to contain the _OT_ text which would avoid the conversion, its called a lot since the UI has to convert the operators.
2009-07-11PyApiCampbell Barton
* refcount error if StringIO or io modules could not be imported * importing python modules like math didnt work because the script registration overwrote the script path. now just prepend the path.
2009-07-092.5Ton Roosendaal
Monthly cleaning round to make it compile warning free. Mostly it was const stuff (strings, Context), but also a couple useful fixes, like wrong use of temp pointers. Only Mathutils callback struct I left alone... design issue.
2009-07-09removed check for pyc when scanning the directory of python files.Campbell Barton
Brecht, double checked and pyc or pyo files arent used because of the (file_extension[3] == '\0') test.
2009-07-092.5: Mesh and Various FixesBrecht Van Lommel
* 3D view Mesh menu works again, but incomplete. * Add Properties and Toolbar to 3D View menu. * Added "specials" menus back, vertex/edge/face and general. * Various fixes in existing mesh operators, some were not working. * Add MESH_OT_merge. * Merge all subdivide ops into MESH_OT_subdivide, subdivide code changes to make smooth + multi give good results. * Rename all select inverse ops to *_OT_select_inverse. * Fix "search for unknown operator" prints at startup, and some warnings in py code. * Don't run .pyc files on startup. * Remove unused image window header C code.
2009-07-08* workaround for PySys_SetArgv() in python3 needing wchar_tCampbell Barton
* PyRNA - id_struct.keyframe_insert("path", index, frame)
2009-07-032.5Ton Roosendaal
Windows #ifdef code missed semicolon.
2009-07-03fix for own missing var in recent commit.Campbell Barton
2009-07-03set the PYTHONPATH to BLI_gethome_folder("python") if it exists.Campbell Barton
This lets us distribute blender with our own python module directory (next to ui and io), and avoids the need for a shell script to start blender.
2009-07-02out own Py_GetPath() function to replace pythons, so we can bundle python ↵Campbell Barton
modules with blender, #if 0'd for now but having it is useful for testing. This works by copying /usr/lib/python3.1 to a dir called "python", next to blenders "ui" and "io" dirs.
2009-06-23PyRNA API support for matrix types as Mathutils matrix (with callbacks) ↵Campbell Barton
rather then a generic rna sequence of floats. Any 3x3 or 4x4 rna matrix will automatically be returned as a Mathutils matrix. This makes useful stuff like multiplying a vector location by an object matrix possible. ob = bpy.data.scenes[0].objects[0] print (ob.data.verts[0].co * ob.matrix) Also added mathutils matrix types to the BGE GameObject.localOrientation, worldOrientation * MT_Matrix3x3 added getValue3x3 and setValue3x3, assumed a 4x3 float array. * KX_GameObject.cpp convenience functions NodeSetGlobalOrientation, NodeGetLocalOrientation, NodeGetLocalScaling, NodeGetLocalPosition. * 2.5 python api now initializes modules BGL, Mathutils and Geometry * modules py3 PyModuleDef's use PyModuleDef_HEAD_INIT, rather then {}, was making msvc fail to build. * added macros for Vector_ReadCallback, Vector_WriteCallback etc. to check if the callback pointer is set before calling the function.
2009-06-182.5 PythonBrecht Van Lommel
Merging changes made by Arystanbek in the soc-2009-kazanbas branch, plus some things modified and added by me. * Operator exec is called execute in python now, due to conflicts with python exec keyword. * Operator invoke/execute now get context argument. * Fix crash executing operators due to bpy_import_main_set not being set with Main pointer. * The bpy.props module now has the FloatProperty/IntProperty/ StringProperty/BoolProperty functions to define RNA properties for operators. * Operators now have an __operator__ property to get the actual RNA operator pointers, this is only temporary though. * bpy.ops.add now allows the operator to be already registered, it will simply overwrite the existing one. * Both the ui and io directories are now scanned and run on startup.
2009-06-18Some generic modules from blender 2.4x building with py3k and mostly working.Campbell Barton
* Mathutils, Geometry, BGL, Mostly working, some //XXX comments for things to fix with py3 python import override (bpy_internal_import.c) so you can import python internal scripts from the BGE and running blender normally.
2009-06-14Blender/Python APICampbell Barton
Send the full python stack trace to the reporting api, added BPY_exception_buffer which temporarily overrides sys.stdout and sys.stderr to get the output (uses the io module in py3 StringIO in py2 to avoid writing into a real file), pity the Py/C api has no function to do this. fix for crash when showing menu's that have no items.
2009-06-05Blender file selector support for setting multiple selected files/dirs which ↵Campbell Barton
operators can use. This allows the sequencers Add-Image strip to work like it does in 2.4x. - as well as setting the "filename" operator property, operators can have collections called "files" and "dirs" which are set when available. - RNA_OperatorFileListElement as new collection type, its a bit redundant since each item only has a "name" property but its needed since we don't have a string array type. - the file selector now prints operators it runs. Tested with python, adding a list of images works to the sequencer works. bpy.ops.SEQUENCER_OT_image_strip_add(name="MyImages", start_frame=54, channel=2, filename="/somedir/", replace_sel=True, files=[{"name":"test1.png"}, {"name":"test2.png"}])
2009-05-25Store the context for python in a static variable with assessor functions - ↵Campbell Barton
BPy_GetContext/BPy_SetContext, Still not happy with this in the long term but its less problematic then storing the context in pythons namespace which couldn't be set before importing modules. This might fix a crash quite a few people have reported (but I cant reproduce).
2009-05-112.5 - Restored 'Render Anim' button!Joshua Leung
After quite a bit of searching, I finally found where the various UI functions were wrapped for use in Py Layouts. For the reference of others, check out editors/interface/interface_api.c
2009-04-23- fix for python refcounting crashes, remember PyDict_GetItem and ↵Campbell Barton
PyDict_GetItemString borrow a ref. - the namespace dictionary wasn't being de-allocated for each run. - clear every error after printing it to avoid stale PyObjects hanging about.
2009-04-23F8Key reloads all python scripts and redraws for quick testingCampbell Barton
F7 runs test.py also for testing
2009-04-22Assorted 2.5 fixes:Joshua Leung
- compiling errors in outliner.c - incorrect comments
2009-04-20Drivers: "Scripted Expression" drivers (i.e. PyDrivers) work againJoshua Leung
Now it is possible to write a Python Expression using the variable names for driver targets (see mockup from initial commit) to substitute the appropriate values into the expression. In the __global__ namespace for PyDriver evaluation, the following modules are available: * __builtins__ - i.e. the builtin Python functions * bpy - new Python API * math or m - math module For example: Consider a driver with three targets, named: A, B, C Now, you could write an expression like: C if A < 5 else B or even: 2*C if A < 5 or A > 20 else m.PI*B Of course, you don't have to have three targets, the above was just an example. TODO: * Bring back way to load pydrivers.py * Blender.Noise equivalent would be nice to have P.S. I hope I haven't made any terrible Python API coding errors here (i.e. mem leaks, etc.)
2009-04-16Need to update the RNA pointers before running scriptsCampbell Barton
2009-04-142.5Ton Roosendaal
More cleanup! - removed old UI font completely, including from uiBeginBlock - emboss hints for uiBlock only have three types now; Regular, Pulldown, or "Nothing" (only icon/text) - removed old font path from Userdef - removed all old button theme hinting - removed old "auto block" to merge buttons in groups (was only in use for radiosity buttons) And went over all warnings. One hooray for make giving clean output :) Well, we need uniform definitions for warnings, so people at least fix them... here's the real bad bugs I found: - in mesh code, a call to editmesh mixed *em and *me - in armature, ED_util.h was not included, so no warnings for wrong call to ED_undo_push() - The extern Py api .h was not included in the bpy_interface.c, showing a several calls using different args. Further just added the missing includes, and removed unused vars.
2009-04-11Added back importing UI scripts rather then running,Campbell Barton
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.
2009-04-11undo previous commit, changing running the script to importing it somehow ↵Campbell Barton
made it crash when running the class functions. will look into this further.
2009-04-11Changed the script UI registration to import rather then run each python script,Campbell Barton
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.
2009-04-11UI:Brecht Van Lommel
* 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 ...
2009-04-01Python Panels WIPCampbell Barton
- 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.
2009-03-23Python:Brecht Van Lommel
* Fix for not printing syntax error when running script from the text editor, and crash on exit. Campbell, please check if this is OK?
2009-03-21get rid of warnings, fix for a refcount errorCampbell Barton
2009-03-19* removed warnings and fixed some python refcount errorsCampbell Barton
* 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 */
2009-03-162.5 PyAPICampbell Barton
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
2009-03-132.5 Python apiCampbell Barton
- 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)
2009-03-11WIP PyAPI from winter camp discussions, make subtypes of the base RNA python ↵Campbell Barton
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.
2009-03-04run script in the text editor is back. UI scripts dont work yet.Campbell Barton
2009-03-02* errors in bpyui draw scripts were segfaultingCampbell Barton
* added PyLineSpit(), useful for debugging so you can easily find the line of the python script running.
2009-02-28Python experimental UI APICampbell Barton
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.
2009-02-16WIP, low level python UI functions, so far tested popup menu to work with ↵Campbell Barton
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.