public override void UpdatePosition(ScriptableBrushBaseAsset brush)
 {
     base.UpdatePosition(brush);
     if (brush.previewParent != null)
     {
         PixelPerfectUtils.RoundToPixelPerfect(brush.previewParent.transform, dpi);
     }
 }
        public override void ApplyModifier(ScriptableBrushBaseAsset brush)
        {
            var previewInstances = brush.previewInstances;

            foreach (var previewInstance in previewInstances)
            {
                PixelPerfectUtils.RoundToPixelPerfect(previewInstance.transform, dpi);
            }
        }
        public override void ApplyModifier(ScriptableBrushBaseAsset brush)
        {
            var previewParent = brush.previewParent;

            if (previewParent.childCount <= 1)
            {
                return;
            }

            for (var i = 0; i < previewParent.childCount; i++)
            {
                var t      = previewParent.GetChild(i);
                var len    = UnityEngine.Random.Range(minDistributionOffset, maxDistributionOffset);
                var angle  = UnityEngine.Random.Range(0, 360);
                var offset = Quaternion.Euler(0, 0, angle) * new Vector3(len, 0, 0);
                t.localPosition = offset;
            }
        }
Exemple #4
0
        public override void ApplyModifier(ScriptableBrushBaseAsset brush)
        {
            if (min <= 0 || max <= 1)
            {
                return;
            }

            var previewInstances = brush.previewInstances;

            foreach (var previewInstance in previewInstances)
            {
                var count = UnityEngine.Random.Range(min, max);
                for (var i = 0; i < count; i++)
                {
                    #if UNITY_EDITOR
                    var prefabRoot = UnityEditor.PrefabUtility.GetCorrespondingObjectFromSource(previewInstance);

                    if (prefabRoot != null)
                    {
                        UnityEditor.PrefabUtility.InstantiatePrefab(prefabRoot, previewInstance.transform.parent);
                    }
                    else
                    {
                        Instantiate(previewInstance, previewInstance.transform.parent);
                    }
#else
                    Instantiate(previewInstance, previewInstance.transform.parent);
#endif

                    // else
                    //     Instantiate (Selection.activeGameObject);

                    // PrefabUtility.InstantiatePrefab(prefab);
                    // GameObject.Instantiate(previewInstance);
                }
            }
        }
Exemple #5
0
 public virtual void ApplyModifier(ScriptableBrushBaseAsset brush)
 {
 }
Exemple #6
0
 public virtual void UpdatePosition(ScriptableBrushBaseAsset brush)
 {
 }