Ejemplo n.º 1
0
			if EXPORT_ANIMATION: # Add frame to the filename.
				context_name[2] = '_%.6d' % frame
			
			Blender.Set('curframe', frame)
			if EXPORT_SEL_ONLY:
				export_objects = scn.objects.context
			else:	
				export_objects = scn.objects
			
			full_path= ''.join(context_name)
			
			# erm... bit of a problem here, this can overwrite files when exporting frames. not too bad.
			# EXPORT THE FILE.
			write(full_path, export_objects,\
			EXPORT_TRI, EXPORT_EDGES, EXPORT_NORMALS,\
			EXPORT_NORMALS_HQ, EXPORT_UV, EXPORT_MTL,\
			EXPORT_COPY_IMAGES, EXPORT_APPLY_MODIFIERS,\
			EXPORT_ROTX90, EXPORT_BLEN_OBS,\
			EXPORT_GROUP_BY_OB, EXPORT_GROUP_BY_MAT, EXPORT_KEEP_VERT_ORDER,\
			EXPORT_POLYGROUPS, EXPORT_CURVE_AS_NURBS)
		
		Blender.Set('curframe', orig_frame)
	
	# Restore old active scene.
	orig_scene.makeCurrent()
	Window.WaitCursor(0)


if __name__ == '__main__':
	Window.FileSelector(write_ui, 'Export Wavefront OBJ', sys.makename(ext='.obj'))
Ejemplo n.º 2
0
        ('VertGr. as SmoothGr.', EXPORT_VG2SG,
         'Make SmoothGroups by VertGroups. See doc.'),
        ('Center Objects', EXPORT_REC,
         'Center ALL objects to World-Grid-Origin-Center-Point-(0,0,0). ;)')
    ]

    if not Draw.PupBlock('Export...', pup_block):
        return

    Window.WaitCursor(1)

    guiTable['MOD'] = EXPORT_MOD.val
    guiTable['MTL'] = EXPORT_MTL.val
    guiTable['UV'] = EXPORT_UV.val
    guiTable['VC'] = EXPORT_VC.val
    guiTable['SELO'] = EXPORT_SELO.val
    guiTable['VG2SG'] = EXPORT_VG2SG.val
    guiTable['RECENTER'] = EXPORT_REC.val

    if not filename.lower().endswith('.ase'):
        filename += '.ase'

    write(filename)

    Window.WaitCursor(0)


if __name__ == '__main__':
    Window.FileSelector(write_ui, 'Export ASCII Scene',
                        sys.makename(ext='.ase'))
		test = AC3DExport(OBJS, file)
	except:
		file.close()
		raise
	else:
		file.close()
		endtime = bsys.time() - starttime
		REPORT_DATA['main'].append("Done. Saved to: %s" % filename)
		REPORT_DATA['main'].append("Data exported in %.3f seconds." % endtime)

	if VERBOSE: report_data()
	Blender.Window.WaitCursor(0)


# -- End of definitions

scn = Blender.Scene.GetCurrent()

if ONLY_SELECTED:
	OBJS = list(scn.objects.context)
else:
	OBJS = list(scn.objects)

if not OBJS:
	Blender.Draw.PupMenu('ERROR: no objects selected')
else:
	fname = bsys.makename(ext=".ac")
	if EXPORT_DIR:
		fname = bsys.join(EXPORT_DIR, bsys.basename(fname))
	FileSelector(fs_callback, "Export AC3D", fname)
Ejemplo n.º 4
0
    psaFile.close()

    Window.RedrawAll()

    print "PSA2Blender completed"


##End of def ImportPSK#########################


