Created
August 11, 2019 15:42
-
-
Save MikeUdin/c7e309b29ffe4d1aecdda6a4c2986dc8 to your computer and use it in GitHub Desktop.
This file contains 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 | |
from c4d import gui | |
# Welcome to the world of Python | |
def axe(objet, matrice, relatif = True) : | |
if relatif : m_obj = objet.GetMl() | |
else : m_obj = objet.GetMg() | |
m = ~matrice * m_obj | |
nbpts = objet.GetPointCount() | |
points = objet.GetAllPoints() | |
for i in xrange(nbpts) : | |
points[i] = m.Mul(points[i]) | |
doc.AddUndo(c4d.UNDOTYPE_CHANGE,objet) | |
objet.SetAllPoints(points) | |
if relatif: | |
objet.SetMl(matrice) | |
else: | |
objet.SetMg(matrice) | |
objet.Message(c4d.MSG_UPDATE) | |
# Main function | |
def OnPick(flags, active, multi): | |
if flags & c4d.PICKSESSION_FLAG_CANCELED: | |
print "User Cancel PickSession" | |
from_obj = active[0] | |
axe(op,from_obj.GetMg(),False) | |
c4d.EventAdd() | |
def main(): | |
if not op or op.GetType() != c4d.Opolygon: | |
gui.MessageDialog('Please select polygon object and try again!') | |
return | |
doc.StartPickSession(OnPick, multi=False) | |
# Execute main() | |
if __name__=='__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment