Scriptname RaceMenuPluginFemales extends RaceMenuBase

bool Property MAGIC_ENABLED = true AutoReadOnly ; Set this to false to rebuild if you don't want magic options

;Common Nodes
string Property NINODE_LEFT_BREAST = "NPC L Breast" AutoReadOnly
string Property NINODE_RIGHT_BREAST = "NPC R Breast" AutoReadOnly
string Property NINODE_LEFT_BREAST_FORWARD = "NPC L Breast01" AutoReadOnly
string Property NINODE_RIGHT_BREAST_FORWARD = "NPC R Breast01" AutoReadOnly
string Property NINODE_LEFT_BUTT = "NPC L Butt" AutoReadOnly
string Property NINODE_RIGHT_BUTT = "NPC R Butt" AutoReadOnly
string Property NINODE_LEFT_PREBREAST = "NPC L PreBreast" AutoReadOnly
string Property NINODE_RIGHT_PREBREAST = "NPC R PreBreast" AutoReadOnly

string Property NINODE_SHOUT = "NPC Head MagicNode [Hmag]" AutoReadOnly
string Property NINODE_MAGIC_LEFT = "NPC L MagicNode [LMag]" AutoReadOnly
string Property NINODE_MAGIC_RIGHT = "NPC R MagicNode [RMag]" AutoReadOnly

string Property NINODE_HEAD = "NPC Head [Head]" AutoReadOnly

;XPMSE specific
string Property NINODE_LEFT_PREBREAST_CME = "CME L PreBreast" AutoReadOnly
string Property NINODE_RIGHT_PREBREAST_CME = "CME R PreBreast" AutoReadOnly

string Property NINODE_BREAST_MAGIC_LEFT = "BreastMagic L" AutoReadOnly
string Property NINODE_BREAST_MAGIC_RIGHT = "BreastMagic R" AutoReadOnly
string Property NINODE_BREAST_MAGIC_RUNE_LEFT = "BreastMagicRune L" AutoReadOnly
string Property NINODE_BREAST_MAGIC_RUNE_RIGHT = "BreastMagicRune R" AutoReadOnly
string Property NINODE_SCHLONG_MAGIC = "SchlongMagic" AutoReadOnly

string Property NINODE_LEFT_HAND_CME = "CME L Hand [LHnd]" AutoReadOnly
string Property NINODE_RIGHT_HAND_CME = "CME R Hand [RHnd]" AutoReadOnly	
string Property NINODE_BREAST_MAGIC_LEFT_CME = "CME BreastMagic L" AutoReadOnly
string Property NINODE_BREAST_MAGIC_RIGHT_CME = "CME BreastMagic R" AutoReadOnly
string Property NINODE_BREAST_MAGIC_RUNE_LEFT_CME = "CME BreastMagicRune L" AutoReadOnly
string Property NINODE_BREAST_MAGIC_RUNE_RIGHT_CME = "CME BreastMagicRune R" AutoReadOnly
string Property NINODE_SCHLONG_MAGIC_CME = "CME SchlongMagic" AutoReadOnly