def fs_callback(filename):
    t = sys.time()
    import time
    import datetime
    print "====== IMPORTING UNREAL SKELETAL ANIMATION FORMAT========\r\n"

    ImportPSA(filename)

    print 'Import PSA Script finished in %.2f seconds' % (sys.time() - t)
    t = datetime.datetime.now()
    EpochSeconds = time.mktime(t.timetuple())
    print datetime.datetime.fromtimestamp(EpochSeconds)
    #textstring = 'Import Complete!'
    #Blender.Draw.PupStrInput("Name:", "untitled", 25)
    #Draw.PupMenu(textstring)


if __name__ == '__main__':
    Window.FileSelector(fs_callback, 'Import PSA File',
                        sys.makename(ext='.psa'))
Ejemplo n.º 5
0
		for frame in scene_frames:
			if EXPORT_ANIMATION: # Add frame to the filename.
				context_name[2] = '_%.6d' % frame
			
			Blender.Set('curframe', frame)
			if EXPORT_SEL_ONLY:
				export_objects = scn.objects.context
			else:   
				export_objects = scn.objects
			
			full_path= ''.join(context_name)
			
			# erm... bit of a problem here, this can overwrite files when exporting frames. not too bad.
			# EXPORT THE FILE.
			write(full_path, export_objects,\
			EXPORT_TRI, EXPORT_EDGES, EXPORT_NORMALS,\
			EXPORT_NORMALS_HQ, EXPORT_UV, EXPORT_MTL,\
			EXPORT_COPY_IMAGES, EXPORT_APPLY_MODIFIERS,\
			EXPORT_ROTX90, EXPORT_BLEN_OBS,\
			EXPORT_GROUP_BY_OB, EXPORT_GROUP_BY_MAT, EXPORT_MORPH_TARGET, EXPORT_ARMATURE)
		
		Blender.Set('curframe', orig_frame)
	
	# Restore old active scene.
	orig_scene.makeCurrent()
	Window.WaitCursor(0)


if __name__ == '__main__':
	Window.FileSelector(write_ui, 'Export Wavefront OBJ', sys.makename(ext='.obj'))
Ejemplo n.º 6
0
    
    pskFile.close()
    
    Window.RedrawAll()
    
    print "PSK2Blender completed"

##End of def ImportPSK#########################


def fs_callback(filename):
    t = sys.time() 
    import time
    import datetime
    print "====== IMPORTING UNREAL SKELETAL MESH FORMAT========\r\n"
        
    ImportPSK(filename)
        
    print 'Import PSK Script finished in %.2f seconds' % (sys.time()-t) 
    t = datetime.datetime.now()
    EpochSeconds = time.mktime(t.timetuple())
    print datetime.datetime.fromtimestamp(EpochSeconds)
    #textstring = 'Import Complete!'
    #Blender.Draw.PupStrInput("Name:", "untitled", 25)
    #Draw.PupMenu(textstring)

if __name__ == '__main__': 
    Window.FileSelector(fs_callback, 'Import PSK File', sys.makename(ext='.psk'))


	# Export all scenes.
	for scn in export_scenes:
		scn.makeCurrent() # If alredy current, this is not slow.
		context = scn.getRenderingContext()
		orig_frame = Blender.Get('curframe')
		
		# Export an animation?
		scene_frames = [orig_frame] # Dont export an animation.
		
		# Loop through all frames in the scene and export.
		for frame in scene_frames:
			
			Blender.Set('curframe', frame)
			export_objects = scn.objects.context
			
			full_path= ''.join(context_name)
			
			# erm... bit of a problem here, this can overwrite files when exporting frames. not too bad.
			# EXPORT THE FILE.
			write(full_path, export_objects)
		
		Blender.Set('curframe', orig_frame)
	
	# Restore old active scene.
	orig_scene.makeCurrent()
	Window.WaitCursor(0)


if __name__ == '__main__':
	Window.FileSelector(write_ui, 'Export EOL Armature', sys.makename(ext='.eolarm'))
Ejemplo n.º 8
0
            s += "{scene}\n"
            if OUTPUT_LANGUAGE == 'tikz':
                s += "global {language tikz}\n"

    f.write(s)
    f.close()


