Simulations: Add new simulation data block

This data block will be the container for simulation node trees.
It will be used for the new particle node system (T73324).

The new data block has the type `ID_SIM`.
It is not visible to users and other developers by default yet.
To enable it, activate the cmake option `WITH_NEW_SIMULATION_TYPE`.

New simulation data blocks can be created by running `bpy.data.simulations.new("name")`.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D7225
This commit is contained in:
Jacques Lucke 2020-04-20 10:37:38 +02:00
parent 5f5ec7b0ed
commit eb4e3bbe68
Notes: blender-bot 2023-07-11 16:54:41 +02:00
Referenced by commit f3f05daf11, Cleanup: Remove unused "Simulation" data-block
46 changed files with 628 additions and 11 deletions

View File

@ -323,6 +323,10 @@ option(WITH_FREESTYLE "Enable Freestyle (advanced edges rendering)" ON)
option(WITH_NEW_OBJECT_TYPES "Enable new hair and pointcloud objects (use for development only, don't save in files)" OFF)
mark_as_advanced(WITH_NEW_OBJECT_TYPES)
# New simulation data block
option(WITH_NEW_SIMULATION_TYPE "Enable simulation data block (use for development only, don't save in files)" OFF)
mark_as_advanced(WITH_NEW_SIMULATION_TYPE)
# Misc
if(WIN32)
option(WITH_INPUT_IME "Enable Input Method Editor (IME) for complex Asian character input" ON)

View File

@ -165,6 +165,7 @@ extern IDTypeInfo IDType_ID_LP;
extern IDTypeInfo IDType_ID_HA;
extern IDTypeInfo IDType_ID_PT;
extern IDTypeInfo IDType_ID_VO;
extern IDTypeInfo IDType_ID_SIM;
extern IDTypeInfo IDType_ID_LINK_PLACEHOLDER;

View File

