From 1966f432b47a320eea77ef1a6ae3401d2c0d520c Mon Sep 17 00:00:00 2001
From: Rye Mutt <rye@alchemyviewer.org>
Date: Thu, 29 Feb 2024 09:59:48 -0500
Subject: [PATCH] Bork

---
 indra/llcharacter/llkeyframemotion.cpp | 14 ++---
 indra/llcharacter/llkeyframemotion.h   |  3 +-
 indra/llcommon/llsortedvector.h        | 13 ++++-
 indra/llfilesystem/lldir.cpp           |  3 ++
 indra/llfilesystem/lldir.h             |  1 +
 indra/llui/llscrolllistcell.cpp        | 75 ++++++++++++++++++++++++++
 indra/llui/llscrolllistcell.h          | 42 ++++++++++++++-
 indra/newview/CMakeLists.txt           |  4 +-
 indra/newview/bdfloaterposecreator.cpp | 64 +++++++++++-----------
 indra/newview/llviewerfloaterreg.cpp   |  4 +-
 10 files changed, 175 insertions(+), 48 deletions(-)

diff --git a/indra/llcharacter/llkeyframemotion.cpp b/indra/llcharacter/llkeyframemotion.cpp
index 31b69d6d097..ee6868b4cda 100644
--- a/indra/llcharacter/llkeyframemotion.cpp
+++ b/indra/llcharacter/llkeyframemotion.cpp
@@ -1377,11 +1377,9 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
 					<< " for animation " << asset_id << LL_ENDL;
 				return FALSE;
 			}
-			
-			rCurve->mKeys.emplace_back(time, rot_key);
-		}
 
-		std::sort(rCurve->mKeys.begin(), rCurve->mKeys.end(), [](const auto& a, const auto& b) { return a.first < b.first; });
+			rCurve->mKeys[time] = rot_key;
+		}
 
         if (joint_motion->mRotationCurve.mNumKeys > joint_motion->mRotationCurve.mKeys.size())
         {
@@ -1483,7 +1481,7 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
 				return FALSE;
 			}
 			
-			pCurve->mKeys.emplace_back(pos_key.mTime, pos_key);
+			pCurve->mKeys[pos_key.mTime] = pos_key;
 
 			if (is_pelvis)
 			{
@@ -1491,8 +1489,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
 			}
 		}
 
-		std::sort(pCurve->mKeys.begin(), pCurve->mKeys.end(), [](const auto& a, const auto& b) { return a.first < b.first; });
-
         if (joint_motion->mPositionCurve.mNumKeys > joint_motion->mPositionCurve.mKeys.size())
         {
             position_dupplicates++;
@@ -1930,11 +1926,11 @@ bool LLKeyframeMotion::dumpToFile(const std::string& name)
 		{
 			outfilename = outfile_base;
 		}
-        if (LLFile::isfile(outfilename))
+        /*if (LLFile::isfile(outfilename))
         {
 			LL_WARNS() << outfilename << " already exists, write failed" << LL_ENDL;
             return false;
-        }
+        }*/
 
         S32 file_size = getFileSize();
         U8* buffer = new U8[file_size];
diff --git a/indra/llcharacter/llkeyframemotion.h b/indra/llcharacter/llkeyframemotion.h
index d517fe4b04c..a1b197e1ab0 100644
--- a/indra/llcharacter/llkeyframemotion.h
+++ b/indra/llcharacter/llkeyframemotion.h
@@ -42,6 +42,7 @@
 #include "v3dmath.h"
 #include "v3math.h"
 #include "llbvhconsts.h"
+#include "llsortedvector.h"
 
 #include "boost/unordered/unordered_flat_map.hpp"
 
@@ -362,7 +363,7 @@ class LLKeyframeMotion :
 
 		InterpolationType	mInterpolationType = LLKeyframeMotion::IT_LINEAR;
 		S32					mNumKeys = 0;
-		typedef std::vector< std::pair<F32, Key> > key_map_t;
+		typedef LLSortedVector<F32, Key> key_map_t;
 		key_map_t 			mKeys;
 		Key					mLoopInKey;
 		Key					mLoopOutKey;
diff --git a/indra/llcommon/llsortedvector.h b/indra/llcommon/llsortedvector.h
index 88b502b2320..5544af6a602 100644
--- a/indra/llcommon/llsortedvector.h
+++ b/indra/llcommon/llsortedvector.h
@@ -51,7 +51,7 @@ class LLSortedVector
     {
         // Allow caller to dump in a bunch of (pairs convertible to)
         // value_type if desired, but make sure we sort afterwards.
-        std::sort(mVector.begin(), mVector.end());
+        std::sort(mVector.begin(), mVector.end(), less<value_type>());
     }
 
     /// insert(key, value)
@@ -151,6 +151,17 @@ class LLSortedVector
         }
     };
 