# Start of script -----------------------------------------------------

# Ensure that at leas one object is selected
if len(Blender.Object.GetSelected()) == 0:
    # no objects selected. Print error message and quit
    Blender.Draw.PupMenu('ERROR: Please select at least one mesh')
else:
    fname = bsys.makename(ext=".sk")
    retval = draw_GUI()

    # Set TikZ and PSTricks specific parameters
    if OUTPUT_LANGUAGE == 'tikz':
        FILL_STR = "fill"
        LINE_STR = "draw"
        OPACITY_STR = "fill opacity"
    else:
        FILL_STR = "fillcolor"
        LINE_STR = "linecolor"
        OPACITY_STR = "fill opacity"
    if retval:
        Blender.Window.FileSelector(write_objects, "Export SK", fname)
        pass
        #write_objects('D:/pycode/blendtools/sketchexporter/tests/basic.sk')
Ejemplo n.º 9
0
  if not OBJ:
    return

  # if any exist, grab the materials
  MAT = Blender.Material.Get()

  # output the header data
  do_header()

  # output the materials used by the selected objects.
  do_materiallibrary()

  # we punch out the models, that is, the meshes themselves
  do_models()


  # finally close our file
  FD.close()



# ---------------------------------------------------------------------------
# Lets trigger it off now
# Blender.Window.FileSelector(export_xsi, 'Export SoftImage XSI')

fname = bsys.makename(ext=".xsi")
if EXPORT_DIR <> '':
  fname = bsys.join(EXPORT_DIR, bsys.basename(fname))

Blender.Window.FileSelector(export_xsi, "Export SoftImage XSI", fname)
Ejemplo n.º 10
0
    for scn in export_scenes:
        scn.makeCurrent()  # If alredy current, this is not slow.
        context = scn.getRenderingContext()
        orig_frame = Blender.Get('curframe')

        # Export an animation?
        scene_frames = [orig_frame]  # Dont export an animation.

        # Loop through all frames in the scene and export.
        for frame in scene_frames:

            Blender.Set('curframe', frame)
            export_objects = scn.objects.context

            full_path = ''.join(context_name)

            # erm... bit of a problem here, this can overwrite files when exporting frames. not too bad.
            # EXPORT THE FILE.
            write(full_path, export_objects)

        Blender.Set('curframe', orig_frame)

    # Restore old active scene.
    orig_scene.makeCurrent()
    Window.WaitCursor(0)


if __name__ == '__main__':
    Window.FileSelector(write_ui, 'Export EOL Armature',
                        sys.makename(ext='.eolarm'))
Ejemplo n.º 11
0
            s += "\n"
            s += "{scene}\n"
            if OUTPUT_LANGUAGE == 'tikz':
                s += "global {language tikz}\n"

    f.write(s)
    f.close()

# Start of script -----------------------------------------------------

# Ensure that at leas one object is selected
if len(Blender.Object.GetSelected()) == 0:
    # no objects selected. Print error message and quit
    Blender.Draw.PupMenu('ERROR: Please select at least one mesh')
else:
    fname = bsys.makename(ext=".sk")
    retval = draw_GUI()

    # Set TikZ and PSTricks specific parameters
    if OUTPUT_LANGUAGE == 'tikz':
        FILL_STR = "fill"
        LINE_STR = "draw"
        OPACITY_STR = "fill opacity"
    else:
        FILL_STR = "fillcolor"
        LINE_STR = "linecolor"
        OPACITY_STR = "fill opacity"
    if retval:
        Blender.Window.FileSelector(write_objects, "Export SK", fname)
        pass
        #write_objects('D:/pycode/blendtools/sketchexporter/tests/basic.sk')
