Jump to content
Alwarren

Custom Attribute Controls - issue with AttributeSave

Recommended Posts

Hello.

 

In absence of an issue tracker, I'll post this here.

 

I am writing a custom attribute edit control. The Attribute entry looks like this:

class FHQ_MissionBriefing
{
    displayName = "Briefing";
    property = "FHQ_BriefingAttribute";
    control = "FHQ_BriefingEdit";
    expression = "if (!is3DEN) then {[_value] call FHQ_fnc_ttiMissionBriefing;}";
    defaultValue = "[]";
    value = 0;
};
 
The FHQ_BriefingEdit control starts like this:
 
class FHQ_BriefingEdit : TitleWide
{
    attributeLoad = "['attributeLoad', _this, _value] call FHQ_fnc_tteEditBriefing;";
    attributeSave = "['attributeSave', _this] call FHQ_fnc_tteEditBriefing;";
    onLoad = "['load', _this] call FHQ_fnc_tteEditBriefing;";

What I see, however, is that when I click the OK button, attributeSave is called twice. While this is normally not a problem (albeit being redundant), it can pose an issue if the attributeSave function has side effects.

 

Question: Is this intended behavior? Or a bug?

Share this post


Link to post
Share on other sites

It's intentional. First run is for data validation, and second will actually apply them.

Added to the documentation.

Share this post


Link to post
Share on other sites

It's intentional. First run is for data validation, and second will actually apply them.

Added to the documentation.

 

Great, thanks!

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×