浏览代码

Added move up/down actions for volume components

/main
Thomas 7 年前
当前提交
99aaff8d
共有 2 个文件被更改,包括 28 次插入3 次删除
  1. 25
      ScriptableRenderPipeline/Core/Volume/Editor/VolumeEditor.cs
  2. 6
      ScriptableRenderPipeline/Core/Volume/VolumeManager.cs

25
ScriptableRenderPipeline/Core/Volume/Editor/VolumeEditor.cs


Undo.DestroyObjectImmediate(prevSettings);
}
void MoveComponent(int id, int offset)
{
// Move components
serializedObject.Update();
m_Components.MoveArrayElement(id, id + offset);
serializedObject.ApplyModifiedProperties();
// Move editors
var prev = m_Editors[id + offset];
m_Editors[id + offset] = m_Editors[id];
m_Editors[id] = prev;
}
if (id == 0)
menu.AddDisabledItem(CoreEditorUtils.GetContent("Move Up"));
else
menu.AddItem(CoreEditorUtils.GetContent("Move Up"), false, () => MoveComponent(id, -1));
if (id == m_Editors.Count - 1)
menu.AddDisabledItem(CoreEditorUtils.GetContent("Move Down"));
else
menu.AddItem(CoreEditorUtils.GetContent("Move Down"), false, () => MoveComponent(id, 1));
menu.AddSeparator(string.Empty);
menu.AddItem(CoreEditorUtils.GetContent("Reset"), false, () => ResetComponent(targetComponent.GetType(), id));
menu.AddItem(CoreEditorUtils.GetContent("Remove"), false, () => RemoveComponent(id));
menu.AddSeparator(string.Empty);

6
ScriptableRenderPipeline/Core/Volume/VolumeManager.cs


float blendDistSqr = volume.blendDistance * volume.blendDistance;
// Volume has no influence, ignore it
// Note: Volume doesn't do anything when `closestDistanceSqr = blendDistSqr` but
// we can't use a >= comparison as blendDistSqr could be set to 0 in which
// case volume would have total influence
// Note: Volume doesn't do anything when `closestDistanceSqr = blendDistSqr` but we
// can't use a >= comparison as blendDistSqr could be set to 0 in which case
// volume would have total influence
if (closestDistanceSqr > blendDistSqr)
continue;

正在加载...
取消
保存