public bool DoParameterHeader(MBEditorParameterHandler handler)
{
bool dirty = false;
bool state = true;
EditorGUILayout.BeginHorizontal(mStyleHeaderStyle);
// Birth Animation
GUI.enabled = handler.ParameterInfo.CanAnimateBirth == MBParameterAnimationMode.Optional;
handler.Target.AnimatedBirth = MBGUI.DoToggle(mTexBirthAnimated, "Are parameter's initial values animated?", handler.Target.AnimatedBirth, out dirty);
if (dirty) {
SelectedEmitter.mbReloadHierarchy();
}
// Life Animation
GUI.enabled = handler.ParameterInfo.CanAnimateLife == MBParameterAnimationMode.Optional;
handler.Target.AnimatedLife = MBGUI.DoToggle(mTexLifeAnimated, "Is this parameter animated over lifetime?", handler.Target.AnimatedLife, out dirty);
GUI.enabled = true;
if (dirty) {
SelectedEmitter.mbReloadHierarchy();
}
string label = ParameterCaption(handler);
if (GUILayout.Button(label, mStyleBoldCentered)) {
Select(handler.Target);
if (Event.current.button == 1)
EditorUtility.DisplayPopupMenu(new Rect(Event.current.mousePosition.x, Event.current.mousePosition.y, 100, 100), "Window/Magical Box/Object", null);
}
// Mute
if (GUILayout.Button(new GUIContent(handler.Target.Muted ? mTexMuted : mTexUnMuted,"Mute/Unmute"), GUI.skin.label, new GUILayoutOption[] { GUILayout.ExpandWidth(false), GUILayout.MaxHeight(18) }))
handler.Target.Muted = !handler.Target.Muted;
// Toggle Section
if (!mSectionToggleState.ContainsKey(label))
mSectionToggleState.Add(label, true);
state = mSectionToggleState[label];
if (GUILayout.Button(new GUIContent(mTexToggleZoom, "Show/Hide Section"), GUI.skin.label,new GUILayoutOption[]{GUILayout.ExpandWidth(false),GUILayout.MaxHeight(18)})) {
state = !state;
mSectionToggleState[label] = state;
}
if (GUILayout.Button(new GUIContent(mTexParamOrderUp, "Move Up (calculate earlier)"), GUI.skin.label, new GUILayoutOption[] { GUILayout.ExpandWidth(false), GUILayout.MaxHeight(18) })) {
MBParameter prev=handler.Target.PreviousParameter;
if (prev) {
int ord=prev.Order;
prev.Order=handler.Target.Order;
handler.Target.Order = ord;
handler.Target.ParentEmitter.mbSortParameters();
InstantiateParameterHandler();
}
}
if (GUILayout.Button(new GUIContent(mTexParamOrderDown, "Move Down (calculate later)"), GUI.skin.label, new GUILayoutOption[] { GUILayout.ExpandWidth(false), GUILayout.MaxHeight(18) })) {
MBParameter next = handler.Target.NextParameter;
if (next) {
int ord = next.Order;
next.Order = handler.Target.Order;
handler.Target.Order = ord;
handler.Target.ParentEmitter.mbSortParameters();
InstantiateParameterHandler();
}
}
EditorGUILayout.EndHorizontal();
return (mParametersAutoToggleSelected) ? handler.Target==SelectedObject: state;
}