+    // Same as above, but with const F32.
+    template <typename T>
+    struct less< std::pair<F32, T> >
+    {
+        bool operator()(const std::pair<F32, T>& lhs,
+            const std::pair<F32, T>& rhs) const
+        {
+            return lhs.first < rhs.first;
+        }
+    };
+
     PairVector mVector;
 };
 
diff --git a/indra/llfilesystem/lldir.cpp b/indra/llfilesystem/lldir.cpp
index be38f1da816..06a44eb3187 100644
--- a/indra/llfilesystem/lldir.cpp
+++ b/indra/llfilesystem/lldir.cpp
@@ -599,6 +599,9 @@ std::string LLDir::getExpandedFilename(ELLPath location, const std::string& subd
 		prefix = add(getOSUserAppDir(), "user_settings", "poses");
 		break;
 
+	case LL_PATH_ANIMATIONS:
+		prefix = add(getOSUserAppDir(), "user_settings", "animations");
+		break;
 		
 	default:
 		llassert(0);
diff --git a/indra/llfilesystem/lldir.h b/indra/llfilesystem/lldir.h
index 25335645c6d..ec04e97e678 100644
--- a/indra/llfilesystem/lldir.h
+++ b/indra/llfilesystem/lldir.h
@@ -50,6 +50,7 @@ typedef enum ELLPath
 	LL_PATH_FONTS = 18,
     LL_PATH_DUMP = 19,
 	LL_PATH_POSES = 20,
+	LL_PATH_ANIMATIONS = 21,
 	LL_PATH_LAST
 } ELLPath;
 
diff --git a/indra/llui/llscrolllistcell.cpp b/indra/llui/llscrolllistcell.cpp
index 264d9eaf0df..2a50df756c6 100644
--- a/indra/llui/llscrolllistcell.cpp
+++ b/indra/llui/llscrolllistcell.cpp
@@ -32,6 +32,8 @@
 #include "llcheckboxctrl.h"
 #include "llui.h"	// LLUIImage
 #include "lluictrlfactory.h"
+//BD
+#include "llmultislider.h"
 
 //static 
 LLScrollListCell* LLScrollListCell::create(const LLScrollListCell::Params& cell_p)
