Thomas ICHÉ
5 年前
当前提交
47cc733e
共有 5 个文件被更改,包括 106 次插入 和 42 次删除
-
5ImageSequencer/Editor/Serialization/ProcessorBase.cs
-
71ImageSequencer/Editor/Serialization/Processors/AssembleProcessor.cs
-
5ImageSequencer/Editor/Serialization/Processors/BreakFlipbookProcessor.cs
-
55ImageSequencer/Editor/Serialization/Processors/DecimateProcessor.cs
-
12ImageSequencer/Editor/Serialization/Processors/DecimateProcessor.cs.meta
|
|||
using UnityEngine; |
|||
|
|||
namespace UnityEditor.VFXToolbox.ImageSequencer |
|||
{ |
|||
[Processor("Sequence","Decimate")] |
|||
internal class DecimateProcessor : ProcessorBase |
|||
{ |
|||
public ushort DecimateBy; |
|||
|
|||
public override string shaderPath => "Packages/com.unity.vfx-toolbox/ImageSequencer/Editor/Shaders/Null.shader"; |
|||
|
|||
public override string label => $"{name} (1 of {DecimateBy})"; |
|||
|
|||
public override string processorName => "Decimate"; |
|||
|
|||
public override int sequenceLength => Mathf.Max(1, (int)Mathf.Floor((float)processor.InputSequence.length / DecimateBy)); |
|||
|
|||
public override void Default() |
|||
{ |
|||
DecimateBy = 3; |
|||
} |
|||
|
|||
public override bool OnInspectorGUI(bool changed, SerializedObject serializedObject) |
|||
{ |
|||
var decimateBy = serializedObject.FindProperty("DecimateBy"); |
|||
|
|||
EditorGUI.BeginChangeCheck(); |
|||
|
|||
int newDecimate = Mathf.Clamp(EditorGUILayout.IntField(VFXToolboxGUIUtility.Get("Decimate by"), (int)DecimateBy), 2, processor.InputSequence.length); |
|||
|
|||
if (newDecimate != decimateBy.intValue) |
|||
{ |
|||
decimateBy.intValue = newDecimate; |
|||
} |
|||
|
|||
if (EditorGUI.EndChangeCheck()) |
|||
{ |
|||
changed = true; |
|||
} |
|||
|
|||
return changed; |
|||
} |
|||
|
|||
public override bool Process(int frame) |
|||
{ |
|||
int targetFrame = frame * DecimateBy; |
|||
Texture texture = processor.InputSequence.RequestFrame(targetFrame).texture; |
|||
processor.material.SetTexture("_MainTex", texture); |
|||
processor.ExecuteShaderAndDump(frame, texture); |
|||
return true; |
|||
} |
|||
} |
|||
} |
|||
|
|||
|
|
|||
fileFormatVersion: 2 |
|||
guid: 35539f9025900914e96e7eb931166504 |
|||
timeCreated: 1465476802 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue