Getting HPB values from matrix

On 07/07/2016 at 07:23, xxxxxxxx wrote:

Hello.

I frequently need to get the HOB rotation values from a matrix, and I don't like using the workaround of setting a dummy object's matrix with SetMg() then getting the HPB values with GetAbsRot().

Does anyone have the formula handy? Thanks.

On 07/07/2016 at 09:35, xxxxxxxx wrote:

import c4d  
def main() :  
   
  obj = doc.GetActiveObject()  
  if not obj: return  
    
  mg = obj.GetMg()  
  rot = c4d.utils.MatrixToHPB(mg)  
  
  print rot  
    
  c4d.EventAdd()   
  
if __name__=='__main__':  
  main()

-ScottA

On 07/07/2016 at 10:33, xxxxxxxx wrote:

Ah, yes. How embarrassing. Forgot about that..

Thank you, Scott.

On 08/07/2016 at 09:45, xxxxxxxx wrote:

Thanks, Scott, for solving this issue 🙂

Just a link for future readers, here's the docs of utils module, which contains quite a bunch of these little helpers.