problem with ID_BASEOBJECT_COLOR

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

On 30/09/2010 at 14:03, xxxxxxxx wrote:

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

---------
Hi, i have a quick question about coloring objects by using ID_BASEOBJECT_COLOR

i tried both of the following, but none did work. any idea what i am missing?

    tempObj->SetParameter(ID_BASEOBJECT_USECOLOR,GeData(ID_BASEOBJECT_USECOLOR_ALWAYS),0);  
          tempObj->SetParameter(ID_BASEOBJECT_COLOR,GeData(Vector(1,0,0)),0);  
     tempObj->GetDataInstance()->SetLong(ID_BASEOBJECT_USECOLOR,ID_BASEOBJECT_USECOLOR_ALWAYS);  
              tempObj->GetDataInstance()->SetVector(ID_BASEOBJECT_COLOR,Vector(1,0,0));  

thanks in advance,
cheers,
Ello

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

On 01/10/2010 at 06:39, xxxxxxxx wrote:

is it a problem that i am inside GetVirtualObjects? yes, it seems so, but is there a way to do it in GetVirtualObjects? I dont want to assign materials for achiving this. Any ideas?

cheers,
Ello

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

On 01/10/2010 at 09:04, xxxxxxxx wrote:

what is tempObj? An object that you create inside of GetVirtualObjects? Then it should work I´d assume. Without a context it´s hard to say. Do you return that object in GetVirtualObjects? Then what does the object look like when you convert your plugin object that creates this?

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

On 01/10/2010 at 09:17, xxxxxxxx wrote:

tempObj is a BaseObject::Alloc(Ocube) and is inserted under a Nullobject. When I convert the plugin, the Cube is there, but no Color is set. I temporarily tried what happens when i insert the Cube directly into the document and the color was set, thats why i assume it doesnt work with virtual objects...

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

On 01/10/2010 at 10:14, xxxxxxxx wrote:

yeah I can confirm it (just tried with a sphere). Don´t know why it doesn´t work (setting primitive specific settings works just fine) but I see no real reason why it shouldn´t work.

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

On 01/10/2010 at 14:08, xxxxxxxx wrote:

I'm having something of a similar problem with reading/writing color vectors.  I'm doing it as SReal() for each component yet the values are reset to default every time - this despite all other settings being read/written properly.  Maxon is boiling my blood at the moment.  I can't spend every friggin week fixing these issues in R12 while I'm trying to employ what little free time to write a new commercial plugin.  It is being evaporated for these vapid hunts of stupid issues.  Grrrr...... ;(

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

On 05/10/2010 at 05:51, xxxxxxxx wrote:

To set the object's color of child objects of a generator you have to use BaseObject::SetColorProperties and additionally the OBJECT_USECACHECOLOR flag has to be set during plugin registration.

here some example code:

  
BaseObject *RoundedTube::GetVirtualObjects(BaseObject *op, HierarchyHelp *hh)  
{  
  BaseObject *ret = NULL;  
  
  Bool dirty = op->CheckCache(hh) || op->IsDirty(DIRTYFLAGS_DATA);  
  if (!dirty) return op->GetCache(hh);  
  
  ret = BaseObject::Alloc(Ocube);  
  if (!ret) return NULL;  
  
  ObjectColorProperties prop;  
  prop.usecolor = ID_BASEOBJECT_USECOLOR_AUTOMATIC;  
  prop.color = Vector(1.0,0.0,0.0);  
  prop.xray = FALSE;  
  
  ret->SetColorProperties(&prop);  
  
  return ret;  
}  
  
  
// be sure to use a unique ID obtained from www.plugincafe.com  
#define ID_ROUNDEDTUBEOBJECT 1001157  
  
Bool RegisterRoundedTube(void)  
{  
  return RegisterObjectPlugin(ID_ROUNDEDTUBEOBJECT,GeLoadString(IDS_ROUNDED_TUBE),OBJECT_GENERATOR|OBJECT_USECACHECOLOR,RoundedTube::Alloc,"Oroundedtube",AutoBitmap("roundedtube.tif"),0);  
}  

cheers,
Matthias

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

On 05/10/2010 at 06:31, xxxxxxxx wrote:

thank you very much matthias, i'll try that

cheers,
ello

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

On 05/10/2010 at 07:03, xxxxxxxx wrote:

thanks matthias. Could you additionally explain why this is necessary and doesn´t work by changing the container values? I just would like to understand the reason for this procedure. thank you!