[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [2456] trunk/py/scripts/addons/ io_coat3D: Fixed pivot point move when using applink.

Kalle-Samuli Riihikoski haikalle at gmail.com
Sat Oct 15 20:10:40 CEST 2011


Revision: 2456
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=2456
Author:   haikalle
Date:     2011-10-15 18:10:40 +0000 (Sat, 15 Oct 2011)
Log Message:
-----------
Fixed pivot point move when using applink.

Modified Paths:
--------------
    trunk/py/scripts/addons/io_coat3D/__init__.py
    trunk/py/scripts/addons/io_coat3D/coat.py

Modified: trunk/py/scripts/addons/io_coat3D/__init__.py
===================================================================
--- trunk/py/scripts/addons/io_coat3D/__init__.py	2011-10-15 15:16:59 UTC (rev 2455)
+++ trunk/py/scripts/addons/io_coat3D/__init__.py	2011-10-15 18:10:40 UTC (rev 2456)
@@ -71,6 +71,8 @@
             name="FilePath",
             subtype="DIR_PATH",
         )
+        cursor_loc = FloatVectorProperty(name="Cursor_loc",description="location")
+        
         exchangedir = StringProperty(
             name="FilePath",
             subtype="DIR_PATH"

Modified: trunk/py/scripts/addons/io_coat3D/coat.py
===================================================================
--- trunk/py/scripts/addons/io_coat3D/coat.py	2011-10-15 15:16:59 UTC (rev 2455)
+++ trunk/py/scripts/addons/io_coat3D/coat.py	2011-10-15 18:10:40 UTC (rev 2456)
@@ -201,15 +201,17 @@
                     looking = False
                     coa.applink_name = checkname
 
-        bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY', center='MEDIAN')
 
+        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)
         obj.scale = (1,1,1)
@@ -217,12 +219,22 @@
         bpy.ops.export_scene.obj(filepath=coa.applink_name,use_selection=True,
         use_apply_modifiers=False,use_blen_objects=True, group_by_material= True,
         use_materials = False,keep_vertex_order = True,axis_forward='X',axis_up='Y')
-        
 
         obj.location = coa.loc
         obj.rotation_euler = coa.rot
         obj.scale = coa.sca
+
+        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))
@@ -246,6 +258,7 @@
         coat = bpy.coat3D
         test = bpy.context.selected_objects
         act_first = bpy.context.scene.objects.active
+        bpy.context.scene.game_settings.material_mode = 'GLSL'
 
         for act_name in test:
             coa = act_name.coat3D
@@ -320,8 +333,7 @@
                     mtl = mtl.replace('.obj','.mtl')
                     if(os.path.isfile(mtl)):
                         os.remove(mtl)
-
-                    
+                   
                     bpy.ops.import_scene.obj(filepath=path_object,axis_forward='X',axis_up='Y')
                     obj_proxy = scene.objects[0]
                     bpy.ops.object.select_all(action='TOGGLE')
@@ -357,6 +369,7 @@
                     bpy.ops.object.delete()
                     objekti.select = True
                     objekti.scale = coat3D.dime
+                    
                     bpy.context.scene.objects.active = objekti
 
                 if(os.path.isfile(path3b_n)):



More information about the Bf-extensions-cvs mailing list