-
Notifications
You must be signed in to change notification settings - Fork 24
/
init.py
185 lines (135 loc) · 5.22 KB
/
init.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
#This Source Code Form is subject to the terms of the Mozilla Public
#License, v. 2.0. If a copy of the MPL was not distributed with this
#file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#Created by Fabrice Fernandez on 17/01/2018.
#####################################################################
# #
# IMPORT NATRON MODULES #
# #
#####################################################################
import os
import string
from NatronEngine import*
from os import*
import NatronEngine
#####################################################################
# #
# IMPORT USER PYTHON TOOLS #
# #
#####################################################################
from Python_INIT.listNatronPath.listNatronPath import *
from Python_INIT.listPyPlugs.listPyPlugs import *
from Python_INIT.natronLogo.natronLogo import *
from Python_INIT.setPreferences.setPreferences import *
from Python_INIT.addDeepLayer.addDeepLayer import *
from Python_INIT.addDepthLayer.addDepthLayer import *
from Python_INIT.addMaskLayer.addMaskLayer import *
from Python_INIT.addMotionLayer.addMotionLayer import *
# SET UP DEFAULT PROJECT SETTINGS #
#------------------------------#
# def setProjectSettings(app):
# app.getProjectParam('outputFormat').setValue("HD 1920x1080")
# app.getProjectParam('autoPreviews').setValue(True)
# app.getProjectParam('frameRange').set(1, 25)
# app.getProjectParam('lockRange').setValue(True)
# app.getProjectParam('frameRate').setValue(25)
# app.getProjectParam('gpuRendering').setValue('Enabled')
# DEFINES WHAT HAPPENS AFTER SPECIFIC NODES CREATION #
#-----------------------------------------------#
def Node_Callback(thisNode, app, userEdited):
if thisNode.getPluginID() == "net.sf.openfx.ConstantPlugin" :
thisNode.enablePreview.setValue(1)
thisNode.hideInputs.setValue(1)
if thisNode.getPluginID() == "net.sf.openfx.Solid" :
thisNode.enablePreview.setValue(1)
thisNode.hideInputs.setValue(1)
if thisNode.getPluginID() == "net.sf.openfx.FrameHold":
currentFrame = app.timelineGetTime()
thisNode.firstFrame.setValue(currentFrame)
#elif thisNode.getPluginID() == "net.sf.openfx.MergePlugin" :
#thisNode.bbox.set('b')
if thisNode.getPluginID() == "fr.inria.built-in.Read" :
#thisNode.outputComponents.set('RGBA')
thisNode.hideInputs.setValue(1)
thisNode.outputLayer.set('Color.RGBA')
elif thisNode.getPluginID() == "fr.inria.built-in.Write" :
thisNode.formatType.set('Input Format')
thisNode.frameRange.set('Manual')
elif thisNode.getPluginID() == "net.sf.openfx.CheckerBoardPlugin" :
thisNode.enablePreview.setValue(1)
thisNode.hideInputs.setValue(1)
elif thisNode.getPluginID() == "fr.inria.built-in.Roto" :
thisNode.setColor(0.16,0.56,0.16)
thisNode.enablePreview.setValue(1)
elif thisNode.getPluginID() == "fr.inria.built-in.RotoPaint" :
thisNode.setColor(0.16,0.56,0.16)
thisNode.enablePreview.setValue(1)
def setNodeDefaults(app):
app.afterNodeCreated.set("Node_Callback")
# SETUP CALLBACKS #
#-----------------#
def Project_Callback(app):
addDeepLayer(app)
addDepthLayer(app)
addMaskLayer(app)
addMotionLayer(app)
setNodeDefaults(app)
setProjectSettings(app)
NatronEngine.natron.setOnProjectCreatedCallback("Project_Callback")
NatronEngine.natron.setOnProjectLoadedCallback("Project_Callback")
#-----------------------------------------------------------------#
#################### STARTING CONSOLE MESSAGES ####################
#-----------------------------------------------------------------#
separator = ('------------------------------------------------------------')
print ('\n' + '\n' + separator)
print (separator)
print ('\n')
# natronLogo()
print ('\n' + '\n' + separator)
print (separator)
print ('-------------------- INIT.PY -----------------------')
print (separator)
print (separator)
# loading user preferences #
#--------------------------#
print ('\n')
setPreferences()
print ('\n')
print (separator)
# check Natron's version status, version number, x32 or x64 version #
#-------------------------------------------------------------------#
print ('\n')
NatronStatus = natron.getNatronDevelopmentStatus()
NatronVersion = natron.getNatronVersionString()
binary = 'x64'
x32_64 = natron.is64Bit()
if x32_64 == 0 :
binary = 'x32'
# print ('- NATRON ') + 'version ' + NatronVersion + ' ' + str(NatronStatus) + ' (' + binary + ')'
print ('\n')
print (separator)
print ('\n')
CPUs = natron.getNumCpus()
# print ('- ') + str(CPUs) + (' CPUs available on the system')
print ('\n')
print (separator)
print ('\n')
print ('- Deep layer added to the viewer')
print ('- Depth layer added to the viewer')
print ('- Mask layer added to the viewer')
print ('- Motion layer added to the viewer')
print ('\n')
print (separator)
##################################################################
PathMessage = ("- NATRON PLUGINS SEARCH PATH :")
print ('\n' + PathMessage + '\n')
#################### print NATRON search path ####################
listNatronPath()
print ('\n' + separator)
PyPlugMessage = ("- PYPLUG(S) LOADED :")
print (separator)
print ('\n' + PyPlugMessage)
#################### print PYPLUG list ####################
listPyPlugs()
print ('\n' + separator)
print (separator)