Changeset View
Changeset View
Standalone View
Standalone View
source/blender/gpencil_modifiers/intern/MOD_gpencilhook.c
| Show First 20 Lines • Show All 350 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| HookGpencilModifierData *mmd = (HookGpencilModifierData *)md; | HookGpencilModifierData *mmd = (HookGpencilModifierData *)md; | ||||
| walk(userData, ob, (ID **)&mmd->material, IDWALK_CB_USER); | walk(userData, ob, (ID **)&mmd->material, IDWALK_CB_USER); | ||||
| foreachObjectLink(md, ob, (ObjectWalkFunc)walk, userData); | foreachObjectLink(md, ob, (ObjectWalkFunc)walk, userData); | ||||
| } | } | ||||
| static void panel_draw(const bContext *C, Panel *panel) | static void panel_draw(const bContext *UNUSED(C), Panel *panel) | ||||
| { | { | ||||
| uiLayout *sub, *row, *col; | uiLayout *sub, *row, *col; | ||||
| uiLayout *layout = panel->layout; | uiLayout *layout = panel->layout; | ||||
| PointerRNA ptr; | |||||
| PointerRNA ob_ptr; | PointerRNA ob_ptr; | ||||
| gpencil_modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); | PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, &ob_ptr); | ||||
| PointerRNA hook_object_ptr = RNA_pointer_get(&ptr, "object"); | PointerRNA hook_object_ptr = RNA_pointer_get(ptr, "object"); | ||||
| bool has_vertex_group = RNA_string_length(&ptr, "vertex_group") != 0; | bool has_vertex_group = RNA_string_length(ptr, "vertex_group") != 0; | ||||
| uiLayoutSetPropSep(layout, true); | uiLayoutSetPropSep(layout, true); | ||||
| col = uiLayoutColumn(layout, false); | col = uiLayoutColumn(layout, false); | ||||
| uiItemR(col, &ptr, "object", 0, NULL, ICON_NONE); | uiItemR(col, ptr, "object", 0, NULL, ICON_NONE); | ||||
| if (!RNA_pointer_is_null(&hook_object_ptr) && | if (!RNA_pointer_is_null(&hook_object_ptr) && | ||||
| RNA_enum_get(&hook_object_ptr, "type") == OB_ARMATURE) { | RNA_enum_get(&hook_object_ptr, "type") == OB_ARMATURE) { | ||||
| PointerRNA hook_object_data_ptr = RNA_pointer_get(&hook_object_ptr, "data"); | PointerRNA hook_object_data_ptr = RNA_pointer_get(&hook_object_ptr, "data"); | ||||
| uiItemPointerR( | uiItemPointerR( | ||||
| col, &ptr, "subtarget", &hook_object_data_ptr, "bones", IFACE_("Bone"), ICON_NONE); | col, ptr, "subtarget", &hook_object_data_ptr, "bones", IFACE_("Bone"), ICON_NONE); | ||||
| } | } | ||||
| row = uiLayoutRow(layout, true); | row = uiLayoutRow(layout, true); | ||||
| uiItemPointerR(row, &ptr, "vertex_group", &ob_ptr, "vertex_groups", NULL, ICON_NONE); | uiItemPointerR(row, ptr, "vertex_group", &ob_ptr, "vertex_groups", NULL, ICON_NONE); | ||||
| sub = uiLayoutRow(row, true); | sub = uiLayoutRow(row, true); | ||||
| uiLayoutSetActive(sub, has_vertex_group); | uiLayoutSetActive(sub, has_vertex_group); | ||||
| uiLayoutSetPropSep(sub, false); | uiLayoutSetPropSep(sub, false); | ||||
| uiItemR(sub, &ptr, "invert_vertex", 0, "", ICON_ARROW_LEFTRIGHT); | uiItemR(sub, ptr, "invert_vertex", 0, "", ICON_ARROW_LEFTRIGHT); | ||||
| uiItemR(layout, &ptr, "strength", UI_ITEM_R_SLIDER, NULL, ICON_NONE); | uiItemR(layout, ptr, "strength", UI_ITEM_R_SLIDER, NULL, ICON_NONE); | ||||
| gpencil_modifier_panel_end(layout, &ptr); | gpencil_modifier_panel_end(layout, ptr); | ||||
| } | } | ||||
| static void falloff_panel_draw(const bContext *C, Panel *panel) | static void falloff_panel_draw(const bContext *UNUSED(C), Panel *panel) | ||||
| { | { | ||||
| uiLayout *row; | uiLayout *row; | ||||
| uiLayout *layout = panel->layout; | uiLayout *layout = panel->layout; | ||||
| PointerRNA ptr; | PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL); | ||||
| gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr); | |||||
| bool use_falloff = RNA_enum_get(&ptr, "falloff_type") != eWarp_Falloff_None; | bool use_falloff = RNA_enum_get(ptr, "falloff_type") != eWarp_Falloff_None; | ||||
| uiLayoutSetPropSep(layout, true); | uiLayoutSetPropSep(layout, true); | ||||
| uiItemR(layout, &ptr, "falloff_type", 0, IFACE_("Type"), ICON_NONE); | uiItemR(layout, ptr, "falloff_type", 0, IFACE_("Type"), ICON_NONE); | ||||
| row = uiLayoutRow(layout, false); | row = uiLayoutRow(layout, false); | ||||
| uiLayoutSetActive(row, use_falloff); | uiLayoutSetActive(row, use_falloff); | ||||
| uiItemR(row, &ptr, "falloff_radius", 0, NULL, ICON_NONE); | uiItemR(row, ptr, "falloff_radius", 0, NULL, ICON_NONE); | ||||
| uiItemR(layout, &ptr, "use_falloff_uniform", 0, NULL, ICON_NONE); | uiItemR(layout, ptr, "use_falloff_uniform", 0, NULL, ICON_NONE); | ||||
| if (RNA_enum_get(&ptr, "falloff_type") == eWarp_Falloff_Curve) { | if (RNA_enum_get(ptr, "falloff_type") == eWarp_Falloff_Curve) { | ||||
| uiTemplateCurveMapping(layout, &ptr, "falloff_curve", 0, false, false, false, false); | uiTemplateCurveMapping(layout, ptr, "falloff_curve", 0, false, false, false, false); | ||||
| } | } | ||||
| } | } | ||||
| static void mask_panel_draw(const bContext *C, Panel *panel) | static void mask_panel_draw(const bContext *UNUSED(C), Panel *panel) | ||||
| { | { | ||||
| gpencil_modifier_masking_panel_draw(C, panel, true, false); | gpencil_modifier_masking_panel_draw(panel, true, false); | ||||
| } | } | ||||
| static void panelRegister(ARegionType *region_type) | static void panelRegister(ARegionType *region_type) | ||||
| { | { | ||||
| PanelType *panel_type = gpencil_modifier_panel_register( | PanelType *panel_type = gpencil_modifier_panel_register( | ||||
| region_type, eGpencilModifierType_Hook, panel_draw); | region_type, eGpencilModifierType_Hook, panel_draw); | ||||
| gpencil_modifier_subpanel_register( | gpencil_modifier_subpanel_register( | ||||
| region_type, "falloff", "Falloff", NULL, falloff_panel_draw, panel_type); | region_type, "falloff", "Falloff", NULL, falloff_panel_draw, panel_type); | ||||
| Show All 28 Lines | |||||