Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- import os
- import c4d
- from c4d import gui, plugins, bitmaps, utils, documents
- __currdir__ = os.path.dirname(__file__)
- if __currdir__ not in sys.path:
- sys.path.insert(0, __currdir__)
- from export_nx3 import *
- PLUGIN_ID = 1011310 # Test ID
- ####################################### Notice #################################################################
- TABVAN = 10001 #TAB constant
- MY_PARENTLINK = 11001
- MY_EXPORT_BUTTON = 11002
- MY_INPUTFILE = 13001
- ##########################################################
- class MyDialog(gui.GeDialog):
- def CreateLayout(self):
- self.TabGroupBegin(id=TABVAN, flags=c4d.BFH_LEFT, tabtype=c4d.TAB_TABS)
- # Select TAB ===================
- self.GroupBegin(id=1000, flags=c4d.BFH_FIT, cols=0, rows=4, title="Rappelz 3D Exporter")
- self.GroupBegin(id=1011, flags=c4d.BFH_FIT, cols=2)
- self.element = self.AddStaticText(id=1003, flags=c4d.BFH_LEFT, initw=200, name="Rappelz 3D Exporter")
- self.GroupEnd()
- self.GroupBegin(id=1012, flags=c4d.BFH_FIT, cols=1, rows=4)
- self.AddSeparatorV(600, flags=c4d.BFH_SCALE)
- self.GroupEnd()
- self.GroupBegin(id=1013, flags=c4d.BFH_SCALEFIT, cols=5, rows=4)
- self.AddButton(MY_EXPORT_BUTTON, c4d.BFV_MASK, initw=100, name="Export")
- self.GroupEnd()
- self.GroupEnd()
- #Importer TAB ==========================
- self.GroupBegin(id=1017, flags=c4d.BFH_MASK, cols=1, rows=4, title="Rappelz 3D importer")
- self.element = self.AddStaticText(id=1051, flags=c4d.BFH_MASK, initw=150, name="Select Rappelz 3D model", borderstyle=c4d.BORDER_NONE)
- self.file = self.AddCustomGui(MY_INPUTFILE, c4d.CUSTOMGUI_FILENAME, "", c4d.BFH_SCALEFIT|c4d.BFV_SCALEFIT, 0, 0)
- self.GroupEnd()
- #About TAB ==========================
- self.GroupBegin(id=1031, flags=c4d.BFH_SCALEFIT, cols=1, rows=4, title="About")
- self.element = self.AddStaticText(id=1041, flags=c4d.BFH_LEFT, initw=500, name="A big thanks to glandu2 for all the research", borderstyle=c4d.BORDER_NONE)
- self.element = self.AddStaticText(id=1042, flags=c4d.BFH_LEFT, initw=500, name="and his wonderful blender plugin !", borderstyle=c4d.BORDER_NONE)
- self.element = self.AddStaticText(id=1043, flags=c4d.BFH_LEFT, initw=600, name="For more info look at: https://github.com/ldxngx/BTRFdom !", borderstyle=c4d.BORDER_NONE)
- self.element = self.AddStaticText(id=1045, flags=c4d.BFH_LEFT, initw=500, name="", borderstyle=c4d.BORDER_NONE)
- self.element = self.AddStaticText(id=1046, flags=c4d.BFH_LEFT, initw=500, name="Coded for c4d by gr4ph0s", borderstyle=c4d.BORDER_NONE)
- self.element = self.AddStaticText(id=1046, flags=c4d.BFH_LEFT, initw=500, name="More info at: http://gr4ph0s.free.fr", borderstyle=c4d.BORDER_NONE)
- self.GroupEnd()
- #self.GroupEnd() #end About tab group
- return True
- def InitValues(self):
- return True
- def Command(self, id, msg):
- if (id == MY_EXPORT_BUTTON):
- s = export_nx3()
- print dir(s)
- print s.name
- return True
- if (id == MY_INPUTFILE):
- filename = self.GetString(MY_INPUTFILE)
- gui.MessageDialog ("Selected file: " + filename)
- return True
- # all other ID's
- return True
- #################################################################################################
- class MyRappelzPlugin(plugins.CommandData):
- dialog = None
- def Execute(self, doc):
- # create the dialog
- if self.dialog is None:
- self.dialog = MyDialog()
- return self.dialog.Open(dlgtype=c4d.DLG_TYPE_ASYNC, pluginid=PLUGIN_ID, defaultw=200, defaulth=150, xpos=-1, ypos=-1)
- def RestoreLayout(self, sec_ref):
- # manage the dialog
- if self.dialog is None:
- self.dialog = MyDialog()
- return self.dialog.Restore(pluginid=PLUGIN_ID, secret=sec_ref)
- if __name__ == "__main__":
- path, fn = os.path.split(__file__)
- bmp = bitmaps.BaseBitmap()
- bmp.InitWith(os.path.join(path, "res/icons/", "icon.tif"))
- okyn = plugins.RegisterCommandPlugin(PLUGIN_ID, "Rappelz",0, bmp, "Rappelz", MyRappelzPlugin())
- if (okyn):
- print "Rappelz plugin V0.1 initialized. @Gr4ph0s 2014"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement