Commit: bd239c7661395f2043cf4a5c1225470ee3c8352d
Author: Julian Eisel
Date:   Fri Sep 23 02:31:23 2016 +0200
Branches: custom-manipulators
https://developer.blender.org/rBbd239c7661395f2043cf4a5c1225470ee3c8352d

Rebase wiggly-widgets branch onto blender2.8 branch

This commit adds a new 'custom-manipulators' branch in which changes of the 
wiggly-widgets branch are applied onto the blender2.8 branch. I've done it so I 
can start porting manipulator drawing code to use the new abstractions for 
OpenGL 3.2 core profile.
At some point I had to do it anyway - better earlier than later to reduce loss 
of git history.
>From now on this is the main branch for the custom manipulators project, I'll 
>delete the wiggly-widgets branch in a bit (but keep it available at 
>https://github.com/julianeisel/blender/tree/wiggly-widgets). It's still 
>possible to merge some manipulators for pre-2.8 by rewriting the drawing of 
>those to use OpenGL <= 2.1 (or copy & pasting from earlier state).

===================================================================

A       release/datafiles/widget_export.py
M       release/scripts/modules/bpy_extras/keyconfig_utils.py
M       release/scripts/modules/rna_keymap_ui.py
M       release/scripts/startup/bl_ui/properties_data_bone.py
M       release/scripts/startup/bl_ui/properties_data_mesh.py
M       release/scripts/startup/bl_ui/properties_data_modifier.py
M       release/scripts/startup/bl_ui/properties_object.py
M       release/scripts/startup/bl_ui/space_node.py
M       release/scripts/startup/bl_ui/space_sequencer.py
M       release/scripts/startup/bl_ui/space_userpref.py
M       source/blender/CMakeLists.txt
M       source/blender/blenkernel/BKE_DerivedMesh.h
M       source/blender/blenkernel/BKE_blender_version.h
A       source/blender/blenkernel/BKE_facemap.h
M       source/blender/blenkernel/BKE_screen.h
M       source/blender/blenkernel/CMakeLists.txt
M       source/blender/blenkernel/intern/action.c
M       source/blender/blenkernel/intern/armature.c
M       source/blender/blenkernel/intern/camera.c
M       source/blender/blenkernel/intern/cdderivedmesh.c
M       source/blender/blenkernel/intern/customdata.c
A       source/blender/blenkernel/intern/facemap.c
M       source/blender/blenkernel/intern/library_query.c
M       source/blender/blenkernel/intern/object.c
M       source/blender/blenkernel/intern/screen.c
M       source/blender/blenkernel/intern/subsurf_ccg.c
M       source/blender/blenlib/BLI_math_vector.h
M       source/blender/blenlib/intern/math_vector.c
M       source/blender/blenloader/intern/readfile.c
M       source/blender/blenloader/intern/versioning_260.c
M       source/blender/blenloader/intern/versioning_270.c
M       source/blender/blenloader/intern/writefile.c
M       source/blender/editors/armature/pose_select.c
M       source/blender/editors/armature/pose_utils.c
M       source/blender/editors/include/BIF_glutil.h
M       source/blender/editors/include/ED_armature.h
M       source/blender/editors/include/ED_mesh.h
M       source/blender/editors/include/ED_screen.h
M       source/blender/editors/include/ED_transform.h
M       source/blender/editors/include/ED_uvedit.h
M       source/blender/editors/include/ED_view3d.h
M       source/blender/editors/include/UI_interface.h
M       source/blender/editors/interface/interface_draw.c
M       source/blender/editors/interface/interface_intern.h
M       source/blender/editors/interface/resources.c
M       source/blender/editors/object/CMakeLists.txt
M       source/blender/editors/object/object_edit.c
A       source/blender/editors/object/object_fmap.c
M       source/blender/editors/object/object_intern.h
M       source/blender/editors/object/object_ops.c
M       source/blender/editors/object/object_shapekey.c
M       source/blender/editors/render/render_internal.c
M       source/blender/editors/screen/area.c
M       source/blender/editors/screen/glutil.c
M       source/blender/editors/screen/screen_edit.c
M       source/blender/editors/space_api/spacetypes.c
M       source/blender/editors/space_clip/clip_draw.c
M       source/blender/editors/space_graph/graph_buttons.c
M       source/blender/editors/space_graph/graph_edit.c
M       source/blender/editors/space_graph/graph_intern.h
M       source/blender/editors/space_graph/graph_ops.c
M       source/blender/editors/space_graph/space_graph.c
M       source/blender/editors/space_image/image_draw.c
M       source/blender/editors/space_image/space_image.c
M       source/blender/editors/space_node/CMakeLists.txt
M       source/blender/editors/space_node/drawnode.c
M       source/blender/editors/space_node/node_draw.c
M       source/blender/editors/space_node/node_edit.c
M       source/blender/editors/space_node/node_intern.h
M       source/blender/editors/space_node/node_view.c
A       source/blender/editors/space_node/node_widgets.c
M       source/blender/editors/space_node/space_node.c
M       source/blender/editors/space_sequencer/sequencer_draw.c
M       source/blender/editors/space_sequencer/sequencer_intern.h
M       source/blender/editors/space_sequencer/sequencer_ops.c
M       source/blender/editors/space_sequencer/sequencer_view.c
M       source/blender/editors/space_sequencer/space_sequencer.c
M       source/blender/editors/space_view3d/CMakeLists.txt
M       source/blender/editors/space_view3d/drawarmature.c
M       source/blender/editors/space_view3d/drawobject.c
M       source/blender/editors/space_view3d/space_view3d.c
M       source/blender/editors/space_view3d/view3d_draw.c
M       source/blender/editors/space_view3d/view3d_edit.c
M       source/blender/editors/space_view3d/view3d_intern.h
M       source/blender/editors/space_view3d/view3d_ops.c
A       source/blender/editors/space_view3d/view3d_widgets.c
M       source/blender/editors/transform/CMakeLists.txt
M       source/blender/editors/transform/transform.c
M       source/blender/editors/transform/transform.h
M       source/blender/editors/transform/transform_constraints.c
M       source/blender/editors/transform/transform_generics.c
M       source/blender/editors/transform/transform_manipulator.c
A       source/blender/editors/transform/transform_manipulator2d.c
M       source/blender/editors/transform/transform_orientations.c
M       source/blender/editors/uvedit/uvedit_ops.c
M       source/blender/gpu/GPU_buffers.h
M       source/blender/gpu/intern/gpu_buffers.c
M       source/blender/makesdna/DNA_action_types.h
M       source/blender/makesdna/DNA_armature_types.h
M       source/blender/makesdna/DNA_customdata_types.h
M       source/blender/makesdna/DNA_key_types.h
A       source/blender/makesdna/DNA_manipulator_types.h
M       source/blender/makesdna/DNA_object_types.h
M       source/blender/makesdna/DNA_screen_types.h
M       source/blender/makesdna/DNA_space_types.h
M       source/blender/makesdna/DNA_userdef_types.h
M       source/blender/makesdna/DNA_view3d_types.h
M       source/blender/makesdna/DNA_windowmanager_types.h
M       source/blender/makesdna/intern/makesdna.c
M       source/blender/makesrna/RNA_access.h
M       source/blender/makesrna/RNA_enum_types.h
M       source/blender/makesrna/intern/rna_armature.c
M       source/blender/makesrna/intern/rna_internal.h
M       source/blender/makesrna/intern/rna_key.c
M       source/blender/makesrna/intern/rna_modifier.c
M       source/blender/makesrna/intern/rna_object.c
M       source/blender/makesrna/intern/rna_pose.c
M       source/blender/makesrna/intern/rna_space.c
M       source/blender/makesrna/intern/rna_userdef.c
M       source/blender/makesrna/intern/rna_wm.c
M       source/blender/makesrna/intern/rna_wm_api.c
M       source/blender/windowmanager/CMakeLists.txt
M       source/blender/windowmanager/WM_api.h
M       source/blender/windowmanager/WM_types.h
M       source/blender/windowmanager/intern/wm_event_system.c
M       source/blender/windowmanager/intern/wm_init_exit.c
M       source/blender/windowmanager/intern/wm_operators.c
A       source/blender/windowmanager/manipulators/WM_manipulator_api.h
A       source/blender/windowmanager/manipulators/WM_manipulator_library.h
A       source/blender/windowmanager/manipulators/WM_manipulator_types.h
A       
source/blender/windowmanager/manipulators/intern/manipulator_library/arrow2d_manipulator.c
A       
source/blender/windowmanager/manipulators/intern/manipulator_library/arrow_manipulator.c
A       
source/blender/windowmanager/manipulators/intern/manipulator_library/cage_manipulator.c
A       
source/blender/windowmanager/manipulators/intern/manipulator_library/dial_manipulator.c
A       
source/blender/windowmanager/manipulators/intern/manipulator_library/facemap_manipulator.c
A       
source/blender/windowmanager/manipulators/intern/manipulator_library/geom_arrow_manipulator.c
A       
source/blender/windowmanager/manipulators/intern/manipulator_library/geom_cube_manipulator.c
A       
source/blender/windowmanager/manipulators/intern/manipulator_library/geom_dial_manipulator.c
A       
source/blender/windowmanager/manipulators/intern/manipulator_library/manipulator_geometry.h
A       
source/blender/windowmanager/manipulators/intern/manipulator_library/manipulator_library_intern.h
A       
source/blender/windowmanager/manipulators/intern/manipulator_library/manipulator_library_utils.c
A       
source/blender/windowmanager/manipulators/intern/manipulator_library/primitive_manipulator.c
A       source/blender/windowmanager/manipulators/intern/wm_manipulator.c
A       source/blender/windowmanager/manipulators/intern/wm_manipulator_intern.h
A       source/blender/windowmanager/manipulators/intern/wm_manipulatorgroup.c
A       source/blender/windowmanager/manipulators/intern/wm_manipulatormap.c
A       source/blender/windowmanager/manipulators/wm_manipulator_wmapi.h
M       source/blender/windowmanager/wm.h
M       source/blender/windowmanager/wm_event_system.h
M       source/blender/windowmanager/wm_event_types.h
M       source/blenderplayer/bad_level_call_stubs/stubs.c
M       source/gameengine/Converter/BL_ArmatureObject.cpp

===================================================================

diff --git a/release/datafiles/widget_export.py 
b/release/datafiles/widget_export.py
new file mode 100644
index 0000000..c700f25
--- /dev/null
+++ b/release/datafiles/widget_export.py
@@ -0,0 +1,79 @@
+import bpy
+from bpy.types import Operator
+from bpy.props import StringProperty
+from bpy_extras.io_utils import ExportHelper
+
+def mesh_triangulate(me):
+    import bmesh
+    bm = bmesh.new()
+    bm.from_mesh(me)
+    bmesh.ops.triangulate(bm, faces=bm.faces)
+    bm.to_mesh(me)
+    bm.free()
+    
+
+class ExportWidget(Operator, ExportHelper):
+    """Export a widget mesh as a C file"""
+    bl_idname = "export_scene.widget"
+    bl_label = "Export Widget"
+    bl_options = {'PRESET', 'UNDO'}
+
+    filename_ext = ".c"
+    filter_glob = StringProperty(
+            default="*.c;",
+            options={'HIDDEN'},
+            )
+    @classmethod
+    def poll(cls, context):
+        obj = context.active_object
+        return (obj and obj.type == 'MESH')
+
+    def execute(self, context):
+        ob = context.active_object
+        scene = context.scene
+
+        try:
+            me = ob.to_mesh(scene, True, 'PREVIEW', calc_tessface=False)
+        except RuntimeError:
+            me = None
+
+        if me is None:
+            return {'CANCELLED'}
+
+        mesh_triangulate(me)
+
+        name = ob.name
+        f = open(self.filepath, 'w')
+        f.write("int _WIDGET_nverts_%s = %d;\n" % (name, len(me.vertices)))
+        f.write("int _WIDGET_ntris_%s = %d;\n\n" % (name, len(me.polygons)))
+        f.write("float _WIDGET_verts_%s[][3] = {\n" % name)
+        for v in me.vertices:
+            f.write("    {%.6f, %.6f, %.6f},\n" % v.co[:])            
+        f.write("};\n\n")
+        f.write("float _WIDGET_normals_%s[][3] = {\n" % name)
+        for v in me.vertices:
+            f.write("    {%.6f, %.6f, %.6f},\n" % v.normal[:])            
+        f.write("};\n\n")
+        f.write("unsigned short _WIDGET_indices_%s[] = {\n" % name)
+        for p in me.polygons:
+            f.write("    %d, %d, %d,\n" % p.vertices[:])            
+        f.write("};\n")
+        f.close()
+        
+        return {'FINISHED'}
+
+def menu_func_export(self, context):
+    self.layout.operator(ExportWidget.bl_idname, text="Widget (.c)")
+
+        
+def register():
+   bpy.utils.register_module(__name__)
+   bpy.types.INFO_MT_file_export.append(menu_func_export)
+
+
+def unregister():
+    bpy.utils.unregister_module(__name__)
+    bpy.types.INFO_MT_file_export.remove(menu_func_export)
+
+if __name__ == "__main__":
+    register()
diff --git a/release/scripts/modules/bpy_extras/keyconfig_utils.py 
b/release/scripts/modules/bpy_extras/keyconfig_utils.py
index a80b9df..fae335f 100644
--- a/release/scripts/modules/bpy_extras/keyconfig_utils.py
+++ b/release/scripts/modules/bpy_extras/keyconfig_utils.py
@@ -19,10 +19,40 @@
 # <pep8 compliant>
 
 # bpy.type.KeyMap: (km.name, km.space_type, km.region_type, [...])
+# Add (0, 0, 0, 0) as first element to skip adding "Foo (Global)" entry
 
 #    ('Script', 'EMPTY', 'WINDOW', []),
 
 
+# would be good to have a more generic way of doing this...
+KM_WIDGETS_HIERARCHY = [
+    # VIEW_3D
+    ('Widgets', 'EMPTY', 'WINDOW', [
+        (0, 0, 0, 0), # avoid adding 'Widgets (Global)" entry
+        ('Face Map Widgets', 'VIEW_3D', 'WINDOW', []),
+        ('Lamp Widgets', 'VIEW_3D', 'WINDOW', []),
+        ('Force Field Widgets', 'VIEW_3D', 'WINDOW', []),
+        ('Camera Widgets', 'VIEW_3D', 'WINDOW', []),
+        ('Manipulator Widgets', 'VIEW_3D', 'WINDOW', []),
+    ]),
+    # GRAPH_EDITOR
+    ('Widgets', 'EMPTY', 'WINDOW', [
+        (0, 0, 0, 0),
+        ('Backdrop Transform Widgets', 'GRAPH_EDITOR', 'WINDOW', []),
+    ]),
+    # NODE_EDITOR
+    ('Widgets', 'EMPTY', 'WINDOW', [
+        (0, 0, 0, 0),
+        ('Backdrop Transform Widgets', 'NODE_EDITOR', 'WINDOW', []),
+    ]),
+    # SEQUENCE_EDITOR
+    ('Widgets', 'EMPTY', 'WINDOW', [
+        (0, 0, 0, 0),
+        ('Backdrop Transform Widgets', 'SEQUENCE_EDITOR', 'WINDOW', []),
+        # ('Image Transform Widgets', 'SEQUENCE_EDITOR', 'WINDOW', []),
+    ]),
+]
+
 KM_HIERARCHY = [
     ('Window', 'EMPTY', 'WINDOW', []),  # file save, window change, exit
     ('Screen', 'EMPTY', 'WINDOW', [     # full screen, undo, screenshot
@@ -55,6 +85,8 @@ KM_HIERARCHY = [
 
         ('Particle', 'EMPTY', 'WINDOW', []),
 
+        KM_WIDGETS_HIERARCHY[0],
+
         ('Knife Tool Modal Map', 'EMPTY', 'WINDOW', []),
         ('Paint Stroke Modal', 'EMPTY', 'WINDOW', []),
         ('Paint Curve', 'EMPTY', 'WINDOW', []),
@@ -73,6 +105,7 @@ KM_HIERARCHY = [
 
     ('Graph Editor', 'GRAPH_EDITOR', 'WINDOW', [
         ('Graph Editor Generic', 'GRAPH_EDITOR', 'WINDOW', []),
+        KM_WIDGETS_HIERARCHY[1]
     ]),
     ('Dopesheet', 'DOPESHEET_EDITOR', 'WINDOW', [
         ('Dopesheet Generic', 'DOPESHEET_EDITOR', 'WINDOW', []),
@@ -94,10 +127,12 @@ KM_HIERARCHY = [
 
     ('Node Editor', 'NODE_EDITOR', 'WINDOW', [
         ('Node Generic', 'NODE_EDITOR', 'WINDOW', []),
+        KM_WIDGETS_HIERARCHY[2],
     ]),
     ('Sequencer', 'SEQUENCE_EDITOR', 'WINDOW', [
         ('SequencerCommon', 'SEQUENCE_EDITOR', 'WINDOW', []),
         ('SequencerPreview', 'SEQUENCE_EDITOR', 'WINDOW', []),
+        KM_WIDGETS_HIERARCHY[3],
     ]),
     ('Logic Editor', 'LOGIC_EDITOR', 'WINDOW', []),
 
diff --git a/release/scripts/modules/rna_keymap_ui.py 
b/release/scripts/modules/rna_keymap_ui.py
index 2ca7a79..93fbc59 100644
--- a/release/scripts/modules/rna_keymap_ui.py
+++ b/release/scripts/modules/rna_keymap_ui.py
@@ -64,6 +64,7 @@ def draw_entry(display_keymaps, entry, col, level=0):
 
 
 def draw_km(display_keymaps, kc, km, children, layout, level):
+    draw_global = children and children[0][0]; # first entry (0, 0, 0, 0) 
means we don't add "Global" entry
     km = km.active()
 
     layout.context_pointer_set("keymap", km)
@@ -85,7 +86,7 @@ def draw_km(display_keymaps, kc, km, children, layout, level):
         del subrow
 
     if km.show_expanded_children:
-        if children:
+        if draw_global:
             # Put the Parent key map's entries in a 'global' sub-category
             # equal in hierarchy to the other children categories
             subcol = _indented_layout(col, level + 1)
@@ -101,13 +102,14 @@ def draw_km(display_keymaps, kc, km, children, layout, 
level):
             for kmi in km.keymap_items:
                 draw_kmi(display_keymaps, kc, km, kmi, col, kmi_level)
 
-            # "Add New" at end of keymap item list
-            subcol = _indented_layout(col, kmi_level)
-            subcol = subcol.split(percentage=0.2).column()
-            subcol.operator("wm.keyitem_add", text="Add New", 
text_ctxt=i18n_contexts.id_windowmanager,
-                            icon='ZOOMIN')
+            if draw_global:
+                # "Add New" at end of keymap item list
+                subcol = _indented_layout(col, kmi_level)
+                subcol = subcol.split(percentage=0.2).column()
+                subcol.operator("wm.keyitem_add", text="Add New", 
text_ctxt=i18n_contexts.id_windowmanager,
+                                icon='ZOOMIN')
 
-            col.separator()
+                col.separator()
 
         # Child key maps
         if children:
diff --git a/release/scripts/startup/bl_ui/properties_data_bone.py 
b/release/scripts/startup/bl_ui/properties_data_bone.py
index 3a54755..edcae34 100644
--- a/release/scripts/startup/bl_ui/properties_data_bone.py
+++ b/release/scripts/startup/bl_ui/properties_data_bone.py
@@ -268,6 +268,33 @@ class BONE_PT_relations(BoneButtonsPanel, Panel):
         sub.prop(bone, "use_local_location")
 
 
+class BONE_PT_facemaps(BoneButtonsPanel, Panel):
+    bl_label = "Face Maps"
+
+    @classmethod
+    def poll(cls, context):
+        return context.object and context.bone
+
+    def draw(self, context):
+        layout = self.layout
+
+        ob = context.object
+        bone = context.bone
+        pchan = ob.pose.bones[bone.name]
+
+        col = layout.column()
+        col.prop(pchan, "facemap_object", text="Object")
+
+        col = layout.column()
+        if pchan.facemap_object:
+            col.prop_search(pchan, "facemap", pchan.facemap_object, 
"face_maps")
+        else:
+            # ugly, used to add inactive search field since prop_search
+            # doesn't support passing pchan.facemap_object if it's unset
+            col.enabled = False
+            col.prop(pchan, "facemap")
+
+
 class BONE_PT_display(BoneButtonsPanel, Panel):
     bl_label = "Display"
 
@@ -295,6 +322,9 @@ class BONE_PT_display(BoneButtonsPanel, Panel):
             col = split.column()
             col.prop(bone, "hide", text="Hide")
             sub = col.column()
+            sub.active = bool(pchan and pchan.facemap)
+            sub.prop(bone, "fmap_only")
+            sub = col.column()
             sub.active = bool(pchan and pchan.custom_shape)
             sub.prop(bone, "show_wire", text="Wireframe")
 
diff --git a/release/scripts/startup/bl_ui/properties_data_mesh.py 
b/release/scripts/startup/bl_ui/properties_data_mesh.py
index 5416735..d573582 100644
--- a/release/scripts/startup/bl_ui/properties_data_mesh.py
+++ b/release/scripts/startup/bl_ui/properties_data_mesh.py
@@ -75,6 +75,17 @@ class MESH_UL_vgroups(UIList):
             layout.label(text="", icon_value=icon)
 
 
+class MESH_UL_fmaps(UIList):
+    def draw_item(self, context, layout, data, item, icon, active_data, 
active_propname, index):
+        # assert(isinstance(item, bpy.types.VertexGroup))
+        fmap = item
+        if self.layout_type in {'DEFAULT', 'COMPACT'}:
+            layout.prop(fmap, "name", text="", emboss=False, icon_value=icon)
+        elif self.layout_type in {'GRID'}:
+            layout.alignment = 'CENTER'
+            layout.label(text="", icon_value=icon)
+
+
 class MESH_UL_shape_keys(UIList):
     def draw_item(self, context, layout, data, item, icon, active_data, 
active_propname, index):
         # assert(isinstance(item, bpy.types.ShapeKey))
@@ -226,6 +237,47 @@ class DATA_PT_vertex_groups(MeshButtonsPanel, Panel):
             layout.prop(context.tool_settings, "vertex_group_weight", 
text="Weight")
 
 
+class DATA_PT_fac

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to