Commit Graph

167 Commits

Author SHA1 Message Date
Campbell Barton
08c9ecb3b0 RNA/Py API
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
2010-01-09 23:44:01 +00:00
Campbell Barton
b8ca67ca33 custom properties panels for most ID types. use subclassing to keep panel UI definitions minimal 2010-01-08 08:54:41 +00:00
Campbell Barton
e49e9289f0 - leg_quadruped_generic missing imports
- move global pivot in the UI of userprefs since others are closer related
2010-01-06 22:38:51 +00:00
Joshua Leung
a9861e3381 Durian Request: Drivers Recode
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.
2010-01-04 21:15:45 +00:00
Campbell Barton
c79cf56b69 dict.get() defaults to None as the second arg. no need to supply it. 2010-01-04 21:10:51 +00:00
Campbell Barton
589b2b4ca8 object.group_users, object.scene_users
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.
2010-01-04 15:37:22 +00:00
Campbell Barton
24a2c6e9bc bound box check for retopo grease pencil convertsion before spline intersection checking 2010-01-03 13:17:12 +00:00
Campbell Barton
18d37648ba grease pencil retopo improvement: join lines when endpoints match are close and are co-linear within some error limits.
still very slow, needs some speedups.
2010-01-03 01:30:07 +00:00
Campbell Barton
d8d11c55d9 patch from Cessen
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.
2010-01-02 23:43:46 +00:00
Campbell Barton
04d0261c37 new python submodule. eg.
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() ?)
2010-01-02 23:14:01 +00:00
Campbell Barton
e7d863cee5 editbone.transform(matrix) function, requested by Cessen.
Also added matrix.median_scale attribute to get the average scale from the matrix, use for scaling bone envalopes.
2010-01-02 22:47:56 +00:00
Campbell Barton
cef8b2088f sphinx support for documenting multiple return values 2010-01-02 18:55:07 +00:00
Campbell Barton
453945e9e3 remove python api cruft from custom operator registration 2009-12-30 22:51:44 +00:00
Martin Poirier
b00cddeb66 Macro registration using the normal rna registration methods (like operators).
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-30 22:14:32 +00:00
Campbell Barton
c72089df50 - deform types for copy, arm and leg, patch from Cessen (with slighy modifications)
- bone.center attribute
2009-12-30 18:39:02 +00:00
Campbell Barton
98f1d6957e new python module constants
* bpy.home - result of BLI_gethome()
* bpy.version - BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION
* bpy.version_string, as above, formatted: "%d.%02d (sub %d)"
2009-12-28 10:00:04 +00:00
Campbell Barton
0767cdd4a0 Transfer Shape Key
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.
2009-12-27 11:14:06 +00:00
Campbell Barton
5689ab3975 classmethods were excluded from docs, hide self & cls arguments for functions and class methods,
made some rna ui funcs not display as optional.
2009-12-26 17:49:08 +00:00
Campbell Barton
24ab5416da * sphinx docgen *
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
2009-12-26 16:47:25 +00:00
Campbell Barton
944a4f2a3f pep8 edits, removed MakeCursor.py and rna_array.py, not important to make pep8 2009-12-26 09:36:50 +00:00
Campbell Barton
5afd084513 replace dynamic_menu.py with Menu classmethods much less complicated.
access append/prepend eg.

