SetColorProperties in GetVirtualObjects



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

    On 16/02/2006 at 12:47, xxxxxxxx wrote:

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

    ---------
    Hi,

    I have a ObjectData plugin that is simply returning a cube object in the GetVirtualObjects.

    I would like to set this cube to red using SetColorProperties.

    But I cant do this because the ObjectData object overrides the color properties.

    I can simple just set the ObjectData color properties, but I want to work with multiple objects with different colours, without creating a material for each one

    Is this possible?



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

    On 17/02/2006 at 04:46, xxxxxxxx wrote:

    Is it not sufficient to set up the color in Base task in AM?
    ...maybe I don't understand you... :)



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

    On 17/02/2006 at 09:18, xxxxxxxx wrote:

    I'm not sure I understand your reply either :)

    I want to create 10 objects (or more), add them to a created null object, and return the null object in ObjectData::GetVirtualObjects

    But I want each of the objects a different colour, without creating a material for each one.

    So I thought if I use SetColorProperties for each object, and give each one a colour, that would work

    but it seems it doesn't



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

    On 17/02/2006 at 12:52, xxxxxxxx wrote:

    Do you want to change the displayed color of the objects in the Object Manager or the copies you return from GetVirtualObjects()?

    I've not had any troubles setting display color on objects using SetColorProperties(). You are sending an ObjectColorProperties with usecolor set to ID_BASEOBJECT_USECOLOR_ALWAYS?



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

    On 17/02/2006 at 13:25, xxxxxxxx wrote:

    The copies I return. Heres an example

      
    BaseObject *BeemobObject::GetVirtualObjects(PluginObject *op, HierarchyHelp *hh)  
    {  
         BaseObject *poly = BaseObject::Alloc(Ocube);  
         if(poly)  
         {  
              ObjectColorProperties ocp;  
              ocp.usecolor = 1;  
              ocp.color = Vector(1.0,0.0,0.0);  
              ocp.xray=TRUE;  
                
              poly->SetColorProperties(&ocp;);  
              poly->Message(MSG_UPDATE);  
              return poly;  
         }       
         return NULL;  
    }  
    

    One would think the cube would be displayed red in an xray fashion



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

    On 17/02/2006 at 13:39, xxxxxxxx wrote:

    There is your problem (possibly) :

    ocp.usecolor = 1;
    

    should be:

    ocp.usecolor = ID_BASEOBJECT_USECOLOR_ALWAYS;
    

    because:

    LONG ID_BASEOBJECT_USECOLOR     { CYCLE { ID_BASEOBJECT_USECOLOR_OFF; ID_BASEOBJECT_USECOLOR_AUTOMATIC; ID_BASEOBJECT_USECOLOR_ALWAYS; } }
    

    ID_BASEOBJECT_USECOLOR_ALWAYS = 2

    and I wouldn't depend on that to always remain true, thus it's better to use the proper definition.

    Automatic will either follow the parent or whatever is set in Preferences. Always overrides parent and preferences.



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

    On 17/02/2006 at 13:42, xxxxxxxx wrote:

    Sorry, but I originally did use ID_BASEOBJECT_USECOLOR_ALWAYS

    was just trying other options, just forgot to change it back before posting



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

    On 17/02/2006 at 14:05, xxxxxxxx wrote:

    Okay. Another possible issue is that you are allocating an object, changing its properties, and then (?). Can you be certain that this is being added to and displayed in the document? If you must, change the object type to something unique (a sphere, for instance) and see if you actually see the unique object replacing your modifier object.

    For now, I'm just guessing along. It is entirely possible that modifications like this cannot be employed with virtual objects.



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

    On 22/02/2006 at 11:50, xxxxxxxx wrote:

    It isn't possible to override the color in GetVirtualObjects(), afaik. In the next version there will be a flag for object plugins that will fix this (OBJECT_USECACHECOLOR).


Log in to reply