-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathplugin-command.sublime-snippet
More file actions
82 lines (58 loc) · 2.16 KB
/
Copy pathplugin-command.sublime-snippet
File metadata and controls
82 lines (58 loc) · 2.16 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<snippet>
<content><![CDATA[
"""
Plugin name : $1
Copyright:
Written for CINEMA 4D Rxx.xxx
Modified Date:
"""
import c4d
from c4d import gui, plugins, utils, bitmaps, storage
import collections, os
# be sure to use a unique ID obtained from www.plugincafe.com
# 1000001-1000010
PLUGIN_ID = 1000001
class $2(gui.GeDialog):
"""docstring for $2"""
def __init__(self):
#self.AddGadget(c4d.DIALOG_NOMENUBAR, 0)#disable menubar
pass
def CreateLayout(self):
#MY_DIALOG corresponds to a MY_DIALOG.res file in the res/dialogs directory
return self.LoadDialogResource(MY_DIALOG)
def InitValues(self):
return True
def Command(self, id, msg):
return True
def Message(self, msg, result):
return c4d.gui.GeDialog.Message(self, msg, result)
class $1(c4d.plugins.CommandData):
"""docstring for $1"""
dialog = None
def Execute(self, doc):
"""Just create the dialog when the user clicked on the entry
in the plugins menu to open it."""
if self.dialog is None:
self.dialog = $2()
return self.dialog.Open(dlgtype=c4d.DLG_TYPE_ASYNC, pluginid=PLUGIN_ID, defaulth=400, defaultw=400)
def RestoreLayout(self, sec_ref):
"""Same for this method. Just allocate it when the dialog
is needed"""
if self.dialog is None:
self.dialog = $2()
return self.dialog.Restore(pluginid=PLUGIN_ID, secret=sec_ref)
if __name__ == "__main__":
bmp = bitmaps.BaseBitmap()
dir, f = os.path.split(__file__)
fn = os.path.join(dir, "res", "icon_Name.tif")
bmp.InitWith(fn)
c4d.plugins.RegisterCommandPlugin(id=PLUGIN_ID, str="plugin_name",
help="show the help message",info=0,
dat=$1(), icon=bmp)
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>cinemaPlugin Command</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.pythonAPI.cinema4D</scope>
<description> Command structure with UI</description>
</snippet>