;Callbacks Table
string Property CALLBACK_BREAST_SCALE = "XPMSEChangeBreastScale" AutoReadOnly
string Property CALLBACK_BREAST_LEFT_SCALE = "XPMSEChangeLeftBreastScale" AutoReadOnly
string Property CALLBACK_BREAST_RIGHT_SCALE = "XPMSEChangeRightBreastScale" AutoReadOnly
string Property CALLBACK_BREAST_FORWARD_LEFT_SCALE = "XPMSEChangeLeftBreastScaleCurve" AutoReadOnly
string Property CALLBACK_BREAST_FORWARD_RIGHT_SCALE = "XPMSEChangeRightBreastScaleCurve" AutoReadOnly
string Property CALLBACK_BREAST_FULLNESS_LEFT = "XPMSEChangeLeftBreastFullness" AutoReadOnly
string Property CALLBACK_BREAST_FULLNESS_RIGHT = "XPMSEChangeRightBreastFullness" AutoReadOnly
string Property CALLBACK_BREAST_LEFT_SAGNESS = "XPMSEChangeLeftBreastSagness" AutoReadOnly
string Property CALLBACK_BREAST_RIGHT_SAGNESS = "XPMSEChangeRightBreastSagness" AutoReadOnly
string Property CALLBACK_BUTT_SCALE = "XPMSEChangeButtScale" AutoReadOnly
string Property CALLBACK_BUTT_LEFT_SCALE = "XPMSEChangeLeftButtScale" AutoReadOnly
string Property CALLBACK_BUTT_RIGHT_SCALE = "XPMSEChangeRightButtScale" AutoReadOnly
string Property CALLBACK_SHOUT_STYLE = "XPMSEChangeShoutStyle" AutoReadOnly
string Property CALLBACK_MAGIC_LEFT_STYLE = "XPMSEChangeMagicLeftStyle" AutoReadOnly
string Property CALLBACK_MAGIC_RIGHT_STYLE = "XPMSEChangeMagicRightStyle" AutoReadOnly
string Property CALLBACK_BREAST_MAGIC_LEFT_POSX = "XPMSEChangeBreastMagicLPosX" AutoReadOnly
string Property CALLBACK_BREAST_MAGIC_LEFT_POSY = "XPMSEChangeBreastMagicLPosY" AutoReadOnly
string Property CALLBACK_BREAST_MAGIC_LEFT_POSZ = "XPMSEChangeBreastMagicLPosZ" AutoReadOnly
string Property CALLBACK_BREAST_MAGIC_RIGHT_POSX = "XPMSEChangeBreastMagicRPosX" AutoReadOnly
string Property CALLBACK_BREAST_MAGIC_RIGHT_POSY = "XPMSEChangeBreastMagicRPosY" AutoReadOnly
string Property CALLBACK_BREAST_MAGIC_RIGHT_POSZ = "XPMSEChangeBreastMagicRPosZ" AutoReadOnly
string Property CALLBACK_BREAST_MAGIC_RUNE_LEFT_POSX = "XPMSEChangeBreastMagicRuneLPosX" AutoReadOnly
string Property CALLBACK_BREAST_MAGIC_RUNE_LEFT_POSY = "XPMSEChangeBreastMagicRuneLPosY" AutoReadOnly
string Property CALLBACK_BREAST_MAGIC_RUNE_LEFT_POSZ = "XPMSEChangeBreastMagicRuneLPosZ" AutoReadOnly
string Property CALLBACK_BREAST_MAGIC_RUNE_RIGHT_POSX = "XPMSEChangeBreastMagicRuneRPosX" AutoReadOnly
string Property CALLBACK_BREAST_MAGIC_RUNE_RIGHT_POSY = "XPMSEChangeBreastMagicRuneRPosY" AutoReadOnly
string Property CALLBACK_BREAST_MAGIC_RUNE_RIGHT_POSZ = "XPMSEChangeBreastMagicRuneRPosZ" AutoReadOnly

; If you are making your own scaling mod, use your own key name
string Property MOD_OVERRIDE_KEY = "RMFPlugin" AutoReadOnly

string Property RMF_BREASTS_KEY = "RMFPlugin_Breasts" AutoReadOnly
string Property RMF_BUTT_KEY = "RMFPlugin_Butt" AutoReadOnly

string Property CATEGORY_KEY = "rsm_body_scale" AutoReadOnly
string Property CATEGORY_MAGIC = "rsm_magic" AutoReadOnly

;Arrays
float[] _breast_left_sagness
float[] _breast_right_sagness

float[] _breastMagic_Position
float[] _breastMagicLeft_Position
float[] _breastMagicRune_Position
float[] _breastMagicRuneLeft_Position

float _shout_Style
float _magic_Style
float _magicLeft_Style

