ArticySoftware / Articy3ImporterForUnreal

Articy Importer plugin for the Unreal Engine 4 and Unreal Engine 5 (work in progress).
MIT License
98 stars 41 forks source link

Missing arithmetic operators can cause compile errors in generated code #84

Closed SalamiArmi closed 8 months ago

SalamiArmi commented 8 months ago

Note: this is a demonstrative code snippet and is not intended to be integrated directly.

My writer has produced a condition block which will cause the importer to generate invalid code: image

The generated code in XYZExpressoScripts.h is a fairly direct transliteration of the text in articy:draft:

Conditions.Add(-1162260831, [&]
{
    return ConditionOrTrue(
        (*Confrontations->Apologetic) < ((*Confrontations->Defensive) + (*Confrontations->Mending))
    );
});

This fails to compile because the only available operators for UArticyInt that relate to addition are +=. My provided methods provide:

  1. an implementation of A + B which fixes my immediate compile error.
  2. implementations which may fix more complex compound variants of this issue. eg: A < B + ((C + D) + E)

A full fix in this manner would provide methods for all other operators -, *, /, etc. as appropriate. For brevity's sake I have omitted them.

Am I on the right track? Have I missed something crucial in understanding why the code generated was invalid, or was this a simple untested case?

lpinkhard commented 8 months ago

The solution appears good to solve the problem. I will arrange for a complete implementation.