Revision: 21583
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=21583
Author:   blendix
Date:     2009-07-14 19:59:26 +0200 (Tue, 14 Jul 2009)

Log Message:
-----------
2.5: Armature

* Bone Transform panel now works, using appropriate EditBone or
  PoseChannel properties.
* Bone name and parent are now editable.
* Some other tweaks to the UI layouts for Armature and Bone.
* Notifiers for armature/editbone properties.

Modified Paths:
--------------
    branches/blender2.5/blender/release/ui/buttons_data_armature.py
    branches/blender2.5/blender/release/ui/buttons_data_bone.py
    branches/blender2.5/blender/source/blender/editors/armature/editarmature.c
    branches/blender2.5/blender/source/blender/editors/armature/poseobject.c
    branches/blender2.5/blender/source/blender/editors/include/ED_armature.h
    
branches/blender2.5/blender/source/blender/editors/space_buttons/buttons_context.c
    branches/blender2.5/blender/source/blender/editors/space_outliner/outliner.c
    
branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_buttons.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_armature.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_pose.c

Modified: branches/blender2.5/blender/release/ui/buttons_data_armature.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_data_armature.py     
2009-07-14 17:35:07 UTC (rev 21582)
+++ branches/blender2.5/blender/release/ui/buttons_data_armature.py     
2009-07-14 17:59:26 UTC (rev 21583)
@@ -42,11 +42,12 @@
 
 
                if arm:
-                       layout.itemR(arm, "rest_position")
-
                        split = layout.split()
 
