ui: Added dynamic labels to map/filter
parent
82e8e3f348
commit
fc0d7afa4d
|
@ -184,6 +184,43 @@ class MapMathNode(base.MaxwellSimNode):
|
||||||
(*item, '', i) if item is not None else None for i, item in enumerate(items)
|
(*item, '', i) if item is not None else None for i, item in enumerate(items)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
####################
|
||||||
|
# - UI
|
||||||
|
####################
|
||||||
|
def draw_label(self):
|
||||||
|
labels = {
|
||||||
|
'REAL': 'ℝ(v)',
|
||||||
|
'IMAG': 'Im(v)',
|
||||||
|
'ABS': '|v|',
|
||||||
|
'SQ': 'v²',
|
||||||
|
'SQRT': '√v',
|
||||||
|
'INV_SQRT': '1/√v',
|
||||||
|
'COS': 'cos v',
|
||||||
|
'SIN': 'sin v',
|
||||||
|
'TAN': 'tan v',
|
||||||
|
'ACOS': 'acos v',
|
||||||
|
'ASIN': 'asin v',
|
||||||
|
'ATAN': 'atan v',
|
||||||
|
'NORM_2': '||v||₂',
|
||||||
|
'DET': 'det V',
|
||||||
|
'COND': 'κ(V)',
|
||||||
|
'NORM_FRO': '||V||_F',
|
||||||
|
'RANK': 'rank V',
|
||||||
|
'DIAG': 'diag V',
|
||||||
|
'EIG_VALS': 'eigvals V',
|
||||||
|
'SVD_VALS': 'svdvals V',
|
||||||
|
'INV': 'V⁻¹',
|
||||||
|
'TRA': 'Vt',
|
||||||
|
'QR': 'qr V',
|
||||||
|
'CHOL': 'chol V',
|
||||||
|
'SVD': 'svd V',
|
||||||
|
}
|
||||||
|
|
||||||
|
if (label := labels.get(self.operation)) is not None:
|
||||||
|
return 'Map: ' + label
|
||||||
|
|
||||||
|
return self.bl_label
|
||||||
|
|
||||||
def draw_props(self, _: bpy.types.Context, layout: bpy.types.UILayout) -> None:
|
def draw_props(self, _: bpy.types.Context, layout: bpy.types.UILayout) -> None:
|
||||||
layout.prop(self, self.blfields['operation'], text='')
|
layout.prop(self, self.blfields['operation'], text='')
|
||||||
|
|
||||||
|
|
|
@ -190,7 +190,7 @@ class OperateMathNode(base.MaxwellSimNode):
|
||||||
('ADD', 'L + R', 'Add'),
|
('ADD', 'L + R', 'Add'),
|
||||||
('SUB', 'L - R', 'Subtract'),
|
('SUB', 'L - R', 'Subtract'),
|
||||||
('MUL', 'L · R', 'Multiply'),
|
('MUL', 'L · R', 'Multiply'),
|
||||||
('DIV', 'L ÷ R', 'Divide'),
|
('DIV', 'L / R', 'Divide'),
|
||||||
('POW', 'L^R', 'Power'),
|
('POW', 'L^R', 'Power'),
|
||||||
('ATAN2', 'atan2(L,R)', 'atan2(L,R)'),
|
('ATAN2', 'atan2(L,R)', 'atan2(L,R)'),
|
||||||
]
|
]
|
||||||
|
@ -221,6 +221,24 @@ class OperateMathNode(base.MaxwellSimNode):
|
||||||
(*item, '', i) if item is not None else None for i, item in enumerate(items)
|
(*item, '', i) if item is not None else None for i, item in enumerate(items)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
####################
|
||||||
|
# - UI
|
||||||
|
####################
|
||||||
|
def draw_label(self):
|
||||||
|
labels = {
|
||||||
|
'ADD': lambda: 'Filter: L + R',
|
||||||
|
'SUB': lambda: 'Filter: L - R',
|
||||||
|
'MUL': lambda: 'Filter: L · R',
|
||||||
|
'DIV': lambda: 'Filter: L / R',
|
||||||
|
'POW': lambda: 'Filter: L^R',
|
||||||
|
'ATAN2': lambda: 'Filter: atan2(L,R)',
|
||||||
|
}
|
||||||
|
|
||||||
|
if (label := labels.get(self.operation)) is not None:
|
||||||
|
return label()
|
||||||
|
|
||||||
|
return self.bl_label
|
||||||
|
|
||||||
def draw_props(self, _: bpy.types.Context, layout: bpy.types.UILayout) -> None:
|
def draw_props(self, _: bpy.types.Context, layout: bpy.types.UILayout) -> None:
|
||||||
layout.prop(self, self.blfields['category'], text='')
|
layout.prop(self, self.blfields['category'], text='')
|
||||||
layout.prop(self, self.blfields['operation'], text='')
|
layout.prop(self, self.blfields['operation'], text='')
|
||||||
|
@ -384,8 +402,6 @@ class OperateMathNode(base.MaxwellSimNode):
|
||||||
has_data_r_info = not ct.FlowSignal.check(data_r_info)
|
has_data_r_info = not ct.FlowSignal.check(data_r_info)
|
||||||
has_data_r_params = not ct.FlowSignal.check(data_r_params)
|
has_data_r_params = not ct.FlowSignal.check(data_r_params)
|
||||||
|
|
||||||
#log.critical((props, input_sockets))
|
|
||||||
|
|
||||||
# Compose by Socket Set
|
# Compose by Socket Set
|
||||||
## Data | Data
|
## Data | Data
|
||||||
if (
|
if (
|
||||||
|
|
Loading…
Reference in New Issue