@ -147,6 +147,7 @@ typedef struct Main {
ListBase hairs;
ListBase pointclouds;
ListBase volumes;
ListBase simulations;
/**
* Must be generated, used and freed by same code - never assume this is valid data unless you
@ -220,7 +221,7 @@ const char *BKE_main_blendfile_path_from_global(void);
struct ListBase *which_libbase(struct Main *mainlib, short type);
#define MAX_LIBARRAY 40
#define MAX_LIBARRAY 41
int set_listbasepointers(struct Main *main, struct ListBase *lb[MAX_LIBARRAY]);
#define MAIN_VERSION_ATLEAST(main, ver, subver) \

View File

@ -0,0 +1,33 @@
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __BKE_SIMULATION_H__
#define __BKE_SIMULATION_H__
#ifdef __cplusplus
extern "C" {
#endif
struct Main;
struct Simulation;
void *BKE_simulation_add(struct Main *bmain, const char *name);
#ifdef __cplusplus
}
#endif
#endif /* __BKE_SIMULATION_H__ */

View File

@ -211,6 +211,7 @@ set(SRC
intern/sequencer.c
intern/shader_fx.c
intern/shrinkwrap.c
intern/simulation.cc
intern/softbody.c
intern/sound.c
intern/speaker.c
@ -362,6 +363,7 @@ set(SRC
BKE_sequencer.h
BKE_shader_fx.h
BKE_shrinkwrap.h
BKE_simulation.h
BKE_softbody.h
BKE_sound.h
BKE_speaker.h

View File

@ -95,6 +95,7 @@ bool id_type_can_have_animdata(const short id_type)
case ID_HA:
case ID_PT:
case ID_VO:
case ID_SIM:
return true;
/* no AnimData */
@ -1321,6 +1322,9 @@ void BKE_animdata_main_cb(Main *bmain, ID_AnimData_Edit_Callback func, void *use
/* volumes */
ANIMDATA_IDS_CB(bmain->volumes.first);
/* simulations */
ANIMDATA_IDS_CB(bmain->simulations.first);
}
/* Fix all RNA-Paths throughout the database (directly access the Global.main version)
@ -1430,6 +1434,9 @@ void BKE_animdata_fix_paths_rename_all(ID *ref_id,
/* volumes */
RENAMEFIX_ANIM_IDS(bmain->volumes.first);
/* simulations */
RENAMEFIX_ANIM_IDS(bmain->simulations.first);
/* scenes */
RENAMEFIX_ANIM_NODETREE_IDS(bmain->scenes.first, Scene);
}

View File

@ -2680,6 +2680,9 @@ void BKE_animsys_evaluate_all_animation(Main *main, Depsgraph *depsgraph, float
/* volumes */
EVAL_ANIM_IDS(main->volumes.first, ADT_RECALC_ANIM);
/* simulations */
EVAL_ANIM_IDS(main->simulations.first, ADT_RECALC_ANIM);
/* objects */
/* ADT_RECALC_ANIM doesn't need to be supplied here, since object AnimData gets
* this tagged by Depsgraph on framechange. This optimization means that objects

View File

@ -92,6 +92,7 @@ static void id_type_init(void)
INIT_TYPE(ID_HA);
INIT_TYPE(ID_PT);
INIT_TYPE(ID_VO);
INIT_TYPE(ID_SIM);
/* Special naughty boy... */
BLI_assert(IDType_ID_LINK_PLACEHOLDER.main_listbase_index == INDEX_ID_NULL);
@ -251,6 +252,7 @@ uint64_t BKE_idtype_idcode_to_idfilter(const short idcode)
CASE_IDFILTER(PT);
CASE_IDFILTER(LP);
CASE_IDFILTER(SCE);
CASE_IDFILTER(SIM);
CASE_IDFILTER(SPK);
CASE_IDFILTER(SO);
CASE_IDFILTER(TE);
@ -302,6 +304,7 @@ short BKE_idtype_idcode_from_idfilter(const uint64_t idfilter)
CASE_IDFILTER(PT);
CASE_IDFILTER(LP);
CASE_IDFILTER(SCE);
CASE_IDFILTER(SIM);
CASE_IDFILTER(SPK);
CASE_IDFILTER(SO);
CASE_IDFILTER(TE);
@ -356,6 +359,7 @@ int BKE_idtype_idcode_to_index(const short idcode)
CASE_IDINDEX(LP);
CASE_IDINDEX(SCE);
CASE_IDINDEX(SCR);
CASE_IDINDEX(SIM);
CASE_IDINDEX(SPK);
CASE_IDINDEX(SO);
CASE_IDINDEX(TE);
@ -417,6 +421,7 @@ short BKE_idtype_idcode_from_index(const int index)
CASE_IDCODE(LP);
CASE_IDCODE(SCE);
CASE_IDCODE(SCR);
CASE_IDCODE(SIM);
CASE_IDCODE(SPK);
CASE_IDCODE(SO);
CASE_IDCODE(TE);

View File

@ -49,6 +49,7 @@
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_sequence_types.h"
#include "DNA_simulation_types.h"
#include "DNA_sound_types.h"
#include "DNA_space_types.h"
#include "DNA_speaker_types.h"
@ -1294,6 +1295,7 @@ static void library_foreach_ID_link(Main *bmain,
case ID_PAL:
case ID_PC:
case ID_CF:
case ID_SIM:
break;
/* Deprecated. */
@ -1456,6 +1458,7 @@ bool BKE_library_id_can_use_idtype(ID *id_owner, const short id_type_used)
case ID_PAL:
case ID_PC:
case ID_CF:
case ID_SIM:
/* Those types never use/reference other IDs... */
return false;
case ID_IP:

View File

@ -479,6 +479,8 @@ ListBase *which_libbase(Main *bmain, short type)
return &(bmain->pointclouds);
case ID_VO:
return &(bmain->volumes);
case ID_SIM:
return &(bmain->simulations);
}
return NULL;
}
@ -554,6 +556,7 @@ int set_listbasepointers(Main *bmain, ListBase **lb)
lb[INDEX_ID_WS] = &(bmain->workspaces); /* before wm, so it's freed after it! */
lb[INDEX_ID_WM] = &(bmain->wm);
lb[INDEX_ID_MSK] = &(bmain->masks);
lb[INDEX_ID_SIM] = &(bmain->simulations);
lb[INDEX_ID_NULL] = NULL;

View File

@ -0,0 +1,93 @@
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/** \file
* \ingroup bke
*/
#include "MEM_guardedalloc.h"
#include "DNA_ID.h"
#include "DNA_defaults.h"
#include "DNA_simulation_types.h"
#include "BLI_compiler_compat.h"
#include "BLI_listbase.h"
#include "BLI_math.h"
#include "BLI_string.h"
#include "BLI_utildefines.h"
#include "BKE_anim_data.h"
#include "BKE_animsys.h"
#include "BKE_idtype.h"
#include "BKE_lib_id.h"
#include "BKE_lib_query.h"
#include "BKE_lib_remap.h"
#include "BKE_main.h"
#include "BKE_simulation.h"
#include "BLT_translation.h"
static void simulation_init_data(ID *id)
{
Simulation *simulation = (Simulation *)id;
BLI_assert(MEMCMP_STRUCT_AFTER_IS_ZERO(simulation, id));
MEMCPY_STRUCT_AFTER(simulation, DNA_struct_default_get(Simulation), id);
}
static void simulation_copy_data(Main *UNUSED(bmain),
ID *UNUSED(id_dst),
const ID *UNUSED(id_src),
const int UNUSED(flag))
{
}
static void simulation_make_local(Main *bmain, ID *id, const int flags)
{
BKE_lib_id_make_local_generic(bmain, id, flags);
}
static void simulation_free_data(ID *id)
{
Simulation *simulation = (Simulation *)id;
BKE_animdata_free(&simulation->id, false);
}
void *BKE_simulation_add(Main *bmain, const char *name)
{
Simulation *simulation = (Simulation *)BKE_libblock_alloc(bmain, ID_SIM, name, 0);
simulation_init_data(&simulation->id);
return simulation;
}
IDTypeInfo IDType_ID_SIM = {
/* id_code */ ID_SIM,
/* id_filter */ FILTER_ID_SIM,
/* main_listbase_index */ INDEX_ID_SIM,
/* struct_size */ sizeof(Simulation),
/* name */ "Simulation",
/* name_plural */ "simulations",
/* translation_context */ BLT_I18NCONTEXT_ID_SIMULATION,
/* flags */ 0,
/* init_data */ simulation_init_data,
/* copy_data */ simulation_copy_data,
/* free_data */ simulation_free_data,
/* make_local */ simulation_make_local,
};

View File

@ -86,6 +86,7 @@
#include "DNA_sdna_types.h"
#include "DNA_sequence_types.h"
#include "DNA_shader_fx_types.h"
#include "DNA_simulation_types.h"
#include "DNA_sound_types.h"
#include "DNA_space_types.h"
#include "DNA_speaker_types.h"
@ -146,6 +147,7 @@
#include "BKE_screen.h"
#include "BKE_sequencer.h"
#include "BKE_shader_fx.h"
#include "BKE_simulation.h"
#include "BKE_sound.h"
#include "BKE_volume.h"
#include "BKE_workspace.h"
@ -9140,6 +9142,24 @@ static void direct_link_volume(FileData *fd, Volume *volume)
/** \} */
/* -------------------------------------------------------------------- */
/** \name Read ID: Simulation
* \{ */
static void lib_link_simulation(FileData *UNUSED(fd),
Main *UNUSED(main),
Simulation *UNUSED(simulation))
{
}
static void direct_link_simulation(FileData *fd, Simulation *simulation)
{
simulation->adt = newdataadr(fd, simulation->adt);
direct_link_animdata(fd, simulation->adt);
}
/** \} */
/* -------------------------------------------------------------------- */
/** \name Read Library Data Block
* \{ */
@ -9258,6 +9278,8 @@ static const char *dataname(short id_code)
return "Data from PT";
case ID_VO:
return "Data from VO";
case ID_SIM:
return "Data from SIM";
}
return "Data from Lib Block";
}
@ -9409,6 +9431,9 @@ static bool direct_link_id(FileData *fd, Main *main, const int tag, ID *id, ID *
case ID_VO:
direct_link_volume(fd, (Volume *)id);
break;
case ID_SIM:
direct_link_simulation(fd, (Simulation *)id);
break;
}
return success;
@ -10089,6 +10114,9 @@ static void lib_link_all(FileData *fd, Main *bmain)
case ID_AC:
lib_link_action(fd, bmain, (bAction *)id);
break;
case ID_SIM:
lib_link_simulation(fd, bmain, (Simulation *)id);
break;
case ID_IP:
/* XXX deprecated... still needs to be maintained for version patches still. */
lib_link_ipo(fd, bmain, (Ipo *)id);
@ -11511,6 +11539,13 @@ static void expand_volume(FileData *fd, Main *mainvar, Volume *volume)
}
}
static void expand_simulation(FileData *fd, Main *mainvar, Simulation *simulation)
{
if (simulation->adt) {
expand_animdata(fd, mainvar, simulation->adt);
}
}
/**
* Set the callback func used over all ID data found by \a BLO_expand_main func.
*
@ -11640,6 +11675,9 @@ void BLO_expand_main(void *fdhandle, Main *mainvar)
case ID_VO:
expand_volume(fd, mainvar, (Volume *)id);
break;
case ID_SIM:
expand_simulation(fd, mainvar, (Simulation *)id);
break;
default:
break;
}

View File

@ -133,6 +133,7 @@
#include "DNA_sdna_types.h"
#include "DNA_sequence_types.h"
#include "DNA_shader_fx_types.h"
#include "DNA_simulation_types.h"
#include "DNA_sound_types.h"
#include "DNA_space_types.h"
#include "DNA_speaker_types.h"
@ -3848,6 +3849,18 @@ static void write_volume(WriteData *wd, Volume *volume, const void *id_address)
}
}
static void write_simulation(WriteData *wd, Simulation *simulation)
{
if (simulation->id.us > 0 || wd->use_memfile) {
writestruct(wd, ID_SIM, Simulation, 1, simulation);
write_iddata(wd, &simulation->id);
if (simulation->adt) {
write_animdata(wd, simulation->adt);
}
}
}
/* Keep it last of write_foodata functions. */
static void write_libraries(WriteData *wd, Main *main)
{
@ -4197,6 +4210,9 @@ static bool write_file_handle(Main *mainvar,
case ID_VO:
write_volume(wd, (Volume *)id_buffer, id);
break;
case ID_SIM:
write_simulation(wd, (Simulation *)id);
break;
case ID_LI:
/* Do nothing, handled below - and should never be reached. */
BLI_assert(0);

View File

@ -122,6 +122,7 @@ bool BLT_lang_is_ime_supported(void);
#define BLT_I18NCONTEXT_ID_IMAGE "Image"
/*#define BLT_I18NCONTEXT_ID_IPO "Ipo"*/ /* Deprecated */
#define BLT_I18NCONTEXT_ID_SHAPEKEY "Key"
#define BLT_I18NCONTEXT_ID_SIMULATION "Simulation"
#define BLT_I18NCONTEXT_ID_LIGHT "Light"
#define BLT_I18NCONTEXT_ID_LIBRARY "Library"
#define BLT_I18NCONTEXT_ID_LATTICE "Lattice"
@ -202,6 +203,7 @@ typedef struct {
BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_SCENE, "id_scene"), \
BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_SCREEN, "id_screen"), \
BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_SEQUENCE, "id_sequence"), \
BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_SIMULATION, "id_simulation"), \
BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_SPEAKER, "id_speaker"), \
BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_SOUND, "id_sound"), \
BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_TEXTURE, "id_texture"), \

