Returning materials to 4d(without parameters)

Forums: Returning materials to 4d(without parameters)
Sub forum for help and tutorials.

Moderator: aoktar

Returning materials to 4d(without parameters)

Postby marcus1070 » Thu Mar 05, 2020 2:49 am

marcus1070 Thu Mar 05, 2020 2:49 am
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
marcus1070
Licensed Customer
Licensed Customer
 
Posts: 44
Joined: Mon Nov 07, 2011 3:14 pm
Location: Brisbane - AU

Re: Returning materials to 4d(without parameters)

Postby aoktar » Fri Mar 06, 2020 6:51 pm

aoktar Fri Mar 06, 2020 6:51 pm
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
User avatar
aoktar
Octane Plugin Developer
Octane Plugin Developer
 
Posts: 15969
Joined: Tue Mar 23, 2010 8:28 pm
Location: Türkiye

Return to Help / Tutorials


Who is online

Users browsing this forum: No registered users and 6 guests

Fri Apr 26, 2024 2:56 pm [ UTC ]