-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathnodeChangeColor.py
More file actions
44 lines (28 loc) · 1.18 KB
/
nodeChangeColor.py
File metadata and controls
44 lines (28 loc) · 1.18 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
#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 27/07/2019.
import os
from NatronGui import *
from PySide.QtGui import *
# SETS NODE COLOR FOR SELECTED NODES #
def nodeChangeColor():
# get current Natron instance running in memory #
app = natron.getGuiInstance(0)
# create modal dialog #
dialog = app.createModalDialog()
# set dialog title #
dialog.setWindowTitle("Change node color")
# set dialog margins #
dialog.setContentsMargins(0, 0, 10, 10)
# create Color picker box #
myColor = dialog.createColorParam("myColor","Color : ", 0)
myColor.set(1,1,1,0)
dialog.refreshUserParamsGUI()
if dialog.exec_():
newColor = dialog.getParam("myColor").get()
selectedNodes = app.getSelectedNodes()
for currentNode in selectedNodes:
curentNodeLabel = currentNode.getLabel()
currentNode.setColor(newColor[0],newColor[1],newColor[2])
os.write( 1, '\n' + str(curentNodeLabel) + ' color changed to [r: ' + str(newColor[0]) + ' , g: ' + str(newColor[1]) + ' , b: ' + str(newColor[2]) +']\n' )