2020-03-04 17:45:19 +01:00
|
|
|
import bpy
|
2020-09-08 23:21:41 +02:00
|
|
|
|
2020-03-04 17:45:19 +01:00
|
|
|
from arm.logicnode.arm_nodes import *
|
|
|
|
|
2020-09-08 23:21:41 +02:00
|
|
|
|
2020-03-04 17:45:19 +01:00
|
|
|
def update_node(self, context):
|
|
|
|
#Clean all nodes
|
|
|
|
|
|
|
|
while len(self.inputs) > 1:
|
|
|
|
self.inputs.remove(self.inputs[-1])
|
|
|
|
|
|
|
|
if (self.property0 == 'Uniform'):
|
|
|
|
self.draw_nodes_uniform(context)
|
|
|
|
elif (self.property0 == 'RGB'):
|
|
|
|
self.draw_nodes_rgb(context)
|
|
|
|
else:
|
|
|
|
self.draw_nodes_colorwheel(context)
|
|
|
|
|
|
|
|
def set_data(self, context):
|
|
|
|
|
|
|
|
abspath = bpy.path.abspath(self.filepath)
|
|
|
|
abspath = abspath.replace("\\","\\\\")
|
|
|
|
with open(abspath, 'r') as myfile:
|
|
|
|
data = myfile.read().replace('\n', '').replace('"','')
|
|
|
|
self.property1 = data
|
|
|
|
|
2020-09-08 21:16:20 +02:00
|
|
|
class ColorgradingSetGlobalNode(ArmLogicTreeNode):
|
2020-09-23 22:12:25 +02:00
|
|
|
"""TO DO."""
|
2020-03-04 17:45:19 +01:00
|
|
|
bl_idname = 'LNColorgradingSetGlobalNode'
|
|
|
|
bl_label = 'Colorgrading Set Global'
|
2020-10-27 19:44:37 +01:00
|
|
|
arm_section = 'colorgrading'
|
2020-09-13 11:27:58 +02:00
|
|
|
arm_version = 1
|
2020-03-04 17:45:19 +01:00
|
|
|
|
|
|
|
# TODO: RRESET FILE OPTION FOR THE BELOW
|
|
|
|
property0 : EnumProperty(
|
|
|
|
items = [('RGB', 'RGB', 'RGB'),
|
|
|
|
('Uniform', 'Uniform', 'Uniform')],
|
|
|
|
name='Mode', default='Uniform', update=update_node)
|
|
|
|
property1 : StringProperty(name="Loaded Data", description="Loaded data - Just ignore", default="")
|
|
|
|
filepath : StringProperty(name="Preset File", description="Postprocess colorgrading preset file", default="", subtype="FILE_PATH", update=set_data)
|
2020-09-08 17:03:24 +02:00
|
|
|
|
2020-03-04 17:45:19 +01:00
|
|
|
|
|
|
|
def draw_nodes_uniform(self, context):
|
2020-09-08 21:49:02 +02:00
|
|
|
self.add_input('NodeSocketFloat', 'Whitebalance', default_value=6500.0)
|
|
|
|
self.add_input('NodeSocketColor', 'Tint', default_value=[1.0, 1.0, 1.0, 1.0])
|
|
|
|
self.add_input('NodeSocketFloat', 'Saturation', default_value=1)
|
|
|
|
self.add_input('NodeSocketFloat', 'Contrast', default_value=1)
|
|
|
|
self.add_input('NodeSocketFloat', 'Gamma', default_value=1)
|
|
|
|
self.add_input('NodeSocketFloat', 'Gain', default_value=1)
|
|
|
|
self.add_input('NodeSocketFloat', 'Offset', default_value=1)
|
2020-03-04 17:45:19 +01:00
|
|
|
|
|
|
|
def draw_nodes_rgb(self, context):
|
2020-09-08 21:49:02 +02:00
|
|
|
self.add_input('NodeSocketFloat', 'Whitebalance', default_value=6500.0)
|
|
|
|
self.add_input('NodeSocketVector', 'Tint', default_value=[1,1,1])
|
|
|
|
self.add_input('NodeSocketVector', 'Saturation', default_value=[1,1,1])
|
|
|
|
self.add_input('NodeSocketVector', 'Contrast', default_value=[1,1,1])
|
|
|
|
self.add_input('NodeSocketVector', 'Gamma', default_value=[1,1,1])
|
|
|
|
self.add_input('NodeSocketVector', 'Gain', default_value=[1,1,1])
|
|
|
|
self.add_input('NodeSocketVector', 'Offset', default_value=[1,1,1])
|
2020-03-04 17:45:19 +01:00
|
|
|
|
|
|
|
def draw_nodes_colorwheel(self, context):
|
|
|
|
pass
|
|
|
|
|
|
|
|
def init(self, context):
|
2020-09-13 11:27:58 +02:00
|
|
|
super(ColorgradingSetGlobalNode, self).init(context)
|
2020-09-08 21:49:02 +02:00
|
|
|
self.add_input('ArmNodeSocketAction', 'In')
|
|
|
|
self.add_output('ArmNodeSocketAction', 'Out')
|
2020-03-04 17:45:19 +01:00
|
|
|
self.draw_nodes_uniform(context)
|
|
|
|
|
|
|
|
def draw_buttons(self, context, layout):
|
|
|
|
layout.label(text="Select value mode")
|
|
|
|
layout.prop(self, 'property0')
|
|
|
|
if (self.property0 == 'Preset File'):
|
|
|
|
layout.prop(self, 'filepath')
|
|
|
|
layout.prop(self, 'property1')
|