Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_outliner/outliner_draw.c
| Show First 20 Lines • Show All 172 Lines • ▼ Show 20 Lines | static void restrictbutton_recursive_bone(Bone *bone_parent, int flag, bool set_flag) | ||||
| } | } | ||||
| } | } | ||||
| static void restrictbutton_r_lay_cb(bContext *C, void *poin, void *UNUSED(poin2)) | static void restrictbutton_r_lay_cb(bContext *C, void *poin, void *UNUSED(poin2)) | ||||
| { | { | ||||
| WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, poin); | WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, poin); | ||||
| } | } | ||||
| static void restrictbutton_bone_visibility_cb(bContext *C, void *poin, void *poin2) | static void restrictbutton_bone_visibility_cb(bContext *C, void *poin, void *UNUSED(poin2)) | ||||
| { | { | ||||
| bArmature *arm = (bArmature *)poin; | Bone *bone = (Bone *)poin; | ||||
| Bone *bone = (Bone *)poin2; | |||||
| if (bone->flag & BONE_HIDDEN_P) { | |||||
| bone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL); | |||||
| } | |||||
| if (CTX_wm_window(C)->eventstate->ctrl) { | if (CTX_wm_window(C)->eventstate->ctrl) { | ||||
| restrictbutton_recursive_bone(bone, BONE_HIDDEN_P, (bone->flag & BONE_HIDDEN_P) != 0); | restrictbutton_recursive_bone(bone, BONE_HIDDEN_P, (bone->flag & BONE_HIDDEN_P) != 0); | ||||
| } | } | ||||
| WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL); | |||||
| DEG_id_tag_update(&arm->id, ID_RECALC_COPY_ON_WRITE); | |||||
| } | } | ||||
| static void restrictbutton_bone_select_cb(bContext *C, void *UNUSED(poin), void *poin2) | static void restrictbutton_bone_select_cb(bContext *C, void *UNUSED(poin), void *poin2) | ||||
| { | { | ||||
| Bone *bone = (Bone *)poin2; | Bone *bone = (Bone *)poin2; | ||||
| if (bone->flag & BONE_UNSELECTABLE) { | if (bone->flag & BONE_UNSELECTABLE) { | ||||
| bone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL); | bone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 651 Lines • ▼ Show 20 Lines | typedef struct RestrictProperties { | ||||
| PropertyRNA *object_hide_viewport, *object_hide_select, *object_hide_render; | PropertyRNA *object_hide_viewport, *object_hide_select, *object_hide_render; | ||||
| PropertyRNA *base_hide_viewport; | PropertyRNA *base_hide_viewport; | ||||
| PropertyRNA *collection_hide_viewport, *collection_hide_select, *collection_hide_render; | PropertyRNA *collection_hide_viewport, *collection_hide_select, *collection_hide_render; | ||||
| PropertyRNA *layer_collection_holdout, *layer_collection_indirect_only, | PropertyRNA *layer_collection_holdout, *layer_collection_indirect_only, | ||||
| *layer_collection_hide_viewport; | *layer_collection_hide_viewport; | ||||
| PropertyRNA *modifier_show_viewport, *modifier_show_render; | PropertyRNA *modifier_show_viewport, *modifier_show_render; | ||||
| PropertyRNA *constraint_enable; | PropertyRNA *constraint_enable; | ||||
| PropertyRNA *bone_hide_viewport; | |||||
| } RestrictProperties; | } RestrictProperties; | ||||
| /* We don't care about the value of the property | /* We don't care about the value of the property | ||||
| * but whether the property should be active or grayed out. */ | * but whether the property should be active or grayed out. */ | ||||
| typedef struct RestrictPropertiesActive { | typedef struct RestrictPropertiesActive { | ||||
| bool object_hide_viewport; | bool object_hide_viewport; | ||||
| bool object_hide_select; | bool object_hide_select; | ||||
| bool object_hide_render; | bool object_hide_render; | ||||
| bool base_hide_viewport; | bool base_hide_viewport; | ||||
| bool collection_hide_viewport; | bool collection_hide_viewport; | ||||
| bool collection_hide_select; | bool collection_hide_select; | ||||
| bool collection_hide_render; | bool collection_hide_render; | ||||
| bool layer_collection_holdout; | bool layer_collection_holdout; | ||||
| bool layer_collection_indirect_only; | bool layer_collection_indirect_only; | ||||
| bool layer_collection_hide_viewport; | bool layer_collection_hide_viewport; | ||||
| bool modifier_show_viewport; | bool modifier_show_viewport; | ||||
| bool modifier_show_render; | bool modifier_show_render; | ||||
| bool constraint_enable; | bool constraint_enable; | ||||
| bool bone_hide_viewport; | |||||
| } RestrictPropertiesActive; | } RestrictPropertiesActive; | ||||
| static void outliner_restrict_properties_enable_collection_set( | static void outliner_restrict_properties_enable_collection_set( | ||||
| PointerRNA *collection_ptr, RestrictProperties *props, RestrictPropertiesActive *props_active) | PointerRNA *collection_ptr, RestrictProperties *props, RestrictPropertiesActive *props_active) | ||||
| { | { | ||||
| if (props_active->collection_hide_render) { | if (props_active->collection_hide_render) { | ||||
| props_active->collection_hide_render = !RNA_property_boolean_get( | props_active->collection_hide_render = !RNA_property_boolean_get( | ||||
| collection_ptr, props->collection_hide_render); | collection_ptr, props->collection_hide_render); | ||||
| ▲ Show 20 Lines • Show All 118 Lines • ▼ Show 20 Lines | props.layer_collection_indirect_only = RNA_struct_type_find_property(&RNA_LayerCollection, | ||||
| "indirect_only"); | "indirect_only"); | ||||
| props.layer_collection_hide_viewport = RNA_struct_type_find_property(&RNA_LayerCollection, | props.layer_collection_hide_viewport = RNA_struct_type_find_property(&RNA_LayerCollection, | ||||
| "hide_viewport"); | "hide_viewport"); | ||||
| props.modifier_show_viewport = RNA_struct_type_find_property(&RNA_Modifier, "show_viewport"); | props.modifier_show_viewport = RNA_struct_type_find_property(&RNA_Modifier, "show_viewport"); | ||||
| props.modifier_show_render = RNA_struct_type_find_property(&RNA_Modifier, "show_render"); | props.modifier_show_render = RNA_struct_type_find_property(&RNA_Modifier, "show_render"); | ||||
| props.constraint_enable = RNA_struct_type_find_property(&RNA_Constraint, "mute"); | props.constraint_enable = RNA_struct_type_find_property(&RNA_Constraint, "mute"); | ||||
| props.bone_hide_viewport = RNA_struct_type_find_property(&RNA_Bone, "hide"); | |||||
| props.initialized = true; | props.initialized = true; | ||||
| } | } | ||||
| struct { | struct { | ||||
| int select; | int select; | ||||
| int hide; | int hide; | ||||
| int viewport; | int viewport; | ||||
| int render; | int render; | ||||
| ▲ Show 20 Lines • Show All 252 Lines • ▼ Show 20 Lines | if (te->ys + 2 * UI_UNIT_Y >= region->v2d.cur.ymin && te->ys <= region->v2d.cur.ymax) { | ||||
| NULL); | NULL); | ||||
| UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); | UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); | ||||
| if (!props_active.modifier_show_render) { | if (!props_active.modifier_show_render) { | ||||
| UI_but_flag_enable(bt, UI_BUT_INACTIVE); | UI_but_flag_enable(bt, UI_BUT_INACTIVE); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| else if (tselem->type == TSE_POSE_CHANNEL) { | else if (tselem->type == TSE_POSE_CHANNEL) { | ||||
| PointerRNA ptr; | |||||
| bPoseChannel *pchan = (bPoseChannel *)te->directdata; | bPoseChannel *pchan = (bPoseChannel *)te->directdata; | ||||
| Bone *bone = pchan->bone; | Bone *bone = pchan->bone; | ||||
| Object *ob = (Object *)tselem->id; | Object *ob = (Object *)tselem->id; | ||||
| bArmature *arm = ob->data; | |||||
| RNA_pointer_create(&arm->id, &RNA_Bone, bone, &ptr); | |||||
| if (soops->show_restrict_flags & SO_RESTRICT_VIEWPORT) { | if (soops->show_restrict_flags & SO_RESTRICT_VIEWPORT) { | ||||
| bt = uiDefIconButBitI(block, | bt = uiDefIconButR_prop(block, | ||||
| UI_BTYPE_ICON_TOGGLE, | UI_BTYPE_ICON_TOGGLE, | ||||
| BONE_HIDDEN_P, | |||||
| 0, | 0, | ||||
| ICON_RESTRICT_VIEW_OFF, | 0, | ||||
| (int)(region->v2d.cur.xmax - restrict_offsets.viewport), | (int)(region->v2d.cur.xmax - restrict_offsets.viewport), | ||||
| te->ys, | te->ys, | ||||
| UI_UNIT_X, | UI_UNIT_X, | ||||
| UI_UNIT_Y, | UI_UNIT_Y, | ||||
| &(bone->flag), | &ptr, | ||||
| 0, | props.bone_hide_viewport, | ||||
| 0, | -1, | ||||
| 0, | 0, | ||||
| 0, | 0, | ||||
| -1, | |||||
| -1, | |||||
| TIP_("Restrict visibility in the 3D View")); | TIP_("Restrict visibility in the 3D View")); | ||||
| UI_but_func_set(bt, restrictbutton_bone_visibility_cb, ob->data, bone); | UI_but_func_set(bt, restrictbutton_bone_visibility_cb, bone, NULL); | ||||
| UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); | UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); | ||||
| UI_but_drawflag_enable(bt, UI_BUT_ICON_REVERSE); | UI_but_drawflag_enable(bt, UI_BUT_ICON_REVERSE); | ||||
| } | } | ||||
| if (soops->show_restrict_flags & SO_RESTRICT_SELECT) { | if (soops->show_restrict_flags & SO_RESTRICT_SELECT) { | ||||
| bt = uiDefIconButBitI(block, | bt = uiDefIconButBitI(block, | ||||
| UI_BTYPE_ICON_TOGGLE, | UI_BTYPE_ICON_TOGGLE, | ||||
| BONE_UNSELECTABLE, | BONE_UNSELECTABLE, | ||||
| ▲ Show 20 Lines • Show All 2,420 Lines • Show Last 20 Lines | |||||