Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Setting xray- for virtual objects

    SDK Help
    0
    8
    887
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Helper
      last edited by

      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?

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        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

        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

          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);
          
          1 Reply Last reply Reply Quote 0
          • H
            Helper
            last edited by

            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.

            1 Reply Last reply Reply Quote 0
            • H
              Helper
              last edited by

              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);  
              
              1 Reply Last reply Reply Quote 0
              • H
                Helper
                last edited by

                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   
                }   
                
                1 Reply Last reply Reply Quote 0
                • H
                  Helper
                  last edited by

                  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.

                  1 Reply Last reply Reply Quote 0
                  • H
                    Helper
                    last edited by

                    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.

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post