Returning materials to 4d(without parameters)

Sub forum for help and tutorials.

Moderators: ChrisHekman, aoktar

Post Reply
marcus1070
Licensed Customer
Posts: 45
Joined: Mon Nov 07, 2011 3:14 pm
Location: Brisbane - AU
Contact:

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()
- Win 10 Pro 64bit
- 64gb Ram
- RTX 3090
- RTX 2080
- Nvidia driver version: 516.94
- Cinema 4d r25
- Plugin version Studio+ 2022.1(r7)


http://www.marcusrizzo.com
User avatar
aoktar
Octane Plugin Developer
Posts: 16066
Joined: Tue Mar 23, 2010 8:28 pm
Location: Türkiye
Contact:

Check scripts under this section. It's enough to start and make progress.
viewtopic.php?f=87&t=56039
Octane For Cinema 4D developer / 3d generalist

3930k / 16gb / 780ti + 1070/1080 / psu 1600w / numerous hw
Post Reply

Return to “Help / Tutorials”