[Bf-committers] blender 2.49 python script to set object rotation - doesn't rotate children

Jeff jmoguill2 at gmail.com
Mon Apr 12 23:19:11 CEST 2010


I think I figured it out:

def GetChildren(obj):
    c = []
    for obj in bpy.data.objects:
        if obj.parent == obj: c.append(obj)
    return c

def Rotate(obj,angle):
    rot = obj.rot
    for j in xrange(0,3): rot[j] += angle[j] * math.pi/180.0
    obj.mat
    for c in GetChildren(obj):
        c.mat

-Jeff

On Mon, Apr 12, 2010 at 1:09 PM, Jeff <jmoguill2 at gmail.com> wrote:

> Hi,
> I want to write a little python function that sets the object's rotation
> (not using the game engine), in blender 2.49.
>
> def rotate(obj,angle):
>      rot = obj.rot
>      for j in xrange(0,3): rot[j] +=angle[j]*math.pi/180.0
>      pObj.rot = rot
>
> When I try running it, it rotates the object, but doesn't move the children
> of the object.  Could someone please show me the correct way to rotate the
> object and update the children as well.
>
> Thanks,
> Jeff
>


More information about the Bf-committers mailing list