Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_graph/graph_buttons.c
| Show First 20 Lines • Show All 899 Lines • ▼ Show 20 Lines | static void graph_panel_driverVar__transChan(uiLayout *layout, ID *id, DriverVar *dvar) | ||||
| } | } | ||||
| uiItemR(sub, &dtar_ptr, "transform_space", 0, IFACE_("Space"), ICON_NONE); | uiItemR(sub, &dtar_ptr, "transform_space", 0, IFACE_("Space"), ICON_NONE); | ||||
| } | } | ||||
| /* ----------------------------------------------------------------- */ | /* ----------------------------------------------------------------- */ | ||||
| /* property driven by the driver - duplicates Active FCurve, but useful for clarity */ | /* property driven by the driver - duplicates Active FCurve, but useful for clarity */ | ||||
| static void graph_draw_driven_property_enabled_btn(uiLayout *layout, | |||||
| ID *id, | |||||
| FCurve *fcu, | |||||
| const char *label) | |||||
| { | |||||
| PointerRNA fcurve_ptr; | |||||
| RNA_pointer_create(id, &RNA_FCurve, fcu, &fcurve_ptr); | |||||
| uiBlock *block = uiLayoutGetBlock(layout); | |||||
| uiDefButR(block, | |||||
| UI_BTYPE_CHECKBOX_N, | |||||
| 0, | |||||
| label, | |||||
| 0, | |||||
| 0, | |||||
| 20 * UI_UNIT_X, | |||||
Severin: The `20 *` can be removed I think, since we figured the issue was actually that inverted… | |||||
| UI_UNIT_Y, | |||||
| &fcurve_ptr, | |||||
| "mute", | |||||
| 0, | |||||
| 0, | |||||
| 0, | |||||
| 0, | |||||
| 0, | |||||
| TIP_("Let the driver determine this property's value")); | |||||
| } | |||||
| static void graph_panel_drivers_header(const bContext *C, Panel *panel) | |||||
| { | |||||
| bAnimListElem *ale; | |||||
| FCurve *fcu; | |||||
| if (!graph_panel_context(C, &ale, &fcu)) { | |||||
| return; | |||||
| } | |||||
| graph_draw_driven_property_enabled_btn(panel->layout, ale->id, fcu, IFACE_("Driver")); | |||||
| } | |||||
| static void graph_draw_driven_property_panel(uiLayout *layout, ID *id, FCurve *fcu) | static void graph_draw_driven_property_panel(uiLayout *layout, ID *id, FCurve *fcu) | ||||
| { | { | ||||
| PointerRNA fcu_ptr; | PointerRNA fcu_ptr; | ||||
| uiLayout *row; | uiLayout *row; | ||||
| char name[256]; | char name[256]; | ||||
| int icon = 0; | int icon = 0; | ||||
| /* F-Curve pointer */ | /* F-Curve pointer */ | ||||
| ▲ Show 20 Lines • Show All 394 Lines • ▼ Show 20 Lines | if (fcu && fcu->driver) { | ||||
| uiItemL(layout, IFACE_("Driven Property:"), ICON_NONE); | uiItemL(layout, IFACE_("Driven Property:"), ICON_NONE); | ||||
| graph_draw_driven_property_panel(panel->layout, id, fcu); | graph_draw_driven_property_panel(panel->layout, id, fcu); | ||||
| /* TODO: All vs Single */ | /* TODO: All vs Single */ | ||||
| uiItemS(layout); | uiItemS(layout); | ||||
| uiItemS(layout); | uiItemS(layout); | ||||
| /* Drivers Settings */ | /* Drivers Settings */ | ||||
| uiItemL(layout, IFACE_("Driver Settings:"), ICON_NONE); | graph_draw_driven_property_enabled_btn(panel->layout, id, fcu, IFACE_("Driver Settings:")); | ||||
| graph_draw_driver_settings_panel(panel->layout, id, fcu, true); | graph_draw_driver_settings_panel(panel->layout, id, fcu, true); | ||||
| } | } | ||||
| } | } | ||||
| /* Show drivers editor is always visible */ | /* Show drivers editor is always visible */ | ||||
| uiItemO(layout, IFACE_("Show in Drivers Editor"), ICON_DRIVER, "SCREEN_OT_drivers_editor_show"); | uiItemO(layout, IFACE_("Show in Drivers Editor"), ICON_DRIVER, "SCREEN_OT_drivers_editor_show"); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 100 Lines • ▼ Show 20 Lines | void graph_buttons_register(ARegionType *art) | ||||
| BLI_addtail(&art->paneltypes, pt); | BLI_addtail(&art->paneltypes, pt); | ||||
| pt = MEM_callocN(sizeof(PanelType), "spacetype graph panel drivers"); | pt = MEM_callocN(sizeof(PanelType), "spacetype graph panel drivers"); | ||||
| strcpy(pt->idname, "GRAPH_PT_drivers"); | strcpy(pt->idname, "GRAPH_PT_drivers"); | ||||
| strcpy(pt->label, N_("Driver")); | strcpy(pt->label, N_("Driver")); | ||||
| strcpy(pt->category, "Drivers"); | strcpy(pt->category, "Drivers"); | ||||
| strcpy(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA); | strcpy(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA); | ||||
| pt->draw = graph_panel_drivers; | pt->draw = graph_panel_drivers; | ||||
| pt->draw_header = graph_panel_drivers_header; | |||||
| pt->poll = graph_panel_drivers_poll; | pt->poll = graph_panel_drivers_poll; | ||||
| BLI_addtail(&art->paneltypes, pt); | BLI_addtail(&art->paneltypes, pt); | ||||
| pt = MEM_callocN(sizeof(PanelType), "spacetype graph panel drivers popover"); | pt = MEM_callocN(sizeof(PanelType), "spacetype graph panel drivers popover"); | ||||
| strcpy(pt->idname, "GRAPH_PT_drivers_popover"); | strcpy(pt->idname, "GRAPH_PT_drivers_popover"); | ||||
| strcpy(pt->label, N_("Add/Edit Driver")); | strcpy(pt->label, N_("Add/Edit Driver")); | ||||
| strcpy(pt->category, "Drivers"); | strcpy(pt->category, "Drivers"); | ||||
| strcpy(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA); | strcpy(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA); | ||||
| Show All 31 Lines | |||||
The 20 * can be removed I think, since we figured the issue was actually that inverted checkboxes were broken :)