Ejemplo n.º 12
0
        # Export an animation?
        scene_frames = [orig_frame]  # Dont export an animation.

        # Loop through all frames in the scene and export.
        for frame in scene_frames:

            Blender.Set('curframe', frame)
            if EXPORT_SEL_ONLY:
                export_objects = scn.objects.context
            else:
                export_objects = scn.objects

            full_path = ''.join(context_name)

            # erm... bit of a problem here, this can overwrite files when exporting frames. not too bad.
            # EXPORT THE FILE.
            write(full_path, export_objects,\
            EXPORT_APPLY_MODIFIERS,\
            EXPORT_ROTX90)

        Blender.Set('curframe', orig_frame)

    # Restore old active scene.
    orig_scene.makeCurrent()
    Window.WaitCursor(0)


if __name__ == '__main__':
    Window.FileSelector(write_ui, 'Export EOL Mesh',
                        sys.makename(ext='.eolmesh'))
Ejemplo n.º 13
0
        file.write('object "%s" "%s"\n' % \
                   (sanitize(ob.name), \
                    sanitize_strip(get_image_filename(scn, me))))

    # Write all frames into one file
    scene_frames = xrange(1, max_frame + 1)
    print "Exporting '%s', %d frames:" % (filename, max_frame + 1)
    for frame in scene_frames:
        print "... frame %d" % frame
        file.write(('\n########################################' + \
                    '########################################\n' + \
                    'frame %d\n' + \
                    '########################################' + \
                    '########################################\n') % \
                    frame)
        Blender.Set('curframe', frame)
        write_frame(scn, file, objects)

    print "Done"
    file.close()

    Blender.Set('curframe', orig_frame)


################################################################################
# This is the entry point to the script
################################################################################
if __name__ == '__main__':
    Window.FileSelector(write, 'Export Plutocracy PLUM', \
                        sys.makename(ext='.plum'))
Ejemplo n.º 14
0
        test = ASCIISTLExport(OBJS, file)
    except:
        file.close()
        raise
    else:
        file.close()
        endtime = bsys.time() - starttime
        REPORT_DATA['main'].append("Done. Saved to: %s" % filename)
        REPORT_DATA['main'].append("Data exported in %.3f seconds." % endtime)

    if VERBOSE: report_data()
    Blender.Window.WaitCursor(0)


# -- End of definitions

scn = Blender.Scene.GetCurrent()

if ONLY_SELECTED:
    OBJS = list(scn.objects.context)
else:
    OBJS = list(scn.objects)

if not OBJS:
    Blender.Draw.PupMenu('ERROR: no objects selected')
else:
    fname = bsys.makename(ext=".stl")
    if EXPORT_DIR:
        fname = bsys.join(EXPORT_DIR, bsys.basename(fname))
    FileSelector(fs_callback, "Export ASCII STL", fname)
Ejemplo n.º 15
0
   EXPORT_SELO = Draw.Create(guiTable['SELO'])
   EXPORT_VG2SG = Draw.Create(guiTable['VG2SG'])
   EXPORT_REC = Draw.Create(guiTable['RECENTER'])

   # Get USER Options
   pup_block = [('Mesh Options...'),('Apply Modifiers', EXPORT_MOD, 'Use modified mesh data from each object.'),('Materials', EXPORT_MTL, 'Export Materials.'),('Face UV', EXPORT_UV, 'Export texface UV coords.'),('Vertex Colors', EXPORT_VC, 'Export vertex colors'),('Context...'),('Selection Only', EXPORT_SELO, 'Only export objects in visible selection, else export all mesh object.'),('Bonus...'),('VertGr. as SmoothGr.', EXPORT_VG2SG, 'Make SmoothGroups by VertGroups. See doc.'), ('Center Objects', EXPORT_REC, 'Center ALL objects to World-Grid-Origin-Center-Point-(0,0,0). ;)')]

   if not Draw.PupBlock('Export...', pup_block):
      return

   Window.WaitCursor(1)

   guiTable['MOD'] = EXPORT_MOD.val
   guiTable['MTL'] = EXPORT_MTL.val
   guiTable['UV'] = EXPORT_UV.val
   guiTable['VC'] = EXPORT_VC.val
   guiTable['SELO'] = EXPORT_SELO.val
   guiTable['VG2SG'] = EXPORT_VG2SG.val
   guiTable['RECENTER'] = EXPORT_REC.val

   if not filename.lower().endswith('.ase'):
      filename += '.ase'

   write(filename)

   Window.WaitCursor(0)