-                       sub = split.column()
+                       col = split.column()
+                       col.itemR(arm, "rest_position")
+
+                       sub = col.column()
                        sub.itemL(text="Deform:")
                        sub.itemR(arm, "deform_vertexgroups", text="Vertes 
Groups")
                        sub.itemR(arm, "deform_envelope", text="Envelopes")
@@ -69,17 +70,14 @@
                layout = self.layout
                arm = context.armature
 
-               split = layout.split()
+               layout.row().itemR(arm, "drawtype", expand=True)
 
-               sub = split.column()
-               sub.itemR(arm, "drawtype", text="Style")
-               sub.itemR(arm, "delay_deform", text="Delay Refresh")
-
-               sub = split.column()
+               sub = layout.column_flow()
                sub.itemR(arm, "draw_names", text="Names")
                sub.itemR(arm, "draw_axes", text="Axes")
                sub.itemR(arm, "draw_custom_bone_shapes", text="Shapes")
                sub.itemR(arm, "draw_group_colors", text="Colors")
+               sub.itemR(arm, "delay_deform", text="Delay Refresh")
 
 class DATA_PT_paths(DataButtonsPanel):
        __idname__ = "DATA_PT_paths"
@@ -93,14 +91,15 @@
                
                sub = split.column()
                sub.itemR(arm, "paths_show_around_current_frame", text="Around 
Frame")
+               col = sub.column(align=True)
                if (arm.paths_show_around_current_frame):
-                       sub.itemR(arm, "path_before_current", text="Before")
-                       sub.itemR(arm, "path_after_current", text="After")
+                       col.itemR(arm, "path_before_current", text="Before")
+                       col.itemR(arm, "path_after_current", text="After")
                else:
-                       sub.itemR(arm, "path_start_frame", text="Start")
-                       sub.itemR(arm, "path_end_frame", text="End")
+                       col.itemR(arm, "path_start_frame", text="Start")
+                       col.itemR(arm, "path_end_frame", text="End")
 
-               sub.itemR(arm, "path_size", text="Step")        
+               col.itemR(arm, "path_size", text="Step")        
                sub.itemR(arm, "paths_calculate_head_positions", text="Head")
                
                sub = split.column()
@@ -121,13 +120,15 @@
 
                sub = split.column()
                sub.itemR(arm, "ghost_type", text="Scope")
+
+               col = sub.column(align=True)
                if arm.ghost_type == 'RANGE':
-                       sub.itemR(arm, "ghost_start_frame", text="Start")
-                       sub.itemR(arm, "ghost_end_frame", text="End")
-                       sub.itemR(arm, "ghost_size", text="Step")
+                       col.itemR(arm, "ghost_start_frame", text="Start")
+                       col.itemR(arm, "ghost_end_frame", text="End")
+                       col.itemR(arm, "ghost_size", text="Step")
                elif arm.ghost_type == 'CURRENT_FRAME':
-                       sub.itemR(arm, "ghost_step", text="Range")
-                       sub.itemR(arm, "ghost_size", text="Step")
+                       col.itemR(arm, "ghost_step", text="Range")
+                       col.itemR(arm, "ghost_size", text="Step")
 
                sub = split.column()
                sub.itemR(arm, "ghost_only_selected", text="Selected Only")

Modified: branches/blender2.5/blender/release/ui/buttons_data_bone.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_data_bone.py 2009-07-14 
17:35:07 UTC (rev 21582)
+++ branches/blender2.5/blender/release/ui/buttons_data_bone.py 2009-07-14 
17:59:26 UTC (rev 21583)
@@ -23,23 +23,52 @@
                split.itemL(text="", icon="ICON_BONE_DATA")
                split.itemR(bone, "name", text="")
 
-class BONE_PT_transform_bone(BoneButtonsPanel):
-       __idname__ = "BONE_PT_transform_bone"
+class BONE_PT_transform(BoneButtonsPanel):
+       __idname__ = "BONE_PT_transform"
        __label__ = "Transform"
 
        def draw(self, context):
                layout = self.layout
+               ob = context.object
                bone = context.bone
+
                if not bone:
                        bone = context.edit_bone
 
-#Seems to be missing from RNA?
-               row = layout.row()
-               row.column().itemR(bone, "location")
-               row.column().itemR(bone, "rotation")
-               row.column().itemR(bone, "scale")
+                       row = layout.row()
+                       row.column().itemR(bone, "head")
+                       row.column().itemR(bone, "tail")
 
+                       col = row.column()
+                       sub = col.column(align=True)
+                       sub.itemL(text="Roll:")
+                       sub.itemR(bone, "roll", text="")
+                       sub.itemL()
+                       sub.itemR(bone, "locked")
+                       sub.itemS()
+               else:
+                       pchan = ob.pose.pose_channels[context.bone.name]
 
+                       layout.itemR(pchan, "rotation_mode")
+
+                       row = layout.row()
+                       col = row.column()
+                       col.itemR(pchan, "location")
+                       col.active = not (bone.parent and bone.connected)
+
+                       col = row.column()
+                       if pchan.rotation_mode == 'QUATERNION':
+                               col.itemR(pchan, "rotation", text="Rotation")
+                       else:
+                               col.itemR(pchan, "euler_rotation", 
text="Rotation")
+
+                       row.column().itemR(pchan, "scale")
+
+                       if pchan.rotation_mode == 'QUATERNION':
+                               col = layout.column(align=True)
+                               col.itemL(text="Euler:")
+                               col.row().itemR(pchan, "euler_rotation", 
text="")
+
 class BONE_PT_bone(BoneButtonsPanel):
        __idname__ = "BONE_PT_bone"
        __label__ = "Bone"
@@ -48,14 +77,21 @@
        def draw(self, context):
                layout = self.layout
                bone = context.bone
+               arm = context.armature
                if not bone:
                        bone = context.edit_bone
 
                split = layout.split()
 
                sub = split.column()
-               sub.itemR(bone, "parent")
-               sub.itemR(bone, "connected")
+               sub.itemL(text="Parent:")
+               if context.bone:
+                       sub.itemR(bone, "parent", text="")
+               else:
+                       sub.item_pointerR(bone, "parent", arm, "edit_bones", 
text="")
+               row = sub.row()
+               row.itemR(bone, "connected")
+               row.active = bone.parent != None
 
                sub.itemL(text="Layers:")
                sub.template_layers(bone, "layer")
@@ -70,8 +106,6 @@
                sub.itemR(bone, "draw_wire", text="Wireframe")
                sub.itemR(bone, "hidden", text="Hide")
 
-
-               
 class BONE_PT_deform(BoneButtonsPanel):
        __idname__ = "BONE_PT_deform"
        __label__ = "Deform"
@@ -94,22 +128,30 @@
                        
                split = layout.split()
 
-               sub = split.column()
-               sub.itemL(text="Envelope:")
+               col = split.column()
+               col.itemL(text="Envelope:")
+               sub = col.column(align=True)
                sub.itemR(bone, "envelope_distance", text="Distance")
                sub.itemR(bone, "envelope_weight", text="Weight")
-               sub.itemR(bone, "multiply_vertexgroup_with_envelope", 
text="Multiply")
-               sub = split.column()
-               
-               sub.itemL(text="Curved Bones:")
+               col.itemR(bone, "multiply_vertexgroup_with_envelope", 
text="Multiply")
+
+               sub = col.column(align=True)
+               sub.itemL(text="Radius:")
+               sub.itemR(bone, "head_radius", text="Head")
+               sub.itemR(bone, "tail_radius", text="Tail")
+
+               col = split.column()
+               col.itemL(text="Curved Bones:")
+               sub = col.column(align=True)
                sub.itemR(bone, "bbone_segments", text="Segments")
                sub.itemR(bone, "bbone_in", text="Ease In")
                sub.itemR(bone, "bbone_out", text="Ease Out")
                
-               sub.itemR(bone, "cyclic_offset")
+               col.itemL(text="Offset:")
+               col.itemR(bone, "cyclic_offset")
 
-
 bpy.types.register(BONE_PT_context_bone)
-bpy.types.register(BONE_PT_transform_bone)
+bpy.types.register(BONE_PT_transform)
 bpy.types.register(BONE_PT_bone)
 bpy.types.register(BONE_PT_deform)
+

Modified: 
branches/blender2.5/blender/source/blender/editors/armature/editarmature.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/armature/editarmature.c  
2009-07-14 17:35:07 UTC (rev 21582)
+++ branches/blender2.5/blender/source/blender/editors/armature/editarmature.c  
2009-07-14 17:59:26 UTC (rev 21583)
@@ -5095,9 +5095,9 @@
 /* called by UI for renaming a bone */
 /* warning: make sure the original bone was not renamed yet! */
 /* seems messy, but thats what you get with not using pointers but channel 
names :) */
-void armature_bone_rename(Object *ob, char *oldnamep, char *newnamep)
+void ED_armature_bone_rename(bArmature *arm, char *oldnamep, char *newnamep)
 {
-       bArmature *arm= ob->data;
+       Object *ob;
        char newname[MAXBONENAME];
        char oldname[MAXBONENAME];
        
@@ -5242,7 +5242,7 @@
                        if (ebone->flag & BONE_SELECTED) {
                                BLI_strncpy(newname, ebone->name, 
sizeof(newname));
                                bone_flip_name(newname, 1);             // 1 = 
do strip off number extensions
-                               armature_bone_rename(obedit, ebone->name, 
newname);
+                               ED_armature_bone_rename(arm, ebone->name, 
newname);
                        }
                }
        }
@@ -5263,7 +5263,7 @@
                        if (ebone->flag & BONE_SELECTED) {
                                BLI_strncpy(newname, ebone->name, 
sizeof(newname));
                                bone_autoside_name(newname, 1, axis, 
ebone->head[axis], ebone->tail[axis]);
-                               armature_bone_rename(obedit, ebone->name, 
newname);
+                               ED_armature_bone_rename(arm, ebone->name, 
newname);
                        }
                }
        }

