//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
//**************** Copyright (c) 2016 Marko Pintera (marko.pintera@gmail.com). All rights reserved. **********************//
using bs;
namespace bs.Editor
{
/** @addtogroup Inspectors
* @{
*/
///
/// Renders common inspector elements for all components.
///
internal abstract class JointInspector : Inspector
{
///
/// Creates GUI elements for fields common to all joints.
///
protected virtual void BuildGUI(Joint joint, bool showOffsets)
{
drawer.AddField("Target", () => joint.GetBody(JointBody.Target), x => joint.SetBody(JointBody.Target, x));
drawer.AddField("Anchor", () => joint.GetBody(JointBody.Anchor), x => joint.SetBody(JointBody.Anchor, x));
if (showOffsets)
{
drawer.AddField("Target offset",
() => joint.GetPosition(JointBody.Target),
x => joint.SetTransform(JointBody.Target, x, joint.GetRotation(JointBody.Target)));
drawer.AddField("Anchor offset",
() => joint.GetPosition(JointBody.Anchor),
x => joint.SetTransform(JointBody.Anchor, x, joint.GetRotation(JointBody.Anchor)));
}
drawer.AddDefault(joint, typeof(Joint));
}
}
/** @} */
}