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

提供: wiki
< テンプレート:Release Notes‎ | 2.42‎ | Python
2018年6月29日 (金) 02:47時点におけるYamyam (トーク | 投稿記録)による版 (1版 をインポートしました)
(差分) ← 古い版 | 最新版 (差分) | 新しい版 → (差分)
移動先: 案内検索

Pack Access

 Applied pack unpack from Pablo Martin (caedes),
 http://projects.blender.org/tracker/?func=detail&atid=127&aid=3246&group_id=9
 adds
 
 Blender.c:
 Blender.UnpackModes (dict with the unpack modes)
 Blender.UnpackAll(mode)
 Blender.PackAll()
 Blender.CountPackedFiles()
 
 Image.c:
 image.packed (this was working)
 image.pack()
 image.unpack()
 
 Sound.c:
 sound.packed
 sound.pack()
 sound.unpack()


Python Mesh API

 A couple of bug fixes and enhancements:
 (1) Setting the UV attributes of a mesh face will create texture faces if
     they are not already defined.  Previously this threw an exception.
 (2) Setting the image attribute of a mesh face will also set the TEX bit
     of the face.mode flag
 (3) When "sticky" vertices are created with mesh.vertexUV, the color is
     set to white instead of black.
 Three more changes for the Mesh module:
 (1) Bug fix for UV vertices ("sticky").  me->msticky was not being updated
    when vertices were added or deleted from the mesh.
 (2) Vertex, edge and face .extend() methods accept zero-length sequences
    instead of throwing an exception.  (Note that not giving any argument
    is still an error).
 (3) Edge and face .extend() methods ignore "invalid" edges or faces which
    have the same vertex twice instead of throwing an exception.  Cam and I
    argued about this for a while... :-)

Python Object API

 Allow object.setMatrix() to accept 3x3 matrices by extending to a 4x4
 internally.  Also check the dimensions of the new matrix and throw an
 exception if not a 3x3 or 4x4.

Python Dupli access

 Log:
 Applied JMS's Patch. for better Python Dupli Access.
 Made some fixes and changes.
 * The matricies returned were wrapped. Wrapping Display Mesh matricies segfaulted sometimes. - Made a copy instead.
 * Added 1 missing epydoc from the patch.
 * Renamed getDupliMatrices to getDupliObjects, and changed to return a list of (object, matrix) tuples instead of just the matrix. This is much more usefull because it allows python to know what objects are used for dupliGroups and for dupliverts where there is more then 1 child. also cleaned up this function a bit.

python empties

new emptys now have default settings for new emptys.

Documentation

Taking a hint from Hos, started adding some (hopefully) better examples into the documentation for creating and manipulating meshes.

Beztriple API

Additions to BezTriple API: complete get/set access to all BezTriple settings (knot and handles points, handle types, tilt/alfa, hide, weight and selection status).

Python Mesh API

 A bug fix and an enhancement:
    * fixed bug when adding or deleting faces from a mesh which has
      vertexColors; mesh->mcol was not being updated
    * changed edges.extend() and faces.extend() to accept integer vertex
      indices in addition to MVerts; this should make scripts simpler and
      in general make things run faster


Python

 Added Blender.Group module
 The plans for the new Python API are too far off to have this module conform.
 
 Added object.dupliGroup so objects can access the groups they instance.
 This is very confusing.
 Since in object has
 ob.setDupliGroup() # Enable/Disable Dupligroup
 ob.getDupliGroup() # see if its enabled.
 ob.dupliGroup # the group data this object is instancing.
 
 Not yet added
 ob.groups # Groups that use this object.
 Log:
 Added support for group objects
   grp.objects
 
 To have an iterator assigned as well as a list. Since gp.objects is an ietartor this is expected.
 grp.objects= someGroup.objects works now.
 
 Some other small fixes made.
 
 Made a wrapper for add_to_group() That handles the OB_FROMGROUP flag. Should be moved to group.c's add_to_group()
 
 void add_to_group_wraper(Group *group, Object *ob) {
 	Base *base;
 	add_to_group(group, ob);
 
 	if (!(ob->flag & OB_FROMGROUP)) { /* do this to avoid a listbase lookup */
 		ob->flag |= OB_FROMGROUP;
 
 		base= object_in_scene(ob, G.scene);
 		if (base)
 			base->flag |= OB_FROMGROUP;
 	}
 }
 

renderpath for python

