[Bf-extensions-cvs] [6d0c58a4] blender2.8: change index from from object to mesh
Kalle-Samuli Riihikoski
noreply at git.blender.org
Sun Aug 12 05:41:03 CEST 2018
Commit: 6d0c58a4ba4407e63cc75452f03d78cb84e2eb67
Author: Kalle-Samuli Riihikoski
Date: Sat Aug 11 14:01:13 2018 +0300
Branches: blender2.8
https://developer.blender.org/rBA6d0c58a4ba4407e63cc75452f03d78cb84e2eb67
change index from from object to mesh
===================================================================
D io_coat3D/coat.py
===================================================================
diff --git a/io_coat3D/coat.py b/io_coat3D/coat.py
deleted file mode 100644
index fc3cb747..00000000
--- a/io_coat3D/coat.py
+++ /dev/null
@@ -1,626 +0,0 @@
-# ***** BEGIN GPL LICENSE BLOCK *****
-#
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# ***** END GPL LICENCE BLOCK *****
-
-import bpy
-from bpy.props import *
-from io_coat3D import tex
-import os
-
-
-bpy.coat3D = dict()
-bpy.coat3D['active_coat'] = ''
-bpy.coat3D['status'] = 0
-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 + 'Objects'
- folder_textures = os.path.expanduser("~") + os.sep + 'Documents' + os.sep + '3DC2Blender' + os.sep + 'Textures' + os.sep
- if(not(os.path.isdir(folder_objects))):
- os.makedirs(folder_objects)
- if(not(os.path.isdir(folder_textures))):
- os.makedirs(folder_textures)
- else:
- folder_objects = os.path.expanduser("~") + os.sep + '3DC2Blender' + os.sep + 'Objects'
- folder_textures = os.path.expanduser("~") + os.sep + '3DC2Blender' + os.sep + 'Textures' + os.sep
- if(not(os.path.isdir(folder_objects))):
- os.makedirs(folder_objects)
- if(not(os.path.isdir(folder_textures))):
- os.makedirs(folder_textures)
-
-
- return folder_objects,folder_textures
-
-class ObjectButtonsPanel():
- bl_space_type = 'PROPERTIES'
- bl_region_type = 'WINDOW'
- bl_context = "object"
-
-class SCENE_PT_Main(ObjectButtonsPanel,bpy.types.Panel):
- bl_label = "3D-Coat Applink"
- bl_space_type = "PROPERTIES"
- bl_region_type = "WINDOW"
- bl_context = "scene"
-
- def draw(self, context):
- layout = self.layout
- scene = context.scene
- me = context.scene.objects
- mat_list = []
- import_no = 0
- coat = bpy.coat3D
- coat3D = bpy.context.scene.coat3D
- if(bpy.context.scene.objects.active):
- coa = bpy.context.scene.objects.active.coat3D
-
-
- if(bpy.coat3D['status'] == 0 and not(os.path.isdir(coat3D.exchangedir))):
- 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="")
-
- 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")
-
-
-
-
-
-
-
-
-
-
-class SCENE_OT_export(bpy.types.Operator):
- bl_idname = "export_applink.pilgway_3d_coat"
- bl_label = "Export your custom property"
- bl_description = "Export your custom property"
- bl_options = {'UNDO'}
-
- def invoke(self, context, event):
- checkname = ''
- coat3D = bpy.context.scene.coat3D
- scene = context.scene
- activeobj = bpy.context.active_object.name
- obj = scene.objects[activeobj]
- coa = bpy.context.scene.objects.active.coat3D
- coat3D.exchangedir = set_exchange_folder()
- export_ok = False
-
- folder_objects,folder_textures = set_working_folders()
-
- if(coat3D.exchange_found == False):
- return {'FINISHED'}
-
- if(bpy.context.selected_objects == []):
- return {'FINISHED'}
- else:
- for objec in bpy.context.selected_objects:
- if objec.type == 'MESH':
- export_ok = True
- if(export_ok == False):
- return {'FINISHED'}
-
- importfile = coat3D.exchangedir
- texturefile = coat3D.exchangedir
- importfile += ('%simport.txt'%(os.sep))
- texturefile += ('%stextures.txt'%(os.sep))
-
- looking = True
- object_index = 0
- if(coa.applink_name and os.path.isfile(coa.applink_name)):
- checkname = coa.applink_name
-
- else:
- while(looking == True):
- checkname = folder_objects + os.sep + activeobj
- checkname = ("%s%.2d.obj"%(checkname,object_index))
- if(os.path.isfile(checkname)):
- object_index += 1
- else:
- looking = False
- coa.applink_name = checkname
-
-
- coat3D.cursor_loc = obj.location
- coat3D.cursor_orginal = bpy.context.scene.cursor_location
-
-
-
- coa.loc = obj.location
- coa.rot = obj.rotation_euler
- coa.sca = obj.scale
- coa.dime = obj.dimensions
-
- obj.location = (0,0,0)
- obj.rotation_euler = (0,0,0)
- bpy.ops.object.transform_apply(scale=True)
-
- bpy.ops.export_scene.obj(filepath=coa.applink_name,use_selection=True,
- use_mesh_modifiers=False,use_blen_objects=True, use_materials = True,
- keep_vertex_order = True,axis_forward='-Z',axis_up='Y')
-
- obj.location = coa.loc
- obj.rotation_euler = coa.rot
-
-
- bpy.context.scene.cursor_location = coat3D.cursor_loc
- bpy.context.scene.cursor_location = coat3D.cursor_orginal
-
- file = open(importfile, "w")
- file.write("%s"%(checkname))
- file.write("\n%s"%(checkname))
- file.write("\n[%s]"%(coat3D.type))
- file.write("\n[TexOutput:%s]"%(folder_textures))
- file.close()
-
- coa.objecttime = str(os.path.getmtime(coa.applink_name))
-
-
-
- return {'FINISHED'}
-
-class SCENE_OT_import(bpy.types.Operator):
- bl_idname = "import_applink.pilgway_3d_coat"
- bl_label = "import your custom property"
- bl_description = "import your custom property"
- bl_options = {'UNDO'}
-
- def invoke(self, context, event):
- scene = context.scene
- coat3D = bpy.context.scene.coat3D
- coat = bpy.coat3D
- test = bpy.context.selected_objects
- act_first = bpy.context.scene.objects.active
- bpy.context.scene.game_settings.material_mode = 'GLSL'
- coat3D.exchangedir = set_exchange_folder()
-
- folder_objects,folder_textures = set_working_folders()
-
- Blender_folder = ("%s%sBlender"%(coat3D.exchan
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list