; NiOverride version data
int Property NIOVERRIDE_VERSION = 3 AutoReadOnly
int Property NIOVERRIDE_SCRIPT_VERSION = 2 AutoReadOnly

bool _versionValid = false

Event OnCategoryRequest()
	AddCategory(CATEGORY_KEY, "$BODY SCALES")
	AddCategory(CATEGORY_MAGIC, "$CATEGORY MAGIC")
EndEvent

Event OnStartup()
	parent.OnStartup()

	int nioverrideVersion = SKSE.GetPluginVersion("NiOverride")
	int nioverrideScriptVersion = NiOverride.GetScriptVersion()

	; Check NiOverride version, disable most features if this fails
	if nioverrideVersion >= NIOVERRIDE_VERSION && nioverrideScriptVersion >= NIOVERRIDE_SCRIPT_VERSION
		_versionValid = true
	Else
		_versionValid = false
	Endif
EndEvent

; Add Custom sliders here
Event OnSliderRequest(Actor target, ActorBase targetBase, Race actorRace, bool isFemale)
	If isFemale == true		
		If NetImmerse.HasNode(target, NINODE_LEFT_BREAST, false) && NetImmerse.HasNode(target, NINODE_RIGHT_BREAST, false)
			AddSliderEx("$Breasts", CATEGORY_KEY, CALLBACK_BREAST_SCALE, 0.1, 3.00, 0.01, GetNodeScaleEX(target, isFemale, NINODE_LEFT_BREAST, RMF_BREASTS_KEY))
			AddSliderEx("$Left Breast", CATEGORY_KEY, CALLBACK_BREAST_LEFT_SCALE, 0.1, 3.00, 0.01, GetNodeScale(target, isFemale, NINODE_LEFT_BREAST))
			AddSliderEx("$Right Breast", CATEGORY_KEY, CALLBACK_BREAST_RIGHT_SCALE, 0.1, 3.00, 0.01, GetNodeScale(target, isFemale, NINODE_RIGHT_BREAST))
		Endif
		If  NetImmerse.HasNode(target, NINODE_LEFT_BREAST_FORWARD, false) && NetImmerse.HasNode(target, NINODE_RIGHT_BREAST_FORWARD, false)
			AddSliderEx("$Left Breast Curve", CATEGORY_KEY, CALLBACK_BREAST_FORWARD_LEFT_SCALE, 0.1, 3.00, 0.01, GetNodeScale(target, isFemale, NINODE_LEFT_BREAST_FORWARD))
			AddSliderEx("$Right Breast Curve", CATEGORY_KEY, CALLBACK_BREAST_FORWARD_RIGHT_SCALE, 0.1, 3.00, 0.01, GetNodeScale(target, isFemale, NINODE_RIGHT_BREAST_FORWARD))
		Endif
		If  NetImmerse.HasNode(target, NINODE_LEFT_PREBREAST, false) && NetImmerse.HasNode(target, NINODE_RIGHT_PREBREAST, false)
			AddSliderEx("$Left Breast Fullness", CATEGORY_KEY, CALLBACK_BREAST_FULLNESS_LEFT, 0.1, 3.00, 0.01, GetNodeScale(target, isFemale, NINODE_LEFT_PREBREAST))
			AddSliderEx("$Right Breast Fullness", CATEGORY_KEY, CALLBACK_BREAST_FULLNESS_RIGHT, 0.1, 3.00, 0.01, GetNodeScale(target, isFemale, NINODE_RIGHT_PREBREAST))
		Endif
		If  NetImmerse.HasNode(target, NINODE_LEFT_PREBREAST_CME, false)
			_breast_left_sagness = GetNodeRotation(target, isFemale, NINODE_LEFT_PREBREAST_CME)
			AddSliderEx("$Left Breast Sagness", CATEGORY_KEY, CALLBACK_BREAST_LEFT_SAGNESS, -40.0, 40.0, 0.01, _breast_left_sagness[0])
		Endif
		If  NetImmerse.HasNode(target, NINODE_RIGHT_PREBREAST_CME, false)
			_breast_right_sagness = GetNodeRotation(target, isFemale, NINODE_RIGHT_PREBREAST_CME)
			AddSliderEx("$Right Breast Sagness", CATEGORY_KEY, CALLBACK_BREAST_RIGHT_SAGNESS, -40.0, 40.0, 0.01, _breast_right_sagness[0])
		Endif
		If NetImmerse.HasNode(target, NINODE_LEFT_BUTT, false) && NetImmerse.HasNode(target, NINODE_RIGHT_BUTT, false)
			AddSliderEx("$Glute", CATEGORY_KEY, CALLBACK_BUTT_SCALE, 0.1, 3.00, 0.01, GetNodeScaleEX(target, isFemale, NINODE_LEFT_BUTT, RMF_BUTT_KEY))
			AddSliderEx("$Left Glute", CATEGORY_KEY, CALLBACK_BUTT_LEFT_SCALE, 0.1, 3.00, 0.01, GetNodeScale(target, isFemale, NINODE_LEFT_BUTT))
			AddSliderEx("$Right Glute", CATEGORY_KEY, CALLBACK_BUTT_RIGHT_SCALE, 0.1, 3.00, 0.01, GetNodeScale(target, isFemale, NINODE_RIGHT_BUTT))
		Endif
	Endif
	If MAGIC_ENABLED
		if isFemale == true	
			If NetImmerse.HasNode(target, NINODE_RIGHT_HAND_CME, false) && NetImmerse.HasNode(target, NINODE_BREAST_MAGIC_RIGHT, false)
				AddSliderEx("$Magic Style", CATEGORY_MAGIC, CALLBACK_MAGIC_RIGHT_STYLE, 0.00, 1.00, 1.00, _magic_Style)
			Endif
			If NetImmerse.HasNode(target, NINODE_BREAST_MAGIC_RIGHT_CME, false)
				_breastMagic_Position = GetNodePosition(target, isFemale, NINODE_BREAST_MAGIC_RIGHT_CME)
				AddSliderEx("$Breast Magic Pos X", CATEGORY_MAGIC, CALLBACK_BREAST_MAGIC_RIGHT_POSX, -10.00, 10.00, 0.01, _breastMagic_Position[0])
				AddSliderEx("$Breast Magic Pos Y", CATEGORY_MAGIC, CALLBACK_BREAST_MAGIC_RIGHT_POSY, -10.00, 10.00, 0.01, _breastMagic_Position[1])
				AddSliderEx("$Breast Magic Pos Z", CATEGORY_MAGIC, CALLBACK_BREAST_MAGIC_RIGHT_POSZ, -10.00, 10.00, 0.01, _breastMagic_Position[2])
			Endif
			If NetImmerse.HasNode(target, NINODE_LEFT_HAND_CME, false) && NetImmerse.HasNode(target, NINODE_BREAST_MAGIC_LEFT, false)
				AddSliderEx("$Magic Left Style", CATEGORY_MAGIC, CALLBACK_MAGIC_LEFT_STYLE, 0.00, 1.00, 1.00, _magicLeft_Style)
			Endif
			If NetImmerse.HasNode(target, NINODE_BREAST_MAGIC_LEFT_CME, false)
				_breastMagicLeft_Position = GetNodePosition(target, isFemale, NINODE_BREAST_MAGIC_LEFT_CME)
				AddSliderEx("$Breast Magic Left Pos X", CATEGORY_MAGIC, CALLBACK_BREAST_MAGIC_LEFT_POSX, -10.00, 10.00, 0.01, _breastMagicLeft_Position[0])
				AddSliderEx("$Breast Magic Left Pos Y", CATEGORY_MAGIC, CALLBACK_BREAST_MAGIC_LEFT_POSY, -10.00, 10.00, 0.01, _breastMagicLeft_Position[1])
				AddSliderEx("$Breast Magic Left Pos Z", CATEGORY_MAGIC, CALLBACK_BREAST_MAGIC_LEFT_POSZ, -10.00, 10.00, 0.01, _breastMagicLeft_Position[2])
			Endif
			If NetImmerse.HasNode(target, NINODE_BREAST_MAGIC_RUNE_RIGHT_CME, false)
				_breastMagicRune_Position = GetNodePosition(target, isFemale, NINODE_BREAST_MAGIC_RUNE_RIGHT_CME)
				AddSliderEx("$Breast Magic Rune Pos X", CATEGORY_MAGIC, CALLBACK_BREAST_MAGIC_RUNE_RIGHT_POSX, -10.00, 10.00, 0.01, _breastMagicRune_Position[0])
				AddSliderEx("$Breast Magic Rune Pos Y", CATEGORY_MAGIC, CALLBACK_BREAST_MAGIC_RUNE_RIGHT_POSY, -10.00, 10.00, 0.01, _breastMagicRune_Position[1])
				AddSliderEx("$Breast Magic Rune Pos Z", CATEGORY_MAGIC, CALLBACK_BREAST_MAGIC_RUNE_RIGHT_POSZ, -10.00, 10.00, 0.01, _breastMagicRune_Position[2])
			Endif
			If NetImmerse.HasNode(target, NINODE_BREAST_MAGIC_RUNE_LEFT_CME, false)
				_breastMagicRuneLeft_Position = GetNodePosition(target, isFemale, NINODE_BREAST_MAGIC_RUNE_LEFT_CME)
				AddSliderEx("$Breast Magic Rune Left Pos X", CATEGORY_MAGIC, CALLBACK_BREAST_MAGIC_RUNE_LEFT_POSX, -10.00, 10.00, 0.01, _breastMagicRuneLeft_Position[0])
				AddSliderEx("$Breast Magic Rune Left Pos Y", CATEGORY_MAGIC, CALLBACK_BREAST_MAGIC_RUNE_LEFT_POSY, -10.00, 10.00, 0.01, _breastMagicRuneLeft_Position[1])
				AddSliderEx("$Breast Magic Rune Left Pos Z", CATEGORY_MAGIC, CALLBACK_BREAST_MAGIC_RUNE_LEFT_POSZ, -10.00, 10.00, 0.01, _breastMagicRuneLeft_Position[2])
			Endif
			If NetImmerse.HasNode(target, NINODE_SCHLONG_MAGIC, false)
				AddSliderEx("$Shout Style", CATEGORY_MAGIC, CALLBACK_SHOUT_STYLE, 0.00, 1.00, 1.00, _shout_Style)
			Endif
		Endif
	Endif