View File

@ -60,6 +60,7 @@ extern "C" {
#include "DNA_rigidbody_types.h"
#include "DNA_scene_types.h"
#include "DNA_sequence_types.h"
#include "DNA_simulation_types.h"
#include "DNA_sound_types.h"
#include "DNA_speaker_types.h"
#include "DNA_texture_types.h"
@ -481,6 +482,9 @@ void DepsgraphNodeBuilder::build_id(ID *id)
case ID_SCE:
build_scene_parameters((Scene *)id);
break;
case ID_SIM:
build_simulation((Simulation *)id);
break;
default:
fprintf(stderr, "Unhandled ID %s\n", id->name);
BLI_assert(!"Should never happen");
@ -1698,6 +1702,16 @@ void DepsgraphNodeBuilder::build_sound(bSound *sound)
build_parameters(&sound->id);
}
void DepsgraphNodeBuilder::build_simulation(Simulation *simulation)
{
if (built_map_.checkIsBuiltAndTag(simulation)) {
return;
}
add_id_node(&simulation->id);
build_animdata(&simulation->id);
build_parameters(&simulation->id);
}
void DepsgraphNodeBuilder::build_scene_sequencer(Scene *scene)
{
if (scene->ed == nullptr) {

View File

@ -52,6 +52,7 @@ struct MovieClip;
struct Object;
struct ParticleSettings;
struct Scene;
struct Simulation;
struct Speaker;
struct Tex;
struct World;
@ -217,6 +218,7 @@ class DepsgraphNodeBuilder : public DepsgraphBuilder {
virtual void build_lightprobe(LightProbe *probe);
virtual void build_speaker(Speaker *speaker);
virtual void build_sound(bSound *sound);
virtual void build_simulation(Simulation *simulation);
virtual void build_scene_sequencer(Scene *scene);
virtual void build_scene_audio(Scene *scene);
virtual void build_scene_speakers(Scene *scene, ViewLayer *view_layer);

View File

@ -62,6 +62,7 @@ extern "C" {
#include "DNA_rigidbody_types.h"
#include "DNA_scene_types.h"
#include "DNA_sequence_types.h"
#include "DNA_simulation_types.h"
#include "DNA_sound_types.h"
#include "DNA_speaker_types.h"
#include "DNA_texture_types.h"
@ -558,6 +559,9 @@ void DepsgraphRelationBuilder::build_id(ID *id)
case ID_SCE:
build_scene_parameters((Scene *)id);
break;
case ID_SIM:
build_simulation((Simulation *)id);
break;
default:
fprintf(stderr, "Unhandled ID %s\n", id->name);
BLI_assert(!"Should never happen");
@ -2502,6 +2506,15 @@ void DepsgraphRelationBuilder::build_sound(bSound *sound)
build_parameters(&sound->id);
}
void DepsgraphRelationBuilder::build_simulation(Simulation *simulation)
{
if (built_map_.checkIsBuiltAndTag(simulation)) {
return;
}
build_animdata(&simulation->id);
build_parameters(&simulation->id);
}
void DepsgraphRelationBuilder::build_scene_sequencer(Scene *scene)
{
if (scene->ed == nullptr) {

View File

@ -68,6 +68,7 @@ struct Object;
struct ParticleSettings;
struct ParticleSystem;
struct Scene;
struct Simulation;
struct Speaker;
struct Tex;
struct ViewLayer;
@ -282,6 +283,7 @@ class DepsgraphRelationBuilder : public DepsgraphBuilder {
virtual void build_lightprobe(LightProbe *probe);
virtual void build_speaker(Speaker *speaker);
virtual void build_sound(bSound *sound);
virtual void build_simulation(Simulation *simulation);
virtual void build_scene_sequencer(Scene *scene);
virtual void build_scene_audio(Scene *scene);
virtual void build_scene_speakers(Scene *scene, ViewLayer *view_layer);

View File

@ -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 */

View File

@ -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 */

View File

@ -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;

View File

@ -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)))

View File

@ -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;
}

View File

@ -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. */

View File

@ -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: */

View File

@ -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;

View File

@ -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 */

View File

@ -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;
}

View File

@ -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, \

View File

@ -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:

View File

@ -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;
}

