diff options
Diffstat (limited to 'source/blender/editors')
13 files changed, 133 insertions, 9 deletions
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index b569f909d7a..0e00e48267b 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -51,6 +51,7 @@ #include "DNA_pointcloud_types.h" #include "DNA_scene_types.h" #include "DNA_screen_types.h" +#include "DNA_simulation_types.h" #include "DNA_space_types.h" #include "DNA_speaker_types.h" #include "DNA_volume_types.h" @@ -3033,6 +3034,83 @@ static bAnimChannelType ACF_DSVOLUME = { acf_dsvolume_setting_ptr /* pointer for setting */ }; +/* Simulation Expander ----------------------------------------- */ + +static int acf_dssimulation_icon(bAnimListElem *UNUSED(ale)) +{ + /* TODO: Use correct icon. */ + return ICON_PHYSICS; +} + +static int acf_dssimulation_setting_flag(bAnimContext *UNUSED(ac), + eAnimChannel_Settings setting, + bool *neg) +{ + /* clear extra return data first */ + *neg = false; + + switch (setting) { + case ACHANNEL_SETTING_EXPAND: /* expanded */ + return SIM_DS_EXPAND; + + case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */ + return ADT_NLA_EVAL_OFF; + + case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */ + *neg = true; + return ADT_CURVES_NOT_VISIBLE; + + case ACHANNEL_SETTING_SELECT: /* selected */ + return ADT_UI_SELECTED; + + default: /* unsupported */ + return 0; + } +} + +static void *acf_dssimulation_setting_ptr(bAnimListElem *ale, + eAnimChannel_Settings setting, + short *type) +{ + Simulation *simulation = (Simulation *)ale->data; + + /* clear extra return data first */ + *type = 0; + + switch (setting) { + case ACHANNEL_SETTING_EXPAND: /* expanded */ + return GET_ACF_FLAG_PTR(simulation->flag, type); + + case ACHANNEL_SETTING_SELECT: /* selected */ + case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */ + case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */ + if (simulation->adt) + return GET_ACF_FLAG_PTR(simulation->adt->flag, type); + return NULL; + + default: /* unsupported */ + return NULL; + } +} + +static bAnimChannelType ACF_DSSIMULATION = { + "Simulation Expander", /* type name */ + ACHANNEL_ROLE_EXPANDER, /* role */ + + acf_generic_dataexpand_color, /* backdrop color */ + acf_generic_dataexpand_backdrop, /* backdrop */ + acf_generic_indention_1, /* indent level */ + acf_generic_basic_offset, /* offset */ + + acf_generic_idblock_name, /* name */ + acf_generic_idblock_name_prop, /* name prop */ + acf_dssimulation_icon, /* icon */ + + acf_generic_dataexpand_setting_valid, /* has setting */ + acf_dssimulation_setting_flag, /* flag for setting */ + acf_dssimulation_setting_ptr /* pointer for setting */ +}; + /* GPencil Expander ------------------------------------------- */ // TODO: just get this from RNA? @@ -4049,6 +4127,7 @@ static void ANIM_init_channel_typeinfo_data(void) animchannelTypeInfo[type++] = &ACF_DSHAIR; /* Hair Channel */ animchannelTypeInfo[type++] = &ACF_DSPOINTCLOUD; /* PointCloud Channel */ animchannelTypeInfo[type++] = &ACF_DSVOLUME; /* Volume Channel */ + animchannelTypeInfo[type++] = &ACF_DSSIMULATION; /* Simulation Channel */ animchannelTypeInfo[type++] = &ACF_SHAPEKEY; /* ShapeKey */ diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index a1b1c7815d8..302b1318bba 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -138,7 +138,8 @@ void ANIM_set_active_channel(bAnimContext *ac, case ANIMTYPE_DSMCLIP: case ANIMTYPE_DSHAIR: case ANIMTYPE_DSPOINTCLOUD: - case ANIMTYPE_DSVOLUME: { + case ANIMTYPE_DSVOLUME: + case ANIMTYPE_DSSIMULATION: { /* need to verify that this data is valid for now */ if (ale->adt) { ACHANNEL_SET_FLAG(ale->adt, ACHANNEL_SETFLAG_CLEAR, ADT_UI_ACTIVE); @@ -194,7 +195,8 @@ void ANIM_set_active_channel(bAnimContext *ac, case ANIMTYPE_DSMCLIP: case ANIMTYPE_DSHAIR: case ANIMTYPE_DSPOINTCLOUD: - case ANIMTYPE_DSVOLUME: { + case ANIMTYPE_DSVOLUME: + case ANIMTYPE_DSSIMULATION: { /* need to verify that this data is valid for now */ if (ale && ale->adt) { ale->adt->flag |= ADT_UI_ACTIVE; @@ -332,7 +334,8 @@ void ANIM_deselect_anim_channels( case ANIMTYPE_DSMCLIP: case ANIMTYPE_DSHAIR: case ANIMTYPE_DSPOINTCLOUD: - case ANIMTYPE_DSVOLUME: { + case ANIMTYPE_DSVOLUME: + case ANIMTYPE_DSSIMULATION: { if ((ale->adt) && (ale->adt->flag & ADT_UI_SELECTED)) { sel = ACHANNEL_SETFLAG_CLEAR; } @@ -428,7 +431,8 @@ void ANIM_deselect_anim_channels( case ANIMTYPE_DSMCLIP: case ANIMTYPE_DSHAIR: case ANIMTYPE_DSPOINTCLOUD: - case ANIMTYPE_DSVOLUME: { + case ANIMTYPE_DSVOLUME: + case ANIMTYPE_DSSIMULATION: { /* need to verify that this data is valid for now */ if (ale->adt) { ACHANNEL_SET_FLAG(ale->adt, sel, ADT_UI_SELECTED); @@ -2964,7 +2968,8 @@ static int mouse_anim_channels(bContext *C, bAnimContext *ac, int channel_index, case ANIMTYPE_DSMCLIP: case ANIMTYPE_DSHAIR: case ANIMTYPE_DSPOINTCLOUD: - case ANIMTYPE_DSVOLUME: { + case ANIMTYPE_DSVOLUME: + case ANIMTYPE_DSSIMULATION: { /* sanity checking... */ if (ale->adt) { /* select/deselect */ diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index 4dc0bef3a1b..e4da4e66e21 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -67,6 +67,7 @@ #include "DNA_scene_types.h" #include "DNA_screen_types.h" #include "DNA_sequence_types.h" +#include "DNA_simulation_types.h" #include "DNA_space_types.h" #include "DNA_speaker_types.h" #include "DNA_userdef_types.h" @@ -826,6 +827,18 @@ static bAnimListElem *make_new_animlistelem(void *data, ale->adt = BKE_animdata_from_id(data); break; } + case ANIMTYPE_DSSIMULATION: { + Simulation *simulation = (Simulation *)data; + AnimData *adt = simulation->adt; + + ale->flag = FILTER_SIMULATION_OBJD(simulation); + + ale->key_data = (adt) ? adt->action : NULL; + ale->datatype = ALE_ACT; + + ale->adt = BKE_animdata_from_id(data); + break; + } case ANIMTYPE_DSSKEY: { Key *key = (Key *)data; AnimData *adt = key->adt; diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h index a9b34e3c735..7d38792f332 100644 --- a/source/blender/editors/include/ED_anim_api.h +++ b/source/blender/editors/include/ED_anim_api.h @@ -229,6 +229,7 @@ typedef enum eAnim_ChannelType { ANIMTYPE_DSHAIR, ANIMTYPE_DSPOINTCLOUD, ANIMTYPE_DSVOLUME, + ANIMTYPE_DSSIMULATION, ANIMTYPE_SHAPEKEY, @@ -356,6 +357,8 @@ typedef enum eAnimFilter_Flags { #define FILTER_HAIR_OBJD(ha) (CHECK_TYPE_INLINE(ha, Hair *), ((ha->flag & HA_DS_EXPAND))) #define FILTER_POINTS_OBJD(pt) (CHECK_TYPE_INLINE(pt, PointCloud *), ((pt->flag & PT_DS_EXPAND))) #define FILTER_VOLUME_OBJD(vo) (CHECK_TYPE_INLINE(vo, Volume *), ((vo->flag & VO_DS_EXPAND))) +#define FILTER_SIMULATION_OBJD(sim) \ + (CHECK_TYPE_INLINE(sim, Simulation *), ((sim->flag & SIM_DS_EXPAND))) /* Variable use expanders */ #define FILTER_NTREE_DATA(ntree) \ (CHECK_TYPE_INLINE(ntree, bNodeTree *), (((ntree)->flag & NTREE_DS_EXPAND))) diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 084eb943665..e3184ac413f 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -2326,6 +2326,9 @@ int UI_idcode_icon_get(const int idcode) return ICON_WORLD_DATA; case ID_WS: return ICON_WORKSPACE; + case ID_SIM: + /* TODO: Use correct icon. */ + return ICON_PHYSICS; default: return ICON_NONE; } diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 27ce20ae374..b76a21fc46a 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -688,6 +688,8 @@ static const char *template_id_browse_tip(const StructRNA *type) return N_("Browse Point Cloud Data to be linked"); case ID_VO: return N_("Browse Volume Data to be linked"); + case ID_SIM: + return N_("Browser Simulation to be linked"); } } return N_("Browse ID data to be linked"); @@ -753,7 +755,8 @@ static uiBut *template_id_def_new_but(uiBlock *block, BLT_I18NCONTEXT_ID_LIGHTPROBE, BLT_I18NCONTEXT_ID_HAIR, BLT_I18NCONTEXT_ID_POINTCLOUD, - BLT_I18NCONTEXT_ID_VOLUME, ); + BLT_I18NCONTEXT_ID_VOLUME, + BLT_I18NCONTEXT_ID_SIMULATION, ); /* Note: BLT_I18N_MSGID_MULTI_CTXT takes a maximum number of parameters, * check the definition to see if a new call must be added when the limit * is exceeded. */ diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index f35f92feaec..b2b00006939 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -630,6 +630,7 @@ static int gather_frames_to_render_for_id(LibraryIDLinkCallbackData *cb_data) case ID_HA: /* Hair */ case ID_PT: /* PointCloud */ case ID_VO: /* Volume */ + case ID_SIM: /* Simulation */ break; /* Blacklist: */ diff --git a/source/blender/editors/space_nla/nla_buttons.c b/source/blender/editors/space_nla/nla_buttons.c index 262af338f2a..307b6d9bc21 100644 --- a/source/blender/editors/space_nla/nla_buttons.c +++ b/source/blender/editors/space_nla/nla_buttons.c @@ -143,7 +143,8 @@ bool nla_panel_context(const bContext *C, case ANIMTYPE_PALETTE: case ANIMTYPE_DSHAIR: case ANIMTYPE_DSPOINTCLOUD: - case ANIMTYPE_DSVOLUME: { + case ANIMTYPE_DSVOLUME: + case ANIMTYPE_DSSIMULATION: { /* for these channels, we only do AnimData */ if (ale->adt && adt_ptr) { ID *id; diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c index 5adcec8a5d7..d399ea47d7e 100644 --- a/source/blender/editors/space_nla/nla_channels.c +++ b/source/blender/editors/space_nla/nla_channels.c @@ -193,7 +193,8 @@ static int mouse_nla_channels( case ANIMTYPE_PALETTE: case ANIMTYPE_DSHAIR: case ANIMTYPE_DSPOINTCLOUD: - case ANIMTYPE_DSVOLUME: { + case ANIMTYPE_DSVOLUME: + case ANIMTYPE_DSSIMULATION: { /* sanity checking... */ if (ale->adt) { /* select/deselect */ diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index ce83cfc3c97..6eba41982a7 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -2581,6 +2581,10 @@ TreeElementIcon tree_element_get_icon(TreeStoreElem *tselem, TreeElement *te) case ID_PC: data.icon = ICON_CURVE_BEZCURVE; break; + case ID_SIM: + /* TODO: Use correct icon. */ + data.icon = ICON_PHYSICS; + break; default: break; } diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h index 90092817acc..3032d38b7ac 100644 --- a/source/blender/editors/space_outliner/outliner_intern.h +++ b/source/blender/editors/space_outliner/outliner_intern.h @@ -108,7 +108,8 @@ typedef struct TreeElementIcon { ID_LP, \ ID_HA, \ ID_PT, \ - ID_VO) || /* Only in 'blendfile' mode ... :/ */ \ + ID_VO, \ + ID_SIM) || /* Only in 'blendfile' mode ... :/ */ \ ELEM(GS((_id)->name), \ ID_SCR, \ ID_WM, \ diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c index a6c1594678b..24c0e63ee9a 100644 --- a/source/blender/editors/space_outliner/outliner_tools.c +++ b/source/blender/editors/space_outliner/outliner_tools.c @@ -39,6 +39,7 @@ #include "DNA_pointcloud_types.h" #include "DNA_scene_types.h" #include "DNA_sequence_types.h" +#include "DNA_simulation_types.h" #include "DNA_volume_types.h" #include "DNA_world_types.h" @@ -160,6 +161,7 @@ static void set_operation_types(SpaceOutliner *soops, case ID_HA: case ID_PT: case ID_VO: + case ID_SIM: is_standard_id = true; break; case ID_WM: diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c index b226d291188..9b06de67825 100644 --- a/source/blender/editors/space_outliner/outliner_tree.c +++ b/source/blender/editors/space_outliner/outliner_tree.c @@ -46,6 +46,7 @@ #include "DNA_pointcloud_types.h" #include "DNA_scene_types.h" #include "DNA_sequence_types.h" +#include "DNA_simulation_types.h" #include "DNA_speaker_types.h" #include "DNA_volume_types.h" #include "DNA_world_types.h" @@ -773,6 +774,13 @@ static void outliner_add_id_contents(SpaceOutliner *soops, outliner_add_element(soops, &te->subtree, volume, te, TSE_ANIM_DATA, 0); break; } + case ID_SIM: { + Simulation *simulation = (Simulation *)id; + if (outliner_animdata_test(simulation->adt)) { + outliner_add_element(soops, &te->subtree, simulation, te, TSE_ANIM_DATA, 0); + } + break; + } default: break; } |