Exemple #1
0
        private static bool SetRendererProperty(GameObject go, string rendererName, RendererProperties property, int value, ObjectType objectType)
        {
            bool didSet = false;

            foreach (var rend in GetRendererList(go, objectType))
            {
                if (rend.NameFormatted() == rendererName)
                {
                    if (property == RendererProperties.ShadowCastingMode)
                    {
                        rend.shadowCastingMode = (UnityEngine.Rendering.ShadowCastingMode)value;
                        didSet = true;
                    }
                    else if (property == RendererProperties.ReceiveShadows)
                    {
                        rend.receiveShadows = value == 1;
                        didSet = true;
                    }
                    else if (property == RendererProperties.Enabled)
                    {
                        rend.enabled = value == 1;
                        didSet       = true;
                    }
                }
            }
            return(didSet);
        }
Exemple #2
0
 public RendererProperty(int id, string rendererName, RendererProperties property, string value, string valueOriginal)
 {
     ID            = id;
     RendererName  = rendererName.Replace("(Instance)", "").Trim();
     Property      = property;
     Value         = value;
     ValueOriginal = valueOriginal;
 }
 public void AddRendererProperty(int id, string rendererName, RendererProperties property, string value, string valueOriginal, GameObject gameObject, bool setProperty = true)
 {
     AddRendererProperty(id, rendererName, property, value, valueOriginal);
     if (setProperty)
     {
         SetRendererProperty(gameObject, rendererName, property, value);
     }
 }
Exemple #4
0
 public RendererProperty(ObjectType objectType, int coordinateIndex, int slot, string rendererName, RendererProperties property, string value, string valueOriginal)
 {
     ObjectType      = objectType;
     CoordinateIndex = coordinateIndex;
     Slot            = slot;
     RendererName    = rendererName.Replace("(Instance)", "").Trim();
     Property        = property;
     Value           = value;
     ValueOriginal   = valueOriginal;
 }
 public override void RemoveRendererProperty(object data, Renderer renderer, RendererProperties property, GameObject go)
 {
     if (data is ObjectData objectData)
     {
         var chaControl = go.GetComponentInParent <ChaControl>();
         MaterialEditorPlugin.GetCharaController(chaControl).RemoveRendererProperty(objectData.Slot, objectData.ObjectType, renderer, property, go);
     }
     else
     {
         GetSceneController().RemoveRendererProperty((int)data, renderer, property);
     }
 }
 public void RemoveRendererProperty(int id, string rendererName, RendererProperties property, GameObject gameObject, bool setProperty = true)
 {
     if (setProperty)
     {
         var original = GetRendererPropertyValueOriginal(id, rendererName, property);
         if (!original.IsNullOrEmpty())
         {
             SetRendererProperty(gameObject, rendererName, property, original);
         }
     }
     RemoveRendererProperty(id, rendererName, property);
 }
        internal override void RemoveRendererProperty(int slot, Renderer renderer, RendererProperties property, GameObject gameObject)
        {
            var chaControl = gameObject.GetComponent <ChaControl>();

            if (chaControl != null)
            {
                MaterialEditorPlugin.GetCharaController(chaControl).RemoveRendererProperty(slot, renderer, property, gameObject);
            }
            else
            {
                GetSceneController().RemoveRendererProperty(slot, renderer, property);
            }
        }
 private static void SetRendererProperty(Renderer rend, RendererProperties property, int value)
 {
     if (property == RendererProperties.ShadowCastingMode)
     {
         rend.shadowCastingMode = (UnityEngine.Rendering.ShadowCastingMode)value;
     }
     else if (property == RendererProperties.ReceiveShadows)
     {
         rend.receiveShadows = value == 1;
     }
     else if (property == RendererProperties.Enabled)
     {
         rend.enabled = value == 1;
     }
 }
Exemple #9
0
            public void AddRendererProperty(int id, string rendererName, RendererProperties property, string value, string valueOriginal)
            {
                var rendererProperty = RendererPropertyList.FirstOrDefault(x => x.ID == id && x.Property == property && x.RendererName == rendererName);

                if (rendererProperty == null)
                {
                    RendererPropertyList.Add(new RendererProperty(id, rendererName, property, value, valueOriginal));
                }
                else
                {
                    if (value == rendererProperty.ValueOriginal)
                    {
                        RendererPropertyList.Remove(rendererProperty);
                    }
                    else
                    {
                        rendererProperty.Value = value;
                    }
                }
            }
Exemple #10
0
 public abstract void SetRendererProperty(object data, Renderer renderer, RendererProperties property, string value, GameObject gameObject);
Exemple #11
0
 public abstract string GetRendererPropertyValueOriginal(object data, Renderer renderer, RendererProperties property, GameObject gameObject);
