On 02/11/2014 at 05:45, xxxxxxxx wrote:
Hi
I'm currently trying to setup a way of having a low poly object in my scene replaced by a high poly version at render time. Both the low and high poly objects are automatically generated by my code and saved to a temporary scene file for retrieval at render time. I've got everything almost working except that the materials saved with the high poly object aren't showing in the render. The materials are definitely there in the scene file as I can load independently and see. I have a null object with a python tag that detects messages for external rendering - which loads up the high poly object.
Heres the bones of the code. It's messy and hacked I know - if anyone has a better suggestion to mimic the Xref process, would be great.
> def message(id, data) :
>
> if c4d.CheckIsRunning(c4d.CHECKISRUNNING_EXTERNALRENDERING) == True:
>
> loadScene()
>
> return
>
>
>
>
>
>
>
>
>
> def loadScene() :
>
>
>
>
>
>
>
> path = "/Applications/MAXON/tempScene.c4d"
>
>
>
>
> fO = LoadDocument(path, c4d.SCENEFILTER_OBJECTS)
>
> fM = LoadDocument(path, c4d.SCENEFILTER_MATERIALS)
>
>
>
> #Find the specific object in the file
>
> obj = fO.SearchObject("Vecfield Final")
>
> #Make a copy of it in memory
>
> clone = obj.GetClone()
>
>
>
>
> #Add the copy to your current open scene
>
> doc.InsertObject(clone,None,None)
>
>
>
>
> mats = fM.GetMaterials()
>
>
>
>
> for m in range(0,len (mats)) :
>
> doc.InsertMaterial(mats[m])