EndEvent

Event OnSliderChanged(string callback, float value)
	bool isFemale = _targetActorBase.GetSex() as bool
	If _versionValid
		If callback == CALLBACK_BREAST_SCALE
			SetNodeScaleEX(_targetActor, isFemale, NINODE_LEFT_BREAST, value, RMF_BREASTS_KEY)
			SetNodeScaleEX(_targetActor, isFemale, NINODE_RIGHT_BREAST, value, RMF_BREASTS_KEY)
			SetNodeScaleEX(_targetActor, isFemale, NINODE_LEFT_BREAST_FORWARD, 1/value, RMF_BREASTS_KEY)
			SetNodeScaleEX(_targetActor, isFemale, NINODE_RIGHT_BREAST_FORWARD, 1/value, RMF_BREASTS_KEY)
		Elseif callback == CALLBACK_BREAST_LEFT_SCALE
			SetNodeScale(_targetActor, isFemale, NINODE_LEFT_BREAST, value)
		Elseif callback == CALLBACK_BREAST_RIGHT_SCALE
			SetNodeScale(_targetActor, isFemale, NINODE_RIGHT_BREAST, value)
		Elseif callback == CALLBACK_BREAST_FORWARD_LEFT_SCALE
			SetNodeScale(_targetActor, isFemale, NINODE_LEFT_BREAST_FORWARD, value)
		Elseif callback == CALLBACK_BREAST_FORWARD_RIGHT_SCALE
			SetNodeScale(_targetActor, isFemale, NINODE_RIGHT_BREAST_FORWARD, value)
		Elseif callback == CALLBACK_BREAST_FULLNESS_LEFT
			SetNodeScale(_targetActor, isFemale, NINODE_LEFT_PREBREAST, value)
		Elseif callback == CALLBACK_BREAST_FULLNESS_RIGHT
			SetNodeScale(_targetActor, isFemale, NINODE_RIGHT_PREBREAST, value)
		Elseif callback == CALLBACK_BUTT_SCALE
			SetNodeScaleEX(_targetActor, isFemale, NINODE_LEFT_BUTT, value, RMF_BUTT_KEY)
			SetNodeScaleEX(_targetActor, isFemale, NINODE_RIGHT_BUTT, value, RMF_BUTT_KEY)
		Elseif callback == CALLBACK_BUTT_LEFT_SCALE
			SetNodeScale(_targetActor, isFemale, NINODE_LEFT_BUTT, value)
		Elseif callback == CALLBACK_BUTT_RIGHT_SCALE
			SetNodeScale(_targetActor, isFemale, NINODE_RIGHT_BUTT, value)
		Elseif callback == CALLBACK_BREAST_LEFT_SAGNESS
			_breast_left_sagness[0] = value
			SetNodeRotation(_targetActor, isFemale, NINODE_LEFT_PREBREAST_CME, _breast_left_sagness)
		Elseif callback == CALLBACK_BREAST_RIGHT_SAGNESS
			_breast_right_sagness[0] = value
			SetNodeRotation(_targetActor, isFemale, NINODE_RIGHT_PREBREAST_CME, _breast_right_sagness)	
		Elseif callback == CALLBACK_SHOUT_STYLE
			If value == 0.0
				_shout_Style = value
				SetNodeParent(_targetActor, isFemale, NINODE_SHOUT, NINODE_HEAD)
			ElseIf value == 1.0
				_shout_Style = value
				SetNodeParent(_targetActor, isFemale, NINODE_SHOUT, NINODE_SCHLONG_MAGIC)
			EndIf
		Elseif callback == CALLBACK_MAGIC_RIGHT_STYLE
			If value == 0.0
				_magic_Style = value
				SetNodeParent(_targetActor, isFemale, NINODE_MAGIC_RIGHT, NINODE_RIGHT_HAND_CME)
			ElseIf value == 1.0
				_magic_Style = value
				SetNodeParent(_targetActor, isFemale, NINODE_MAGIC_RIGHT, NINODE_BREAST_MAGIC_RIGHT)
			EndIf
		Elseif callback == CALLBACK_MAGIC_LEFT_STYLE
			If value == 0.0
				_magicLeft_Style = value
				SetNodeParent(_targetActor, isFemale, NINODE_MAGIC_LEFT, NINODE_LEFT_HAND_CME)
			ElseIf value == 1.0
				_magicLeft_Style = value
				SetNodeParent(_targetActor, isFemale, NINODE_MAGIC_LEFT, NINODE_BREAST_MAGIC_LEFT)
			EndIf
		Elseif callback == CALLBACK_BREAST_MAGIC_RIGHT_POSX || callback == CALLBACK_BREAST_MAGIC_RIGHT_POSY || callback == CALLBACK_BREAST_MAGIC_RIGHT_POSZ
			If callback == CALLBACK_BREAST_MAGIC_RIGHT_POSX
				_breastMagic_Position[0] = value
			ElseIf callback == CALLBACK_BREAST_MAGIC_RIGHT_POSY
				_breastMagic_Position[1] = value
			ElseIf callback == CALLBACK_BREAST_MAGIC_RIGHT_POSZ
				_breastMagic_Position[2] = value
			EndIf
			SetNodePosition(_targetActor, isFemale, NINODE_BREAST_MAGIC_RIGHT_CME, _breastMagic_Position)
		Elseif callback == CALLBACK_BREAST_MAGIC_LEFT_POSX || callback == CALLBACK_BREAST_MAGIC_LEFT_POSY || callback == CALLBACK_BREAST_MAGIC_LEFT_POSZ
			If callback == CALLBACK_BREAST_MAGIC_LEFT_POSX
				_breastMagicLeft_Position[0] = value
			ElseIf callback == CALLBACK_BREAST_MAGIC_LEFT_POSY
				_breastMagicLeft_Position[1] = value
			ElseIf callback == CALLBACK_BREAST_MAGIC_LEFT_POSZ
				_breastMagicLeft_Position[2] = value
			EndIf
			SetNodePosition(_targetActor, isFemale, NINODE_BREAST_MAGIC_LEFT_CME, _breastMagicLeft_Position)
		Elseif callback == CALLBACK_BREAST_MAGIC_RUNE_RIGHT_POSX || callback == CALLBACK_BREAST_MAGIC_RUNE_RIGHT_POSY || callback == CALLBACK_BREAST_MAGIC_RUNE_RIGHT_POSZ
			If callback == CALLBACK_BREAST_MAGIC_RUNE_RIGHT_POSX
				_breastMagicRune_Position[0] = value
			ElseIf callback == CALLBACK_BREAST_MAGIC_RUNE_RIGHT_POSY
				_breastMagicRune_Position[1] = value
			ElseIf callback == CALLBACK_BREAST_MAGIC_RUNE_RIGHT_POSZ
				_breastMagicRune_Position[2] = value
			EndIf
			SetNodePosition(_targetActor, isFemale, NINODE_BREAST_MAGIC_RUNE_RIGHT_CME, _breastMagicRune_Position)
		Elseif callback == CALLBACK_BREAST_MAGIC_RUNE_LEFT_POSX || callback == CALLBACK_BREAST_MAGIC_RUNE_LEFT_POSY || callback == CALLBACK_BREAST_MAGIC_RUNE_LEFT_POSZ
			If callback == CALLBACK_BREAST_MAGIC_RUNE_LEFT_POSX
				_breastMagicRuneLeft_Position[0] = value
			ElseIf callback == CALLBACK_BREAST_MAGIC_RUNE_LEFT_POSY
				_breastMagicRuneLeft_Position[1] = value
			ElseIf callback == CALLBACK_BREAST_MAGIC_RUNE_LEFT_POSZ
				_breastMagicRuneLeft_Position[2] = value
			EndIf
			SetNodePosition(_targetActor, isFemale, NINODE_BREAST_MAGIC_RUNE_LEFT_CME, _breastMagicRuneLeft_Position)
		Endif
	Endif
