Skip to content

Commit 05573d6

Browse files
authoredDec 29, 2021
Remove unused (de)serializeAttributes() methods
1 parent 9b650b9 commit 05573d6

10 files changed

+0
-274
lines changed
 

‎src/gui/guiButton.cpp

-79
Original file line numberDiff line numberDiff line change
@@ -632,85 +632,6 @@ bool GUIButton::isDrawingBorder() const
632632
}
633633

634634

635-
//! Writes attributes of the element.
636-
void GUIButton::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const
637-
{
638-
IGUIButton::serializeAttributes(out,options);
639-
640-
out->addBool ("PushButton", IsPushButton );
641-
if (IsPushButton)
642-
out->addBool("Pressed", Pressed);
643-
644-
for ( u32 i=0; i<(u32)EGBIS_COUNT; ++i )
645-
{
646-
if ( ButtonImages[i].Texture )
647-
{
648-
core::stringc name( GUIButtonImageStateNames[i] );
649-
out->addTexture(name.c_str(), ButtonImages[i].Texture);
650-
name += "Rect";
651-
out->addRect(name.c_str(), ButtonImages[i].SourceRect);
652-
}
653-
}
654-
655-
out->addBool ("UseAlphaChannel", UseAlphaChannel);
656-
out->addBool ("Border", DrawBorder);
657-
out->addBool ("ScaleImage", ScaleImage);
658-
659-
for ( u32 i=0; i<(u32)EGBS_COUNT; ++i )
660-
{
661-
if ( ButtonSprites[i].Index >= 0 )
662-
{
663-
core::stringc nameIndex( GUIButtonStateNames[i] );
664-
nameIndex += "Index";
665-
out->addInt(nameIndex.c_str(), ButtonSprites[i].Index );
666-
667-
core::stringc nameColor( GUIButtonStateNames[i] );
668-
nameColor += "Color";
669-
out->addColor(nameColor.c_str(), ButtonSprites[i].Color );
670-
671-
core::stringc nameLoop( GUIButtonStateNames[i] );
672-
nameLoop += "Loop";
673-
out->addBool(nameLoop.c_str(), ButtonSprites[i].Loop );
674-
675-
core::stringc nameScale( GUIButtonStateNames[i] );
676-
nameScale += "Scale";
677-
out->addBool(nameScale.c_str(), ButtonSprites[i].Scale );
678-
}
679-
}
680-
681-
// out->addString ("OverrideFont", OverrideFont);
682-
}
683-
684-
685-
//! Reads attributes of the element
686-
void GUIButton::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)
687-
{
688-
IGUIButton::deserializeAttributes(in,options);
689-
690-
IsPushButton = in->getAttributeAsBool("PushButton");
691-
Pressed = IsPushButton ? in->getAttributeAsBool("Pressed") : false;
692-
693-
core::rect<s32> rec = in->getAttributeAsRect("ImageRect");
694-
if (rec.isValid())
695-
setImage( in->getAttributeAsTexture("Image"), rec);
696-
else
697-
setImage( in->getAttributeAsTexture("Image") );
698-
699-
rec = in->getAttributeAsRect("PressedImageRect");
700-
if (rec.isValid())
701-
setPressedImage( in->getAttributeAsTexture("PressedImage"), rec);
702-
else
703-
setPressedImage( in->getAttributeAsTexture("PressedImage") );
704-
705-
setDrawBorder(in->getAttributeAsBool("Border"));
706-
setUseAlphaChannel(in->getAttributeAsBool("UseAlphaChannel"));
707-
setScaleImage(in->getAttributeAsBool("ScaleImage"));
708-
709-
// setOverrideFont(in->getAttributeAsString("OverrideFont"));
710-
711-
updateAbsolutePosition();
712-
}
713-
714635
// PATCH
715636
GUIButton* GUIButton::addButton(IGUIEnvironment *environment,
716637
const core::rect<s32>& rectangle, ISimpleTextureSource *tsrc,

‎src/gui/guiButton.h

-8
Original file line numberDiff line numberDiff line change
@@ -221,14 +221,6 @@ class GUIButton : public gui::IGUIButton
221221
return ClickControlState;
222222
}
223223

