static private RuleFlags GetRuleFlags(RSResolvableValueData inValueData, RSLibrary inLibrary) { RuleFlags flags = 0; switch (inValueData.Mode) { case ResolvableValueMode.Query: { flags |= GetRuleFlags(inValueData.Query.Scope, inLibrary); flags |= GetRuleFlags(inLibrary.GetQuery(inValueData.Query.Id)); if (inValueData.QueryArguments != null) { foreach (var arg in inValueData.QueryArguments) { flags |= GetRuleFlags(arg, inLibrary); } } break; } case ResolvableValueMode.Register: { flags |= RuleFlags.UsesRegisters; break; } } return(flags); }
private void OnGUI() { RegenContext(); SyncAllowedListOperations(); float width = this.position.width; float thirdWidth = Mathf.Max(width / 3, 300) - EditorStyles.helpBox.padding.left; using (new EditorGUILayout.HorizontalScope()) { using (new EditorGUILayout.VerticalScope(GUILayout.Width(thirdWidth), GUILayout.ExpandWidth(true))) { GUILayout.Space(4); using (new EditorGUILayout.VerticalScope(EditorStyles.helpBox, GUILayout.Width(thirdWidth), GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true))) { RuleTableGUI(); GUILayout.FlexibleSpace(); } using (new EditorGUILayout.VerticalScope(EditorStyles.helpBox, GUILayout.Width(thirdWidth), GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true))) { ErrorGUI(); } using (new EditorGUILayout.VerticalScope(EditorStyles.helpBox, GUILayout.Width(thirdWidth), GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true))) { ConfigGUI(); } GUILayout.Space(4); } EditorGUI.BeginChangeCheck(); { using (new EditorGUILayout.VerticalScope(EditorStyles.helpBox, GUILayout.Width(thirdWidth), GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true))) { RuleInfoGUI(); } using (new EditorGUILayout.VerticalScope(EditorStyles.helpBox, GUILayout.Width(thirdWidth), GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true))) { ConditionInfoGUI(); ActionInfoGUI(); } } if (EditorGUI.EndChangeCheck() && m_SelectionState.Rule != null && m_Context.Library != null) { RuleFlags flags = TableUtils.GetRuleFlags(m_SelectionState.Rule, m_Context.Library); if (flags != m_SelectionState.Rule.Flags) { m_TargetState.UndoTarget.MarkDirty("Modified rule flags"); m_SelectionState.Rule.Flags = flags; } } } }
private ExecutionScope ConstructScope(RuleFlags inFlags) { Logger?.Warn("Constructing new execution scope"); if ((inFlags & RuleFlags.UsesRegisters) != 0) { return(new ExecutionScope(this, ExecutionScope.Type.Pooled | ExecutionScope.Type.Registers)); } return(new ExecutionScope(this, ExecutionScope.Type.Pooled)); }
static public RuleFlags GetRuleFlags(RSMemberFlags inFlags) { RuleFlags flags = 0; if ((inFlags & RSMemberFlags.UsesRegisters) != 0) { flags |= RuleFlags.UsesRegisters; } return(flags); }
static private RuleFlags GetRuleFlags(RSActionInfo inInfo) { RuleFlags flags = 0; if (inInfo != null) { flags |= GetRuleFlags(inInfo.Flags); } return(flags); }
internal bool CloneScopeIfNecessary(ExecutionScope inScope, RuleFlags inFlags, out ExecutionScope outScope) { if ((inFlags & RuleFlags.UsesRegisters) != 0) { outScope = CloneScope(inScope, inFlags); return(true); } outScope = inScope; return(false); }
static private RuleFlags GetRuleFlags(RSConditionData inConditionData, RSLibrary inLibrary) { RuleFlags flags = 0; if (inConditionData.Enabled) { flags |= GetRuleFlags(inConditionData.Query, inLibrary); if (inConditionData.Operator.IsBinary()) { flags |= GetRuleFlags(inConditionData.Target, inLibrary); } } return(flags); }
void ISerializedObject.Serialize(Serializer ioSerializer) { if (ioSerializer.ObjectVersion >= 4) { ioSerializer.Serialize("id", ref Id, string.Empty, FieldOptions.Optional | FieldOptions.PreferAttribute); } else { Id = string.Empty; } ioSerializer.Serialize("name", ref Name, string.Empty, FieldOptions.Optional | FieldOptions.PreferAttribute); ioSerializer.Serialize("group", ref RoutineGroup, string.Empty, FieldOptions.Optional | FieldOptions.PreferAttribute); if (ioSerializer.ObjectVersion >= 3) { ioSerializer.Enum("flags", ref Flags, FieldOptions.PreferAttribute); } else { Flags = 0; } ioSerializer.Serialize("enabled", ref Enabled, true, FieldOptions.PreferAttribute); ioSerializer.Serialize("onlyOnce", ref OnlyOnce, false, FieldOptions.Optional | FieldOptions.PreferAttribute); if (ioSerializer.ObjectVersion >= 2) { ioSerializer.Serialize("dontInterrupt", ref DontInterrupt, false, FieldOptions.PreferAttribute); } else { DontInterrupt = false; } ioSerializer.Int32Proxy("triggerId", ref TriggerId); ioSerializer.ObjectArray("conditions", ref Conditions, FieldOptions.Optional); if (Conditions != null && Conditions.Length > 0) { ioSerializer.Enum("conditionSubset", ref ConditionSubset, Subset.All); } ioSerializer.ObjectArray("actions", ref Actions); }
static private RuleFlags GetRuleFlags(RSActionData inActionData, RSLibrary inLibrary) { RuleFlags flags = 0; if (inActionData.Enabled) { flags |= GetRuleFlags(inActionData.Action.Scope, inLibrary); flags |= GetRuleFlags(inLibrary.GetAction(inActionData.Action.Id)); if (inActionData.Arguments != null) { foreach (var arg in inActionData.Arguments) { flags |= GetRuleFlags(arg, inLibrary); } } } return(flags); }
static private RuleFlags GetRuleFlags(NestedValue inValueData, RSLibrary inLibrary) { RuleFlags flags = 0; switch (inValueData.Mode) { case ResolvableValueMode.Query: { flags |= GetRuleFlags(inValueData.Query.Scope, inLibrary); flags |= GetRuleFlags(inLibrary.GetQuery(inValueData.Query.Id)); break; } case ResolvableValueMode.Register: { flags |= RuleFlags.UsesRegisters; break; } } return(flags); }
/// <summary> /// Outputs all flags for the given rule. /// </summary> static public RuleFlags GetRuleFlags(RSRuleData inRuleData, RSLibrary inLibrary) { Assert.True(inRuleData != null, "Cannot read from null rule"); RuleFlags flags = 0; if (inRuleData.Conditions != null) { foreach (var condition in inRuleData.Conditions) { flags |= GetRuleFlags(condition, inLibrary); } } if (inRuleData.Actions != null) { foreach (var action in inRuleData.Actions) { flags |= GetRuleFlags(action, inLibrary); } } return(flags); }
internal ExecutionScope CloneScope(ExecutionScope inScope, RuleFlags inFlags) { Assert.True(inScope != null && inScope.m_Environment == this); return(CreateScope(inScope.SelfEntity, inScope.Argument, inFlags)); }
internal ExecutionScope CreateScope(IRSRuntimeEntity inEntity, RSValue inArgument, RuleFlags inFlags) { List <ExecutionScope> pool; if ((inFlags & RuleFlags.UsesRegisters) != 0) { pool = m_RegisterScopePool; } else { pool = m_LocalScopePool; } ExecutionScope scope; int count = pool.Count; if (count > 0) { scope = pool[count - 1]; pool.RemoveAt(count - 1); } else { scope = ConstructScope(inFlags); } scope.Initialize(inEntity, inArgument); return(scope); }