[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [2310] trunk/py/scripts/addons/ io_coat3D: MAde some changes for future improments.

Kalle-Samuli Riihikoski haikalle at gmail.com
Tue Sep 6 22:14:53 CEST 2011


Revision: 2310
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=2310
Author:   haikalle
Date:     2011-09-06 20:14:51 +0000 (Tue, 06 Sep 2011)
Log Message:
-----------
MAde some changes for future improments. Basicly conserning transferring mmultires data between blender and 3d-coat.

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-09-06 04:50:56 UTC (rev 2309)
+++ trunk/py/scripts/addons/io_coat3D/__init__.py	2011-09-06 20:14:51 UTC (rev 2310)
@@ -141,16 +141,16 @@
             description="Remember position.",
             default= True
         )
-        multires = BoolProperty(
-            name="Multires. Levels",
-            description="Saves Multiresolution data.",
-            default= True
-        )
         importtextures = BoolProperty(
             name="Bring Textures",
             description="Import Textures.",
             default= True
         )
+        importlevel = BoolProperty(
+            name="Multires. Level.",
+            description="Bring Specific Multires Level.",
+            default= False
+        )
         exportover = BoolProperty(
             name="Export Obj",
             description="Import Textures.",

Modified: trunk/py/scripts/addons/io_coat3D/coat.py
===================================================================
--- trunk/py/scripts/addons/io_coat3D/coat.py	2011-09-06 04:50:56 UTC (rev 2309)
+++ trunk/py/scripts/addons/io_coat3D/coat.py	2011-09-06 20:14:51 UTC (rev 2310)
@@ -106,7 +106,9 @@
             colR.prop(coat3D,"importmesh")
             colR.prop(coat3D,"importmod")
             colR.prop(coat3D,"importtextures")
-            colR.prop(coat3D,"multires")
+            
+            # This is Disabled, because of the blender bug. 
+            #colR.prop(coat3D,"importlevel")
             row = layout.row()
         
         if(bpy.context.selected_objects):
@@ -287,17 +289,19 @@
                 coat3D.rota = objekti.rotation_euler
                 coa = act_name.coat3D
 
-                if(coat3D.multires):
-                    for modifiers in objekti.modifiers:
-                        if modifiers.type == 'MULTIRES' and (modifiers.total_levels > 0):
+                
+                #See if there is multres modifier. 
+                for modifiers in objekti.modifiers:
+                    if modifiers.type == 'MULTIRES' and (modifiers.total_levels > 0):
+                        if(not(coat3D.importlevel)):
                             bpy.ops.object.multires_external_pack()
                             multires = coat3D.exchangedir
                             multires += ('%stemp.btx'%(os.sep))
                             bpy.ops.object.multires_external_save(filepath=multires)
                             #bpy.ops.object.multires_external_pack()
-                            multires_on = True
-                            multires_name = modifiers.name
-                            break
+                        multires_on = True
+                        multires_name = modifiers.name
+                        break
                         
                 exportfile = coat3D.exchangedir
                 path3b_n = coat3D.exchangedir
@@ -346,15 +350,24 @@
                     proxy_mat.user_clear()
                     bpy.data.materials.remove(proxy_mat)
                     bpy.ops.object.select_all(action='TOGGLE')
+
+                    if(coat3D.importlevel):
+                        obj_proxy.select = True
+                        obj_proxy.modifiers.new(name='temp',type='MULTIRES')
+                        objekti.select = True
+                        bpy.ops.object.multires_reshape(modifier=multires_name)
+                        bpy.ops.object.select_all(action='TOGGLE')
+                        multires_on = False
+                    else:
                     
-                    scene.objects.active = obj_proxy
+                        scene.objects.active = obj_proxy
+                    
+                        obj_data = objekti.data.id_data
+                        objekti.data = obj_proxy.data.id_data
+                        if(bpy.data.meshes[obj_data.name].users == 0):
+                            bpy.data.meshes.remove(obj_data)
+                            objekti.data.id_data.name = obj_data.name
 
-                    obj_data = objekti.data.id_data
-                    objekti.data = obj_proxy.data.id_data
-                    if(bpy.data.meshes[obj_data.name].users == 0):
-                        bpy.data.meshes.remove(obj_data)
-                        objekti.data.id_data.name = obj_data.name
-
                     obj_proxy.select = True
                     bpy.ops.object.delete()
                     objekti.select = True
@@ -407,6 +420,7 @@
                     #bpy.ops.object.multires_external_pack()
                 bpy.ops.object.shade_smooth()
                 
+                
         for act_name in test:
             act_name.select = True
         bpy.context.scene.objects.active = act_first



More information about the Bf-extensions-cvs mailing list