Select every single material

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

On 28/11/2006 at 05:38, xxxxxxxx wrote:

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

---------
Hi,
i would like to select every single material in the meterialmanager step by step. My code dont work could someone help me.
 
void matree  (BaseDocument *doc, BaseMaterial *op,Bool *loc1,Bool *loc2,Bool *loc3)
{
  while(op)
  {
   doc->SetActiveMaterial(op,SELECTION_ADD);//
  //matree(doc,op->GetNext(),loc1,loc2,loc3);
   op = op->GetNext();
  }
  
}
void Sort::sortalg(Bool *loc1,Bool *loc2,Bool *loc3)
{
 BaseDocument *mydoc = BaseDocument::Alloc();
 
 mydoc = GetActiveDocument();
 
    BaseMaterial *op = mydoc->GetFirstMaterial();
 mydoc->SetActiveMaterial(op,SELECTION_NEW);
 matree(mydoc, op,loc1,loc2,loc3);
 BaseDocument::Free(mydoc);
 MessageDialog("TESTSTRING");
 
 
}

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

On 28/11/2006 at 05:44, xxxxxxxx wrote:

I know that i have a never ending loop too, how can ein check if it is the last material?
 
Thx

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

On 28/11/2006 at 05:58, xxxxxxxx wrote:

you could try

BaseDocument* pDocument = GetActiveDocument();
BaseMaterial* pMat = pDocument->GetFirstMaterial();
while(pMat)
{
... do something here

pMat = pMat->GetNext();
}

last material is NULL 🙂

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

On 28/11/2006 at 06:15, xxxxxxxx wrote:

Hm, no it does not select anything

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

On 28/11/2006 at 06:18, xxxxxxxx wrote:

Could it be that window maust be refreshed?

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

On 28/11/2006 at 06:26, xxxxxxxx wrote:

Ho no, all mat have been selecte but this will be not shown in cinema if it is not refreshed.
Thanks

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

On 28/11/2006 at 08:10, xxxxxxxx wrote:

well, the loop just iterated throughout all the materials 🙂 the "... do something here" part was the code needed to select them