mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 14:24:53 +08:00
[unity] PhysicsConstraints: Added inspector properties for Movement relative to, see previous commit 4266c72.
This commit is contained in:
parent
4266c727cb
commit
ad825305f0
@ -62,7 +62,7 @@ namespace Spine.Unity.Editor {
|
||||
SerializedProperty skeletonDataAsset, initialSkinName;
|
||||
SerializedProperty startingAnimation, startingLoop, timeScale, freeze,
|
||||
updateTiming, updateWhenInvisible, unscaledTime, tintBlack, layoutScaleMode, editReferenceRect;
|
||||
SerializedProperty applyTranslationToPhysics, applyRotationToPhysics;
|
||||
SerializedProperty applyTranslationToPhysics, applyRotationToPhysics, physicsMovementRelativeTo;
|
||||
SerializedProperty initialFlipX, initialFlipY;
|
||||
SerializedProperty meshGeneratorSettings;
|
||||
SerializedProperty allowMultipleCanvasRenderers, separatorSlotNames, enableSeparatorSlots,
|
||||
@ -77,6 +77,8 @@ namespace Spine.Unity.Editor {
|
||||
"When enabled, the GameObject Transform translation movement is applied to PhysicsConstraints of the skeleton.");
|
||||
readonly GUIContent ApplyRotationToPhysicsLabel = new GUIContent("Transform Rotation",
|
||||
"When enabled, the GameObject Transform rotation movement is applied to PhysicsConstraints of the skeleton.");
|
||||
readonly GUIContent PhysicsMovementRelativeToLabel = new GUIContent("Movement relative to",
|
||||
"Reference transform relative to which physics movement will be calculated, or null to use world location.");
|
||||
|
||||
SkeletonGraphic thisSkeletonGraphic;
|
||||
protected bool isInspectingPrefab;
|
||||
@ -143,6 +145,7 @@ namespace Spine.Unity.Editor {
|
||||
editReferenceRect = so.FindProperty("editReferenceRect");
|
||||
applyTranslationToPhysics = so.FindProperty("applyTranslationToPhysics");
|
||||
applyRotationToPhysics = so.FindProperty("applyRotationToPhysics");
|
||||
physicsMovementRelativeTo = so.FindProperty("physicsMovementRelativeTo");
|
||||
|
||||
meshGeneratorSettings = so.FindProperty("meshGenerator").FindPropertyRelative("settings");
|
||||
meshGeneratorSettings.isExpanded = SkeletonRendererInspector.advancedFoldout;
|
||||
@ -320,6 +323,7 @@ namespace Spine.Unity.Editor {
|
||||
EditorGUILayout.LabelField(SpineInspectorUtility.TempContent("Physics Constraints", SpineEditorUtilities.Icons.constraintPhysics), EditorStyles.boldLabel);
|
||||
EditorGUILayout.PropertyField(applyTranslationToPhysics, ApplyTranslationToPhysicsLabel);
|
||||
EditorGUILayout.PropertyField(applyRotationToPhysics, ApplyRotationToPhysicsLabel);
|
||||
EditorGUILayout.PropertyField(physicsMovementRelativeTo, PhysicsMovementRelativeToLabel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -68,7 +68,7 @@ namespace Spine.Unity.Editor {
|
||||
protected SerializedProperty normals, tangents, zSpacing, pmaVertexColors, tintBlack; // MeshGenerator settings
|
||||
protected SerializedProperty maskInteraction;
|
||||
protected SerializedProperty maskMaterialsNone, maskMaterialsInside, maskMaterialsOutside;
|
||||
protected SerializedProperty applyTranslationToPhysics, applyRotationToPhysics;
|
||||
protected SerializedProperty applyTranslationToPhysics, applyRotationToPhysics, physicsMovementRelativeTo;
|
||||
protected SpineInspectorUtility.SerializedSortingProperties sortingProperties;
|
||||
protected bool wasInitParameterChanged = false;
|
||||
protected bool requireRepaint = false;
|
||||
@ -88,10 +88,12 @@ namespace Spine.Unity.Editor {
|
||||
protected GUIContent MaskMaterialsHeadingLabel, MaskMaterialsNoneLabel, MaskMaterialsInsideLabel, MaskMaterialsOutsideLabel;
|
||||
protected GUIContent SetMaterialButtonLabel, ClearMaterialButtonLabel, DeleteMaterialButtonLabel;
|
||||
|
||||
readonly GUIContent ApplyTranslationToPhysicsLabel = new GUIContent ("Transform Translation",
|
||||
readonly GUIContent ApplyTranslationToPhysicsLabel = new GUIContent("Transform Translation",
|
||||
"When enabled, the GameObject Transform translation movement is applied to PhysicsConstraints of the skeleton.");
|
||||
readonly GUIContent ApplyRotationToPhysicsLabel = new GUIContent ("Transform Rotation",
|
||||
readonly GUIContent ApplyRotationToPhysicsLabel = new GUIContent("Transform Rotation",
|
||||
"When enabled, the GameObject Transform rotation movement is applied to PhysicsConstraints of the skeleton.");
|
||||
readonly GUIContent PhysicsMovementRelativeToLabel = new GUIContent("Movement relative to",
|
||||
"Reference transform relative to which physics movement will be calculated, or null to use world location.");
|
||||
|
||||
const string ReloadButtonString = "Reload";
|
||||
static GUILayoutOption reloadButtonWidth;
|
||||
@ -169,6 +171,7 @@ namespace Spine.Unity.Editor {
|
||||
maskMaterialsOutside = so.FindProperty("maskMaterials.materialsOutsideMask");
|
||||
applyTranslationToPhysics = so.FindProperty("applyTranslationToPhysics");
|
||||
applyRotationToPhysics = so.FindProperty("applyRotationToPhysics");
|
||||
physicsMovementRelativeTo = so.FindProperty("physicsMovementRelativeTo");
|
||||
|
||||
separatorSlotNames = so.FindProperty("separatorSlotNames");
|
||||
separatorSlotNames.isExpanded = true;
|
||||
@ -418,6 +421,7 @@ namespace Spine.Unity.Editor {
|
||||
EditorGUILayout.LabelField(SpineInspectorUtility.TempContent("Physics Constraints", SpineEditorUtilities.Icons.constraintPhysics), EditorStyles.boldLabel);
|
||||
EditorGUILayout.PropertyField(applyTranslationToPhysics, ApplyTranslationToPhysicsLabel);
|
||||
EditorGUILayout.PropertyField(applyRotationToPhysics, ApplyRotationToPhysicsLabel);
|
||||
EditorGUILayout.PropertyField(physicsMovementRelativeTo, PhysicsMovementRelativeToLabel);
|
||||
}
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
@ -389,7 +389,7 @@ namespace Spine.Unity {
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void ApplyTransformMovementToPhysics() {
|
||||
public virtual void ApplyTransformMovementToPhysics () {
|
||||
if (Application.isPlaying) {
|
||||
if (applyTranslationToPhysics) {
|
||||
Vector2 position = GetPhysicsTransformPosition();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user