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
2014-01-04RNA API: use bool's for enum itemf callbacks.Campbell Barton
2013-03-07use bool for rna funcs.Campbell Barton
2013-01-09style cleanupCampbell Barton
2013-01-05This patch adds support in bpy.props for getter/setter callback functions. ↵Lukas Toenne
We already have update callbacks, but generic get/set functions can come in handy in some cases where the functionality is too complex to use a single value. The current C callback functions are too simple allow a straightforward implementation, in particular they don't receive the PropertyRNA pointer itself as an argument, which means the callback cannot directly access the PropertyRNA's py_data pointers which store the python function objects. For this reason a second runtime variant of these callbacks has been added. It is only used for runtime callbacks and not in makesrna, but otherwise works the same way.
2012-03-30Node socket values now only have soft limits, rather than hard limits, so youBrecht Van Lommel
can type in any value, and only when sliding the number value there is a limit. It was already possible to assign any value to a socket with node linking, so this shouldn't cause any new issues. Also raised the limits on the math nodes, with a patch by Agustin Benavidez.
2012-03-18Code style edits (mostly spliting long lines, and removing trailing spaces).Bastien Montagne
Note about long lines: I did not touch to two pieces of code (because I don’t see any way to keep a nicely formated, compact code, with shorter lines): * The node types definitions into rna_nodetree_types.h * The vgroup name functions into rna_particle.c
2012-03-16i18n stuff: adds translation_context to RNA structs (used for there ui ↵Bastien Montagne
name), and a first default "Operator" one for all operators' label. The fact is, operators' label are nearly always verbs, while properties labels are nearly always nouns. So this should already solve many translations' problems regarding noun/verb confusion. This commit also simplifies a bit i18n usage: *Now IFACE_ and TIP_ macros (or there context versions, CTX_IFACE_/TIP_) are used nearly everywhere (with one exception, where code is a bit complex and needs to manually test whether ui/tip translations is allowed, so no need to redo it later through those macros). *Also, those macros are now defined to NOP in case WITH_INTERNATIONAL is false, which avoid testing that define everywhere in code!
2012-02-17unify include guard defines, __$FILENAME__Campbell Barton
without the underscores these clogged up the namespace for autocompleation which was annoying.
2011-12-22Translation context for RNA propertiesSergey Sharybin
This commit implements a way to define context of property which is used by localization stuff and which is needed to resolve translation context when some word wit the same english spelling is used in different meanings (like Manual in meaning of tutorial, and Manual in meaning of something is setting up by hand). To define property's context there's a function RNA_def_property_translation_context. If property doesn't have context, regular BLF_gettext function is used to get translation of property name, otherwise BLF_pgettext is used for this. Hence, for correct translation, messages in .po files should be marked by "msgctxt" context, otherwise property with context declared wouldn't be translated at all. Toolchain scripts from bf-translation project would be updated soon. If context for some values of enumerator property, property itself should be moved to other context and all items from this enum would be moved to this context automatically (it's impossible to move one few items to another context). P.S. Think context like "BRUSH" or "MODIFIER" are preferable than "NOUN" and "VERB" because in some cases the same english noun used in different areas better be translated differently to make translation more native.
2011-12-02renaming BooleanProperty to BoolProperty (rna structs shouldnt affect scripters)Dalai Felinto
Talked with Brecht and Campbell and they both agreed that bpy.types should match bpy.props In the ideal world we would rename bpy.props to BooleanProperty. This would break scripts though. So we go for a compromise and at least have some consistency.
2011-10-23remove $Id: tags after discussion on the mailign list: ↵Campbell Barton
http://markmail.org/message/fp7ozcywxum3ar7n
2011-10-01support for object data material assignment in pythonCampbell Barton
eg: bpy.context.object.data.materials[0] = bpy.data.materials["SomeMaterial"]
2011-10-01add a collection function slot for assignment (not used yet).Campbell Barton
2011-06-09fix for own mistake & fix some comments.Campbell Barton
2011-06-06Support for update callbacks in python defined RNA properties as discussed ↵Campbell Barton
last meeting. This means script authors can perform actions using these callbacks rather then on drawing which puts blender in a readonly state. Simple example: import bpy def up_func(self, context): print("test") bpy.types.Scene.testprop = bpy.props.FloatProperty(update=up_func) bpy.context.scene.testprop = 11 # prints -> test
2011-05-26support for dynamic items in bpy.props.EnumProperty(), the items keyword ↵Campbell Barton
argument can optionally be a function rather then a list.
2011-05-26add the property as an argument to enum item functions, not used yet but ↵Campbell Barton
needed for dynamic python enums.
2011-05-18RNA: make mechanism used by operators to keep python instance alive more ↵Brecht Van Lommel
generic, to be used by render engine later.
2011-03-25fix for incorrect prints with RNA errors (own fault, CONTAINER_RNA_ID was ↵Campbell Barton
incorrect) & close keymap file after running.
2011-02-27doxygen: blender/makesrna tagged.Nathan Letwory
2011-02-23doxygen: prevent GPL license block from being parsed as doxygen comment.Nathan Letwory
2011-01-16defining types via python gave confusing errors because DefRNA.laststruct ↵Campbell Barton
was being used for errors when the new property wasn't on the last struct. added CONTAINER_RNA_ID() define to get the ID from the ContainerRNA type.
2011-01-15remove/comment unused defines.Campbell Barton
2011-01-05fix for py/rna mesh.materials[:] where empty materials exist, would raise a ↵Campbell Barton
runtime exception. problem was there was no way to tell the difference between getting an empty item from a collection or the item not being found.
2010-08-03rna pointer poll function, not used yet.Campbell Barton
2010-02-12correct fsf addressCampbell Barton
2010-01-02support for multiple return values from rna functions & support for ↵Campbell Barton
returning arrays, (no functions are using this yet). patch from Elia Sarti, (vekoon) with some modifications mainly for the python api. - multiple values are returned as a typle in the order that are defined. - added support for registered types returning multiple arguments (untested). - renamed func->ret --> func->c_ret, since this only defines what the C function returns.
2009-12-08RNA:Brecht Van Lommel
* Property update functions no longer get context, instead they get only Main and Scene. The RNA api was intended to be as context-less as possible, since it doesn't really matter who is changing the property, everything that uses the property should be updated. * There's still one exception case that use it now, screen operations still depend on context too much. It also revealed a few places using context where they shouldn't. * Ideally Scene shouldn't be passed, but much of Blender still depends on it, should be dropped when we try to support multiple scene editing. Change was planned for a while, but need this now to be able to call update without a context pointer.
2009-11-25AnimSys - Transform Locks + RNA:Joshua Leung
The Animation System now respects the Transform Locks too (i.e. lock x-location, etc.) when writing settings. This means that it is no longer necessary to set up "constant drivers" to make sure some values don't get accidentally animated. Internally, added a new callback for properties in RNA, which is responsible for checking if the item at some array-index is editable. This needs to be manually called for each place which uses rna to set settings for arrays (see the code changes in anim_sys.c for changes how to do this; the same thing needs to be done in the UI code too, and probably in py-api too)
2009-11-18ID properties that are displayed via RNA can now define their own UI settings,Campbell Barton
only implimented min/max precision & step. at the moment there is no way to edit these other then via python example of setting UI limits... >>> C.object['foo'] = 0.5 >>> C.object['_RNA_UI'] = {'foo': {'step': 0.5, 'soft_max': 10.0, 'soft_min': 0.0, 'precision': 2, 'description': 'Some setting'}} Also fixed typo's: precission -> precision
2009-11-13arbitrary property and function support for rna properties (arrays and ↵Campbell Barton
collections), this means functions can be easily added. eg. scene.objects.link() object.constraints.new() mesh.verts.transform(...) mesh.faces.active PropertyRNA stores an StructRNA pointer where these can be defined.
2009-11-03active property for collections for things like scene.objects.activeCampbell Barton
will add more properties later
2009-09-09RNA: multidimensional & dyanmic array changesBrecht Van Lommel
* Disable setting array length of dynamic array for now, this was not implemented correct, and it's not really needed now. * Allow all dimensions to be dynamic size, not just the first. * Change storage of multidimensional to be simpler. * Rename API functions to be more compact. * Fix some bugs in the implementation. * RenderLayer.rect and RenderPass.rect use a multidimensional dynamic array now.
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-07-17bpy rnaCampbell Barton
Calling rna functions with invalid keywords, too many keywords and too many args would fail silently - now raise an error with invalid keywords and a list of valid ones, raise an error when too many args are given. - calling rna functions would alloc a ParameterList each time, changed to use a stack variable (2 pointers and an int). - store the number of parameters ParameterList - python exception types were wrong in many cases, (using attribute error rather then type error) - fixes to small errors in python UI scripts.
2009-07-10RNABrecht Van Lommel
* Enums can now be dynamically created in the _itemf callback, using RNA_enum_item(s)_add, RNA_enum_item_end. All places asking for enum items now need to potentially free the items. * This callback now also gets context, this was added specifically for operators. This doesn't fit design well at all, needed to do some ugly hacks, but can't find a good solution at the moment. * All enums must have a default list of items too, even with an _itemf callback, for docs and fallback in case there is no context. * Used by MESH_OT_merge, MESH_OT_select_similar, TFM_OT_select_orientation. * Also changes some operator properties that were enums to booleas (unselected, deselect), to make them consistent with other ops.
2009-06-29RNABrecht Van Lommel
Implementation of RNA side of foreach_get/foreach_set, Campbell will do python code. Three functions for efficiently setting some property for all items in a collection. RNA_property_collection_raw_array gives access to the properties as an array with length, stride, and type specified, if this is possible, i.e. not when it uses a ListBase, or if a manual get/set function is implemented. Two other functions take a C array pointer and get/set it using the a collection + property name, using efficient array access if possible, and otherwise using slower RNA iterator. RNA_property_collection_raw_get RNA_property_collection_raw_set The number of type conversion required here got a bit out of hand, it could be more efficient still if checking for more cases, but function is already long enough. Example: http://www.pasteall.org/6362/c
2009-06-202.5Brecht Van Lommel
* Optimized RNA property lookups and path resolving, still can be much better, but now the 1000 IPO example on bf-taskforce25 runs at reasonable speed. * Also an optimization in the depsgraph when dealing with many objects, this was actually also a bottleneck here.
2009-06-18RNABrecht Van Lommel
Merging changes made by Arystanbek in the soc-2009-kazanbas branch, plus some things modified and added by me. * The API files now all in the makesrna module, convention is to call them e.g. rna_mesh_api.c for rna_mesh.c. Note for visual studio build maintainers, the rna_*_api.c files are compiled as part of "makesrna", but do not have rna_*_gen.c generated as part of the library. SCons/cmake/make were updated. * Added function flags FUNC_USE_CONTEXT and FUNC_USE_REPORTS, to allow RNA functions to get context and error reporting parameters optionally. Renamed FUNC_TYPESTATIC to FUNC_NO_SELF. * RNA collections now have a pointer to add/remove FunctionRNA's, this isn't actually used anywhere yet, purpose is to make an alias main.meshes.add() for main.add_mesh() in python. * Fixes to make autogenerating property set/get for multidimensional arrays work, though a 4x4 matrix will be exposed as a length 16 one dimensional RNA array. * Functions and properties added: * Main.add_mesh() * Main.remove_mesh() * Object.matrix * Object.create_render_mesh() * WindowManager.add_fileselect()
2009-06-16RNABrecht Van Lommel
* Added icon to property and enum property items. The latter is responsible for the large number of files changed. * For RNA functions, added PROP_RNAPTR flag to ask for a PointerRNA as argument instead of a C pointer, instead of doing it implicitly with the AnyType type. * Material: properly wrap diffuse/specular param variables, and rename some things for consistency. * MaterialTextureSlot: added "enabled" property (ma->septex). * Image: make animated property editable. * Image Editor: make some things editable, notifiers, respect state. * Context: fix issue with screen not being set as ID.
2009-06-07RNA:Brecht Van Lommel
* Accept None as NULL pointers through python function calls. * Added type callback for pointers back, it's useful still in some cases. Made Object.data editable using this, the pointer type varying based on object type. * Wrap pin ID pointer in buttons space. * Added subclasses for text and surface curve ID blocks, to organize data better and get proper icons. * Added RNA_type_to_ID_code and ID_code_to_RNA_type functions. * Update RNA_access.h with new RNA types.
2009-06-04UI/RNA:Brecht Van Lommel
* Added an icon entry to RNA structs, instead of the UI_GetIconRNA function, to keep code together a bit more and make the lookup faster.
2009-05-29RNA:Brecht Van Lommel
* Automatically do us++ and us-- reference counting in ID pointer set functions. * Added an enum property callback to dynamically vary the list of available items. * Added some functions to do removes on pointers and collections runtime defined for RNA and using ID properties. * Constraints now have owner/target space wrapped, and most pointers made editable. They can be ported to use python layouts. * Also other pointers made editable that I think are see now with the automatic reference counting.
2009-05-20RNA:Brecht Van Lommel
* Any Struct can now have ID properties, by creating a callback function to create/return an IDProperty. * Wrapped PoseChannel ID properties. * Note there is still no way to create ID Properties in 2.5, though the callback to get/create the initial group is now exposed through RNA_struct_idproperties.
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-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-25RNA:Brecht Van Lommel
* Test with constructing RNA paths from pointer + property, based on a callback per struct. For animato we'll need to be able to do this, for keyframing from buttons, unless we can somehow derive the paths from the interface code, which seems like an unnecessary burden. However constructing such paths is not always quick, and we need a fast way to find out if a property is animated for drawing buttons, so this may not be the best solution. See rna_mesh.c for some callbacks created as a test. * Added BLI_sprintfN to mallocN a new string using printf style formatting.
2009-03-23RNA:Brecht Van Lommel
* Allow pointers to be editable, did SpaceTextEditor.text as a test. * Changed PROP_NOT_EDITABLE to PROP_EDITABLE, and added RNA_def_property_clear_flag. * Removed rna_dependency.c test code.
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.