Page 1 of 1

Returning materials to 4d(without parameters)

Posted: Thu Mar 05, 2020 2:49 am
by marcus1070
Hi @aoktar ! :D
I've search for a script or something that could revert the octane materials tags to default c4d, just the tags, not a really materials and texture.. I'm trying to export some objects to fbx and any other format, it simply ignore the octane materials. it seems 4d dont consider octane materials as it, so he wont export.
Could we have something like a script, just for this?

I made this script above, but only convert one material each time.

import c4d
from c4d import gui

doc = c4d.documents.GetActiveDocument()
activemat = doc.GetActiveMaterial()
mats = doc.GetMaterials();



def swapMat(activemat, mat):
objLink = activemat[c4d.ID_MATERIALASSIGNMENTS]
for x in xrange(objLink.GetObjectCount()):
texTag = objLink.ObjectFromIndex(doc, x)
texTag.SetMaterial(mat)
c4d.EventAdd()



def main():


mat = c4d.BaseMaterial(c4d.Mmaterial); # create standard material
mat[c4d.ID_BASELIST_NAME] = activemat.GetName() +"_";
doc.InsertMaterial(mat,pred=None,checknames=True)

swapMat(activemat, mat)

c4d.EventAdd();


if __name__=='__main__':
main()

Re: Returning materials to 4d(without parameters)

Posted: Fri Mar 06, 2020 6:51 pm
by aoktar
Check scripts under this section. It's enough to start and make progress.
viewtopic.php?f=87&t=56039