private void InitDialogFromMaskMode(MaskMode maskMode) { switch (maskMode) { case MaskMode.R: UpdateColorTransferMode("RGB"); _curveControl.SetSelected(0, true); _curveControl.SetSelected(1, false); _curveControl.SetSelected(2, false); break; case MaskMode.G: UpdateColorTransferMode("RGB"); _curveControl.SetSelected(0, false); _curveControl.SetSelected(1, true); _curveControl.SetSelected(2, false); break; case MaskMode.B: UpdateColorTransferMode("RGB"); _curveControl.SetSelected(0, false); _curveControl.SetSelected(1, false); _curveControl.SetSelected(2, true); break; default: case MaskMode.RGB: UpdateColorTransferMode("Luminosity"); _curveControl.SetSelected(0, true); break; } }
internal static void AddMask(dynamic ps, MaskMode maskMode) { //if (maskMode == MaskMode.RevealSelection && !HasSelection(ps)) // maskMode = MaskMode.RevealAll; //else if (maskMode == MaskMode.HideSelection && !HasSelection(ps)) // maskMode = MaskMode.HideAll; string maskModeId = CharIDFromMaskMode(maskMode); var idMk = ps.CharIDToTypeID("Mk "); dynamic desc2 = Activator.CreateInstance(_actionDescriptorType); var idNw = ps.CharIDToTypeID("Nw "); var idChnl = ps.CharIDToTypeID("Chnl"); desc2.PutClass(idNw, idChnl); var idAt = ps.CharIDToTypeID("At "); dynamic ref1 = Activator.CreateInstance(_actionReferenceType); var idChnl1 = ps.CharIDToTypeID("Chnl"); var idChnl2 = ps.CharIDToTypeID("Chnl"); var idMsk = ps.CharIDToTypeID("Msk "); ref1.PutEnumerated(idChnl1, idChnl2, idMsk); desc2.PutReference(idAt, ref1); var idUsng = ps.CharIDToTypeID("Usng"); var idUsrM = ps.CharIDToTypeID("UsrM"); var idMaskMode = ps.CharIDToTypeID(maskModeId); desc2.PutEnumerated(idUsng, idUsrM, idMaskMode); ps.ExecuteAction(idMk, desc2, PsDialogModes.psDisplayNoDialogs); }
// Invoked from World.Settings internal static void LoadSettings(IEnumerable <XElement> xmlToolSettings) { foreach (var xElement in xmlToolSettings.Elements("Tool")) { string toolName = (string)xElement.Attribute("Name"); switch (toolName) { case "Paint": _paintMode = (PaintMode)ToEnum(typeof(PaintMode), (string)xElement.Attribute("Mode") ?? PaintMode.Tile.ToString()); break; case "Brush": _brushWidth = (int?)xElement.Attribute("Width") ?? 20; _brushHeight = (int?)xElement.Attribute("Height") ?? 20; _brushOutline = (int?)xElement.Attribute("Outline") ?? 1; _brushShape = (BrushShape)ToEnum(typeof(BrushShape), (string)xElement.Attribute("Shape") ?? BrushShape.Square.ToString()); break; case "Tile": _paintTile = (int?)xElement.Attribute("Tile") ?? 0; _paintTileMask = (int?)xElement.Attribute("Mask") ?? 0; _paintTileMaskMode = (MaskMode)ToEnum(typeof(MaskMode), (string)xElement.Attribute("Mode") ?? MaskMode.Off.ToString()); break; case "Wall": _paintWall = (int?)xElement.Attribute("Wall") ?? 0; _paintWallMask = (int?)xElement.Attribute("Mask") ?? 0; _paintWallMaskMode = (MaskMode)ToEnum(typeof(MaskMode), (string)xElement.Attribute("Mode") ?? MaskMode.Off.ToString()); break; } } }
/// <summary> /// Another constructor for the class, this method allows the developer to specify /// the mask mode and expressions to be used. /// </summary> /// <param name="evalMode">The mask mode (i.e. per character, on leave, or both) to be employ</param> /// <param name="leaveExpression">The expression used to evalute input on leave</param> /// <param name="keystrokeExpression">The expression used to evaluate input as characters are typed</param> public MaskedEditTextBox(MaskMode evalMode, string leaveExpression, string keystrokeExpression) { // This call is required by the Windows.Forms Form Designer. InitializeComponent(); //set mask mode this.Mode = evalMode; //initialize appropriate expressions switch (evalMode) { case MaskMode.KeyPress: this.keyPressExpression = new Regex(keystrokeExpression); break; case MaskMode.Leave: this.expression = new Regex(leaveExpression); break; case MaskMode.Both: this.keyPressExpression = new Regex(keystrokeExpression); this.expression = new Regex(leaveExpression); break; } }
/// <summary> /// Adds mask to a current layer. /// </summary> /// <exception cref="ArgumentOutOfRangeException">When mask mode is out of range.</exception> /// <exception cref="Exception"></exception> internal static void ApplyMaskFromSelection(dynamic ps, MaskMode maskMode) { string selectionMode = CharIDFromMaskMode(maskMode); var idMk = ps.CharIDToTypeID("Mk "); dynamic desc2 = Activator.CreateInstance(_actionDescriptorType); var idNw = ps.CharIDToTypeID("Nw "); var idChnl = ps.CharIDToTypeID("Chnl"); desc2.PutClass(idNw, idChnl); var idAt = ps.CharIDToTypeID("At "); dynamic ref1 = Activator.CreateInstance(_actionReferenceType); var idChnl1 = ps.CharIDToTypeID("Chnl"); var idChnl2 = ps.CharIDToTypeID("Chnl"); var idMsk = ps.CharIDToTypeID("Msk "); ref1.PutEnumerated(idChnl1, idChnl2, idMsk); desc2.PutReference(idAt, ref1); var idUsng = ps.CharIDToTypeID("Usng"); var idUsrM = ps.CharIDToTypeID("UsrM"); var idSelection = ps.CharIDToTypeID(selectionMode); desc2.PutEnumerated(idUsng, idUsrM, idSelection); ps.ExecuteAction(idMk, desc2, PsDialogModes.psDisplayNoDialogs); }
/// <summary> /// Sets current mask mode. /// </summary> public void SetMaskMode(MaskMode maskMode) { if (this.maskMode == maskMode) { return; } this.maskMode = maskMode; SetMaterialDirty(); }
internal static string CharIDFromMaskMode(MaskMode maskMode) { return(maskMode switch { MaskMode.RevealAll => "RvlA", MaskMode.HideAll => "HdAl", MaskMode.RevealSelection => "RvlS", MaskMode.HideSelection => "HdSl", _ => throw new ArgumentOutOfRangeException(nameof(maskMode), maskMode + " is not supported.") });
public static void SetMaskModeStatic(MaskMode maskMode) { InitMaskMode = maskMode; // Debug.Log("set init mask"); if (MainInstance != null) { MainInstance.CurrentMaskMode = maskMode; // Debug.Log("set instance mask"); } }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (App.Current.IsInDesignMode()) { return(value?.ToString() !); } MaskMode maskMode = (MaskMode)value; return(Localize[$"{nameof(MaskMode)}_{maskMode}"]); }
/// <summary> /// Default constructor /// </summary> public MaskedEditTextBox() { // This call is required by the Windows.Forms Form Designer. InitializeComponent(); //initialize mask mode this.mode = MaskMode.Both; //initialize expression this.expression = new Regex(""); //initialize keyPressExpression this.keyPressExpression = new Regex(""); }
public Mask( bool inverted, string name, Animatable <PathGeometry> points, Animatable <Opacity> opacity, MaskMode mode ) { Inverted = inverted; Name = name; Points = points; Opacity = opacity; Mode = mode; }
public Mask( bool inverted, string name, Animatable <Sequence <BezierSegment> > points, Animatable <double> opacityPercent, MaskMode mode ) { Inverted = inverted; Name = name; Points = points; OpacityPercent = opacityPercent; Mode = mode; }
void ResetMaskCommandBuffer() { if (_maskCmd == null) { // If buffer doesn't exist, create it _maskCmd = new CommandBuffer(); _maskCmd.name = "VrTunnellingPro Draw Mask Objects"; } _maskCmd.Clear(); // Set color target to our RT, clear, but keep z buffer #if UNITY_2017_4_OR_NEWER // Allow for SP Instanced _maskCmd.SetRenderTarget( new RenderTargetIdentifier(_maskRt), new RenderTargetIdentifier(BuiltinRenderTextureType.CameraTarget), 0, CubemapFace.Unknown, -1 ); #else _maskCmd.SetRenderTarget( new RenderTargetIdentifier(_maskRt), new RenderTargetIdentifier(BuiltinRenderTextureType.CameraTarget) ); #endif _maskCmd.ClearRenderTarget(false, true, Color.white); // Draw each listed mesh Material maskMatToUse = maskMode == MaskMode.WINDOW ? _matWindow : _matMask; FillMaskBuffer(_maskCmd, _maskObjects, maskMatToUse); // Update command buffer state if (isActiveAndEnabled) { if (_lastMaskMode == MaskMode.OFF && usingMask && !_camHasMaskBuffer) { ToggleMaskCommandBuffer(true); } else if (_lastMaskMode != MaskMode.OFF && !usingMask && _camHasMaskBuffer) { ToggleMaskCommandBuffer(false); } _lastMaskMode = maskMode; } else if (_camHasMaskBuffer) { ToggleMaskCommandBuffer(false); } }
//----------------------- public UberTexturePainter() { this.Plane = new Plane(); IsRestrictedToPlane = false; // create the cameras. _maskCamera = new Camera(new Vector3(), new Matrix3x3(), new Projection(-1.0f, 1.0f, -1.0f, 1.0f, 10.0f)); _sourceCamera = new Camera(new Vector3(), new Matrix3x3(), new Projection(-1.0f, 1.0f, -1.0f, 1.0f, 10.0f)); // create the rasterizer. _rasterizer = new UberTextureRasterizer(); // allocate the index array. _visibleTriangles = new ushort[65536]; // initialize to additive. _maskPaintMode = MaskMode.Add; }
// Invoked from World.Settings internal static void LoadSettings(IEnumerable<XElement> xmlToolSettings) { foreach (var xElement in xmlToolSettings.Elements("Tool")) { string toolName = (string)xElement.Attribute("Name"); switch (toolName) { case "Paint": _paintMode = (PaintMode)ToEnum(typeof(PaintMode), (string)xElement.Attribute("Mode") ?? PaintMode.TileAndWall.ToString()); break; case "Brush": _brushWidth = (int?)xElement.Attribute("Width") ?? 20; _brushHeight = (int?)xElement.Attribute("Height") ?? 20; _brushOutline = (int?)xElement.Attribute("Outline") ?? 1; _brushShape = (BrushShape)ToEnum(typeof(BrushShape), (string)xElement.Attribute("Shape") ?? BrushShape.Square.ToString()); break; case "Tile": _paintTile = (int?)xElement.Attribute("Tile") ?? 0; _paintTileMask = (int?)xElement.Attribute("Mask") ?? 0; _paintTileActive = (bool)xElement.Attribute("Active"); _paintTileMaskMode = (MaskMode)ToEnum(typeof(MaskMode), (string)xElement.Attribute("Mode") ?? MaskMode.Off.ToString()); break; case "Wall": _paintWall = (int?)xElement.Attribute("Wall") ?? 0; _paintWallMask = (int?)xElement.Attribute("Mask") ?? 0; _paintWallActive = (bool)xElement.Attribute("Active"); _paintWallMaskMode = (MaskMode)ToEnum(typeof(MaskMode), (string)xElement.Attribute("Mode") ?? MaskMode.Off.ToString()); break; case "Wire": _redWire = (bool)xElement.Attribute("Red"); _blueWire = (bool)xElement.Attribute("Blue"); _greenWire = (bool)xElement.Attribute("Green"); break; } } }
private void InitDialogFromMaskMode(MaskMode maskMode) { switch (maskMode) { case MaskMode.R: selectedChannel = 0; UpdateColorTransferMode(ColorTransferMode.Rgb); curveControl.SetSelected(0, true); curveControl.SetSelected(1, false); curveControl.SetSelected(2, false); break; case MaskMode.G: selectedChannel = 1; UpdateColorTransferMode(ColorTransferMode.Rgb); curveControl.SetSelected(0, false); curveControl.SetSelected(1, true); curveControl.SetSelected(2, false); break; case MaskMode.B: selectedChannel = 2; UpdateColorTransferMode(ColorTransferMode.Rgb); curveControl.SetSelected(0, false); curveControl.SetSelected(1, false); curveControl.SetSelected(2, true); break; default: case MaskMode.RGB: selectedChannel = 0; UpdateColorTransferMode(ColorTransferMode.Luminosity); curveControl.SetSelected(0, true); break; } //UpdateCheckboxEnables(); }
public void SetMaskMode(MaskMode mode) { SetMaskMode(_profanityFilter, mode); }
private static extern void SetMaskMode(IntPtr profanityFilter, MaskMode mode);
/// <summary> /// Override some or all settings using a TunnellingPreset asset. /// </summary> public void ApplyPreset(TunnellingPreset p) { ApplyPresetBase(p); if (p.overrideEffectOverlay) { effectOverlay = p.effectOverlay; } if (p.overrideBackgroundMode) { backgroundMode = p.backgroundMode; } if (p.overrideCageDownsample) { cageDownsample = p.cageDownsample; } if (p.overrideCageAntiAliasing) { cageAntiAliasing = p.cageAntiAliasing; } if (p.overrideCageUpdateEveryFrame) { cageUpdateEveryFrame = p.cageUpdateEveryFrame; } if (p.overrideCageFogDensity) { cageFogDensity = p.cageFogDensity; } if (p.overrideCageFogPower) { cageFogPower = p.cageFogPower; } if (p.overrideCageFogBlend) { cageFogBlend = p.cageFogBlend; } if (p.overrideMaskMode) { maskMode = p.maskMode; } if (p.overrideBlurDownsample) { blurDownsample = p.blurDownsample; } if (p.overrideBlurDistance) { blurDistance = p.blurDistance; } if (p.overrideBlurPasses) { blurPasses = p.blurPasses; } if (p.overrideBlurSamples) { blurSamples = p.blurSamples; } if (p.overrideCounterVelocityMode) { counterVelocityMode = p.counterVelocityMode; } if (p.overrideCounterVelocityResetDistance) { counterVelocityResetDistance = p.counterVelocityResetDistance; } if (p.overrideCounterVelocityResetTime) { counterVelocityResetTime = p.counterVelocityResetTime; } if (p.overrideCounterVelocityStrength) { counterVelocityStrength = p.counterVelocityStrength; } if (p.overrideCounterVelocityPerAxis) { counterVelocityPerAxis = p.counterVelocityPerAxis; } if (p.overrideIrisZRejection) { irisZRejection = p.irisZRejection; } }
private Mask(MaskMode maskMode, AnimatableShapeValue maskPath) { _maskMode = maskMode; MaskPath = maskPath; }
private Mask(MaskMode maskMode, AnimatableShapeValue maskPath, AnimatableIntegerValue opacity) { _maskMode = maskMode; MaskPath = maskPath; Opacity = opacity; }
public void Mask(string mode) { switch (tag) { case "event": throw new CYFException("sprite.Mask: Can not be applied to Overworld Event sprites."); case "letter": throw new CYFException("sprite.Mask: Can not be applied to Letter sprites."); default: if (mode == null) { throw new CYFException("sprite.Mask: No argument provided."); } break; } MaskMode masked; try { masked = (MaskMode)Enum.Parse(typeof(MaskMode), mode, true); } catch { throw new CYFException("sprite.Mask: Invalid mask mode \"" + mode + "\"."); } if (masked != _masked) { //If children need to have their "inverted" property updated, then do so if ((int)_masked < 4 && (int)masked > 3 || (int)_masked > 3 && (int)masked < 4) { foreach (Transform child in GetTarget()) { MaskImage childmask = child.gameObject.GetComponent <MaskImage>(); if (childmask != null) { childmask.inverted = (int)masked > 3; } } } RectMask2D box = img.GetComponent <RectMask2D>(); Mask spr = img.GetComponent <Mask>(); switch (masked) { case MaskMode.BOX: //Remove sprite mask if applicable spr.enabled = false; box.enabled = true; break; case MaskMode.OFF: //Mask has been disabled spr.enabled = false; box.enabled = false; break; default: //The mask mode now can't possibly be box, so remove box mask if applicable spr.enabled = true; box.enabled = false; // Used to differentiate between "sprite" and "stencil"-like display modes spr.showMaskGraphic = masked == MaskMode.SPRITE || masked == MaskMode.INVERTEDSPRITE; break; } } _masked = masked; }
void Start() { MainInstance = this; mainCamera = GetComponent <Camera>(); CurrentMaskMode = InitMaskMode; }
/// <summary> /// Override some or all settings using a TunnellingPreset asset. /// </summary> public void ApplyPreset(TunnellingPreset p) { ApplyPresetBase(p); if (p.overrideBackgroundMode) { backgroundMode = p.backgroundMode; } if (p.overrideCageDownsample) { cageDownsample = p.cageDownsample; } if (p.overrideCageAntiAliasing) { cageAntiAliasing = p.cageAntiAliasing; } if (p.overrideCageUpdateEveryFrame) { cageUpdateEveryFrame = p.cageUpdateEveryFrame; } if (p.overrideCageFogDensity) { cageFogDensity = p.cageFogDensity; } if (p.overrideCageFogPower) { cageFogPower = p.cageFogPower; } if (p.overrideCageFogBlend) { cageFogBlend = p.cageFogBlend; } if (p.overrideMaskMode) { maskMode = p.maskMode; } if (p.overrideBlurDownsample) { blurDownsample = p.blurDownsample; } if (p.overrideBlurDistance) { blurDistance = p.blurDistance; } if (p.overrideBlurPasses) { blurPasses = p.blurPasses; } if (p.overrideBlurSamples) { blurSamples = p.blurSamples; } if (p.overrideIrisZRejection) { irisZRejection = p.irisZRejection; } }
public void SetMaskMode(MaskMode maskMode) { this.maskMode = maskMode; }
public FieldRaycastManager(Camera mainCamera) { this.mainCamera = mainCamera; this.maskMode = MaskMode.All; }