Compare commits

...

2 Commits

Author SHA1 Message Date
KINDNICK
b1d1e8ae19 Design: add individual Lerp constraint icons 2026-08-21 22:55:54 +09:00
KINDNICK
a24acd2901 Rename: Rough constraints to Lerp constraints 2026-08-21 22:43:29 +09:00
38 changed files with 775 additions and 59 deletions

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f5f43322334040eda82a02238038c637
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 KiB

View File

@ -0,0 +1,89 @@
fileFormatVersion: 2
guid: 07da6f60b8c84789bc7ee4602f68d356
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 256
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings: []
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
customData:
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 202 KiB

View File

@ -0,0 +1,89 @@
fileFormatVersion: 2
guid: 8f25ac2c42604ab79638fbe063e38a1e
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 256
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings: []
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
customData:
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 317 KiB

View File

@ -0,0 +1,89 @@
fileFormatVersion: 2
guid: 0c84e46fbbf5438d8099a052a0afc864
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 256
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings: []
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
customData:
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 KiB

View File

@ -0,0 +1,89 @@
fileFormatVersion: 2
guid: 07856e0ad4ad45cea23acd5143fd834a
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 256
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings: []
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
customData:
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 129 KiB

View File

@ -0,0 +1,89 @@
fileFormatVersion: 2
guid: 9f06836401f24edab7eb10cfa8cc366c
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 256
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings: []
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
customData:
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 KiB

View File

@ -0,0 +1,89 @@
fileFormatVersion: 2
guid: cb343fa7887e4c33841ba7c34114ba1b
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 256
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings: []
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
customData:
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 324 KiB

View File

