Example #1
0
        protected override void GenerateErrors(VFXInvalidateErrorReporter manager)
        {
            VFXSetting capacitySetting = GetSetting("capacity");

            if ((uint)capacitySetting.value > 1000000)
            {
                manager.RegisterError("CapacityOver1M", VFXErrorType.PerfWarning, "Systems with large capacities can be slow to simulate");
            }
            var data = GetData() as VFXDataParticle;

            if (data != null && data.boundsSettingMode == BoundsSettingMode.Recorded &&
                CanBeCompiled())
            {
                if (VFXViewWindow.currentWindow?.graphView?.attachedComponent == null ||
                    !BoardPreferenceHelper.IsVisible(BoardPreferenceHelper.Board.componentBoard, false))
                {
                    manager.RegisterError("NeedsRecording", VFXErrorType.Warning,
                                          "In order to record the bounds, the current graph needs to be attached to a scene instance via the Target Game Object panel");
                }

                try
                {
                    var boundsSlot = inputSlots.First(s => s.name == "bounds");
                    if (boundsSlot.AllChildrenWithLink().Any())
                    {
                        manager.RegisterError("OverriddenRecording", VFXErrorType.Warning,
                                              "This system bounds will not be recorded because they are set from operators.");
                    }
                }
                catch { /* do nothing*/ }
            }
        }
Example #2
0
        protected override void GenerateErrors(VFXInvalidateErrorReporter manager)
        {
            if (value is Texture texture && texture.dimension != TextureDimension.Cube)
            {
                manager.RegisterError("Slot_Value_Incorrect_TextureCube", VFXErrorType.Error, "This slot expects a Cubemap");
            }

            base.GenerateErrors(manager);
        }
        protected override void GenerateErrors(VFXInvalidateErrorReporter manager)
        {
            VFXSetting capacitySetting = GetSetting("capacity");

            if ((uint)capacitySetting.value > 1000000)
            {
                manager.RegisterError("CapacityOver1M", VFXErrorType.PerfWarning, "Systems with large capacities can be slow to simulate");
            }
        }
Example #4
0
        protected override void GenerateErrors(VFXInvalidateErrorReporter manager)
        {
            base.GenerateErrors(manager);
            var dataParticle = GetData() as VFXDataParticle;

            if (dataParticle != null && dataParticle.boundsSettingMode != BoundsSettingMode.Manual)
            {
                manager.RegisterError("WarningBoundsComputation", VFXErrorType.Warning, $"Bounds computation have no sense of what the scale of the output mesh is," +
                                      $" so the resulted computed bounds can be too small or big" +
                                      $" Please use padding to mitigate this discrepancy.");
            }
        }
        protected override void GenerateErrors(VFXInvalidateErrorReporter manager)
        {
            //Type isn't reachable ... but we already stored a type, log an error.
            if (m_customType == null &&
                !object.ReferenceEquals(m_customType, null) &&
                !string.IsNullOrEmpty(m_customType.text))
            {
                manager.RegisterError("CustomSpawnerIDNotFound", VFXErrorType.Error, "Can't find : " + m_customType.text);
            }

            if (customBehavior == null && m_customType != null)
            {
                if (m_customScript != null && m_customScript.GetClass() != null)
                {
                    manager.RegisterError("CustomSpawnerIDNotVFXSpawnerCallbacks", VFXErrorType.Error, string.Format("{0} isn't a VFXSpawnerCallbacks", m_customScript.GetClass()));
                }
                else
                {
                    manager.RegisterError("CustomSpawnerIDInvalid", VFXErrorType.Error, "Invalid ScriptableObject : " + (Type)m_customType);
                }
            }
        }
