Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import c4d
- from c4d import gui
- # Welcome to the world of Python
- # Author: Mike Udin,
- # Tutorial here http://mikeudin.net/?p=2930
- # 2016
- def main():
- objs = doc.GetActiveObjects(1)
- if not objs: return
- tlist = [1018791, 1018544, 1010865, 5142, 1011010, 1019396, 5140]
- menu = c4d.BaseContainer()
- for otype in tlist:
- menu.SetString(c4d.FIRST_POPUP_ID+len(menu), c4d.GetObjectName(otype))
- result = gui.ShowPopupDialog(cd=None, bc=menu, x=c4d.MOUSEPOS, y=c4d.MOUSEPOS)-c4d.FIRST_POPUP_ID
- if result<0:return
- parent = c4d.BaseObject(tlist[result])
- parent.InsertBefore(objs[0])
- parent.SetBit(c4d.BIT_ACTIVE)
- for obj in reversed(objs):
- obj.InsertUnder(parent)
- obj.DelBit(c4d.BIT_ACTIVE)
- c4d.EventAdd()
- if __name__=='__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement