[Bf-blender-cvs] [a3e2b60f931] fluid-mantaflow: Mantaflow: Mantaflow is now an experimental feature
Sebastián Barschkis
noreply at git.blender.org
Thu Dec 12 02:47:02 CET 2019
Commit: a3e2b60f931cd8f5ffe7c0921d054aa969b1c1ea
Author: Sebastián Barschkis
Date: Thu Dec 12 02:46:05 2019 +0100
Branches: fluid-mantaflow
https://developer.blender.org/rBa3e2b60f931cd8f5ffe7c0921d054aa969b1c1ea
Mantaflow: Mantaflow is now an experimental feature
===================================================================
M release/scripts/startup/bl_operators/object_quick_effects.py
M release/scripts/startup/bl_ui/properties_physics_manta.py
M release/scripts/startup/bl_ui/space_userpref.py
M source/blender/blenkernel/intern/DerivedMesh.c
M source/blender/blenloader/intern/readfile.c
M source/blender/blenloader/intern/writefile.c
M source/blender/makesdna/DNA_modifier_types.h
M source/blender/makesdna/DNA_userdef_types.h
M source/blender/makesrna/intern/rna_modifier.c
M source/blender/makesrna/intern/rna_userdef.c
===================================================================
diff --git a/release/scripts/startup/bl_operators/object_quick_effects.py b/release/scripts/startup/bl_operators/object_quick_effects.py
index c348fd9f456..0e3471cb413 100644
--- a/release/scripts/startup/bl_operators/object_quick_effects.py
+++ b/release/scripts/startup/bl_operators/object_quick_effects.py
@@ -352,6 +352,9 @@ class QuickSmoke(ObjectModeOperator, Operator):
if not bpy.app.build_options.manta:
self.report({'ERROR'}, "Built without Fluid Mantaflow modifier")
return {'CANCELLED'}
+ if not (context.preferences.experimental.use_manta_fluids or context.preferences.experimental.use_experimental_all):
+ self.report({'ERROR'}, "Modifier only available as experimental feature, can be enabled in preferences")
+ return {'CANCELLED'}
fake_context = context.copy()
mesh_objects = [obj for obj in context.selected_objects
@@ -452,6 +455,13 @@ class QuickLiquid(Operator):
)
def execute(self, context):
+ if not bpy.app.build_options.manta:
+ self.report({'ERROR'}, "Built without Fluid Mantaflow modifier")
+ return {'CANCELLED'}
+ if not (context.preferences.experimental.use_manta_fluids or context.preferences.experimental.use_experimental_all):
+ self.report({'ERROR'}, "Modifier only available as experimental feature, can be enabled in preferences")
+ return {'CANCELLED'}
+
fake_context = context.copy()
mesh_objects = [obj for obj in context.selected_objects
if obj.type == 'MESH']
diff --git a/release/scripts/startup/bl_ui/properties_physics_manta.py b/release/scripts/startup/bl_ui/properties_physics_manta.py
index a8adb746087..5802ded723c 100644
--- a/release/scripts/startup/bl_ui/properties_physics_manta.py
+++ b/release/scripts/startup/bl_ui/properties_physics_manta.py
@@ -39,6 +39,12 @@ class PhysicButtonsPanel:
bl_region_type = 'WINDOW'
bl_context = "physics"
+ @staticmethod
+ def poll_manta_enabled(context):
+ if not (context.preferences.experimental.use_manta_fluids or context.preferences.experimental.use_experimental_all) or not (bpy.app.build_options.manta):
+ return False
+ return True
+
@staticmethod
def poll_fluid(context):
ob = context.object
@@ -46,7 +52,7 @@ class PhysicButtonsPanel:
return False
md = context.manta
- return md and (context.manta.manta_type != 'NONE') and (bpy.app.build_options.manta)
+ return md and (context.manta.manta_type != 'NONE') and PhysicButtonsPanel.poll_manta_enabled(context)
@staticmethod
def poll_fluid_domain(context):
@@ -105,7 +111,11 @@ class PHYSICS_PT_manta(PhysicButtonsPanel, Panel):
col.alignment = 'RIGHT'
col.label(text="Built without Fluid modifier")
return
-
+ if not (context.preferences.experimental.use_manta_fluids or context.preferences.experimental.use_experimental_all):
+ col = layout.column(align=True)
+ col.alignment = 'RIGHT'
+ col.label(text="Modifier only available as experimental feature, can be enabled in preferences", icon='ERROR')
+ return
md = context.manta
layout.prop(md, "manta_type")
diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index 7c6a7ecbcee..965c902f846 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -2166,6 +2166,22 @@ class USERPREF_PT_experimental_all(ExperimentalPanel, Panel):
# and make sure they are disabled if use_experimental_all is True
+class USERPREF_PT_experimental_physics(ExperimentalPanel, Panel):
+ bl_label = "Physics"
+
+ def draw_props(self, context, layout):
+ prefs = context.preferences
+ experimental = prefs.experimental
+ layout.active = not experimental.use_experimental_all
+
+ task = "T59995"
+ split = layout.split(factor=0.66)
+ col = split.split()
+ col.prop(experimental, "use_manta_fluids")
+ col = split.split()
+ col.operator("wm.url_open", text=task, icon='URL').url = "https://developer.blender.org/" + task
+
+
"""
# Example panel, leave it here so we always have a template to follow even
# after the features are gone from the experimental panel.
@@ -2277,6 +2293,7 @@ classes = (
USERPREF_PT_studiolight_world,
USERPREF_PT_experimental_all,
+ USERPREF_PT_experimental_physics,
# Add dynamically generated editor theme panels last,
# so they show up last in the theme section.
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index 8be7a947a67..00f0aa4340f 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -1019,6 +1019,14 @@ static void mesh_calc_modifiers(struct Depsgraph *depsgraph,
for (; md; md = md->next, md_datamask = md_datamask->next) {
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
+ /* Mantaflow currently requires experimental flag. */
+ if ((md->type == eModifierType_Manta) && !((U.experimental.flag & USER_EXPERIMENTAL_MANTA) ||
+ (U.experimental.flag & USER_EXPERIMENTAL_ALL))) {
+ modifier_setError(
+ md, "Modifier only available as experimental feature, can be enabled in preferences");
+ continue;
+ }
+
if (!modifier_isEnabled(scene, md, required_mode)) {
continue;
}
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index e68ce9d70b9..7b4d3128a85 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -239,7 +239,7 @@
/* local prototypes */
static void read_libraries(FileData *basefd, ListBase *mainlist);
static void *read_struct(FileData *fd, BHead *bh, const char *blockname);
-static void direct_link_modifiers(FileData *fd, ListBase *lb);
+static void direct_link_modifiers(FileData *fd, ListBase *lb, const Object *ob);
static BHead *find_bhead_from_code_name(FileData *fd, const short idcode, const char *name);
static BHead *find_bhead_from_idname(FileData *fd, const char *idname);
@@ -5471,7 +5471,7 @@ static void direct_link_pose(FileData *fd, bPose *pose)
}
}
-static void direct_link_modifiers(FileData *fd, ListBase *lb)
+static void direct_link_modifiers(FileData *fd, ListBase *lb, const Object *ob)
{
ModifierData *md;
@@ -5481,6 +5481,24 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
md->error = NULL;
md->runtime = NULL;
+ if (md->type == eModifierType_Fluidsim) {
+ blo_reportf_wrap(
+ fd->reports,
+ RPT_WARNING,
+ TIP_(
+ "Possible data loss when saving this file! %s modifier is deprecated (Object: %s)."),
+ md->name,
+ ob->id.name + 2);
+ }
+ else if (md->type == eModifierType_Smoke) {
+ blo_reportf_wrap(
+ fd->reports,
+ RPT_WARNING,
+ TIP_(
+ "Possible data loss when saving this file! %s modifier is deprecated (Object: %s)."),
+ md->name,
+ ob->id.name + 2);
+ }
/* if modifiers disappear, or for upward compatibility */
if (NULL == modifierType_getInfo(md->type)) {
md->type = eModifierType_None;
@@ -5523,16 +5541,8 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
clmd->solver_result = NULL;
}
- else if (md->type == eModifierType_Fluidsim) {
- FluidsimModifierData *fluidmd = (FluidsimModifierData *)md;
-
- fluidmd->fss = newdataadr(fd, fluidmd->fss);
- if (fluidmd->fss) {
- fluidmd->fss->fmd = fluidmd;
- fluidmd->fss->meshVelocities = NULL;
- }
- }
else if (md->type == eModifierType_Manta) {
+
MantaModifierData *mmd = (MantaModifierData *)md;
if (mmd->type == MOD_MANTA_TYPE_DOMAIN) {
@@ -5930,7 +5940,7 @@ static void direct_link_object(FileData *fd, Object *ob)
ob->matbits = newdataadr(fd, ob->matbits);
/* do it here, below old data gets converted */
- direct_link_modifiers(fd, &ob->modifiers);
+ direct_link_modifiers(fd, &ob->modifiers, ob);
direct_link_gpencil_modifiers(fd, &ob->greasepencil_modifiers);
direct_link_shaderfxs(fd, &ob->shader_fx);
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 15f1f596329..128814cb663 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -1631,6 +1631,14 @@ static void write_modifiers(WriteData *wd, ListBase *modbase)
else if (md->type == eModifierType_Manta) {
MantaModifierData *mmd = (MantaModifierData *)md;
+ bool is_valid = (mmd->domain || mmd->flow || mmd->effector);
+ /* Mantaflow currently requires experimental flag. */
+ if (!((U.experimental.flag & USER_EXPERIMENTAL_MANTA) ||
+ (U.experimental.flag & USER_EXPERIMENTAL_ALL)) &&
+ (!is_valid)) {
+ continue;
+ }
+
if (mmd->type & MOD_MANTA_TYPE_DOMAIN) {
writestruct(wd, DATA, MantaDomainSettings, 1, mmd->domain);
diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h
index d81d7a7f05f..110a0170bb5 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -62,7 +62,7 @@ typedef enum ModifierType {
eModifierType_SimpleDeform = 28,
eModifierType_Multires = 29,
eModifierType_Surface = 30,
- eModifierType_Manta = 31,
+ eModifierType_Smoke = 31,
eModifierType_ShapeKey = 32,
eModifierType_Solidify = 33,
eModifierType_Screw = 34,
@@ -86,6 +86,7 @@ typedef enum ModifierType {
eModifierType_MeshSequenceCache = 52,
eModifierType_SurfaceDeform = 53,
eModifierType_WeightedNormal = 54,
+ eModifierType_Manta = 55,
NUM_MODIFIER_TYPES,
} ModifierType;
@@ -984,6 +985,11 @@ typedef struct FluidsimModifierData {
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list