Created
October 28, 2019 07:35
-
-
Save p2or/3ba082b73d935828727750bf683c2b6d to your computer and use it in GitHub Desktop.
Flicker #Natron
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# DO NOT EDIT THIS FILE | |
# This file was automatically generated by Natron PyPlug exporter version 10. | |
# Hand-written code should be added in a separate file named N_FlickerExt.py | |
# See http://natron.readthedocs.org/en/master/devel/groups.html#adding-hand-written-code-callbacks-etc | |
# Note that Viewers are never exported | |
import NatronEngine | |
import sys | |
# Try to import the extensions file where callbacks and hand-written code should be located. | |
try: | |
from N_FlickerExt import * | |
except ImportError: | |
pass | |
def getPluginID(): | |
return "N_Flicker" | |
def getLabel(): | |
return "N_Flicker" | |
def getVersion(): | |
return 1 | |
def getGrouping(): | |
return "" | |
def createInstance(app,group): | |
# Create all nodes in the group | |
# Create the parameters of the group node the same way we did for all internal nodes | |
lastNode = group | |
lastNode.setColor(0.7, 0.7, 0.7) | |
# Create the user parameters | |
lastNode.Controls = lastNode.createPageParam("Controls", "Contols") | |
param = lastNode.createSeparatorParam("Seperator1", "Min-Max") | |
# Add the param to the page | |
lastNode.Controls.addParam(param) | |
# Set param properties | |
param.setHelp("") | |
param.setAddNewLine(True) | |
param.setPersistent(False) | |
param.setEvaluateOnChange(False) | |
lastNode.Seperator1 = param | |
del param | |
param = lastNode.createDoubleParam("Flicker_Min", "Min") | |
param.setMinimum(0, 0) | |
param.setMaximum(1, 0) | |
param.setDisplayMinimum(0, 0) | |
param.setDisplayMaximum(1, 0) | |
param.setDefaultValue(0.9, 0) | |
param.restoreDefaultValue(0) | |
# Add the param to the page | |
lastNode.Controls.addParam(param) | |
# Set param properties | |
param.setHelp("") | |
param.setAddNewLine(True) | |
param.setAnimationEnabled(True) | |
param.setValue(0.887, 0) | |
lastNode.Flicker_Min = param | |
del param | |
param = lastNode.createDoubleParam("Flicker_Max", "Max") | |
param.setMinimum(0, 0) | |
param.setMaximum(1, 0) | |
param.setDisplayMinimum(0, 0) | |
param.setDisplayMaximum(1, 0) | |
param.setDefaultValue(1, 0) | |
param.restoreDefaultValue(0) | |
# Add the param to the page | |
lastNode.Controls.addParam(param) | |
# Set param properties | |
param.setHelp("") | |
param.setAddNewLine(True) | |
param.setAnimationEnabled(True) | |
lastNode.Flicker_Max = param | |
del param | |
param = lastNode.createSeparatorParam("Seperator2", "Mix") | |
# Add the param to the page | |
lastNode.Controls.addParam(param) | |
# Set param properties | |
param.setHelp("") | |
param.setAddNewLine(True) | |
param.setPersistent(False) | |
param.setEvaluateOnChange(False) | |
lastNode.Seperator2 = param | |
del param | |
param = lastNode.createDoubleParam("Flicker_Mix", "Mix") | |
param.setMinimum(0, 0) | |
param.setMaximum(1, 0) | |
param.setDisplayMinimum(0, 0) | |
param.setDisplayMaximum(1, 0) | |
param.setDefaultValue(1, 0) | |
param.restoreDefaultValue(0) | |
# Add the param to the page | |
lastNode.Controls.addParam(param) | |
# Set param properties | |
param.setHelp("") | |
param.setAddNewLine(True) | |
param.setAnimationEnabled(True) | |
lastNode.Flicker_Mix = param | |
del param | |
param = lastNode.createStringParam("LabelX", "") | |
param.setType(NatronEngine.StringParam.TypeEnum.eStringTypeLabel) | |
# Add the param to the page | |
lastNode.Controls.addParam(param) | |
# Set param properties | |
param.setHelp("") | |
param.setAddNewLine(True) | |
param.setEvaluateOnChange(False) | |
param.setAnimationEnabled(False) | |
lastNode.LabelX = param | |
del param | |
param = lastNode.createStringParam("Label1", "") | |
param.setType(NatronEngine.StringParam.TypeEnum.eStringTypeLabel) | |
param.setDefaultValue("Nivre Flicker v0.1") | |
param.restoreDefaultValue() | |
# Add the param to the page | |
lastNode.Controls.addParam(param) | |
# Set param properties | |
param.setHelp("") | |
param.setAddNewLine(True) | |
param.setEvaluateOnChange(False) | |
param.setAnimationEnabled(False) | |
lastNode.Label1 = param | |
del param | |
# Refresh the GUI with the newly created parameters | |
lastNode.setPagesOrder(['Controls', 'Node', 'Settings']) | |
lastNode.refreshUserParamsGUI() | |
del lastNode | |
# Start of node "Multiply1" | |
lastNode = app.createNode("net.sf.openfx.MultiplyPlugin", 2, group) | |
lastNode.setScriptName("Multiply1") | |
lastNode.setLabel("Multiply1") | |
lastNode.setPosition(1105, 339) | |
lastNode.setSize(104, 31) | |
lastNode.setColor(0.48, 0.66, 1) | |
groupMultiply1 = lastNode | |
param = lastNode.getParam("value") | |
if param is not None: | |
param.setValue(0.9008992741117254, 0) | |
param.setValue(0.9327610643634107, 1) | |
param.setValue(0.9166134519646876, 2) | |
param.setValue(0.9894763878844679, 3) | |
del param | |
param = lastNode.getParam("premult") | |
if param is not None: | |
param.setValue(True) | |
del param | |
param = lastNode.getParam("mix") | |
if param is not None: | |
param.setValue(1, 0) | |
del param | |
del lastNode | |
# End of node "Multiply1" | |
# Start of node "Input1" | |
lastNode = app.createNode("fr.inria.built-in.Input", 1, group) | |
lastNode.setScriptName("Input1") | |
lastNode.setLabel("Multiply1_Source") | |
lastNode.setPosition(1022, 214) | |
lastNode.setSize(104, 52) | |
lastNode.setColor(0.3, 0.5, 0.2) | |
groupInput1 = lastNode | |
del lastNode | |
# End of node "Input1" | |
# Start of node "Input2" | |
lastNode = app.createNode("fr.inria.built-in.Input", 1, group) | |
lastNode.setScriptName("Input2") | |
lastNode.setLabel("Multiply1_Mask") | |
lastNode.setPosition(1193, 225) | |
lastNode.setSize(104, 30) | |
lastNode.setColor(0.3, 0.5, 0.2) | |
groupInput2 = lastNode | |
del lastNode | |
# End of node "Input2" | |
# Start of node "Output1" | |
lastNode = app.createNode("fr.inria.built-in.Output", 1, group) | |
lastNode.setLabel("Output1") | |
lastNode.setPosition(1105, 425) | |
lastNode.setSize(104, 30) | |
lastNode.setColor(0.7, 0.7, 0.7) | |
groupOutput1 = lastNode | |
del lastNode | |
# End of node "Output1" | |
# Now that all nodes are created we can connect them together, restore expressions | |
groupMultiply1.connectInput(0, groupInput1) | |
groupMultiply1.connectInput(1, groupInput2) | |
groupOutput1.connectInput(0, groupMultiply1) | |
param = groupMultiply1.getParam("value") | |
param.setExpression("thisNode.value.random(thisGroup.Flicker_Min.get(), thisGroup.Flicker_Max.get())", False, 0) | |
param.setExpression("thisNode.value.random(thisGroup.Flicker_Min.get(), thisGroup.Flicker_Max.get())", False, 1) | |
param.setExpression("thisNode.value.random(thisGroup.Flicker_Min.get(), thisGroup.Flicker_Max.get())", False, 2) | |
param.setExpression("thisNode.value.random(thisGroup.Flicker_Min.get(), thisGroup.Flicker_Max.get())", False, 3) | |
del param | |
param = groupMultiply1.getParam("mix") | |
param.setExpression("thisGroup.Flicker_Mix.get()", False, 0) | |
del param | |
try: | |
extModule = sys.modules["N_FlickerExt"] | |
except KeyError: | |
extModule = None | |
if extModule is not None and hasattr(extModule ,"createInstanceExt") and hasattr(extModule.createInstanceExt,"__call__"): | |
extModule.createInstanceExt(app,group) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment