[Bf-blender-cvs] [a5ad2d7f75d] fcurve-modifier-panels: Merge branch 'master' into fcurve-modifier-panels
Hans Goudey
noreply at git.blender.org
Mon Oct 19 04:45:06 CEST 2020
Commit: a5ad2d7f75d1a59abe6a002860f4103252f64525
Author: Hans Goudey
Date: Sun Oct 18 19:54:09 2020 -0500
Branches: fcurve-modifier-panels
https://developer.blender.org/rBa5ad2d7f75d1a59abe6a002860f4103252f64525
Merge branch 'master' into fcurve-modifier-panels
===================================================================
===================================================================
diff --cc source/blender/blenloader/intern/versioning_290.c
index 862cfbf6c45,5e6fdad8509..0d8b097b32a
--- a/source/blender/blenloader/intern/versioning_290.c
+++ b/source/blender/blenloader/intern/versioning_290.c
@@@ -835,5 -855,25 +855,39 @@@ void blo_do_versions_290(FileData *fd,
}
}
}
+
+ /* Ensure that particle systems generated by fluid modifier have correct phystype. */
+ LISTBASE_FOREACH (ParticleSettings *, part, &bmain->particles) {
+ if ELEM (part->type, PART_FLUID_FLIP, PART_FLUID_SPRAY, PART_FLUID_BUBBLE, PART_FLUID_FOAM) {
+ part->phystype = PART_PHYS_NO;
+ }
+ }
}
- }
+
+ /**
+ * Versioning code until next subversion bump goes here.
+ *
+ * \note Be sure to check when bumping the version:
+ * - "versioning_userdef.c", #blo_do_versions_userdef
+ * - "versioning_userdef.c", #do_versions_theme
+ *
+ * \note Keep this message at the bottom of the function.
+ */
+ {
+ /* Keep this block, even when empty. */
++
++ /* Move to storing expansion for all panels of FModifiers. */
++ LISTBASE_FOREACH (bAction *, act, &bmain->actions) {
++ LISTBASE_FOREACH (FCurve *, fcu, &act->curves) {
++ LISTBASE_FOREACH (FModifier *, fcm, &fcu->modifiers) {
++ if (fcm->flag & FMODIFIER_FLAG_EXPANDED_DEPRECATED) {
++ fcm->ui_expand_flag = 1;
++ }
++ else {
++ fcm->ui_expand_flag = 0;
++ }
++ }
++ }
++ }
+ }
+ }
diff --cc source/blender/editors/animation/fmodifier_ui.c
index 5cef02e8921,fc622c7a52e..cae249ea925
--- a/source/blender/editors/animation/fmodifier_ui.c
+++ b/source/blender/editors/animation/fmodifier_ui.c
@@@ -53,176 -58,10 +53,176 @@@
#include "DEG_depsgraph.h"
-/* ********************************************** */
-/* UI STUFF */
+typedef void (*PanelDrawFn)(const bContext *, struct Panel *);
+static void deg_update(bContext *C, void *owner_id, void *UNUSED(var2));
+static void fmodifier_panel_header(const bContext *C, Panel *panel);
+
+/* -------------------------------------------------------------------- */
+/** \name Panel Registering and Panel Callbacks
+ * \{ */
+
+static PointerRNA *fmodifier_get_pointers(const Panel *panel, ID **r_owner_id)
+{
+ /* TODO(Hans): Use #UI_panel_custom_data_get. */
+ PointerRNA *ptr = panel->runtime.custom_data_ptr;
+
+ if (r_owner_id != NULL) {
+ *r_owner_id = ptr->owner_id;
+ }
+
+ // FModifier *fcm = (FModifier *)ptr->data;
+ // uiLayoutSetActive(panel->layout, !(fcu->flag & FCURVE_MOD_OFF));
+
+ return ptr;
+}
+
+/**
+ * Move an FModifier to the index it's moved to after a drag and drop.
+ */
+static void fmodifier_reorder(bContext *C, Panel *panel, int new_index)
+{
+ ID *fcurve_owner_id;
+ PointerRNA *ptr = fmodifier_get_pointers(panel, &fcurve_owner_id);
+ FModifier *fcm = ptr->data;
+
+ /* Cycles modifier has to be the first, so make sure it's kept that way. */
+ if (fcm->type == FMODIFIER_TYPE_CYCLES) {
+ WM_report(RPT_ERROR, "Cannot reorder cycles modifier");
+ return;
+ }
+
+ ListBase *modifiers;
+ if (CTX_wm_space_graph(C)) {
+ modifiers = ANIM_graph_context_fmodifiers(C);
+ }
+ else if (CTX_wm_space_nla(C)) {
+ modifiers = ANIM_nla_context_fmodifiers(C);
+ }
+
+ /* Again, make sure we don't move a modifier before a cycles modifier. */
+ FModifier *fcm_first = modifiers->first;
+ if (fcm_first->type == FMODIFIER_TYPE_CYCLES && new_index == 0) {
+ WM_report(RPT_ERROR, "Cycles modifier must be first");
+ return;
+ }
+
+ int current_index = BLI_findindex(modifiers, fcm);
+ BLI_assert(current_index >= 0);
+ BLI_assert(new_index >= 0);
+
+ /* Don't do anything if the drag didn't change the index. */
+ if (current_index == new_index) {
+ return;
+ }
+
+ /* Move the FModifier in the list. */
+ BLI_listbase_link_move(modifiers, fcm, new_index - current_index);
+
+ ED_undo_push(C, "Move F-Curve Modifier");
+
+ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
+ DEG_id_tag_update(fcurve_owner_id, ID_RECALC_ANIMATION);
+}
+
+static short get_fmodifier_expand_flag(const bContext *UNUSED(C), Panel *panel)
+{
+ PointerRNA *ptr = fmodifier_get_pointers(panel, NULL);
+ FModifier *fcm = (FModifier *)ptr->data;
+
+ return fcm->ui_expand_flag;
+}
+
+static void set_fmodifier_expand_flag(const bContext *UNUSED(C), Panel *panel, short expand_flag)
+{
+ PointerRNA *ptr = fmodifier_get_pointers(panel, NULL);
+ FModifier *fcm = (FModifier *)ptr->data;
+
+ fcm->ui_expand_flag = expand_flag;
+}
+
+static PanelType *fmodifier_panel_register(ARegionType *region_type,
+ eFModifier_Types type,
+ PanelDrawFn draw,
+ PanelTypePollFn poll,
+ const char *id_prefix)
+{
+ /* Get the name for the modifier's panel. */
+ char panel_idname[BKE_ST_MAXNAME];
+ snprintf(panel_idname, BKE_ST_MAXNAME, "%s_PT_", id_prefix);
+ const FModifierTypeInfo *fmi = get_fmodifier_typeinfo(type);
+ strcat(panel_idname, fmi->name);
+
+ PanelType *panel_type = MEM_callocN(sizeof(PanelType), panel_idname);
+
+ strcpy(panel_type->idname, panel_idname);
+ strcpy(panel_type->label, "");
+ strcpy(panel_type->category, "Modifiers");
+ strcpy(panel_type->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
+
+ panel_type->draw_header = fmodifier_panel_header;
+ panel_type->draw = draw;
+ panel_type->poll = poll;
+
+ /* Give the panel the special flag that says it was built here and corresponds to a
+ * modifer rather than a PanelType. */
+ panel_type->flag = PNL_LAYOUT_HEADER_EXPAND | PNL_DRAW_BOX | PNL_INSTANCED;
+ panel_type->reorder = fmodifier_reorder;
+ panel_type->get_list_data_expand_flag = get_fmodifier_expand_flag;
+ panel_type->set_list_data_expand_flag = set_fmodifier_expand_flag;
+
+ BLI_addtail(®ion_type->paneltypes, panel_type);
+
+ return panel_type;
+}
+
+/**
+ * Add a child panel to the parent.
+ *
+ * \note To create the panel type's idname, it appends the \a name argument to the \a parent's
+ * idname.
+ */
+static PanelType *fmodifier_subpanel_register(ARegionType *region_type,
+ const char *name,
+ const char *label,
+ PanelDrawFn draw_header,
+ PanelDrawFn draw,
+ PanelTypePollFn poll,
+ PanelType *parent)
+{
+ /* Create the subpanel's ID name. */
+ char panel_idname[BKE_ST_MAXNAME];
+ strcpy(panel_idname, parent->idname);
+ strcat(panel_idname, "_");
+ strcat(panel_idname, name);
+
+ PanelType *panel_type = MEM_callocN(sizeof(PanelType), panel_idname);
+
+ strcpy(panel_type->idname, panel_idname);
+ strcpy(panel_type->label, label);
+ strcpy(panel_type->category, "Modifiers");
+ strcpy(panel_type->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
+
+ panel_type->draw_header = draw_header;
+ panel_type->draw = draw;
+ panel_type->poll = poll;
+ panel_type->flag = (PNL_DEFAULT_CLOSED | PNL_DRAW_BOX);
+
+ BLI_assert(parent != NULL);
+ strcpy(panel_type->parent_id, parent->idname);
+ panel_type->parent = parent;
+ BLI_addtail(&parent->children, BLI_genericNodeN(panel_type));
+ BLI_addtail(®ion_type->paneltypes, panel_type);
+
+ return panel_type;
+}
+
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name General UI Callbacks and Drawing
+ * \{ */
- // XXX! --------------------------------
+ /* XXX! -------------------------------- */
/* Temporary definition for limits of float number buttons
* (FLT_MAX tends to infinity with old system). */
#define UI_FLT_MAX 10000.0f
More information about the Bf-blender-cvs
mailing list