Setting xray- for virtual objects



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

    On 21/10/2012 at 07:03, xxxxxxxx wrote:

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

    ---------
    Hey Guys,

    I am working on an objectdata-plugin. I create several objects (NURBS) in GetVirtualObjects and I want to make them transparent. So I do something like this:

      
    BaseContainer *bc = obj->GetDataInstance();  
    bc->SetLong(ID_BASEOBJECT_VISIBILITY_EDITOR, editor);  
    bc->SetLong(ID_BASEOBJECT_VISIBILITY_RENDER, render);  
    bc->SetBool(ID_BASEOBJECT_XRAY, xray);
    

    But x-ray does not get set. :( Any idea why?



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

    On 21/10/2012 at 15:15, xxxxxxxx wrote:

    The only place it seems to work is inside of the Draw() function.

    DRAWRESULT MyObject::Draw(BaseObject *op, DRAWPASS drawpass, BaseDraw *bd, BaseDrawHelp *bh)  
    {  
      
      //code that draws the object here  
      
      ....  
      
      //Get the state of the xray option  
      GeData d;  
      op->GetParameter(DescID(ID_BASEOBJECT_XRAY), d, DESCFLAGS_GET_0);  
      LONG xstate = d.GetLong();  
      GePrint(LongToString(xstate));  
      
      
      //Enable the Xray option  
      op->SetParameter(DescID(ID_BASEOBJECT_XRAY), GeData(TRUE), DESCFLAGS_SET_0);  
      EventAdd();  
      
      return DRAWRESULT_OK;  
    }
    

    -ScottA



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

    On 21/10/2012 at 16:18, xxxxxxxx wrote:

    Hey Scott,

    Thank you for your replay. It works but the problem is, that the hole object would be transparent. I only want a special object.

    I get an other method, but here I must convert my NURB object and that is not very fine...

      
              bd->DrawPolygonObject(bh, res, DRAWOBJECT_XRAY_ON, op, green);
    


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

    On 22/10/2012 at 01:46, xxxxxxxx wrote:

    Please check the BaseObject::SetColorProperties() function. It's used to set object colors and X-Ray.



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

    On 22/10/2012 at 06:13, xxxxxxxx wrote:

    Does not work. :(

    ObjectColorProperties ocp;  
          ocp.usecolor =    ID_BASEOBJECT_USECOLOR_ALWAYS;  
          ocp.xray =            TRUE;  
          ocp.color =            Vector(0.0,1.0,0.0); //green  
          obj->SetColorProperties(&ocp);  
    


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

    On 22/10/2012 at 06:29, xxxxxxxx wrote:

    You're setting it on the object you're generating. Set it on the generator object itself and it will work. I.e.:

      
      
    BaseObject* MyObjectDataPlugin::GetVirtualObjects(BaseObject *op, HierarchyHelp *hh)   
    {   
    //.... do other stuff   
    ObjectColorProperties ocp;   
            ocp.usecolor =    ID_BASEOBJECT_USECOLOR_ALWAYS;   
            ocp.xray =            TRUE;   
            ocp.color =            Vector(0.0,1.0,0.0); //green   
            op->SetColorProperties(&ocp;);    // <------ uses 'op' not your generated object   
    }   
    


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

    On 22/10/2012 at 09:46, xxxxxxxx wrote:

    Hey spedler,

    Thank you but I want to use it on an object I generate and not on a the hole generator. Only a part of it.



  • On 18/04/2013 at 08:56, xxxxxxxx wrote:

    If anyone run into the same problem.. you have to set the OBJECT_USECACHECOLOR flag when registering the object to avoid that the color properties get overwritten by the generator.


Log in to reply