Exemple #12
0
 internal override void RemoveRendererProperty(ObjectType objectType, int coordinateIndex, int slot, string rendererName, RendererProperties property, GameObject gameObject) =>
 GetSceneController().RemoveRendererProperty(slot, rendererName, property, gameObject);
 public override string GetRendererPropertyValueOriginal(object data, Renderer renderer, RendererProperties property, GameObject go)
 {
     if (data is ObjectData objectData)
     {
         var chaControl = go.GetComponentInParent <ChaControl>();
         return(MaterialEditorPlugin.GetCharaController(chaControl).GetRendererPropertyValueOriginal(objectData.Slot, objectData.ObjectType, renderer, property, go));
     }
     else
     {
         return(GetSceneController().GetRendererPropertyValueOriginal((int)data, renderer, property));
     }
 }
 internal abstract string GetRendererPropertyValueOriginal(int slot, Renderer renderer, RendererProperties property, GameObject gameObject);
 /// <summary>
 /// Set the value of the specified renderer property
 /// </summary>
 /// <param name="gameObject">GameObject to search for the renderer</param>
 /// <param name="rendererName">Name of the renderer being modified</param>
 /// <param name="propertyName">Property of the renderer being modified</param>
 /// <param name="value">Value to be set</param>
 /// <returns>True if the value was set, false if it could not be set</returns>
 public static bool SetRendererProperty(GameObject gameObject, string rendererName, RendererProperties propertyName, string value) => SetRendererProperty(gameObject, rendererName, propertyName, int.Parse(value));
 public string GetRendererPropertyValueOriginal(int id, string rendererName, RendererProperties property) => null;
 public void AddRendererProperty(int id, string rendererName, RendererProperties property, string value, string valueOriginal)
 {
 }
Exemple #18
0
        public override string GetRendererPropertyValueOriginal(object data, Renderer renderer, RendererProperties property, GameObject go)
        {
            ObjectData objectData = (ObjectData)data;

            return(MaterialEditorPlugin.GetCharaController(MakerAPI.GetCharacterControl()).GetRendererPropertyValueOriginal(objectData.Slot, objectData.ObjectType, renderer, property, go));
        }
Exemple #19
0
 private static bool SetRendererProperty(GameObject go, string rendererName, RendererProperties property, string value, ObjectType objectType) => SetRendererProperty(go, rendererName, property, int.Parse(value), objectType);
 internal abstract void RemoveRendererProperty(int slot, Renderer renderer, RendererProperties property, GameObject gameObject);
 internal abstract void SetRendererProperty(int slot, Renderer renderer, RendererProperties property, string value, GameObject gameObject);
Exemple #22
0
 public abstract void RemoveRendererProperty(object data, Renderer renderer, RendererProperties property, GameObject gameObject);
 /// <summary>
 /// Set the value of the specified renderer property
 /// </summary>
 /// <param name="chaControl">ChaControl to search for the renderer. Only parts comprising the body and face will be searched, not clothes, accessories, etc.</param>
 /// <param name="rendererName">Name of the renderer being modified</param>
 /// <param name="propertyName">Property of the renderer being modified</param>
 /// <param name="value">Value to be set</param>
 /// <returns>True if the value was set, false if it could not be set</returns>
 public static bool SetRendererProperty(ChaControl chaControl, string rendererName, RendererProperties propertyName, int value) => SetRendererProperty(chaControl.gameObject, rendererName, propertyName, value);
Exemple #24
0
 public void RemoveRendererProperty(int id, string rendererName, RendererProperties property) =>
 RendererPropertyList.RemoveAll(x => x.ID == id && x.Property == property && x.RendererName == rendererName);
 /// <summary>
 /// Set the value of the specified renderer property
 /// </summary>
 /// <param name="gameObject">GameObject to search for the renderer</param>
 /// <param name="rendererName">Name of the renderer being modified</param>
 /// <param name="propertyName">Property of the renderer being modified</param>
 /// <param name="value">Value to be set</param>
 /// <returns>True if the value was set, false if it could not be set</returns>
 public static bool SetRendererProperty(GameObject gameObject, string rendererName, RendererProperties propertyName, int value)
 {
     if (propertyName == RendererProperties.Enabled)
     {
         return(SetRendererEnabled(gameObject, rendererName, value == 1));
     }
     if (propertyName == RendererProperties.ShadowCastingMode)
     {
         return(SetRendererShadowCastingMode(gameObject, rendererName, (UnityEngine.Rendering.ShadowCastingMode)value));
     }
     if (propertyName == RendererProperties.ReceiveShadows)
     {
         return(SetRendererReceiveShadows(gameObject, rendererName, value == 1));
     }
     return(false);
 }
 internal override void RemoveRendererProperty(ObjectType objectType, int coordinateIndex, int slot, string rendererName, RendererProperties property, GameObject gameObject) =>
 MaterialEditorPlugin.GetCharaController(MakerAPI.GetCharacterControl()).RemoveRendererProperty(objectType, coordinateIndex, slot, rendererName, property, gameObject);
Exemple #27
0
 public string GetRendererPropertyValueOriginal(int id, string rendererName, RendererProperties property) =>
 RendererPropertyList.FirstOrDefault(x => x.ID == id && x.Property == property && x.RendererName == rendererName)?.ValueOriginal;
Exemple #28
0
        public override void RemoveRendererProperty(object data, Renderer renderer, RendererProperties property, GameObject go)
        {
            ObjectData objectData = (ObjectData)data;

            MaterialEditorPlugin.GetCharaController(MakerAPI.GetCharacterControl()).RemoveRendererProperty(objectData.Slot, objectData.ObjectType, renderer, property, go);
        }
 public void RemoveRendererProperty(int id, string rendererName, RendererProperties property)
 {
 }
 internal override string GetRendererPropertyValueOriginal(ObjectType objectType, int coordinateIndex, int slot, string rendererName, RendererProperties property) =>
 MaterialEditorPlugin.GetCharaController(MakerAPI.GetCharacterControl()).GetRendererPropertyValueOriginal(objectType, coordinateIndex, slot, rendererName, property);