Example #6
0
        protected override void GenerateErrors(VFXInvalidateErrorReporter manager)
        {
            VFXSetting capacitySetting = GetSetting("capacity");

            if ((uint)capacitySetting.value > 1000000)
            {
                manager.RegisterError("CapacityOver1M", VFXErrorType.PerfWarning, "Systems with large capacities can be slow to simulate");
            }
            var data = GetData() as VFXDataParticle;

            if (data != null && CanBeCompiled())
            {
                if (data.boundsMode == BoundsSettingMode.Recorded)
                {
                    if (VFXViewWindow.GetWindow(GetGraph(), false, false)?.graphView?.attachedComponent == null ||
                        !BoardPreferenceHelper.IsVisible(BoardPreferenceHelper.Board.componentBoard, false))
                    {
                        manager.RegisterError("NeedsRecording", VFXErrorType.Warning,
                                              "In order to record the bounds, the current graph needs to be attached to a scene instance via the Target Game Object panel");
                    }
                    var boundsSlot = inputSlots.FirstOrDefault(s => s.name == "bounds");
                    if (boundsSlot != null && boundsSlot.HasLink(true))
                    {
                        manager.RegisterError("OverriddenRecording", VFXErrorType.Warning,
                                              "This system bounds will not be recorded because they are set from operators.");
                    }
                }

                if (data.boundsMode == BoundsSettingMode.Automatic)
                {
                    manager.RegisterError("CullingFlagAlwaysSimulate", VFXErrorType.Warning,
                                          "Setting the system Bounds Mode to Automatic will switch the culling flags of the Visual Effect asset" +
                                          " to 'Always recompute bounds and simulate'.");
                }
            }
        }
        protected override void GenerateErrors(VFXInvalidateErrorReporter manager)
        {
            base.GenerateErrors(manager);
            var dataParticle = GetData() as VFXDataParticle;

            if (dataParticle != null && dataParticle.boundsSettingMode != BoundsSettingMode.Manual)
            {
                var modifiedBounds = children
                                     .SelectMany(b =>
                                                 b.attributes)
                                     .Any(attr => attr.mode.HasFlag(VFXAttributeMode.Write) &&
                                          (attr.attrib.name.Contains("size") ||
                                           attr.attrib.name.Contains("position") ||
                                           attr.attrib.name.Contains("scale") ||
                                           attr.attrib.name.Contains("pivot")));
                if (modifiedBounds && CanBeCompiled())
                {
                    manager.RegisterError("WarningBoundsComputation", VFXErrorType.Warning, $"Bounds computation during recording is based on Position and Size in the Update Context." +
                                          $" Changing these properties now could lead to incorrect bounds." +
                                          $" Use padding to mitigate this discrepancy.");
                }
            }
        }
Example #8
0
        protected override void GenerateErrors(VFXInvalidateErrorReporter manager)
        {
            base.GenerateErrors(manager);
            var dataParticle = GetData() as VFXDataParticle;

            if (dataParticle != null && dataParticle.boundsMode != BoundsSettingMode.Manual)
            {
                var modifiedBounds = children
                                     .SelectMany(b =>
                                                 b.attributes)
                                     .Any(attr => attr.mode.HasFlag(VFXAttributeMode.Write) &&
                                          (attr.attrib.name.Contains("size") ||
                                           attr.attrib.name.Contains("position") ||
                                           attr.attrib.name.Contains("scale") ||
                                           attr.attrib.name.Contains("pivot")));
                if (modifiedBounds && CanBeCompiled())
                {
                    manager.RegisterError("WarningBoundsComputation", VFXErrorType.Warning,
                                          $"Bounds computation during recording is based on Position and Size in the Update Context." +
                                          $" Changing these properties now could lead to incorrect bounds." +
                                          $" Use padding to mitigate this discrepancy.");
                }
            }

            if (HasSorting())
            {
                if (!needsOwnSort)
                {
                    var modifiedAttributes = children
                                             .Where(c => c.enabled)
                                             .SelectMany(b => b.attributes)
                                             .Where(a => a.mode.HasFlag(VFXAttributeMode.Write))
                                             .Select(a => a.attrib);
                    bool isCriterionModified = false;

                    if (HasCustomSortingCriterion())
                    {
                        HashSet <VFXExpression> sortKeyExpressions = new HashSet <VFXExpression>();
                        var sortKeyExp = inputSlots.First(s => s.name == "sortKey").GetExpression();
                        VFXExpression.CollectParentExpressionRecursively(sortKeyExp, sortKeyExpressions);

                        foreach (var modifiedAttribute in modifiedAttributes)
                        {
                            isCriterionModified |=
                                sortKeyExpressions.Contains(new VFXAttributeExpression(modifiedAttribute));
                        }
                    }
                    else
                    {
                        var usedAttributesInSorting = VFXSortingUtility.GetSortingDependantAttributes(sortMode);
                        isCriterionModified = usedAttributesInSorting.Intersect(modifiedAttributes).Any();
                    }

                    if (isCriterionModified)
                    {
                        manager.RegisterError("SortingKeyOverriden", VFXErrorType.Warning,
                                              $"Sorting happens in Update, before the attributes were modified in the Output context." +
                                              $" All the modifications made here will not be taken into account during sorting.");
                    }
                }

                if (sortMode == SortCriteria.YoungestInFront)
                {
                    if (!GetData().IsAttributeUsed(VFXAttribute.Age))
                    {
                        manager.RegisterError("NoAgeToSort", VFXErrorType.Warning,
                                              $"The sorting mode depends on the Age attribute, which is neither set nor updated in this system.");
                    }
                }
            }
        }