Calling InitData on a local remembers the user-defined default data for local and sets the data to that value. We need a similar InitDefaultData that can set the default-default value of the type as the value. For instance, 0 for numerics and '' for strings.
It should do something like this
TypeRef t = outputType; while (t->HasCustomDefault()) { t = t->BaseType(); } t->InitData(outputData);