Set Material Preview



  • On 09/03/2013 at 11:37, xxxxxxxx wrote:

    I'm trying to change the preview of a material from the normal sphere object in python. I found some documentation on it in the C++ documentation under MaterialPreviewType but i'm not sure I have the knowledge to implement that yet. Can anyone help or point me in the right direction? Thanks!



  • On 09/03/2013 at 14:19, xxxxxxxx wrote:

    MaterialPreviews are a CustomGui / CustomDataType which is not wrapped for Python. Basically

    you would read/write it with mymaterial[c4d.MATERIAL_PREVIEW], but as i said it is not wrapped.



  • On 09/03/2013 at 14:58, xxxxxxxx wrote:

    Thanks Little Devil, that seems a bit beyond me at this point. I'll take another look when I understand more about Python.



  • On 01/04/2016 at 17:22, xxxxxxxx wrote:

    Is the material preview type still inaccessible from Python?



  • On 04/04/2016 at 02:19, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    Is the material preview type still inaccessible from Python?

    I'm afraid the Python API still doesn't support the MaterialPreviewData type.



  • On 07/11/2016 at 23:13, xxxxxxxx wrote:

    And is there any way to access the general c4d settings to change the default material preview ?

    EDIT:
    Nevermind, got it :)



  • On 08/11/2016 at 01:32, xxxxxxxx wrote:

    Hello,

    one can change the global settings by accessing the world container. Please notice that "custom" material preview scenes have to be set differently than default material preview scenes.

      
    worldContainer = c4d.GetWorldContainerInstance()  
      
    # set a default value  
    worldContainer.SetInt32(c4d.WPREF_MATPREVIEW_DEFAULTOBJECT_MAT, c4d.MatPreview2Torus)  
      
    # or set a custom scene  
    worldContainer.SetInt32(c4d.WPREF_MATPREVIEW_DEFAULTOBJECT_MAT, c4d.MatPreviewUser)  
    worldContainer.SetString(c4d.WPREF_MATPREVIEW_DEFAULTUSERSCENE_MAT, "Cylinder (GI)")  
      
    c4d.EventAdd()  
    

    best wishes,
    Sebastian


Log in to reply