diff options
author | Kalle-Samuli Riihikoski <haikalle@gmail.com> | 2018-07-21 19:45:35 +0300 |
---|---|---|
committer | Kalle-Samuli Riihikoski <haikalle@gmail.com> | 2018-07-21 19:45:35 +0300 |
commit | f2c6fb5ac6eeb9842866bcf61239582fa5b081a1 (patch) | |
tree | 983de914200b99880e36aff2ac7154a3bb0fdb03 | |
parent | 0c78badd5551098787bfd950cdc29d669452b846 (diff) |
remove print lines
-rw-r--r-- | io_coat3D/__init__.py | 20 | ||||
-rw-r--r-- | io_coat3D/tex.py | 308 |
2 files changed, 0 insertions, 328 deletions
diff --git a/io_coat3D/__init__.py b/io_coat3D/__init__.py index a2867a24..9af86a25 100644 --- a/io_coat3D/__init__.py +++ b/io_coat3D/__init__.py @@ -134,7 +134,6 @@ def set_working_folders(): else: folder_objects = os.path.dirname(bpy.data.filepath) + os.sep + '3DCApplink' + os.sep + 'Objects' folder_textures = os.path.dirname(bpy.data.filepath) + os.sep + '3DCApplink' + os.sep + 'Textures' + os.sep - print('mitas sanoo', folder_objects) if(not(os.path.isdir(folder_objects))): os.makedirs(folder_objects) if(not(os.path.isdir(folder_textures))): @@ -335,20 +334,14 @@ class SCENE_OT_import(bpy.types.Operator): obj_names = objekti.coat3D.applink_group - print('obj_names:',obj_names) obj_list = obj_names.split(':::') - print('obj_list:',obj_list) applinks = [] mat_list = [] for app_obj in obj_list: - print('sisalla app_obj') pnimi = app_obj.lstrip() - print('pnimi', pnimi) listed = re.split(r'[:::]', pnimi) - print('listed: ',listed) for tobj in bpy.context.scene.collection.all_objects: if(tobj.name == app_obj): - print('tobj:',tobj) applinks.append(tobj) if(obj_coat.objecttime != str(os.path.getmtime(obj_coat.applink_address))): materials_old = bpy.data.materials.keys() @@ -364,10 +357,8 @@ class SCENE_OT_import(bpy.types.Operator): #bpy.data.materials.remove(bpy.data.materials[-1]) counter = 1 del_list = [] - print('applinkki lista:', applinks) for obe in applinks: - print('kuka etsii:', obe) counter += 1 obe.coat3D.applink_skip = 'True' if(obe.coat3D.applink_address == objekti.coat3D.applink_address and obe.type == 'MESH'): @@ -385,18 +376,14 @@ class SCENE_OT_import(bpy.types.Operator): else: find_name = obe.name + '.001' for allobjekti in bpy.context.scene.collection.all_objects: - print('allobject', allobjekti) - print('find_name', find_name) counter = 0 if(allobjekti.name == find_name): - print('löyty:',allobjekti) obj_proxy = allobjekti del_list.append(allobjekti) break bpy.ops.object.select_all(action='DESELECT') - print('ja mitahan tassa', obj_proxy) obj_proxy.select_set('SELECT') bpy.ops.object.select_all(action='TOGGLE') @@ -422,11 +409,9 @@ class SCENE_OT_import(bpy.types.Operator): objekti.select_set('SELECT') if (obe.coat3D.applink_firsttime == True): - print('ensimmainen', obe) obe.scale = (1, 1, 1) obe.rotation_euler = (0,0,0) obe.coat3D.applink_firsttime = False - print('toimiiko', objekti) bpy.ops.object.origin_set(type='GEOMETRY_ORIGIN') proxy_index -= 1 obe.material_slots[0].material = act_mat @@ -437,9 +422,7 @@ class SCENE_OT_import(bpy.types.Operator): bpy.ops.object.select_all(action='DESELECT') - print('tuholista', del_list) for deleting in del_list: - print('tuhotaan: ', deleting) deleting.select_set(action='SELECT') bpy.ops.object.delete() mat_index = 0 @@ -497,17 +480,14 @@ class SCENE_OT_import(bpy.types.Operator): if(new_obj.coat3D.applink_old == False): nimi += new_obj.name + ':::' - print('uusi objekti: ', new_obj) new_obj.select_set('SELECT') #bpy.ops.object.origin_set(type='GEOMETRY_ORIGIN') new_obj.rotation_euler = (0, 0, 0) new_obj.select_set('DESELECT') new_obj.coat3D.applink_address = new_applink_address - print('addressi on:', new_applink_address) splittext = ntpath.basename(new_applink_address) new_obj.coat3D.applink_name = splittext.split('.')[0] new_obj.coat3D.applink_export = True - print('nimi on:', new_obj.coat3D.applink_name) for material in bpy.data.materials: if(new_obj.name == material.name): new_obj.material_slots[0].material = material diff --git a/io_coat3D/tex.py b/io_coat3D/tex.py index 4c516def..5df312ea 100644 --- a/io_coat3D/tex.py +++ b/io_coat3D/tex.py @@ -157,313 +157,5 @@ def createnodes(objekti,texcoat): #luo nodes palikat ja linkittaa tekstuurit nii def matlab(mat_list, objekti, scene,is_new): #checkmaterial(mat_list, objekti) readtexturefolder(objekti,is_new) - - - """ - print('tassa tietoo') - print(mat_list,objekti,scene,export) - - coat3D = bpy.context.scene.coat3D - coa = objekti.coat3D - print(coat3D,coa) - - if(bpy.context.scene.render.engine == 'VRAY_RENDER' or bpy.context.scene.render.engine == 'VRAY_RENDER_PREVIEW'): - vray = True - else: - vray = False - - take_color = 0 - take_spec = 0 - take_normal = 0 - take_disp = 0 - - bring_color = 1 - bring_spec = 1 - bring_normal = 1 - bring_disp = 1 - texcoat = {} - texcoat['color'] = [] - texcoat['specular'] = [] - texcoat['nmap'] = [] - texcoat['disp'] = [] - texu = [] - - if(export): - objekti.coat3D.objpath = export - nimi = os.path.split(export)[1] - osoite = os.path.dirname(export) + os.sep #pitaa ehka muuttaa - for mate in objekti.material_slots: - for tex_slot in mate.material.texture_slots: - if(hasattr(tex_slot,'texture')): - if(tex_slot.texture.type == 'IMAGE'): - if tex_slot.texture.image is not None: - tex_slot.texture.image.reload() - else: - if(os.sys.platform == 'win32'): - osoite = os.path.expanduser("~") + os.sep + 'Documents' + os.sep + '3DC2Blender' + os.sep + 'Textures' + os.sep - else: - osoite = os.path.expanduser("~") + os.sep + '3DC2Blender' + os.sep + 'Textures' + os.sep - ki = os.path.split(coa.applink_name)[1] - ko = os.path.splitext(ki)[0] - just_nimi = ko + '_' - just_nimi_len = len(just_nimi) - print('terve:' + coa.applink_name) - - if(len(objekti.material_slots) != 0): - for obj_tex in objekti.active_material.texture_slots: - if(hasattr(obj_tex,'texture')): - if(obj_tex.texture.type == 'IMAGE'): - if(obj_tex.use_map_color_diffuse): - bring_color = 0; - if(obj_tex.use_map_specular): - bring_spec = 0; - if(obj_tex.use_map_normal): - bring_normal = 0; - if(obj_tex.use_map_displacement): - bring_disp = 0; - - files = os.listdir(osoite) - for i in files: - tui = i[:just_nimi_len] - if(tui == just_nimi): - texu.append(i) - - for yy in texu: - minimi = (yy.rfind('_'))+1 - maksimi = (yy.rfind('.')) - tex_name = yy[minimi:maksimi] - koko = '' - koko += osoite - koko += yy - texcoat[tex_name].append(koko) - - if((texcoat['color'] or texcoat['nmap'] or texcoat['disp'] or texcoat['specular']) and (len(objekti.material_slots)) == 0): - materials_old = bpy.data.materials.keys() - bpy.ops.material.new() - materials_new = bpy.data.materials.keys() - new_ma = list(set(materials_new).difference(set(materials_old))) - new_mat = new_ma[0] - ki = bpy.data.materials[new_mat] - objekti.data.materials.append(ki) - - if(bring_color == 1 and texcoat['color']): - index = find_index(objekti) - tex = bpy.ops.Texture - objekti.active_material.texture_slots.create(index) - total_mat = len(objekti.active_material.texture_slots.items()) - useold = '' - - for seekco in bpy.data.textures: - if((seekco.name[:5] == 'Color') and (seekco.users_material == ())): - useold = seekco - - - if(useold == ''): - - textures_old = bpy.data.textures.keys() - bpy.data.textures.new('Color',type='IMAGE') - textures_new = bpy.data.textures.keys() - name_te = list(set(textures_new).difference(set(textures_old))) - name_tex = name_te[0] - - bpy.ops.image.new(name=name_tex) - bpy.data.images[name_tex].filepath = texcoat['color'][0] - bpy.data.images[name_tex].source = 'FILE' - - objekti.active_material.texture_slots[index].texture = bpy.data.textures[name_tex] - objekti.active_material.texture_slots[index].texture.image = bpy.data.images[name_tex] - - if(objekti.data.uv_textures.active): - objekti.active_material.texture_slots[index].texture_coords = 'UV' - objekti.active_material.texture_slots[index].uv_layer = objekti.data.uv_textures.active.name - - objekti.active_material.texture_slots[index].texture.image.reload() - - - elif(useold != ''): - - objekti.active_material.texture_slots[index].texture = useold - objekti.active_material.texture_slots[index].texture.image = bpy.data.images[useold.name] - objekti.active_material.texture_slots[index].texture.image.filepath = texcoat['color'][0] - if(objekti.data.uv_textures.active): - objekti.active_material.texture_slots[index].texture_coords = 'UV' - objekti.active_material.texture_slots[index].uv_layer = objekti.data.uv_textures.active.name - - - if(bring_normal == 1 and texcoat['nmap']): - index = find_index(objekti) - tex = bpy.ops.Texture - objekti.active_material.texture_slots.create(index) - total_mat = len(objekti.active_material.texture_slots.items()) - useold = '' - - for seekco in bpy.data.textures: - if((seekco.name[:6] == 'Normal') and (seekco.users_material == ())): - useold = seekco - - if(useold == ''): - - textures_old = bpy.data.textures.keys() - bpy.data.textures.new('Normal',type='IMAGE') - textures_new = bpy.data.textures.keys() - name_te = list(set(textures_new).difference(set(textures_old))) - name_tex = name_te[0] - - bpy.ops.image.new(name=name_tex) - bpy.data.images[name_tex].filepath = texcoat['nmap'][0] - bpy.data.images[name_tex].source = 'FILE' - - objekti.active_material.texture_slots[index].texture = bpy.data.textures[name_tex] - objekti.active_material.texture_slots[index].texture.image = bpy.data.images[name_tex] - - if(objekti.data.uv_textures.active): - objekti.active_material.texture_slots[index].texture_coords = 'UV' - objekti.active_material.texture_slots[index].uv_layer = objekti.data.uv_textures.active.name - - objekti.active_material.texture_slots[index].use_map_color_diffuse = False - objekti.active_material.texture_slots[index].use_map_normal = True - - objekti.active_material.texture_slots[index].texture.image.reload() - if(vray): - bpy.data.textures[name_tex].vray_slot.BRDFBump.map_type = 'TANGENT' - - else: - bpy.data.textures[name_tex].use_normal_map = True - objekti.active_material.texture_slots[index].normal_map_space = 'TANGENT' - objekti.active_material.texture_slots[index].normal_factor = 1 - - - - elif(useold != ''): - - objekti.active_material.texture_slots[index].texture = useold - objekti.active_material.texture_slots[index].texture.image = bpy.data.images[useold.name] - objekti.active_material.texture_slots[index].texture.image.filepath = texcoat['nmap'][0] - if(objekti.data.uv_textures.active): - objekti.active_material.texture_slots[index].texture_coords = 'UV' - objekti.active_material.texture_slots[index].uv_layer = objekti.data.uv_textures.active.name - objekti.active_material.texture_slots[index].use_map_color_diffuse = False - objekti.active_material.texture_slots[index].use_map_normal = True - objekti.active_material.texture_slots[index].normal_factor = 1 - - - if(bring_spec == 1 and texcoat['specular']): - - index = find_index(objekti) - - objekti.active_material.texture_slots.create(index) - useold = '' - - for seekco in bpy.data.textures: - if((seekco.name[:8] == 'Specular') and (seekco.users_material == ())): - useold = seekco - - if(useold == ''): - - textures_old = bpy.data.textures.keys() - bpy.data.textures.new('Specular',type='IMAGE') - textures_new = bpy.data.textures.keys() - name_te = list(set(textures_new).difference(set(textures_old))) - name_tex = name_te[0] - - bpy.ops.image.new(name=name_tex) - bpy.data.images[name_tex].filepath = texcoat['specular'][0] - bpy.data.images[name_tex].source = 'FILE' - - objekti.active_material.texture_slots[index].texture = bpy.data.textures[name_tex] - objekti.active_material.texture_slots[index].texture.image = bpy.data.images[name_tex] - - if(objekti.data.uv_textures.active): - objekti.active_material.texture_slots[index].texture_coords = 'UV' - objekti.active_material.texture_slots[index].uv_layer = objekti.data.uv_textures.active.name - - objekti.active_material.texture_slots[index].use_map_color_diffuse = False - objekti.active_material.texture_slots[index].use_map_specular = True - - objekti.active_material.texture_slots[index].texture.image.reload() - - - elif(useold != ''): - - objekti.active_material.texture_slots[index].texture = useold - objekti.active_material.texture_slots[index].texture.image = bpy.data.images[useold.name] - objekti.active_material.texture_slots[index].texture.image.filepath = texcoat['specular'][0] - if(objekti.data.uv_textures.active): - objekti.active_material.texture_slots[index].texture_coords = 'UV' - objekti.active_material.texture_slots[index].uv_layer = objekti.data.uv_textures.active.name - objekti.active_material.texture_slots[index].use_map_color_diffuse = False - objekti.active_material.texture_slots[index].use_map_specular = True - - if(bring_disp == 1 and texcoat['disp']): - - index = find_index(objekti) - - - objekti.active_material.texture_slots.create(index) - useold = '' - - for seekco in bpy.data.textures: - if((seekco.name[:12] == 'Displacement') and (seekco.users_material == ())): - useold = seekco - - if useold == "": - - textures_old = bpy.data.textures.keys() - bpy.data.textures.new('Displacement',type='IMAGE') - textures_new = bpy.data.textures.keys() - name_te = list(set(textures_new).difference(set(textures_old))) - name_tex = name_te[0] - - bpy.ops.image.new(name=name_tex) - bpy.data.images[name_tex].filepath = texcoat['disp'][0] - bpy.data.images[name_tex].source = 'FILE' - - objekti.active_material.texture_slots[index].texture = bpy.data.textures[name_tex] - objekti.active_material.texture_slots[index].texture.image = bpy.data.images[name_tex] - - if(objekti.data.uv_textures.active): - objekti.active_material.texture_slots[index].texture_coords = 'UV' - objekti.active_material.texture_slots[index].uv_layer = objekti.data.uv_textures.active.name - - objekti.active_material.texture_slots[index].use_map_color_diffuse = False - objekti.active_material.texture_slots[index].use_map_displacement = True - - objekti.active_material.texture_slots[index].texture.image.reload() - - - elif(useold != ''): - - objekti.active_material.texture_slots[index].texture = useold - objekti.active_material.texture_slots[index].texture.image = bpy.data.images[useold.name] - objekti.active_material.texture_slots[index].texture.image.filepath = texcoat['disp'][0] - if(objekti.data.uv_textures.active): - objekti.active_material.texture_slots[index].texture_coords = 'UV' - objekti.active_material.texture_slots[index].uv_layer = objekti.data.uv_textures.active.name - objekti.active_material.texture_slots[index].use_map_color_diffuse = False - objekti.active_material.texture_slots[index].use_map_displacement = True - - if(vray): - objekti.active_material.texture_slots[index].texture.use_interpolation = False - objekti.active_material.texture_slots[index].displacement_factor = 0.05 - - - else: - disp_modi = '' - for seek_modi in objekti.modifiers: - if(seek_modi.type == 'DISPLACE'): - disp_modi = seek_modi - break - if(disp_modi): - disp_modi.texture = objekti.active_material.texture_slots[index].texture - if(objekti.data.uv_textures.active): - disp_modi.texture_coords = 'UV' - disp_modi.uv_layer = objekti.data.uv_textures.active.name - else: - objekti.modifiers.new('Displace',type='DISPLACE') - objekti.modifiers['Displace'].texture = objekti.active_material.texture_slots[index].texture - if(objekti.data.uv_textures.active): - objekti.modifiers['Displace'].texture_coords = 'UV' - objekti.modifiers['Displace'].uv_layer = objekti.data.uv_textures.active.name - """ return('FINISHED') |