From 687bb7f35f36e9aca91224d2047bc384fb049fb1 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Fri, 6 Dec 2019 01:31:16 -0500 Subject: [PATCH] Use prefixes for enum names instead of suffixes in helper script. --- helper.py | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/helper.py b/helper.py index 15d2f62d..cdde373f 100755 --- a/helper.py +++ b/helper.py @@ -354,9 +354,9 @@ struct {identifier} : Module {{""" enum ParamIds {""" for c in components['params']: source += f""" - {c['name']}_PARAM,""" + PARAM_{c['name']},""" source += """ - NUM_PARAMS + PARAMS_LEN };""" # Inputs @@ -364,9 +364,9 @@ struct {identifier} : Module {{""" enum InputIds {""" for c in components['inputs']: source += f""" - {c['name']}_INPUT,""" + INPUT_{c['name']},""" source += """ - NUM_INPUTS + INPUTS_LEN };""" # Outputs @@ -374,9 +374,9 @@ struct {identifier} : Module {{""" enum OutputIds {""" for c in components['outputs']: source += f""" - {c['name']}_OUTPUT,""" + OUTPUT_{c['name']},""" source += """ - NUM_OUTPUTS + OUTPUTS_LEN };""" # Lights @@ -384,28 +384,28 @@ struct {identifier} : Module {{""" enum LightIds {""" for c in components['lights']: source += f""" - {c['name']}_LIGHT,""" + LIGHT_{c['name']},""" source += """ - NUM_LIGHTS + LIGHTS_LEN };""" source += f""" {identifier}() {{ - config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS);""" + config(PARAMS_LEN, INPUTS_LEN, OUTPUTS_LEN, LIGHTS_LEN);""" for c in components['params']: source += f""" - configParam({c['name']}_PARAM, 0.f, 1.f, 0.f, "");""" + configParam(PARAM_{c['name']}, 0.f, 1.f, 0.f, "");""" for c in components['inputs']: source += f""" - configInput({c['name']}_INPUT, "");""" + configInput(INPUT_{c['name']}, "");""" for c in components['outputs']: source += f""" - configOutput({c['name']}_OUTPUT, "");""" + configOutput(OUTPUT_{c['name']}, "");""" source += """ } @@ -434,10 +434,10 @@ struct {identifier}Widget : ModuleWidget {{ for c in components['params']: if 'x' in c: source += f""" - addParam(createParam(mm2px(Vec({c['x']}, {c['y']})), module, {identifier}::{c['name']}_PARAM));""" + addParam(createParam(mm2px(Vec({c['x']}, {c['y']})), module, {identifier}::PARAM_{c['name']}));""" else: source += f""" - addParam(createParamCentered(mm2px(Vec({c['cx']}, {c['cy']})), module, {identifier}::{c['name']}_PARAM));""" + addParam(createParamCentered(mm2px(Vec({c['cx']}, {c['cy']})), module, {identifier}::PARAM_{c['name']}));""" # Inputs if len(components['inputs']) > 0: @@ -445,10 +445,10 @@ struct {identifier}Widget : ModuleWidget {{ for c in components['inputs']: if 'x' in c: source += f""" - addInput(createInput(mm2px(Vec({c['x']}, {c['y']})), module, {identifier}::{c['name']}_INPUT));""" + addInput(createInput(mm2px(Vec({c['x']}, {c['y']})), module, {identifier}::INPUT_{c['name']}));""" else: source += f""" - addInput(createInputCentered(mm2px(Vec({c['cx']}, {c['cy']})), module, {identifier}::{c['name']}_INPUT));""" + addInput(createInputCentered(mm2px(Vec({c['cx']}, {c['cy']})), module, {identifier}::INPUT_{c['name']}));""" # Outputs if len(components['outputs']) > 0: @@ -456,10 +456,10 @@ struct {identifier}Widget : ModuleWidget {{ for c in components['outputs']: if 'x' in c: source += f""" - addOutput(createOutput(mm2px(Vec({c['x']}, {c['y']})), module, {identifier}::{c['name']}_OUTPUT));""" + addOutput(createOutput(mm2px(Vec({c['x']}, {c['y']})), module, {identifier}::OUTPUT_{c['name']}));""" else: source += f""" - addOutput(createOutputCentered(mm2px(Vec({c['cx']}, {c['cy']})), module, {identifier}::{c['name']}_OUTPUT));""" + addOutput(createOutputCentered(mm2px(Vec({c['cx']}, {c['cy']})), module, {identifier}::OUTPUT_{c['name']}));""" # Lights if len(components['lights']) > 0: @@ -467,10 +467,10 @@ struct {identifier}Widget : ModuleWidget {{ for c in components['lights']: if 'x' in c: source += f""" - addChild(createLight>(mm2px(Vec({c['x']}, {c['y']})), module, {identifier}::{c['name']}_LIGHT));""" + addChild(createLight>(mm2px(Vec({c['x']}, {c['y']})), module, {identifier}::LIGHT_{c['name']}));""" else: source += f""" - addChild(createLightCentered>(mm2px(Vec({c['cx']}, {c['cy']})), module, {identifier}::{c['name']}_LIGHT));""" + addChild(createLightCentered>(mm2px(Vec({c['cx']}, {c['cy']})), module, {identifier}::LIGHT_{c['name']}));""" # Widgets if len(components['widgets']) > 0: