def main():
    c4d.StopAllThreads()
    doc = c4d.documents.GetActiveDocument()
    fps = doc.GetFps()
    fromTime = doc.GetMinTime().GetFrame(fps)
    toTime = doc.GetMaxTime().GetFrame(fps)
    animLength = toTime - fromTime + 1
    filePath = c4d.storage.SaveDialog()
    filePath, objName = os.path.split(filePath)
    objName = objName + "_"
    filePath = filePath + "\\"

    for f in range(0, animLength):
        doc.SetTime(c4d.BaseTime(fromTime, fps) + c4d.BaseTime(f, fps))
        c4d.EventAdd(c4d.EVENT_FORCEREDRAW)
        c4d.DrawViews(c4d.DRAWFLAGS_FORCEFULLREDRAW)

        c4d.StatusSetText("Exporting " + str(f) + " of " + str(animLength))
        c4d.StatusSetBar(100.0 * f / animLength)

        c4d.CallCommand(16768, 16768)
        c4d.CallCommand(100004794, 100004794)
        c4d.CallCommand(100004787)

        fileName = filePath + objName + str(f) + ".obj"
        savingresult = c4d.documents.SaveDocument(doc, fileName,
                                                  c4d.SAVEDOCUMENTFLAGS_0,
                                                  c4d.FORMAT_OBJ2EXPORT)

        c4d.CallCommand(12105, 12105)
        c4d.CallCommand(12105, 12105)
        c4d.CallCommand(12105, 12105)

    c4d.StatusClear()
    gui.MessageDialog('Exporting to' + filePath + ' done')
Пример #2
0
def main(undo = True):
    now = c4d.GeGetTimer() # start stopwatch
    c4d.CallCommand(13957) # Konsole löschen
    # c4d.CallCommand(12305) # Konsole...

    if GetActiveDocument():
        doc     = GetActiveDocument()
        if doc.GetFirstObject():
            c4d.StatusSetSpin()
            op = doc.GetFirstObject()
            myobject = op
            counter = numberofobjects(op)
            secondcounter = 0
            c4d.StatusSetText ('%s Objects are processed.' %(counter))
            opactive = None
        else:
            print "Error: No Objects"
            return False
    else:
        print "Error: No Document"
        return False
    
    #doc.StartUndo() # Start undo support
    # iterate over all objects in the document
    c4d.CallCommand(12113) # Alles deselektieren
    
    while op:
        
        optemp = op
        op = GetNextObject(op) # get next object    
            
        secondcounter += 1        
        statusbar(counter, secondcounter)

        if optemp.CheckType(c4d.Opolygon):
            optemp.SetBit(c4d.BIT_ACTIVE)
  
            if selchildren(optemp,optemp.GetNext()):
                c4d.CallCommand(16768) #Connect And Delete
                c4d.CallCommand(16768) #Connect And Delete
            
            opactive = doc.GetActiveObject()
            opactive.DelBit(c4d.BIT_ACTIVE)
                    
        optemp.DelBit(c4d.BIT_ACTIVE)
            

    c4d.StatusClear()
    #doc.EndUndo() # Do not forget to close the undo support
    c4d.EventAdd()        # update cinema 4d
    print 'END OF SCRIPT %s ms ' %(c4d.GeGetTimer() - now)
    return 
Пример #3
0
def main():
    c4d.StopAllThreads()
    doc = c4d.documents.GetActiveDocument()
    fps = doc.GetFps()
    fromTime = doc.GetMinTime().GetFrame(fps)
    toTime = doc.GetMaxTime().GetFrame(fps)
    animLength = toTime - fromTime + 1
    filePath = c4d.storage.SaveDialog()
    filePath, objName = os.path.split(filePath)
    objName = objName + "_"
    filePath = filePath + "\\"


    for f in range(0,animLength):
        
        c4d.EventAdd(c4d.EVENT_FORCEREDRAW)
        c4d.DrawViews(c4d.DRAWFLAGS_FORCEFULLREDRAW)
        c4d.StatusSetText("Exporting " + str(f) + " of " + str(animLength))
        c4d.StatusSetBar(100.0*f/animLength)
         
        objs = doc.GetActiveObjects(c4d.GETACTIVEOBJECTFLAGS_CHILDREN)
 
        # Get a fresh, temporary document with only the selected objects
        docTemp = c4d.documents.IsolateObjects(doc, objs)
        docTemp.SetTime(c4d.BaseTime(fromTime,fps) + c4d.BaseTime(f,fps))
        if docTemp == None:
            return
    
        # Set project scale
        unitScale = c4d.UnitScaleData()
        unitScale.SetUnitScale(1.0, c4d.DOCUMENT_UNIT_M)
    
        bc = c4d.BaseContainer()
        bc[c4d.DOCUMENT_DOCUNIT] = unitScale
        docTemp.SetDocumentData(c4d. DOCUMENTSETTINGS_DOCUMENT, bc)
        

        fileName = filePath+objName+str(f)+".obj"
        savingresult = c4d.documents.SaveDocument(docTemp,fileName,c4d.SAVEDOCUMENTFLAGS_0,c4d.FORMAT_OBJ2EXPORT)
        c4d.documents.KillDocument(docTemp)

    c4d.StatusClear()
    gui.MessageDialog( 'Exporting to'+filePath+' done' )
def ReplaceRendersettingsFromScene(scene, append=True):
    c4d.StatusSetSpin()
    message = """Replacing current Render-Settings from: %s""" % (scene)
    c4d.StatusSetText(message)

    tdoc = c4d.documents.LoadDocument(
        scene, c4d.SCENEFILTER_ONLY_RENDERDATA
        | c4d.SCENEFILTER_IGNOREMISSINGPLUGINSINNONACTIVERENDERDATA, None)
    if tdoc is None:
        return

    trd = tdoc.GetFirstRenderData()
    active = tdoc.GetActiveRenderData()

    clones = list()
    while trd:
        clones.append(trd.GetClone())
        trd = trd.GetNext()

    rd = doc.GetFirstRenderData()
    current_rd = list()
    while rd:
        current_rd.append(rd)
        rd = rd.GetNext()

    doc.StartUndo()

    if not append:
        for rd in current_rd:
            doc.AddUndo(c4d.UNDOTYPE_DELETE, rd)
            rd.Remove()

    for trd in reversed(clones):
        doc.AddUndo(c4d.UNDOTYPE_NEW, trd)
        doc.InsertRenderDataLast(trd)
        if trd.GetData() == active.GetData():
            doc.SetActiveRenderData(trd)

    doc.EndUndo()
    c4d.EventAdd()

    c4d.StatusSetBar(0)
    c4d.StatusClear()
Пример #5
0
def main():
    texture_dir = c4d.storage.LoadDialog(
        type=c4d.FILESELECTTYPE_IMAGES,
        title="Select Directory Containing Textures",
        flags=c4d.FILESELECT_DIRECTORY)
    if texture_dir is None:
        c4d.StatusSetText("Import Textures: Cancelled")
        return

    mat = c4d.BaseMaterial(c4d.Mmaterial)

    channels = [
        ChannelTexture(
            "Color", c4d.MATERIAL_USE_COLOR, c4d.MATERIAL_COLOR_SHADER,
            ["color", "diffuse", "albedo", "col", "diff", "dif", "clr"]),
        ChannelTexture("Luminance", c4d.MATERIAL_USE_LUMINANCE,
                       c4d.MATERIAL_LUMINANCE_SHADER,
                       ["luminance", "emission", "luma", "lum", "emi"]),
        ChannelTexture(
            "Bump", c4d.MATERIAL_USE_BUMP, c4d.MATERIAL_BUMP_SHADER,
            ["bump", "bmp"]),  #TODO: Fix possible bug with *.bmp files
        ChannelTexture("Displacement", c4d.MATERIAL_USE_DISPLACEMENT,
                       c4d.MATERIAL_DISPLACEMENT_SHADER,
                       ["displacement", "disp", "height"]),
        ChannelTexture("Ambient Occlusion", c4d.MATERIAL_USE_DIFFUSION,
                       c4d.MATERIAL_DIFFUSION_SHADER,
                       ["ambientocclusion", "ambient", "AO", "occlusion"]),
        ChannelTexture("Normal", c4d.MATERIAL_USE_DIFFUSION,
                       c4d.MATERIAL_DIFFUSION_SHADER,
                       ["normal", "norm", "nrml", "nrm"])
    ]

    for texture in os.listdir(texture_dir):
        for channel in channels:
            if channel.loaded:
                continue

            channel.Load(mat, texture_dir, texture)

    doc.InsertMaterial(mat)
    c4d.EventAdd()
def main():
    td = doc.GetTakeData()
    mt = td.GetMainTake()
    take_list = td.GetTakeSelection(True)
    #cam = main.GetEffectiveCamera(td)
    #camname=c4d.BaseList2D.GetName(cam)
    c4d.StatusSetText("updating")
    print("status update")
    #print(cam.getType())
    #print(cam.getTypeName())
    #print(cam.GetObjectName())
    c4d.StatusSetBar(0)
    for i in take_list:
        if not i.IsMain():
            print(i)
            tempCam = i.GetEffectiveCamera(td)
            print(tempCam)
            cn = tempCam[0].GetName()
            print(cn)
            i.SetName(cn)
            #td.(i)
    c4d.StatusClear()
Пример #7
0
def main():
    fn = c4d.storage.LoadDialog(c4d.FILESELECTTYPE_ANYTHING,
                                "Folder to export", c4d.FILESELECT_DIRECTORY)
    if not fn: return  # If cancelled stop the script
    doc = c4d.documents.GetActiveDocument()  # Get active Cinema 4D document
    objects = doc.GetObjects()  # Get objects

    plug = plugins.FindPlugin(1030178, c4d.PLUGINTYPE_SCENESAVER)
    if plug is None:
        return
    data = {}
    if plug.Message(c4d.MSG_RETRIEVEPRIVATEDATA, data):
        if "imexporter" not in data:
            return
        objExport = data["imexporter"]
        if objExport is None:
            return

    for i, obj in enumerate(objects):  # Iterate through objects
        tempDoc = c4d.documents.BaseDocument()  # Initiralize a temp document
        clone = obj.GetClone()  # Get clone of the original object
        tags = obj.GetTags()  # Get object's tags
        for t in tags:  # Loop through tags
            if isinstance(t, c4d.TextureTag):  # If texture tag
                mat = t[c4d.TEXTURETAG_MATERIAL]  # Get material
                tempDoc.InsertMaterial(
                    mat)  # Insert material to the temp document
        tempDoc.InsertObject(clone)  # Insert clone to the temp document
        name = obj.GetName()
        path = os.path.splitext(fn)[0] + "\\" + name + ".obj"  # File name
        c4d.documents.SaveDocument(tempDoc, path,
                                   c4d.SAVEDOCUMENTFLAGS_DONTADDTORECENTLIST,
                                   1030178)  # Export OBJ-file
        tempDoc.Flush()  # Flush temp doc
    c4d.StatusSetText("Export complete!")  # Set status text
    c4d.EventAdd()  # Refresh Cinema 4D
Пример #8
0
def main():
    # ---------------------------------------------------------------------------------------------------
    # Setup and export AI-sequence with Sketch and Toon
    fn = c4d.storage.LoadDialog(
        c4d.FILESELECTTYPE_ANYTHING,
        "Select Save Path",
        flags=c4d.FILESELECT_DIRECTORY)  # Select path to save
    if not fn: return  # If cancelled stop the script
    doc = c4d.documents.GetActiveDocument()  # Get active Cinema 4D document
    renderData = doc.GetActiveRenderData()  # Get document render data
    currVideoPost = renderData.GetFirstVideoPost()  # Get first render effect
    sntFound = False  # Initialize variable for storing info is 'Sketch and Toon' effect enabled already
    while currVideoPost is not None:  # Loop through render effects
        if currVideoPost.GetType(
        ) == 1011015:  # If 'Sketch and Toon' effect found
            sntFound = True  # Set variable to true
        currVideoPost = currVideoPost.GetNext(
        )  # Get next render effect on list
    if sntFound == False:  # If 'Sketch and Toon' effect is not enabled already
        sketchEffect = c4d.documents.BaseVideoPost(
            1011015)  # Initialize 'Sketch and Toon' effect
        renderData.InsertVideoPostLast(
            sketchEffect)  # Add 'Sketch and Toon' effect to render settings
    sketchMat = c4d.BaseMaterial(1011014)  # Initialize 'Sketch Material'
    doc.InsertMaterial(sketchMat)  # Insert material to document
    sketchTags = []  # Initialize list for 'Sketch Style' tags
    # ---------------------------------------------------------------------------------------------------
    # Export plug-in settings
    plug = plugins.FindPlugin(1012074, c4d.PLUGINTYPE_SCENESAVER)
    if plug is None:
        return
    data = {}
    if plug.Message(c4d.MSG_RETRIEVEPRIVATEDATA, data):
        if "imexporter" not in data:
            return
        aiExport = data["imexporter"]
        if aiExport is None:
            return
        # Change Illustrator export settings
        aiExport[c4d.TUAIEXPORT_OUTPUTSIZE] = 0  # Output: Render
        aiExport[c4d.TUAIEXPORT_ZSORT] = 0
        aiExport[c4d.TUAIEXPORT_SCALE] = 1  # Scale: 100%
        aiExport[c4d.TUAIEXPORT_EXPORTLINES] = 1  # Export lines
        aiExport[c4d.TUAIEXPORT_LINEOPACITY] = 0  # Disable line opacity
        aiExport[c4d.TUAIEXPORT_LINETHICKNESS] = 0  # Disable line thickness
        aiExport[c4d.TUAIEXPORT_LINEPATTERNS] = 0  # Disable line patterns
        aiExport[c4d.TUAIEXPORT_LINECONNECTIONS] = 1  # Enable line connections
        aiExport[c4d.TUAIEXPORT_EXPORTSURFACE] = 0  # Disable surface export
        aiExport[c4d.TUAIEXPORT_ANIMATION] = 1  # Export animation
        aiExport[c4d.TUAIEXPORT_ANIMTYPE] = 0  # Output As: Files
        aiExport[c4d.TUAIEXPORT_FRAMES] = 2  # Frames: Manual
        aiExport[c4d.TUAIEXPORT_FRAME_START] = doc.GetLoopMinTime(
        )  # Animation first frame
        aiExport[c4d.TUAIEXPORT_FRAME_END] = doc.GetLoopMaxTime(
        )  # Animation last frame
        aiExport[c4d.TUAIEXPORT_FRAME_RATE] = doc.GetFps()  # Frame rate
    # ---------------------------------------------------------------------------------------------------
    # Handle selected objects
    selection = doc.GetActiveObjects(
        c4d.GETACTIVEOBJECTFLAGS_0)  # Get selected objects
    for i in xrange(0, len(selection)):  # Loop through selected objects
        #sketchTags.append(c4d.BaseTag(1011012)) # Insert 'Sketch Style' tag to sketchTags list
        sketchTag = c4d.BaseTag(1011012)  # Initialize a sketch tag
        sketchTag[
            c4d.
            OUTLINEMAT_LINE_DEFAULT_MAT_V] = sketchMat  # Put sketch material to sketch tag
        sketchTag[c4d.OUTLINEMAT_LINE_SPLINES] = 1  # Enable splines
        sketchTag[c4d.OUTLINEMAT_LINE_FOLD] = 0  # Disable fold
        sketchTag[c4d.OUTLINEMAT_LINE_CREASE] = 0  # Disable crease
        sketchTag[c4d.OUTLINEMAT_LINE_BORDER] = 0  # Disable border
        selection[i].InsertTag(
            sketchTag)  # Insert sketch tag to selected object
        # ---------------------------------------------------------------------------------------------------
        folderPath = os.path.splitext(fn)[0]  # Folder path
        objectName = selection[i].GetName()  # Get object name
        os.mkdir(folderPath + "\\" + objectName)  # Create new folders
        fullFilePath = folderPath + "\\" + objectName + "\\" + objectName + ".ai"  # Full file path
        c4d.documents.SaveDocument(doc, fullFilePath,
                                   c4d.SAVEDOCUMENTFLAGS_DONTADDTORECENTLIST,
                                   1012074)  # Export AI-file
        sketchTag.Remove()  # Delete sketch tag
    # ---------------------------------------------------------------------------------------------------
    # Remove unnecessary stuff
    #for st in sketchTags: # Loop through sketchTags
    #st.Remove() # Remove 'Sketch Style' tag
    sketchMat.Remove()  # Remove 'Sketch Material'
    if sntFound == False:  # If there was not 'Sketch and Toon' render effect already
        sketchEffect.Remove()  # Remove 'Sketch and Toon' render effect
    # ---------------------------------------------------------------------------------------------------
    c4d.StatusClear()  # Clear status bar
    c4d.StatusSetText("Export complete!")  # Set status text
    c4d.EventAdd()  # Refresh Cinema 4D
Пример #9
0
def main():
    """ Step 1 - Setup and export AI-sequence with Sketch and Toon """
    keyMod = GetKeyMod() # Get keymodifier

    doc = c4d.documents.GetActiveDocument() # Get active Cinema 4D document
    sketchTags = [] # Initialize list for 'Sketch Style' tags

    if keyMod == "None":
        fn = c4d.storage.SaveDialog(c4d.FILESELECTTYPE_ANYTHING, "Select Save Path") # Select path to save
        if not fn: return # If cancelled stop the script

        sketchMat = c4d.BaseMaterial(1011014) # Initialize 'Sketch Material'
        doc.InsertMaterial(sketchMat) # Insert material to document
        sntFound, sketchEffect = SetRender(doc) # Set render settings
        SetExporter(doc) # Set exporter settings

        selection = doc.GetActiveObjects(c4d.GETACTIVEOBJECTFLAGS_0) # Get selected objects
        for i in range(0, len(selection)): # Loop through selected objects
            sketchTags.append(c4d.BaseTag(1011012)) # Insert 'Sketch Style' tag to sketchTags list
            sketchTags[i][c4d.OUTLINEMAT_LINE_DEFAULT_MAT_V] = sketchMat # Put sketch material to sketch tag
            sketchTags[i][c4d.OUTLINEMAT_LINE_SPLINES] = 1 # Enable splines
            sketchTags[i][c4d.OUTLINEMAT_LINE_FOLD] = 0 # Disable fold
            sketchTags[i][c4d.OUTLINEMAT_LINE_CREASE] = 0 # Disable crease
            sketchTags[i][c4d.OUTLINEMAT_LINE_BORDER] = 0 # Disable border
            selection[i].InsertTag(sketchTags[i]) # Insert sketch tag to selected object

        name = os.path.splitext(fn)[0]+".ai" # File name
        c4d.documents.SaveDocument(doc, name, c4d.SAVEDOCUMENTFLAGS_DONTADDTORECENTLIST, 1012074) # Export AI-file

    elif keyMod == "Shift":
        fn = c4d.storage.LoadDialog(c4d.FILESELECTTYPE_ANYTHING, "Select Save Path", flags=c4d.FILESELECT_DIRECTORY) # Select folder to save
        if not fn: return # If cancelled stop the script

        sketchMat = c4d.BaseMaterial(1011014) # Initialize 'Sketch Material'
        doc.InsertMaterial(sketchMat) # Insert material to document
        sketchTags = [] # Initialize list for 'Sketch Style' tags

        sntFound, sketchEffect = SetRender(doc) # Set render settings
        SetExporter(doc) # Set exporter settings

        # Handle selected objects
        selection = doc.GetActiveObjects(c4d.GETACTIVEOBJECTFLAGS_0) # Get selected objects
        for i in range(0, len(selection)): # Loop through selected objects
            #sketchTags.append(c4d.BaseTag(1011012)) # Insert 'Sketch Style' tag to sketchTags list
            sketchTag = c4d.BaseTag(1011012) # Initialize a sketch tag
            sketchTag[c4d.OUTLINEMAT_LINE_DEFAULT_MAT_V] = sketchMat # Put sketch material to sketch tag
            sketchTag[c4d.OUTLINEMAT_LINE_SPLINES] = 1 # Enable splines
            sketchTag[c4d.OUTLINEMAT_LINE_FOLD] = 0 # Disable fold
            sketchTag[c4d.OUTLINEMAT_LINE_CREASE] = 0 # Disable crease
            sketchTag[c4d.OUTLINEMAT_LINE_BORDER] = 0 # Disable border
            selection[i].InsertTag(sketchTag) # Insert sketch tag to selected object

            folderPath = os.path.splitext(fn)[0] # Folder path
            objectName = selection[i].GetName() # Get object name
            os.mkdir(folderPath+"\\"+objectName) # Create new folders
            fullFilePath = folderPath+"\\"+objectName+"\\"+objectName+".ai" # Full file path
            c4d.documents.SaveDocument(doc, fullFilePath, c4d.SAVEDOCUMENTFLAGS_DONTADDTORECENTLIST, 1012074) # Export AI-file
            sketchTag.Remove() # Delete sketch tag

    # Remove unnecessary stuff
    for st in sketchTags: # Loop through sketchTags
        st.Remove() # Remove 'Sketch Style' tag
    sketchMat.Remove() # Remove 'Sketch Material'
    if sntFound == False: # If there was not 'Sketch and Toon' render effect already
        sketchEffect.Remove() # Remove 'Sketch and Toon' render effect

    # Rest of the stuff
    c4d.StatusClear() # Clear status bar
    c4d.StatusSetText("Export complete!") # Set status text
    c4d.EventAdd() # Refresh Cinema 4D
Пример #10
0
def main():
    colors_objects_mgs = {}

    doc.StartUndo()

    c4d.StatusSetText("[1/2]: Collating by color.")
    c4d.StatusSetSpin()

    # Store objects by color
    obj = doc.GetFirstObject()
    while obj:
        color = obj[c4d.ID_BASEOBJECT_COLOR]
        color_string = repr(color)
        mg = obj.GetMg()

        obj_mg = (obj, mg)

        if color_string in colors_objects_mgs.keys():
            colors_objects_mgs[color_string].append(obj_mg)
        else:
            colors_objects_mgs[color_string] = [obj_mg]

        obj = GetNextObject(obj)

    c4d.StatusSetText("[2/2]: Grouping Objects.")
    # Build groups of objects by color
    pred_null = None
    for color_string, obj_mg_list in colors_objects_mgs.iteritems():
        # Find the center position of the objects
        average_pos = c4d.Vector(0.0)

        for obj, mg in obj_mg_list:
            average_pos += mg.off

        average_pos /= float(len(obj_mg_list))

        # Create a null centered between the objects
        null_obj = c4d.BaseObject(c4d.Onull)

        # Make it the same color as the objects
        null_obj[c4d.ID_BASEOBJECT_USECOLOR] = 1  # Automatic Mode
        null_obj[c4d.ID_BASEOBJECT_COLOR] = eval("c4d." + color_string)
        null_obj[c4d.NULLOBJECT_ICONCOL] = True

        # Center the null
        center_mg = c4d.Matrix()
        mg.off = average_pos

        # Ensure nulls are inserted roughly in the same order colors first occurred in the scene.
        doc.InsertObject(null_obj, pred=pred_null)
        pred_null = null_obj

        # Center the null
        null_obj.SetMg(center_mg)
        doc.AddUndo(c4d.UNDOTYPE_NEW, null_obj)

        # Move objects of the came color under the new null
        pred = None
        for obj, mg in obj_mg_list:
            doc.AddUndo(c4d.UNDOTYPE_CHANGE, obj)
            obj.Remove()
            doc.InsertObject(obj, parent=null_obj, pred=pred)
            obj.SetMg(mg)
            pred = obj

    doc.EndUndo()
    c4d.EventAdd()
    c4d.StatusClear()
Пример #11
0
def main():
    
    # get active document
    doc = c4d.documents.GetActiveDocument()

    # retrieve an instance of render data
    renderSettings = doc.GetActiveRenderData()

    # retrieve fps
    docFps = doc.GetFps()
    
    # Get Animation Length
    fromTime = renderSettings[c4d.RDATA_FRAMEFROM].GetFrame(docFps)
    toTime = renderSettings[c4d.RDATA_FRAMETO].GetFrame(docFps)
    animLength = toTime - fromTime + 1
    
    # prompt user for directory
    filePath = c4d.storage.SaveDialog()
    filePath, objName = os.path.split(filePath)
    objName = objName + "_"
    filePath = filePath + "\\"
    # Check for confirmation
    questionDialogText = "Obj Sequence will be saved as:\n\n"\
        "" + filePath + objName + "####.obj\n\n"\
        "From frame " + str(fromTime) + " to " + str(toTime) + " for " + str(animLength) + " frames.\n"
    proceedBool = c4d.gui.QuestionDialog(questionDialogText)
    
    if proceedBool == True:
        
        # Loop through animation and export frames
        for x in range(0,animLength):
            
            # change frame, redraw view
            moveTime = c4d.BaseTime(fromTime,docFps) + c4d.BaseTime(x,docFps)
            doc.SetTime(moveTime)
            c4d.EventAdd(c4d.EVENT_FORCEREDRAW)
            c4d.DrawViews(c4d.DRAWFLAGS_FORCEFULLREDRAW)
            
            # progress bar
            c4d.StatusSetText("Exporting " + str(x) + " of " + str(animLength))
            c4d.StatusSetBar(100.0*x/animLength)
            
            # add buffer 0001
            bufferedNumber = str(doc.GetTime().GetFrame(docFps))
            if len(bufferedNumber)<4:
                for x in range(len(bufferedNumber),4):
                    bufferedNumber = "0" + bufferedNumber
            
            #save file   
            fileName = filePath+objName+bufferedNumber+".obj"
            print fileName
            c4d.documents.SaveDocument(doc,fileName,c4d.SAVEDOCUMENTFLAGS_DONTADDTORECENTLIST,c4d.FORMAT_OBJEXPORT)
        
    else: print "User directed cancel"
        
    c4d.StatusClear()
    
    # ask to open containing folder
    viewFilesBool = c4d.gui.QuestionDialog("Do you want to open containing folder?")
    if viewFilesBool == True:
        ('explorer "C:\path\of\folder"')
        subprocess.Popen('explorer ' + '"' + filePath + '"' )
    else:
        return None