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
2010-10-14UNUSED() macro so -Wunused-parameter can be used with GCC without so many ↵Campbell Barton
warnings. applied to python api and exotic.c, removed some args being passed down which were not needed. keyword args for new mathutils types were being ignored when they should raise an error.
2010-09-23- py/rna's path_resolve function was ignoring the index eg: ↵Campbell Barton
obj.path_resolve("location[1]") - corrected comment from previous commit
2010-09-10rewrote python IDProperty metaclass in C, this was a quick hack to get it ↵Campbell Barton
working. The reason this didnt work is all sibclasses of pythons type() or PyType_Type in C, have to have their size set to sizeof(PyHeapTypeObject) rather then sizeof(PyTypeObject) as you might expect. This is strange since its not a heap-class (defined in pythons runtime), but a static C type, so Im not sure about this, and cant find any documentation but it seems to work ok.
2010-09-02- new subclass for ID-Property based collections - this way add/remove/move ↵Campbell Barton
functions will only be shown for types that support it. - moved array attributes into array properties - saves 8 bytes per allocated non-array property.
2010-08-31rna support for passing dynamic sized arrays to rna functionsCampbell Barton
using this for object.vertex_groups.assign([index list ...], group, weight, mode)
2010-08-19- Properties from base classes are now registered too, this allows class ↵Campbell Barton
mix-in's to define properties. An example of how this is useful - an importer mixin could define the filepath properties and a generic invoke function which can run the subclasses exec for each selected file. - Panels and Menus now skip the property check when registering. - renamed _idproperties_ to _idprops_ in function names, function names were getting very long.
2010-08-02minor changes to Martni's commit 30961Campbell Barton
- removed the immediate option from C/api and now store in python only, when python loads modules it sets it to False. - unloading a module would clear the entire TypeMap for all modules, only remove the module types that is being unloaded. - added some checks for bad class registering, report errors rather then crashing.
2010-08-02RNA Types metaclass registrationMartin Poirier
See mailing list posts for details [1][2][3] Addons still need to be fixed; Campbell said he'd do it today. See any of the py files (outside netrender) in this commit for how to do it (it's rather simple). [1] http://lists.blender.org/pipermail/bf-committers/2010-February/026328.html [2] http://lists.blender.org/pipermail/bf-committers/2010-August/028311.html [3] http://lists.blender.org/pipermail/bf-committers/2010-August/028321.html
2010-07-23[#22488] Reloading scripts causes crashCampbell Barton
F8 key enabled again, useful for script UI development. - keying set freeing wasnt freeing from all scenes and the builtin list. - PointerProperty() cant refer to a removed python srna type (fixed in rigify and netrender). - Added a check for freeing a type used by a PointerProperty but its very slow, makes reloading take ~10sec. Only enabled this in debug mode for now. Netrender register() function isnt re-registering the property, probably because the module is cached by python and not re-run.
2010-03-16fix for nasty bug where registering properties would register them in the ↵Brecht Van Lommel
parent classes SRNA, made for confusing rigify args turning up in add sequencer adding collection. (commit 27433 by Campbell from render25 branch)
2010-02-27utility function pyrna_enum_value_from_id for getting the enum from a string ↵Campbell Barton
and raising an error if its invalid.
2010-02-16bugfix [#21173] Autocompleate raises an errorCampbell Barton
split PropertyRNA off into 3 types, base type, collection and array, since array and collections needed internal checks inside almost every function its better to have the, as subclassed to the property type. This makes introspection more useful. Also made printing of structs and properties prettier giveing type and length.
2010-02-12correct fsf addressCampbell Barton
2010-02-02subtype support for properties in bpy.props.Campbell Barton
2010-01-24RNA functionsElia Sarti
Fixed and completed support for returning multiple values. This includes support for returning arrays, both fixed and dynamically sized. The way this is achieved is by storing an additional int value next to the dynamic parameter in the ParameterList stack which gets passed to the C function as an additional parameter. In the case of return parameters it is duty of the C function to set this int to the correct length value for the dynamic parameter (which makes sense). Note that for the dynamic output/return parameter it is assumed the function has allocated that memory (which gets freed automatically). Also, I cleaned the makesrna's bridge function generation code a bit and renamed PROP_RETURN to PROP_OUTPUT, which represents better the reality now that there are multiple returns. The function now to mark multiple returns (outputs) is RNA_def_function_output. For an example, look at Action.get_frame_range in rna_action_api.c, by the way Aligorith I removed the #ifdef for this function now that there's support for returning arrays, feel free to modify (the function seems to work).
2010-01-23when python calls an operator, return a set from the operator flag, this ↵Campbell Barton
matches the set that python operators themselves return. eg. {'MODAL'} or... {'FINISHED'}
2010-01-20BPY: fixed iteration over and slicing of multidim. arrays.Arystanbek Dyussenov
2010-01-19patch [#20724] Randomize Loc Rot Size py operator for B2.5Campbell Barton
written from scratch by Daniel Salazar (zanqdo). added own modifications. New property type bpy.props.FloatVectorProperty(), only difference with float is it takes a 'size' argument and optional 'default' sequence of floats. moved bpy.props.* functions out of bpy_rna.c into their own C file.
2009-12-31Macro registration using the normal rna registration methods (like operators).Martin Poirier
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-08- pyrna support for (value in array), currently only 1 dimensional arrays.Campbell Barton
- use python malloc's in bpy_array.c - automatically blending bone locations is disabled if the target bone has locked location - neck had incorrect roll
2009-11-11python api for collection add()/remove()Campbell Barton
Added a group example C = bpy.context ob = C.active_object bpy.data.groups[0].objects.add(ob) - add_to_group and rem_from_group now take optional scene and base flags and deal with updating the object & base flags - operators that add objects to groups were setting ob->recalc= OB_RECALC_OB; looks like its not needed. - previously add() ignored python args, now add and remove are called like any other FunctionRNA from python. - made the pyrna api use tp_getset's for collestions active/add()/remove()
2009-11-08bpy/rna api class featureCampbell Barton
- python defined classes will be used when available (otherwise automaically generated metaclasses are made as before) - use properties rather then functions for python defined rna class's - call the classes getattr AFTER doing an RNA lookup, avoids setting and clearing exceptions for most attribute lookups, tested UI scripts are ~25% faster. - extending rna py classes this way is a nicer alternative to modifying the generated metaclasses in place. Example class --- snip class Object(bpy.types.ID): def _get_children(self): return [child for child in bpy.data.objects if child.parent == self] children = property(_get_children) --- snip The C initialization function looks in bpy_types.py for classes matching RNA structure names, using them when available. This means all objects in python will be instances of these classes. Python properties/funcs defined in ID py class will also be available for subclasses for eg. (Group Mesh etc)
2009-10-31define operator properties in the class, similar to django fieldsCampbell Barton
# Before [ bpy.props.StringProperty(attr="path", name="File Path", description="File path used for exporting the PLY file", maxlen= 1024, default= ""), bpy.props.BoolProperty(attr="use_modifiers", name="Apply Modifiers", description="Apply Modifiers to the exported mesh", default= True), bpy.props.BoolProperty(attr="use_normals", name="Export Normals", description="Export Normals for smooth and hard shaded faces", default= True), bpy.props.BoolProperty(attr="use_uvs", name="Export UVs", description="Exort the active UV layer", default= True), bpy.props.BoolProperty(attr="use_colors", name="Export Vertex Colors", description="Exort the active vertex color layer", default= True) ] # After path = StringProperty(attr="", name="File Path", description="File path used for exporting the PLY file", maxlen= 1024, default= "") use_modifiers = BoolProperty(attr="", name="Apply Modifiers", description="Apply Modifiers to the exported mesh", default= True) use_normals = BoolProperty(attr="", name="Export Normals", description="Export Normals for smooth and hard shaded faces", default= True) use_uvs = BoolProperty(attr="", name="Export UVs", description="Exort the active UV layer", default= True) use_colors = BoolProperty(attr="", name="Export Vertex Colors", description="Exort the active vertex color layer", default= True)
2009-09-06Python part of multidim. array support for RNA complete.Arystanbek Dyussenov
Multidim. arrays can now be modified at any level, for example: struc.arrayprop = x struc.arrayprop[i] = x struc.arrayprop[i][j] = x struc.arrayprop[i][j][k] = x etc... Approriate rvalue type/length checking is done. To ensure all works correctly, I wrote automated tests in release/test/rna_array.py. These tests cover: array/item access, assignment on different levels, tests that proper exceptions are thrown on invalid item access/assignment. The tests use properties of the RNA Test struct defined in rna_test.c. This struct is only compiled when building with BF_UNIT_TEST=1 scons arg. Currently unit tests are run manually by loading the script in the Text Editor. Here's the output I have: http://www.pasteall.org/7644 Things to improve here: - better exception messages when multidim. array assignment fails. Those we have currently are not very useful for multidim. - add tests for slice assignment
2009-08-25Implemented dynamic and multidimensional array support in RNA.Arystanbek Dyussenov
Example code: http://www.pasteall.org/7332/c. New API functions: http://www.pasteall.org/7330/c. Maximum number of dimensions is currently limited to 3, but can be increased arbitrarily if needed. What this means for ID property access: * MeshFace.verts - dynamic array, size 3 or 4 depending on MFace.v4 * MeshTextureFace.uv - dynamic, 2-dimensional array, size depends on MFace.v4 * Object.matrix - 2-dimensional array What this means for functions: * more intuitive API possibility, for example: Mesh.add_vertices([(x, y, z), (x, y, z), ...]) Mesh.add_faces([(1, 2, 3), (4, 5, 6), ...]) Python part is not complete yet, e.g. it is possible to: MeshFace.verts = (1, 2, 3) # even if Mesh.verts is (1, 2, 3, 4) and vice-versa MeshTextureFace.uv = [(0.0, 0.0)] * 4 # only if a corresponding MFace is a quad but the following won't work: MeshTextureFace.uv[3] = (0.0, 0.0) # setting uv[3] modifies MTFace.uv[1][0] instead of MTFace.uv[3]
2009-08-182.5: RNA, defining enums, pointers and collections properties is nowBrecht Van Lommel
possible from python, but it's still work in progress. Pointers and collections are restricted to types derived from IDPropertyGroup (same as for operators), because RNA knows how to allocate/deallocate those. Collections have .add() and .remove(number) functions that can be used. The remove function should be fixed to take an other argument than a number. With the IDPropertyGroup restriction, pointers are more like nested structs. They don't have add(), remove() yet, not sure where to put them. Currently the pointer / nested struct is automatically allocated in the get() function, this needs to be fixed, rule is that RNA get() will not change any data for thread safety. Also, it is only possible to add properties to structs after they have been registered, which needs to be improved as well. Example code: http://www.pasteall.org/7201/python
2009-08-15changes to help refcounts in rna be more predictable (still leaks when ↵Campbell Barton
reloading on - F8)
2009-08-14- registering new python classes runs the free functions on existing classes.Campbell Barton
- print an error if RNA Structs are freed with a python pointer set to help with debugging leaks. - fix for unlikely eternal loop in unit conversion.
2009-07-30Operator Copy/PasteCampbell Barton
you can copy operator strings from buttons or the reporting interface and run them in the console. - Ctrl+C over an operator button copies its python string to the clipboard. - Paste in the console (1 line only for now). - operators run from python no longer require all arguments.
2009-07-23pyrna,Campbell Barton
calling rna functions with the wrong argument type would raise an error like.. expected a string type Added an error prefix so now the message is.. TypeError: UILayout.item_enumO(): error with argument 3, "value" - expected a string type
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-05PyRNACampbell Barton
- Support for python to convert a PyObject into a collection (uses a list of dicts - quite verbose :/) - Operators can now take collection args when called from python. - Support for printing operators that use collections (macro recording). - Added RNA_pointer_as_string which prints all pointer prop values as a python dict. Example that can run in the in test.py (F7 key) bpy.ops.VIEW3D_OT_select_lasso(path=[{"loc":(0, 0), "time":0}, {"loc":(1000, 0), "time":0}, {"loc":(1000, 1000), "time":0}], type='SELECT') for some reason lasso locations always print as 0,0. Need to look into why this is.
2009-04-19RNA: Generic Type RegistrationBrecht Van Lommel
The Python API to define Panels and Operators is based on subclassing, this makes that system more generic, and based on RNA. Hopefully that will make it easy to make various parts of Blender more extensible. * The system simply uses RNA properties and functions and marks them with REGISTER to make them part of the type registration process. Additionally, the struct must provide a register/unregister callback to create/free the PanelType or similar. * From the python side there were some small changes, mainly that registration now goes trough bpy.types.register instead of bpy.ui.addPanel. * Only Panels have been wrapped this way now. Check rna_ui.c to see how this code works. There's still some rough edges and possibilities to make it cleaner, though it works without any manual python code. * Started some docs here: http://wiki.blender.org/index.php/BlenderDev/Blender2.5/RNATypeRegistration * Also changed some RNA_property and RNA_struct functions to not require a PointerRNA anymore, where they were not required (which is actually the cause of most changed files).
2009-04-16merged pyrna_py_to_param and pyrna_py_to_prop since they are almost the sameCampbell Barton
2009-04-09talked to vekoon and he's ok about using pythons CFunction rather then our ↵Campbell Barton
own pytype. If printing PyTypes becomes important we can do it a different way which is still less then 10 lines.
2009-04-09Experimental removal of pyrna_func_Type (ifdef'd out)Campbell Barton
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.
2009-04-07RNA: Commit of the API patch by vekoon. This adds Functions to RNA,Brecht Van Lommel
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.
2009-03-21- lazy subtype initialization rna, was initializing every type in bpy.types ↵Campbell Barton
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
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-01-29python3 couldn't generate epydocs because python3 needs richcompare ↵Campbell Barton
functions for C defined PyTypes (it seems).
2009-01-08RNA: fix crash in python code, forgot to update this part in a previous commit.Brecht Van Lommel
2008-12-29added RNA access to operators pointers to be documented with epy_doc_gen.py.Campbell Barton
eg: print (bpyoperator.VIEW3D_OT_viewnumpad.rna.__members__) docs for bpyoperator http://www.graphicall.org/ftp/ideasman42/html/bpyoperator-module.html
2008-12-27python operators (in bpy_opwrapper.*)Campbell Barton
This means you can define an operator in python that is called from C or Python - like any other operator. Python functions for invoke and exec can be registered with an operator name. keywords are read from the python exec() function, then used to create operator properties. The default python values are used to set the property type and defaults. def exec(size=2.0, text="blah"): ... is equivalent to... prop = RNA_def_property(ot->srna, "size", PROP_FLOAT, PROP_NONE); RNA_def_property_float_default(prop, 2.0f); prop = RNA_def_property(ot->srna, "size", PROP_STRING, PROP_NONE); RNA_def_property_string_default(prop, "blah"); TODO - * make use of events * return OPERATOR_CANCELLED/OPERATOR_FINISHED.. etc * add support for array args * more testing
2008-12-25* PyOperators now parse args using the PyRNA api (wraps ID props internally), Campbell Barton
this means it can reuse the function for converting python to RNA types - giving more useful errors. * Incorrect enum args lists valid values in their exception message (used for PyRNA and PyOperators). * remove bpy_idprop.c and bpy_idprop.h PyOperators are not usable since they run outside the UI loop atm.
2008-12-16Added "bpydoc" to the global namespace of python scripts, making ↵Campbell Barton
documentation available no matter what data is open in the current blend file, Directory type was also missing from the subtype enum causing the test rna-dump script to fail.
2008-12-01PyRNA structs and properties can now be subtyped to add functionality in python.Campbell Barton
rna_actuator.c was missing an enum
2008-11-29Python RNA APICampbell Barton
* Matches the C/RNA api structure * Thin wrapper ~(600 lines) * No functions specific to any blender object type. * Defines 2 types, BPy_StructRNA and BPy_PropertyRNA. * Python 3.0 target (compatible with python 2.4,5,6) * http://wiki.blender.org/index.php/BlenderDev/Blender2.5/PyRNA - continue docs/discussion here. Todo * Collection iterators * Write access to data * Define how constants should be accessed (as strings or some special type) * Solve the "Python keeping invalid blender pointers" problem. This cant just be solved in the py api - we need blender to notify when ID's are removed Examples Here are some examples that work with the current implementation of the api. rna.lamps["Lamp.006"].energy -> (1.0) rna.lamps["Lamp.007"].shadow -> ("NOSHADOW") rna.materials.keys() -> ['flyingsquirrel_eye', 'frankie_skin', 'frankie_theeth'] rna.scenes["hud"].objects["num_text_p2_4"].data.novnormalflip -> False rna.meshes["mymesh"].uv_layers.keys() -> ['UVTex', 'UVTex'] rna.meshes.items() For a dump of yo-frankie level see - http://pasteall.org/3294/python Notes * Added python back, can only execute scripts from the command line with -P script.py * bpy_interface.c is just enough functionality to run a python file.