Beispiel #1
0
def exportFbx(human, filepath, options):
    posemode.exitPoseMode()
    posemode.enterPoseMode()

    the.Human = human
    the.Config = export_config.exportConfig(human, True, [])
    the.Config.separatefolder = True
    outfile = export_config.getOutFileFolder(filepath, the.Config)
    (outpath, ext) = os.path.splitext(outfile)

    log.message("Write FBX file %s" % outfile)

    rawTargets = []
    if options["expressions"]:
        shapeList = read_expression.readExpressionUnits(human, 0, 1)
        rawTargets += shapeList

    if options["customshapes"]:
        the.Config.customshapes = True
        mhx_custom.listCustomFiles(the.Config)

        log.message("Custom shapes:")
        for path, name in the.Config.customShapeFiles:
            log.message("    %s", path)
            shape = mhx_custom.readCustomTarget(path)
            target = (name, shape)
            rawTargets.append(target)

    rigfile = "data/rigs/%s.rig" % options["fbxrig"]
    stuffs = object_collection.setupObjects(
        os.path.splitext(outfile)[0],
        human,
        rigfile,
        rawTargets=rawTargets,
        helpers=options["helpers"],
        hidden=options["hidden"],
        eyebrows=options["eyebrows"],
        lashes=options["lashes"],
    )

    (scale, unit) = options["scale"]

    bpy.initialize()
    name = os.path.splitext(os.path.basename(filepath))[0]
    boneInfo = stuffs[0].boneInfo
    rig = bpy.addRig(name, boneInfo)
    for stuff in stuffs:
        ob = bpy.addMesh(stuff.name, stuff, True)
        ob.parent = rig

    # name = os.path.splitext(os.path.basename(filepath))[0]
    # bpy.addMesh(name, human.meshData, False)

    filename = "%s.fbx" % outpath
    io_mh_fbx.fbx_export.exportFbxFile(bpy.context, filename)
    posemode.exitPoseMode()
    return
Beispiel #2
0
def exportFbx(human, filepath, options):
    posemode.exitPoseMode()        
    posemode.enterPoseMode()
    
    the.Human = human        
    the.Config = export_config.exportConfig(human, True, [])
    the.Config.separatefolder = True
    outfile = export_config.getOutFileFolder(filepath, the.Config)        
    (outpath, ext) = os.path.splitext(outfile)

    log.message("Write FBX file %s" % outfile)

    rawTargets = []
    if options["expressions"]:
        shapeList = read_expression.readExpressionUnits(human, 0, 1)
        rawTargets += shapeList

    if options["customshapes"]:
        the.Config.customshapes = True
        mhx_custom.listCustomFiles(the.Config)                            

        log.message("Custom shapes:")    
        for path,name in the.Config.customShapeFiles:
            log.message("    %s", path)
            shape = mhx_custom.readCustomTarget(path)
            target = (name,shape)
            rawTargets.append(target)

    rigfile = "data/rigs/%s.rig" % options["fbxrig"]
    stuffs = object_collection.setupObjects(
        os.path.splitext(outfile)[0], 
        human, 
        rigfile, 
        rawTargets=rawTargets,
        helpers=options["helpers"], 
        hidden=options["hidden"], 
        eyebrows=options["eyebrows"], 
        lashes=options["lashes"])

    (scale, unit) = options["scale"]   

    bpy.initialize()
    name = os.path.splitext(os.path.basename(filepath))[0]
    boneInfo = stuffs[0].boneInfo
    rig = bpy.addRig(name, boneInfo)
    for stuff in stuffs:
        ob = bpy.addMesh(stuff.name, stuff, True)
        ob.parent = rig
        
    #name = os.path.splitext(os.path.basename(filepath))[0]
    #bpy.addMesh(name, human.meshData, False)
    
    filename = "%s.fbx" % outpath
    io_mh_fbx.fbx_export.exportFbxFile(bpy.context, filename)
    posemode.exitPoseMode()        
    return
Beispiel #3
0
def exportFbx(human, filepath, config):
    posemode.exitPoseMode()
    posemode.enterPoseMode()

    config.setHuman(human)
    config.setupTexFolder(filepath)

    log.message("Write FBX file %s" % filepath)
    print(config)

    rigfile = "data/rigs/%s.rig" % config.rigtype
    rawTargets = exportutils.collect.readTargets(human, config)
    filename = os.path.basename(filepath)
    name = config.goodName(os.path.splitext(filename)[0])
    stuffs = exportutils.collect.setupObjects(name,
                                              human,
                                              config=config,
                                              rigfile=rigfile,
                                              rawTargets=rawTargets,
                                              helpers=config.helpers,
                                              eyebrows=config.eyebrows,
                                              lashes=config.lashes)

    bpy.initialize(human, config)
    boneInfo = stuffs[0].boneInfo
    rig = bpy.addRig(name, boneInfo, scale=config.scale)
    for stuff in stuffs:
        ob = bpy.addMesh(stuff.name,
                         stuff,
                         rig,
                         isStuff=True,
                         scale=config.scale)

    #name = os.path.splitext(os.path.basename(filepath))[0]
    #bpy.addMesh(name, human.meshData, isStuff=False)

    gui3d.app.progress(0, text="Exporting %s" % filepath)
    io_fbx.fbx_export.exportFbxFile(bpy.context,
                                    filepath,
                                    scale=1.0,
                                    encoding=config.encoding)
    gui3d.app.progress(1)
    posemode.exitPoseMode()
    return
Beispiel #4
0
def exportFbx(human, filepath, config):
    posemode.exitPoseMode()        
    posemode.enterPoseMode()
    
    config.setHuman(human)
    config.setupTexFolder(filepath)        

    log.message("Write FBX file %s" % filepath)
    print(config)

    rigfile = "data/rigs/%s.rig" % config.rigtype
    rawTargets = exportutils.collect.readTargets(human, config)
    filename = os.path.basename(filepath)
    name = config.goodName(os.path.splitext(filename)[0])
    stuffs = exportutils.collect.setupObjects(
        name, 
        human, 
        config=config,
        rigfile=rigfile, 
        rawTargets=rawTargets,
        helpers=config.helpers, 
        eyebrows=config.eyebrows, 
        lashes=config.lashes)

    bpy.initialize(human, config)
    boneInfo = stuffs[0].boneInfo
    rig = bpy.addRig(name, boneInfo, scale=config.scale)
    for stuff in stuffs:
        ob = bpy.addMesh(stuff.name, stuff, rig, isStuff=True, scale=config.scale)
        
    #name = os.path.splitext(os.path.basename(filepath))[0]
    #bpy.addMesh(name, human.meshData, isStuff=False)
    
    gui3d.app.progress(0, text="Exporting %s" % filepath)
    io_fbx.fbx_export.exportFbxFile(bpy.context, filepath, scale=1.0, encoding=config.encoding)
    gui3d.app.progress(1)
    posemode.exitPoseMode()        
    return