if __name__ == '__main__':
   Window.FileSelector(write_ui, 'Export ASCII Scene', sys.makename(ext='.ase'))
Ejemplo n.º 16
0
            if EXPORT_ANIMATION:  # Add frame to the filename.
                context_name[2] = '_%.6d' % frame

            Blender.Set('curframe', frame)
            if EXPORT_SEL_ONLY:
                export_objects = scn.objects.context
            else:
                export_objects = scn.objects

            full_path = ''.join(context_name)

            # erm... bit of a problem here, this can overwrite files when exporting frames. not too bad.
            # EXPORT THE FILE.
            write(full_path, export_objects,\
            EXPORT_TRI, EXPORT_EDGES, EXPORT_NORMALS,\
            EXPORT_NORMALS_HQ, EXPORT_UV, EXPORT_MTL,\
            EXPORT_COPY_IMAGES, EXPORT_APPLY_MODIFIERS,\
            EXPORT_ROTX90, EXPORT_BLEN_OBS,\
            EXPORT_GROUP_BY_OB, EXPORT_GROUP_BY_MAT, EXPORT_KEEP_VERT_ORDER)

        Blender.Set('curframe', orig_frame)

    # Restore old active scene.
    orig_scene.makeCurrent()
    Window.WaitCursor(0)


if __name__ == '__main__':
    Window.FileSelector(write_ui, 'Export Wavefront OBJ',
                        sys.makename(ext='.obj'))
Ejemplo n.º 17
0
                file.write('object "%s" "%s"\n' % \
                           (sanitize(ob.name), \
                            sanitize_strip(get_image_filename(scn, me))))

        # Write all frames into one file
        scene_frames = xrange(1, max_frame + 1)
        print "Exporting '%s', %d frames:" % (filename, max_frame + 1)
        for frame in scene_frames:
                print "... frame %d" % frame
                file.write(('\n########################################' + \
                            '########################################\n' + \
                            'frame %d\n' + \
                            '########################################' + \
                            '########################################\n') % \
                            frame);
                Blender.Set('curframe', frame)
                write_frame(scn, file, objects)

        print "Done"
        file.close()

        Blender.Set('curframe', orig_frame)

################################################################################
# This is the entry point to the script
################################################################################
if __name__ == '__main__':
        Window.FileSelector(write, 'Export Plutocracy PLUM', \
                            sys.makename(ext='.plum'))

Ejemplo n.º 18
0
  	# FILE WRITE
	
	#RG - dump psk file
	psk.PrintOut()
	file = open(psk_filename, "wb") 
	file.write(psk.dump())
	file.close() 
	print 'Successfully Exported File: ' + psk_filename

	#RG - dump psa file
	if not psa.IsEmpty():
		psa.PrintOut()
		file = open(psa_filename, "wb") 
		file.write(psa.dump())
		file.close() 
		print 'Successfully Exported File: ' + psa_filename
	else:
		print 'No Animations to Export'
	print 'My Export PSK/PSA Script finished in %.2f seconds' % (sys.time()-t) 
	t = datetime.datetime.now()
	EpochSeconds = time.mktime(t.timetuple())
	print datetime.datetime.fromtimestamp(EpochSeconds)
	textstring = 'Export Complete!'
	#Blender.Draw.PupStrInput("Name:", "untitled", 25)
	Draw.PupMenu(textstring)

if __name__ == '__main__': 
	Window.FileSelector(fs_callback, 'Export PSK/PSA File', sys.makename(ext='.psk'))
	#fs_callback('c:\\ChainBenderSideTurret.psk')
	
