fix(web): synchronize WebEngine WASM with Blender sources
This commit is contained in:
@@ -26,6 +26,9 @@
|
||||
|
||||
#include "BKE_modifier.hh"
|
||||
|
||||
#include "UI_resources.hh"
|
||||
#include "RNA_prototypes.hh"
|
||||
|
||||
#include "DEG_depsgraph_query.hh"
|
||||
|
||||
#include "MOD_modifiertypes.hh"
|
||||
@@ -35,6 +38,42 @@
|
||||
|
||||
namespace blender {
|
||||
|
||||
#ifdef WITH_WEB
|
||||
/* Web keeps simulation modifiers metadata-only, but the concrete DNA type is
|
||||
* required so BLO_write_file serializes the same block layout it read. */
|
||||
static bool web_simulation_modifier_disabled(const Scene * /*scene*/,
|
||||
ModifierData * /*md*/,
|
||||
const bool /*use_render_params*/)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
static ModifierTypeInfo web_simulation_modifier_type(const char *idname,
|
||||
const char *struct_name,
|
||||
const int struct_size,
|
||||
const int icon)
|
||||
{
|
||||
ModifierTypeInfo info{};
|
||||
std::strncpy(info.idname, idname, sizeof(info.idname) - 1);
|
||||
std::strncpy(info.name, idname, sizeof(info.name) - 1);
|
||||
std::strncpy(info.struct_name, struct_name, sizeof(info.struct_name) - 1);
|
||||
info.struct_size = struct_size;
|
||||
info.srna = &RNA_Modifier;
|
||||
info.type = ModifierTypeType::OnlyDeform;
|
||||
info.flags = eModifierTypeFlag_AcceptsMesh;
|
||||
info.icon = icon;
|
||||
info.is_disabled = web_simulation_modifier_disabled;
|
||||
return info;
|
||||
}
|
||||
|
||||
ModifierTypeInfo modifierType_Softbody = web_simulation_modifier_type(
|
||||
"Softbody", "SoftbodyModifierData", sizeof(SoftbodyModifierData), ICON_MOD_SOFT);
|
||||
ModifierTypeInfo modifierType_Cloth = web_simulation_modifier_type(
|
||||
"Cloth", "ClothModifierData", sizeof(ClothModifierData), ICON_MOD_CLOTH);
|
||||
ModifierTypeInfo modifierType_Collision = web_simulation_modifier_type(
|
||||
"Collision", "CollisionModifierData", sizeof(CollisionModifierData), ICON_MOD_PHYSICS);
|
||||
#endif
|
||||
|
||||
void MOD_init_texture(MappingInfoModifierData *dmd, const ModifierEvalContext *ctx)
|
||||
{
|
||||
Tex *tex = dmd->texture;
|
||||
@@ -227,6 +266,11 @@ void modifier_type_init(ModifierTypeInfo *types[])
|
||||
INIT_TYPE(EdgeSplit);
|
||||
INIT_TYPE(Armature);
|
||||
INIT_TYPE(Hook);
|
||||
/* These simulation modifiers remain metadata-only in the Web evaluator,
|
||||
* but must retain their concrete DNA layouts when Main is serialized. */
|
||||
INIT_TYPE(Softbody);
|
||||
INIT_TYPE(Cloth);
|
||||
INIT_TYPE(Collision);
|
||||
INIT_TYPE(Boolean);
|
||||
INIT_TYPE(MeshDeform);
|
||||
INIT_TYPE(Nodes);
|
||||
|
||||
Reference in New Issue
Block a user