Page Menu
Home
Search
Configure Global Search
Log In
Files
F11156
armaturelayers.patch
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Authored By
Shane Ambler (sambler)
Nov 13 2013, 2:21 PM
Size
6 KB
Subscribers
None
armaturelayers.patch
View Options
Index: source/blender/editors/armature/armature_ops.c
===================================================================
--- source/blender/editors/armature/armature_ops.c (revision 31430)
+++ source/blender/editors/armature/armature_ops.c (working copy)
@@ -84,7 +84,10 @@
WM_operatortype_append(ARMATURE_OT_armature_layers);
WM_operatortype_append(ARMATURE_OT_bone_layers);
-
+ WM_operatortype_append(ARMATURE_OT_show_all_bone_layers);
+ WM_operatortype_append(ARMATURE_OT_show_all_protected_layers);
+ WM_operatortype_append(ARMATURE_OT_show_no_protected_layers);
+
/* SKETCH */
WM_operatortype_append(SKETCH_OT_gesture);
WM_operatortype_append(SKETCH_OT_delete);
Index: source/blender/editors/armature/armature_intern.h
===================================================================
--- source/blender/editors/armature/armature_intern.h (revision 31430)
+++ source/blender/editors/armature/armature_intern.h (working copy)
@@ -78,6 +78,9 @@
void ARMATURE_OT_armature_layers(struct wmOperatorType *ot);
void ARMATURE_OT_bone_layers(struct wmOperatorType *ot);
+void ARMATURE_OT_show_all_bone_layers(struct wmOperatorType *ot);
+void ARMATURE_OT_show_all_protected_layers(struct wmOperatorType *ot);
+void ARMATURE_OT_show_no_protected_layers(struct wmOperatorType *ot);
/* ******************************************************* */
/* Pose-Mode Operators */
Index: source/blender/editors/armature/poseobject.c
===================================================================
--- source/blender/editors/armature/poseobject.c (revision 31430)
+++ source/blender/editors/armature/poseobject.c (working copy)
@@ -1593,6 +1593,10 @@
PointerRNA ptr;
int layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
+ /* sanity checking */
+ if (arm == NULL)
+ return OPERATOR_CANCELLED;
+
/* get the values set in the operator properties */
RNA_boolean_get_array(op->ptr, "layers", layers);
@@ -1645,6 +1649,124 @@
RNA_def_boolean_layer_member(ot->srna, "layers", 32, NULL, "Layer", "Armature layers to make visible");
}
+/* change visiblilty of all armature layers */
+static int armature_all_layers_on_exec (bContext *C, wmOperator *op)
+{
+ Object *ob= CTX_data_active_object(C);
+ bArmature *arm= (ob)? ob->data : NULL;
+ PointerRNA ptr;
+ int x, layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
+
+ /* sanity checking */
+ if (arm == NULL)
+ return OPERATOR_CANCELLED;
+
+ for(x=0;x<32;x++)
+ layers[x]=1;
+
+ /* get pointer for armature, and write data there... */
+ RNA_id_pointer_create((ID *)arm, &ptr);
+ RNA_boolean_set_array(&ptr, "layer", layers);
+
+ /* note, notifier might evolve */
+ WM_event_add_notifier(C, NC_OBJECT|ND_POSE, ob);
+
+ return OPERATOR_FINISHED;
+}
+
+void ARMATURE_OT_show_all_bone_layers (wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Turn All Armature Layers On";
+ ot->idname= "ARMATURE_OT_show_all_bone_layers";
+ ot->description= "Make all armature layers visible";
+
+ /* callbacks */
+ ot->exec= armature_all_layers_on_exec;
+ ot->poll= ED_operator_editarmature;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+
+static int armature_all_proxy_layers_on_exec (bContext *C, wmOperator *op)
+{
+ Object *ob= CTX_data_active_object(C);
+ bArmature *arm= (ob)? ob->data : NULL;
+ PointerRNA ptr;
+ int x, layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
+
+ /* sanity checking */
+ if (arm == NULL)
+ return OPERATOR_CANCELLED;
+
+ for(x=0;x<32;x++)
+ layers[x]=1;
+
+ /* get pointer for armature, and write data there... */
+ RNA_id_pointer_create((ID *)arm, &ptr);
+ RNA_boolean_set_array(&ptr, "layer_protection", layers);
+
+ /* note, notifier might evolve */
+ WM_event_add_notifier(C, NC_OBJECT|ND_POSE, ob);
+
+ return OPERATOR_FINISHED;
+}
+
+void ARMATURE_OT_show_all_protected_layers (wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Turn All Protected Armature Layers On";
+ ot->idname= "ARMATURE_OT_show_all_protected_layers";
+ ot->description= "Make all armature protected layers visible";
+
+ /* callbacks */
+ ot->exec= armature_all_proxy_layers_on_exec;
+ ot->poll= ED_operator_editarmature;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+
+static int armature_all_proxy_layers_off_exec (bContext *C, wmOperator *op)
+{
+ Object *ob= CTX_data_active_object(C);
+ bArmature *arm= (ob)? ob->data : NULL;
+ PointerRNA ptr;
+ int x, layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
+
+ /* sanity checking */
+ if (arm == NULL)
+ return OPERATOR_CANCELLED;
+
+ for(x=0;x<32;x++)
+ layers[x]=0;
+
+ /* get pointer for armature, and write data there... */
+ RNA_id_pointer_create((ID *)arm, &ptr);
+ RNA_boolean_set_array(&ptr, "layer_protection", layers);
+
+ /* note, notifier might evolve */
+ WM_event_add_notifier(C, NC_OBJECT|ND_POSE, ob);
+
+ return OPERATOR_FINISHED;
+}
+
+void ARMATURE_OT_show_no_protected_layers (wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Turn All Protected Armature Layers Off";
+ ot->idname= "ARMATURE_OT_show_no_protected_layers";
+ ot->description= "Make all armature protected layers invisible";
+
+ /* callbacks */
+ ot->exec= armature_all_proxy_layers_off_exec;
+ ot->poll= ED_operator_editarmature;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+
/* ------------------- */
/* Present a popup to get the layers that should be used */
Index: source/blender/editors/interface/interface_handlers.c
===================================================================
--- source/blender/editors/interface/interface_handlers.c (revision 31430)
+++ source/blender/editors/interface/interface_handlers.c (working copy)
@@ -4115,6 +4115,20 @@
uiItemS(layout);
+ /* add layer visibility options to the bone layers menu */
+ if( strcmp(name, "Visible Layers")==0 )
+ {
+ uiItemO(layout, "Turn All Bone Layers On", 0, "ARMATURE_OT_show_all_bone_layers");
+ uiItemS(layout);
+ }
+
+ if( strcmp(name, "Layer Proxy Protection")==0 )
+ {
+ uiItemO(layout, "Turn All Protected Layers On", 0, "ARMATURE_OT_show_all_protected_layers");
+ uiItemO(layout, "Turn All Protected Layers Off", 0, "ARMATURE_OT_show_no_protected_layers");
+ uiItemS(layout);
+ }
+
/* Property Operators */
//Copy Property Value
File Metadata
Details
Mime Type
text/x-diff
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
ad/36/7974410efd8aa60f4e5398e3dbb0
Event Timeline
Log In to Comment