def write_materials(world_dir): matfile = os.path.join(world_dir,'materials.mtl') matstring = sio() matstring.write('\n') write_default_materials_mtl(matstring) matstring.write('\n') with open(matfile,'w') as h: h.write(matstring.getvalue()) for dm in def_mats: shutil.copy(db.resource_path(dm.dtexture),world_dir) print('new materials file',matfile)
def write_materials(world_dir): matfile = os.path.join(world_dir, 'materials.mtl') matstring = sio() matstring.write('\n') write_default_materials_mtl(matstring) matstring.write('\n') with open(matfile, 'w') as h: h.write(matstring.getvalue()) for dm in def_mats: shutil.copy(db.resource_path(dm.dtexture), world_dir) print('new materials file', matfile)
def material_image(name, texture): mat = bpy.data.materials.new(name) imgpath = db.resource_path(texture) tex = bpy.data.textures.new(name, type='IMAGE') tex.image = bpy.data.images.load(imgpath) tex.use_alpha = True #mat.use_shadeless = True mtex = mat.texture_slots.add() mtex.texture = tex mtex.texture_coords = 'UV' mtex.use_map_color_diffuse = True return mat
def material_image(name,texture): mat = bpy.data.materials.new(name) imgpath = db.resource_path(texture) tex = bpy.data.textures.new(name,type = 'IMAGE') tex.image = bpy.data.images.load(imgpath) tex.use_alpha = True #mat.use_shadeless = True mtex = mat.texture_slots.add() mtex.texture = tex mtex.texture_coords = 'UV' mtex.use_map_color_diffuse = True return mat
def _write_obj(self,msio): msio.write('\nnewmtl ') msio.write(self.name) msio.write('\n') msio.write('Ka 1.000 1.000 1.000\n') msio.write('Kd 1.000 1.000 1.000\n') msio.write('Ks 0.000 0.000 0.000\n') msio.write('d 1.0\n') msio.write('illum 2\n') dtexture = db.resource_path(self.dtexture) msio.write('map_Kd '+dtexture+'\n') msio.write('\n')
def _standards(self,**st): if 'title' in st:wt = st['title'] else:wt = 'mwindow' if 'geometry' in st:geo = st['geometry'] else: x,y = convert_pixel_space(300,300) x_size,y_size = convert_pixel_space(512,512) geo = (x,y,x_size,y_size) gearicon = QtGui.QIcon(mb.resource_path('gear.png')) self.setWindowIcon(gearicon) self.setWindowTitle(wt) self.setGeometry(*geo)
def _standards(self, **st): if 'title' in st: wt = st['title'] else: wt = 'mwindow' if 'geometry' in st: geo = st['geometry'] else: x, y = convert_pixel_space(300, 300) x_size, y_size = convert_pixel_space(512, 512) geo = (x, y, x_size, y_size) gearicon = QtGui.QIcon(mb.resource_path('gear.png')) self.setWindowIcon(gearicon) self.setWindowTitle(wt) self.setGeometry(*geo)
import dilap.core.base as db import os obj_world_dir = os.getcwd() obj_texture_dir = os.getcwd() osmdata = db.resource_path('richmond_virginia.osm') #osmdata = db.resource_path('san-jose_california.osm') #osmdata = db.resource_path('sioux-city_iowa.osm') #osmdata = db.resource_path('new-york_new-york.osm') info = { 'exporter': 'obj', 'contentdir': obj_world_dir, 'contenttexturedir': obj_texture_dir, 'osmdata': osmdata, }
import dilap.core.base as db import os obj_world_dir = os.getcwd() obj_texture_dir = os.getcwd() osmdata = db.resource_path('richmond_virginia.osm') #osmdata = db.resource_path('san-jose_california.osm') #osmdata = db.resource_path('sioux-city_iowa.osm') #osmdata = db.resource_path('new-york_new-york.osm') info = { 'exporter':'obj', 'contentdir':obj_world_dir, 'contenttexturedir':obj_texture_dir, 'osmdata':osmdata, }