Probe: Add new object datablock

We went for a new datablock because blending probe functionality with empties was going to be messy.
This commit is contained in:
2017-06-06 22:47:41 +02:00
parent 346619159a
commit cc31d7bb49
31 changed files with 452 additions and 3 deletions

View File

@@ -71,6 +71,7 @@ set(SRC_DNA_INC
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_outliner_types.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_packedFile_types.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_particle_types.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_probe_types.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_property_types.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_rigidbody_types.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_scene_types.h

View File

@@ -95,7 +95,7 @@ void id_clear_lib_data_ex(struct Main *bmain, struct ID *id, const bool id_in_ma
struct ListBase *which_libbase(struct Main *mainlib, short type);
#define MAX_LIBARRAY 36
#define MAX_LIBARRAY 37
int set_listbasepointers(struct Main *main, struct ListBase *lb[MAX_LIBARRAY]);
/* Main API */

View File

@@ -108,6 +108,7 @@ typedef struct Main {
ListBase vfont;
ListBase text;
ListBase speaker;
ListBase probe;
ListBase sound;
ListBase group;
ListBase armature;

View File

@@ -0,0 +1,45 @@
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* 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.
*
* The Original Code is Copyright (C) Blender Foundation.
* All rights reserved.
*
* The Original Code is: all of this file.
*
* Contributor(s): none yet.
*
* ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_PROBE_H__
#define __BKE_PROBE_H__
/** \file BKE_probe.h
* \ingroup bke
* \brief General operations for probes.
*/
struct Main;
struct Probe;
void BKE_probe_init(struct Probe *probe);
void *BKE_probe_add(struct Main *bmain, const char *name);
struct Probe *BKE_probe_copy(struct Main *bmain, struct Probe *probe);
void BKE_probe_make_local(struct Main *bmain, struct Probe *probe, const bool lib_local);
void BKE_probe_free(struct Probe *probe);
#endif /* __BKE_PROBE_H__ */

View File

@@ -159,6 +159,7 @@ set(SRC
intern/pbvh.c
intern/pbvh_bmesh.c
intern/pointcache.c
intern/probe.c
intern/property.c
intern/layer.c
intern/report.c
@@ -280,6 +281,7 @@ set(SRC
BKE_particle.h
BKE_pbvh.h
BKE_pointcache.h
BKE_probe.h
BKE_property.h
BKE_layer.h
BKE_report.h

View File

@@ -94,6 +94,7 @@ bool id_type_can_have_animdata(const short id_type)
case ID_MA: case ID_TE: case ID_NT:
case ID_LA: case ID_CA: case ID_WO:
case ID_LS:
case ID_PRB:
case ID_SPK:
case ID_SCE:
case ID_MC:

View File

@@ -81,6 +81,7 @@ static IDType idtypes[] = {
{ ID_PA, "ParticleSettings", "particles", BLT_I18NCONTEXT_ID_PARTICLESETTINGS, IDTYPE_FLAGS_ISLINKABLE },
{ ID_PAL, "Palettes", "palettes", BLT_I18NCONTEXT_ID_PALETTE, IDTYPE_FLAGS_ISLINKABLE },
{ ID_PC, "PaintCurve", "paint_curves", BLT_I18NCONTEXT_ID_PAINTCURVE, IDTYPE_FLAGS_ISLINKABLE },
{ ID_PRB, "Probe", "probes", BLT_I18NCONTEXT_ID_PROBE, IDTYPE_FLAGS_ISLINKABLE },
{ ID_SCE, "Scene", "scenes", BLT_I18NCONTEXT_ID_SCENE, IDTYPE_FLAGS_ISLINKABLE },
{ ID_SCR, "Screen", "screens", BLT_I18NCONTEXT_ID_SCREEN, IDTYPE_FLAGS_ISLINKABLE },
{ ID_SEQ, "Sequence", "sequences", BLT_I18NCONTEXT_ID_SEQUENCE, 0 }, /* not actually ID data */
@@ -204,6 +205,7 @@ int BKE_idcode_to_idfilter(const short idcode)
CASE_IDFILTER(PA);
CASE_IDFILTER(PAL);
CASE_IDFILTER(PC);
CASE_IDFILTER(PRB);
CASE_IDFILTER(SCE);
CASE_IDFILTER(SPK);
CASE_IDFILTER(SO);
@@ -249,6 +251,7 @@ short BKE_idcode_from_idfilter(const int idfilter)
CASE_IDFILTER(PA);
CASE_IDFILTER(PAL);
CASE_IDFILTER(PC);
CASE_IDFILTER(PRB);
CASE_IDFILTER(SCE);
CASE_IDFILTER(SPK);
CASE_IDFILTER(SO);
@@ -296,6 +299,7 @@ int BKE_idcode_to_index(const short idcode)
CASE_IDINDEX(PA);
CASE_IDINDEX(PAL);
CASE_IDINDEX(PC);
CASE_IDINDEX(PRB);
CASE_IDINDEX(SCE);
CASE_IDINDEX(SCR);
CASE_IDINDEX(SPK);

View File

@@ -62,6 +62,7 @@
#include "DNA_mask_types.h"
#include "DNA_node_types.h"
#include "DNA_object_types.h"
#include "DNA_probe_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_speaker_types.h"
@@ -117,6 +118,7 @@
#include "BKE_paint.h"
#include "BKE_particle.h"
#include "BKE_packedFile.h"
#include "BKE_probe.h"
#include "BKE_sound.h"
#include "BKE_speaker.h"
#include "BKE_scene.h"
@@ -419,6 +421,9 @@ bool id_make_local(Main *bmain, ID *id, const bool test, const bool lib_local)
case ID_SPK:
if (!test) BKE_speaker_make_local(bmain, (Speaker *)id, lib_local);
return true;
case ID_PRB:
if (!test) BKE_probe_make_local(bmain, (Probe *)id, lib_local);
return true;
case ID_WO:
if (!test) BKE_world_make_local(bmain, (World *)id, lib_local);
return true;
@@ -532,6 +537,9 @@ bool id_copy(Main *bmain, ID *id, ID **newid, bool test)
case ID_SPK:
if (!test) *newid = (ID *)BKE_speaker_copy(bmain, (Speaker *)id);
return true;
case ID_PRB:
if (!test) *newid = (ID *)BKE_probe_copy(bmain, (Probe *)id);
return true;
case ID_CA:
if (!test) *newid = (ID *)BKE_camera_copy(bmain, (Camera *)id);
return true;
@@ -669,6 +677,8 @@ ListBase *which_libbase(Main *mainlib, short type)
return &(mainlib->text);
case ID_SPK:
return &(mainlib->speaker);
case ID_PRB:
return &(mainlib->probe);
case ID_SO:
return &(mainlib->sound);
case ID_GR:
@@ -839,6 +849,7 @@ int set_listbasepointers(Main *main, ListBase **lb)
lb[INDEX_ID_BR] = &(main->brush);
lb[INDEX_ID_PA] = &(main->particle);
lb[INDEX_ID_SPK] = &(main->speaker);
lb[INDEX_ID_PRB] = &(main->probe);
lb[INDEX_ID_WO] = &(main->world);
lb[INDEX_ID_MC] = &(main->movieclip);
@@ -931,6 +942,9 @@ void *BKE_libblock_alloc_notest(short type)
case ID_SPK:
id = MEM_callocN(sizeof(Speaker), "speaker");
break;
case ID_PRB:
id = MEM_callocN(sizeof(Probe), "probe");
break;
case ID_SO:
id = MEM_callocN(sizeof(bSound), "sound");
break;
@@ -1057,6 +1071,9 @@ void BKE_libblock_init_empty(ID *id)
case ID_SPK:
BKE_speaker_init((Speaker *)id);
break;
case ID_PRB:
BKE_probe_init((Probe *)id);
break;
case ID_CA:
BKE_camera_init((Camera *)id);
break;

View File

@@ -53,6 +53,7 @@
#include "DNA_mask_types.h"
#include "DNA_node_types.h"
#include "DNA_object_types.h"
#include "DNA_probe_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_speaker_types.h"
@@ -99,6 +100,7 @@
#include "BKE_object.h"
#include "BKE_paint.h"
#include "BKE_particle.h"
#include "BKE_probe.h"
#include "BKE_sca.h"
#include "BKE_speaker.h"
#include "BKE_sound.h"
@@ -838,6 +840,9 @@ void BKE_libblock_free_ex(Main *bmain, void *idv, const bool do_id_user, const b
case ID_SPK:
BKE_speaker_free((Speaker *)id);
break;
case ID_PRB:
BKE_probe_free((Probe *)id);
break;
case ID_SO:
BKE_sound_free((bSound *)id);
break;

View File

@@ -58,6 +58,7 @@
#include "DNA_view3d_types.h"
#include "DNA_world_types.h"
#include "DNA_object_types.h"
#include "DNA_probe_types.h"
#include "DNA_property_types.h"
#include "DNA_rigidbody_types.h"
@@ -107,6 +108,7 @@
#include "BKE_paint.h"
#include "BKE_particle.h"
#include "BKE_pointcache.h"
#include "BKE_probe.h"
#include "BKE_property.h"
#include "BKE_rigidbody.h"
#include "BKE_sca.h"
@@ -602,6 +604,7 @@ void *BKE_object_obdata_add_from_type(Main *bmain, int type, const char *name)
case OB_LATTICE: return BKE_lattice_add(bmain, name);
case OB_ARMATURE: return BKE_armature_add(bmain, name);
case OB_SPEAKER: return BKE_speaker_add(bmain, name);
case OB_PROBE: return BKE_probe_add(bmain, name);
case OB_EMPTY: return NULL;
default:
printf("%s: Internal error, bad type: %d\n", __func__, type);

View File

@@ -0,0 +1,80 @@
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* 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.
*
* The Original Code is Copyright (C) Blender Foundation.
* All rights reserved.
*
* The Original Code is: all of this file.
*
* Contributor(s): none yet.
*
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/blenkernel/intern/probe.c
* \ingroup bke
*/
#include "DNA_object_types.h"
#include "DNA_probe_types.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BKE_animsys.h"
#include "BKE_global.h"
#include "BKE_main.h"
#include "BKE_probe.h"
void BKE_probe_init(Probe *probe)
{
BLI_assert(MEMCMP_STRUCT_OFS_IS_ZERO(probe, id));
probe->influence = 0.5f;
}
void *BKE_probe_add(Main *bmain, const char *name)
{
Probe *probe;
probe = BKE_libblock_alloc(bmain, ID_PRB, name);
BKE_probe_init(probe);
return probe;
}
Probe *BKE_probe_copy(Main *bmain, Probe *probe)
{
Probe *probe_new;
probe_new = BKE_libblock_copy(bmain, &probe->id);
BKE_id_copy_ensure_local(bmain, &probe->id, &probe_new->id);
return probe_new;
}
void BKE_probe_make_local(Main *bmain, Probe *probe, const bool lib_local)
{
BKE_id_make_local_generic(bmain, &probe->id, true, lib_local);
}
void BKE_probe_free(Probe *probe)
{
BKE_animdata_free((ID *)probe, false);
}

View File

@@ -89,6 +89,7 @@
#include "DNA_object_types.h"
#include "DNA_packedFile_types.h"
#include "DNA_particle_types.h"
#include "DNA_probe_types.h"
#include "DNA_property_types.h"
#include "DNA_rigidbody_types.h"
#include "DNA_text_types.h"
@@ -7645,6 +7646,26 @@ static void fix_relpaths_library(const char *basepath, Main *main)
}
}
/* ************ READ PROBE ***************** */
static void lib_link_probe(FileData *fd, Main *main)
{
for (Probe *prb = main->speaker.first; prb; prb = prb->id.next) {
if (prb->id.tag & LIB_TAG_NEED_LINK) {
IDP_LibLinkProperty(prb->id.properties, fd);
lib_link_animdata(fd, &prb->id, prb->adt);
prb->id.tag &= ~LIB_TAG_NEED_LINK;
}
}
}
static void direct_link_probe(FileData *fd, Probe *prb)
{
prb->adt = newdataadr(fd, prb->adt);
direct_link_animdata(fd, prb->adt);
}
/* ************ READ SPEAKER ***************** */
static void lib_link_speaker(FileData *fd, Main *main)
@@ -8260,6 +8281,7 @@ static const char *dataname(short id_code)
case ID_VF: return "Data from VF";
case ID_TXT : return "Data from TXT";
case ID_SPK: return "Data from SPK";
case ID_PRB: return "Data from PRB";
case ID_SO: return "Data from SO";
case ID_NT: return "Data from NT";
case ID_BR: return "Data from BR";
@@ -8492,6 +8514,9 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, const short
case ID_SO:
direct_link_sound(fd, (bSound *)id);
break;
case ID_PRB:
direct_link_probe(fd, (Probe *)id);
break;
case ID_GR:
direct_link_group(fd, (Group *)id);
break;
@@ -8697,6 +8722,7 @@ static void lib_link_all(FileData *fd, Main *main)
lib_link_text(fd, main);
lib_link_camera(fd, main);
lib_link_speaker(fd, main);
lib_link_probe(fd, main);
lib_link_sound(fd, main);
lib_link_group(fd, main);
lib_link_armature(fd, main);
@@ -9882,6 +9908,12 @@ static void expand_sound(FileData *fd, Main *mainvar, bSound *snd)
expand_doit(fd, mainvar, snd->ipo); // XXX deprecated - old animation system
}
static void expand_probe(FileData *fd, Main *mainvar, Probe *prb)
{
if (prb->adt)
expand_animdata(fd, mainvar, prb->adt);
}
static void expand_movieclip(FileData *fd, Main *mainvar, MovieClip *clip)
{
if (clip->adt)
@@ -10042,6 +10074,9 @@ void BLO_expand_main(void *fdhandle, Main *mainvar)
case ID_SO:
expand_sound(fd, mainvar, (bSound *)id);
break;
case ID_PRB:
expand_probe(fd, mainvar, (Probe *)id);
break;
case ID_AR:
expand_armature(fd, mainvar, (bArmature *)id);
break;

View File

@@ -135,6 +135,7 @@
#include "DNA_object_force.h"
#include "DNA_packedFile_types.h"
#include "DNA_particle_types.h"
#include "DNA_probe_types.h"
#include "DNA_property_types.h"
#include "DNA_rigidbody_types.h"
#include "DNA_scene_types.h"
@@ -3201,6 +3202,19 @@ static void write_sound(WriteData *wd, bSound *sound)
}
}
static void write_probe(WriteData *wd, Probe *prb)
{
if (prb->id.us > 0 || wd->current) {
/* write LibData */
writestruct(wd, ID_PRB, Probe, 1, prb);
write_iddata(wd, &prb->id);
if (prb->adt) {
write_animdata(wd, prb->adt);
}
}
}
static void write_group(WriteData *wd, Group *group)
{
if (group->id.us > 0 || wd->current) {
@@ -3984,6 +3998,9 @@ static bool write_file_handle(
case ID_SPK:
write_speaker(wd, (Speaker *)id);
break;
case ID_PRB:
write_probe(wd, (Probe *)id);
break;
case ID_SO:
write_sound(wd, (bSound *)id);
break;

View File

@@ -140,6 +140,7 @@ bool BLT_lang_is_ime_supported(void);
#define BLT_I18NCONTEXT_ID_PAINTCURVE "PaintCurve"
#define BLT_I18NCONTEXT_ID_PALETTE "Palette"
#define BLT_I18NCONTEXT_ID_PARTICLESETTINGS "ParticleSettings"
#define BLT_I18NCONTEXT_ID_PROBE "Probe"
#define BLT_I18NCONTEXT_ID_SCENE "Scene"
#define BLT_I18NCONTEXT_ID_SCREEN "Screen"
#define BLT_I18NCONTEXT_ID_SEQUENCE "Sequence"
@@ -195,6 +196,7 @@ typedef struct {
BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_PAINTCURVE, "id_paintcurve"), \
BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_PALETTE, "id_palette"), \
BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_PARTICLESETTINGS, "id_particlesettings"), \
BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_PROBE, "id_probe"), \
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"), \

View File

@@ -1359,6 +1359,8 @@ int UI_idcode_icon_get(const int idcode)
return ICON_COLOR; /* TODO! this would need its own icon! */
case ID_PC:
return ICON_CURVE_BEZCURVE; /* TODO! this would need its own icon! */
case ID_PRB:
return ICON_RADIO;
case ID_SCE:
return ICON_SCENE_DATA;
case ID_SPK:

View File

@@ -451,6 +451,7 @@ static const char *template_id_browse_tip(const StructRNA *type)
case ID_PC: return N_("Browse Paint Curve Data to be linked");
case ID_CF: return N_("Browse Cache Files to be linked");
case ID_WS: return N_("Browse Workspace to be linked");
case ID_PRB: return N_("Browse Probe to be linked");
}
}
return N_("Browse ID data to be linked");
@@ -589,6 +590,7 @@ static void template_ID(
BLT_I18NCONTEXT_ID_GPENCIL,
BLT_I18NCONTEXT_ID_FREESTYLELINESTYLE,
BLT_I18NCONTEXT_ID_WORKSPACE,
BLT_I18NCONTEXT_ID_PROBE,
);
if (newop) {

View File

@@ -215,7 +215,8 @@ short ED_fileselect_set_params(SpaceFile *sfile)
FILTER_ID_GR | FILTER_ID_IM | FILTER_ID_LA | FILTER_ID_LS | FILTER_ID_LT | FILTER_ID_MA |
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_TE | FILTER_ID_TXT | FILTER_ID_VF | FILTER_ID_WO | FILTER_ID_CF | FILTER_ID_WS |
FILTER_ID_PRB;
if (U.uiflag & USER_HIDE_DOT) {
params->flag |= FILE_HIDE_DOT;

View File

@@ -108,7 +108,7 @@ typedef struct TreeElement {
#define TREESTORE_ID_TYPE(_id) \
(ELEM(GS((_id)->name), ID_SCE, ID_LI, ID_OB, ID_ME, ID_CU, ID_MB, ID_NT, ID_MA, ID_TE, ID_IM, ID_LT, ID_LA, ID_CA) || \
ELEM(GS((_id)->name), ID_KE, ID_WO, ID_SPK, ID_GR, ID_AR, ID_AC, ID_BR, ID_PA, ID_GD, ID_LS) || \
ELEM(GS((_id)->name), ID_KE, ID_WO, ID_SPK, ID_GR, ID_AR, ID_AC, ID_BR, ID_PA, ID_GD, ID_LS, ID_PRB) || \
ELEM(GS((_id)->name), ID_SCR, ID_WM, ID_TXT, ID_VF, ID_SO, ID_CF, ID_PAL, ID_WS)) /* Only in 'blendfile' mode ... :/ */
/* TreeElement->flag */

View File

@@ -266,6 +266,7 @@ typedef enum ID_Type {
ID_PC = MAKE_ID2('P', 'C'), /* PaintCurve */
ID_CF = MAKE_ID2('C', 'F'), /* CacheFile */
ID_WS = MAKE_ID2('W', 'S'), /* WorkSpace */
ID_PRB = MAKE_ID2('P', 'R'), /* Probe */
} ID_Type;
/* Only used as 'placeholder' in .blend files for directly linked datablocks. */
@@ -400,6 +401,7 @@ enum {
FILTER_ID_PA = (1 << 27),
FILTER_ID_CF = (1 << 28),
FILTER_ID_WS = (1 << 29),
FILTER_ID_PRB = (1 << 30),
};
/* IMPORTANT: this enum matches the order currently use in set_lisbasepointers,
@@ -431,6 +433,7 @@ enum {
INDEX_ID_BR,
INDEX_ID_PA,
INDEX_ID_SPK,
INDEX_ID_PRB,
INDEX_ID_WO,
INDEX_ID_MC,
INDEX_ID_SCR,

View File

@@ -385,6 +385,7 @@ enum {
OB_CAMERA = 11,
OB_SPEAKER = 12,
OB_PROBE = 13,
/* OB_WAVE = 21, */
OB_LATTICE = 22,

View File

@@ -0,0 +1,84 @@
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* 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.
*
* Contributor(s): Blender Foundation
*
* ***** END GPL LICENSE BLOCK *****
*
*/
/** \file DNA_probe_types.h
* \ingroup DNA
*/
#ifndef __DNA_PROBE_TYPES_H__
#define __DNA_PROBE_TYPES_H__
#include "DNA_defs.h"
#include "DNA_listBase.h"
#include "DNA_ID.h"
#ifdef __cplusplus
extern "C" {
#endif
struct Object;
struct AnimData;
typedef struct Probe {
ID id;
struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */
char type; /* For realtime probe objects */
char flag; /* General purpose flags for probes */
char display; /* Probe visual appearance in the viewport */
char parallax; /* Parallax type */
float influence; /* Influence radius or distance */
float falloff; /* Influence falloff */
float pad;
struct Object *parallax_ob; /* Object to use as a parallax volume */
} Probe;
/* Probe->type */
enum {
PROBE_CAPTURE = (1 << 0),
PROBE_PLANAR = (1 << 1),
PROBE_CUSTOM = (1 << 2),
};
/* Probe->display */
enum {
PROBE_WIRE = 0,
PROBE_SHADED = 1,
PROBE_DIFFUSE = 2,
PROBE_REFLECTIVE = 3,
};
/* Probe->parallax */
enum {
PROBE_PARALLAX_NONE = 0,
PROBE_PARALLAX_SPHERE = 1,
PROBE_PARALLAX_CUBE = 2,
};
#ifdef __cplusplus
}
#endif
#endif /* __DNA_PROBE_TYPES_H__ */

View File

@@ -136,6 +136,7 @@ static const char *includefiles[] = {
"DNA_cachefile_types.h",
"DNA_layer_types.h",
"DNA_workspace_types.h",
"DNA_probe_types.h",
/* see comment above before editing! */
@@ -1363,5 +1364,6 @@ int main(int argc, char **argv)
#include "DNA_cachefile_types.h"
#include "DNA_layer_types.h"
#include "DNA_workspace_types.h"
#include "DNA_probe_types.h"
/* end of list */

View File

@@ -72,6 +72,7 @@ set(DEFSRC
rna_palette.c
rna_particle.c
rna_pose.c
rna_probe.c
rna_property.c
rna_render.c
rna_rigidbody.c

View File

@@ -3345,6 +3345,7 @@ static RNAProcessItem PROCESS_ITEMS[] = {
{"rna_palette.c", NULL, RNA_def_palette},
{"rna_particle.c", NULL, RNA_def_particle},
{"rna_pose.c", "rna_pose_api.c", RNA_def_pose},
{"rna_probe.c", NULL, RNA_def_probe},
{"rna_property.c", NULL, RNA_def_gameproperty},
{"rna_render.c", NULL, RNA_def_render},
{"rna_rigidbody.c", NULL, RNA_def_rigidbody},

View File

@@ -74,6 +74,7 @@ EnumPropertyItem rna_enum_id_type_items[] = {
{ID_PC, "PAINTCURVE", ICON_CURVE_BEZCURVE, "Paint Curve", ""},
{ID_PAL, "PALETTE", ICON_COLOR, "Palette", ""},
{ID_PA, "PARTICLE", ICON_PARTICLE_DATA, "Particle", ""},
{ID_PRB, "PROBE", ICON_RADIO, "Probe", ""},
{ID_SCE, "SCENE", ICON_SCENE_DATA, "Scene", ""},
{ID_SCR, "SCREEN", ICON_SPLITSCREEN, "Screen", ""},
{ID_SO, "SOUND", ICON_PLAY_AUDIO, "Sound", ""},

View File

@@ -166,6 +166,7 @@ void RNA_def_packedfile(struct BlenderRNA *brna);
void RNA_def_palette(struct BlenderRNA *brna);
void RNA_def_particle(struct BlenderRNA *brna);
void RNA_def_pose(struct BlenderRNA *brna);
void RNA_def_probe(struct BlenderRNA *brna);
void RNA_def_render(struct BlenderRNA *brna);
void RNA_def_rigidbody(struct BlenderRNA *brna);
void RNA_def_rna(struct BlenderRNA *brna);
@@ -337,6 +338,7 @@ void RNA_def_main_linestyles(BlenderRNA *brna, PropertyRNA *cprop);
void RNA_def_main_cachefiles(BlenderRNA *brna, PropertyRNA *cprop);
void RNA_def_main_paintcurves(BlenderRNA *brna, PropertyRNA *cprop);
void RNA_def_main_workspaces(BlenderRNA *brna, PropertyRNA *cprop);
void RNA_def_main_probes(BlenderRNA *brna, PropertyRNA *cprop);
/* ID Properties */

View File

@@ -299,6 +299,12 @@ static void rna_Main_workspaces_begin(CollectionPropertyIterator *iter, PointerR
rna_iterator_listbase_begin(iter, &bmain->workspaces, NULL);
}
static void rna_Main_probes_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
Main *bmain = (Main *)ptr->data;
rna_iterator_listbase_begin(iter, &bmain->probe, NULL);
}
static void rna_Main_version_get(PointerRNA *ptr, int *value)
{
Main *bmain = (Main *)ptr->data;
@@ -375,6 +381,7 @@ void RNA_def_main(BlenderRNA *brna)
{"cache_files", "CacheFile", "rna_Main_cachefiles_begin", "Cache Files", "Cache Files data-blocks", RNA_def_main_cachefiles},
{"paint_curves", "PaintCurve", "rna_Main_paintcurves_begin", "Paint Curves", "Paint Curves data-blocks", RNA_def_main_paintcurves},
{"workspaces", "WorkSpace", "rna_Main_workspaces_begin", "Workspaces", "Workspace data-blocks", RNA_def_main_workspaces},
{"probes", "Probe", "rna_Main_probes_begin", "Probes", "Probe data-blocks", RNA_def_main_probes},
{NULL, NULL, NULL, NULL, NULL, NULL}
};

View File

@@ -79,6 +79,7 @@
#include "BKE_font.h"
#include "BKE_node.h"
#include "BKE_speaker.h"
#include "BKE_probe.h"
#include "BKE_movieclip.h"
#include "BKE_mask.h"
#include "BKE_gpencil.h"
@@ -95,6 +96,7 @@
#include "DNA_mesh_types.h"
#include "DNA_speaker_types.h"
#include "DNA_sound_types.h"
#include "DNA_probe_types.h"
#include "DNA_text_types.h"
#include "DNA_texture_types.h"
#include "DNA_group_types.h"
@@ -573,6 +575,16 @@ static FreestyleLineStyle *rna_Main_linestyles_new(Main *bmain, const char *name
return linestyle;
}
static Probe *rna_Main_probe_new(Main *bmain, const char *name)
{
char safe_name[MAX_ID_NAME - 2];
rna_idname_validate(name, safe_name);
Probe *probe = BKE_probe_add(bmain, safe_name);
id_us_min(&probe->id);
return probe;
}
/* tag and is_updated 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, int value) { \
@@ -616,6 +628,7 @@ RNA_MAIN_ID_TAG_FUNCS_DEF(linestyle, linestyle, ID_LS)
RNA_MAIN_ID_TAG_FUNCS_DEF(cachefiles, cachefiles, ID_CF)
RNA_MAIN_ID_TAG_FUNCS_DEF(paintcurves, paintcurves, ID_PC)
RNA_MAIN_ID_TAG_FUNCS_DEF(workspaces, workspaces, ID_WS)
RNA_MAIN_ID_TAG_FUNCS_DEF(probes, probe, ID_PRB)
#undef RNA_MAIN_ID_TAG_FUNCS_DEF
@@ -1846,4 +1859,43 @@ void RNA_def_main_workspaces(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_property_boolean_funcs(prop, "rna_Main_workspaces_is_updated_get", NULL);
}
void RNA_def_main_probes(BlenderRNA *brna, PropertyRNA *cprop)
{
StructRNA *srna;
FunctionRNA *func;
PropertyRNA *parm;
PropertyRNA *prop;
RNA_def_property_srna(cprop, "BlendDataProbes");
srna = RNA_def_struct(brna, "BlendDataProbes", NULL);
RNA_def_struct_sdna(srna, "Main");
RNA_def_struct_ui_text(srna, "Main Probes", "Collection of probes");
func = RNA_def_function(srna, "new", "rna_Main_probe_new");
RNA_def_function_ui_description(func, "Add a new probe to the main database");
parm = RNA_def_string(func, "name", "Probe", 0, "", "New name for the data-block");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
/* return type */
parm = RNA_def_pointer(func, "probe", "Probe", "", "New probe 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 probe from the current blendfile");
parm = RNA_def_pointer(func, "probe", "Probe", "", "Probe 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 probe before deleting it "
"(WARNING: will also delete objects instancing that probe data)");
func = RNA_def_function(srna, "tag", "rna_Main_probes_tag");
parm = RNA_def_boolean(func, "value", 0, "Value", "");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_boolean_funcs(prop, "rna_Main_probes_is_updated_get", NULL);
}
#endif

View File

@@ -148,6 +148,7 @@ EnumPropertyItem rna_enum_object_type_items[] = {
{OB_CAMERA, "CAMERA", 0, "Camera", ""},
{OB_LAMP, "LAMP", 0, "Lamp", ""},
{OB_SPEAKER, "SPEAKER", 0, "Speaker", ""},
{OB_PROBE, "PROBE", 0, "Probe", ""},
{0, NULL, 0, NULL, NULL}
};

View File

@@ -0,0 +1,75 @@
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* 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.
*
* Contributor(s): Blender Foundation.
*
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/makesrna/intern/rna_probe.c
* \ingroup RNA
*/
#include <stdlib.h>
#include "RNA_define.h"
#include "RNA_enum_types.h"
#include "rna_internal.h"
#include "DNA_probe_types.h"
#ifdef RNA_RUNTIME
#include "MEM_guardedalloc.h"
#include "BKE_depsgraph.h"
#include "BKE_main.h"
#include "WM_api.h"
#include "WM_types.h"
#else
static void rna_def_probe(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
srna = RNA_def_struct(brna, "Probe", "ID");
RNA_def_struct_ui_text(srna, "Probe", "Probe data-block for lighting capture objects");
RNA_def_struct_ui_icon(srna, ICON_RADIO);
// prop = RNA_def_property(srna, "influence", PROP_FLOAT, PROP_NONE);
// RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
// RNA_def_property_range(prop, 0.0f, 1.0f);
// RNA_def_property_ui_text(prop, "Maximum Volume", "Maximum volume, no matter how near the object is");
/* RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_volume_max_set", NULL); */
/* RNA_def_property_update(prop, 0, "rna_Speaker_update"); */
/* common */
rna_def_animdata_common(srna);
}
void RNA_def_probe(BlenderRNA *brna)
{
rna_def_probe(brna);
}
#endif

View File

@@ -3906,6 +3906,7 @@ static void rna_def_fileselect_params(BlenderRNA *brna)
"Particles Settings", "Show/hide Particle Settings data-blocks"},
{FILTER_ID_PAL, "PALETTE", ICON_COLOR, "Palettes", "Show/hide Palette data-blocks"},
{FILTER_ID_PC, "PAINT_CURVE", ICON_CURVE_BEZCURVE, "Paint Curves", "Show/hide Paint Curve data-blocks"},
{FILTER_ID_PRB, "PROBE", ICON_RADIO, "Probes", "Show/hide Probe data-blocks"},
{FILTER_ID_SCE, "SCENE", ICON_SCENE_DATA, "Scenes", "Show/hide Scene data-blocks"},
{FILTER_ID_SPK, "SPEAKER", ICON_SPEAKER, "Speakers", "Show/hide Speaker data-blocks"},
{FILTER_ID_SO, "SOUND", ICON_SOUND, "Sounds", "Show/hide Sound data-blocks"},