Skip to content

Updates to ViewWidget registration

Several updates to ViewWidget registration:
1. Fully decouple smtk::view from smtk::extension
2. Reference registered views by type index, not type name
3. Register ViewWidget aliases by type, not by string

(1) helps us enforce encapsulation and adds the possibility for other View backends in the future. Eventually, we may be able to migrate useful bits of smtk::extension::qtBaseView and smtk::extension::ViewInfo into their parent classes (smtk::view::BaseView and smtk::view::Information, respectively).

(2) improves performance by performing integer lookup instead of string lookup. Since ViewWidgets are never written to disk by the application, we are unaffected by potentially inconsistent type_index values across executions of SMTK-enabled applications.

(3) removes the implicit requirement for smtkTypenameMacro() on ViewWidgets. Instead of three degrees of freedom (the ViewWidget's type, its type name and its alias) we now have two degrees of freedom (the ViewWidget's type and its alias), and the ViewWidget's type name is instead generated. A ViewWidget's type name is conditionally added as an alias upon registration if an alias for the type name is not already present.

Edited by T.J. Corona

Merge request reports