Skip to content

Commit

Permalink
Limit fragment outputs to 8
Browse files Browse the repository at this point in the history
  • Loading branch information
pragma37 committed Feb 27, 2023
1 parent ff407cb commit b74cedb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
11 changes: 8 additions & 3 deletions BlenderMalt/MaltNodes/Nodes/MaltIONode.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,7 @@ def get_source_global_parameters(self, transpiler):
src = MaltNode.get_source_global_parameters(self, transpiler)
custom_outputs = ''
graph_io = self.id_data.get_pipeline_graph().graph_io[self.io_type]
try: index = graph_io.custom_output_start_index
except: index = 0
index = graph_io.custom_output_start_index
for key, parameter in self.get_custom_parameters().items():
if parameter.is_output:
socket = self.inputs[key]
Expand Down Expand Up @@ -197,7 +196,13 @@ def add_custom_socket():
while f'{name} {i}' in parameters.keys():
i += 1
new_param.name = f'{name} {i}'
col.operator("wm.malt_callback", text='', icon='ADD').callback.set(add_custom_socket, 'Add')
add_row = col.row()
graph = self.id_data.get_pipeline_graph()
if (self.is_output and graph.language == 'GLSL' and
len(parameters) >= (8 - graph.graph_io[self.io_type].custom_output_start_index) and
self.id_data.graph_type.endswith("(Group)") == False):
add_row.enabled = False
add_row.operator("wm.malt_callback", text='', icon='ADD').callback.set(add_custom_socket, 'Add')
def remove_custom_socket():
parameters.remove(index)
col.operator("wm.malt_callback", text='', icon='REMOVE').callback.set(remove_custom_socket, 'Remove')
Expand Down
1 change: 1 addition & 0 deletions Malt/PipelineGraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ def __init__(self, name, dynamic_input_types = [], dynamic_output_types = [],
self.default_dynamic_inputs = default_dynamic_inputs
self.default_dynamic_outputs = default_dynamic_outputs
self.function = function
self.custom_output_start_index = 0

class PipelineGraph():

Expand Down

0 comments on commit b74cedb

Please sign in to comment.