224-
//! Writes attributes of the element.
225-
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const override;
226-
227-
//! Reads attributes of the element
228-
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) override;
229-
230-
231-
232224
void setColor(video::SColor color);
233225
// PATCH
234226
//! Set element properties from a StyleSpec corresponding to the button state

‎src/gui/guiEditBox.cpp

-51
Original file line numberDiff line numberDiff line change
@@ -846,54 +846,3 @@ void GUIEditBox::updateVScrollBar()
846846
}
847847
}
848848
}
849-
850-
void GUIEditBox::deserializeAttributes(
851-
io::IAttributes *in, io::SAttributeReadWriteOptions *options = 0)
852-
{
853-
IGUIEditBox::deserializeAttributes(in, options);
854-
855-
setOverrideColor(in->getAttributeAsColor("OverrideColor"));
856-
enableOverrideColor(in->getAttributeAsBool("OverrideColorEnabled"));
857-
setMax(in->getAttributeAsInt("MaxChars"));
858-
setWordWrap(in->getAttributeAsBool("WordWrap"));
859-
setMultiLine(in->getAttributeAsBool("MultiLine"));
860-
setAutoScroll(in->getAttributeAsBool("AutoScroll"));
861-
core::stringw ch = in->getAttributeAsStringW("PasswordChar");
862-
863-
if (ch.empty())
864-
setPasswordBox(in->getAttributeAsBool("PasswordBox"));
865-
else
866-
setPasswordBox(in->getAttributeAsBool("PasswordBox"), ch[0]);
867-
868-
setTextAlignment((EGUI_ALIGNMENT)in->getAttributeAsEnumeration(
869-
"HTextAlign", GUIAlignmentNames),
870-
(EGUI_ALIGNMENT)in->getAttributeAsEnumeration(
871-
"VTextAlign", GUIAlignmentNames));
872-
873-
setWritable(in->getAttributeAsBool("Writable"));
874-
// setOverrideFont(in->getAttributeAsFont("OverrideFont"));
875-
}
876-
877-
//! Writes attributes of the element.
878-
void GUIEditBox::serializeAttributes(
879-
io::IAttributes *out, io::SAttributeReadWriteOptions *options = 0) const
880-
{
881-
// IGUIEditBox::serializeAttributes(out,options);
882-
883-
out->addBool("OverrideColorEnabled", m_override_color_enabled);
884-
out->addColor("OverrideColor", m_override_color);
885-
// out->addFont("OverrideFont",m_override_font);
886-
out->addInt("MaxChars", m_max);
887-
out->addBool("WordWrap", m_word_wrap);
888-
out->addBool("MultiLine", m_multiline);
889-
out->addBool("AutoScroll", m_autoscroll);
890-
out->addBool("PasswordBox", m_passwordbox);
891-
core::stringw ch = L" ";
892-
ch[0] = m_passwordchar;
893-
out->addString("PasswordChar", ch.c_str());
894-
out->addEnum("HTextAlign", m_halign, GUIAlignmentNames);
895-
out->addEnum("VTextAlign", m_valign, GUIAlignmentNames);
896-
out->addBool("Writable", m_writable);
897-
898-
IGUIEditBox::serializeAttributes(out, options);
899-
}

‎src/gui/guiEditBox.h

-8
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,6 @@ class GUIEditBox : public IGUIEditBox
130130
//! called if an event happened.
131131
virtual bool OnEvent(const SEvent &event);
132132

133-
//! Writes attributes of the element.
134-
virtual void serializeAttributes(io::IAttributes *out,
135-
io::SAttributeReadWriteOptions *options) const;
136-
137-
//! Reads attributes of the element
138-
virtual void deserializeAttributes(
139-
io::IAttributes *in, io::SAttributeReadWriteOptions *options);
140-
141133
virtual bool acceptsIME() { return isEnabled() && m_writable; };
142134

143135
protected:

‎src/gui/guiEditBoxWithScrollbar.cpp

-20
Original file line numberDiff line numberDiff line change
@@ -652,26 +652,6 @@ void GUIEditBoxWithScrollBar::setBackgroundColor(const video::SColor &bg_color)
652652
m_bg_color_used = true;
653653
}
654654

