1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.Rendering;
- namespace COM3D2.MeidoPhotoStudio.Plugin
- {
- public class DragPointBody : DragPointGeneral
- {
- public bool IsCube;
- private bool isIK;
- public bool IsIK
- {
- get => isIK;
- set
- {
- if (isIK != value)
- {
- isIK = value;
- ApplyDragType();
- }
- }
- }
- protected override void ApplyDragType()
- {
- bool enabled = !IsIK && (Transforming || Selecting);
- bool select = IsIK && Selecting;
- ApplyProperties(enabled || select, IsCube && enabled, false);
- if (IsCube) ApplyColours();
- }
- }
- public class DragPointBG : DragPointGeneral
- {
- public override void Set(Transform myObject)
- {
- base.Set(myObject);
- DefaultPosition = myObject.position;
- }
- protected override void ApplyDragType()
- {
- ApplyProperties(Transforming, Transforming, Rotating);
- ApplyColours();
- }
- }
- public class DragPointDogu : DragPointGeneral
- {
- private List<Renderer> meshRenderers;
- public AttachPointInfo attachPointInfo = AttachPointInfo.Empty;
- public string Name => MyGameObject.name;
- public string assetName = string.Empty;
- public bool ShadowCasting
- {
- get
- {
- if (meshRenderers.Count == 0) return false;
- return meshRenderers[0].shadowCastingMode == ShadowCastingMode.On;
- }
- set
- {
- foreach (Renderer renderer in meshRenderers)
- {
- renderer.shadowCastingMode = value ? ShadowCastingMode.On : ShadowCastingMode.Off;
- }
- }
- }
- public override void Set(Transform myObject)
- {
- base.Set(myObject);
- DefaultRotation = MyObject.rotation;
- DefaultPosition = MyObject.position;
- meshRenderers = new List<Renderer>(MyObject.GetComponentsInChildren<SkinnedMeshRenderer>());
- meshRenderers.AddRange(MyObject.GetComponentsInChildren<MeshRenderer>());
- }
- protected override void ApplyDragType()
- {
- bool active = (DragPointEnabled && Transforming) || Special;
- ApplyProperties(active, active, GizmoEnabled && Rotating);
- ApplyColours();
- }
- protected override void OnDestroy()
- {
- GameObject.Destroy(MyGameObject);
- base.OnDestroy();
- }
- }
- }
|