View File

@ -424,6 +424,7 @@ typedef enum ID_Type {
ID_HA = MAKE_ID2('H', 'A'), /* Hair */
ID_PT = MAKE_ID2('P', 'T'), /* PointCloud */
ID_VO = MAKE_ID2('V', 'O'), /* Volume */
ID_SIM = MAKE_ID2('S', 'I'), /* Simulation */
} ID_Type;
/* Only used as 'placeholder' in .blend files for directly linked data-blocks. */
@ -723,6 +724,7 @@ typedef enum IDRecalcFlag {
#define FILTER_ID_HA (1ULL << 32)
#define FILTER_ID_PT (1ULL << 33)
#define FILTER_ID_VO (1ULL << 34)
#define FILTER_ID_SIM (1ULL << 35)
#define FILTER_ID_ALL \
(FILTER_ID_AC | FILTER_ID_AR | FILTER_ID_BR | FILTER_ID_CA | FILTER_ID_CU | FILTER_ID_GD | \
@ -730,7 +732,7 @@ typedef enum IDRecalcFlag {
FILTER_ID_MB | FILTER_ID_MC | FILTER_ID_ME | FILTER_ID_MSK | FILTER_ID_NT | FILTER_ID_OB | \
FILTER_ID_PA | FILTER_ID_PAL | FILTER_ID_PC | FILTER_ID_SCE | FILTER_ID_SPK | FILTER_ID_SO | \
FILTER_ID_TE | FILTER_ID_TXT | FILTER_ID_VF | FILTER_ID_WO | FILTER_ID_CF | FILTER_ID_WS | \
FILTER_ID_LP | FILTER_ID_HA | FILTER_ID_PT | FILTER_ID_VO)
FILTER_ID_LP | FILTER_ID_HA | FILTER_ID_PT | FILTER_ID_VO | FILTER_ID_SIM)
/* IMPORTANT: this enum matches the order currently use in set_listbasepointers,
* keep them in sync! */
@ -774,6 +776,7 @@ enum {
INDEX_ID_WS,
INDEX_ID_WM,
INDEX_ID_MSK,
INDEX_ID_SIM,
INDEX_ID_NULL,
INDEX_ID_MAX,
};

View File

@ -0,0 +1,40 @@
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/** \file
* \ingroup DNA
*/
#ifndef __DNA_SIMULATION_DEFAULTS_H__
#define __DNA_SIMULATION_DEFAULTS_H__
/* Struct members on own line. */
/* clang-format off */
/* -------------------------------------------------------------------- */
/** \name Simulation Struct
* \{ */
#define _DNA_DEFAULT_Simulation \
{ \
.flag = 0, \
}
/** \} */
/* clang-format on */
#endif /* __DNA_SIMULATION_DEFAULTS_H__ */

View File

@ -0,0 +1,39 @@
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/** \file
* \ingroup DNA
*/
#ifndef __DNA_SIMULATION_TYPES_H__
#define __DNA_SIMULATION_TYPES_H__
#include "DNA_ID.h"
typedef struct Simulation {
ID id;
struct AnimData *adt; /* animation data (must be immediately after id) */
int flag;
int _pad1[1];
} Simulation;
/* Simulation.flag */
enum {
SIM_DS_EXPAND = (1 << 0),
};
#endif /* __DNA_SIMULATION_TYPES_H__ */

View File

@ -146,6 +146,7 @@ set(SRC
../DNA_object_defaults.h
../DNA_pointcloud_defaults.h
../DNA_scene_defaults.h
../DNA_simulation_defaults.h
../DNA_speaker_defaults.h
../DNA_texture_defaults.h
../DNA_vec_defaults.h

View File

@ -71,6 +71,7 @@
#include "DNA_object_types.h"
#include "DNA_pointcloud_types.h"
#include "DNA_scene_types.h"
#include "DNA_simulation_types.h"
#include "DNA_space_types.h"
#include "DNA_speaker_types.h"
#include "DNA_texture_types.h"
@ -93,6 +94,7 @@
#include "DNA_object_defaults.h"
#include "DNA_pointcloud_defaults.h"
#include "DNA_scene_defaults.h"
#include "DNA_simulation_defaults.h"
#include "DNA_speaker_defaults.h"
#include "DNA_texture_defaults.h"
#include "DNA_volume_defaults.h"
@ -150,6 +152,9 @@ SDNA_DEFAULT_DECL_STRUCT(PointCloud);
SDNA_DEFAULT_DECL_STRUCT(Scene);
SDNA_DEFAULT_DECL_STRUCT(ToolSettings);
/* DNA_simulation_defaults.h */
SDNA_DEFAULT_DECL_STRUCT(Simulation);
/* DNA_speaker_defaults.h */
SDNA_DEFAULT_DECL_STRUCT(Speaker);
@ -260,6 +265,9 @@ const void *DNA_default_table[SDNA_TYPE_MAX] = {
SDNA_DEFAULT_DECL_EX(GP_Sculpt_Settings, ToolSettings.gp_sculpt),
SDNA_DEFAULT_DECL_EX(GP_Sculpt_Guide, ToolSettings.gp_sculpt.guide),
/* DNA_simulation_defaults.h */
SDNA_DEFAULT_DECL(Simulation),
/* DNA_speaker_defaults.h */
SDNA_DEFAULT_DECL(Speaker),

View File

@ -136,6 +136,7 @@ static const char *includefiles[] = {
"DNA_hair_types.h",
"DNA_pointcloud_types.h",
"DNA_volume_types.h",
"DNA_simulation_types.h",
/* see comment above before editing! */
@ -1590,6 +1591,7 @@ int main(int argc, char **argv)
#include "DNA_sdna_types.h"
#include "DNA_sequence_types.h"
#include "DNA_shader_fx_types.h"
#include "DNA_simulation_types.h"
#include "DNA_sound_types.h"
#include "DNA_space_types.h"
#include "DNA_speaker_types.h"

View File

@ -548,6 +548,7 @@ extern StructRNA RNA_ShrinkwrapConstraint;
extern StructRNA RNA_ShrinkwrapModifier;
extern StructRNA RNA_SimpleDeformModifier;
extern StructRNA RNA_SimplifyGpencilModifier;
extern StructRNA RNA_Simulation;
extern StructRNA RNA_SkinModifier;
extern StructRNA RNA_SmoothGpencilModifier;
extern StructRNA RNA_SmoothModifier;

View File

@ -103,6 +103,13 @@ if(WITH_NEW_OBJECT_TYPES)
)
endif()
if (WITH_NEW_SIMULATION_TYPE)
list(APPEND DEFSRC
rna_simulation.c
)
endif()
set(APISRC
rna_action_api.c
rna_animation_api.c
@ -342,6 +349,11 @@ if(WITH_NEW_OBJECT_TYPES)
add_definitions(-DWITH_NEW_OBJECT_TYPES)
endif()
if (WITH_NEW_SIMULATION_TYPE)
add_definitions(-DWITH_NEW_SIMULATION_TYPE)
endif()
# Build makesrna executable
blender_include_dirs(
.

View File

@ -4302,6 +4302,9 @@ static RNAProcessItem PROCESS_ITEMS[] = {
{"rna_screen.c", NULL, RNA_def_screen},
{"rna_sculpt_paint.c", NULL, RNA_def_sculpt_paint},
{"rna_sequencer.c", "rna_sequencer_api.c", RNA_def_sequencer},
#ifdef WITH_NEW_SIMULATION_TYPE
{"rna_simulation.c", NULL, RNA_def_simulation},
#endif
{"rna_space.c", "rna_space_api.c", RNA_def_space},
{"rna_speaker.c", NULL, RNA_def_speaker},
{"rna_test.c", NULL, RNA_def_test},

View File

@ -71,6 +71,9 @@ const EnumPropertyItem rna_enum_id_type_items[] = {
{ID_PA, "PARTICLE", ICON_PARTICLE_DATA, "Particle", ""},
{ID_LP, "LIGHT_PROBE", ICON_LIGHTPROBE_CUBEMAP, "Light Probe", ""},
{ID_SCE, "SCENE", ICON_SCENE_DATA, "Scene", ""},
#ifdef WITH_NEW_SIMULATION_TYPE
{ID_SIM, "SIMULATION", ICON_PHYSICS, "Simulation", ""}, /* TODO: Use correct icon. */
#endif
{ID_SO, "SOUND", ICON_SOUND, "Sound", ""},
{ID_SPK, "SPEAKER", ICON_SPEAKER, "Speaker", ""},
{ID_TXT, "TEXT", ICON_TEXT, "Text", ""},
@ -303,6 +306,11 @@ short RNA_type_to_ID_code(const StructRNA *type)
if (base_type == &RNA_Screen) {
return ID_SCR;
}
# ifdef WITH_NEW_SIMULATION_TYPE
if (base_type == &RNA_Simulation) {
return ID_SIM;
}
# endif
if (base_type == &RNA_Sound) {
return ID_SO;
}
@ -405,6 +413,12 @@ StructRNA *ID_code_to_RNA_type(short idcode)
return &RNA_Scene;
case ID_SCR:
return &RNA_Screen;
case ID_SIM:
# ifdef WITH_NEW_SIMULATION_TYPE
return &RNA_Simulation;
# else
return &RNA_ID;
# endif
case ID_SO:
return &RNA_Sound;
case ID_SPK:

View File

@ -185,6 +185,7 @@ void RNA_def_render(struct BlenderRNA *brna);
void RNA_def_rigidbody(struct BlenderRNA *brna);
void RNA_def_rna(struct BlenderRNA *brna);
void RNA_def_scene(struct BlenderRNA *brna);
void RNA_def_simulation(struct BlenderRNA *brna);
void RNA_def_view_layer(struct BlenderRNA *brna);
void RNA_def_screen(struct BlenderRNA *brna);
void RNA_def_sculpt_paint(struct BlenderRNA *brna);
@ -449,6 +450,7 @@ void RNA_def_main_lightprobes(BlenderRNA *brna, PropertyRNA *cprop);
void RNA_def_main_hairs(BlenderRNA *brna, PropertyRNA *cprop);
void RNA_def_main_pointclouds(BlenderRNA *brna, PropertyRNA *cprop);
void RNA_def_main_volumes(BlenderRNA *brna, PropertyRNA *cprop);
void RNA_def_main_simulations(BlenderRNA *brna, PropertyRNA *cprop);
/* ID Properties */

View File

@ -134,6 +134,9 @@ RNA_MAIN_LISTBASE_FUNCS_DEF(pointclouds)
RNA_MAIN_LISTBASE_FUNCS_DEF(scenes)
RNA_MAIN_LISTBASE_FUNCS_DEF(screens)
RNA_MAIN_LISTBASE_FUNCS_DEF(shapekeys)
# ifdef WITH_NEW_SIMULATION_TYPE
RNA_MAIN_LISTBASE_FUNCS_DEF(simulations)
# endif
RNA_MAIN_LISTBASE_FUNCS_DEF(sounds)
RNA_MAIN_LISTBASE_FUNCS_DEF(speakers)
RNA_MAIN_LISTBASE_FUNCS_DEF(texts)
@ -402,6 +405,14 @@ void RNA_def_main(BlenderRNA *brna)
"Volumes",
"Volume data-blocks",
RNA_def_main_volumes},
# ifdef WITH_NEW_SIMULATION_TYPE
{"simulations",
"Simulation",
"rna_Main_simulations_begin",
"Simulations",
"Simulation data-blocks",
RNA_def_main_simulations},
# endif
{NULL, NULL, NULL, NULL, NULL, NULL},
};

View File

@ -69,6 +69,7 @@
# include "BKE_particle.h"
# include "BKE_pointcloud.h"
# include "BKE_scene.h"
# include "BKE_simulation.h"
# include "BKE_sound.h"
# include "BKE_speaker.h"
# include "BKE_text.h"
@ -98,6 +99,7 @@
# include "DNA_node_types.h"
# include "DNA_particle_types.h"
# include "DNA_pointcloud_types.h"
# include "DNA_simulation_types.h"
# include "DNA_sound_types.h"
# include "DNA_speaker_types.h"
# include "DNA_text_types.h"
@ -738,6 +740,18 @@ static Volume *rna_Main_volumes_new(Main *bmain, const char *name)
return volume;
}
# ifdef WITH_NEW_SIMULATION_TYPE
static Simulation *rna_Main_simulations_new(Main *bmain, const char *name)
{
char safe_name[MAX_ID_NAME - 2];
rna_idname_validate(name, safe_name);
Simulation *simulation = BKE_simulation_add(bmain, safe_name);
id_us_min(&simulation->id);
return simulation;
}
# endif
/* tag functions, all the same */
# define RNA_MAIN_ID_TAG_FUNCS_DEF(_func_name, _listbase_name, _id_type) \
static void rna_Main_##_func_name##_tag(Main *bmain, bool value) \
@ -785,6 +799,9 @@ RNA_MAIN_ID_TAG_FUNCS_DEF(hairs, hairs, ID_HA)
RNA_MAIN_ID_TAG_FUNCS_DEF(pointclouds, pointclouds, ID_PT)
# endif
RNA_MAIN_ID_TAG_FUNCS_DEF(volumes, volumes, ID_VO)
# ifdef WITH_NEW_SIMULATION_TYPE
RNA_MAIN_ID_TAG_FUNCS_DEF(simulations, simulations, ID_SIM)
# endif
# undef RNA_MAIN_ID_TAG_FUNCS_DEF
@ -2304,4 +2321,44 @@ void RNA_def_main_volumes(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
void RNA_def_main_simulations(BlenderRNA *brna, PropertyRNA *cprop)
{
StructRNA *srna;
FunctionRNA *func;
PropertyRNA *parm;
RNA_def_property_srna(cprop, "BlendDataSimulations");
srna = RNA_def_struct(brna, "BlendDataSimulations", NULL);
RNA_def_struct_sdna(srna, "Main");
RNA_def_struct_ui_text(srna, "Main Simulations", "Collection of simulations");
func = RNA_def_function(srna, "new", "rna_Main_simulations_new");
RNA_def_function_ui_description(func, "Add a new simulation to the main database");
parm = RNA_def_string(func, "name", "Simulation", 0, "", "New name for the data-block");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
/* return type */
parm = RNA_def_pointer(func, "simulation", "Simulation", "", "New simulation data-block");
RNA_def_function_return(func, parm);
func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Remove a simulation from the current blendfile");
parm = RNA_def_pointer(func, "simulation", "Simulation", "", "Simulation to remove");
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
RNA_def_boolean(
func, "do_unlink", true, "", "Unlink all usages of this simulation before deleting it");
RNA_def_boolean(func,
"do_id_user",
true,
"",
"Decrement user counter of all datablocks used by this simulation data");
RNA_def_boolean(
func, "do_ui_user", true, "", "Make sure interface does not reference this simulation data");
func = RNA_def_function(srna, "tag", "rna_Main_simulations_tag");
parm = RNA_def_boolean(func, "value", 0, "Value", "");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
#endif

View File

@ -0,0 +1,51 @@
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/** \file
* \ingroup RNA
*/
#include <stdlib.h>
#include "RNA_define.h"
#include "RNA_enum_types.h"
#include "DNA_simulation_types.h"
#include "rna_internal.h"
#ifdef RNA_RUNTIME
#else
static void rna_def_simulation(BlenderRNA *brna)
{
StructRNA *srna;
srna = RNA_def_struct(brna, "Simulation", "ID");
RNA_def_struct_ui_text(srna, "Simulation", "Simulation data-block");
RNA_def_struct_ui_icon(srna, ICON_PHYSICS); /* TODO: Use correct icon. */
/* common */
rna_def_animdata_common(srna);
}
void RNA_def_simulation(BlenderRNA *brna)
{
rna_def_simulation(brna);
}
#endif

View File

@ -5527,6 +5527,13 @@ static void rna_def_fileselect_idfilter(BlenderRNA *brna)
"Show/hide Point Cloud data-blocks"},
# endif
{FILTER_ID_SCE, "filter_scene", ICON_SCENE_DATA, "Scenes", "Show Scene data-blocks"},
# ifdef WITH_NEW_SIMULATION_TYPE
{FILTER_ID_SIM,
"filter_simulation",
ICON_PHYSICS,
"Simulations",
"Show Simulation data-blocks"}, /* TODO: Use correct icon. */
# endif
{FILTER_ID_SPK, "filter_speaker", ICON_SPEAKER, "Speakers", "Show Speaker data-blocks"},
{FILTER_ID_SO, "filter_sound", ICON_SOUND, "Sounds", "Show Sound data-blocks"},
{FILTER_ID_TE, "filter_texture", ICON_TEXTURE_DATA, "Textures", "Show Texture data-blocks"},