def SetGlobalRotation(obj, rot):  # Set object's global rotation
    m = obj.GetMg()
    pos = m.off
    scale = c4d.Vector(m.v1.GetLength(), m.v2.GetLength(), m.v3.GetLength())
    m = u.HPBToMatrix(rot)
    m.off = pos
    m.v1 = m.v1.GetNormalized() * scale.x
    m.v2 = m.v2.GetNormalized() * scale.y
    m.v3 = m.v3.GetNormalized() * scale.z
    obj.SetMg(m)
    b = map(float,row)
    GHROTS.append(b)

data.close()


anglelist = []
for angle in GHROTS:
#---------STORE ANGLES IN A LIST ----------------------    
    H = angle[0] #x items
    P = angle[1] #y items
    B = angle[2] #z items
    
    hpb = c4d.Vector(P,B,-H) #REMEMBER TO NEGATE THE ANGLES POTENTIALLY FROM GH
  
    anglelist.append(hpb)
    
obj = doc.SearchObject("baked clones 3")
child = obj.GetChildren()


for c,d in zip(child,anglelist):
    m = c.GetMg() #GET MATRIX 
    
    pos = m.off #GET POSITION DATA
      
    m = utils.HPBToMatrix(d) #SET A NEW MATRIX WITH GH ANGLES
  
    m.off = pos
 
    c.SetMg(m) #SET THE ANGLE MATRIX TO THE CURRENT MARTIX