Age | Commit message (Collapse) | Author |
|
|
|
translating too
|
|
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.
|
|
generic, to be used by render engine later.
|
|
|
|
The problem was flag-enums were being treated as regular enums, a default value of 0 was using the first enum item, whereas with flag enums we want to be able to use 0 as a default value to specify all flags are off.
|
|
this missed some cases, now also disallow ints to be wrapped as floats.
This commit also exposed a number of cases where ints/floats were incorrectly wrapped.
Bugs like [#25416] wont slip through the cracks anymore.
|
|
to directly adjusting the loc/scale/rot.
- pose bone 'matrix_local' wasn't well named since it didn't work like object or regular bones.
- pose bone matrix values for rna had array access rather then 4x4 matrix access.
note: for pose bones update scripts by renaming 'matrix_local' --> 'matrix_basis'
|
|
other has corrupted filename)
|
|
PointerProperties
cant test if this fix solves the problem matt is having but it at least fixes an error caused by classes created in exec(),
when the properties pointers were copied the hash key still referred to the python object which could be freed. in most cases this wouldnt happen (would be kept in bytecode) but with exec() the property string is freed immediately.
|
|
patch [#23317] Changed some operators' RNA to accept lengths
by Lorenzo Tozzi (oni_niubbo)
with the minor change to use XYZ subtype rather then LENGTH.
|
|
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.
|
|
|
|
eg:
bpy.types.Scene.IntProperty(attr="myprop") # adds
bpy.types.Scene.RemoveProperty(attr="myprop") # removes
|
|
|
|
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).
|
|
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.
|
|
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)
|
|
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
|
|
% sign for percentage assuming it is between 0-100, while factor is
for values 0-1.
Move collision setting absorption from modifier to collision settings,
was inconsistent to have it there as the only one, and made it have
range 0.0-1.0 instead of 0-100.
|
|
Appending and Linking
* Linking Operator, invokes filebrowser for Append/Link
* Separated the append/link function into three parts:
** BLO_library_append_begin finds main for appending
** BLO_library_append_named_part appends one Object,Group, Material, ...
** BLO_library_append_end actually reads and expands the libraries
NOTE 1:
I also changed the returned properties for the filebrowser operators to the following convention:
"path" - the full path to a file or directory, means what is in directory + filename buttons in filebrowser
"directory" - the content of the directory button in filebrowser
"filename" - the content of the filename button in filebrowser
Usually only path should be required, but in some cases it might be more convenient to retrieve the parts separately.
Ton, Brecht: If you have time to take a look, let me know if anything needs to be fixed.
|
|
* 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.
|
|
* Added RNA subtype for layers.
* Shift-click works again.
* uiItemR can now also handle armature/bone layers.
* Also makes Move to Layer popup work as expected.
|
|
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]
|
|
unregister func.
- use RNA_struct_blender_type_set to set the type to NULL before its freed
There is a memory error here when reloading scripts - ui_handler_panel_region, need to look into theis further.
|
|
* ID blocks can now get RNA properties defined from python, e.g.:
bpy.types.Scene.BoolProperty(..)
* RNA structs/functions/properties can now get pointers duplicated
(mostly strings), since we can't point to some static string then.
* Added ExtensionRNA struct to add into *Type structs for subclassing,
is a bit more compact than defining the 4 variables each time.
Only disadvantage is it requires including RNA in more places.
|
|
* Added suppport for generating code without verifying with DNA,
this doesn't give good errors and is more error prone, but makes
it easier to wrap things like EditBone which are not in DNA.
* RNA_define_verify_sdna(0), and set to 1 again afterwards.
|
|
* RNA_enum_items_add_value and RNA_enum_item_add_separator utility
functions, to add an item from an existing array with a certain
value, and to add a separator.
|
|
* 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.
|
|
* Context panel now draws without header, with arrows, no scene name.
* Softbody vertex group search popup.
* Improve names for autogenerated shortcut keys in menus.
* Make most Select menus in the 3D view header work.
* Fix armature border select selection syncing.
* Add POSE_OT_select_constraint_target,
MESH_OT_select_by_number_vertices, MESH_OT_select_vertex_path.
* Merge mesh select similar into one operator.
* Don't give MESH_OT_select_random Space hotkey.
* Add DAG_object_flush_update to many mesh edit tools, not calling this
will crash with modifiers.
* RNA_def_enum_funcs for dynamic enums in operators, but not very useful
without context yet.
* Fix refresh issue with image window header + editmode.
* Fix drawing of shadow mesh for image painting.
* Remove deprecated uiDefMenuButO and uiDefMenuSep functions.
* Remove keyval.c, code is in wm_keymap.c already.
* Rename WM_operator_redo to WM_operator_props_popup.
|
|
check Save Image or Export PLY operator for example.
Also these code changes:
* Added some RNA collection iterator macros to simplify code.
* Fix bpy.props.BoolProperty not working correct.
* Merge uiDefAutoButsRNA/uiDefAutoButsRNA_single into one.
|
|
* 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.
|
|
* Added PROP_ID_REFCOUNT flag to control if refcounting should
be done on ID pointer properties. All ID pointers are refcounted,
by default, with the exception of Object, Scene and Text.
* Also made TextureFace image pointer editable, with the special
refcounting behavior.
|
|
* 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.
|
|
- Added an autogenerated C++ API, basically a simple layer over the C
API, but with the advantage that it fits the object oriented RNA
model better. Read-only still like the C API.
- Had to rename "protected" property in Action Group because it is
a C++ keyword, called it "locked" since that seems more consistent
anyway?
- It's not used anywhere, so here's some example code I used to test it,
to get an idea of how it would be used:
http://pasteall.org/4582/cpp
- Also, ID names are now editable.
|
|
|
|
* Added Particle wrapping patch by Roelf de Kock. It's not
complete yet and I haven't reviewed it, but committing anyway,
will get to it later.
* Added "Percentage" subtype for floats. Doesn't really do
much besides making auto rna buttons into sliders rather than
numeric inputs, but can later display in % rather than 0.0-1.0.
|
|
* 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
|
|
* Added more compact property definitions, with a single function.
Only used by operators at the moment, would need to tweak regular
expressions a bit more to use it also for other RNA definitions.
* The operator properties defined now were completed a bit more but
still have many issues that need to be adressed, specifically;
* Some properties that should be booleans or enums are defined as
ints, note that ints are only for numeric values, not bitflags
or multiple choice.
* Soft/hard limits and default values of many properties are not
well defined still,
* Inconsistent naming, especially for example mouse locations or
bounds are named differently in different places. Also mouse
locations and other vector like properties should become a single
vector property instead of multiple X/Y properties.
* Almost no properties have descriptions, these would be good to
have for docs and tooltips.
So, please verify that the properties of the operators you wrote are
well defined.
|