Changeset View
Changeset View
Standalone View
Standalone View
source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c
| Show First 20 Lines • Show All 171 Lines • ▼ Show 20 Lines | if (mmd->flag & GP_TIME_KEEP_LOOP) { | ||||
| if (cfra + offset > efra) { | if (cfra + offset > efra) { | ||||
| return nfra - efra + sfra - 1; | return nfra - efra + sfra - 1; | ||||
| } | } | ||||
| } | } | ||||
| return cfra + offset; | return cfra + offset; | ||||
| } | } | ||||
| static void panel_draw(const bContext *C, Panel *panel) | static void panel_draw(const bContext *UNUSED(C), Panel *panel) | ||||
| { | { | ||||
| uiLayout *row, *col; | uiLayout *row, *col; | ||||
| 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); | |||||
| int mode = RNA_enum_get(&ptr, "mode"); | int mode = RNA_enum_get(ptr, "mode"); | ||||
| uiLayoutSetPropSep(layout, true); | uiLayoutSetPropSep(layout, true); | ||||
| uiItemR(layout, &ptr, "mode", 0, NULL, ICON_NONE); | uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE); | ||||
| col = uiLayoutColumn(layout, false); | col = uiLayoutColumn(layout, false); | ||||
| const char *text = (mode == GP_TIME_MODE_FIX) ? IFACE_("Frame") : IFACE_("Frame Offset"); | const char *text = (mode == GP_TIME_MODE_FIX) ? IFACE_("Frame") : IFACE_("Frame Offset"); | ||||
| uiItemR(col, &ptr, "offset", 0, text, ICON_NONE); | uiItemR(col, ptr, "offset", 0, text, ICON_NONE); | ||||
| row = uiLayoutRow(col, false); | row = uiLayoutRow(col, false); | ||||
| uiLayoutSetActive(row, mode != GP_TIME_MODE_FIX); | uiLayoutSetActive(row, mode != GP_TIME_MODE_FIX); | ||||
| uiItemR(row, &ptr, "frame_scale", 0, IFACE_("Scale"), ICON_NONE); | uiItemR(row, ptr, "frame_scale", 0, IFACE_("Scale"), ICON_NONE); | ||||
| row = uiLayoutRow(layout, false); | row = uiLayoutRow(layout, false); | ||||
| uiLayoutSetActive(row, mode != GP_TIME_MODE_FIX); | uiLayoutSetActive(row, mode != GP_TIME_MODE_FIX); | ||||
| uiItemR(row, &ptr, "use_keep_loop", 0, NULL, ICON_NONE); | uiItemR(row, ptr, "use_keep_loop", 0, NULL, ICON_NONE); | ||||
| gpencil_modifier_panel_end(layout, &ptr); | gpencil_modifier_panel_end(layout, ptr); | ||||
| } | } | ||||
| static void custom_range_header_draw(const bContext *C, Panel *panel) | static void custom_range_header_draw(const bContext *UNUSED(C), Panel *panel) | ||||
| { | { | ||||
| 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); | |||||
| int mode = RNA_enum_get(&ptr, "mode"); | int mode = RNA_enum_get(ptr, "mode"); | ||||
| uiLayoutSetActive(layout, mode != GP_TIME_MODE_FIX); | uiLayoutSetActive(layout, mode != GP_TIME_MODE_FIX); | ||||
| uiItemR(layout, &ptr, "use_custom_frame_range", 0, NULL, ICON_NONE); | uiItemR(layout, ptr, "use_custom_frame_range", 0, NULL, ICON_NONE); | ||||
| } | } | ||||
| static void custom_range_panel_draw(const bContext *C, Panel *panel) | static void custom_range_panel_draw(const bContext *UNUSED(C), Panel *panel) | ||||
| { | { | ||||
| uiLayout *col; | uiLayout *col; | ||||
| 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); | |||||
| int mode = RNA_enum_get(&ptr, "mode"); | int mode = RNA_enum_get(ptr, "mode"); | ||||
| uiLayoutSetPropSep(layout, true); | uiLayoutSetPropSep(layout, true); | ||||
| uiLayoutSetActive( | uiLayoutSetActive( | ||||
| layout, (mode != GP_TIME_MODE_FIX) && (RNA_boolean_get(&ptr, "use_custom_frame_range"))); | layout, (mode != GP_TIME_MODE_FIX) && (RNA_boolean_get(ptr, "use_custom_frame_range"))); | ||||
| col = uiLayoutColumn(layout, false); | col = uiLayoutColumn(layout, false); | ||||
| uiItemR(col, &ptr, "frame_start", 0, IFACE_("Frame Start"), ICON_NONE); | uiItemR(col, ptr, "frame_start", 0, IFACE_("Frame Start"), ICON_NONE); | ||||
| uiItemR(col, &ptr, "frame_end", 0, IFACE_("End"), ICON_NONE); | uiItemR(col, ptr, "frame_end", 0, IFACE_("End"), ICON_NONE); | ||||
| } | } | ||||
| 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, false, false); | gpencil_modifier_masking_panel_draw(panel, false, 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_Time, panel_draw); | region_type, eGpencilModifierType_Time, panel_draw); | ||||
| gpencil_modifier_subpanel_register(region_type, | gpencil_modifier_subpanel_register(region_type, | ||||
| "custom_range", | "custom_range", | ||||
| Show All 32 Lines | |||||