@@ -54,6 +56,10 @@ LLScrollListCell* LLScrollListCell::create(const LLScrollListCell::Params& cell_
 	{
 		cell = new LLScrollListIconText(cell_p);
 	}
+	else if (cell_p.type() == "multislider")
+	{
+		cell = new LLScrollListMultiSlider(cell_p);
+	}
     else if (cell_p.type() == "bar")
     {
         cell = new LLScrollListBar(cell_p);
@@ -742,3 +748,72 @@ BOOL LLScrollListLineEditor::handleUnicodeCharHere(llwchar uni_char )
 {
 	return TRUE;
 }
+
+//
+// BD - LLScrollListMultiSlider
+//
+LLScrollListMultiSlider::LLScrollListMultiSlider(const LLScrollListCell::Params& p)
+	: LLScrollListCell(p),
+	mMinValue(p.min_val),
+	mMaxValue(p.max_val)
+{
+	LLMultiSlider::Params multislider_p;
+	multislider_p.name("multislider");
+	multislider_p.rect = LLRect(0, 18, p.width, 0);
+	multislider_p.enabled(p.enabled);
+	multislider_p.initial_value(p.value());
+	multislider_p.max_sliders(p.max_sliders);
+	multislider_p.min_value(p.min_val);
+	multislider_p.max_value(p.max_val);
+	multislider_p.increment(p.increment);
+
+	mMultiSlider = LLUICtrlFactory::create<LLMultiSlider>(multislider_p);
+	LLRect rect(mMultiSlider->getRect());
+	if (p.width)
+	{
+		rect.mRight = rect.mLeft + p.width;
+		mMultiSlider->setRect(rect);
+		setWidth(p.width);
+	}
+	else
+	{
+		setWidth(rect.getWidth()); //check_box->getWidth();
+	}
+
+	mMultiSlider->setColor(p.color);
+}
+
+LLScrollListMultiSlider::~LLScrollListMultiSlider()
+{
+}
+
+const LLSD LLScrollListMultiSlider::getValue() const
+{
+	return true;
+}
+
+void LLScrollListMultiSlider::setValue(const LLSD& value)
+{
+	
+}
+
+void LLScrollListMultiSlider::addKeyframe(F32 time, std::string name)
+{
+	mMultiSlider->addSlider(time, name);
+}
+
+void LLScrollListMultiSlider::deleteKeyframe(std::string name)
+{
+	mMultiSlider->deleteSlider(name);
+}
+
+void LLScrollListMultiSlider::setWidth(S32 width)
+{
+	LLScrollListCell::setWidth(width);
+}
+
+
+void LLScrollListMultiSlider::draw(const LLColor4& color, const LLColor4& highlight_color)	 const
+{
+	mMultiSlider->draw();
+}
diff --git a/indra/llui/llscrolllistcell.h b/indra/llui/llscrolllistcell.h
index 9964cc9454e..9d02ddccac6 100644
--- a/indra/llui/llscrolllistcell.h
+++ b/indra/llui/llscrolllistcell.h
@@ -40,6 +40,7 @@
 #include "lluictrl.h"
 // [/SL:KB]
 
+class LLMultiSlider;
 class LLCheckBoxCtrl;
 class LLSD;
 class LLUIImage;
@@ -85,6 +86,12 @@ class LLScrollListCell
 
 		Optional<LLColor4>			color;
 
+		//BD
+		Optional<S32>				max_sliders;
+		Optional<F32>				min_val;
+		Optional<F32>				max_val;
+		Optional<F32>				increment;
+
 		Params()
 		:	type("type", "text"),
 			column("column"),
@@ -101,7 +108,12 @@ class LLScrollListCell
 			font("font", LLFontGL::getFontSansSerifSmall()),
 			font_color("font_color", LLColor4::black),
 			color("color", LLColor4::white),
-			font_halign("halign", LLFontGL::LEFT)
+			font_halign("halign", LLFontGL::LEFT),
+			//BD
+			max_sliders("max_sliders", 60),
+			min_val("min_value", 0),
+			max_val("max_value", 1),
+			increment("increment", 1)
 		{
 			addSynonym(column, "name");
 			addSynonym(font_color, "font-color");
@@ -331,4 +343,32 @@ class LLScrollListLineEditor : public LLScrollListCell
 	LLLineEditor* mLineEditor;
 };
 
+/*
+* BD - Cell displaying a keyframe multislider.
+*/
+
+class LLScrollListMultiSlider : public LLScrollListCell
+{
+public:
+	LLScrollListMultiSlider(const LLScrollListCell::Params& p);
+	/*virtual*/ ~LLScrollListMultiSlider();
+	/*virtual*/ void	draw(const LLColor4& color, const LLColor4& highlight_color) const;
+	/*virtual*/ const LLSD		getValue() const;
+	/*virtual*/ void	setValue(const LLSD& value);
+
+
+	/*virtual*/ void	setWidth(S32 width);/* { LLScrollListCell::setWidth(width); mTextWidth = width - ; }*/
+
+	F32					getMinValue() const { return mMinValue; }
+	F32					getMaxValue() const { return mMaxValue; }
+
+	void				addKeyframe(F32 time, std::string name);
+	void				deleteKeyframe(std::string name);
+
+private:
+	LLMultiSlider*		mMultiSlider;
+	F32					mMinValue;
+	F32					mMaxValue;
+};
+
 #endif
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index 2452432d732..1fdddfe519b 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -110,7 +110,7 @@ set(viewer_SOURCE_FILES
     alviewermenu.cpp
     bdanimator.cpp
     bdfloaterposer.cpp
-    #bdfloaterposecreator.cpp
+    bdfloaterposecreator.cpp
     bdposingmotion.cpp
     fslslpreproc.cpp
     fslslpreprocviewer.cpp
@@ -845,7 +845,7 @@ set(viewer_HEADER_FILES
     alviewermenu.h
     bdanimator.h
     bdfloaterposer.h
-    #bdfloaterposecreator.h
+    bdfloaterposecreator.h
     bdposingmotion.h
     fslslpreproc.h
     fslslpreprocviewer.h
diff --git a/indra/newview/bdfloaterposecreator.cpp b/indra/newview/bdfloaterposecreator.cpp
index da88b21154a..1f4b8ff58e1 100644
--- a/indra/newview/bdfloaterposecreator.cpp
+++ b/indra/newview/bdfloaterposecreator.cpp
@@ -48,9 +48,7 @@
 
 //BD - Black Dragon specifics
 #include "bdanimator.h"
-#include "bdfunctions.h"
 #include "bdposingmotion.h"
-#include "bdstatus.h"
 #include "bdfloaterposer.h"
 
 //BD - 1 frame is always 1/60 of a second, we assume animations run at 60 FPS by default.
@@ -173,7 +171,7 @@ BOOL BDFloaterPoseCreator::postBuild()
 	enable_registrar.add("Joints.OnEnable", boost::bind(&BDFloaterPoseCreator::onJointContextMenuEnable, this, _2));
 	LLContextMenu* joint_menu = LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu>("menu_poser_joints.xml",
 		gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
-	//mJointScrolls[JOINTS]->setContextMenu(joint_menu);
+	mJointScrolls[JOINTS]->setContextMenu(LLScrollListCtrl::MENU_EXTERNAL, joint_menu);
 
 	return TRUE;
 }
@@ -251,7 +249,7 @@ void BDFloaterPoseCreator::onKeyframesRebuild()
 		for (auto& rot_key : rot_curve.mKeys)
 		{
 			F32 roll, pitch, yaw;
-			LLQuaternion rot_quat = rot_key.second.mRotation;
+			LLQuaternion rot_quat = rot_key.second.mValue;
 			rot_quat.getEulerAngles(&roll, &pitch, &yaw);
 
 			S32 time_frames = (S32)ll_round(rot_key.second.mTime / FRAMETIME, 1.f);
@@ -265,7 +263,7 @@ void BDFloaterPoseCreator::onKeyframesRebuild()
 
 		for (auto& pos_key : pos_curve.mKeys)
 		{
-			LLVector3 pos = pos_key.second.mPosition;
+			LLVector3 pos = pos_key.second.mValue;
 			S32 time_frames = (S32)ll_round(pos_key.second.mTime / FRAMETIME, 1.f);
 
 			if (col_slider)
@@ -277,7 +275,7 @@ void BDFloaterPoseCreator::onKeyframesRebuild()
 
 		for (auto& scale_key : scale_curve.mKeys)
 		{
-			LLVector3 scale = scale_key.second.mScale;
+			LLVector3 scale = scale_key.second.mValue;
 			S32 time_frames = (S32)ll_round(scale_key.second.mTime / FRAMETIME, 1.f);
 
 			if (col_slider)
@@ -358,7 +356,7 @@ void BDFloaterPoseCreator::onKeyframeRefresh()
 		for (auto& rot_key : rot_curve.mKeys)
 		{
 			F32 roll, pitch, yaw;
-			LLQuaternion rot_quat = rot_key.second.mRotation;
+			LLQuaternion rot_quat = rot_key.second.mValue;
 			rot_quat.getEulerAngles(&roll, &pitch, &yaw);
 
 			S32 time_frames = (S32)ll_round(rot_key.second.mTime / FRAMETIME, 1.f);
@@ -387,7 +385,7 @@ void BDFloaterPoseCreator::onKeyframeRefresh()
 	{
 		for (auto& pos_key : pos_curve.mKeys)
 		{
-			LLVector3 pos = pos_key.second.mPosition;
+			LLVector3 pos = pos_key.second.mValue;
 			S32 time_frames = (S32)ll_round(pos_key.second.mTime / FRAMETIME, 1.f);
 			LLSD row;
 			row["columns"][0]["column"] = "time";
@@ -413,7 +411,7 @@ void BDFloaterPoseCreator::onKeyframeRefresh()
 	{
 		for (auto& scale_key : scale_curve.mKeys)
 		{
-			LLVector3 scale = scale_key.second.mScale;
+			LLVector3 scale = scale_key.second.mValue;
 			S32 time_frames = (S32)ll_round(scale_key.second.mTime / FRAMETIME, 1.f);
 			LLSD row;
 			row["columns"][0]["column"] = "time";
@@ -473,7 +471,7 @@ void BDFloaterPoseCreator::onKeyframeSelect()
 		{
 			if ((S32)it.first == si)
 			{
-				LLQuaternion rot_quat = it.second.mRotation;
+				LLQuaternion rot_quat = it.second.mValue;
 				LLVector3 rot_vec;
 				rot_quat.getEulerAngles(&rot_vec.mV[VX], &rot_vec.mV[VY], &rot_vec.mV[VZ]);
 				mRotationSliders[VX]->setValue(rot_vec.mV[VX]);
@@ -489,7 +487,7 @@ void BDFloaterPoseCreator::onKeyframeSelect()
 		{
 			if ((S32)it.first == si)
 			{
-				LLVector3 pos = it.second.mPosition;
+				LLVector3 pos = it.second.mValue;
 				mPositionSliders[VX]->setValue(pos.mV[VX]);
 				mPositionSliders[VY]->setValue(pos.mV[VY]);
 				mPositionSliders[VZ]->setValue(pos.mV[VZ]);
@@ -503,7 +501,7 @@ void BDFloaterPoseCreator::onKeyframeSelect()
 		{
 			if ((S32)it.first == si)
 			{
-				LLVector3 scale = it.second.mScale;
+				LLVector3 scale = it.second.mValue;
 				mScaleSliders[VX]->setValue(scale.mV[VX]);
 				mScaleSliders[VY]->setValue(scale.mV[VY]);
 				mScaleSliders[VZ]->setValue(scale.mV[VZ]);
@@ -1174,7 +1172,8 @@ void BDFloaterPoseCreator::onPoseStartStop()
 		//     list when we stop it preventing it from being destroyed at some point.
 		if (!tmotion)
 		{
-			gDragonAnimator.mPoseCreatorMotion->dumpToFile("_poser_temp.anim", false);
+			std::string full_path = gDirUtilp->getExpandedFilename(LL_PATH_ANIMATIONS, "_poser_temp.anim");
+			gDragonAnimator.mPoseCreatorMotion->dumpToFile(full_path);
 
 			LLKeyframeMotion* motion = onReadyTempMotion();
 			if (motion)
@@ -1190,7 +1189,8 @@ void BDFloaterPoseCreator::onPoseStartStop()
 			if (tmotion->isStopped())
 			{
 				//BD - Save the animation temporarily.
-				gDragonAnimator.mPoseCreatorMotion->dumpToFile("_poser_temp.anim", false);
+				std::string full_path = gDirUtilp->getExpandedFilename(LL_PATH_ANIMATIONS, "_poser_temp.anim");
+				gDragonAnimator.mPoseCreatorMotion->dumpToFile(full_path);
 				//BD - Reload the animation data back into our already existing animation.
 				//     To refresh it and make sure its always up to date with all our changes.
 				LLKeyframeMotion* tmotion = onReadyTempMotion();
@@ -1257,19 +1257,19 @@ void BDFloaterPoseCreator::onPoseReapply()
 			//     start.
 			for (auto& rot_key : rot_curve.mKeys)
 			{
-				LLQuaternion rot = rot_key.second.mRotation;
+				LLQuaternion rot = rot_key.second.mValue;
 				joint->setTargetRotation(rot);
 			}
 
 			for (auto& pos_key : pos_curve.mKeys)
 			{
-				LLVector3 pos = pos_key.second.mPosition;
+				LLVector3 pos = pos_key.second.mValue;
 				joint->setTargetPosition(pos);
 			}
 
 			for (auto& scale_key : scale_curve.mKeys)
 			{
-				LLVector3 scale = scale_key.second.mScale;
+				LLVector3 scale = scale_key.second.mValue;
 				joint->setScale(scale);
 			}
 
@@ -1291,7 +1291,6 @@ void BDFloaterPoseCreator::onPoseStart()
 			onCollectDefaults();
 
 		gAgent.stopFidget();
-		gDragonStatus->setPosing(true);
 
 		gAgentAvatarp->startMotion(ANIM_BD_POSING_MOTION);
 		onJointRotPosScaleReset();
@@ -1312,7 +1311,6 @@ void BDFloaterPoseCreator::onPoseStart()
 		//BD - Clear posing when we're done now that we've safely endangered getting spaghetified.
 		gAgentAvatarp->clearPosing();
 		gAgentAvatarp->stopMotion(ANIM_BD_POSING_MOTION);
-		gDragonStatus->setPosing(false);
 	}
 
 	//BD - Wipe the joint list.
@@ -1336,7 +1334,8 @@ bool BDFloaterPoseCreator::onPoseExport()
 	if (motion_name.empty())
 		return false;
 
-	return gDragonAnimator.mPoseCreatorMotion->dumpToFile(motion_name, false);
+	std::string full_path = gDirUtilp->getExpandedFilename(LL_PATH_ANIMATIONS, motion_name + ".anim");
+	return gDragonAnimator.mPoseCreatorMotion->dumpToFile(full_path);
 
 	LLKeyframeMotion* temp_motion = NULL;
 	LLAssetID mMotionID;
@@ -1437,14 +1436,14 @@ bool BDFloaterPoseCreator::onPoseExport()
 				//BD - Get the pelvis's bounding box and add it.
 				if (joint->getJointNum() == 0)
 				{
-					joint_motion_list->mPelvisBBox.addPoint(position_key.mPosition);
+					joint_motion_list->mPelvisBBox.addPoint(position_key.mValue);
 				}
 			}
 		}
 	}
 
 	temp_motion->setJointMotionList(joint_motion_list);
-	return temp_motion->dumpToFile(motion_name, false);
+	return temp_motion->dumpToFile(full_path);
 }
 
 void BDFloaterPoseCreator::onPoseImport()
@@ -1946,10 +1945,10 @@ void BDFloaterPoseCreator::onJointSet(LLUICtrl* ctrl, const LLSD& param)
 			LLScrollListItem* key_item = mKeyframeScroll->getItemByLabel(mirror_joint_name);
 			if (key_item)
 			{
-				for (std::map<F32, LLKeyframeMotion::RotationKey>::iterator it = mirror_joint_motion->mRotationCurve.mKeys.begin();
+				for (auto it = mirror_joint_motion->mRotationCurve.mKeys.begin();
 					it != mirror_joint_motion->mRotationCurve.mKeys.end(); )
 				{
-					std::map<F32, LLKeyframeMotion::RotationKey>::iterator curr_it = it;
+					auto curr_it = it;
 					//BD - Previously we were rounding the keyframe time and comparing it to the time set
 					//     in the keyframe list entry, this was ugly and had a big downside, having two
 					//     or more entries with the same time resulting in all of them getting changed.
@@ -1962,7 +1961,7 @@ void BDFloaterPoseCreator::onJointSet(LLUICtrl* ctrl, const LLSD& param)
 					if ((S32)curr_it->first == si)
 					{
 						found = true;
-						curr_it->second.mRotation = mirror_joint->getTargetRotation();
+						curr_it->second.mValue = mirror_joint->getTargetRotation();
 
 						F32 roll, pitch, yaw;
 						LLQuaternion rot_quat = mirror_joint->getTargetRotation();
@@ -2038,10 +2037,10 @@ void BDFloaterPoseCreator::onJointPosSet(LLUICtrl* ctrl, const LLSD& param)
 
 	bool found = false;
 	S32 si = mKeyframeScroll->getFirstSelectedIndex() + 1;
-	for (std::map<F32, LLKeyframeMotion::PositionKey>::iterator it = joint_motion->mPositionCurve.mKeys.begin();
+	for (auto it = joint_motion->mPositionCurve.mKeys.begin();
 		it != joint_motion->mPositionCurve.mKeys.end(); )
 	{
-		std::map<F32, LLKeyframeMotion::PositionKey>::iterator curr_it = it;
+		auto curr_it = it;
 		//BD - Previously we were rounding the keyframe time and comparing it to the time set
 		//     in the keyframe list entry, this was ugly and had a big downside, having two
 		//     or more entries with the same time resulting in all of them getting changed.
@@ -2053,7 +2052,7 @@ void BDFloaterPoseCreator::onJointPosSet(LLUICtrl* ctrl, const LLSD& param)
 		if ((S32)curr_it->first == si)
 		{
 			found = true;
-			curr_it->second.mPosition = joint->getTargetPosition();
+			curr_it->second.mValue = joint->getTargetPosition();
 
 			LLVector3 pos = joint->getTargetPosition();
 			//BD - Should we really be able to get here? The comparison above should already
@@ -2117,10 +2116,10 @@ void BDFloaterPoseCreator::onJointScaleSet(LLUICtrl* ctrl, const LLSD& param)
 	LLKeyframeMotion::RotationCurve rot_curve = joint_motion->mRotationCurve;
 
 	S32 si = mKeyframeScroll->getFirstSelectedIndex() + 1;
-	for (std::map<F32, LLKeyframeMotion::ScaleKey>::iterator it = joint_motion->mScaleCurve.mKeys.begin();
+	for (auto it = joint_motion->mScaleCurve.mKeys.begin();
 		it != joint_motion->mScaleCurve.mKeys.end(); )
 	{
-		std::map<F32, LLKeyframeMotion::ScaleKey>::iterator curr_it = it;
+		auto curr_it = it;
 		//BD - Previously we were rounding the keyframe time and comparing it to the time set
 		//     in the keyframe list entry, this was ugly and had a big downside, having two
 		//     or more entries with the same time resulting in all of them getting changed.
@@ -2131,7 +2130,7 @@ void BDFloaterPoseCreator::onJointScaleSet(LLUICtrl* ctrl, const LLSD& param)
 		//     This should work for now until we decide to allow reordering keyframes.
 		if ((S32)curr_it->first == si)
 		{
-			curr_it->second.mScale = joint->getScale();
+			curr_it->second.mValue = joint->getScale();
 
 			LLVector3 scale = joint->getScale();
 			key_item->getColumn(2)->setValue(ll_round(scale.mV[VX], 0.001f));
@@ -3051,7 +3050,8 @@ void BDFloaterPoseCreator::onCreateTempMotion()
 	//     this animation locally which will create a fully setup LLKeyframeAnimation
 	//     that doesn't have some weird things going on causing crashes, it is also
 	//     a lot easier to do.
-	temp_motion->dumpToFile("_poser_temp", false);
+	std::string full_path = gDirUtilp->getExpandedFilename(LL_PATH_ANIMATIONS, "_poser_temp.anim");
+	temp_motion->dumpToFile(full_path);
 	//return temp_motion;
 }
 
diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp
index 189612f46f9..006da1c01e1 100644
--- a/indra/newview/llviewerfloaterreg.cpp
+++ b/indra/newview/llviewerfloaterreg.cpp
@@ -200,7 +200,7 @@
 #include "llscriptfloater.h"
 #include "llsyswellwindow.h"
 #include "bdfloaterposer.h"
-//#include "bdfloaterposecreator.h"
+#include "bdfloaterposecreator.h"
 
 // *NOTE: Please add files in alphabetical order to keep merges easy.
 // [RLVa:KB] - Checked: 2010-03-11
@@ -570,7 +570,7 @@ void LLViewerFloaterReg::registerFloaters()
     LLFloaterReg::add("new_local_inventory", "floater_new_local_inventory.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterNewLocalInventory>);
 	LLFloaterReg::add("particle_editor", "floater_particle_editor.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<ALFloaterParticleEditor>);
 	LLFloaterReg::add("poser", "floater_poser.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<BDFloaterPoser>);
-	//LLFloaterReg::add("poser_creator", "floater_poser_creator.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<BDFloaterPoseCreator>);
+	LLFloaterReg::add("poser_creator", "floater_poser_creator.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<BDFloaterPoseCreator>);
 	LLFloaterReg::add("progress_view", "floater_progress_view.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterProgressView>);
 	LLFloaterReg::add("quick_settings", "floater_quick_settings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloater>);
 	LLFloaterReg::add("region_tracker", "floater_region_tracker.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<ALFloaterRegionTracker>);
-- 
GitLab