[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [4111] trunk/py/scripts/addons: Updated to use UI_UL_list as template_list ( and fix for a dummy mistake in own previous commit).

Bastien Montagne montagne29 at wanadoo.fr
Fri Dec 28 11:41:41 CET 2012


Revision: 4111
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=4111
Author:   mont29
Date:     2012-12-28 10:41:39 +0000 (Fri, 28 Dec 2012)
Log Message:
-----------
Updated to use UI_UL_list as template_list (and fix for a dummy mistake in own previous commit).

Modified Paths:
--------------
    trunk/py/scripts/addons/io_export_unreal_psk_psa.py
    trunk/py/scripts/addons/io_import_scene_unreal_psa_psk.py

Modified: trunk/py/scripts/addons/io_export_unreal_psk_psa.py
===================================================================
--- trunk/py/scripts/addons/io_export_unreal_psk_psa.py	2012-12-28 10:06:57 UTC (rev 4110)
+++ trunk/py/scripts/addons/io_export_unreal_psk_psa.py	2012-12-28 10:41:39 UTC (rev 4111)
@@ -1966,6 +1966,29 @@
 #===========================================================================
 # User interface
 #===========================================================================
+class EXPORT_UL_UDKlists(bpy.types.UIList):
+    def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
+        if not isinstance(item, (bpy.types.UDKActionSetListPG, bpy.types.UDKObjListPG, bpy.types.UDKMeshListPG,
+                                 bpy.types.UDKArmListPG)):
+            return
+        if self.layout_type in {'DEFAULT', 'COMPACT'}:
+            layout.label(item.name, icon_value=icon)
+            if isinstance(item, bpy.types.UDKActionSetListPG):
+                layout.prop(item, "bmatch", text="")
+                layout.prop(item, "bexport", text="")
+            if isinstance(item, bpy.types.UDKObjListPG):
+                layout.prop(item, "otype", text="")
+                layout.prop(item, "bselect", text="")
+            if isinstance(item, bpy.types.UDKMeshListPG):
+                layout.prop(item, "bselect", text="")
+                layout.prop(item, "bexport", text="")
+            if isinstance(item, bpy.types.UDKArmListPG):
+                pass # Nothing special here for now...
+        elif self.layout_type in {'GRID'}:
+            layout.alignment = 'CENTER'
+            layout.label("", icon_value=icon)
+
+
 class OBJECT_OT_UTSelectedFaceSmooth(bpy.types.Operator):
     bl_idname = "object.utselectfacesmooth"  # XXX, name???
     bl_label = "Select Smooth Faces"#"Select Smooth faces"
@@ -2202,48 +2225,44 @@
         return{'FINISHED'}
 
 class UDKActionSetListPG(bpy.types.PropertyGroup):
-    bool    = BoolProperty(default=False)
-    string  = StringProperty()
-    actionname  = StringProperty()
-    bmatch    = BoolProperty(default=False,name="Match", options={"HIDDEN"},description = "This check against bone names and action group names matches and override boolean if true.")
-    bexport    = BoolProperty(default=False,name="Export",description = "Check this to export the animation")
-    template_list_controls = StringProperty(default="bmatch:bexport", options={"HIDDEN"})
+#    boolean = BoolProperty(default=False)
+    string = StringProperty()
+    actionname = StringProperty()
+    bmatch = BoolProperty(default=False,name="Match", options={"HIDDEN"},description = "This check against bone names and action group names matches and override boolean if true.")
+    bexport = BoolProperty(default=False,name="Export",description = "Check this to export the animation")
 
 bpy.utils.register_class(UDKActionSetListPG)
 bpy.types.Scene.udkas_list = CollectionProperty(type=UDKActionSetListPG)
 bpy.types.Scene.udkas_list_idx = IntProperty()
 
 class UDKObjListPG(bpy.types.PropertyGroup):
-    bool    = BoolProperty(default=False)
-    string  = StringProperty()
-    bexport    = BoolProperty(default=False,name="Export", options={"HIDDEN"},description = "This will be ignore when exported")
-    bselect    = BoolProperty(default=False,name="Select", options={"HIDDEN"},description = "This will be ignore when exported")
-    otype  = StringProperty(name="Type",description = "This will be ignore when exported")
-    template_list_controls = StringProperty(default="otype:bselect", options={"HIDDEN"})
+#    boolean = BoolProperty(default=False)
+    string = StringProperty()
+    bexport = BoolProperty(default=False,name="Export", options={"HIDDEN"},description = "This will be ignore when exported")
+    bselect = BoolProperty(default=False,name="Select", options={"HIDDEN"},description = "This will be ignore when exported")
+    otype = StringProperty(name="Type",description = "This will be ignore when exported")
 
 bpy.utils.register_class(UDKObjListPG)
 bpy.types.Scene.udkobj_list = CollectionProperty(type=UDKObjListPG)
 bpy.types.Scene.udkobj_list_idx = IntProperty()
 
 class UDKMeshListPG(bpy.types.PropertyGroup):
-    bool    = BoolProperty(default=False)
-    string  = StringProperty()
-    bexport    = BoolProperty(default=False,name="Export", options={"HIDDEN"},description = "This object will be export when true.")
-    bselect    = BoolProperty(default=False,name="Select", options={"HIDDEN"},description = "Make sure you have Mesh is parent to Armature.")
-    otype  = StringProperty(name="Type",description = "This will be ignore when exported")
-    template_list_controls = StringProperty(default="bselect:bexport", options={"HIDDEN"})
+#    boolean = BoolProperty(default=False)
+    string = StringProperty()
+    bexport = BoolProperty(default=False,name="Export", options={"HIDDEN"},description = "This object will be export when true.")
+    bselect = BoolProperty(default=False,name="Select", options={"HIDDEN"},description = "Make sure you have Mesh is parent to Armature.")
+    otype = StringProperty(name="Type",description = "This will be ignore when exported")
 
 bpy.utils.register_class(UDKMeshListPG)
 bpy.types.Scene.udkmesh_list = CollectionProperty(type=UDKMeshListPG)
 bpy.types.Scene.udkmesh_list_idx = IntProperty()
 
 class UDKArmListPG(bpy.types.PropertyGroup):
-    bool    = BoolProperty(default=False)
-    string  = StringProperty()
-    bexport    = BoolProperty(default=False,name="Export", options={"HIDDEN"},description = "This will be ignore when exported")
-    bselect    = BoolProperty(default=False,name="Select", options={"HIDDEN"},description = "This will be ignore when exported")
-    otype  = StringProperty(name="Type",description = "This will be ignore when exported")
-    template_list_controls = StringProperty(default="", options={"HIDDEN"})
+    boolean = BoolProperty(default=False)
+    string = StringProperty()
+    bexport = BoolProperty(default=False,name="Export", options={"HIDDEN"},description = "This will be ignore when exported")
+    bselect = BoolProperty(default=False,name="Select", options={"HIDDEN"},description = "This will be ignore when exported")
+    otype = StringProperty(name="Type",description = "This will be ignore when exported")
 
 bpy.utils.register_class(UDKArmListPG)
 bpy.types.Scene.udkArm_list = CollectionProperty(type=UDKArmListPG)
@@ -2294,14 +2313,17 @@
         if context.scene.udk_option_selectobjects:
             layout.operator("object.selobjectpdate")
             layout.label(text="ARMATURE")
-            layout.template_list(context.scene, "udkArm_list", context.scene, "udkArm_list_idx",prop_list="template_list_controls", rows=3)
+            layout.template_list("EXPORT_UL_UDKlists", "", context.scene, "udkArm_list",
+                                 context.scene, "udkArm_list_idx", rows=3)
             layout.label(text="MESH")
-            layout.template_list(context.scene, "udkmesh_list", context.scene, "udkmesh_list_idx",prop_list="template_list_controls", rows=5)
+            layout.template_list("EXPORT_UL_UDKlists", "", context.scene, "udkmesh_list",
+                                 context.scene, "udkmesh_list_idx", rows=5)
         layout.prop(context.scene, "udk_option_selectanimations")
         if context.scene.udk_option_selectanimations:
             layout.operator("action.setanimupdate")
             layout.label(text="Action Set(s)")
-            layout.template_list(context.scene, "udkas_list", context.scene, "udkas_list_idx",prop_list="template_list_controls", rows=5)
+            layout.template_list("EXPORT_UL_UDKlists", "", context.scene, "udkas_list",
+                                 context.scene, "udkas_list_idx", rows=5)
         test = layout.separator()
         layout.prop(context.scene, "udk_option_scale")
         layout.prop(context.scene, "udk_option_rebuildobjects")
@@ -2531,7 +2553,6 @@
                 my_item = my_sett.add()
                 #print(dir(my_item.bmatch))
                 my_item.name = action.name
-                my_item.template_list_controls = "bmatch:bexport"
                 if len(bones) == len(action.groups) == count:
                     my_item.bmatch = True
                 else:

Modified: trunk/py/scripts/addons/io_import_scene_unreal_psa_psk.py
===================================================================
--- trunk/py/scripts/addons/io_import_scene_unreal_psa_psk.py	2012-12-28 10:06:57 UTC (rev 4110)
+++ trunk/py/scripts/addons/io_import_scene_unreal_psa_psk.py	2012-12-28 10:41:39 UTC (rev 4111)
@@ -366,7 +366,7 @@
              createbone.bindmat = mathutils.Quaternion((indata[7], -indata[4], -indata[5], -indata[6])).to_matrix()
              createbone.origmat = mathutils.Quaternion((indata[7], -indata[4], -indata[5], -indata[6])).to_matrix()
         
-        createbone.bindmat = mathutils.Matrix.Translation(mathutils.Vector((indata[8], indata[9], indata[10]))) *
+        createbone.bindmat = mathutils.Matrix.Translation(mathutils.Vector((indata[8], indata[9], indata[10]))) * \
                              createbone.bindmat.to_4x4()
 
         md5_bones.append(createbone)



More information about the Bf-extensions-cvs mailing list