Duplicate Material?

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

On 18/11/2004 at 17:07, xxxxxxxx wrote:

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

---------
Hi,

what is the best method to check if two materials are the same (I need to write my own "RemoveDuplicateMaterials" function). Which Parameters are used for this?

Thank you!!

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

On 19/11/2004 at 08:03, xxxxxxxx wrote:

I tried to browse through each container ID and check if they are the same on both materials, but that doesn´t work (either if I check the returned GeData with the compare operator == or if I really check the values of each GeData).

Anybody any idea?

thx!

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

On 01/12/2004 at 03:12, xxxxxxxx wrote:

How do you mean? Why doesn't checking all values work? How would you define "being the same material"?

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

On 01/12/2004 at 07:43, xxxxxxxx wrote:

I don´t know why it doesn´t work, but it doesn´t. It always tells me that it´s different. "Being the same material" is a material with the exact same settings (the name is irrelevant though, it can be different). Just the way Cineam does.
But from your words, I think I better recheck if I didn´t do anything wrong.

Thanks, will report if the problem still exists.

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

On 01/12/2004 at 14:10, xxxxxxxx wrote:

Hi Katachi,
I think I've just encountered the same problem as you, but I think I have a solution.

I found (as you did), that if you just iterate through all the parameters and compare them, it always says they are different.

I eventually found out that if you have a 'null' GeData object, then it acts like a NaN, in that if compares false with everything including itself.

Why is this relevant? Because the parameters seem to include a whole bunch of these null/NaN values!

A workaround that I found that seems to work if you want to compare materials A and B is to iterate through all the parameters, and for each parameter get a GeData gA and a GeData gB.
Now, before checked if gA==gB, check whether gA==gA.
If it doesn't then ignore that parameter and move on to the next one.

This seems to work!

Hope this helps.

Cheers - Steve

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

On 01/12/2004 at 14:22, xxxxxxxx wrote:

Hi Steve,

thanks, I will try that!! 🙂