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() |
Blast from the past :) Isn't this the same as the Reset PSR command now? Correct me if i'm wrong. Can't really remember what i used this for. :) And now that plugincafe is dead, i can't read the thread i'm linking to in the code.
So whats your usecase?
Isn't this the same as the Reset PSR command now? Correct me if i'm wrong
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, I realise it's been a while but I would like to ask for little help with this script. It does not consider that there are vertex normals tag, and when the rotation of the object is reset to zero the normals vectors remain linked to the original HPBs rotation, is there any way to improve the script and what is needed to keep the positions of the vertex normals unchanged or inherit the new rotation position? Thanks