Created
September 22, 2015 20:02
-
-
Save bonsak/00a4835bf36513ca58a3 to your computer and use it in GitHub Desktop.
c4d-reset-object-axis
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import c4d | |
| # Slightly modified version of Lennart's (tca studios) script from this thread: | |
| # http://www.plugincafe.com/forum/forum_posts.asp?TID=6600&KW=&PID=27379#27379 | |
| def main(): | |
| if op is None: return False | |
| oldm = op.GetMg() | |
| points = op.GetAllPoints() | |
| pcount = op.GetPointCount() | |
| doc.StartUndo() | |
| doc.AddUndo(c4d.UNDOTYPE_CHANGE, op) | |
| op.SetAbsPos(c4d.Vector(0,0,0)) #Comment out this to keep original position | |
| op.SetAbsRot(c4d.Vector(0,0,0)) #Comment out this to keep original rotation | |
| op.SetAbsScale(c4d.Vector(1,1,1)) #Comment out this to keep original scale | |
| op.Message(c4d.MSG_UPDATE) | |
| newm = op.GetMg() | |
| for p in xrange(pcount): | |
| op.SetPoint(p,~newm*oldm*points[p]) | |
| op.Message(c4d.MSG_UPDATE) | |
| c4d.EventAdd() | |
| doc.EndUndo() | |
| if __name__=='__main__': | |
| main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Reset PSR just moves the object to original axis as parent or global zero of the scene, not its axis :( Your script or something like it only resets the axis of this objects, so yeah