655-
//! Writes attributes of the element.
656-
void GUIEditBoxWithScrollBar::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options = 0) const
657-
{
658-
out->addBool("Border", m_border);
659-
out->addBool("Background", m_background);
660-
// out->addFont("OverrideFont", OverrideFont);
661-
662-
GUIEditBox::serializeAttributes(out, options);
663-
}
664-
665-
666-
//! Reads attributes of the element
667-
void GUIEditBoxWithScrollBar::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options = 0)
668-
{
669-
GUIEditBox::deserializeAttributes(in, options);
670-
671-
setDrawBorder(in->getAttributeAsBool("Border"));
672-
setDrawBackground(in->getAttributeAsBool("Background"));
673-
}
674-
675655
bool GUIEditBoxWithScrollBar::isDrawBackgroundEnabled() const { return false; }
676656
bool GUIEditBoxWithScrollBar::isDrawBorderEnabled() const { return false; }
677657
void GUIEditBoxWithScrollBar::setCursorChar(const wchar_t cursorChar) { }

‎src/gui/guiEditBoxWithScrollbar.h

-6
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,6 @@ class GUIEditBoxWithScrollBar : public GUIEditBox
3131
//! Change the background color
3232
virtual void setBackgroundColor(const video::SColor &bg_color);
3333

34-
//! Writes attributes of the element.
35-
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const;
36-
37-
//! Reads attributes of the element
38-
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options);
39-
4034
virtual bool isDrawBackgroundEnabled() const;
4135
virtual bool isDrawBorderEnabled() const;
4236
virtual void setCursorChar(const wchar_t cursorChar);

‎src/gui/guiSkin.cpp

-42
Original file line numberDiff line numberDiff line change
@@ -1024,48 +1024,6 @@ void GUISkin::draw2DRectangle(IGUIElement* element,
10241024
}
10251025

10261026

1027-
//! Writes attributes of the object.
1028-
//! Implement this to expose the attributes of your scene node animator for
1029-
//! scripting languages, editors, debuggers or xml serialization purposes.
1030-
void GUISkin::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const
1031-
{
1032-
u32 i;
1033-
for (i=0; i<EGDC_COUNT; ++i)
1034-
out->addColor(GUISkinColorNames[i], Colors[i]);
1035-
1036-
for (i=0; i<EGDS_COUNT; ++i)
1037-
out->addInt(GUISkinSizeNames[i], Sizes[i]);
1038-
1039-
for (i=0; i<EGDT_COUNT; ++i)
1040-
out->addString(GUISkinTextNames[i], Texts[i].c_str());
1041-
1042-
for (i=0; i<EGDI_COUNT; ++i)
1043-
out->addInt(GUISkinIconNames[i], Icons[i]);
1044-
}
1045-
1046-
1047-
//! Reads attributes of the object.
1048-
//! Implement this to set the attributes of your scene node animator for
1049-
//! scripting languages, editors, debuggers or xml deserialization purposes.
1050-
void GUISkin::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)
1051-
{
1052-
// TODO: This is not nice code for downward compatibility, whenever new values are added and users
1053-
// load an old skin the corresponding values will be set to 0.
1054-
u32 i;
1055-
for (i=0; i<EGDC_COUNT; ++i)
1056-
Colors[i] = in->getAttributeAsColor(GUISkinColorNames[i]);
1057-
1058-
for (i=0; i<EGDS_COUNT; ++i)
1059-
Sizes[i] = in->getAttributeAsInt(GUISkinSizeNames[i]);
1060-
1061-
for (i=0; i<EGDT_COUNT; ++i)
1062-
Texts[i] = in->getAttributeAsStringW(GUISkinTextNames[i]);
1063-
1064-
for (i=0; i<EGDI_COUNT; ++i)
1065-
Icons[i] = in->getAttributeAsInt(GUISkinIconNames[i]);
1066-
}
1067-
1068-
10691027
//! gets the colors
10701028
// PATCH
10711029
void GUISkin::getColors(video::SColor* colors)

