path -> filepath (for rna and operators, as agreed on with elubie)
path -> data_path (for windowmanager context functions, this was alredy used in many places)
- bpy.context wasnt being created from the python bpy.types.Context type defined in bpy_types.py (bpy.context.copy() failed for eg.)
- bpy.context.copy() was returning C defined methods like FloatProperty(), which are not useful in this case, removed.
there are internal memory problems which can make it crash still.
If you remove all directories in the scripts folder except for 'modules' and 'ui', it runs without crashes.
- Also made it so sys.stdin isnt overwritten anymore, instead the interactive consoel overwrites while it executes and restores after.
- removed hope folder from sphinx patch path
- own mistake in scene help text.
- rename properties to have users as the prefix for better ordering.
- use fixed height for stamp, gives better aligned text.
- mathutils.Color.hsv attribute. eg. material.diffuse_color.hsv = 0.2, 0.8, 0.4
- Vector/Euler/Quaternion/Color now only take a single seq arg.
- internal function for parsing arrays. (cleanup messy internal list/vector/tuple/seq parsing)
- didnt update rigify yet.
This adds a new presets menu in the splash screen and the Input section of
User Preferences to choose a preset interaction style, consisting of key configurations
and also other user preferences such as select mouse button, view rotation style, etc.
Currently, just 'Blender' and 'Maya' presets are included, hopefully we can have more
presets contributed (and maintained!) by the community.
It's best to keep these presets minimal to avoid too many key conflicts. In the Maya one
I changed the view manipulation key/mouse combos and also the transform
manipulator keys, not much more than that.
To save an interaction preset, open the user preferences Input section, and press the
[ + ] button next to the presets menu. It will save out a .py file containing any edited key
maps and navigation preferences to the presets/interaction folder in your scripts folder.
---
Part of this commit changes the way that key maps are exported/displayed in
preferences - now partial key configs are allowed. Previously it would export/import the
entire key configuration, regardless of whether individual key maps were edited or not
(which would make them more susceptible to conflicts in unexpected areas).
(note, in blender terminology, a key map is a category of key items, such as
'Object Mode' or 'View 2d'.)
Now, the export and the UI display work in a similar way to how key maps are
processed internally - Locally edited key maps (after pressing the 'Edit' button) are
processed first, falling back to other key maps in the current key config, and then falling
back to the default key config. So it's possible for a key config to only include a few
key maps, and the rest just gets pulled from the default key config. The preferences
UI display works like this too behind the scenes in deciding what to show users,
however using it is just like it was before, the complexity is hidden.
- added new mathutils.Color() type, use with rna so we can do for eg:
material.diffuse_color.r = 1.0
# also has hsv access
material.diffuse_color.s = 0.6
- made Mathutils and Geometry module names lowercase.
- vectors now respect min/max settings.
- keyframing and adding drivers raises an error in an index is set on a non array, keyframing raises an error if it fails.
reference docs...
- added docstrings for remaining python bpy_struct functions
- added fake class for docs, bpy_struct, which is the base class of everything in bpy.types
- improved inherictance references for struct classes, include bpy_struct members.
* Some cases of struct name being set where it shouldnt have been.
* Spelling: wich --> which
* Copy and initialize uv modifier scale, remove unneeded enum.
* Ability to pin any object into the context.
* Update uv window while transforming (useful when used with UVProject modifier)
* Patch by Wahooney, so new template's are internal text and dont get saved over
by mistake.
* Fix for https://bugzilla.redhat.com/show_bug.cgi?id=572186
Bug 572186 - [abrt] crash in blender-2.49b-5.fc12: Process
/usr/bin/blender.bin was killed by signal 6 (SIGABRT). Original fix submitted
by Jochen Schmitt.
* [#21816] bpy.data.add_image has stopped working on Windows. moved to
bpy.data.images.load(), missed this call.
(commits 27726,27825,27828,27831,27832,27833,27834,27836,27837,27838,27839,27858 by Campbell from render25 branch)
After a few days of wrong turns and learning the finer points of RNA-type-subclassing the hard way, this commit finally presents a refactored version of the Keying Sets system (now version 2) based on some requirements from Cessen.
For a more thorough discussion of this commit, see
http://sites.google.com/site/aligorith/keyingsets_2.pdf?attredirects=0&d=1
------
The main highlight of this refactor is that relative Keying Sets have now been recoded so that Python callbacks are run to generate the Keying Set's list of paths everytime the Keying Set is used (to insert or delete keyframes), allowing complex heuristics to be used to determine whether a property gets keyframed based on the current context. These checks may include checking on selection status of related entities, or transform locks.
Built-In KeyingSets have also been recoded, and moved from C and out into Python. These are now coded as Relative Keying Sets, and can to some extent serve as basis for adding new relative Keying Sets. However, these have mostly been coded in a slightly 'modular' way which may be confusing for those not so familiar with Python in general. A usable template will be added soon for more general usage.
Keyframing settings (i.e. 'visual', 'needed') can now be specified on a per-path basis now, which is especially useful for Absolute Keying Sets, where control over this is often beneficial.
Most of the places where Auto-Keyframing is performed have been tidied up for consistency. I'm sure quite a few issues still exist there, but these I'll clean up over the next few days.
setting sys.stdin to None is done so python wont lock blender when it tries to read from the input. - help() from the console does this.
Running blender with -d keeps the stdin so python debugging can work. add info in the help message about this.
eventually it might be best to replace sys.stdin with our own object which interacts with the console but this is not trivial.
Added a tail control rig.
For now, you have to manually hook the resulting controls up to a separate spline IK rig that you make by hand. Perhaps this can be automated in the future.
For anyone using this: keep in mind that you need separate armatures for the tail deformation bones and tail control bones. Otherwise you create a cyclic dependency like so:
tail deform bones <- spline object <- tail control bones
reloading bpy_types was causing reload to fail. also unregister all modules in the reverse order that they were loaded, so when reloading removed files done hang around.
Required options:
mesh: name of mesh object(s) to add/get shapekeys to/from
(if multiple objects, make a comma-separated list)
Optional options:
loc_<x/y/z>: name of the shape key to tie to translation of the bone
loc_<x/y/z>_fac: default multiplier of the bone influence on the shape key
rot_<x/y/z>: name of the shape key to tie to rotation of the bone
rot_<x/y/z>_fac: default multiplier of the bone influence on the shape key
scale_<x/y/z>: name of the shape key to tie to scale of the bone
scale_<x/y/z>_fac: default multiplier of the bone influence on the shape key
- bpy.app moved into PyStructSequence (used by sys.float_info)
- added buildinfo into bpy.app.build_*
- bpy.ui removed (wasnt used)
- include external example files in Mathutils docs (only Mathutils and Vector are currently written)
- added support to auto document PyStructSequence's
- CMake had "'s inside all its strings.
- Removed control-shape deformation bones from the spine rig (no longer necessary thanks to the new "custom shape at" feature).
- Various improvements to the mouth rig, including a corrective shape key for mouth-open.
- The new method of generating into the same armature object every time wasn't copying pose bone data in the process, such as rotation mode and transform locks.
By default the generated rig object is named "rig". But you can add a custom "rig_object_name" property to the metarig to specify the name of the object to generate into.
python modules bpy.app, bpy.utils are now included in docs.
C defined python module bpy.props has its docstrings extracted and written directly into sphinx docs since the C methods cant be inspected.
added docstrings to bpy.props and improved some in bpy.utils.
will update online docs tomorrow.
- modify the path in python rather then C
- filter returns an object in python 3, set using slice.
also import sys as _sys so it doesnt appier in aytocompleation.
- Added two driven-shape-key rig types that create and drive shape keys on a mesh/meshes based on the distance or rotation difference between two bones.
- Fixed bug in finger curl rig type where secondary finger controls were not created. Finger type can also now (optionally) have a hinge switch (useful when using it for wings).
- Changed the blending system in rigify_utils to use copy_transforms constraints instead of copy_loc+copy_rot.
- Finished the quadruped leg type. Now has both ik and fk control and ik/fk switching. Also uses a rotating bone to control the knee direction instead of a pole target (seems to work more consistently for quadruped setups). There's still one annoying bug regarding foot roll, but it's not blocking. I'll track it down later.
- Mouth rig now creates corrective shape keys on the face mesh for dealing with mouth corners when they spread open.
- Biped arm and leg types now cause mesh to scale when you scale the fk controls.
- Misc improvements to the rig types.
Example of adding a button to the view header;
def draw_custom(self, context): self.layout.operator("some.operator")
bpy.types.VIEW3D_HT_header.append(draw_custom)
- reload modules from types that are not directly included. for example wm.py uses classes from modules/rna_prop_ui.py which wasnt reloaded.
- script paths were being added to sys.path multiple times.
note: now the second reload gives a crash right away but this is a bug elsewhere.
- arguments, return values indentation means they get correctly interpreted by sphinx
- functions with no return values were displaying return as ()
- return values were getting the '(optional)' added in some cases.
Example:
http://www.blender.org/documentation/250PythonDoc/bpy.ops.object.html
- property names dont need the bone type prefix anymore
- always add a root bone that all non parented bones are parented to
- x/y/z axis properties for bones.
change how data is added. eg.
bpy.data.add_mesh(name) --> bpy.data.meshes.new(name)
bpy.data.remove_lamp(lamp) --> bpy.data.lamps.remove(lamp)
image and texture stil use add_* funcs
Highlights:
* Support for Multi-Target Variables
This was the main reason for this recode. Previously, variables could only be used to give some RNA property used as an input source to the driver a name. However, this meant that effects such as Rotational Difference couldn't be used in conjunction with other effects and/or settings to achieve the powerful results. Now, a variable can take several input targets, perform some interesting operations on them, and spit out a representative value based on that.
* New Variable Types
With the introduction of multi-target variables, there are now 3 types of variable that can be used: single property (i.e. the only type previously), Rotational Difference (angle between two bones), and Distance (distance between two objects or bones).
* New Driver Types
In addition to the existing 'Average', 'Sum', and 'Expression' types, there is now the additional options of 'Minimum' and 'Maximum'. These take the smallest/largest value that one of the variables evaluates to.
* Fix for Driver F-Curve colouring bug
Newly added drivers did not get automatically coloured in the Graph Editor properly. Was caused by inappropriate notifiers being used.
Notes:
* This commit breaks existing 2.5 files with drivers (in other words, they are lost forever).
* Rigify has been corrected to work with the new system. The PyAPI for accessing targets used for the variables could still be made nicer (using subclassing to directly access?), but that is left for later.
* Version patching for 2.49 files still needs to be put back in place.
utility functions to find the groups and scenes this object is used in.
button to set the group location from the cursor (UI is horrible but not any nice place to add?)
smarp project would fail if there were linked meshes in the scene, made ID.tag ignore the library, so you can tag linked data since its only for tools to use.
normalize the vertex normal before setting and use inline vector functions.
Adds a new set of bones to rig types which are to be used for weight paint vgroups, in some these have some more segments to account for twist. also use Aligoriths new copy transform constraint.
from bpy.app import binary_path, version, version_string, home
can add constant variables from blender here as needed (maybe functions too... bpy.app.memory_usage() ?)
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).
Useful if you have 2 different characters with the same base mesh (matching indicies), and want to copy a facial expression for eg, from one to another.
Durian request to re-use shapes between characters.
* Copies the active shape to other selected objects
* Different methods to apply the shape
* * OFFSET, simple translation offset
* * RELATIVE (EDGE/FACE), Use Barycentric transformation to copy the shape. This means the target mesh can be a different orientation and scale and the shape should still apply since the surrounding geometry is used as a basis for the offset.
bug: barycentric transform's depth was inverted.
Note:
* This isnt added into a menu yet,
* This cant be redone since adding a shape key messes up the redo stack. needs fixing for other scripts too.
py_function_args wasnt working right (was using function namespace for function args), use pythons inspect module instead.
move the function to get a type description into rna_info
* option to roll the delta of the arm rig.
* fix to copy metarig type
* renamed EditBone.align() --> EditBone.align_roll()
* Added EditBone.align_orientation(other)
* Added bone.vector: same as (bone.tail - bone.head)
On ubuntu/debian install these tools...
sudo apt-get install pylint pyflakes python-setuptools python-pip
sudo pip install pep8
then run from blenders source dir...
python release/test/pep8.py
This searches for the comments "# <pep8 compliant>" and "# <pep8-80 compliant>", running the checking tools on these scripts only.
* some minor pep8 corrections too.
* optional default blend argument, use for better leg & arm defaults
* way to define arbitrary options for bones that can then be passed to the generator function, only used to set elbow target parent at the moment.
- use reverse order for palm fingers (pointer first)
- allow copying bone class instances to exclude some bones
- doc generation had a python error (incedently updated online docs linked from the splash)
- Neck example didnt account for some possible problems when linking to the body
- foot IK were referencing the wrong bones
- updated some example rigs
- graph constraint arrow direction was incorrect
- 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
also avoids hitting the 255 string limit if you want to add 100's of values. eg.
>>> b05/max(0.001, [globals().update({"LOCALS":locals(), "ADD":float.__add__, "reduce":__import__("functools").reduce}), 0.0][1], max((, [LOCALS["b%.2d" % (i+1)] for i in range(5)])))
Since this more simple expression reaches the limit fairly quick...
>>> b05/max(0.001,b01+b02+b03+b04+b05)
- updated delta not to remove a bone
- spine and neck rigs interpolation bones are now axis aligned to the control bone
- palm tag is expected on the pointer finger rather then the wrist
- operate on bone children first working up the chain (not essential but more pradictable)
Basic definition works like a python operator but you derive from "bpy.types.Macro" instead.
Operators are added to the macro after it has been added with "bpy.ops.add_macro" through the class method "define" which takes an operator id and returns an OperatorMacroType (new RNA type) for which properties can then be defined to be passed to the operator when run.
Example: http://blenderartists.org/~theeth/bf/macro.py
Using this system, it should be easy to add an operator to the console that converts selected lines into a macro or even a more generic record macro system.
original bone names cant be changed anymore but this means the bones can be re-parented without confusing scripts that run after the rig is modified.
support for defining a bone to have multiple types and automatically blending between 2 generated rigs
new bone properties
- bone.basename (name without the extension), "Some.Bone.001" --> "Some.Bone"
- bone.children_recursive_basename, gives a chain of children that have the same basename
- the scripts path set in the user preferences or ~/.blender/scripts/ui (io, op, io etc..) will be used to load scripts.
- the default home dir part probably only works in *nix os's
- Added a missing sync callback to vector.toTuple()
- retopo operator to convert grease pencil drawn topology into geometry, not in the convert menu yet since its not quite finished, use the operator search menu for retopo. will test this week and see what needs fixing.
[#20123] "Import" menu entry becomes empty
[#20141] In Object menu Make Links appears twice - SVN 24970
also moved OBJs name cleaning func to bpy.utils.clean_name(name, replace="_")
these are applied by adding constraints, drivers, control bones etc. making it possible to re-apply changes & improvements to many rigs at once.
testcase makes a finger rig (like in BBB) from 3 bones, the base tagged with an id property "type":"finger".
still missing is a way to update the driver dep's
also fixed an error in the property UI when the active bone is not on the active layer.
This means you can have a pose bone for eg and get the path...
pose.bones["Bone"]
uses rna internal functions, so will work for sequence strips etc.
- StructRNA.get(), used for getting ID props without exceptions...
val = C.object["someKey"]
or..
val = C.object.get("someKey", "defaultValue") # wont raise an error
- change rna property for testing if rna props are editable, test the flag rather then calling the function since the function depends on blenders state.
- fix a python exception with the ID-Property popup UI (when editing in more then 1 step)
- remove functions such as operator_int(), operator_enum(), operator_string
this mixed with keyword arguments in a way that made them hard to read.
Instead, have operator() always return properties rather then needing an argument.
- rename prop_pointer() --> prop_object(), pointer is more a C thing.
- missed item_enumR(), rename to prop_enum()
- path functions bpy.utils.script_paths(), bpy.utils_preset_paths(subdir)
- further simplified presets, use a generic draw function for preset menus and define the preset subdir and operator in the class
- property editor can now set button min/max values and edit the tooltip
- custom props tooltips were not displayed
- cleanup the property UI
- remove hacks that were used for editing (edit is now a popup operator)
- object.children was broken
however this meant the invoke function could not modify properties for exec to use (unless it called exec directly after)
since the popup for eg would re-instance the python class each time.
now use the operator properties directly through rna without an automatic copy.
now an operator attribute is accessed like this...
self.path --> self.properties.path
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
this could be supported again easily however it leads typo's & api changes not showing any errors.
This broke povray export.
Solution for now is to allow setting private properties starting with '_'
eg,
ob = bpy.context.object
ob._foo = [1,2,3] # this is a python list, it will stay only as long as this PyObject is active
ob.foo = 1 # raises an error!, only for rna properties
ob["foo"] = 1 # converts to an ID property and is saved
using the underscore like this should really be used for classes internally.
- povray failed on armatures
- menu key wasn't using WM_keymap_add_menu
- bpy is now a python package, this makes it easier to add utility modules and adjust python startup which was previously using verbose Py/C api. Access should not be any slower since both C and Python modules use dictionary access.
- loop over scripts and load via python (currently F8 reload isnt working, will add back shortly)
- the C module is kept but renamed to _bpy and not meant for direct access from anything but the bpy package.
- bpy_types.py is an exception since it runs before the bpy package is initialized.
this way the UI scripts are less likely to fail silently and wont let typos work ok.
also allow subclassing of the context, added a copy function,
bpy.context.copy(), returns the context as a python dict to be modified and used in python.
This also showed up an invalid brush member in the screen context.
- 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)
- added scene.bases (like scene.objects)
- renamed group create operator.
Example
scene = bpy.data.scenes[0]
C = {}
C["scene"] = scene
C["selected_editable_bases"] = [scene.bases[2], scene.bases[3]]
bpy.ops.group.create(C)
Also made operator fake modules not return __call__ (reported by Stani, fixes autocomp. bug)