テンプレート:Release Notes/2.41/Python/Misc

提供: wiki
移動先: 案内検索

POSE

Python Pose Module

Log:

  • pose code for python

- adds object.getPose - ability to manipulate poses /posebones - fixes a overflow bug in matrix sequence accessor - adds code to get vec/roll from mat3 - few internal fixes to NLA - ability to set bone matrices


Mathutils

Python Mathutils fix

Mathutils fix: bug #3737 Vector.resize4D() didn't put 1 in the 4th component (the scale factor), as it did in 2.37. While this is more "correct", it is much less usefull. Also, matrix.resize4x4 puts a 1 there too, so might as well revert and be consistent.


Mathutils

[ #3661 ] resize4x4 in Matrix class doesn't set ones on the diagonal

  • resizing a matrix now puts 1's back on the diagonals.

ARMATURE, BONES and CONSTRAINTS

bugfix: #3738 BonesDict was returning None instead of throwing a KeyError when key not found. Also fixed a few compile warnings about struct initialization.

[ #3712 ] Calling makeEditable() and update() on an armature twice duplicates bones

  • fixes bug where editbones are not freed on calling update()
  • bone.children fix

- fixes bone.children to return direct bone children - added bone.getAllChildren() to allow previous behavior

bug fix constraints

Bugfix as provided by 'stealth apprentice' on the bf-comitters list. Function get_constraint_target() should catch the case when a constraint has unknown type, to prevent a pointer to become unitialized.




BEZTRIPLE

Python Beztriple fixes

Log: Removed printfs in setPoints(), add proper exception handling.

Window

Window Editmode fix

Fixed Window.Editmode(0) so that it only calls undo_push_mesh() when U.undosteps is nonzero.Also added optional parameter to avoid pushing undo info alltogether if desired.

Window Theme

- minor: added missing theme options (bone_solid, bone_pose, strip, strip_select) to Blender.Window.Theme and also updated accordingly (version info) the script that saves themes as scripts and the module's doc.


IPO

IPO.getKey

Log: Patches submitted by Michael Reimpell to get/set relative key selection, and to get the current value of the IPO shape key.There are still some issues to discuss as to whether methods/attributes should be used and what they should be named, but this will (or should) be addressed in the upcoming API rewrite.

OBJECT

Object.Get

replaced more M_Object_Get for the faster Object_CreatePyObject. Object.GetSelected now dosen't return None if there is no 3d view. - wasn't documented and likely would mess up scripts that always expected a list. - Just return an empty list instead.

Object.GetSelected

Added some notes regarding Object.GetSelected() - it uses the last localview.

Object.insertShapeKey

patch from jean-michel soler (jms) - .insertShapeKey()

Python API, a function to insert a shape key in an object . It works on Mesh, Lattice curve ans surface . Example of use :

import Blender

OBJECT=Blender.Object.GetSelected()[0]

OBJECT.insertShapeKey()

Object fix

Object.Get( name ) was throwing an AttributeError. Change to throw more correct ValueError

Object.Join

Added a python hook to Joining objects Object.Join()

Seperated the join calls from space.c and view3dmenu into join_menu() in space.c, like the select_group_menu(), okee's from join_curve, join_mesh.. etc are in join_menu() so python can call them without UI menu's in the way. this is also a bit neater since there were 2 places that were doing what join_menu() does now.

Moved Object.Join() into a function of an object. eg. ret_val = ob.join(objects) Now it dosent depend on the current selection, or change the selection context.

Made respective join_* functions return 0 if the join was not mode, 1 when it workes.

Object.insertPoseKey

added Object.insertPoseKey to continue with the attempt to make nla/path walkcycle baking to actions


Object.Duplicate

Added the function Duplicate to the object module. Object.Duplicate(linked=1)

Basicly a wrapper for adduplicate();

There was previously no easy way to copy objects in python. even the ways that do exist dont take modifiers, particles etc into account. Uses the current selection

Changed adduplicate() to take the dupflags as an argument. so faking the Alt Key isnt needed anymore in Blender or python. Changed Pythons Object.Duplicate() to take keyword parms to enable duplication of spesific data. Eg- Object.Duplicate(mesh=1) # to duplicate mesh data also.

Made pythons duplicate not redraw, documented adduplicate()

Mesh

Mesh_getFromObject made Mesh and Surf types copy the material list to the new mesh. Still need to do Mball and Text.

Blender.Mesh.Mode

Python Mesh bugfixes

Bugfix #3761: Attempting to set mesh.faceUV=1 when a mesh has no faces now throws a RuntimeError exception.Previous behavior was to do nothing.

  • edge and face extend() methods now add edges and faces in the order given

by their parameters.Note that if duplicate edges or faces are specified, the order is preserved but the dups are removed, so indices won't match.

  • allow extend(), findEdges() and faces.uv to accept lists or tuples
  • fix bug in mesh.verts.extend() which didn't correctly check argument types

Two bug fixes for mesh.faces.extend() method; fix a error checking for duplicate faces in the input list, and also extend texture faces if they are enabled.

Clean-up of some reference counting issues with delete() methods.Also further relax the input types for edge.extend() and face.extend() so that single lists or tuples are accepted without errors.

Another bug fix for reference counting in extend methods.

Cam Barton discovered the setter for me.faces[i].col was missing.

NMesh

Created local function check_NMeshLists(), which performs checking on NMesh lists before trying to build a new mesh (used by mesh.PutRaw() and mesh.update()).It was possible to put junk into the NMesh lists, resulting in some messed-up meshes.

MISC

Bug fix #3671: Blender.Beztriple.New() did not accept sequences as parameters, even though its error messages suggested it did. Thanks to Yann for the patch (I also added the ability to accept parameters without requiring them to be in a tuple). Also documented the New() function.

Bugfix #3652: material.setSpecCol() only accepted a tuple, not separate parameters as it used to (prior to my tp_getset update).Fixed this and other similar situations.


IPO.addCurve

Bugfix for Toni: Ipo_addCurve() needed to call set_icu_vars() in order to properly initialize data for new Ipo curves.

bugfix

Fixed bug in convert function with Mesh objects. Objects with no modifier could still be converted, but resulting meshes were corrupt and segfaulted Blender when cycling edit mode. This tests each mesh object for modifiers before converting.

Resulting metaballs meshes were not visible in wireframe.

Also made the selection context nicer, All new converted objects are selected while objects that are converted are deselected.


Scene.getChildren

made scene.getChildren() a heap faster. 983.3 times faster in my test. getting 7200 objects did take: 1.18 sec,now 0.0012 sec

It was doing a full object list lookup for every object in the scenes base using the name to compare. now it just gets the object directly from the base and converts it to a python object, adding it to the list.

Curve doc fix

Log: Bugfix #3731: User reported that cyclic IPO curves reported the wrong value in the BPy API for the "end point".It was a minunderstanding of what happens with cyclic Ipos, but we updated the documentation to make this clearer in the future.

lamp modes

Gave an example of changing lamp modes in epydocs.

command line script bug fix

Log: Bug #3658 reported by Daniel Holtz (thanks): http://projects.blender.org/tracker/?func=detail&atid=125&aid=3658&group_id=9

Running scripts from command line in bg mode: blender -b -P myscript.py crashes Blender 2.40.

The problem is in add_text() in text.c: G.scene can be NULL at this point (in bg mode). Added a check:

line 323: if (G.scene) /* can be NULL (bg mode) */ BLI_convertstringcode(str, G.sce, G.scene->r.cfra);

The text being added with add_text() in this particular case is the script filename specified at the command prompt, so it should be ok to skip BLI_convertstringcode. Feel free to disagree, though.

CleverNumButs

PupBlock method. This wraps the "clevernumbut" code to allow scripters to use popup blocks for user input instead of a sequence of multiple different popups. See the blend file for a comprehensive test and example file.

Made buttons in clever numbuts align. Commented out crufty name spesific actions that changed variables and added a label of buttons started with "Rot" - Since panels are used for rotating now.

Exclude labels from grouping. - Clever numbuts look nicer with rounded theme.

Fixed bug in do_clever_numbuts not displaying tooltips. Comment: Clear all events so tooltips work, this is not ideal and only needed because calls from the menu still have some events left over when do_clever_numbuts is called. Calls from keyshortcuts do not have this problem.