@ -0,0 +1,89 @@
fileFormatVersion: 2
guid: 6e8f1bdf638d4772bde06d7d0eeb8af3
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 256
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings: []
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
customData:
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,13 +1,13 @@
using Streamingle.Utils.RoughConstraints; using Streamingle.Utils.LerpConstraints;
using UnityEditor; using UnityEditor;
using UnityEditorInternal; using UnityEditorInternal;
using UnityEngine; using UnityEngine;
namespace Streamingle.Utils.RoughConstraintsEditor namespace Streamingle.Utils.LerpConstraintsEditor
{ {
[CustomEditor(typeof(RoughConstraintBase), true)] [CustomEditor(typeof(LerpConstraintBase), true)]
[CanEditMultipleObjects] [CanEditMultipleObjects]
public sealed class RoughConstraintEditor : UnityEditor.Editor public sealed class LerpConstraintEditor : UnityEditor.Editor
{ {
private SerializedProperty constraintActive; private SerializedProperty constraintActive;
private SerializedProperty locked; private SerializedProperty locked;
@ -18,7 +18,7 @@ namespace Streamingle.Utils.RoughConstraintsEditor
private SerializedProperty useUnscaledTime; private SerializedProperty useUnscaledTime;
private SerializedProperty snapOnEnable; private SerializedProperty snapOnEnable;
private ReorderableList sourceList; private ReorderableList sourceList;
private bool roughFollowFoldout = true; private bool lerpFollowFoldout = true;
private bool settingsFoldout = true; private bool settingsFoldout = true;
private void OnEnable() private void OnEnable()
@ -62,7 +62,7 @@ namespace Streamingle.Utils.RoughConstraintsEditor
GUILayout.FlexibleSpace(); GUILayout.FlexibleSpace();
if (GUILayout.Button("Activate", EditorStyles.miniButton, GUILayout.Width(72f))) if (GUILayout.Button("Activate", EditorStyles.miniButton, GUILayout.Width(72f)))
{ {
ApplyAction("Activate Rough Constraint", ActivateConstraint); ApplyAction("Activate Lerp Constraint", ActivateConstraint);
} }
if (GUILayout.Button("Zero", EditorStyles.miniButton, GUILayout.Width(56f))) if (GUILayout.Button("Zero", EditorStyles.miniButton, GUILayout.Width(56f)))
@ -84,8 +84,8 @@ namespace Streamingle.Utils.RoughConstraintsEditor
serializedObject.ApplyModifiedProperties(); serializedObject.ApplyModifiedProperties();
foreach (var selectedTarget in targets) foreach (var selectedTarget in targets)
{ {
var constraint = (RoughConstraintBase)selectedTarget; var constraint = (LerpConstraintBase)selectedTarget;
Undo.RecordObject(constraint, "Change Rough Constraint Lock"); Undo.RecordObject(constraint, "Change Lerp Constraint Lock");
constraint.SetLocked(newValue); constraint.SetLocked(newValue);
EditorUtility.SetDirty(constraint); EditorUtility.SetDirty(constraint);
} }
@ -102,8 +102,8 @@ namespace Streamingle.Utils.RoughConstraintsEditor
private void DrawTypeSettings() private void DrawTypeSettings()
{ {
roughFollowFoldout = EditorGUILayout.Foldout(roughFollowFoldout, "Rough Follow", true); lerpFollowFoldout = EditorGUILayout.Foldout(lerpFollowFoldout, "Lerp Follow", true);
if (roughFollowFoldout) if (lerpFollowFoldout)
{ {
using (new EditorGUI.IndentLevelScope()) using (new EditorGUI.IndentLevelScope())
{ {
@ -128,27 +128,27 @@ namespace Streamingle.Utils.RoughConstraintsEditor
private void DrawTypeProperties() private void DrawTypeProperties()
{ {
if (target is RoughPositionConstraint) if (target is LerpPositionConstraint)
{ {
DrawProperties("constrainedAxis", "positionOffset", "offsetInSourceSpace"); DrawProperties("constrainedAxis", "positionOffset", "offsetInSourceSpace");
} }
else if (target is RoughRotationConstraint) else if (target is LerpRotationConstraint)
{ {
DrawProperties("constrainedAxis", "rotationOffset"); DrawProperties("constrainedAxis", "rotationOffset");
} }
else if (target is RoughScaleConstraint) else if (target is LerpScaleConstraint)
{ {
DrawProperties("constrainedAxis", "scaleOffset"); DrawProperties("constrainedAxis", "scaleOffset");
} }
else if (target is RoughParentConstraint) else if (target is LerpParentConstraint)
{ {
DrawProperties("constrainedPositionAxis", "positionOffset", "positionOffsetInSourceSpace", "constrainedRotationAxis", "rotationOffset"); DrawProperties("constrainedPositionAxis", "positionOffset", "positionOffsetInSourceSpace", "constrainedRotationAxis", "rotationOffset");
} }
else if (target is RoughAimConstraint) else if (target is LerpAimConstraint)
{ {
DrawProperties("aimAxis", "upAxis", "worldUpVector", "rotationOffset"); DrawProperties("aimAxis", "upAxis", "worldUpVector", "rotationOffset");
} }
else if (target is RoughLookAtConstraint) else if (target is LerpLookAtConstraint)
{ {
DrawProperties("forwardAxis", "worldUpVector", "targetPositionOffset", "rotationOffset"); DrawProperties("forwardAxis", "worldUpVector", "targetPositionOffset", "rotationOffset");
} }
@ -166,22 +166,22 @@ namespace Streamingle.Utils.RoughConstraintsEditor
} }
} }
private void ApplyAction(string undoName, System.Action<RoughConstraintBase> action) private void ApplyAction(string undoName, System.Action<LerpConstraintBase> action)
{ {
serializedObject.ApplyModifiedProperties(); serializedObject.ApplyModifiedProperties();
foreach (var selectedTarget in targets) foreach (var selectedTarget in targets)
{ {
var constraint = (RoughConstraintBase)selectedTarget; var constraint = (LerpConstraintBase)selectedTarget;
Undo.RecordObject(constraint.transform, undoName); Undo.RecordObject(constraint.transform, undoName);
action(constraint); action(constraint);
EditorUtility.SetDirty(constraint.transform); EditorUtility.SetDirty(constraint.transform);
} }
} }
private void ActivateConstraint(RoughConstraintBase constraint) private void ActivateConstraint(LerpConstraintBase constraint)
{ {
Undo.RecordObject(constraint, "Activate Rough Constraint"); Undo.RecordObject(constraint, "Activate Lerp Constraint");
constraint.ActivateConstraint(); constraint.ActivateConstraint();
EditorUtility.SetDirty(constraint); EditorUtility.SetDirty(constraint);
} }
@ -189,7 +189,7 @@ namespace Streamingle.Utils.RoughConstraintsEditor
private void ZeroOffsets() private void ZeroOffsets()
{ {
serializedObject.ApplyModifiedProperties(); serializedObject.ApplyModifiedProperties();
Undo.RecordObjects(targets, "Zero Rough Constraint Offsets"); Undo.RecordObjects(targets, "Zero Lerp Constraint Offsets");
SetVector3IfExists("positionOffset", Vector3.zero); SetVector3IfExists("positionOffset", Vector3.zero);
SetVector3IfExists("rotationOffset", Vector3.zero); SetVector3IfExists("rotationOffset", Vector3.zero);
@ -261,13 +261,13 @@ namespace Streamingle.Utils.RoughConstraintsEditor
private string GetSettingsTitle() private string GetSettingsTitle()
{ {
if (target is RoughLookAtConstraint) if (target is LerpLookAtConstraint)
{ {
return "Look At"; return "Look At";
} }
var name = target.GetType().Name; var name = target.GetType().Name;
name = name.Replace("Rough", string.Empty).Replace("Constraint", string.Empty); name = name.Replace("Lerp", string.Empty).Replace("Constraint", string.Empty);
return ObjectNames.NicifyVariableName(name); return ObjectNames.NicifyVariableName(name);
} }
} }

View File

@ -0,0 +1,69 @@
using System;
using System.Linq;
using Streamingle.Utils.LerpConstraints;
using UnityEditor;
using UnityEngine;
namespace Streamingle.Utils.LerpConstraintsEditor
{
[InitializeOnLoad]
internal static class LerpConstraintIconInstaller
{
private const string IconDirectory = "Packages/com.streamingle.utilities/Editor/Constraints/Icons";
private static readonly IconDefinition[] IconDefinitions =
{
new IconDefinition(typeof(LerpAimConstraint), "LerpAimConstraintIcon"),
new IconDefinition(typeof(LerpLookAtConstraint), "LerpLookAtConstraintIcon"),
new IconDefinition(typeof(LerpParentConstraint), "LerpParentConstraintIcon"),
new IconDefinition(typeof(LerpPositionConstraint), "LerpPositionConstraintIcon"),
new IconDefinition(typeof(LerpRotationConstraint), "LerpRotationConstraintIcon"),
new IconDefinition(typeof(LerpScaleConstraint), "LerpScaleConstraintIcon")
};
static LerpConstraintIconInstaller()
{
EditorApplication.delayCall += ApplyIcons;
}
private static void ApplyIcons()
{
string[] scriptGuids = AssetDatabase.FindAssets(
"t:MonoScript",
new[] { "Packages/com.streamingle.utilities/Runtime/Constraints" });
foreach (IconDefinition definition in IconDefinitions)
{
Texture2D icon = AssetDatabase.LoadAssetAtPath<Texture2D>(
$"{IconDirectory}/{definition.IconName}.png");
if (icon == null)
{
continue;
}
MonoScript script = scriptGuids
.Select(AssetDatabase.GUIDToAssetPath)
.Select(AssetDatabase.LoadAssetAtPath<MonoScript>)
.FirstOrDefault(candidate => candidate != null && candidate.GetClass() == definition.ConstraintType);
if (script != null)
{
EditorGUIUtility.SetIconForObject(script, icon);
}
}
}
private readonly struct IconDefinition
{
public IconDefinition(Type constraintType, string iconName)
{
ConstraintType = constraintType;
IconName = iconName;
}
public Type ConstraintType { get; }
public string IconName { get; }
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 97633b0c6f0f4ca0a862c50e6de6f70b

View File

@ -1,8 +1,8 @@
using Streamingle.Utils.RoughConstraints; using Streamingle.Utils.LerpConstraints;
using UnityEditor; using UnityEditor;
using UnityEngine; using UnityEngine;
namespace Streamingle.Utils.RoughConstraintsEditor namespace Streamingle.Utils.LerpConstraintsEditor
{ {
[CustomPropertyDrawer(typeof(Vector3Bool))] [CustomPropertyDrawer(typeof(Vector3Bool))]
public sealed class Vector3BoolDrawer : UnityEditor.PropertyDrawer public sealed class Vector3BoolDrawer : UnityEditor.PropertyDrawer

View File

@ -1,10 +1,12 @@
using UnityEngine; using UnityEngine;
using UnityEngine.Scripting.APIUpdating;
namespace Streamingle.Utils.RoughConstraints namespace Streamingle.Utils.LerpConstraints
{ {
[MovedFrom(true, "Streamingle.Utils.RoughConstraints", "Assembly-CSharp", "RoughAimConstraint")]
[ExecuteAlways] [ExecuteAlways]
[AddComponentMenu("Streamingle Utilities/Constraints/Rough Aim Constraint")] [AddComponentMenu("Streamingle Utilities/Constraints/Lerp Aim Constraint")]
public class RoughAimConstraint : RoughConstraintBase public class LerpAimConstraint : LerpConstraintBase
{ {
[Header("Aim")] [Header("Aim")]
public Vector3 aimAxis = Vector3.forward; public Vector3 aimAxis = Vector3.forward;

View File

@ -1,12 +1,13 @@
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEngine.Scripting.APIUpdating;
#if UNITY_EDITOR #if UNITY_EDITOR
using UnityEditor; using UnityEditor;
#endif #endif
namespace Streamingle.Utils.RoughConstraints namespace Streamingle.Utils.LerpConstraints
{ {
public enum RoughConstraintUpdateMode public enum LerpConstraintUpdateMode
{ {
Update, Update,
LateUpdate, LateUpdate,
@ -14,8 +15,9 @@ namespace Streamingle.Utils.RoughConstraints
Manual Manual
} }
[MovedFrom(true, "Streamingle.Utils.RoughConstraints", "Assembly-CSharp", "RoughConstraintBase")]
[ExecuteAlways] [ExecuteAlways]
public abstract class RoughConstraintBase : MonoBehaviour public abstract class LerpConstraintBase : MonoBehaviour
{ {
[Header("Constraint")] [Header("Constraint")]
public bool constraintActive = true; public bool constraintActive = true;
@ -24,13 +26,13 @@ namespace Streamingle.Utils.RoughConstraints
[Range(0f, 1f)] [Range(0f, 1f)]
public float weight = 1f; public float weight = 1f;
public List<RoughConstraintSource> sources = new List<RoughConstraintSource>(); public List<LerpConstraintSource> sources = new List<LerpConstraintSource>();
[Header("Rough Follow")] [Header("Lerp Follow")]
[Min(0f)] [Min(0f)]
public float damping = 12f; public float damping = 12f;
public RoughConstraintUpdateMode updateMode = RoughConstraintUpdateMode.LateUpdate; public LerpConstraintUpdateMode updateMode = LerpConstraintUpdateMode.LateUpdate;
public bool useUnscaledTime; public bool useUnscaledTime;
public bool snapOnEnable = true; public bool snapOnEnable = true;
@ -47,7 +49,7 @@ namespace Streamingle.Utils.RoughConstraints
return 1f / 60f; return 1f / 60f;
} }
if (updateMode == RoughConstraintUpdateMode.FixedUpdate) if (updateMode == LerpConstraintUpdateMode.FixedUpdate)
{ {
return useUnscaledTime ? Time.fixedUnscaledDeltaTime : Time.fixedDeltaTime; return useUnscaledTime ? Time.fixedUnscaledDeltaTime : Time.fixedDeltaTime;
} }
@ -94,7 +96,7 @@ namespace Streamingle.Utils.RoughConstraints
{ {
if (!Application.isPlaying) if (!Application.isPlaying)
{ {
if (updateMode != RoughConstraintUpdateMode.Manual) if (updateMode != LerpConstraintUpdateMode.Manual)
{ {
Evaluate(); Evaluate();
} }
@ -102,7 +104,7 @@ namespace Streamingle.Utils.RoughConstraints
return; return;
} }
if (updateMode == RoughConstraintUpdateMode.Update) if (updateMode == LerpConstraintUpdateMode.Update)
{ {
Evaluate(); Evaluate();
} }
@ -115,7 +117,7 @@ namespace Streamingle.Utils.RoughConstraints
return; return;
} }
if (updateMode == RoughConstraintUpdateMode.LateUpdate) if (updateMode == LerpConstraintUpdateMode.LateUpdate)
{ {
Evaluate(); Evaluate();
} }
@ -128,7 +130,7 @@ namespace Streamingle.Utils.RoughConstraints
return; return;
} }
if (updateMode == RoughConstraintUpdateMode.FixedUpdate) if (updateMode == LerpConstraintUpdateMode.FixedUpdate)
{ {
Evaluate(); Evaluate();
} }
@ -165,7 +167,7 @@ namespace Streamingle.Utils.RoughConstraints
return; return;
} }
if (Application.isPlaying || updateMode == RoughConstraintUpdateMode.Manual) if (Application.isPlaying || updateMode == LerpConstraintUpdateMode.Manual)
{ {
return; return;
} }

View File

@ -1,10 +1,10 @@
using System; using System;
using UnityEngine; using UnityEngine;
namespace Streamingle.Utils.RoughConstraints namespace Streamingle.Utils.LerpConstraints
{ {
[Serializable] [Serializable]
public struct RoughConstraintSource public struct LerpConstraintSource
{ {
public Transform sourceTransform; public Transform sourceTransform;

View File

@ -1,10 +1,12 @@
using UnityEngine; using UnityEngine;
using UnityEngine.Scripting.APIUpdating;
namespace Streamingle.Utils.RoughConstraints namespace Streamingle.Utils.LerpConstraints
{ {
[MovedFrom(true, "Streamingle.Utils.RoughConstraints", "Assembly-CSharp", "RoughLookAtConstraint")]
[ExecuteAlways] [ExecuteAlways]
[AddComponentMenu("Streamingle Utilities/Constraints/Rough Look At Constraint")] [AddComponentMenu("Streamingle Utilities/Constraints/Lerp Look At Constraint")]
public class RoughLookAtConstraint : RoughConstraintBase public class LerpLookAtConstraint : LerpConstraintBase
{ {
[Header("Look At")] [Header("Look At")]
public Vector3 forwardAxis = Vector3.forward; public Vector3 forwardAxis = Vector3.forward;

View File

@ -1,10 +1,12 @@
using UnityEngine; using UnityEngine;
using UnityEngine.Scripting.APIUpdating;
namespace Streamingle.Utils.RoughConstraints namespace Streamingle.Utils.LerpConstraints
{ {
[MovedFrom(true, "Streamingle.Utils.RoughConstraints", "Assembly-CSharp", "RoughParentConstraint")]
[ExecuteAlways] [ExecuteAlways]
[AddComponentMenu("Streamingle Utilities/Constraints/Rough Parent Constraint")] [AddComponentMenu("Streamingle Utilities/Constraints/Lerp Parent Constraint")]
public class RoughParentConstraint : RoughConstraintBase public class LerpParentConstraint : LerpConstraintBase
{ {
[Header("Position")] [Header("Position")]
public Vector3Bool constrainedPositionAxis = Vector3Bool.All; public Vector3Bool constrainedPositionAxis = Vector3Bool.All;

View File

@ -1,10 +1,12 @@
using UnityEngine; using UnityEngine;
using UnityEngine.Scripting.APIUpdating;
namespace Streamingle.Utils.RoughConstraints namespace Streamingle.Utils.LerpConstraints
{ {
[MovedFrom(true, "Streamingle.Utils.RoughConstraints", "Assembly-CSharp", "RoughPositionConstraint")]
[ExecuteAlways] [ExecuteAlways]
[AddComponentMenu("Streamingle Utilities/Constraints/Rough Position Constraint")] [AddComponentMenu("Streamingle Utilities/Constraints/Lerp Position Constraint")]
public class RoughPositionConstraint : RoughConstraintBase public class LerpPositionConstraint : LerpConstraintBase
{ {
[Header("Position")] [Header("Position")]
public Vector3Bool constrainedAxis = Vector3Bool.All; public Vector3Bool constrainedAxis = Vector3Bool.All;

View File

@ -1,10 +1,12 @@
using UnityEngine; using UnityEngine;
using UnityEngine.Scripting.APIUpdating;
namespace Streamingle.Utils.RoughConstraints namespace Streamingle.Utils.LerpConstraints
{ {
[MovedFrom(true, "Streamingle.Utils.RoughConstraints", "Assembly-CSharp", "RoughRotationConstraint")]
[ExecuteAlways] [ExecuteAlways]
[AddComponentMenu("Streamingle Utilities/Constraints/Rough Rotation Constraint")] [AddComponentMenu("Streamingle Utilities/Constraints/Lerp Rotation Constraint")]
public class RoughRotationConstraint : RoughConstraintBase public class LerpRotationConstraint : LerpConstraintBase
{ {
[Header("Rotation")] [Header("Rotation")]
public Vector3Bool constrainedAxis = Vector3Bool.All; public Vector3Bool constrainedAxis = Vector3Bool.All;

View File

@ -1,10 +1,12 @@
using UnityEngine; using UnityEngine;
using UnityEngine.Scripting.APIUpdating;
namespace Streamingle.Utils.RoughConstraints namespace Streamingle.Utils.LerpConstraints
{ {
[MovedFrom(true, "Streamingle.Utils.RoughConstraints", "Assembly-CSharp", "RoughScaleConstraint")]
[ExecuteAlways] [ExecuteAlways]
[AddComponentMenu("Streamingle Utilities/Constraints/Rough Scale Constraint")] [AddComponentMenu("Streamingle Utilities/Constraints/Lerp Scale Constraint")]
public class RoughScaleConstraint : RoughConstraintBase public class LerpScaleConstraint : LerpConstraintBase
{ {
[Header("Scale")] [Header("Scale")]
public Vector3Bool constrainedAxis = Vector3Bool.All; public Vector3Bool constrainedAxis = Vector3Bool.All;

View File

@ -1,6 +1,6 @@
using System; using System;
namespace Streamingle.Utils.RoughConstraints namespace Streamingle.Utils.LerpConstraints
{ {
[Serializable] [Serializable]
public struct Vector3Bool public struct Vector3Bool

View File

@ -1,7 +1,7 @@
{ {
"name": "com.streamingle.utilities", "name": "com.streamingle.utilities",
"displayName": "Streamingle Utilities", "displayName": "Streamingle Utilities",
"version": "0.1.7", "version": "0.1.22",
"unity": "6000.0", "unity": "6000.0",
"description": "Reusable Streamingle runtime components and Unity editor utilities.", "description": "Reusable Streamingle runtime components and Unity editor utilities.",
"keywords": [ "keywords": [