-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #122 from cs-util-com/feature/ecsImprovements3
Feature/ecs improvements3
- Loading branch information
Showing
244 changed files
with
8,527 additions
and
970 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
CsCore/CsCoreUnity/Plugins/CsCoreUnity/com/csutil/animations/AnimationExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
CsCore/CsCoreUnity/Plugins/CsCoreUnity/com/csutil/editor/CopyPasteTransformComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
using UnityEditor; | ||
using UnityEngine; | ||
|
||
namespace com.csutil.editor { | ||
|
||
/// <summary> Modified version of https://github.com/sirgru/Unity-Simple-Editor-Shortcuts-Tools-Collection </summary> | ||
public static class CopyPasteTransformComponent { | ||
|
||
private static TransformData copiedTransformValues; | ||
|
||
[MenuItem("Edit/Copy Transform Values %#c", false, -101)] | ||
public static void CopyTransformValues() { | ||
if (Selection.gameObjects.Length == 0) return; | ||
var transformToCopy = Selection.gameObjects[0].transform; | ||
|
||
if (transformToCopy is RectTransform rt) { | ||
copiedTransformValues = new TransformData() { | ||
position = transformToCopy.position, | ||
rotation = transformToCopy.rotation, | ||
lossyScale = transformToCopy.lossyScale, | ||
}; | ||
// Additionally copy the anchors, pivot, width and height etc: | ||
copiedTransformValues.anchorMin = rt.anchorMin; | ||
copiedTransformValues.anchorMax = rt.anchorMax; | ||
copiedTransformValues.anchoredPosition = rt.anchoredPosition; | ||
copiedTransformValues.pivot = rt.pivot; | ||
copiedTransformValues.sizeDelta = rt.sizeDelta; | ||
} else { | ||
copiedTransformValues = new TransformData() { | ||
position = transformToCopy.position, | ||
rotation = transformToCopy.rotation, | ||
lossyScale = transformToCopy.lossyScale | ||
}; | ||
} | ||
} | ||
|
||
[MenuItem("Edit/Paste Transform Values %#v", false, -101)] | ||
public static void PasteTransformValues() { | ||
foreach (var selection in Selection.gameObjects) { | ||
Transform targetTransform = selection.transform; | ||
Undo.RecordObject(targetTransform, "Paste Transform Values"); | ||
|
||
targetTransform.position = copiedTransformValues.position; | ||
targetTransform.rotation = copiedTransformValues.rotation; | ||
targetTransform.scale(copiedTransformValues.lossyScale); | ||
if (targetTransform is RectTransform rt) { | ||
rt.anchorMin = copiedTransformValues.anchorMin; | ||
rt.anchorMax = copiedTransformValues.anchorMax; | ||
rt.anchoredPosition = copiedTransformValues.anchoredPosition; | ||
rt.pivot = copiedTransformValues.pivot; | ||
rt.sizeDelta = copiedTransformValues.sizeDelta; | ||
} | ||
|
||
} | ||
} | ||
|
||
private struct TransformData { | ||
public Vector3 position; | ||
public Quaternion rotation; | ||
public Vector3 lossyScale; | ||
public Vector2 anchorMin; | ||
public Vector2 anchorMax; | ||
public Vector2 anchoredPosition; | ||
public Vector2 pivot; | ||
public Vector2 sizeDelta; | ||
} | ||
|
||
} | ||
|
||
} |
3 changes: 3 additions & 0 deletions
3
CsCore/CsCoreUnity/Plugins/CsCoreUnity/com/csutil/editor/CopyPasteTransformComponent.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.