EndEvent

Function SetNodeScale(Actor akActor, bool isFemale, string nodeName, float value)
	If value != 1.0
		NiOverride.AddNodeTransformScale(akActor, false, isFemale, nodeName, MOD_OVERRIDE_KEY, value)
		NiOverride.AddNodeTransformScale(akActor, true, isFemale, nodeName, MOD_OVERRIDE_KEY, value)
	Else
		NiOverride.RemoveNodeTransformScale(akActor, false, isFemale, nodeName, MOD_OVERRIDE_KEY)
		NiOverride.RemoveNodeTransformScale(akActor, true, isFemale, nodeName, MOD_OVERRIDE_KEY)
	Endif
	NiOverride.UpdateNodeTransform(akActor, false, isFemale, nodeName)
	NiOverride.UpdateNodeTransform(akActor, true, isFemale, nodeName)
EndFunction

Function SetNodeScaleEX(Actor akActor, bool isFemale, string nodeName, float value, string modkey)
	If value != 1.0
		NiOverride.AddNodeTransformScale(akActor, false, isFemale, nodeName, modkey, value)
		NiOverride.AddNodeTransformScale(akActor, true, isFemale, nodeName, modkey, value)
	Else
		NiOverride.RemoveNodeTransformScale(akActor, false, isFemale, nodeName, modkey)
		NiOverride.RemoveNodeTransformScale(akActor, true, isFemale, nodeName, modkey)
	Endif
	NiOverride.UpdateNodeTransform(akActor, false, isFemale, nodeName)
	NiOverride.UpdateNodeTransform(akActor, true, isFemale, nodeName)