Added a way to set the renderpath (dir and name) from the command line.

 eg
 Blender  -b c:\blends\test.blend  -o "c:\renders\render_#.png"  -x 0  -F PNG
 
 -x 1/0 for extension enable/disable
 -F for format/filetype
 
 This is important because somebody elses Blend files can render anywhere on your PC, possibly a security risk.
 And nice for renderfarms to be able to set the path without running a python script inside the blend file.
 
 blender --help (render opts only)
 Render options:
   -b <file>     Render <file> in background
     -S <name>   Set scene <name>
     -f <frame>  Render frame <frame> and save it
     -s <frame>  Set start to frame <frame> (use with -a)
     -e <frame>  Set end to frame (use with -a)<frame>
     -o <path>   Set the render path and file name.
       Use // at the start of the path to
         render relative to the blend file.
       Use # in the filename to be replaced with the frame number
       eg: blender -b foobar.blend -o //render_# -F PNG -x 1
     -F <format> Set the render format, Valid options are..
         TGA IRIS HAMX FTYPE JPEG MOVIE IRIZ RAWTGA
         AVIRAW AVIJPEG PNG AVICODEC QUICKTIME BMP
         HDR TIFF EXR MPEG FRAMESERVER CINEON DPX
                Use // at the start of the path to
     -x <bool>   Set option to add the file extension to the end of the file.
 
 Added details to the -v option
 Eg
 blender -v
 Blender 2.41 Build
         build date: 2006-03-20
         build time: 16:16:34
         build platform: linux-glibc2.3.6-i386
         build type: dynamic
 
 Also fixed bugs where nagative/realy big  frames could be set- causing Blender to crash.

Python Docs

 Attempted to unify and document Dupli* stuff.
 DupGroup
 DupObjects
 enableDupVerts
 enableDupFrames
 enableDupGroup
 enableDupRot
 enableDupNoSpeed
 
 see the epydocs for documentation at http://members.iinet.net.au/~cpbarton/ideasman/BPY_API/Object.Object-class.html - will update in a tick.

Python

 Log:
 Made blender python work in background mode without a blend file loading.
 Blender.c python initialization creates a scene when in background mode and when there is no scene.
 Needed to skip redrawing when in background mode because it depended on screen data that wasnt there.

Python API

 Log:
 Added select group meny to mesh editmode.
 Currently only works for faces.
 Try Shift+G in face/editmode.


Python API

 Log:
 Added python image pack/unpack per image.


python

 Added matt's empty drawsize property to python.

bpymesh

dded BPyMesh for mesh python mesh functions.

 at the moment it only has meshWeight2Dict and dict2MeshWeight
   These allow you to deal with vertex weights as a list of dicts which makes scrips short and easy to understand.
    (kh_python, perhaps dict access to the python verts could replace this )
 
 Used the above util functions to update mesh_cleanup.
 Copied from the source
 
 	'Material Clean', 'Remove unused materials.'
 	'VGroups'
 	'Group Clean', 'Remove vertex groups that have no verts using them.'
 	'Weight Clean', 'Remove zero weighted verts from groups (limit is zero threshold).'
 	'Weight Normalize', 'Make the sum total of vertex weights accross vgroups 1.0 for each vertex.'
 
 Normalizing lets you see how much % of the vertex a bone owns just by looking at 1 of the bone weights.
 
 Would be nice to have this functionality in Blender but theres not much room for new buttons in teh vgroup and material area :/

python API Groups

 Added Group to Blender.Types, tested and working.
 Added Group Epydocs, with 2 examples.
 also added http://en.wikibooks.org/wiki/Blender_3D:_Blending_Into_Python
   to the blender links main page.
 


python api

 Replaced constant_getAttr() with constant_getAttro(), and added extra
 code so that the .keys(), .items() and .values() methods worked.

Python API

 New Ipo and IpoCurve API.  Ipo and IpoCurve objects support the [] operator,
 for accessing the curves of a particular Ipo and for accessing the value
 of an IpoCurve at a specific time.  Both modules were also "tp_getset"-ified.
 Also, code for an alternative method (Antont wanted this) of accessing curves
 via Ipo attributes is included for now, for people to try and see if it's
 actually preferable to the Ipo [] operator.
 
 These are all new additions; nothing was intentionally removed from the API.
 If you find the something in the existing API has changed, let me know.


Python API

 Initial commit for new Modifier API.  Probably does about 70-75% of what it
 should, but it's a start.

modifer sequencer python

 Log:
 added remove to the modifier seq (when pymodifier->md is NULL then its been removed)
 added name to the docs
 

Python API

 More Modifier API changes:
  * add Blender.Modifier.Settings dict with constants for modifier types
  * add mod.type attribute, which returns type of the Modifier
  * add some internal consistency checks in ModSeq_remove