Ejemplo n.º 19
0
        # Loop through all frames in the scene and export.
        for frame in scene_frames:
            if EXPORT_ANIMATION: # Add frame to the filename.
                context_name[2] = '_%.6d' % frame
            
            Blender.Set('curframe', frame)
            if EXPORT_SEL_ONLY:
                export_objects = scn.objects.context
            else:   
                export_objects = scn.objects
            
            full_path= ''.join(context_name)
            
            # erm... bit of a problem here, this can overwrite files when exporting frames. not too bad.
            # EXPORT THE FILE.
            write(full_path, export_objects,\
            EXPORT_NORMALS_HQ, EXPORT_MTL,\
            EXPORT_COPY_IMAGES, EXPORT_APPLY_MODIFIERS,\
            EXPORT_BLEN_OBS,\
            EXPORT_GROUP_BY_OB)
        
        Blender.Set('curframe', orig_frame)
    
    # Restore old active scene.
    orig_scene.makeCurrent()
    Window.WaitCursor(0)


if __name__ == '__main__':
    Window.FileSelector(write_ui, 'Export OpenRacing WTF', sys.makename(ext='.wtf'))
Ejemplo n.º 20
0
            write_mtl(file, materialDict, globalMaterials)
            file.close()


def write_ui(filePath):

    Window.EditMode(0)
    slashPos = filePath.rfind('\\')
    directory = filePath[:slashPos + 1]
    filename = filePath[slashPos + 1:]

    if not filename.lower().endswith('.drk'):
        filename += '.drk'

    if not BPyMessages.Warning_SaveOver(filePath):
        return

    context = Scene.GetCurrent().getRenderingContext()
    orig_frame = Blender.Get('curframe')
    Blender.Set('curframe', context.startFrame())
    write(directory, filename, Scene.GetCurrent().objects)
    Blender.Set('curframe', orig_frame)

    # Restore old active scene.
    Window.WaitCursor(0)


if __name__ == '__main__':
    Window.FileSelector(write_ui, 'Export Darkness Drk',
                        sys.makename(ext='.drk'))
Ejemplo n.º 21
0
			if EXPORT_ANIMATION: # Add frame to the filename.
				context_name[2] = '_%.6d' % frame
			
			Blender.Set('curframe', frame)
			if EXPORT_SEL_ONLY:
				export_objects = scn.objects.context
			else:	
				export_objects = scn.objects
			
			full_path= ''.join(context_name)
			
			# erm... bit of a problem here, this can overwrite files when exporting frames. not too bad.
			# EXPORT THE FILE.
			write(full_path, export_objects,\
			EXPORT_TRI, EXPORT_EDGES, EXPORT_NORMALS,\
			EXPORT_NORMALS_HQ, EXPORT_UV, EXPORT_MTL,\
			EXPORT_COPY_IMAGES, EXPORT_APPLY_MODIFIERS,\
			EXPORT_ROTX90, EXPORT_BLEN_OBS,\
			EXPORT_GROUP_BY_OB, EXPORT_GROUP_BY_MAT, EXPORT_KEEP_VERT_ORDER,\
			EXPORT_POLYGROUPS, EXPORT_CURVE_AS_NURBS)
		
		Blender.Set('curframe', orig_frame)
	
	# Restore old active scene.
	orig_scene.makeCurrent()
	Window.WaitCursor(0)


if __name__ == '__main__':
	Window.FileSelector(write_ui, 'Export thee.js (slim)', sys.makename(ext='.obj'))
Ejemplo n.º 22
0
    pskFile.close()

    Window.RedrawAll()

    print "PSK2Blender completed"


##End of def ImportPSK#########################