EndFunction

Function SetNodeRotation(Actor akActor, bool isFemale, string nodeName, float[] values)
	If values[0] != 0.0 || values[1] != 0.0 || values[2] != 0.0
		NiOverride.AddNodeTransformRotation(akActor, false, isFemale, nodeName, MOD_OVERRIDE_KEY, values)
		NiOverride.AddNodeTransformRotation(akActor, true, isFemale, nodeName, MOD_OVERRIDE_KEY, values)
	Else
		NiOverride.RemoveNodeTransformRotation(akActor, false, isFemale, nodeName, MOD_OVERRIDE_KEY)
		NiOverride.RemoveNodeTransformRotation(akActor, true, isFemale, nodeName, MOD_OVERRIDE_KEY)
	Endif
	NiOverride.UpdateNodeTransform(akActor, false, isFemale, nodeName)
	NiOverride.UpdateNodeTransform(akActor, true, isFemale, nodeName)
EndFunction

Function SetNodePosition(Actor akActor, bool isFemale, string nodeName, float[] values)
	If values[0] != 0.0 || values[1] != 0.0 || values[2] != 0.0
		NiOverride.AddNodeTransformPosition(akActor, false, isFemale, nodeName, MOD_OVERRIDE_KEY, values)
		NiOverride.AddNodeTransformPosition(akActor, true, isFemale, nodeName, MOD_OVERRIDE_KEY, values)
	Else
		NiOverride.RemoveNodeTransformPosition(akActor, false, isFemale, nodeName, MOD_OVERRIDE_KEY)
		NiOverride.RemoveNodeTransformPosition(akActor, true, isFemale, nodeName, MOD_OVERRIDE_KEY)
	Endif
	NiOverride.UpdateNodeTransform(akActor, false, isFemale, nodeName)
	NiOverride.UpdateNodeTransform(akActor, true, isFemale, nodeName)
