Changing Material's Icon?
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 01/06/2011 at 10:14, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 12
Platform: Windows ;
Language(s) : C.O.F.F.E.E ; PYTHON ;---------
Hi,
I've tried everything I can think of. But I can't figure out how to change the icon previews on materials.I started with the basics:
var mat = doc->GetActiveMaterial(); mat#MatPreviewFlat2D = true; //<---invalid ID
Then I tried getting at them from the material's container:
var mat = doc->GetActiveMaterial(); var bc = mat->GetContainer(); var preview = bc->SetData(MatPreviewFlat2D, true);//<--- member not found bc->SetContainer(preview);
Then I thought maybe that they weren't held by the material.
But held by another object(ID_MATERIAL_PREVIEW) inside of the material://No errors...But it doesn't do anything var mat = doc->GetActiveMaterial(); var preview = mat#ID_MATERIAL_PREVIEW; preview = MatPreviewFlat2D; CallCommand(12252); // Render Materials updates the ICON
Nope.
Can anyone tell me what I'm doing wrong?
If it's not possible in Coffee. Then a Python or C++ solution is ok.Thanks,
-ScottA*Edit:
After more looking. I found a preview class in the C++ SDK.
It has a SetPreviewType(MatPreviewType t) method in it.
But I could not find these in the Python and Coffee SDK's. So does that mean that this is only supported in C++? -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 02/06/2011 at 17:16, xxxxxxxx wrote:
Am I even close with this?
Or am I way off?Bool SimplePlugin::Execute(BaseDocument *doc) { BaseMaterial *mat = doc->GetActiveMaterial(); Bool Init(BaseMaterial* mat, LONG lCount); MaterialPreviewData *MPD = What the heck goes here? MPD->SetPreviewType(MatPreviewFlat2D); return TRUE; }
-ScottA
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 06/06/2011 at 06:28, xxxxxxxx wrote:
It's possible through C++, probably Python too. The material preview is a custom data type which are not supported by COFFEE.
Example:
#include "customgui_matpreview.h" ... Bool MenuTest::Execute(BaseDocument *doc) { BaseMaterial *mat = doc->GetActiveMaterial(); if (!mat) return FALSE; GeData d; if (mat->GetParameter(DescLevel(MATERIAL_PREVIEW), d, DESCFLAGS_GET_0)) { MaterialPreviewData *mp = (MaterialPreviewData* )d.GetCustomDataType(CUSTOMDATATYPE_MATPREVIEW); // set the preview type, see the C++ docs if (mp) mp->SetPreviewType(MatPreviewTorus); mat->SetParameter(DescLevel(MATERIAL_PREVIEW), d, DESCFLAGS_SET_0); } mat->Message(MSG_UPDATE); mat->Update(TRUE, FALSE); EventAdd(); return TRUE; }
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 06/06/2011 at 07:54, xxxxxxxx wrote:
Thanks.
I was trying out every combination of GeData and SetParameter() I could think of over the weekend. But I just couldn't find the magic combination to make it work.The SDK also confused me a lot. Because under "customgui_matpreview.h" it says that it must be created with Alloc. And then there's three different types of Init() functions.
I know now that those functions are for different things than setting the built-in preview types. But the whole experience was extremely confusing to me.I hope the C++ SDK gets some sort of attention in the future. And a more clear way of explaining things to newer users is found. This C++ stuff is actually pretty easy to do when it's explained.
If I can be of any help in that area. Please let me know. I'm willing to volunteer some time to that.Thanks again for the help,
-ScottA