‎src/gui/guiSkin.h

-10
Original file line numberDiff line numberDiff line change
@@ -290,16 +290,6 @@ namespace gui
290290
//! get the type of this skin
291291
virtual EGUI_SKIN_TYPE getType() const;
292292

293-
//! Writes attributes of the object.
294-
//! Implement this to expose the attributes of your scene node animator for
295-
//! scripting languages, editors, debuggers or xml serialization purposes.
296-
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const;
297-
298-
//! Reads attributes of the object.
299-
//! Implement this to set the attributes of your scene node animator for
300-
//! scripting languages, editors, debuggers or xml deserialization purposes.
301-
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0);
302-
303293
//! gets the colors
304294
virtual void getColors(video::SColor* colors); // ::PATCH:
305295

‎src/irrlicht_changes/static_text.cpp

-44
Original file line numberDiff line numberDiff line change
@@ -588,50 +588,6 @@ s32 StaticText::getTextWidth() const
588588
}
589589

590590

591-
//! Writes attributes of the element.
592-
//! Implement this to expose the attributes of your element for
593-
//! scripting languages, editors, debuggers or xml serialization purposes.
594-
void StaticText::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const
595-
{
596-
IGUIStaticText::serializeAttributes(out,options);
597-
598-
out->addBool ("Border", Border);
599-
out->addBool ("OverrideColorEnabled",true);
600-
out->addBool ("OverrideBGColorEnabled",ColoredText.hasBackground());
601-
out->addBool ("WordWrap", WordWrap);
602-
out->addBool ("Background", Background);
603-
out->addBool ("RightToLeft", RightToLeft);
604-
out->addBool ("RestrainTextInside", RestrainTextInside);
605-
out->addColor ("OverrideColor", ColoredText.getDefaultColor());
606-
out->addColor ("BGColor", ColoredText.getBackground());
607-
out->addEnum ("HTextAlign", HAlign, GUIAlignmentNames);
608-
out->addEnum ("VTextAlign", VAlign, GUIAlignmentNames);
609-
610-
// out->addFont ("OverrideFont", OverrideFont);
611-
}
612-
613-
614-
//! Reads attributes of the element
615-
void StaticText::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)
616-
{
617-
IGUIStaticText::deserializeAttributes(in,options);
618-
619-
Border = in->getAttributeAsBool("Border");
620-
setWordWrap(in->getAttributeAsBool("WordWrap"));
621-
Background = in->getAttributeAsBool("Background");
622-
RightToLeft = in->getAttributeAsBool("RightToLeft");
623-
RestrainTextInside = in->getAttributeAsBool("RestrainTextInside");
624-
if (in->getAttributeAsBool("OverrideColorEnabled"))
625-
ColoredText.setDefaultColor(in->getAttributeAsColor("OverrideColor"));
626-
if (in->getAttributeAsBool("OverrideBGColorEnabled"))
627-
ColoredText.setBackground(in->getAttributeAsColor("BGColor"));
628-
629-
setTextAlignment( (EGUI_ALIGNMENT) in->getAttributeAsEnumeration("HTextAlign", GUIAlignmentNames),
630-
(EGUI_ALIGNMENT) in->getAttributeAsEnumeration("VTextAlign", GUIAlignmentNames));
631-
632-
// OverrideFont = in->getAttributeAsFont("OverrideFont");
633-
}
634-
635591
} // end namespace gui
636592

637593
#endif // USE_FREETYPE

‎src/irrlicht_changes/static_text.h

-6
Original file line numberDiff line numberDiff line change
@@ -184,12 +184,6 @@ namespace gui
184184
//! Checks if the text should be interpreted as right-to-left text
185185
virtual bool isRightToLeft() const;
186186

187-
//! Writes attributes of the element.
188-
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const;
189-
190-
//! Reads attributes of the element
191-
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options);
192-
193187
virtual bool hasType(EGUI_ELEMENT_TYPE t) const {
194188
return (t == EGUIET_ENRICHED_STATIC_TEXT) || (t == EGUIET_STATIC_TEXT);
195189
};

0 commit comments

Comments
 (0)
Please sign in to comment.