Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/modifiers/intern/MOD_meshcache.c')
-rw-r--r--source/blender/modifiers/intern/MOD_meshcache.c97
1 files changed, 95 insertions, 2 deletions
diff --git a/source/blender/modifiers/intern/MOD_meshcache.c b/source/blender/modifiers/intern/MOD_meshcache.c
index 219de1569b3..2d104e1e0c2 100644
--- a/source/blender/modifiers/intern/MOD_meshcache.c
+++ b/source/blender/modifiers/intern/MOD_meshcache.c
@@ -26,22 +26,32 @@
#include "BLI_path_util.h"
#include "BLI_string.h"
+#include "BLT_translation.h"
+
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
+#include "DNA_screen_types.h"
+#include "BKE_context.h"
#include "BKE_main.h"
#include "BKE_mesh.h"
#include "BKE_scene.h"
+#include "BKE_screen.h"
+
+#include "UI_interface.h"
+#include "UI_resources.h"
+
+#include "RNA_access.h"
#include "DEG_depsgraph_query.h"
#include "MEM_guardedalloc.h"
#include "MOD_meshcache_util.h" /* utility functions */
-
#include "MOD_modifiertypes.h"
+#include "MOD_ui_common.h"
static void initData(ModifierData *md)
{
@@ -287,8 +297,90 @@ static void deformVertsEM(ModifierData *md,
meshcache_do(mcmd, scene, ctx->object, vertexCos, numVerts);
}
+static void panel_draw(const bContext *C, Panel *panel)
+{
+ uiLayout *layout = panel->layout;
+
+ PointerRNA ptr;
+ modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
+
+ uiLayoutSetPropSep(layout, true);
+
+ uiItemR(layout, &ptr, "cache_format", 0, NULL, ICON_NONE);
+ uiItemR(layout, &ptr, "filepath", 0, NULL, ICON_NONE);
+
+ uiItemR(layout, &ptr, "factor", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
+ uiItemR(layout, &ptr, "deform_mode", 0, NULL, ICON_NONE);
+ uiItemR(layout, &ptr, "interpolation", 0, NULL, ICON_NONE);
+
+ modifier_panel_end(layout, &ptr);
+}
+
+static void time_remapping_panel_draw(const bContext *C, Panel *panel)
+{
+ uiLayout *layout = panel->layout;
+
+ PointerRNA ptr;
+ modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
+
+ uiItemR(layout, &ptr, "time_mode", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
+
+ uiLayoutSetPropSep(layout, true);
+
+ uiItemR(layout, &ptr, "play_mode", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
+
+ if (RNA_enum_get(&ptr, "play_mode") == MOD_MESHCACHE_PLAY_CFEA) {
+ uiItemR(layout, &ptr, "frame_start", 0, NULL, ICON_NONE);
+ uiItemR(layout, &ptr, "frame_scale", 0, NULL, ICON_NONE);
+ }
+ else { /* play_mode == MOD_MESHCACHE_PLAY_EVAL */
+ int time_mode = RNA_enum_get(&ptr, "time_mode");
+ if (time_mode == MOD_MESHCACHE_TIME_FRAME) {
+ uiItemR(layout, &ptr, "eval_frame", 0, NULL, ICON_NONE);
+ }
+ else if (time_mode == MOD_MESHCACHE_TIME_SECONDS) {
+ uiItemR(layout, &ptr, "eval_time", 0, NULL, ICON_NONE);
+ }
+ else { /* time_mode == MOD_MESHCACHE_TIME_FACTOR */
+ uiItemR(layout, &ptr, "eval_factor", 0, NULL, ICON_NONE);
+ }
+ }
+}
+
+static void axis_mapping_panel_draw(const bContext *C, Panel *panel)
+{
+ uiLayout *col;
+ uiLayout *layout = panel->layout;
+
+ PointerRNA ptr;
+ modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
+
+ uiLayoutSetPropSep(layout, true);
+
+ col = uiLayoutColumn(layout, true);
+ uiLayoutSetRedAlert(col, RNA_enum_get(&ptr, "forward_axis") == RNA_enum_get(&ptr, "up_axis"));
+ uiItemR(col, &ptr, "forward_axis", 0, NULL, ICON_NONE);
+ uiItemR(col, &ptr, "up_axis", 0, NULL, ICON_NONE);
+
+ uiItemR(layout, &ptr, "flip_axis", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
+}
+
+static void panelRegister(ARegionType *region_type)
+{
+ PanelType *panel_type = modifier_panel_register(
+ region_type, eModifierType_MeshCache, panel_draw);
+ modifier_subpanel_register(region_type,
+ "time_remapping",
+ "Time Remapping",
+ NULL,
+ time_remapping_panel_draw,
+ panel_type);
+ modifier_subpanel_register(
+ region_type, "axis_mapping", "Axis Mapping", NULL, axis_mapping_panel_draw, panel_type);
+}
+
ModifierTypeInfo modifierType_MeshCache = {
- /* name */ "Mesh Cache",
+ /* name */ "MeshCache",
/* structName */ "MeshCacheModifierData",
/* structSize */ sizeof(MeshCacheModifierData),
/* type */ eModifierTypeType_OnlyDeform,
@@ -317,4 +409,5 @@ ModifierTypeInfo modifierType_MeshCache = {
/* foreachIDLink */ NULL,
/* foreachTexLink */ NULL,
/* freeRuntimeData */ NULL,
+ /* panelRegister */ panelRegister,
};