diff --git a/include/app/ModuleWidget.hpp b/include/app/ModuleWidget.hpp index ac01720b..bbe0c0f2 100644 --- a/include/app/ModuleWidget.hpp +++ b/include/app/ModuleWidget.hpp @@ -18,6 +18,7 @@ struct ModuleWidget : widget::OpaqueWidget { struct Internal; Internal* internal; + /** Not owned */ plugin::Model* model = NULL; /** Owned */ engine::Module* module = NULL; @@ -28,18 +29,19 @@ struct ModuleWidget : widget::OpaqueWidget { } ~ModuleWidget(); + /** Returns the Model instance of this ModuleWidget. */ plugin::Model* getModel(); void setModel(plugin::Model* model); - /** Returns the attached Module. */ + /** Returns Module attached to this ModuleWidget. */ engine::Module* getModule(); - /** Returns the attached Module, casted to the given Module type. */ + /** Returns Module attached to this ModuleWidget, casted to the given Module type. */ template TModule* getModule() { return dynamic_cast(getModule()); } /** Associates this ModuleWidget with the Module. - Transfers ownership. + Transfers ownership to `this`. */ void setModule(engine::Module* module); diff --git a/include/engine/Module.hpp b/include/engine/Module.hpp index cf7b13a8..23d9b39f 100644 --- a/include/engine/Module.hpp +++ b/include/engine/Module.hpp @@ -30,15 +30,19 @@ struct Module { struct Internal; Internal* internal; + /** Not owned. */ plugin::Model* model = NULL; + /** Unique ID for referring to the module in the engine. - Between 0 and 2^53 since this is serialized with JSON. + Between 0 and 2^53-1 since the number is serialized with JSON. Assigned when added to the engine. */ int64_t id = -1; /** Arrays of components. - Initialized with config(). + Initialized using config(). + + It is recommended to call getParam(), getInput(), etc. instead of accessing these directly. */ std::vector params; std::vector inputs; @@ -46,8 +50,10 @@ struct Module { std::vector lights; /** Arrays of component metadata. - Initialized with configParam(), configInput(), configOutput(), and configLight(). + Initialized using configParam(), configInput(), configOutput(), and configLight(). LightInfos are initialized to null unless configLight() is called. + + It is recommended to call getParamQuantity(), getInputInfo(), etc. instead of accessing these directly. */ std::vector paramQuantities; std::vector inputInfos;