Better highlighting functionality.



What I want is more functionality to highlight the selected entity.

I've found "aModel.SelectionColor = Color.aColor" to change the color of the highlighting but I need some more modifiability to offer the visual experience requested. The image shows my first thoughts regarding this, a light version of the selection color around the selected entity, and availability to temporarily change the size. 

Thank you!

Sorry if something similar already exists, was directed to here from a question in the FAQ.

3

Comments

6 comments
  • How does this apply to 3D objects or 3D objects edges?

    0
    Comment actions Permalink
  • I have not fully thought about that, I'm trying to offer a top view only, i.e. 2D visual experience.

    I'd imagine it be pretty similar though, maybe the temporary size increase is superfluous in 3D and simple glow effect would be sufficient.

    0
    Comment actions Permalink
  • Using
     
    yourEntity.LineWeightMethod = colorMethodType.byEntity;
    yourEntity.LineWeight = DesiredValue;

    Works to temporarily change the values back and forth when selecting/deselecting entities to highlight them further than a color change.
    0
    Comment actions Permalink
  • I have previously implemented something similar to what you are after Adam. What I did was to create another 2 lines, parallel to either side of the original line, offset by the line thickness. These ghost outlines can be whatever colour you want, so you can set their colour with a transparency to give that glow effect.

    1
    Comment actions Permalink
  • Yes, this ability would be great. I have often wanted to highlight ICurves with a 'glow'

    Damian, you have a good idea to offset the line in 2d normal to the screen projection. Along this idea, it maybe possible to offset the vertices of the ICurve as to allow any ICurve to be highlighted without worry of tessellation issues

    Maybe implementing a "Glow" entity that references any ICurve is a neat way to do this.

    0
    Comment actions Permalink
  • Alberto & devDept team, I first tried this:
    model1.ActionMode = devDept.Eyeshot.actionType.SelectVisibleByPickDynamic;
    model1.SelectionColorDynamic = Color.FromArgb(120, Color.Red);

    But I get an exception "SelectionColorDynamic" must be opaque. Might it be possible to add this glow ability? I have developed it myself, but would be a nice addition built directly into Eyeshot.

    Here is how I found that we can implement the glow effect by using overlays:

        class MyModel : Model
    {
    protected override void OnMouseMove(MouseEventArgs e)
    {
    base.OnMouseMove(e);

    IndexsUnder = GetAllEntitiesUnderMouseCursor(e.Location);
    Invalidate();
    }
    int[] IndexsUnder;
    protected override void DrawOverlay(DrawSceneParams data)
    {
    if (IndexsUnder != null)
    {
    foreach (int i in IndexsUnder)
    {
    ICurve c = Entities[i] as ICurve;
    if(c != null)
    DrawScreenCurve(c, (c as Entity).LineWeight * SelectionLineWeightScaleFactor);
    }
    }
    base.DrawOverlay(data);
    }
    public void DrawScreenCurve(ICurve curve, float linesize)
    {
    Entity e = curve as Entity;
    if (e.Vertices != null)
    DrawOverLayLineStrip(e.Vertices, linesize);
    }
    public void DrawOverLayLineStrip(Point3D[] pts, float linesize)
    {
    Point3D[] screenpts = new Point3D[pts.Length];
    for (int ii = 0; ii < pts.Length; ii++)
    screenpts[ii] = WorldToScreen(pts[ii]);

    renderContext.EnableXOR(false);
    renderContext.SetState(devDept.Graphics.depthStencilStateType.DepthTestOff);

    renderContext.SetLineSize(linesize); // This needs to be about 2x the width of the line we're highlight glowing
    renderContext.SetState(blendStateType.Blend);
    renderContext.SetState(rasterizerStateType.CCW_PolygonFill_NoCullFace_NoPolygonOffset);
    renderContext.SetColorWireframe(Color.FromArgb(120, System.Drawing.Color.Red), true);
    renderContext.DrawLineStrip(screenpts);

    renderContext.SetLineSize(1);
    }
    }

    0
    Comment actions Permalink

Please sign in to leave a comment.

Didn't find what you were looking for?

New post