def fs_callback(filename):
    t = sys.time()
    import time
    import datetime
    print "====== IMPORTING UNREAL SKELETAL MESH FORMAT========\r\n"

    ImportPSK(filename)

    print 'Import PSK Script finished in %.2f seconds' % (sys.time() - t)
    t = datetime.datetime.now()
    EpochSeconds = time.mktime(t.timetuple())
    print datetime.datetime.fromtimestamp(EpochSeconds)
    #textstring = 'Import Complete!'
    #Blender.Draw.PupStrInput("Name:", "untitled", 25)
    #Draw.PupMenu(textstring)


if __name__ == '__main__':
    Window.FileSelector(fs_callback, 'Import PSK File',
                        sys.makename(ext='.psk'))
Ejemplo n.º 23
0
		return

	ONLYSELECTED = PREF_ONLYSELECTED.val
	POLYLINES = PREF_POLYLINES.val
	ONLYFACES = PREF_ONLYFACES.val
	POLYFACES = PREF_POLYFACES.val
	FLATTEN = PREF_FLATTEN.val
	HIDDEN_MODE = PREF_HIDDEN_MODE.val
	SCALE_FACTOR = PREF_SCALE_FACTOR.val

	sce = Scene.GetCurrent()
	if ONLYSELECTED: sel_group = sce.objects.selected
	else: sel_group = sce.objects

	if sel_group: do_export(sel_group, filepath)
	else:
		print "Abort: selection was empty, no object to export!"
		Draw.PupMenu('DXF Exporter:   nothing exported!|empty selection!')
	# Timing the script is a good way to be aware on any speed hits when scripting



#-----------------------------------------------------
if __name__=='__main__':
	#main()
	if not copy:
		Draw.PupMenu('Error%t|This script requires a full python install')
	Window.FileSelector(dxf_export_ui, 'EXPORT DXF', sys.makename(ext='.dxf'))
	
	
	
Ejemplo n.º 24
0
    pup_block = [
        ('Selection Only', export_selection_only,
         'Only export objects in visible selection. Else export whole scene.'),
        ('Rotate +Z to +Y', export_rotate_z_to_y,
         'Rotate such that +Z axis (Blender up) becomes +Y (VRML up).'),
        ('Compress', export_compressed,
         'Generate a .wrz file (normal VRML compressed by gzip).')
    ]
    return Draw.PupBlock('Export VRML 97...', pup_block)


#########################################################
# main routine
#########################################################

load_from_registry()

# Note that show_popup must be done before Blender.Window.FileSelector,
# because export_compressed affects the suggested extension of resulting
# file.

if show_popup():
    save_to_registry()
    if export_compressed.val:
        extension = ".wrz"
        from gzip import *
    else:
        extension = ".wrl"
    Blender.Window.FileSelector(select_file, "Export VRML97", \
           sys.makename(ext=extension))
Ejemplo n.º 25
0
        try:
            f = file(filepath, "w")
            # write header to file
            f.write("%% Generated by tikz_export.py v %s \n" % (__version__))
            f.write(s)
            print "Code written to %s" % filepath
        finally:
            f.close()
        return
    else:
        success = copy_to_clipboard(s)
        if not success:
            print "Failed to copy code to the clipboard"
            print "Pywin32, xclip, cbcopy or pygtk required for clipboard support"
            Blender.Draw.PupMenu("ERROR: Failed to copy generated code to the clipboard")


# Start of script -----------------------------------------------------

# Ensure that at leas one object is selected
if len(Blender.Object.GetSelected()) == 0:
    # no objects selected. Print error message and quit
    Blender.Draw.PupMenu("ERROR: Please select at least one curve")
else:
    fname = bsys.makename(ext=".tex")
    retval = draw_GUI()
    if retval and not CLIPBOARD_OUTPUT:
        Blender.Window.FileSelector(write_objects, "Export TikZ", fname)
    write_objects(fname)
    print "tikz_export ended ..."