Modified: 
branches/blender2.5/blender/source/blender/editors/armature/poseobject.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/armature/poseobject.c    
2009-07-14 17:35:07 UTC (rev 21582)
+++ branches/blender2.5/blender/source/blender/editors/armature/poseobject.c    
2009-07-14 17:59:26 UTC (rev 21583)
@@ -1346,7 +1346,7 @@
                        if(pchan->bone->flag & (BONE_ACTIVE|BONE_SELECTED)) {
                                BLI_strncpy(newname, pchan->name, 
sizeof(newname));
                                bone_flip_name(newname, 1);     // 1 = do strip 
off number extensions
-                               armature_bone_rename(ob, pchan->name, newname);
+                               ED_armature_bone_rename(arm, pchan->name, 
newname);
                        }
                }
        }
@@ -1375,7 +1375,7 @@
                        if(pchan->bone->flag & (BONE_ACTIVE|BONE_SELECTED)) {
                                BLI_strncpy(newname, pchan->name, 
sizeof(newname));
                                bone_autoside_name(newname, 1, axis, 
pchan->bone->head[axis], pchan->bone->tail[axis]);
-                               armature_bone_rename(ob, pchan->name, newname);
+                               ED_armature_bone_rename(arm, pchan->name, 
newname);
                        }
                }
        }

Modified: 
branches/blender2.5/blender/source/blender/editors/include/ED_armature.h
===================================================================
--- branches/blender2.5/blender/source/blender/editors/include/ED_armature.h    
2009-07-14 17:35:07 UTC (rev 21582)
+++ branches/blender2.5/blender/source/blender/editors/include/ED_armature.h    
2009-07-14 17:59:26 UTC (rev 21583)
@@ -116,7 +116,7 @@
 
 void auto_align_armature(struct Scene *scene, struct View3D *v3d, short mode);
 void unique_editbone_name(struct ListBase *ebones, char *name, EditBone 
*bone); /* if bone is already in list, pass it as param to ignore it */
-void armature_bone_rename(struct Object *ob, char *oldnamep, char *newnamep);
+void ED_armature_bone_rename(struct bArmature *arm, char *oldnamep, char 
*newnamep);
 
 void undo_push_armature(struct bContext *C, char *name);
 

Modified: 
branches/blender2.5/blender/source/blender/editors/space_buttons/buttons_context.c

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to