-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathselectSimilarByColor.py
More file actions
45 lines (29 loc) · 1.13 KB
/
selectSimilarByColor.py
File metadata and controls
45 lines (29 loc) · 1.13 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
#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 06/07/2019.
import NatronEngine
from NatronGui import *
# SELECT SIMILAR NODES BY COLOR #
def selectSimilarByColor():
# get current Natron instance running in memory #
app = natron.getGuiInstance(0)
# get selected nodes #
selectedNodes = app.getSelectedNodes()
# cycle through every selected nodes #
for node in selectedNodes:
# get user selected node color #
referenceColor = node.getColor()
if len(selectedNodes) == 1:
# select all nodes #
app.selectAllNodes()
# get selected nodes #
selectedNodes = app.getSelectedNodes()
# deselect all nodes #
app.clearSelection()
# cycle through every selected nodes #
for currentNode in selectedNodes:
# get current node color #
currentColor = currentNode.getColor()
if currentColor[0] == referenceColor[0] and currentColor[1] == referenceColor[1] and currentColor[2] == referenceColor[2]:
app.selectNode(currentNode,False)