[Bf-extensions-cvs] [4c132dc5] blender2.8: Merge branch 'master' into blender2.8
Campbell Barton
noreply at git.blender.org
Fri Sep 7 22:09:43 CEST 2018
Commit: 4c132dc503c7c9506e301be5b479c6c579ce9723
Author: Campbell Barton
Date: Sat Sep 8 06:18:54 2018 +1000
Branches: blender2.8
https://developer.blender.org/rBA4c132dc503c7c9506e301be5b479c6c579ce9723
Merge branch 'master' into blender2.8
===================================================================
===================================================================
diff --cc io_coat3D/__init__.py
index ba56d653,b5539ede..f7d0bc88
--- a/io_coat3D/__init__.py
+++ b/io_coat3D/__init__.py
@@@ -55,1061 -49,6 +55,1061 @@@ from bpy.props import
)
+bpy.coat3D = dict()
+bpy.coat3D['active_coat'] = ''
+bpy.coat3D['status'] = 0
+
+def folder_size(path):
+
+ tosi = True
+ while tosi:
+ list_of_files = []
+ for file in os.listdir(path):
+ list_of_files.append(path + os.sep + file)
+
+ if len(list_of_files) >= 400:
+ oldest_file = min(list_of_files, key=os.path.getctime)
+ os.remove(os.path.abspath(oldest_file))
+ else:
+ tosi = False
+
+def set_exchange_folder():
+ platform = os.sys.platform
+ coat3D = bpy.context.scene.coat3D
+ Blender_export = ""
+
+ if(platform == 'win32'):
+ exchange = os.path.expanduser("~") + os.sep + 'Documents' + os.sep + '3D-CoatV4' + os.sep +'Exchange'
+ if not(os.path.isdir(exchange)):
+ exchange = os.path.expanduser("~") + os.sep + 'Documents' + os.sep + '3D-CoatV3' + os.sep +'Exchange'
+ else:
+ exchange = os.path.expanduser("~") + os.sep + '3D-CoatV4' + os.sep + 'Exchange'
+ if not(os.path.isdir(exchange)):
+ exchange = os.path.expanduser("~") + os.sep + '3D-CoatV3' + os.sep + 'Exchange'
+ if(not(os.path.isdir(exchange))):
+ exchange = coat3D.exchangedir
+
+ if(os.path.isdir(exchange)):
+ bpy.coat3D['status'] = 1
+ if(platform == 'win32'):
+ exchange_path = os.path.expanduser("~") + os.sep + 'Documents' + os.sep + '3DC2Blender' + os.sep + 'Exchange_folder.txt'
+ applink_folder = os.path.expanduser("~") + os.sep + 'Documents' + os.sep + '3DC2Blender'
+ if(not(os.path.isdir(applink_folder))):
+ os.makedirs(applink_folder)
+ else:
+ exchange_path = os.path.expanduser("~") + os.sep + 'Documents' + os.sep + '3DC2Blender' + os.sep + 'Exchange_folder.txt'
+ applink_folder = os.path.expanduser("~") + os.sep + 'Documents' + os.sep + '3DC2Blender'
+ if(not(os.path.isdir(applink_folder))):
+ os.makedirs(applink_folder)
+ file = open(exchange_path, "w")
+ file.write("%s"%(coat3D.exchangedir))
+ file.close()
+
+ else:
+ if(platform == 'win32'):
+ exchange_path = os.path.expanduser("~") + os.sep + 'Documents' + os.sep + '3DC2Blender' + os.sep + 'Exchange_folder.txt'
+ else:
+ exchange_path = os.path.expanduser("~") + os.sep + '3DC2Blender' + os.sep + 'Exchange_folder.txt'
+ if(os.path.isfile(exchange_path)):
+ ex_path =''
+
+ ex_pathh = open(exchange_path)
+ for line in ex_pathh:
+ ex_path = line
+ break
+ ex_pathh.close()
+
+ if(os.path.isdir(ex_path) and ex_path.rfind('Exchange') >= 0):
+ exchange = ex_path
+ bpy.coat3D['status'] = 1
+ else:
+ bpy.coat3D['status'] = 0
+ else:
+ bpy.coat3D['status'] = 0
+ if(bpy.coat3D['status'] == 1):
+ Blender_folder = ("%s%sBlender"%(exchange,os.sep))
+ Blender_export = Blender_folder
+ path3b_now = exchange
+ path3b_now += ('last_saved_3b_file.txt')
+ Blender_export += ('%sexport.txt'%(os.sep))
+
+ if(not(os.path.isdir(Blender_folder))):
+ os.makedirs(Blender_folder)
+ Blender_folder = os.path.join(Blender_folder,"run.txt")
+ file = open(Blender_folder, "w")
+ file.close()
+ return exchange
+
+def set_working_folders():
+ platform = os.sys.platform
+ coat3D = bpy.context.scene.coat3D
+ if(platform == 'win32'):
+ folder_objects = os.path.expanduser("~") + os.sep + 'Documents' + os.sep + '3DC2Blender' + os.sep + 'ApplinkObjects'
+ if(not(os.path.isdir(folder_objects))):
+ os.makedirs(folder_objects)
+ else:
+ folder_objects = os.path.expanduser("~") + os.sep + '3DC2Blender' + os.sep + 'ApplinkObjects'
+ if(not(os.path.isdir(folder_objects))):
+ os.makedirs(folder_objects)
+
+ return folder_objects
+
+def make_texture_list(texturefolder):
+ texturefolder += ('%stextures.txt'%(os.sep))
+ texturelist = []
+
+ if (os.path.isfile(texturefolder)):
+ texturefile = open(texturefolder)
+ index = 0
+ for line in texturefile:
+ if line != '' and index == 0:
+ objekti = line
+ index += 1
+ elif index == 1:
+ material = line
+ index += 1
+ elif index == 2:
+ type = line
+ index += 1
+ elif index == 3:
+ address = line
+ texturelist.append([objekti,material,type,address])
+ index = 0
+ texturefile.close()
+ return texturelist
+
+
+'''
- #Updating objects MESH part ( Mesh, Vertex Groups, Vertex Colors )
++#Updating objects MESH part ( Mesh, Vertex Groups, Vertex Colors )
+'''
+
+def updatemesh(objekti, proxy):
+
+
+ #TO DO VERTEX GROUPS, gives an error with this code.
+
+ if(objekti.vertex_groups.keys() != []):
+ bpy.ops.object.select_all(action='DESELECT')
+ proxy.select_set('SELECT')
+ objekti.select_set('SELECT')
+ bpy.ops.object.vertex_group_copy_to_selected()
+ bpy.ops.object.select_all(action='DESELECT')
+
+
+
+
+ # UV Set Copy
+
+ proxy.select_set('SELECT')
+ objekti.select_set('SELECT')
+
+ if len(objekti.data.uv_layers) > 1:
+ obj_uv_index = objekti.data.uv_layers.active_index
+ index = 0
+ for uv_layer in objekti.data.uv_layers:
+ if (uv_layer != objekti.data.uv_layers[0]):
+ proxy.data.uv_layers.new(uv_layer.name)
+ proxy.data.uv_layers.active_index = index
+ objekti.data.uv_layers.active_index = index
+ bpy.ops.object.join_uvs()
+ index += 1
+ proxy.data.uv_layers.active_index = obj_uv_index
+
+ bpy.ops.object.select_all(action='DESELECT')
+
+ #Mesh Copy
+
+ proxy.select_set('SELECT')
+ obj_data = objekti.data.id_data
+ objekti.data = proxy.data.id_data
+ objekti.data.id_data.name = obj_data.name
+ if (bpy.data.meshes[obj_data.name].users == 0):
+ bpy.data.meshes.remove(obj_data)
+
+
+
+class SCENE_PT_Main(bpy.types.Panel):
+ bl_label = "3D-Coat Applink"
+ bl_space_type = "VIEW_3D"
+ bl_region_type = "TOOLS"
+ bl_context = "objectmode"
+ bl_category = '3D-Coat'
+ bl_options = {'DEFAULT_CLOSED'}
+
+ def draw(self, context):
+ layout = self.layout
+ coat3D = bpy.context.scene.coat3D
+ if(bpy.context.active_object):
+ coa = bpy.context.active_object.coat3D
+
+ if(coat3D.exchange_found == False):
+ bpy.coat3D['active_coat'] = set_exchange_folder()
+ row = layout.row()
+ row.label(text="Applink didn't find your 3d-Coat/Excahnge folder.")
+ row = layout.row()
+ row.label("Please select it before using Applink.")
+ row = layout.row()
+ row.prop(coat3D,"exchangedir",text="")
+ row = layout.row()
+ row.operator("update_exchange_folder.pilgway_3d_coat", text="Apply folder")
+
+ else:
+ #Here you add your GUI
+ row = layout.row()
+ row.prop(coat3D,"type",text = "")
+ row = layout.row()
+ colL = row.column()
+ colR = row.column()
+
+ colR.operator("export_applink.pilgway_3d_coat", text="Transfer")
+ colL.operator("import_applink.pilgway_3d_coat", text="Update")
+
+
+def running():
+ n=0# number of instances of the program running
+ prog=[line.split() for line in subprocess.check_output("tasklist").splitlines()]
+ [prog.pop(e) for e in [0,1,2]] #useless
+ for task in prog:
+ if str(task[0]) == "b'3D-CoatDX64C.exe'" or str(task[0]) == "b'3D-CoatGL64C.exe'":
+ n+=1
+ break
+ if n>0:
+ return True
+ else:
+ return False
+
+class SCENE_OT_folder(bpy.types.Operator):
+ bl_idname = "update_exchange_folder.pilgway_3d_coat"
+ bl_label = "Export your custom property"
+ bl_description = "Export your custom property"
+ bl_options = {'UNDO'}
+
+ def invoke(self, context, event):
+ coat3D = bpy.context.scene.coat3D
+ print(coat3D.exchangedir)
+ print(os.path.isdir(coat3D.exchangedir))
+ if(os.path.isdir(coat3D.exchangedir)):
+ coat3D.exchange_found = True
+ else:
+ coat3D.exchange_found = False
+
+ return {'FINISHED'}
+
+class SCENE_OT_opencoat(bpy.types.Operator):
+ bl_idname = "open_3dcoat.pilgway_3d_coat"
+ bl_label = "Export your custom property"
+ bl_description = "Export your custom property"
+ bl_options = {'UNDO'}
+
+ def invoke(self, context, event):
+ coat3D = bpy.context.selected_objects[0].coat3D.applink_3b_path
+ print('3b osoite on:',coat3D)
+ platform = os.sys.platform
+ prog_path = os.environ['PROGRAMFILES']
+ if (platform == 'win32'):
+ index = 0
+ for file in os.listdir(prog_path):
+ if index == 0:
+ if file.startswith('3D-Coat-V4'):
+ modi = os.path.getmtime(prog_path + os.sep + file)
+ active_3dcoat = prog_path + os.sep + file
+ index += 1
+ else:
+ if file.startswith('3D-Coat-V4'):
+ if(os.path.getmtime(prog_path + os.sep + file) > modi):
+ modi = os.path.getmtime(prog_path + os.sep + file)
+ active_3dcoat = prog_path + os.sep + file
+
+ print('haippaa',active_3dcoat)
+
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list