SetDrawParameter & LineZOffset



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 23/09/2006 at 17:21, xxxxxxxx wrote:

    I was thinkin' (never good). ;)

    What draw pass are you using? The only experience I have with plugin objects is my 'bones' for IPP. Here, the only drawing is the 'origin' crosshairs which always draw in front of everything. I use DRAWPASS_HANDLES to do this. This is the method (for your perusal if it may provide something) :

    // ObjectData.Draw  
    //*---------------------------------------------------------------------------*  
    Bool IPPBase::Draw(PluginObject* op, LONG drawpass, BaseDraw* bd, BaseDrawHelp* bh)  
    //*---------------------------------------------------------------------------*  
    {  
         if (drawpass != DRAWPASS_HANDLES)     return SUPER::Draw(op, drawpass, bd, bh);  
      
         BaseContainer*     bc =     op->GetDataInstance();  
         if (!bc)                    return SUPER::Draw(op, drawpass, bd, bh);  
      
         Real               len =     0.05 * bc->GetReal(IPP_SCALING);  
         Vector               ep =     bc->GetVector(IPP_ENDPOINT)-bc->GetVector(IPP_ORIGIN);  
         Matrix               mg =     bh->GetMg();  
      
         // Line between Origin-EndPoint  
         bd->SetPen(Vector(1.0,1.0,0.0));  
         bd->Line3D(Vector(0.0,0.0,0.0)*mg, ep*mg);  
         // Origin cross-hairs  
         bd->SetPen(Vector(0.0,1.0,0.0));  
         bd->Line3D(Vector(-len, 0.0, 0.0)*mg, Vector(len, 0.0, 0.0)*mg);  
         bd->Line3D(Vector(0.0, -len, 0.0)*mg, Vector(0.0, len, 0.0)*mg);  
         bd->Line3D(Vector(0.0, 0.0, -len)*mg, Vector(0.0, 0.0, len)*mg);  
         // EndPoint cross-hairs  
         bd->SetPen(Vector(1.0,0.0,0.0));  
         bd->Line3D(Vector(ep.x-len, ep.y, ep.z)*mg, Vector(ep.x+len, ep.y, ep.z)*mg);  
         bd->Line3D(Vector(ep.x, ep.y-len, ep.z)*mg, Vector(ep.x, ep.y+len, ep.z)*mg);  
         bd->Line3D(Vector(ep.x, ep.y, ep.z-len)*mg, Vector(ep.x, ep.y, ep.z+len)*mg);  
      
         return SUPER::Draw(op, drawpass, bd, bh);  
    }
    


  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 23/09/2006 at 17:51, xxxxxxxx wrote:

    Howdy,

    Well, I'm also using DRAWPASS_HANDLES to draw... you guessed it... "handles", so the user can edit the size of the joint envelope. ;)

    When using DRAWPASS_HANDLES, it only draws when the object is the active object. So, that's no good for drawing all the joints in the skeleton.

    Same with DRAWPASS_BOX, it only draws when the object is the active object.

    Using DRAWPASS_HIGHLIGHTS, it doesn't draw at all.

    So all I have left is DRAWPASS_OBJECT, or let it draw without any draw pass, but then it will draw with every draw pass.

    Adios,
    Cactus Dan



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 23/09/2006 at 18:08, xxxxxxxx wrote:

    I feel your pain, Dan.

    Yes, selected objects - I don't draw anything unless the 'bone' is selected. So you want to draw your objects irregardless of selection. You may need to use that extreme value for LineZOffset() - need to hear from higher authorities on this.

    As for drawing semi-transparent lines, that is a good question. SetTransparency() sets transparency for polygons only - presumptiously not lines etc. DRAW_PARAMETER_ALPHA_THRESHOLD may have relevance here - but I have no experience with it.

    Will have to wait for more info on this - maybe OGL is the only option and you'll only be able to support it in that situation (OGL as compared to Software mode).

    Sorry that I can't be more helpful.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 23/09/2006 at 19:41, xxxxxxxx wrote:

    Howdy,

    Well, it'll do for now. Thanks anyway.

    Drawing a dotted line may even be an internal drawing function not available in the SDK.

    Adios,
    Cactus Dan



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 26/09/2006 at 04:21, xxxxxxxx wrote:

    Hi guys,

    this info is for R9.5 and i'm not sure if it will work for you, but anyways:

    SetTransparency should work for lines, too. You get dottet lines by using a negative argument. SetTransparency(-128) should work fine. Other values didn't work as expected in my experiments.

    If the DRAWFLAGS_INVERSE_Z flag is avaiable ( only toolplugins ? ), you can just check it and change the transparency.

    If not you can do something like:
    // normal pass
    DrawStuff(bd)
    // dotted pass
    bd->SetDrawParam(DRAW_PARAMETER_SETZ,DRAW_Z_GREATER)
    bd->SetTransparency(-128)
    DrawStuff(bd)

    I think with LineNew and friends you can also disable the depth test by using the NOCLIP_Z flag. Never tested it though.

    Hope that helps



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 26/09/2006 at 13:37, xxxxxxxx wrote:

    Howdy,

    Thanks Michael, but it still doesn't seem to work.

    I'm using:
    bd->LineNew(p1,p2,NOCLIP_Z)

    Using DRAW_Z_GREATER makes the lines not draw at all, or rather makes them only draw over something that has already been drawn in the viewport. So, the only way they'll show over the geometry is if the geometry is above them in the OM so that the geometry gets drawn first.

    Adios,
    Cactus Dan



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 27/09/2006 at 00:39, xxxxxxxx wrote:

    In that case use
    bd->LineNew(p1,p2,0)

    and draw the lines twice
    // normal pass
    bd->SetDrawParam(DRAW_PARAMETER_SETZ,DRAW_Z_LOWEREQUAL)
    bd->SetTransparency(0)
    DrawStuff(bd)
    // dotted pass
    bd->SetDrawParam(DRAW_PARAMETER_SETZ,DRAW_Z_GREATER)
    bd->SetTransparency(-128)
    DrawStuff(bd)
    // reset parameters
    bd->SetDrawParam(DRAW_PARAMETER_SETZ,DRAW_Z_LOWEREQUAL)
    bd->SetTransparency(0)

    this should work



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 27/09/2006 at 08:22, xxxxxxxx wrote:

    Howdy,

    Thanks Michael, but it still seems to depend on where the geometry is in the OM. Actually I am already drawing the lines twice. I'm trying to give the user an option, via a checkbox, to see the joints in front of the geometry, because as they are now, the user can only see the joints if the geometry is in XRay mode.

    Geometry below the joints in the OM:

    Geometry above the joints in the OM:

    As you can see, it draws nicely when the geometry is above the joints in the OM, but I'd like it to draw like that no matter where the geometry is in the OM.

    If I place GePrint() statements in the Draw() function, I find that the joint's Draw() function only gets called once with the flag DRAWPASS_OBJECT, unless it is the active object then it gets called three times, once with the flag DRAWPASS_OBJECT, and twice with the flag DRAWPASS_HANDLES.

    DRAWPASS_BOX and DRAWPASS_HIGHLIGHTS never get passed to the joint object's Draw() function.

    Adios,
    Cactus Dan



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 28/09/2006 at 01:57, xxxxxxxx wrote:

    Aw.. damn.. you are right of couse.. what i told you can't work. It works fine for tools because they draw after objects. Even if you paint with inverted Z test, the next object will still paint above these lines.

    I'm wondering how bones are implemented. They seem to have no problem.

    Perhaps the only way to get your lines is to use a scenehook plugin. If you can make it draw after the objects drawpass, then you could just loop over all your bones and do the drawing as i mentioned it above.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 28/09/2006 at 09:33, xxxxxxxx wrote:

    Howdy,

    Well, it looks like a SceneHookData() may not work. The documentation says this: "This is a data class to register a function that will be called on every scene prepare, for example before redraw and before rendering." From what that says, it gets called before drawing, so that doesn't sound like it could work.

    I'm curious though, is it possible to call an object's Draw() function from within a tag's Draw() function, and would it be safe to do that? I mean if both tag and object Draw() functions are normally called from within the same thread, it should be safe, right? Maybe? It sounds logical, but then I don't have enough experience with C++ to know for sure.

    Adios,
    Cactus Dan



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 28/09/2006 at 14:27, xxxxxxxx wrote:

    You should really test when Draw is called. What the docs mention is about the Execute function.

    Theoretically it should be safe. However first you must get a pointer the corresponding ObjectData instance for your object. The safest way to do it is probably by using the message function with MSG_RETRIEVEPRIVATEDATA. And return/send whatever data you need. You could actually send the BaseDraw Pointer and call the object draw function as reaction on the message.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 28/09/2006 at 14:56, xxxxxxxx wrote:

    You can also get the node data using something like this (not illegal and it works) :

    MyObject* myo = static_cast<MyObject*>(obj->GetNodeData());

    This allows you to call methods in your ObjectData. Just make sure to check for NULL and heed the advice about virtual functions.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 28/09/2006 at 15:30, xxxxxxxx wrote:

    Howdy,

    Well, thanks for all the help, but I may end up abandoning the idea.

    I noticed that the tag's Draw() function gets called three times, and that seems a bit too often to be branching out to each joint just to draw them on top of the polygon mesh. :o(

    Anyway, I am curious to know how the bones are doing it, though.

    Adios,
    Cactus Dan



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 29/09/2006 at 03:28, xxxxxxxx wrote:

    GetNodeData(), thanks for the hind. I was looking for something like this, but could not find it.

    I still suggest that using a SceneHook will work. It allows more control over when the drawing happens ( highlight pass ) and the draw function should always be called. I'm convinced that bones are drawn this way.

    It would be nice now to know for sure... Mikael ? David ?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 29/09/2006 at 09:28, xxxxxxxx wrote:

    Howdy,

    > Quote: Originally posted by Michael Welter on 29 September 2006
    >
    > * * *
    >
    > GetNodeData(), thanks for the hind. I was looking for something like this, but could not find it.
    >
    >
    > * * *

    Yes, I knew about that. It works well for being able to communicate between your plugin classes, to retrieve pointers to stored data.

    > Quote: _I still suggest that using a SceneHook will work. It allows more control over when the drawing happens ( highlight pass ) and the draw function should always be called. I'm convinced that bones are drawn this way.
    >
    > * * *
    _


    I may give that a try, but maybe for the next update of the plugin. ;o)

    > Quote: It would be nice now to know for sure... Mikael ? David ?
    >
    > * * *
    >
    > * * *

    Yes, I would like to know for sure, too.

    Adios,
    Cactus Dan



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 04/10/2006 at 11:43, xxxxxxxx wrote:

    It's surely a hack to call the object's Draw() function from the tag's, but I can't see how it could be dangerous. More like code reuse... :-)
    The Scenehook solution might be the simplest, though, provided that its Draw() function is always called after objects'.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 05/10/2006 at 20:24, xxxxxxxx wrote:

    Howdy,

    Thanks Mikael, I'll consider giving that a try when I do another update. ;o)

    Adios,
    Cactus Dan



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 06/02/2007 at 13:48, xxxxxxxx wrote:

    Dan,

    Did you ever find a solution here and what was it? :)

    I am looking into something similar for my bones while some other related features are added.

    If you went with a SceneHook, how do you do the drawing? Do you recurse the document's objects for you own and draw them then?

    Thanks!

    Robert



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 06/02/2007 at 13:58, xxxxxxxx wrote:

    Howdy,

    Nope, not yet. :o(

    Actually, I haven't tried it anymore, and just went on to other things.

    Adios,
    Cactus Dan



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 06/02/2007 at 14:18, xxxxxxxx wrote:

    Hello Dan,

    Nothing huh?

    Well, if I find a way, it will be posted here. :)

    Thanks!


Log in to reply