EndFunction

Function SetNodeParent(Actor akActor, bool isFemale, string nodeName, string newParent)
	NiOverride.SetNodeDestination(akActor, false, isFemale, nodeName, newParent)
	NiOverride.SetNodeDestination(akActor, true, isFemale, nodeName, newParent)
	NiOverride.UpdateNodeTransform(akActor, false, isFemale, nodeName)
	NiOverride.UpdateNodeTransform(akActor, true, isFemale, nodeName)
EndFunction

float Function GetNodeScale(Actor akActor, bool isFemale, string nodeName)
	return NiOverride.GetNodeTransformScale(akActor, false, isFemale, nodeName, MOD_OVERRIDE_KEY)
EndFunction

float Function GetNodeScaleEX(Actor akActor, bool isFemale, string nodeName, string modkey)
	return NiOverride.GetNodeTransformScale(akActor, false, isFemale, nodeName, modkey)
EndFunction

float[] Function GetNodeRotation(Actor akActor, bool isFemale, string nodeName)
	return NiOverride.GetNodeTransformRotation(akActor, false, isFemale, nodeName, MOD_OVERRIDE_KEY)
EndFunction

float[] Function GetNodePosition(Actor akActor, bool isFemale, string nodeName)
	return NiOverride.GetNodeTransformPosition(akActor, false, isFemale, nodeName, MOD_OVERRIDE_KEY)
EndFunction