-
Notifications
You must be signed in to change notification settings - Fork 0
/
SelectionExporter.py
65 lines (39 loc) · 1.55 KB
/
SelectionExporter.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import c4d
from c4d import gui
#Scipting Malik Kayaalp
def main():
objs = doc.GetActiveObjects(c4d.GETACTIVEOBJECTFLAGS_CHILDREN)
IDM_MENU1 = c4d.FIRST_POPUP_ID
IDM_MENU2 = c4d.FIRST_POPUP_ID+1
menu = c4d.BaseContainer()
menu.InsData(c4d.FORMAT_OBJ2EXPORT, 'OBJ')
menu.InsData(c4d.FORMAT_3DSEXPORT, '3DS')
result = gui.ShowPopupDialog(cd=None, bc=menu,x=c4d.MOUSEPOS, y=c4d.MOUSEPOS)
if result == 0 :
return
if objs == [] or None:
gui.MessageDialog('Bir Obje Seciniz')
if objs == []:
return
docTemp = c4d.documents.IsolateObjects(doc, objs)
if docTemp == None:
return
unitScale = c4d.UnitScaleData()
unitScale.SetUnitScale(1.0, c4d.DOCUMENT_UNIT_CM)
bc = c4d.BaseContainer()
bc[c4d.DOCUMENT_DOCUNIT] = unitScale
docTemp.SetDocumentData(c4d. DOCUMENTSETTINGS_DOCUMENT, bc)
plug = c4d.plugins.FindPlugin(c4d.FORMAT_OBJ2EXPORT, c4d.PLUGINTYPE_SCENESAVER)
if plug is None:
return
filePath = c4d.storage.LoadDialog(title="Save File 3DS", flags=c4d.FILESELECT_SAVE, force_suffix="obj")
if filePath is None:
return
# Finally export the document
if c4d.documents.SaveDocument(docTemp, filePath, c4d.SAVEDOCUMENTFLAGS_EXPORTDIALOG, c4d.FORMAT_OBJ2EXPORT):
gui.MessageDialog('Expot Islemi Tamamdir')
else:
gui.MessageDialog('Export Basarisiz!')
c4d.documents.KillDocument(docTemp)
if __name__=='__main__':
main()