Plugin Cafe Homepage
Forum Home Forum Home > Plugin Cafe > SDK Help
  New Posts New Posts
  FAQ FAQ  Forum Search   Register Register  Login Login

Draw highlight

 Post Reply Post Reply
Author
Message
WickedP View Drop Down
Member
Member
Avatar

Joined: 2011 Aug 21
Online Status: Offline
Posts: 474
Post Options Post Options   Quote WickedP Quote  Post ReplyReply Direct Link To This Post Topic: Draw highlight
    Posted: 2018 Jan 12 at 7:46pm

User Information:

Cinema 4D Version:   R14 
Platform:   Windows  ;   
Language(s):     C++  ;   

---------

Hi folks,

is it possible to turn off the highlighting 'feature' when I draw a LineObject inside my ObjectData plugin's Draw() function? Currently if my object is selected the lines are drawn white.

WP.
WickedP® Developer
http://www.wickedp.com
Back to Top
knickknack View Drop Down
Forum Moderator
Forum Moderator


Joined: 2016 Jul 01
Location: Italy
Online Status: Offline
Posts: 241
Post Options Post Options   Quote knickknack Quote  Post ReplyReply Direct Link To This Post Posted: 2018 Jan 15 at 5:33am
Hi WickedP, thanks for writing us.

With reference to your request, could you please better explain your final intent? Could you also confirm that you need to draw a line using the BaseDraw::DrawLine() in ObjectData::Draw() rather than dealing with LineObject which has completely different purposes?

Best, Riccardo
MAXON Computer GmbH
SDK Support Team
Back to Top
WickedP View Drop Down
Member
Member
Avatar

Joined: 2011 Aug 21
Online Status: Offline
Posts: 474
Post Options Post Options   Quote WickedP Quote  Post ReplyReply Direct Link To This Post Posted: 2018 Jan 15 at 11:11pm
Hi knickknack,

I'm wanting to draw a spline in an ObjectData's Draw() function. So I'm getting the LineObject from a SplineObject, and using DrawObject() to draw the LineObject. Psuedo code:

// set spline points
LineObject *line = Spline->GetLineObject(nullptr,0.0,nullptr)
bd->DrawObject(bh,line,DRAW_FLAGS,drawpass,nullptr,colour);
// etc..

The spline/line is drawn fine. But it's highlighted - I want the colour drawn to the colour I set regardless of whether the object is selected or not.

WP.
WickedP® Developer
http://www.wickedp.com
Back to Top
knickknack View Drop Down
Forum Moderator
Forum Moderator


Joined: 2016 Jul 01
Location: Italy
Online Status: Offline
Posts: 241
Post Options Post Options   Quote knickknack Quote  Post ReplyReply Direct Link To This Post Posted: 2018 Jan 16 at 2:26am
Hi WickedP, thankls for following up.

To avoid having your item "highlighted" simply draw it in the DRAWPASS_OBJECT rather than in the DRAWPASS_HIGHLIGHTS being sure that the pen color is set to BaseDraw::GetObjectColor() instead of BaseDraw::GetHighlightPassColor().

Best, Riccardo
MAXON Computer GmbH
SDK Support Team
Back to Top
WickedP View Drop Down
Member
Member
Avatar

Joined: 2011 Aug 21
Online Status: Offline
Posts: 474
Post Options Post Options   Quote WickedP Quote  Post ReplyReply Direct Link To This Post Posted: 2018 Jan 17 at 1:37am
Hi knickknack,

that's the thing, I'm drawing it in DRAWPASS_OBJECT and setting the pen colour isn't having any effect. It just draws the line white unless I deselect my object. This is a stripped down version of my function (psuedo to keep it minimal):

DRAWRESULT My_Object::Draw(BaseObject *op,DRAWPASS drawpass,BaseDraw *bd,BaseDrawHelp *bh)
{
    if(drawpass == DRAWPASS_OBJECT)
    {
        // set spline points/tangents here
        // (spline is a class level variable)
        LineObject *line = My_Spline->GetLineObject(nullptr,0.0,nullptr);

        // this line doesn't change anything
        bd->SetPen(bd->GetObjectColor(bh,My_Spline,FALSE),NULL);

        Vector col = Vector(1.0,0.0,0.0);
        Draw_Result = bd->DrawObject(bh,line,DRAWOBJECT_EDITMODE|DRAWOBJECT_FORCEPOINTS|DRAWOBJECT_USE_CUSTOM_COLOR,drawpass,nullptr,col);

        LineObject::Free(line);

        if(Draw_Result == DRAWRESULT_OK)
        {
            GePrint("Drawn.");
        }
    }

    return SUPER::Draw(op,drawpass,bd,bh);
}

Just in addition to the highlighting issue, the DRAWOBJECT_FORCEPOINTS flag doesn't seem to do anything here. Can I draw points from the line object as well?

WP.

Edit: fixed typo.


Edited by WickedP - 2018 Jan 18 at 2:54am
WickedP® Developer
http://www.wickedp.com
Back to Top
WickedP View Drop Down
Member
Member
Avatar

Joined: 2011 Aug 21
Online Status: Offline
Posts: 474
Post Options Post Options   Quote WickedP Quote  Post ReplyReply Direct Link To This Post Posted: 2018 Mar 16 at 1:00am
Hi folks,

I know this is a couple of months old, but I'm having a really frustrating time with this. I've tried returning the spline in GVO instead but it does the same thing. When I add a cube and set the colour with ObjectColorProperties the cube is coloured fine. Why are splines different?

Can I colour the spline so that it's not affected by the draw highlight? There must be a way. How is the normal spline object drawn (with the white-to-blue curve colour and points)?

WP.
WickedP® Developer
http://www.wickedp.com
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Bulletin Board Software by Web Wiz Forums® version 9.61 [Free Express Edition]
Copyright ©2001-2009 Web Wiz

This page was generated in 0.094 seconds.