python modifiers

 Re arranged how modifiers are used.
 All settings through Blender.Modifier.Settings
 see the epydocs
 Also added some error checking to fix some possible segfaults.
 Added more epydocs
 
 Modifiers API should be stable enough to use now, though give it a bit of time for testing.

Mathutils

Added scalePart to mathutils matrix type object.

 and made it so toEuler converts a 4x4 matrix to a 3x3 rather then raising an error.
 
 Its not straight fwd to get an objects worldspace loc/size/rot from its 4x4 matrix.
 Example from updated docs.
       import Blender
       scn = Blender.Scene.GetCurrent()
       ob = scn.getActiveObject()
       if ob:
         mat= ob.mat # Same as martixWorld
         print 'Location", mat.translationPart() # 3D Vector
         print 'Size", mat.scalePart() # 3D Vector
         print 'Rotation", mat.toEuler() # Euler object

Python API

 Added render.getRenderWinSize() method, to complement render.setRenderWinSize()

pydrivers

Pydrivers: Ipo Drivers controlled by Python expressions

 wiki with info: http://mediawiki.blender.org/index.php/BlenderDev/PyDrivers
 
 (there are two sample .blends in the patch tracker entry, last link in
 the wiki page)
 
 Notes:
 
 In usiblender.c I just made Python exit before the main library gets
 freed. I found a situation with pydrivers where py's gc tried to del
 objects on exit and their ID's were not valid anymore (so sigsegv).
 
 Ton needs to check the depsgraph part.
 
 For now pydrivers can reference their own object, something normal
 ipodrivers can't. This seems to work fine and is quite useful, but if
 tests prove the restriction is necessary, we just need to uncomment a
 piece of code in EXPP_interface.c, marked with "XXX".
 
 Thanks Ton for the ipodrivers code and adding the hooks for the py part
 and Martin for the "Button Python Evaluation" patch from which I started
 this one.
 
 Anyone interested, please check the wiki, the .blends (they have
 README's) and tell me about any issue.
 Small update for pydrivers: force reloading the pydrivers.py Blender
 text module when user edits the input text box of any pydriver
 (Transform Properties panel, Ipo window).
 
 It's enough to click in and out of a single pydriver's text input box
 for the module reloading and also re-evaluation of all pydrivers
 available. Maybe this "refreshing" should also be available from a
 menu, let's see.
 
 Note for Python fans:
 
 Definitions and redefinitions in a reloaded module are properly handled
 in Python, but previously defined data in the module doesn't disappear.
 So if you define a function "f" inside a module, import it, then change
 the function's name to "g" and reload the module, both "f" and "g" will
 be available. This is considered a feature, check reload's documentation:
 http://docs.python.org/lib/built-in-funcs.html#l2h-59

Python API

 Added activeGroup attribute to Mesh API, to get/set active vertex group for
 meshes.

python api

 added optional 'worldspace' arg to getLocation/getSize/getEuler
 getSize is never flipped, but added a note in the docs.
 correction to getEuler, its not wrapped.
 
 also removed all // comments to shut GCC up.

python

 Added "VertexPaint" slot for python menus


Python API

 New Constraint API.  Constraints are accessible through a "constraints"
 attribute in poses and objects.  Would be REALLY NICE for armature users to
 pound on this code.

mesh python api

 Added some shortcuts to Mesh
  MFace.area
  MFace.cent
  MEdge.length
 
 Updated some scripts that used these.


Mesh API

 Log:
 Added MVert.hide property because hidden verts were hanging BPyMesh_Redux
==Python API==
 Added NULL constraint (and fixed bug that didn't allow appending FLOOR
 constraint), and added support for Constraint.Settings.LOCAL key support in
 COPYLOC, COPYROT and COPYSIZE constraints when target object is an armature.

Python API

 * use CONSTRAINT_LOCAL instead of SELECT in "Copy Rotate" constraint
 * remove "LOCAL" key for now from "Copy Size" constraint; not supported
   right now in Blender UI

Python API

 Make me.faces.sel and me.edges.sel behave like EM_select_face() and
 EM_select_edge() in source/blender/src/editmesh_lib.c.
 
 Script users should note that if they change ANY of the selection states
 (vertex, edge, face) and then call a mesh "tool" method (like me.remDoubles)
 that the selection states of the mesh MAY change, since these tools use the
 edit mode (which updates select states).

pose api

 *applying patch
 [ #4143 ] Methods for reading bone movement limits
 Aron Cristian (criller)
 
 Gives the ability to return/set the limitations on a posebone when that bone is part of an IK chain.