Age | Commit message (Collapse) | Author |
|
eg:
bpy.context.object.data.materials[0] = bpy.data.materials["SomeMaterial"]
|
|
|
|
|
|
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
|
|
argument can optionally be a function rather then a list.
|
|
needed for dynamic python enums.
|
|
generic, to be used by render engine later.
|
|
incorrect) & close keymap file after running.
|
|
|
|
|
|
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.
|
|
|
|
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.
|
|
|
|
|
|
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.
|
|
* 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.
|
|
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)
|
|
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
|
|
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.
|
|
will add more properties later
|
|
* 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.
|
|
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
|
|
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]
|
|
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.
|
|
* 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.
|
|
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
|
|
* 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.
|
|
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()
|
|
* 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.
|
|
* 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.
|
|
* 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.
|
|
* 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.
|
|
* 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.
|
|
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).
|
|
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.
|
|
* 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.
|
|
* 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.
|
|
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.
|
|
* RNA_blender.h is now generated along with the other files. It is not
used anywhere yet, and still located quite hidden next to the other
rna_*_gen.c files. Read only access for now.
* Inherited properties are not copied from the base anymore but
iterated over. Patch by Vekoon, thanks!
* Array get/set callbacks now do the whole array instead of getting an
index. This is needed for some layers for example so python can set
the array as a whole, otherwise the check that one layer has to be
enabled at all times gets in the way. Also nicer for the C API.
* Also some changes to returning pointers to make the API cleaner, got
rid of the type() callback and instead let get() return PointerRNA
with the type included.
The C API looks like this currently:
http://users.pandora.be/blendix/RNA_blender.h
|
|
* Finished DNA_lamp_types.h, DNA_world_types.h and DNA_sound_types.h.
* Renamed "parent" struct property to "nested", and also remaining "from"
usage to "base".
* Added a NEVER_NULL subtype for pointers and use it for all properties
that apply.
* Make sure all structs have a description, and fix any other DOC_BROKEN
descriptions, also many other naming consistency improvements.
|
|
RNA struct
This is used for generating docs so a nested RNA struct such as MaterialRaytraceTransparency are listed under Material rather then in the global struct list)
These RNA structs are used for grouping properties and don't correspond to a C structure.
|
|
* Added support for sending notifiers and updates when setting
RNA properties. Per property, there is a notifier NC_/ND_ flag,
and a function that is called. Currently only used for
Object.loc/rot/size.
* RNA_property_update that does this is not automatically called
in every _set function, it has do be done separate, and is being
done by buttons with RNA data.
* Perhaps for python there could be a trick to accumulate these
flags rather than update each time, though for now the python
RNA code could just do them everytime. Did not add these calls
in the python code yet because it needs context, not sure where
to get that from?
|
|
accessible via python)
Many descriptions are not written, grep for DOC_BROKEN if you have some spare time to write struct descriptions.
|
|
* Wrap most user editable data in DNA_mesh_types.h and DNA_meshdata_types.h.
Still needs to be improved in some areas though, especially how to deal
with data layers (expose per element or as array, or both?), and data in
face corners (bmesh type data structures are more logical here).
Tweaks to RNA defining to make some cases easier:
* Added range callback function for int/float.
* Added 'skip' callback for listbase and array iterators to skip items in
the collection.
* Extra error print when calling wrong define_property_*_sdna functions.
* Also made button code respect non_editable flag, is quick change though,
need to add support for properly graying out etc.
|
|
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
|
|
* Added support for ID properties, mapped as follows:
* IDP Int = RNA Int
* IDP Float, Double = RNA Float
* IDP_String = RNA String
* IDP Group = RNA IDPropertyGroup Struct
* IDP_Array = RNA Array
* PropertyRNA and StructRNA are now defined private for the module,
to force external code to always use accessor functions.
|