Ejemplo n.º 26
0
		test = AC3DExport(OBJS, file)
	except:
		file.close()
		raise
	else:
		file.close()
		endtime = bsys.time() - starttime
		REPORT_DATA['main'].append("Done. Saved to: %s" % filename)
		REPORT_DATA['main'].append("Data exported in %.3f seconds." % endtime)

	if VERBOSE: report_data()
	Blender.Window.WaitCursor(0)


# -- End of definitions

scn = Blender.Scene.GetCurrent()

if ONLY_SELECTED:
	OBJS = list(scn.objects.context)
else:
	OBJS = list(scn.objects)

if not OBJS:
	Blender.Draw.PupMenu('ERROR: no objects selected')
else:
	fname = bsys.makename(ext=".ac")
	if EXPORT_DIR:
		fname = bsys.join(EXPORT_DIR, bsys.basename(fname))
	FileSelector(fs_callback, "Export AC3D", fname)
Ejemplo n.º 27
0
			export_compressed.val = d['compressed']
		except: save_to_registry() # If data is not valid, rewrite it.

def show_popup():
	pup_block = [
		('Selection Only', export_selection_only, 'Only export objects in visible selection. Else export whole scene.'),
		('Rotate +Z to +Y', export_rotate_z_to_y, 'Rotate such that +Z axis (Blender up) becomes +Y (VRML up).'),
		('Compress', export_compressed, 'Generate a .wrz file (normal VRML compressed by gzip).')
		]
	return Draw.PupBlock('Export VRML 97...', pup_block) 

#########################################################
# main routine
#########################################################

load_from_registry()

# Note that show_popup must be done before Blender.Window.FileSelector,
# because export_compressed affects the suggested extension of resulting
# file.

if show_popup():
	save_to_registry()
	if export_compressed.val:
		extension=".wrz"
		from gzip import *
	else:
		extension=".wrl"
	Blender.Window.FileSelector(select_file, "Export VRML97", \
								sys.makename(ext=extension))
Ejemplo n.º 28
0
        for frame in scene_frames:
            if EXPORT_ANIMATION:  # Add frame to the filename.
                context_name[2] = '_%.6d' % frame

            Blender.Set('curframe', frame)
            if EXPORT_SEL_ONLY:
                export_objects = scn.objects.context
            else:
                export_objects = scn.objects

            full_path = ''.join(context_name)

            # erm... bit of a problem here, this can overwrite files when exporting frames. not too bad.
            # EXPORT THE FILE.
            write(full_path, export_objects,\
            EXPORT_NORMALS_HQ, EXPORT_MTL,\
            EXPORT_COPY_IMAGES, EXPORT_APPLY_MODIFIERS,\
            EXPORT_BLEN_OBS,\
            EXPORT_GROUP_BY_OB)

        Blender.Set('curframe', orig_frame)

    # Restore old active scene.
    orig_scene.makeCurrent()
    Window.WaitCursor(0)


if __name__ == '__main__':
    Window.FileSelector(write_ui, 'Export OpenRacing WTF',
                        sys.makename(ext='.wtf'))
Ejemplo n.º 29
0
		
		# Export an animation?
		scene_frames = [orig_frame] # Dont export an animation.
		
		# Loop through all frames in the scene and export.
		for frame in scene_frames:
			
			Blender.Set('curframe', frame)
			if EXPORT_SEL_ONLY:
				export_objects = scn.objects.context
			else:   
				export_objects = scn.objects
			
			full_path= ''.join(context_name)
			
			# erm... bit of a problem here, this can overwrite files when exporting frames. not too bad.
			# EXPORT THE FILE.
			write(full_path, export_objects,\
			EXPORT_APPLY_MODIFIERS,\
			EXPORT_ROTX90)
		
		Blender.Set('curframe', orig_frame)
	
	# Restore old active scene.
	orig_scene.makeCurrent()
	Window.WaitCursor(0)


if __name__ == '__main__':
	Window.FileSelector(write_ui, 'Export EOL Mesh', sys.makename(ext='.eolmesh'))