bpy.types.INFO_MT_file_import.append(lambda self, context: self.layout.operator("import_some.format"))
2009-12-25 22:16:19 +00:00
Campbell Barton
be67970303 fix for [#20244] importing .obj without "Object" option checked crashes blender 2009-12-25 20:40:00 +00:00
Campbell Barton
4c5a314fef update rna_info and rna_rna for better introspection 2009-12-25 14:42:00 +00:00
Campbell Barton
4f3c477a85 fix for segfault getting RNA Enum default values, minor updates to introspection class 2009-12-25 09:01:23 +00:00
Campbell Barton
5f4e24d599 operator draw function working again. needed to add layout to the operator to give access to "self.layout" - like panels, headers and manu's have 2009-12-24 21:17:14 +00:00
Campbell Barton
bbe13e7823 * register operators like other classes
* operators now return sets (converted into flags)
* can't remove bpy_operator_wrap.c since macro's still use the custom register funcs
2009-12-24 19:50:43 +00:00
Campbell Barton
5bdcb2dff2 py error fix and minor changes to rna info class 2009-12-21 23:14:16 +00:00
Campbell Barton
7e8af5868e utility module for introspecting RNA for doc generation. 2009-12-19 13:48:50 +00:00
Campbell Barton
0c813b2a0e autorigging front end, access in pose mode armature panel (at the bottom)
demo: http://download.blender.org/durian/metarig_demo.ogv
sintel base rig also, would like to include more generic/simple rigs eventually
2009-12-17 19:48:30 +00:00
Campbell Barton
4cddc9e146 rescale metarig types to roughly match 1.0 == 1m for body parts, also fix py error with bone UI 2009-12-17 13:17:24 +00:00
Campbell Barton
c3b978828c pep8 corrections and no need to use C's _OT_ syntax when accessing operator names from py 2009-12-17 01:21:55 +00:00
Campbell Barton
bcb5f8ea12 Update 2.4x script: UV Follow active quads initial port thanks to Michael Williamson, added operator option, reporting, menu, edge length option myself. 2009-12-16 21:27:07 +00:00
Campbell Barton
3ea2d08e1a pep8 changes 2009-12-16 13:27:30 +00:00
Campbell Barton
b0abe98d59 - original bones in last layer
- dont rename root bone
- use Rigify exceptions
2009-12-15 18:53:16 +00:00
Campbell Barton
e7b4d36fd6 * new metarig type for the durian dragon leg (original rig by Cessen)
* 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)
2009-12-14 20:56:19 +00:00
Campbell Barton
d725fdb612 missing import 2009-12-14 14:51:42 +00:00
Campbell Barton
d88c776614 edits to the bone copy metarig type from Cessen, pointcache warning fix 2009-12-14 14:42:46 +00:00
Campbell Barton
3bf27683be automatic layer placement, users can set the layers if they want.
predefined layer types 'main', 'extra', 'ik', 'fk'
2009-12-14 14:21:06 +00:00
Campbell Barton
9f965ba62b pep8 warnings, remove unused imports 2009-12-13 22:48:11 +00:00
Campbell Barton
3449d3f9b3 use python3 syntax for defining a set. 2009-12-13 16:20:18 +00:00
Campbell Barton
7fc4ab2aab add pep8 headers so these scripts spit out errors when running pep8.
made some changes but mostly these scripts will give pep8 warnings.
2009-12-13 14:38:30 +00:00
Campbell Barton
a1656300ba script for automating pep8 checks.
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.
2009-12-13 13:59:16 +00:00
Campbell Barton
c1bfd014bd * rna: memory leak fix for RNA_property_enum_value()
* rigify: generate root-most bones before children, this makes parenting to dynamically created bones work.
2009-12-13 12:26:19 +00:00
Campbell Barton
026364dcca rigify
* 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.
2009-12-11 16:30:27 +00:00
Campbell Barton
fb28896cf7 * added an armature submenu where python defined armatures can go.
* bpy.utils.display_name(), which makes filenames and module names look nicer in menus eg... /home/me/foo_bar.py  --> "Foo Bar"
* missing rna_path --> data_path renaming
2009-12-11 14:16:59 +00:00
Campbell Barton
8b32402f38 * root bone override fixed
* delta was disabled
* simple copy metarig type
* proper exception when a type isnt found
2009-12-10 23:24:31 +00:00
Campbell Barton
97abf6ad96 * rename 'rna_path' --> 'data_path', rna and dna are for internal use and are not descriptive.
* armature.pose_position: POSE_POSITION, REST_POSITION --> POSE, REST
* rigify now forces rest pose mode
* updated neck_flex to keep original bones unchanged
2009-12-10 22:23:09 +00:00
Campbell Barton
2576268fb8 missed a header last commit, added custom exceptions to rigify so they can be caught and converted into reports and have normal errors display the stack trace as useual. 2009-12-10 18:28:22 +00:00
Campbell Barton
5c5ec6f0a7 fix for some errors and local root bone override 2009-12-10 14:32:37 +00:00
Campbell Barton
aaa181818e missed editing the sample rigs, Cessen likes palm_curl.py better 2009-12-10 13:45:16 +00:00