From 919541ffbeb34af259f2950c785d9cb7cc392f33 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 5 Aug 2020 11:38:23 +1000 Subject: Cleanup: trailing space --- io_coat3D/__init__.py | 58 +++++++++++++++++++++++++-------------------------- io_coat3D/tex.py | 30 +++++++++++++------------- io_coat3D/texVR.py | 24 ++++++++++----------- 3 files changed, 56 insertions(+), 56 deletions(-) (limited to 'io_coat3D') diff --git a/io_coat3D/__init__.py b/io_coat3D/__init__.py index 5d74a960..77318c74 100644 --- a/io_coat3D/__init__.py +++ b/io_coat3D/__init__.py @@ -139,7 +139,7 @@ def set_exchange_folder(): file.write("%s"%(coat3D.exchangedir)) file.close() exchange = coat3D.exchangedir - + else: exchange = source @@ -292,10 +292,10 @@ def updatemesh(objekti, proxy, texturelist): if(udim_textures): udim = proxy.data.uv_layers[index].name udim_index = int(udim[2:]) - 1 - + objekti.data.uv_layers[0].data[indi].uv[0] = proxy.data.uv_layers[index].data[indi].uv[0] objekti.data.uv_layers[0].data[indi].uv[1] = proxy.data.uv_layers[index].data[indi].uv[1] - + index = index + 1 # Mesh Copy @@ -312,11 +312,11 @@ class SCENE_OT_getback(bpy.types.Operator): bl_options = {'UNDO'} def invoke(self, context, event): - + global global_exchange_folder global initial_settings path_ex = '' - + if(initial_settings): global_exchange_folder = set_exchange_folder() initial_settings = False @@ -326,29 +326,29 @@ class SCENE_OT_getback(bpy.types.Operator): BlenderFolder = Blender_folder ExportFolder = Export_folder - + Blender_folder += ('%sexport.txt' % (os.sep)) Export_folder += ('%sexport.txt' % (os.sep)) - + if (bpy.app.background == False): if os.path.isfile(Export_folder): print('BLENDER -> 3DC -> BLENDER WORKFLLOW') - DeleteExtra3DC() + DeleteExtra3DC() workflow1(ExportFolder) removeFile(Export_folder) - removeFile(Blender_folder) - - - + removeFile(Blender_folder) + + + elif os.path.isfile(Blender_folder): print('3DC -> BLENDER WORKFLLOW') - DeleteExtra3DC() + DeleteExtra3DC() workflow2(BlenderFolder) removeFile(Blender_folder) - - + + return {'FINISHED'} @@ -576,7 +576,7 @@ class SCENE_OT_export(bpy.types.Operator): def invoke(self, context, event): bpy.ops.export_applink.pilgway_3d_coat() - + return {'FINISHED'} def execute(self, context): @@ -823,12 +823,12 @@ class SCENE_OT_export(bpy.types.Operator): if(node.name.startswith('3DC_') == True): material.material.node_tree.nodes.remove(node) - + for ind, mat_list in enumerate(mod_mat_list): if(mat_list == '__' + objekti.name): for ind, mat in enumerate(mod_mat_list[mat_list]): objekti.material_slots[mod_mat_list[mat_list][ind][0]].material = mod_mat_list[mat_list][ind][1] - + bpy.context.scene.render.engine = active_render return {'FINISHED'} @@ -855,7 +855,7 @@ def DeleteExtra3DC(): bpy.data.images.remove(del_img) bpy.data.materials.remove(material) - + image_del_list = [] for image in bpy.data.images: if (image.name.startswith('3DC')): @@ -934,7 +934,7 @@ def new_ref_function(new_applink_address, nimi): def blender_3DC_blender(texturelist): - + coat3D = bpy.context.scene.coat3D old_materials = bpy.data.materials.keys() @@ -1086,7 +1086,7 @@ def blender_3DC_blender(texturelist): #delete_materials_from_end(keep_materials_count, obj_proxy) - + updatemesh(objekti,obj_proxy, texturelist) bpy.context.view_layer.objects.active = objekti @@ -1213,7 +1213,7 @@ def blender_3DC(texturelist, new_applink_address): old_materials = bpy.data.materials.keys() old_objects = bpy.data.objects.keys() - + bpy.ops.import_scene.fbx(filepath=new_applink_address, global_scale = 1, axis_forward='-Z', axis_up='Y') new_materials = bpy.data.materials.keys() @@ -1288,7 +1288,7 @@ def blender_3DC(texturelist, new_applink_address): os.remove(Blender_export) if (os.path.isfile(Blender_folder2)): os.remove(Blender_folder2) - + for material in bpy.data.materials: if material.use_nodes == True: for node in material.node_tree.nodes: @@ -1309,9 +1309,9 @@ def workflow1(ExportFolder): for image in bpy.data.images: if(image.filepath == texturepath[3] and image.users == 0): bpy.data.images.remove(image) - + path3b_now = coat3D.exchangedir - + path3b_now += ('last_saved_3b_file.txt') new_applink_address = 'False' new_object = False @@ -1335,7 +1335,7 @@ def workflow1(ExportFolder): new_ref_object = True nimi = scene_objects.name - + exportfile = coat3D.exchangedir @@ -1368,9 +1368,9 @@ def workflow2(BlenderFolder): kokeilu = coat3D.exchangedir Blender_export = os.path.join(kokeilu, 'Blender') - + path3b_now = coat3D.exchangedir - + path3b_now += ('last_saved_3b_file.txt') Blender_export += ('%sexport.txt'%(os.sep)) new_applink_address = 'False' @@ -2058,7 +2058,7 @@ def register(): bpy.types.Object.coat3D = PointerProperty(type=ObjectCoat3D) bpy.types.Scene.coat3D = PointerProperty(type=SceneCoat3D) bpy.types.Mesh.coat3D = PointerProperty(type=MeshCoat3D) - bpy.types.Material.coat3D = PointerProperty(type=MaterialCoat3D) + bpy.types.Material.coat3D = PointerProperty(type=MaterialCoat3D) kc = bpy.context.window_manager.keyconfigs.addon diff --git a/io_coat3D/tex.py b/io_coat3D/tex.py index 3a48ab8f..21fa92b3 100644 --- a/io_coat3D/tex.py +++ b/io_coat3D/tex.py @@ -128,22 +128,22 @@ def updatetextures(objekti): # Update 3DC textures def testi(objekti, texture_info, index_mat_name, uv_MODE_mat, mat_index): if uv_MODE_mat == 'UV': - + uv_set_founded = False for uvset in objekti.data.uv_layers: - + if(uvset.name == texture_info): uv_set_founded = True - + break - + if(uv_set_founded): for uv_poly in objekti.data.uv_layers[texture_info].id_data.polygons: if(mat_index == uv_poly.material_index): return True else: return False - + elif uv_MODE_mat == 'MAT': return (texture_info == index_mat_name) @@ -168,17 +168,17 @@ def readtexturefolder(objekti, mat_list, texturelist, is_new, udim_textures): #r if(udim_textures == False): for slot_index, texture_info in enumerate(texturelist): - uv_MODE_mat = 'MAT' + uv_MODE_mat = 'MAT' for index, layer in enumerate(objekti.data.uv_layers): if(layer.name == texturelist[slot_index][0]): uv_MODE_mat = 'UV' break - + if(testi(objekti, texturelist[slot_index][0], index_mat.name, uv_MODE_mat, ind)) : if texture_info[2] == 'color' or texture_info[2] == 'diffuse': if(index_mat.material.coat3D_diffuse): - + texcoat['color'].append(texture_info[3]) create_nodes = True else: @@ -241,7 +241,7 @@ def readtexturefolder(objekti, mat_list, texturelist, is_new, udim_textures): #r os.remove(texture_info[3]) create_group_node = True - + else: for texture_info in texturelist: @@ -516,21 +516,21 @@ def CreateTextureLine(type, act_material, main_mat, texcoat, coat3D, notegroup, load_image = True for image in bpy.data.images: - + if(texcoat[type['name']][0] == image.filepath): load_image = False node.image = image - + break if (load_image): print('load_image', texcoat[type['name']][0]) - + node.image = bpy.data.images.load(texcoat[type['name']][0]) if(udim_textures): node.image.source = 'TILED' - + if node.image and type['colorspace'] == 'noncolor': node.image.colorspace_settings.is_data = True @@ -589,7 +589,7 @@ def CreateTextureLine(type, act_material, main_mat, texcoat, coat3D, notegroup, if(material.name == '3DC_Emission'): main_material.links.new(applink_tree.outputs[type['input']], material.inputs[0]) break - + uv_node.location = node.location uv_node.location[0] -= 300 uv_node.location[1] -= 200 @@ -688,7 +688,7 @@ def matlab(objekti,mat_list,texturelist,is_new): ''' Check if bind textures with UVs or Materials ''' if(texturelist != []): - + udim_textures = False if texturelist[0][0].startswith('100') and len(texturelist[0][0]) == 4: udim_textures = True diff --git a/io_coat3D/texVR.py b/io_coat3D/texVR.py index 9f0e65ec..520b3084 100644 --- a/io_coat3D/texVR.py +++ b/io_coat3D/texVR.py @@ -173,19 +173,19 @@ def readtexturefolder(objekti, mat_list, texturelist, is_new, udim_textures): #r if(udim_textures == False): for slot_index, texture_info in enumerate(texturelist): - uv_MODE_mat = 'MAT' + uv_MODE_mat = 'MAT' for index, layer in enumerate(objekti.data.uv_layers): if(layer.name == texturelist[slot_index][0]): uv_MODE_mat = 'UV' break - + print('aaa') print(texture_info[0]) print(index_mat) if(texture_info[0] == index_mat.name): if texture_info[2] == 'color' or texture_info[2] == 'diffuse': if(index_mat.material.coat3D_diffuse): - + texcoat['color'].append(texture_info[3]) create_nodes = True else: @@ -248,7 +248,7 @@ def readtexturefolder(objekti, mat_list, texturelist, is_new, udim_textures): #r os.remove(texture_info[3]) create_group_node = True - + else: for texture_info in texturelist: @@ -282,7 +282,7 @@ def readtexturefolder(objekti, mat_list, texturelist, is_new, udim_textures): #r texcoat['alpha'].append([texture_info[0], texture_info[3]]) create_nodes = True create_group_node = True - + if(create_nodes): coat3D = bpy.context.scene.coat3D path3b_n = coat3D.exchangedir @@ -311,7 +311,7 @@ def createnodes(active_mat,texcoat, create_group_node, tile_list, objekti, ind, if(coatMat.use_nodes == False): coatMat.use_nodes = True - + act_material = coatMat.node_tree main_material = coatMat.node_tree applink_group_node = False @@ -596,7 +596,7 @@ def CreateTextureLine(type, act_material, main_mat, texcoat, coat3D, notegroup, else: node = act_material.nodes.new('ShaderNodeTexImage') uv_node = act_material.nodes.new('ShaderNodeUVMap') - + uv_node.uv_map = objekti.data.uv_layers[0].name act_material.links.new(uv_node.outputs[0], node.inputs[0]) uv_node.use_custom_color = True @@ -646,7 +646,7 @@ def CreateTextureLine(type, act_material, main_mat, texcoat, coat3D, notegroup, if (load_image): node.image = bpy.data.images.load(texcoat[type['name']][0]) - + if node.image and type['colorspace'] == 'noncolor': node.image.colorspace_settings.is_data = True @@ -788,7 +788,7 @@ def createExtraNodes(act_material, node, type, notegroup): curvenode.location = -900, -1250 rampnode.location = -600, -1200 huenode.location = -300, -1200 - + if(type['name'] == 'color'): node_vertex = act_material.nodes.new('ShaderNodeVertexColor') node_mixRGB = act_material.nodes.new('ShaderNodeMixRGB') @@ -804,12 +804,12 @@ def createExtraNodes(act_material, node, type, notegroup): node_vertex.location = -337, 525 node_mixRGB.location = 0, 425 - + act_material.links.new(node_vertex.outputs[0], node_mixRGB.inputs[1]) act_material.links.new(huenode.outputs[0], node_mixRGB.inputs[2]) act_material.links.new(node_vertex.outputs[1], notegroup.inputs[8]) act_material.links.new(node_mixRGB.outputs[0], node_vectormath.inputs[0]) - + return node_vectormath return huenode @@ -829,7 +829,7 @@ def matlab(objekti,mat_list,texturelist,is_new): ''' Check if bind textures with UVs or Materials ''' if(texturelist != []): - + udim_textures = False if texturelist[0][0].startswith('100'): udim_textures = True -- cgit v1.2.3