Selaa lähdekoodia

Updated RTTI for certain types using the new (shorter) definition format

BearishSun 9 vuotta sitten
vanhempi
sitoutus
c35504b88e

+ 29 - 98
Source/BansheeEngine/Include/BsCameraRTTI.h

@@ -16,106 +16,37 @@ namespace BansheeEngine
 	class BS_EXPORT CameraRTTI : public RTTIType <Camera, IReflectable, CameraRTTI>
 	{
 	private:
-		SPtr<Viewport> getViewport(Camera* obj) { return obj->mViewport; }
-		void setViewport(Camera* obj, SPtr<Viewport> val) { obj->mViewport = val; }
-
-		UINT64& getLayers(Camera* obj) { return obj->mLayers; }
-		void setLayers(Camera* obj, UINT64& val) { obj->mLayers = val; }
-
-		UINT8& getMSAACount(Camera* obj) { return obj->mMSAA; }
-		void setMSAACount(Camera* obj, UINT8& msaaCount) { obj->mMSAA = msaaCount; }
-
-		PostProcessSettings& getPostProcessSettings(Camera* obj) { return obj->mPPSettings; }
-		void setPostProcessSettings(Camera* obj, PostProcessSettings& settings) { obj->mPPSettings = settings; }
-
-		CameraFlags& getFlags(Camera* obj) { return obj->mCameraFlags; }
-		void setFlags(Camera* obj, CameraFlags& val) { obj->mCameraFlags = val; }
-
-		Vector3& getPosition(Camera* obj) { return obj->mPosition; }
-		void setPosition(Camera* obj, Vector3& val) { obj->mPosition = val; }
-
-		Quaternion& getRotation(Camera* obj) { return obj->mRotation; }
-		void setRotation(Camera* obj, Quaternion& val) { obj->mRotation = val; }
-
-		ProjectionType& getProjType(Camera* obj) { return obj->mProjType; }
-		void setProjType(Camera* obj, ProjectionType& val) { obj->mProjType = val; }
-
-		Radian& getHorzFOV(Camera* obj) { return obj->mHorzFOV; }
-		void setHorzFOV(Camera* obj, Radian& val) { obj->mHorzFOV = val; }
-
-		float& getFarDist(Camera* obj) { return obj->mFarDist; }
-		void setFarDist(Camera* obj, float& val) { obj->mFarDist = val; }
-
-		float& getNearDist(Camera* obj) { return obj->mNearDist; }
-		void setNearDist(Camera* obj, float& val) { obj->mNearDist = val; }
-
-		float& getAspect(Camera* obj) { return obj->mAspect; }
-		void setAspect(Camera* obj, float& val) { obj->mAspect = val; }
-
-		float& getOrthoHeight(Camera* obj) { return obj->mOrthoHeight; }
-		void setOrthoHeight(Camera* obj, float& val) { obj->mOrthoHeight = val; }
-
-		INT32& getPriority(Camera* obj) { return obj->mPriority; }
-		void setPriority(Camera* obj, INT32& val) { obj->mPriority = val; }
-
-		bool& getCustomViewMatrix(Camera* obj) { return obj->mCustomViewMatrix; }
-		void setCustomViewMatrix(Camera* obj, bool& val) { obj->mCustomViewMatrix = val; }
-
-		bool& getCustomProjMatrix(Camera* obj) { return obj->mCustomProjMatrix; }
-		void setCustomProjMatrix(Camera* obj, bool& val) { obj->mCustomProjMatrix = val; }
-
-		bool& getFrustumManual(Camera* obj) { return obj->mFrustumExtentsManuallySet; }
-		void setFrustumManual(Camera* obj, bool& val) { obj->mFrustumExtentsManuallySet = val; }
-
-		Matrix4& getProjMatrix(Camera* obj) { return obj->mProjMatrix; }
-		void setProjMatrix(Camera* obj, Matrix4& val) { obj->mProjMatrix = val; }
-
-		Matrix4& getProjMatrixRS(Camera* obj) { return obj->mProjMatrixRS; }
-		void setProjMatrixRS(Camera* obj, Matrix4& val) { obj->mProjMatrixRS = val; }
-
-		Matrix4& getViewMatrix(Camera* obj) { return obj->mViewMatrix; }
-		void setViewMatrix(Camera* obj, Matrix4& val) { obj->mViewMatrix = val; }
-
-		float& getLeft(Camera* obj) { return obj->mLeft; }
-		void setLeft(Camera* obj, float& val) { obj->mLeft = val; }
-
-		float& getRight(Camera* obj) { return obj->mRight; }
-		void setRight(Camera* obj, float& val) { obj->mRight = val; }
-
-		float& getTop(Camera* obj) { return obj->mTop; }
-		void setTop(Camera* obj, float& val) { obj->mTop = val; }
-
-		float& getBottom(Camera* obj) { return obj->mBottom; }
-		void setBottom(Camera* obj, float& val) { obj->mBottom = val; }
-
+		BS_BEGIN_RTTI_MEMBERS
+			BS_RTTI_MEMBER_REFLPTR(mViewport, 0)
+			BS_RTTI_MEMBER_PLAIN(mLayers, 1)
+			BS_RTTI_MEMBER_PLAIN(mPosition, 2)
+			BS_RTTI_MEMBER_PLAIN(mRotation, 3)
+			BS_RTTI_MEMBER_PLAIN(mProjType, 4)
+			BS_RTTI_MEMBER_PLAIN(mHorzFOV, 5)
+			BS_RTTI_MEMBER_PLAIN(mFarDist, 6)
+			BS_RTTI_MEMBER_PLAIN(mNearDist, 7)
+			BS_RTTI_MEMBER_PLAIN(mAspect, 8)
+			BS_RTTI_MEMBER_PLAIN(mOrthoHeight, 9)
+			BS_RTTI_MEMBER_PLAIN(mPriority, 10)
+			BS_RTTI_MEMBER_PLAIN(mCustomViewMatrix, 11)
+			BS_RTTI_MEMBER_PLAIN(mCustomProjMatrix, 12)
+			BS_RTTI_MEMBER_PLAIN(mFrustumExtentsManuallySet, 13)
+			BS_RTTI_MEMBER_PLAIN(mProjMatrixRS, 15)
+			BS_RTTI_MEMBER_PLAIN(mProjMatrix, 16)
+			BS_RTTI_MEMBER_PLAIN(mViewMatrix, 17)
+			BS_RTTI_MEMBER_PLAIN(mLeft, 18)
+			BS_RTTI_MEMBER_PLAIN(mRight, 19)
+			BS_RTTI_MEMBER_PLAIN(mTop, 20)
+			BS_RTTI_MEMBER_PLAIN(mBottom, 21)
+			BS_RTTI_MEMBER_PLAIN(mCameraFlags, 22)
+			BS_RTTI_MEMBER_PLAIN(mMSAA, 23)
+			BS_RTTI_MEMBER_PLAIN(mPPSettings, 24)
+		BS_END_RTTI_MEMBERS
+			
 	public:
 		CameraRTTI()
-		{
-			addReflectablePtrField("mViewport", 0, &CameraRTTI::getViewport, &CameraRTTI::setViewport);
-			addPlainField("mLayers", 1, &CameraRTTI::getLayers, &CameraRTTI::setLayers);
-			addPlainField("mPosition", 2, &CameraRTTI::getPosition, &CameraRTTI::setPosition);
-			addPlainField("mRotation", 3, &CameraRTTI::getRotation, &CameraRTTI::setRotation);
-			addPlainField("mProjType", 4, &CameraRTTI::getProjType, &CameraRTTI::setProjType);
-			addPlainField("mHorzFOV", 5, &CameraRTTI::getHorzFOV, &CameraRTTI::setHorzFOV);
-			addPlainField("mFarDist", 6, &CameraRTTI::getFarDist, &CameraRTTI::setFarDist);
-			addPlainField("mNearDist", 7, &CameraRTTI::getNearDist, &CameraRTTI::setNearDist);
-			addPlainField("mAspect", 8, &CameraRTTI::getAspect, &CameraRTTI::setAspect);
-			addPlainField("mOrthoHeight", 9, &CameraRTTI::getOrthoHeight, &CameraRTTI::setOrthoHeight);
-			addPlainField("mPriority", 10, &CameraRTTI::getPriority, &CameraRTTI::setPriority);
-			addPlainField("mCustomViewMatrix", 11, &CameraRTTI::getCustomViewMatrix, &CameraRTTI::setCustomViewMatrix);
-			addPlainField("mCustomProjMatrix", 12, &CameraRTTI::getCustomProjMatrix, &CameraRTTI::setCustomProjMatrix);
-			addPlainField("mFrustumExtentsManuallySet", 13, &CameraRTTI::getFrustumManual, &CameraRTTI::setFrustumManual);
-			addPlainField("mProjMatrixRS", 15, &CameraRTTI::getProjMatrixRS, &CameraRTTI::setProjMatrixRS);
-			addPlainField("mProjMatrix", 16, &CameraRTTI::getProjMatrix, &CameraRTTI::setProjMatrix);
-			addPlainField("mViewMatrix", 17, &CameraRTTI::getViewMatrix, &CameraRTTI::setViewMatrix);
-			addPlainField("mLeft", 18, &CameraRTTI::getLeft, &CameraRTTI::setLeft);
-			addPlainField("mRight", 19, &CameraRTTI::getRight, &CameraRTTI::setRight);
-			addPlainField("mTop", 20, &CameraRTTI::getTop, &CameraRTTI::setTop);
-			addPlainField("mBottom", 21, &CameraRTTI::getBottom, &CameraRTTI::setBottom);
-			addPlainField("mFlags", 22, &CameraRTTI::getFlags, &CameraRTTI::setFlags);
-			addPlainField("mMSAA", 23, &CameraRTTI::getMSAACount, &CameraRTTI::setMSAACount);
-			addPlainField("mPPSettings", 24, &CameraRTTI::getPostProcessSettings, &CameraRTTI::setPostProcessSettings);
-		}
+			:mInitMembers(this)
+		{ }
 
 		void onDeserializationEnded(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
 		{

+ 45 - 150
Source/BansheeEngine/Include/BsGUIElementStyleRTTI.h

@@ -16,158 +16,53 @@ namespace BansheeEngine
 	class BS_EXPORT GUIElementStyleRTTI : public RTTIType <GUIElementStyle, IReflectable, GUIElementStyleRTTI>
 	{
 	private:
-		HFont& getFont(GUIElementStyle* obj) { return obj->font; }
-		void setFont(GUIElementStyle* obj, HFont& val) { obj->font = val; }
-		
-		UINT32& getFontSize(GUIElementStyle* obj) { return obj->fontSize; }
-		void setFontSize(GUIElementStyle* obj, UINT32& val) { obj->fontSize = val; }
-
-		TextHorzAlign& getTextHorzAlign(GUIElementStyle* obj) { return obj->textHorzAlign; }
-		void setTextHorzAlign(GUIElementStyle* obj, TextHorzAlign& val) { obj->textHorzAlign = val; }
-
-		TextVertAlign& getTextVertAlign(GUIElementStyle* obj) { return obj->textVertAlign; }
-		void setTextVertAlign(GUIElementStyle* obj, TextVertAlign& val) { obj->textVertAlign = val; }
-
-		GUIImagePosition& getImagePosition(GUIElementStyle* obj) { return obj->imagePosition; }
-		void setImagePosition(GUIElementStyle* obj, GUIImagePosition& val) { obj->imagePosition = val; }
-
-		bool& getWordWrap(GUIElementStyle* obj) { return obj->wordWrap; }
-		void setWordWrap(GUIElementStyle* obj, bool& val) { obj->wordWrap = val; }
-
-
-		HSpriteTexture& getNormalTexture(GUIElementStyle* obj) { return obj->normal.texture; }
-		void setNormalTexture(GUIElementStyle* obj, HSpriteTexture& val) { obj->normal.texture = val; }
-
-		Color& getNormalTextColor(GUIElementStyle* obj) { return obj->normal.textColor; }
-		void setNormalTextColor(GUIElementStyle* obj, Color& val) { obj->normal.textColor = val; }
-
-		HSpriteTexture& getHoverTexture(GUIElementStyle* obj) { return obj->hover.texture; }
-		void setHoverTexture(GUIElementStyle* obj, HSpriteTexture& val) { obj->hover.texture = val; }
-
-		Color& getHoverTextColor(GUIElementStyle* obj) { return obj->hover.textColor; }
-		void setHoverTextColor(GUIElementStyle* obj, Color& val) { obj->hover.textColor = val; }
-
-		HSpriteTexture& getActiveTexture(GUIElementStyle* obj) { return obj->active.texture; }
-		void setActiveTexture(GUIElementStyle* obj, HSpriteTexture& val) { obj->active.texture = val; }
-
-		Color& getActiveTextColor(GUIElementStyle* obj) { return obj->active.textColor; }
-		void setActiveTextColor(GUIElementStyle* obj, Color& val) { obj->active.textColor = val; }
-
-		HSpriteTexture& getFocusedTexture(GUIElementStyle* obj) { return obj->focused.texture; }
-		void setFocusedTexture(GUIElementStyle* obj, HSpriteTexture& val) { obj->focused.texture = val; }
-
-		Color& getFocusedTextColor(GUIElementStyle* obj) { return obj->focused.textColor; }
-		void setFocusedTextColor(GUIElementStyle* obj, Color& val) { obj->focused.textColor = val; }
-
-
-		HSpriteTexture& getNormalOnTexture(GUIElementStyle* obj) { return obj->normalOn.texture; }
-		void setNormalOnTexture(GUIElementStyle* obj, HSpriteTexture& val) { obj->normalOn.texture = val; }
-
-		Color& getNormalOnTextColor(GUIElementStyle* obj) { return obj->normalOn.textColor; }
-		void setNormalOnTextColor(GUIElementStyle* obj, Color& val) { obj->normalOn.textColor = val; }
-
-		HSpriteTexture& getHoverOnTexture(GUIElementStyle* obj) { return obj->hoverOn.texture; }
-		void setHoverOnTexture(GUIElementStyle* obj, HSpriteTexture& val) { obj->hoverOn.texture = val; }
-
-		Color& getHoverOnTextColor(GUIElementStyle* obj) { return obj->hoverOn.textColor; }
-		void setHoverOnTextColor(GUIElementStyle* obj, Color& val) { obj->hoverOn.textColor = val; }
-
-		HSpriteTexture& getActiveOnTexture(GUIElementStyle* obj) { return obj->activeOn.texture; }
-		void setActiveOnTexture(GUIElementStyle* obj, HSpriteTexture& val) { obj->activeOn.texture = val; }
-
-		Color& getActiveOnTextColor(GUIElementStyle* obj) { return obj->activeOn.textColor; }
-		void setActiveOnTextColor(GUIElementStyle* obj, Color& val) { obj->activeOn.textColor = val; }
-
-		HSpriteTexture& getFocusedOnTexture(GUIElementStyle* obj) { return obj->focusedOn.texture; }
-		void setFocusedOnTexture(GUIElementStyle* obj, HSpriteTexture& val) { obj->focusedOn.texture = val; }
-
-		Color& getFocusedOnTextColor(GUIElementStyle* obj) { return obj->focusedOn.textColor; }
-		void setFocusedOnTextColor(GUIElementStyle* obj, Color& val) { obj->focusedOn.textColor = val; }
-
-
-		RectOffset& getBorder(GUIElementStyle* obj) { return obj->border; }
-		void setBorder(GUIElementStyle* obj, RectOffset& val) { obj->border = val; }
-
-		RectOffset& getMargins(GUIElementStyle* obj) { return obj->margins; }
-		void setMargins(GUIElementStyle* obj, RectOffset& val) { obj->margins = val; }
-
-		RectOffset& getContentOffset(GUIElementStyle* obj) { return obj->contentOffset; }
-		void setContentOffset(GUIElementStyle* obj, RectOffset& val) { obj->contentOffset = val; }
-
-		RectOffset& getPadding(GUIElementStyle* obj) { return obj->padding; }
-		void setPadding(GUIElementStyle* obj, RectOffset& val) { obj->padding = val; }
-
-		UINT32& getWidth(GUIElementStyle* obj) { return obj->width; }
-		void setWidth(GUIElementStyle* obj, UINT32& val) { obj->width = val; }
-
-		UINT32& getHeight(GUIElementStyle* obj) { return obj->height; }
-		void setHeight(GUIElementStyle* obj, UINT32& val) { obj->height = val; }
-
-		UINT32& getMinWidth(GUIElementStyle* obj) { return obj->minWidth; }
-		void setMinWidth(GUIElementStyle* obj, UINT32& val) { obj->minWidth = val; }
-
-		UINT32& getMaxWidth(GUIElementStyle* obj) { return obj->maxWidth; }
-		void setMaxWidth(GUIElementStyle* obj, UINT32& val) { obj->maxWidth = val; }
-
-		UINT32& getMinHeight(GUIElementStyle* obj) { return obj->minHeight; }
-		void setMinHeight(GUIElementStyle* obj, UINT32& val) { obj->minHeight = val; }
-
-		UINT32& getMaxHeight(GUIElementStyle* obj) { return obj->maxHeight; }
-		void setMaxHeight(GUIElementStyle* obj, UINT32& val) { obj->maxHeight = val; }
-
-		bool& getFixedWidth(GUIElementStyle* obj) { return obj->fixedWidth; }
-		void setFixedWidth(GUIElementStyle* obj, bool& val) { obj->fixedWidth = val; }
-
-		bool& getFixedHeight(GUIElementStyle* obj) { return obj->fixedHeight; }
-		void setFixedHeight(GUIElementStyle* obj, bool& val) { obj->fixedHeight = val; }
-
-		Map<String, String>& getSubStyles(GUIElementStyle* obj) { return obj->subStyles; }
-		void setSubStyles(GUIElementStyle* obj, Map<String, String>& val) { obj->subStyles = val; }
-
+		BS_BEGIN_RTTI_MEMBERS
+			BS_RTTI_MEMBER_REFL(font, 0)
+			BS_RTTI_MEMBER_PLAIN(fontSize, 1)
+			BS_RTTI_MEMBER_PLAIN(textHorzAlign, 2)
+			BS_RTTI_MEMBER_PLAIN(textVertAlign, 3)
+			BS_RTTI_MEMBER_PLAIN(imagePosition, 4)
+			BS_RTTI_MEMBER_PLAIN(wordWrap, 5)
+
+			BS_RTTI_MEMBER_REFL_NAMED(normalTex, normal.texture, 6)
+			BS_RTTI_MEMBER_PLAIN_NAMED(normalTextColor, normal.textColor, 7)
+			BS_RTTI_MEMBER_REFL_NAMED(hoverTex, hover.texture, 8)
+			BS_RTTI_MEMBER_PLAIN_NAMED(hoverTextColor, hover.textColor, 9)
+			BS_RTTI_MEMBER_REFL_NAMED(activeTex, active.texture, 10)
+			BS_RTTI_MEMBER_PLAIN_NAMED(activeTextColor, active.textColor, 11)
+			BS_RTTI_MEMBER_REFL_NAMED(focusedTex, focused.texture, 12)
+			BS_RTTI_MEMBER_PLAIN_NAMED(focusedTextColor, focused.textColor, 13)
+
+			BS_RTTI_MEMBER_REFL_NAMED(normalOnTex, normalOn.texture, 14)
+			BS_RTTI_MEMBER_PLAIN_NAMED(normalOnTextColor, normalOn.textColor, 15)
+			BS_RTTI_MEMBER_REFL_NAMED(hoverOnTex, hoverOn.texture, 16)
+			BS_RTTI_MEMBER_PLAIN_NAMED(hoverOnTextColor, hoverOn.textColor, 17)
+			BS_RTTI_MEMBER_REFL_NAMED(activeOnTex, activeOn.texture, 18)
+			BS_RTTI_MEMBER_PLAIN_NAMED(activeOnTextColor, activeOn.textColor, 19)
+			BS_RTTI_MEMBER_REFL_NAMED(focusedOnTex, focusedOn.texture, 20)
+			BS_RTTI_MEMBER_PLAIN_NAMED(focusedOnTextColor, focusedOn.textColor, 21)
+
+			BS_RTTI_MEMBER_PLAIN(border, 22)
+			BS_RTTI_MEMBER_PLAIN(margins, 23)
+			BS_RTTI_MEMBER_PLAIN(contentOffset, 24)
+			BS_RTTI_MEMBER_PLAIN(padding, 25)
+
+			BS_RTTI_MEMBER_PLAIN(width, 26)
+			BS_RTTI_MEMBER_PLAIN(height, 27)
+			BS_RTTI_MEMBER_PLAIN(minWidth, 28)
+			BS_RTTI_MEMBER_PLAIN(maxWidth, 29)
+			BS_RTTI_MEMBER_PLAIN(minHeight, 30)
+			BS_RTTI_MEMBER_PLAIN(maxHeight, 31)
+			BS_RTTI_MEMBER_PLAIN(fixedWidth, 32)
+			BS_RTTI_MEMBER_PLAIN(fixedHeight, 33)
+
+			BS_RTTI_MEMBER_PLAIN(subStyles, 34)
+		BS_END_RTTI_MEMBERS
+			
 	public:
 		GUIElementStyleRTTI()
-		{
-			addReflectableField("font", 0, &GUIElementStyleRTTI::getFont, &GUIElementStyleRTTI::setFont);
-			addPlainField("fontSize", 1, &GUIElementStyleRTTI::getFontSize, &GUIElementStyleRTTI::setFontSize);
-			addPlainField("textHorzAlign", 2, &GUIElementStyleRTTI::getTextHorzAlign, &GUIElementStyleRTTI::setTextHorzAlign);
-			addPlainField("textVertAlign", 3, &GUIElementStyleRTTI::getTextVertAlign, &GUIElementStyleRTTI::setTextVertAlign);
-			addPlainField("imagePosition", 4, &GUIElementStyleRTTI::getImagePosition, &GUIElementStyleRTTI::setImagePosition);
-			addPlainField("wordWrap", 5, &GUIElementStyleRTTI::getWordWrap, &GUIElementStyleRTTI::setWordWrap);
-
-			addReflectableField("normalTex", 6, &GUIElementStyleRTTI::getNormalTexture, &GUIElementStyleRTTI::setNormalTexture);
-			addPlainField("normalTextColor", 7, &GUIElementStyleRTTI::getNormalTextColor, &GUIElementStyleRTTI::setNormalTextColor);
-			addReflectableField("hoverTex", 8, &GUIElementStyleRTTI::getHoverTexture, &GUIElementStyleRTTI::setHoverTexture);
-			addPlainField("hoverTextColor", 9, &GUIElementStyleRTTI::getHoverTextColor, &GUIElementStyleRTTI::setHoverTextColor);
-			addReflectableField("activeTex", 10, &GUIElementStyleRTTI::getActiveTexture, &GUIElementStyleRTTI::setActiveTexture);
-			addPlainField("activeTextColor", 11, &GUIElementStyleRTTI::getActiveTextColor, &GUIElementStyleRTTI::setActiveTextColor);
-			addReflectableField("focusedTex", 12, &GUIElementStyleRTTI::getFocusedTexture, &GUIElementStyleRTTI::setFocusedTexture);
-			addPlainField("focusedTextColor", 13, &GUIElementStyleRTTI::getFocusedTextColor, &GUIElementStyleRTTI::setFocusedTextColor);
-
-			addReflectableField("normalOnTex", 14, &GUIElementStyleRTTI::getNormalOnTexture, &GUIElementStyleRTTI::setNormalOnTexture);
-			addPlainField("normalOnTextColor", 15, &GUIElementStyleRTTI::getNormalOnTextColor, &GUIElementStyleRTTI::setNormalOnTextColor);
-			addReflectableField("hoverOnTex", 16, &GUIElementStyleRTTI::getHoverOnTexture, &GUIElementStyleRTTI::setHoverOnTexture);
-			addPlainField("hoverOnTextColor", 17, &GUIElementStyleRTTI::getHoverOnTextColor, &GUIElementStyleRTTI::setHoverOnTextColor);
-			addReflectableField("activeOnTex", 18, &GUIElementStyleRTTI::getActiveOnTexture, &GUIElementStyleRTTI::setActiveOnTexture);
-			addPlainField("activeOnTextColor", 19, &GUIElementStyleRTTI::getActiveOnTextColor, &GUIElementStyleRTTI::setActiveOnTextColor);
-			addReflectableField("focusedOnTex", 20, &GUIElementStyleRTTI::getFocusedOnTexture, &GUIElementStyleRTTI::setFocusedOnTexture);
-			addPlainField("focusedOnTextColor", 21, &GUIElementStyleRTTI::getFocusedOnTextColor, &GUIElementStyleRTTI::setFocusedOnTextColor);
-
-			addPlainField("border", 22, &GUIElementStyleRTTI::getBorder, &GUIElementStyleRTTI::setBorder);
-			addPlainField("margins", 23, &GUIElementStyleRTTI::getMargins, &GUIElementStyleRTTI::setMargins);
-			addPlainField("contentOffset", 24, &GUIElementStyleRTTI::getContentOffset, &GUIElementStyleRTTI::setContentOffset);
-			addPlainField("padding", 25, &GUIElementStyleRTTI::getPadding, &GUIElementStyleRTTI::setPadding);
-
-			addPlainField("width", 26, &GUIElementStyleRTTI::getWidth, &GUIElementStyleRTTI::setWidth);
-			addPlainField("height", 27, &GUIElementStyleRTTI::getHeight, &GUIElementStyleRTTI::setHeight);
-			addPlainField("minWidth", 28, &GUIElementStyleRTTI::getMinWidth, &GUIElementStyleRTTI::setMinWidth);
-			addPlainField("maxWidth", 29, &GUIElementStyleRTTI::getMaxWidth, &GUIElementStyleRTTI::setMaxWidth);
-			addPlainField("minHeight", 30, &GUIElementStyleRTTI::getMinHeight, &GUIElementStyleRTTI::setMinHeight);
-			addPlainField("maxHeight", 31, &GUIElementStyleRTTI::getMaxHeight, &GUIElementStyleRTTI::setMaxHeight);
-			addPlainField("fixedWidth", 32, &GUIElementStyleRTTI::getFixedWidth, &GUIElementStyleRTTI::setFixedWidth);
-			addPlainField("fixedHeight", 33, &GUIElementStyleRTTI::getFixedHeight, &GUIElementStyleRTTI::setFixedHeight);
-
-			addPlainField("subStyles", 34, &GUIElementStyleRTTI::getSubStyles, &GUIElementStyleRTTI::setSubStyles);
-		}
+			:mInitMembers(this)
+		{ }
 
 		const String& getRTTIName() override
 		{

+ 10 - 25
Source/BansheeEngine/Include/BsGameSettingsRTTI.h

@@ -16,34 +16,19 @@ namespace BansheeEngine
 	class BS_EXPORT GameSettingsRTTI : public RTTIType <GameSettings, IReflectable, GameSettingsRTTI>
 	{
 	private:
-		String& getMainSceneUUID(GameSettings* obj) { return obj->mainSceneUUID; }
-		void setMainSceneUUID(GameSettings* obj, String& val) { obj->mainSceneUUID = val; }
-
-		bool& getFullscreen(GameSettings* obj) { return obj->fullscreen; }
-		void setFullscreen(GameSettings* obj, bool& val) { obj->fullscreen = val; }
-
-		bool& getUseDesktopResolution(GameSettings* obj) { return obj->useDesktopResolution; }
-		void setUseDesktopResolution(GameSettings* obj, bool& val) { obj->useDesktopResolution = val; }
-
-		UINT32& getResolutionWidth(GameSettings* obj) { return obj->resolutionWidth; }
-		void setResolutionWidth(GameSettings* obj, UINT32& val) { obj->resolutionWidth = val; }
-
-		UINT32& getResolutionHeight(GameSettings* obj) { return obj->resolutionHeight; }
-		void setResolutionHeight(GameSettings* obj, UINT32& val) { obj->resolutionHeight = val; }
-
-		WString& getTitlebarText(GameSettings* obj) { return obj->titleBarText; }
-		void setTitlebarText(GameSettings* obj, WString& val) { obj->titleBarText = val; }
+		BS_BEGIN_RTTI_MEMBERS
+			BS_RTTI_MEMBER_PLAIN(mainSceneUUID, 0)
+			BS_RTTI_MEMBER_PLAIN(fullscreen, 1)
+			BS_RTTI_MEMBER_PLAIN(useDesktopResolution, 2)
+			BS_RTTI_MEMBER_PLAIN(resolutionWidth, 3)
+			BS_RTTI_MEMBER_PLAIN(resolutionHeight, 4)
+			BS_RTTI_MEMBER_PLAIN(titleBarText, 5)
+		BS_END_RTTI_MEMBERS
 
 	public:
 		GameSettingsRTTI()
-		{
-			addPlainField("mainSceneUUID", 0, &GameSettingsRTTI::getMainSceneUUID, &GameSettingsRTTI::setMainSceneUUID);
-			addPlainField("fullscreen", 1, &GameSettingsRTTI::getFullscreen, &GameSettingsRTTI::setFullscreen);
-			addPlainField("useDesktopResolution", 2, &GameSettingsRTTI::getUseDesktopResolution, &GameSettingsRTTI::setUseDesktopResolution);
-			addPlainField("resolutionWidth", 3, &GameSettingsRTTI::getResolutionWidth, &GameSettingsRTTI::setResolutionWidth);
-			addPlainField("resolutionHeight", 4, &GameSettingsRTTI::getResolutionHeight, &GameSettingsRTTI::setResolutionHeight);
-			addPlainField("titleBarText", 5, &GameSettingsRTTI::getTitlebarText, &GameSettingsRTTI::setTitlebarText);
-		}
+			:mInitMembers(this)
+		{ }
 
 		const String& getRTTIName() override
 		{

+ 14 - 41
Source/BansheeEngine/Include/BsLightRTTI.h

@@ -16,49 +16,22 @@ namespace BansheeEngine
 	class BS_EXPORT LightRTTI : public RTTIType <Light, IReflectable, LightRTTI>
 	{
 	private:
-		Vector3& getPosition(Light* obj) { return obj->mPosition; }
-		void setPosition(Light* obj, Vector3& position) { obj->mPosition = position; }
-
-		Quaternion& getRotation(Light* obj) { return obj->mRotation; }
-		void setRotation(Light* obj, Quaternion& rotation) { obj->mRotation = rotation; }
-
-		LightType& getType(Light* obj) { return obj->mType; }
-		void setType(Light* obj, LightType& type) { obj->mType = type; }
-
-		bool& getCastsShadow(Light* obj) { return obj->mCastsShadows; }
-		void setCastsShadow(Light* obj, bool& castsShadow) { obj->mCastsShadows = castsShadow; }
-
-		Color& getColor(Light* obj) { return obj->mColor; }
-		void setColor(Light* obj, Color& color) { obj->mColor = color; }
-
-		float& getRange(Light* obj) { return obj->mRange; }
-		void setRange(Light* obj, float& range) { obj->mRange = range; }
-
-		float& getIntensity(Light* obj) { return obj->mIntensity; }
-		void setIntensity(Light* obj, float& intensity) { obj->mIntensity = intensity; }
-
-		Degree& getSpotAngle(Light* obj) { return obj->mSpotAngle; }
-		void setSpotAngle(Light* obj, Degree& spotAngle) { obj->mSpotAngle = spotAngle; }
-
-		Degree& getSpotFalloffAngle(Light* obj) { return obj->mSpotFalloffAngle; }
-		void setSpotFalloffAngle(Light* obj, Degree& spotAngle) { obj->mSpotFalloffAngle = spotAngle; }
-
-		bool& getPhysCorrectAtten(Light* obj) { return obj->mPhysCorrectAtten; }
-		void setPhysCorrectAtten(Light* obj, bool& value) { obj->mPhysCorrectAtten = value; }
+		BS_BEGIN_RTTI_MEMBERS
+			BS_RTTI_MEMBER_PLAIN(mPosition, 0)
+			BS_RTTI_MEMBER_PLAIN(mRotation, 1)
+			BS_RTTI_MEMBER_PLAIN(mType, 2)
+			BS_RTTI_MEMBER_PLAIN(mCastsShadows, 3)
+			BS_RTTI_MEMBER_PLAIN(mColor, 4)
+			BS_RTTI_MEMBER_PLAIN(mRange, 5)
+			BS_RTTI_MEMBER_PLAIN(mIntensity, 6)
+			BS_RTTI_MEMBER_PLAIN(mSpotAngle, 7)
+			BS_RTTI_MEMBER_PLAIN(mSpotFalloffAngle, 8)
+			BS_RTTI_MEMBER_PLAIN(mPhysCorrectAtten, 9)
+		BS_END_RTTI_MEMBERS
 	public:
 		LightRTTI()
-		{
-			addPlainField("mPosition", 0, &LightRTTI::getPosition, &LightRTTI::setPosition);
-			addPlainField("mRotation", 1, &LightRTTI::getRotation, &LightRTTI::setRotation);
-			addPlainField("mType", 2, &LightRTTI::getType, &LightRTTI::setType);
-			addPlainField("mCastsShadow", 3, &LightRTTI::getCastsShadow, &LightRTTI::setCastsShadow);
-			addPlainField("mColor", 4, &LightRTTI::getColor, &LightRTTI::setColor);
-			addPlainField("mRange", 5, &LightRTTI::getRange, &LightRTTI::setRange);
-			addPlainField("mIntensity", 6, &LightRTTI::getIntensity, &LightRTTI::setIntensity);
-			addPlainField("mSpotAngle", 7, &LightRTTI::getSpotAngle, &LightRTTI::setSpotAngle);
-			addPlainField("mSpotFalloffAngle", 8, &LightRTTI::getSpotFalloffAngle, &LightRTTI::setSpotFalloffAngle);
-			addPlainField("mPhysCorrectAtten", 9, &LightRTTI::getPhysCorrectAtten, &LightRTTI::setPhysCorrectAtten);
-		}
+			:mInitMembers(this)
+		{ }
 
 		void onDeserializationEnded(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
 		{

+ 6 - 5
Source/BansheeEngine/Include/BsScriptCodeImportOptionsRTTI.h

@@ -16,13 +16,14 @@ namespace BansheeEngine
 	class BS_EXPORT ScriptCodeImportOptionsRTTI : public RTTIType <ScriptCodeImportOptions, ImportOptions, ScriptCodeImportOptionsRTTI>
 	{
 	private:
-		bool& getEditorScript(ScriptCodeImportOptions* obj) { return obj->mEditorScript; }
-		void setEditorScript(ScriptCodeImportOptions* obj, bool& val) { obj->mEditorScript = val; }
+		BS_BEGIN_RTTI_MEMBERS
+			BS_RTTI_MEMBER_PLAIN(mEditorScript, 0)
+		BS_END_RTTI_MEMBERS
+
 	public:
 		ScriptCodeImportOptionsRTTI()
-		{
-			addPlainField("mEditorScript", 0, &ScriptCodeImportOptionsRTTI::getEditorScript, &ScriptCodeImportOptionsRTTI::setEditorScript);
-		}
+			:mInitMembers(this)
+		{ }
 
 		const String& getRTTIName() override
 		{

+ 6 - 8
Source/BansheeEngine/Include/BsScriptCodeRTTI.h

@@ -16,17 +16,15 @@ namespace BansheeEngine
 	class BS_EXPORT ScriptCodeRTTI : public RTTIType <ScriptCode, Resource, ScriptCodeRTTI>
 	{
 	private:
-		WString& getString(ScriptCode* obj) { return obj->mString; }
-		void setString(ScriptCode* obj, WString& val) { obj->mString = val; }
+		BS_BEGIN_RTTI_MEMBERS
+			BS_RTTI_MEMBER_PLAIN(mString, 0)
+			BS_RTTI_MEMBER_PLAIN(mEditorScript, 1)
+		BS_END_RTTI_MEMBERS
 
-		bool& getEditorScript(ScriptCode* obj) { return obj->mEditorScript; }
-		void setEditorScript(ScriptCode* obj, bool& val) { obj->mEditorScript = val; }
 	public:
 		ScriptCodeRTTI()
-		{
-			addPlainField("mString", 0, &ScriptCodeRTTI::getString, &ScriptCodeRTTI::setString);
-			addPlainField("mEditorScript", 1, &ScriptCodeRTTI::getEditorScript, &ScriptCodeRTTI::setEditorScript);
-		}
+			:mInitMembers(this)
+		{ }
 
 		const String& getRTTIName() override
 		{

+ 7 - 13
Source/BansheeEngine/Include/BsSpriteTextureRTTI.h

@@ -16,22 +16,16 @@ namespace BansheeEngine
 	class BS_EXPORT SpriteTextureRTTI : public RTTIType<SpriteTexture, Resource, SpriteTextureRTTI>
 	{
 	private:
-		HTexture& getAtlasTexture(SpriteTexture* obj) { return obj->mAtlasTexture; }
-		void setAtlasTexture(SpriteTexture* obj, HTexture& val) { obj->mAtlasTexture = val; } 
-
-		Vector2& getUVOffset(SpriteTexture* obj) { return obj->mUVOffset; }
-		void setUVOffset(SpriteTexture* obj, Vector2& val) { obj->mUVOffset = val; } 
-
-		Vector2& getUVScale(SpriteTexture* obj) { return obj->mUVScale; }
-		void setUVScale(SpriteTexture* obj, Vector2& val) { obj->mUVScale = val; } 
+		BS_BEGIN_RTTI_MEMBERS
+			BS_RTTI_MEMBER_REFL(mAtlasTexture, 0)
+			BS_RTTI_MEMBER_PLAIN(mUVOffset, 1)
+			BS_RTTI_MEMBER_PLAIN(mUVScale, 2)
+		BS_END_RTTI_MEMBERS
 
 	public:
 		SpriteTextureRTTI()
-		{
-			addReflectableField("mAtlasTexture", 0, &SpriteTextureRTTI::getAtlasTexture, &SpriteTextureRTTI::setAtlasTexture);
-			addPlainField("mUVOffset", 1, &SpriteTextureRTTI::getUVOffset, &SpriteTextureRTTI::setUVOffset);
-			addPlainField("mUVScale", 2, &SpriteTextureRTTI::getUVScale, &SpriteTextureRTTI::setUVScale);
-		}
+			:mInitMembers(this)
+		{ }
 
 		const String& getRTTIName() override
 		{