Compare commits
1 Commits
temp-py-gp
...
temp-volum
Author | SHA1 | Date | |
---|---|---|---|
74f7cdcf6b |
@@ -122,6 +122,11 @@ openvdb::GridBase::Ptr OpenVDBReader::getGrid(const openvdb::Name &name) const
|
||||
return m_file->readGrid(name);
|
||||
}
|
||||
|
||||
openvdb::GridBase::Ptr OpenVDBReader::getGrid(size_t index) const
|
||||
{
|
||||
return (*(m_file->getGrids()))[index];
|
||||
}
|
||||
|
||||
size_t OpenVDBReader::numGrids() const
|
||||
{
|
||||
return m_file->getGrids()->size();
|
||||
|
@@ -49,6 +49,7 @@ public:
|
||||
|
||||
bool hasGrid(const openvdb::Name &name) const;
|
||||
openvdb::GridBase::Ptr getGrid(const openvdb::Name &name) const;
|
||||
openvdb::GridBase::Ptr getGrid(size_t index) const;
|
||||
size_t numGrids() const;
|
||||
};
|
||||
|
||||
|
@@ -240,3 +240,13 @@ void OpenVDBReader_get_meta_mat4(OpenVDBReader *reader, const char *name, float
|
||||
{
|
||||
reader->mat4sMeta(name, value);
|
||||
}
|
||||
|
||||
size_t OpenVDBReader_num_grids(struct OpenVDBReader *reader)
|
||||
{
|
||||
return reader->numGrids();
|
||||
}
|
||||
|
||||
const char *OpenVDBReader_grid_name(struct OpenVDBReader *reader, size_t index)
|
||||
{
|
||||
return reader->getGrid(index)->getName().c_str();
|
||||
}
|
||||
|
@@ -30,12 +30,19 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct OpenVDBReader;
|
||||
#include <stdlib.h>
|
||||
|
||||
struct OpenVDBWriter;
|
||||
struct OpenVDBFloatGrid;
|
||||
struct OpenVDBIntGrid;
|
||||
struct OpenVDBVectorGrid;
|
||||
|
||||
typedef struct OpenVDBReader OpenVDBReader;
|
||||
typedef struct OpenVDBWrite OpenVDBWrite;
|
||||
typedef struct OpenVDBFloatGrid OpenVDBFloatGrid;
|
||||
typedef struct OpenVDBIntGrid OpenVDBIntGrid;
|
||||
typedef struct OpenVDBVectorGrid OpenVDBVectorGrid;
|
||||
|
||||
int OpenVDB_getVersionHex(void);
|
||||
|
||||
enum {
|
||||
@@ -99,6 +106,9 @@ void OpenVDBReader_get_meta_v3(struct OpenVDBReader *reader, const char *name, f
|
||||
void OpenVDBReader_get_meta_v3_int(struct OpenVDBReader *reader, const char *name, int value[3]);
|
||||
void OpenVDBReader_get_meta_mat4(struct OpenVDBReader *reader, const char *name, float value[4][4]);
|
||||
|
||||
size_t OpenVDBReader_num_grids(struct OpenVDBReader *reader);
|
||||
const char *OpenVDBReader_grid_name(struct OpenVDBReader *reader, size_t index);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
Before Width: | Height: | Size: 4.4 MiB After Width: | Height: | Size: 4.5 MiB |
Binary file not shown.
BIN
release/datafiles/blender_icons16/icon16_outliner_ob_volume.dat
Normal file
BIN
release/datafiles/blender_icons16/icon16_outliner_ob_volume.dat
Normal file
Binary file not shown.
Binary file not shown.
BIN
release/datafiles/blender_icons16/icon16_volume.dat
Normal file
BIN
release/datafiles/blender_icons16/icon16_volume.dat
Normal file
Binary file not shown.
BIN
release/datafiles/blender_icons16/icon16_volume_data.dat
Normal file
BIN
release/datafiles/blender_icons16/icon16_volume_data.dat
Normal file
Binary file not shown.
Binary file not shown.
BIN
release/datafiles/blender_icons32/icon32_outliner_ob_volume.dat
Normal file
BIN
release/datafiles/blender_icons32/icon32_outliner_ob_volume.dat
Normal file
Binary file not shown.
Binary file not shown.
BIN
release/datafiles/blender_icons32/icon32_volume.dat
Normal file
BIN
release/datafiles/blender_icons32/icon32_volume.dat
Normal file
Binary file not shown.
BIN
release/datafiles/blender_icons32/icon32_volume_data.dat
Normal file
BIN
release/datafiles/blender_icons32/icon32_volume_data.dat
Normal file
Binary file not shown.
@@ -40,6 +40,7 @@ _modules = [
|
||||
"properties_data_metaball",
|
||||
"properties_data_modifier",
|
||||
"properties_data_speaker",
|
||||
"properties_data_volume",
|
||||
"properties_game",
|
||||
"properties_mask_common",
|
||||
"properties_material",
|
||||
|
101
release/scripts/startup/bl_ui/properties_data_volume.py
Normal file
101
release/scripts/startup/bl_ui/properties_data_volume.py
Normal file
@@ -0,0 +1,101 @@
|
||||
# ##### 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.
|
||||
#
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
# <pep8 compliant>
|
||||
import bpy
|
||||
from bpy.types import Panel, UIList
|
||||
from rna_prop_ui import PropertyPanel
|
||||
|
||||
|
||||
class DataButtonsPanel:
|
||||
bl_space_type = 'PROPERTIES'
|
||||
bl_region_type = 'WINDOW'
|
||||
bl_context = "data"
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
engine = context.scene.render.engine
|
||||
return context.volume and (engine in cls.COMPAT_ENGINES)
|
||||
|
||||
|
||||
class DATA_PT_context_volume(DataButtonsPanel, Panel):
|
||||
bl_label = ""
|
||||
bl_options = {'HIDE_HEADER'}
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
ob = context.object
|
||||
volume = context.volume
|
||||
space = context.space_data
|
||||
|
||||
split = layout.split(percentage=0.65)
|
||||
|
||||
if ob:
|
||||
split.template_ID(ob, "data")
|
||||
elif volume:
|
||||
split.template_ID(space, "pin_id")
|
||||
|
||||
|
||||
class DATA_PT_volume(DataButtonsPanel, Panel):
|
||||
bl_label = "Volume"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
volume = context.volume
|
||||
|
||||
layout.prop(volume, "filepath", text="")
|
||||
|
||||
|
||||
class VOLUME_UL_grids(UIList):
|
||||
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
|
||||
layout.prop(item, "name", text="", emboss=False, icon='OUTLINER_DATA_LATTICE')
|
||||
|
||||
|
||||
class DATA_PT_volume_grids(DataButtonsPanel, Panel):
|
||||
bl_label = "Grids"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
volume = context.volume
|
||||
|
||||
layout.template_list("VOLUME_UL_grids", "grids", volume, "grids", volume.grids, "active_index", rows=2)
|
||||
|
||||
class DATA_PT_custom_props_volume(DataButtonsPanel, PropertyPanel, Panel):
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
_context_path = "object.data"
|
||||
_property_type = bpy.types.Volume
|
||||
|
||||
|
||||
classes = (
|
||||
DATA_PT_context_volume,
|
||||
DATA_PT_volume,
|
||||
DATA_PT_volume_grids,
|
||||
DATA_PT_custom_props_volume,
|
||||
VOLUME_UL_grids,
|
||||
)
|
||||
|
||||
if __name__ == "__main__": # only for live edit.
|
||||
from bpy.utils import register_class
|
||||
for cls in classes:
|
||||
register_class(cls)
|
@@ -88,6 +88,8 @@ def dopesheet_filter(layout, context, genericFiltersOnly=False):
|
||||
row.prop(dopesheet, "show_curves", text="")
|
||||
if bpy.data.metaballs:
|
||||
row.prop(dopesheet, "show_metaballs", text="")
|
||||
if bpy.data.volumes:
|
||||
row.prop(dopesheet, "show_volumes", text="")
|
||||
if bpy.data.lattices:
|
||||
row.prop(dopesheet, "show_lattices", text="")
|
||||
if bpy.data.armatures:
|
||||
|
@@ -1309,6 +1309,7 @@ class INFO_MT_add(Menu):
|
||||
layout.menu("INFO_MT_surface_add", icon='OUTLINER_OB_SURFACE')
|
||||
layout.menu("INFO_MT_metaball_add", text="Metaball", icon='OUTLINER_OB_META')
|
||||
layout.operator("object.text_add", text="Text", icon='OUTLINER_OB_FONT')
|
||||
layout.operator("object.volume_add", text="Volume", icon='OUTLINER_OB_VOLUME')
|
||||
layout.separator()
|
||||
|
||||
layout.menu("INFO_MT_armature_add", icon='OUTLINER_OB_ARMATURE')
|
||||
|
@@ -190,6 +190,7 @@ class VIEW3D_PT_tools_add_object(View3DPanel, Panel):
|
||||
@staticmethod
|
||||
def draw_add_other(layout):
|
||||
layout.operator("object.text_add", text="Text", icon='OUTLINER_OB_FONT')
|
||||
layout.operator("object.volume_add", text="Volume", icon='OUTLINER_OB_VOLUME')
|
||||
layout.operator("object.armature_add", text="Armature", icon='OUTLINER_OB_ARMATURE')
|
||||
layout.operator("object.add", text="Lattice", icon='OUTLINER_OB_LATTICE').type = 'LATTICE'
|
||||
layout.operator("object.empty_add", text="Empty", icon='OUTLINER_OB_EMPTY').type = 'PLAIN_AXES'
|
||||
|
@@ -157,7 +157,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 35
|
||||
#define MAX_LIBARRAY 36
|
||||
int set_listbasepointers(struct Main *main, struct ListBase *lb[MAX_LIBARRAY]);
|
||||
|
||||
/* Main API */
|
||||
|
@@ -125,6 +125,7 @@ typedef struct Main {
|
||||
ListBase mask;
|
||||
ListBase linestyle;
|
||||
ListBase cachefiles;
|
||||
ListBase volume;
|
||||
|
||||
char id_tag_update[MAX_LIBARRAY];
|
||||
|
||||
|
@@ -42,6 +42,7 @@ struct Main;
|
||||
struct PackedFile;
|
||||
struct ReportList;
|
||||
struct VFont;
|
||||
struct Volume;
|
||||
|
||||
/* pack */
|
||||
struct PackedFile *dupPackedFile(const struct PackedFile *pf_src);
|
||||
@@ -58,6 +59,7 @@ char *unpackFile(
|
||||
int unpackVFont(struct Main *bmain, struct ReportList *reports, struct VFont *vfont, int how);
|
||||
int unpackSound(struct Main *bmain, struct ReportList *reports, struct bSound *sound, int how);
|
||||
int unpackImage(struct Main *bmain, struct ReportList *reports, struct Image *ima, int how);
|
||||
int unpackVolume(struct Main *bmain, struct ReportList *reports, struct Volume *volume, int how);
|
||||
void unpackAll(struct Main *bmain, struct ReportList *reports, int how);
|
||||
int unpackLibraries(struct Main *bmain, struct ReportList *reports);
|
||||
|
||||
|
43
source/blender/blenkernel/BKE_volume.h
Normal file
43
source/blender/blenkernel/BKE_volume.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* ***** 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): Brecht Van Lommel.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#ifndef __BKE_VOLUME_H__
|
||||
#define __BKE_VOLUME_H__
|
||||
|
||||
/** \file BKE_volume.h
|
||||
* \ingroup bke
|
||||
* \brief General operations for volumes.
|
||||
*/
|
||||
|
||||
struct Main;
|
||||
struct Volume;
|
||||
|
||||
void BKE_volume_init(struct Volume *volume);
|
||||
void *BKE_volume_add(struct Main *bmain, const char *name);
|
||||
void BKE_volume_copy_data(struct Main *bmain, struct Volume *volume_dst, const struct Volume *volume_src, const int flag);
|
||||
struct Volume *BKE_volume_copy(struct Main *bmain, const struct Volume *volume);
|
||||
void BKE_volume_make_local(struct Main *bmain, struct Volume *volume, const bool lib_local);
|
||||
void BKE_volume_free(struct Volume *volume);
|
||||
|
||||
void BKE_volume_reload(struct Main *bmain, struct Volume *volume);
|
||||
|
||||
#endif
|
@@ -192,6 +192,7 @@ set(SRC
|
||||
intern/tracking_util.c
|
||||
intern/undo_system.c
|
||||
intern/unit.c
|
||||
intern/volume.c
|
||||
intern/world.c
|
||||
intern/writeavi.c
|
||||
intern/writeframeserver.c
|
||||
@@ -301,6 +302,7 @@ set(SRC
|
||||
BKE_tracking.h
|
||||
BKE_undo_system.h
|
||||
BKE_unit.h
|
||||
BKE_volume.h
|
||||
BKE_world.h
|
||||
BKE_writeavi.h
|
||||
BKE_writeframeserver.h
|
||||
|
@@ -103,6 +103,7 @@ bool id_type_can_have_animdata(const short id_type)
|
||||
case ID_MSK:
|
||||
case ID_GD:
|
||||
case ID_CF:
|
||||
case ID_VO:
|
||||
return true;
|
||||
|
||||
/* no AnimData */
|
||||
@@ -1175,6 +1176,9 @@ void BKE_animdata_main_cb(Main *bmain, ID_AnimData_Edit_Callback func, void *use
|
||||
|
||||
/* cache files */
|
||||
ANIMDATA_IDS_CB(bmain->cachefiles.first);
|
||||
|
||||
/* volumes */
|
||||
ANIMDATA_IDS_CB(bmain->volume.first);
|
||||
}
|
||||
|
||||
/* Fix all RNA-Paths throughout the database (directly access the Global.main version)
|
||||
@@ -1269,6 +1273,9 @@ void BKE_animdata_fix_paths_rename_all(ID *ref_id, const char *prefix, const cha
|
||||
/* cache files */
|
||||
RENAMEFIX_ANIM_IDS(bmain->cachefiles.first);
|
||||
|
||||
/* volumes */
|
||||
RENAMEFIX_ANIM_IDS(bmain->volume.first);
|
||||
|
||||
/* scenes */
|
||||
RENAMEFIX_ANIM_NODETREE_IDS(bmain->scene.first, Scene);
|
||||
}
|
||||
@@ -2901,6 +2908,9 @@ void BKE_animsys_evaluate_all_animation(Main *main, Scene *scene, float ctime)
|
||||
/* cache files */
|
||||
EVAL_ANIM_IDS(main->cachefiles.first, ADT_RECALC_ANIM);
|
||||
|
||||
/* volumes */
|
||||
EVAL_ANIM_IDS(main->volume.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
|
||||
|
@@ -67,6 +67,7 @@
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_smoke_types.h"
|
||||
#include "DNA_freestyle_types.h"
|
||||
#include "DNA_volume_types.h"
|
||||
|
||||
#include "BLI_blenlib.h"
|
||||
#include "BLI_utildefines.h"
|
||||
@@ -532,6 +533,14 @@ void BKE_bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ID_VO:
|
||||
{
|
||||
Volume *volume = (Volume *)id;
|
||||
if (volume->packedfile == NULL || (flag & BKE_BPATH_TRAVERSE_SKIP_PACKED) == 0) {
|
||||
rewrite_path_fixed(volume->filepath, visit_cb, absbase, bpath_user_data);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ID_TXT:
|
||||
if (((Text *)id)->name) {
|
||||
rewrite_path_alloc(&((Text *)id)->name, visit_cb, absbase, bpath_user_data);
|
||||
|
@@ -89,6 +89,7 @@ static IDType idtypes[] = {
|
||||
{ ID_TE, "Texture", "textures", BLT_I18NCONTEXT_ID_TEXTURE, IDTYPE_FLAGS_ISLINKABLE },
|
||||
{ ID_TXT, "Text", "texts", BLT_I18NCONTEXT_ID_TEXT, IDTYPE_FLAGS_ISLINKABLE },
|
||||
{ ID_VF, "VFont", "fonts", BLT_I18NCONTEXT_ID_VFONT, IDTYPE_FLAGS_ISLINKABLE },
|
||||
{ ID_VO, "Volume", "volumes", BLT_I18NCONTEXT_ID_VOLUME, IDTYPE_FLAGS_ISLINKABLE },
|
||||
{ ID_WO, "World", "worlds", BLT_I18NCONTEXT_ID_WORLD, IDTYPE_FLAGS_ISLINKABLE },
|
||||
{ ID_WM, "WindowManager", "window_managers", BLT_I18NCONTEXT_ID_WINDOWMANAGER, 0 },
|
||||
|
||||
@@ -209,6 +210,7 @@ int BKE_idcode_to_idfilter(const short idcode)
|
||||
CASE_IDFILTER(TE);
|
||||
CASE_IDFILTER(TXT);
|
||||
CASE_IDFILTER(VF);
|
||||
CASE_IDFILTER(VO);
|
||||
CASE_IDFILTER(WO);
|
||||
default:
|
||||
return 0;
|
||||
@@ -253,6 +255,7 @@ short BKE_idcode_from_idfilter(const int idfilter)
|
||||
CASE_IDFILTER(TE);
|
||||
CASE_IDFILTER(TXT);
|
||||
CASE_IDFILTER(VF);
|
||||
CASE_IDFILTER(VO);
|
||||
CASE_IDFILTER(WO);
|
||||
default:
|
||||
return 0;
|
||||
@@ -301,6 +304,7 @@ int BKE_idcode_to_index(const short idcode)
|
||||
CASE_IDINDEX(TE);
|
||||
CASE_IDINDEX(TXT);
|
||||
CASE_IDINDEX(VF);
|
||||
CASE_IDINDEX(VO);
|
||||
CASE_IDINDEX(WM);
|
||||
CASE_IDINDEX(WO);
|
||||
}
|
||||
|
@@ -68,6 +68,7 @@
|
||||
#include "DNA_sound_types.h"
|
||||
#include "DNA_text_types.h"
|
||||
#include "DNA_vfont_types.h"
|
||||
#include "DNA_volume_types.h"
|
||||
#include "DNA_windowmanager_types.h"
|
||||
#include "DNA_world_types.h"
|
||||
|
||||
@@ -122,6 +123,7 @@
|
||||
#include "BKE_scene.h"
|
||||
#include "BKE_text.h"
|
||||
#include "BKE_texture.h"
|
||||
#include "BKE_volume.h"
|
||||
#include "BKE_world.h"
|
||||
|
||||
#include "DEG_depsgraph.h"
|
||||
@@ -469,6 +471,9 @@ bool id_make_local(Main *bmain, ID *id, const bool test, const bool lib_local)
|
||||
case ID_CF:
|
||||
if (!test) BKE_cachefile_make_local(bmain, (CacheFile *)id, lib_local);
|
||||
return true;
|
||||
case ID_VO:
|
||||
if (!test) BKE_volume_make_local(bmain, (Volume *)id, lib_local);
|
||||
return true;
|
||||
case ID_SCR:
|
||||
case ID_LI:
|
||||
case ID_KE:
|
||||
@@ -646,6 +651,9 @@ bool BKE_id_copy_ex(Main *bmain, const ID *id, ID **r_newid, const int flag, con
|
||||
case ID_VF:
|
||||
BKE_vfont_copy_data(bmain, (VFont *)*r_newid, (VFont *)id, flag);
|
||||
break;
|
||||
case ID_VO:
|
||||
BKE_volume_copy_data(bmain, (Volume *)*r_newid, (Volume *)id, flag);
|
||||
break;
|
||||
case ID_LI:
|
||||
case ID_SCR:
|
||||
case ID_WM:
|
||||
@@ -878,6 +886,8 @@ ListBase *which_libbase(Main *mainlib, short type)
|
||||
return &(mainlib->paintcurves);
|
||||
case ID_CF:
|
||||
return &(mainlib->cachefiles);
|
||||
case ID_VO:
|
||||
return &(mainlib->volume);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -1016,6 +1026,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_VO] = &(main->volume);
|
||||
|
||||
lb[INDEX_ID_WO] = &(main->world);
|
||||
lb[INDEX_ID_MC] = &(main->movieclip);
|
||||
@@ -1090,6 +1101,7 @@ size_t BKE_libblock_get_alloc_info(short type, const char **name)
|
||||
CASE_RETURN(ID_PAL, Palette);
|
||||
CASE_RETURN(ID_PC, PaintCurve);
|
||||
CASE_RETURN(ID_CF, CacheFile);
|
||||
CASE_RETURN(ID_VO, Volume);
|
||||
}
|
||||
return 0;
|
||||
#undef CASE_RETURN
|
||||
@@ -1257,6 +1269,9 @@ void BKE_libblock_init_empty(ID *id)
|
||||
case ID_CF:
|
||||
BKE_cachefile_init((CacheFile *)id);
|
||||
break;
|
||||
case ID_VO:
|
||||
BKE_volume_init((Volume *)id);
|
||||
break;
|
||||
case ID_KE:
|
||||
/* Shapekeys are a complex topic too - they depend on their 'user' data type...
|
||||
* They are not linkable, though, so it should never reach here anyway. */
|
||||
|
@@ -61,6 +61,7 @@
|
||||
#include "DNA_sound_types.h"
|
||||
#include "DNA_text_types.h"
|
||||
#include "DNA_vfont_types.h"
|
||||
#include "DNA_volume_types.h"
|
||||
#include "DNA_world_types.h"
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
@@ -990,6 +991,7 @@ void BKE_library_foreach_ID_link(Main *bmain, ID *id, LibraryIDLinkCallback call
|
||||
case ID_PAL:
|
||||
case ID_PC:
|
||||
case ID_CF:
|
||||
case ID_VO:
|
||||
break;
|
||||
|
||||
/* Deprecated. */
|
||||
@@ -1065,7 +1067,7 @@ bool BKE_library_id_can_use_idtype(ID *id_owner, const short id_type_used)
|
||||
case ID_OB:
|
||||
/* Could be the following, but simpler to just always say 'yes' here. */
|
||||
#if 0
|
||||
return ELEM(id_type_used, ID_ME, ID_CU, ID_MB, ID_LT, ID_SPK, ID_AR, ID_LA, ID_CA, /* obdata */
|
||||
return ELEM(id_type_used, ID_ME, ID_CU, ID_MB, ID_LT, ID_SPK, ID_AR, ID_LA, ID_CA, ID_VO, /* obdata */
|
||||
ID_OB, ID_MA, ID_GD, ID_GR, ID_TE, ID_PA, ID_TXT, ID_SO, ID_MC, ID_IM, ID_AC
|
||||
/* + constraints, modifiers and game logic ID types... */);
|
||||
#else
|
||||
@@ -1125,6 +1127,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_VO:
|
||||
/* Those types never use/reference other IDs... */
|
||||
return false;
|
||||
case ID_IP:
|
||||
|
@@ -59,6 +59,7 @@
|
||||
#include "DNA_sound_types.h"
|
||||
#include "DNA_text_types.h"
|
||||
#include "DNA_vfont_types.h"
|
||||
#include "DNA_volume_types.h"
|
||||
#include "DNA_windowmanager_types.h"
|
||||
#include "DNA_world_types.h"
|
||||
|
||||
@@ -106,6 +107,7 @@
|
||||
#include "BKE_scene.h"
|
||||
#include "BKE_text.h"
|
||||
#include "BKE_texture.h"
|
||||
#include "BKE_volume.h"
|
||||
#include "BKE_world.h"
|
||||
|
||||
#ifdef WITH_PYTHON
|
||||
@@ -857,6 +859,9 @@ void BKE_libblock_free_datablock(ID *id, const int UNUSED(flag))
|
||||
case ID_CF:
|
||||
BKE_cachefile_free((CacheFile *)id);
|
||||
break;
|
||||
case ID_VO:
|
||||
BKE_volume_free((Volume *)id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -117,6 +117,7 @@
|
||||
#include "BKE_material.h"
|
||||
#include "BKE_camera.h"
|
||||
#include "BKE_image.h"
|
||||
#include "BKE_volume.h"
|
||||
|
||||
#ifdef WITH_MOD_FLUID
|
||||
#include "LBM_fluidsim.h"
|
||||
@@ -558,6 +559,7 @@ static const char *get_obdata_defname(int type)
|
||||
case OB_LATTICE: return DATA_("Lattice");
|
||||
case OB_ARMATURE: return DATA_("Armature");
|
||||
case OB_SPEAKER: return DATA_("Speaker");
|
||||
case OB_VOLUME: return DATA_("Volume");
|
||||
case OB_EMPTY: return DATA_("Empty");
|
||||
default:
|
||||
printf("get_obdata_defname: Internal error, bad type: %d\n", type);
|
||||
@@ -582,6 +584,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_VOLUME: return BKE_volume_add(bmain, name);
|
||||
case OB_EMPTY: return NULL;
|
||||
default:
|
||||
printf("%s: Internal error, bad type: %d\n", __func__, type);
|
||||
|
@@ -46,6 +46,7 @@
|
||||
#include "DNA_ID.h"
|
||||
#include "DNA_packedFile_types.h"
|
||||
#include "DNA_sound_types.h"
|
||||
#include "DNA_volume_types.h"
|
||||
#include "DNA_vfont_types.h"
|
||||
|
||||
#include "BLI_blenlib.h"
|
||||
@@ -58,6 +59,7 @@
|
||||
#include "BKE_packedFile.h"
|
||||
#include "BKE_report.h"
|
||||
#include "BKE_sound.h"
|
||||
#include "BKE_volume.h"
|
||||
|
||||
int seekPackedFile(PackedFile *pf, int offset, int whence)
|
||||
{
|
||||
@@ -124,6 +126,7 @@ int countPackedFiles(Main *bmain)
|
||||
Image *ima;
|
||||
VFont *vf;
|
||||
bSound *sound;
|
||||
Volume *volume;
|
||||
int count = 0;
|
||||
|
||||
/* let's check if there are packed files... */
|
||||
@@ -139,6 +142,10 @@ int countPackedFiles(Main *bmain)
|
||||
if (sound->packedfile)
|
||||
count++;
|
||||
|
||||
for (volume = bmain->volume.first; volume; volume = volume->id.next)
|
||||
if (volume->packedfile)
|
||||
count++;
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
@@ -229,6 +236,7 @@ void packAll(Main *bmain, ReportList *reports, bool verbose)
|
||||
Image *ima;
|
||||
VFont *vfont;
|
||||
bSound *sound;
|
||||
Volume *volume;
|
||||
int tot = 0;
|
||||
|
||||
for (ima = bmain->image.first; ima; ima = ima->id.next) {
|
||||
@@ -258,6 +266,13 @@ void packAll(Main *bmain, ReportList *reports, bool verbose)
|
||||
}
|
||||
}
|
||||
|
||||
for (volume = bmain->volume.first; volume; volume = volume->id.next) {
|
||||
if (volume->packedfile == NULL && !ID_IS_LINKED(volume)) {
|
||||
volume->packedfile = newPackedFile(reports, volume->filepath, bmain->name);
|
||||
tot++;
|
||||
}
|
||||
}
|
||||
|
||||
if (tot > 0)
|
||||
BKE_reportf(reports, RPT_INFO, "Packed %d files", tot);
|
||||
else if (verbose)
|
||||
@@ -524,6 +539,9 @@ static void unpack_generate_paths(
|
||||
case ID_IM:
|
||||
BLI_snprintf(r_relpath, relpathlen, "//textures/%s", tempname);
|
||||
break;
|
||||
case ID_VO:
|
||||
BLI_snprintf(r_relpath, relpathlen, "//volumes/%s", tempname);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -628,6 +646,31 @@ int unpackImage(Main *bmain, ReportList *reports, Image *ima, int how)
|
||||
return(ret_value);
|
||||
}
|
||||
|
||||
int unpackVolume(Main *bmain, ReportList *reports, Volume *volume, int how)
|
||||
{
|
||||
char localname[FILE_MAX], absname[FILE_MAX];
|
||||
char *newfilepath;
|
||||
int ret_value = RET_ERROR;
|
||||
|
||||
if (volume != NULL) {
|
||||
unpack_generate_paths(volume->filepath, (ID *)volume, absname, localname, sizeof(absname), sizeof(localname));
|
||||
newfilepath = unpackFile(reports, BKE_main_blendfile_path(bmain), absname, localname, volume->packedfile, how);
|
||||
if (newfilepath != NULL) {
|
||||
BLI_strncpy(volume->filepath, newfilepath, sizeof(volume->filepath));
|
||||
MEM_freeN(newfilepath);
|
||||
|
||||
freePackedFile(volume->packedfile);
|
||||
volume->packedfile = NULL;
|
||||
|
||||
BKE_volume_reload(bmain, volume);
|
||||
|
||||
ret_value = RET_OK;
|
||||
}
|
||||
}
|
||||
|
||||
return(ret_value);
|
||||
}
|
||||
|
||||
int unpackLibraries(Main *bmain, ReportList *reports)
|
||||
{
|
||||
Library *lib;
|
||||
@@ -678,6 +721,7 @@ void unpackAll(Main *bmain, ReportList *reports, int how)
|
||||
Image *ima;
|
||||
VFont *vf;
|
||||
bSound *sound;
|
||||
Volume *volume;
|
||||
|
||||
for (ima = bmain->image.first; ima; ima = ima->id.next)
|
||||
if (BKE_image_has_packedfile(ima))
|
||||
@@ -690,6 +734,10 @@ void unpackAll(Main *bmain, ReportList *reports, int how)
|
||||
for (sound = bmain->sound.first; sound; sound = sound->id.next)
|
||||
if (sound->packedfile)
|
||||
unpackSound(bmain, reports, sound, how);
|
||||
|
||||
for (volume = bmain->volume.first; volume; volume = volume->id.next)
|
||||
if (volume->packedfile)
|
||||
unpackVolume(bmain, reports, volume, how);
|
||||
}
|
||||
|
||||
/* ID should be not NULL, return 1 if there's a packed file */
|
||||
@@ -711,6 +759,11 @@ bool BKE_pack_check(ID *id)
|
||||
bSound *snd = (bSound *)id;
|
||||
return snd->packedfile != NULL;
|
||||
}
|
||||
case ID_VO:
|
||||
{
|
||||
Volume *volume = (Volume *)id;
|
||||
return volume->packedfile != NULL;
|
||||
}
|
||||
case ID_LI:
|
||||
{
|
||||
Library *li = (Library *)id;
|
||||
@@ -750,6 +803,14 @@ void BKE_unpack_id(Main *bmain, ID *id, ReportList *reports, int how)
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ID_VO:
|
||||
{
|
||||
Volume *volume = (Volume *)id;
|
||||
if (volume->packedfile) {
|
||||
unpackVolume(bmain, reports, volume, how);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ID_LI:
|
||||
{
|
||||
Library *li = (Library *)id;
|
||||
|
@@ -1676,7 +1676,8 @@ static bool scene_need_update_objects(Main *bmain)
|
||||
DAG_id_type_tagged(bmain, ID_CA) || /* Camera */
|
||||
DAG_id_type_tagged(bmain, ID_KE) || /* KE */
|
||||
DAG_id_type_tagged(bmain, ID_SPK) || /* Speaker */
|
||||
DAG_id_type_tagged(bmain, ID_AR); /* Armature */
|
||||
DAG_id_type_tagged(bmain, ID_AR) || /* Armature */
|
||||
DAG_id_type_tagged(bmain, ID_VO); /* Volume */
|
||||
}
|
||||
|
||||
static void scene_update_objects(EvaluationContext *eval_ctx, Main *bmain, Scene *scene, Scene *scene_parent)
|
||||
|
138
source/blender/blenkernel/intern/volume.c
Normal file
138
source/blender/blenkernel/intern/volume.c
Normal file
@@ -0,0 +1,138 @@
|
||||
/*
|
||||
* ***** 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): Brecht Van Lommel.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
/** \file blender/blenkernel/intern/volume.c
|
||||
* \ingroup bke
|
||||
*/
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_sound_types.h"
|
||||
#include "DNA_volume_types.h"
|
||||
|
||||
#include "BLI_listbase.h"
|
||||
#include "BLI_math.h"
|
||||
#include "BLI_string.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BKE_animsys.h"
|
||||
#include "BKE_global.h"
|
||||
#include "BKE_library.h"
|
||||
#include "BKE_library_query.h"
|
||||
#include "BKE_library_remap.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_packedFile.h"
|
||||
#include "BKE_volume.h"
|
||||
|
||||
#ifdef WITH_OPENVDB
|
||||
#include "openvdb_capi.h"
|
||||
#endif
|
||||
|
||||
/* OpenVDB integration */
|
||||
|
||||
static void volume_create_openvdb(Volume *volume)
|
||||
{
|
||||
if (!volume->filepath[0]) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef WITH_OPENVDB
|
||||
OpenVDBReader *reader = OpenVDBReader_create();
|
||||
OpenVDBReader_open(reader, volume->filepath);
|
||||
|
||||
size_t num_grids = OpenVDBReader_num_grids(reader);
|
||||
|
||||
for (int i = 0; i < num_grids; i++) {
|
||||
VolumeGrid *grid = MEM_callocN(sizeof(VolumeGrid), "VolumeGrid");
|
||||
const char *name = OpenVDBReader_grid_name(reader, i);
|
||||
BLI_strncpy(grid->name, name, sizeof(grid->name));
|
||||
BLI_addtail(&volume->grids, grid);
|
||||
}
|
||||
|
||||
OpenVDBReader_free(reader);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void volume_free_openvdb(Volume *volume)
|
||||
{
|
||||
#ifdef WITH_OPENVDB
|
||||
BLI_freelistN(&volume->grids);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Volume datablock */
|
||||
|
||||
void BKE_volume_init(Volume *volume)
|
||||
{
|
||||
BLI_assert(MEMCMP_STRUCT_OFS_IS_ZERO(volume, id));
|
||||
|
||||
volume->filepath[0] = '\0';
|
||||
volume->packedfile = NULL;
|
||||
BLI_listbase_clear(&volume->grids);
|
||||
volume->flag = 0;
|
||||
}
|
||||
|
||||
void *BKE_volume_add(Main *bmain, const char *name)
|
||||
{
|
||||
Volume *volume;
|
||||
|
||||
volume = BKE_libblock_alloc(bmain, ID_VO, name, 0);
|
||||
|
||||
BKE_volume_init(volume);
|
||||
|
||||
return volume;
|
||||
}
|
||||
|
||||
void BKE_volume_copy_data(Main *bmain, Volume *volume_dst, const Volume *UNUSED(volume_src), const int UNUSED(flag))
|
||||
{
|
||||
if (volume_dst->packedfile) {
|
||||
volume_dst->packedfile = dupPackedFile(volume_dst->packedfile);
|
||||
}
|
||||
|
||||
BLI_listbase_clear(&volume_dst->grids);
|
||||
BKE_volume_reload(bmain, volume_dst);
|
||||
}
|
||||
|
||||
Volume *BKE_volume_copy(Main *bmain, const Volume *volume)
|
||||
{
|
||||
Volume *volume_copy;
|
||||
BKE_id_copy_ex(bmain, &volume->id, (ID **)&volume_copy, 0, false);
|
||||
return volume_copy;
|
||||
}
|
||||
|
||||
void BKE_volume_make_local(Main *bmain, Volume *volume, const bool lib_local)
|
||||
{
|
||||
BKE_id_make_local_generic(bmain, &volume->id, true, lib_local);
|
||||
}
|
||||
|
||||
void BKE_volume_free(Volume *volume)
|
||||
{
|
||||
BKE_animdata_free((ID *)volume, false);
|
||||
volume_free_openvdb(volume);
|
||||
}
|
||||
|
||||
void BKE_volume_reload(Main *UNUSED(bmain), Volume *volume)
|
||||
{
|
||||
volume_free_openvdb(volume);
|
||||
volume_create_openvdb(volume);
|
||||
}
|
@@ -399,6 +399,9 @@ BlendFileData *BLO_read_from_memfile(
|
||||
/* make lookups of existing sound data in old main */
|
||||
blo_make_sound_pointer_map(fd, oldmain);
|
||||
|
||||
/* make lookups of existing volume data in old main */
|
||||
blo_make_volume_pointer_map(fd, oldmain);
|
||||
|
||||
/* removed packed data from this trick - it's internal data that needs saves */
|
||||
|
||||
bfd = blo_read_file_internal(fd, filename);
|
||||
@@ -412,6 +415,9 @@ BlendFileData *BLO_read_from_memfile(
|
||||
/* ensures relinked sounds are not freed */
|
||||
blo_end_sound_pointer_map(fd, oldmain);
|
||||
|
||||
/* ensures relinked volumes are not freed */
|
||||
blo_end_volume_pointer_map(fd, oldmain);
|
||||
|
||||
/* Still in-use libraries have already been moved from oldmain to new mainlist,
|
||||
* but oldmain itself shall *never* be 'transferred' to new mainlist! */
|
||||
BLI_assert(old_mainlist.first == oldmain);
|
||||
|
@@ -99,6 +99,7 @@
|
||||
#include "DNA_sound_types.h"
|
||||
#include "DNA_space_types.h"
|
||||
#include "DNA_vfont_types.h"
|
||||
#include "DNA_volume_types.h"
|
||||
#include "DNA_world_types.h"
|
||||
#include "DNA_movieclip_types.h"
|
||||
#include "DNA_mask_types.h"
|
||||
@@ -1329,6 +1330,8 @@ void blo_freefiledata(FileData *fd)
|
||||
oldnewmap_free(fd->movieclipmap);
|
||||
if (fd->soundmap)
|
||||
oldnewmap_free(fd->soundmap);
|
||||
if (fd->volumemap)
|
||||
oldnewmap_free(fd->volumemap);
|
||||
if (fd->packedmap)
|
||||
oldnewmap_free(fd->packedmap);
|
||||
if (fd->libmap && !(fd->flags & FD_FLAGS_NOT_MY_LIBMAP))
|
||||
@@ -1528,6 +1531,13 @@ static void *newsoundadr(FileData *fd, const void *adr) /* used to restore
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void *newvolumeadr(FileData *fd, const void *adr) /* used to restore volume data after undo */
|
||||
{
|
||||
if (fd->volumemap && adr)
|
||||
return oldnewmap_lookup_and_inc(fd->volumemap, adr, true);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void *newpackedadr(FileData *fd, const void *adr) /* used to restore packed data after undo */
|
||||
{
|
||||
if (fd->packedmap && adr)
|
||||
@@ -1790,6 +1800,43 @@ void blo_end_sound_pointer_map(FileData *fd, Main *oldmain)
|
||||
}
|
||||
}
|
||||
|
||||
void blo_make_volume_pointer_map(FileData *fd, Main *oldmain)
|
||||
{
|
||||
fd->volumemap = oldnewmap_new();
|
||||
|
||||
Volume *volume = oldmain->volume.first;
|
||||
for (; volume; volume = volume->id.next) {
|
||||
for (VolumeGrid *grid = volume->grids.first; grid; grid = grid->next) {
|
||||
if (grid->openvdb_handle) {
|
||||
oldnewmap_insert(fd->volumemap, grid->openvdb_handle, grid->openvdb_handle, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* set old main volume caches to zero if it has been restored */
|
||||
/* this works because freeing old main only happens after this call */
|
||||
void blo_end_volume_pointer_map(FileData *fd, Main *oldmain)
|
||||
{
|
||||
OldNew *entry = fd->volumemap->entries;
|
||||
Volume *volume = oldmain->volume.first;
|
||||
int i;
|
||||
|
||||
/* used entries were restored, so we put them to zero */
|
||||
for (i = 0; i < fd->volumemap->nentries; i++, entry++) {
|
||||
if (entry->nr > 0)
|
||||
entry->newp = NULL;
|
||||
}
|
||||
|
||||
for (; volume; volume = volume->id.next) {
|
||||
for (VolumeGrid *grid = volume->grids.first; grid; grid = grid->next) {
|
||||
if (grid->openvdb_handle) {
|
||||
grid->openvdb_handle = newvolumeadr(fd, grid->openvdb_handle);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* XXX disabled this feature - packed files also belong in temp saves and quit.blend, to make restore work */
|
||||
|
||||
static void insert_packedmap(FileData *fd, PackedFile *pf)
|
||||
@@ -1803,6 +1850,7 @@ void blo_make_packed_pointer_map(FileData *fd, Main *oldmain)
|
||||
Image *ima;
|
||||
VFont *vfont;
|
||||
bSound *sound;
|
||||
Volume *volume;
|
||||
Library *lib;
|
||||
|
||||
fd->packedmap = oldnewmap_new();
|
||||
@@ -1826,6 +1874,10 @@ void blo_make_packed_pointer_map(FileData *fd, Main *oldmain)
|
||||
if (sound->packedfile)
|
||||
insert_packedmap(fd, sound->packedfile);
|
||||
|
||||
for (volume = oldmain->volume.first; volume; volume = volume->id.next)
|
||||
if (volume->packedfile)
|
||||
insert_packedmap(fd, volume->packedfile);
|
||||
|
||||
for (lib = oldmain->library.first; lib; lib = lib->id.next)
|
||||
if (lib->packedfile)
|
||||
insert_packedmap(fd, lib->packedfile);
|
||||
@@ -1839,6 +1891,7 @@ void blo_end_packed_pointer_map(FileData *fd, Main *oldmain)
|
||||
Image *ima;
|
||||
VFont *vfont;
|
||||
bSound *sound;
|
||||
Volume *volume;
|
||||
Library *lib;
|
||||
OldNew *entry = fd->packedmap->entries;
|
||||
int i;
|
||||
@@ -1864,6 +1917,9 @@ void blo_end_packed_pointer_map(FileData *fd, Main *oldmain)
|
||||
for (sound = oldmain->sound.first; sound; sound = sound->id.next)
|
||||
sound->packedfile = newpackedadr(fd, sound->packedfile);
|
||||
|
||||
for (volume = oldmain->volume.first; volume; volume = volume->id.next)
|
||||
volume->packedfile = newpackedadr(fd, volume->packedfile);
|
||||
|
||||
for (lib = oldmain->library.first; lib; lib = lib->id.next)
|
||||
lib->packedfile = newpackedadr(fd, lib->packedfile);
|
||||
}
|
||||
@@ -8094,6 +8150,39 @@ static void direct_link_linestyle(FileData *fd, FreestyleLineStyle *linestyle)
|
||||
}
|
||||
}
|
||||
|
||||
/* ************ READ VOLUME ***************** */
|
||||
|
||||
static void lib_link_volume(FileData *fd, Main *main)
|
||||
{
|
||||
for (Volume *volume = main->volume.first; volume; volume = volume->id.next) {
|
||||
if (volume->id.tag & LIB_TAG_NEED_LINK) {
|
||||
IDP_LibLinkProperty(volume->id.properties, fd);
|
||||
lib_link_animdata(fd, &volume->id, volume->adt);
|
||||
|
||||
volume->id.tag &= ~LIB_TAG_NEED_LINK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void direct_link_volume(FileData *fd, Volume *volume)
|
||||
{
|
||||
volume->adt = newdataadr(fd, volume->adt);
|
||||
direct_link_animdata(fd, volume->adt);
|
||||
|
||||
volume->packedfile = direct_link_packedfile(fd, volume->packedfile);
|
||||
|
||||
link_list(fd, &volume->grids);
|
||||
|
||||
for (VolumeGrid *grid = volume->grids.first; grid; grid = grid->next) {
|
||||
if (fd->volumemap) {
|
||||
grid->openvdb_handle = newvolumeadr(fd, grid->openvdb_handle);
|
||||
}
|
||||
else {
|
||||
grid->openvdb_handle = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ************** GENERAL & MAIN ******************** */
|
||||
|
||||
|
||||
@@ -8134,6 +8223,7 @@ static const char *dataname(short id_code)
|
||||
case ID_MSK: return "Data from MSK";
|
||||
case ID_LS: return "Data from LS";
|
||||
case ID_CF: return "Data from CF";
|
||||
case ID_VO: return "Data from VO";
|
||||
}
|
||||
return "Data from Lib Block";
|
||||
|
||||
@@ -8382,6 +8472,9 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, const short
|
||||
case ID_CF:
|
||||
direct_link_cachefile(fd, (CacheFile *)id);
|
||||
break;
|
||||
case ID_VO:
|
||||
direct_link_volume(fd, (Volume *)id);
|
||||
break;
|
||||
}
|
||||
|
||||
oldnewmap_free_unused(fd->datamap);
|
||||
@@ -8577,6 +8670,7 @@ static void lib_link_all(FileData *fd, Main *main)
|
||||
lib_link_linestyle(fd, main);
|
||||
lib_link_gpencil(fd, main);
|
||||
lib_link_cachefiles(fd, main);
|
||||
lib_link_volume(fd, main);
|
||||
|
||||
lib_link_library(fd, main); /* only init users */
|
||||
}
|
||||
@@ -9841,6 +9935,12 @@ static void expand_gpencil(FileData *fd, Main *mainvar, bGPdata *gpd)
|
||||
expand_animdata(fd, mainvar, gpd->adt);
|
||||
}
|
||||
|
||||
static void expand_volume(FileData *fd, Main *mainvar, Volume *volume)
|
||||
{
|
||||
if (volume->adt)
|
||||
expand_animdata(fd, mainvar, volume->adt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the callback func used over all ID data found by \a BLO_expand_main func.
|
||||
*
|
||||
@@ -9955,6 +10055,9 @@ void BLO_expand_main(void *fdhandle, Main *mainvar)
|
||||
case ID_CF:
|
||||
expand_cachefile(fd, mainvar, (CacheFile *)id);
|
||||
break;
|
||||
case ID_VO:
|
||||
expand_volume(fd, mainvar, (Volume *)id);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@@ -89,6 +89,7 @@ typedef struct FileData {
|
||||
struct OldNewMap *imamap;
|
||||
struct OldNewMap *movieclipmap;
|
||||
struct OldNewMap *soundmap;
|
||||
struct OldNewMap *volumemap;
|
||||
struct OldNewMap *packedmap;
|
||||
|
||||
struct BHeadSort *bheadmap;
|
||||
@@ -142,6 +143,8 @@ void blo_make_movieclip_pointer_map(FileData *fd, Main *oldmain);
|
||||
void blo_end_movieclip_pointer_map(FileData *fd, Main *oldmain);
|
||||
void blo_make_sound_pointer_map(FileData *fd, Main *oldmain);
|
||||
void blo_end_sound_pointer_map(FileData *fd, Main *oldmain);
|
||||
void blo_make_volume_pointer_map(FileData *fd, Main *oldmain);
|
||||
void blo_end_volume_pointer_map(FileData *fd, Main *oldmain);
|
||||
void blo_make_packed_pointer_map(FileData *fd, Main *oldmain);
|
||||
void blo_end_packed_pointer_map(FileData *fd, Main *oldmain);
|
||||
void blo_add_library_pointer_map(ListBase *old_mainlist, FileData *fd);
|
||||
|
@@ -144,6 +144,7 @@
|
||||
#include "DNA_text_types.h"
|
||||
#include "DNA_view3d_types.h"
|
||||
#include "DNA_vfont_types.h"
|
||||
#include "DNA_volume_types.h"
|
||||
#include "DNA_world_types.h"
|
||||
#include "DNA_windowmanager_types.h"
|
||||
#include "DNA_movieclip_types.h"
|
||||
@@ -3621,6 +3622,25 @@ static void write_cachefile(WriteData *wd, CacheFile *cache_file)
|
||||
}
|
||||
}
|
||||
|
||||
static void write_volume(WriteData *wd, Volume *volume)
|
||||
{
|
||||
if (volume->id.us > 0 || wd->use_memfile) {
|
||||
/* write LibData */
|
||||
writestruct(wd, ID_VO, Volume, 1, volume);
|
||||
write_iddata(wd, &volume->id);
|
||||
|
||||
if (volume->adt) {
|
||||
write_animdata(wd, volume->adt);
|
||||
}
|
||||
|
||||
if (volume->packedfile) {
|
||||
PackedFile *pf = volume->packedfile;
|
||||
writestruct(wd, DATA, PackedFile, 1, pf);
|
||||
writedata(wd, DATA, pf->size, pf->data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Keep it last of write_foodata functions. */
|
||||
static void write_libraries(WriteData *wd, Main *main)
|
||||
{
|
||||
@@ -3895,6 +3915,9 @@ static bool write_file_handle(
|
||||
case ID_CF:
|
||||
write_cachefile(wd, (CacheFile *)id);
|
||||
break;
|
||||
case ID_VO:
|
||||
write_volume(wd, (Volume *)id);
|
||||
break;
|
||||
case ID_LI:
|
||||
/* Do nothing, handled below - and should never be reached. */
|
||||
BLI_assert(0);
|
||||
|
@@ -148,6 +148,7 @@ bool BLT_lang_is_ime_supported(void);
|
||||
#define BLT_I18NCONTEXT_ID_TEXTURE "Texture"
|
||||
#define BLT_I18NCONTEXT_ID_TEXT "Text"
|
||||
#define BLT_I18NCONTEXT_ID_VFONT "VFont"
|
||||
#define BLT_I18NCONTEXT_ID_VOLUME "Volume"
|
||||
#define BLT_I18NCONTEXT_ID_WORLD "World"
|
||||
#define BLT_I18NCONTEXT_ID_WINDOWMANAGER "WindowManager"
|
||||
#define BLT_I18NCONTEXT_ID_MOVIECLIP "MovieClip"
|
||||
@@ -202,6 +203,7 @@ typedef struct {
|
||||
BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_TEXTURE, "id_texture"), \
|
||||
BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_TEXT, "id_text"), \
|
||||
BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_VFONT, "id_vfont"), \
|
||||
BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_VOLUME, "id_volume"), \
|
||||
BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_WORLD, "id_world"), \
|
||||
BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_WINDOWMANAGER, "id_windowmanager"), \
|
||||
{NULL, NULL, NULL} \
|
||||
|
@@ -58,6 +58,7 @@
|
||||
#include "DNA_world_types.h"
|
||||
#include "DNA_gpencil_types.h"
|
||||
#include "DNA_speaker_types.h"
|
||||
#include "DNA_volume_types.h"
|
||||
#include "DNA_mask_types.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
@@ -643,6 +644,8 @@ static int acf_object_icon(bAnimListElem *ale)
|
||||
return ICON_OUTLINER_OB_FONT;
|
||||
case OB_SURF:
|
||||
return ICON_OUTLINER_OB_SURFACE;
|
||||
case OB_VOLUME:
|
||||
return ICON_OUTLINER_OB_VOLUME;
|
||||
case OB_EMPTY:
|
||||
return ICON_OUTLINER_OB_EMPTY;
|
||||
default:
|
||||
@@ -2630,6 +2633,83 @@ static bAnimChannelType ACF_DSSPK =
|
||||
acf_dsspk_setting_ptr /* pointer for setting */
|
||||
};
|
||||
|
||||
/* Volume Expander ------------------------------------------- */
|
||||
|
||||
// TODO: just get this from RNA?
|
||||
static int acf_dsvolume_icon(bAnimListElem *UNUSED(ale))
|
||||
{
|
||||
return ICON_VOLUME;
|
||||
}
|
||||
|
||||
/* get the appropriate flag(s) for the setting when it is valid */
|
||||
static int acf_dsvolume_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 VO_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;
|
||||
}
|
||||
}
|
||||
|
||||
/* get pointer to the setting */
|
||||
static void *acf_dsvolume_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
|
||||
{
|
||||
Volume *volume = (Volume *)ale->data;
|
||||
|
||||
/* clear extra return data first */
|
||||
*type = 0;
|
||||
|
||||
switch (setting) {
|
||||
case ACHANNEL_SETTING_EXPAND: /* expanded */
|
||||
return GET_ACF_FLAG_PTR(volume->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 (volume->adt)
|
||||
return GET_ACF_FLAG_PTR(volume->adt->flag, type);
|
||||
return NULL;
|
||||
|
||||
default: /* unsupported */
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* volume expander type define */
|
||||
static bAnimChannelType ACF_DSVOLUME =
|
||||
{
|
||||
"Volume 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_dsvolume_icon, /* icon */
|
||||
|
||||
acf_generic_dataexpand_setting_valid, /* has setting */
|
||||
acf_dsvolume_setting_flag, /* flag for setting */
|
||||
acf_dsvolume_setting_ptr /* pointer for setting */
|
||||
};
|
||||
|
||||
/* GPencil Expander ------------------------------------------- */
|
||||
|
||||
// TODO: just get this from RNA?
|
||||
@@ -3591,6 +3671,7 @@ static void ANIM_init_channel_typeinfo_data(void)
|
||||
animchannelTypeInfo[type++] = &ACF_DSSPK; /* Speaker Channel */
|
||||
animchannelTypeInfo[type++] = &ACF_DSGPENCIL; /* GreasePencil Channel */
|
||||
animchannelTypeInfo[type++] = &ACF_DSMCLIP; /* MovieClip Channel */
|
||||
animchannelTypeInfo[type++] = &ACF_DSVOLUME; /* Volume Channel */
|
||||
|
||||
animchannelTypeInfo[type++] = &ACF_SHAPEKEY; /* ShapeKey */
|
||||
|
||||
|
@@ -134,6 +134,7 @@ void ANIM_set_active_channel(bAnimContext *ac, void *data, eAnimCont_Types datat
|
||||
case ANIMTYPE_DSSPK:
|
||||
case ANIMTYPE_DSGPENCIL:
|
||||
case ANIMTYPE_DSMCLIP:
|
||||
case ANIMTYPE_DSVOLUME:
|
||||
{
|
||||
/* need to verify that this data is valid for now */
|
||||
if (ale->adt) {
|
||||
@@ -192,6 +193,7 @@ void ANIM_set_active_channel(bAnimContext *ac, void *data, eAnimCont_Types datat
|
||||
case ANIMTYPE_DSTEX:
|
||||
case ANIMTYPE_DSGPENCIL:
|
||||
case ANIMTYPE_DSMCLIP:
|
||||
case ANIMTYPE_DSVOLUME:
|
||||
{
|
||||
/* need to verify that this data is valid for now */
|
||||
if (ale && ale->adt) {
|
||||
@@ -321,6 +323,7 @@ void ANIM_deselect_anim_channels(bAnimContext *ac, void *data, eAnimCont_Types d
|
||||
case ANIMTYPE_DSSPK:
|
||||
case ANIMTYPE_DSGPENCIL:
|
||||
case ANIMTYPE_DSMCLIP:
|
||||
case ANIMTYPE_DSVOLUME:
|
||||
{
|
||||
if ((ale->adt) && (ale->adt->flag & ADT_UI_SELECTED))
|
||||
sel = ACHANNEL_SETFLAG_CLEAR;
|
||||
@@ -418,6 +421,7 @@ void ANIM_deselect_anim_channels(bAnimContext *ac, void *data, eAnimCont_Types d
|
||||
case ANIMTYPE_DSSPK:
|
||||
case ANIMTYPE_DSGPENCIL:
|
||||
case ANIMTYPE_DSMCLIP:
|
||||
case ANIMTYPE_DSVOLUME:
|
||||
{
|
||||
/* need to verify that this data is valid for now */
|
||||
if (ale->adt) {
|
||||
@@ -2747,6 +2751,7 @@ static int mouse_anim_channels(bContext *C, bAnimContext *ac, int channel_index,
|
||||
case ANIMTYPE_DSSPK:
|
||||
case ANIMTYPE_DSGPENCIL:
|
||||
case ANIMTYPE_DSMCLIP:
|
||||
case ANIMTYPE_DSVOLUME:
|
||||
{
|
||||
/* sanity checking... */
|
||||
if (ale->adt) {
|
||||
|
@@ -70,6 +70,7 @@
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
#include "DNA_speaker_types.h"
|
||||
#include "DNA_volume_types.h"
|
||||
#include "DNA_world_types.h"
|
||||
#include "DNA_gpencil_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
@@ -752,6 +753,19 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne
|
||||
ale->adt = BKE_animdata_from_id(data);
|
||||
break;
|
||||
}
|
||||
case ANIMTYPE_DSVOLUME:
|
||||
{
|
||||
Volume *volume = (Volume *)data;
|
||||
AnimData *adt = volume->adt;
|
||||
|
||||
ale->flag = FILTER_VOLUME_OBJD(volume);
|
||||
|
||||
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;
|
||||
@@ -2425,6 +2439,14 @@ static size_t animdata_filter_ds_obdata(bAnimContext *ac, ListBase *anim_data, b
|
||||
expanded = FILTER_SPK_OBJD(spk);
|
||||
break;
|
||||
}
|
||||
case OB_VOLUME: /* ---------- Volume ----------- */
|
||||
{
|
||||
Volume *volume = (Volume *)ob->data;
|
||||
|
||||
type = ANIMTYPE_DSVOLUME;
|
||||
expanded = FILTER_VOLUME_OBJD(volume);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* add object data animation channels */
|
||||
|
@@ -182,6 +182,7 @@ typedef enum eAnim_ChannelType {
|
||||
ANIMTYPE_DSSPK,
|
||||
ANIMTYPE_DSGPENCIL,
|
||||
ANIMTYPE_DSMCLIP,
|
||||
ANIMTYPE_DSVOLUME,
|
||||
|
||||
ANIMTYPE_SHAPEKEY,
|
||||
|
||||
@@ -296,6 +297,7 @@ typedef enum eAnimFilter_Flags {
|
||||
#define FILTER_MESH_OBJD(me) (CHECK_TYPE_INLINE(me, Mesh *), ((me->flag & ME_DS_EXPAND)))
|
||||
#define FILTER_LATTICE_OBJD(lt) (CHECK_TYPE_INLINE(lt, Lattice *), ((lt->flag & LT_DS_EXPAND)))
|
||||
#define FILTER_SPK_OBJD(spk) (CHECK_TYPE_INLINE(spk, Speaker *), ((spk->flag & SPK_DS_EXPAND)))
|
||||
#define FILTER_VOLUME_OBJD(vo) (CHECK_TYPE_INLINE(vo, Volume *), ((vo->flag & VO_DS_EXPAND)))
|
||||
/* Variable use expanders */
|
||||
#define FILTER_NTREE_DATA(ntree) (CHECK_TYPE_INLINE(ntree, bNodeTree *), ((ntree->flag & NTREE_DS_EXPAND)))
|
||||
#define FILTER_TEX_DATA(tex) (CHECK_TYPE_INLINE(tex, Tex *), ((tex->flag & TEX_DS_EXPAND)))
|
||||
|
@@ -135,8 +135,8 @@ DEF_ICON(PARTICLES)
|
||||
DEF_ICON(PHYSICS)
|
||||
DEF_ICON(SPEAKER)
|
||||
DEF_ICON(TEXTURE_SHADED)
|
||||
DEF_ICON(VOLUME)
|
||||
#ifndef DEF_ICON_BLANK_SKIP
|
||||
DEF_ICON(BLANK042)
|
||||
DEF_ICON(BLANK043)
|
||||
DEF_ICON(BLANK044)
|
||||
DEF_ICON(BLANK045)
|
||||
@@ -235,9 +235,7 @@ DEF_ICON(CONSTRAINT_BONE)
|
||||
DEF_ICON(CAMERA_STEREO)
|
||||
DEF_ICON(PACKAGE)
|
||||
DEF_ICON(UGLYPACKAGE)
|
||||
#ifndef DEF_ICON_BLANK_SKIP
|
||||
DEF_ICON(BLANK079b)
|
||||
#endif
|
||||
DEF_ICON(VOLUME_DATA) /* TODO */
|
||||
|
||||
/* DATA */
|
||||
DEF_ICON(BRUSH_DATA)
|
||||
@@ -315,8 +313,8 @@ DEF_ICON(OUTLINER_OB_SURFACE)
|
||||
DEF_ICON(OUTLINER_OB_SPEAKER)
|
||||
DEF_ICON(OUTLINER_OB_FORCE_FIELD)
|
||||
DEF_ICON(OUTLINER_OB_GROUP_INSTANCE)
|
||||
DEF_ICON(OUTLINER_OB_VOLUME)
|
||||
#ifndef DEF_ICON_BLANK_SKIP
|
||||
DEF_ICON(BLANK122)
|
||||
DEF_ICON(BLANK123)
|
||||
DEF_ICON(BLANK124)
|
||||
DEF_ICON(BLANK125)
|
||||
@@ -348,7 +346,9 @@ DEF_ICON(OUTLINER_DATA_SPEAKER)
|
||||
DEF_ICON(OUTLINER_DATA_POSE)
|
||||
#ifndef DEF_ICON_BLANK_SKIP
|
||||
DEF_ICON(BLANK130)
|
||||
DEF_ICON(BLANK131)
|
||||
#endif
|
||||
DEF_ICON(OUTLINER_DATA_VOLUME)
|
||||
#ifndef DEF_ICON_BLANK_SKIP
|
||||
DEF_ICON(BLANK132)
|
||||
DEF_ICON(BLANK133)
|
||||
DEF_ICON(BLANK134)
|
||||
|
@@ -1356,6 +1356,8 @@ int UI_idcode_icon_get(const int idcode)
|
||||
return ICON_TEXT;
|
||||
case ID_VF:
|
||||
return ICON_FONT_DATA;
|
||||
case ID_VO:
|
||||
return ICON_VOLUME;
|
||||
case ID_WO:
|
||||
return ICON_WORLD_DATA;
|
||||
default:
|
||||
|
@@ -455,6 +455,7 @@ static const char *template_id_browse_tip(StructRNA *type)
|
||||
case ID_PAL: return N_("Browse Palette Data to be linked");
|
||||
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_VO: return N_("Browse Volume Data to be linked");
|
||||
}
|
||||
}
|
||||
return N_("Browse ID data to be linked");
|
||||
@@ -619,6 +620,7 @@ static void template_ID(
|
||||
BLT_I18NCONTEXT_ID_PARTICLESETTINGS,
|
||||
BLT_I18NCONTEXT_ID_GPENCIL,
|
||||
BLT_I18NCONTEXT_ID_FREESTYLELINESTYLE,
|
||||
BLT_I18NCONTEXT_ID_VOLUME,
|
||||
);
|
||||
|
||||
if (newop) {
|
||||
|
@@ -90,6 +90,7 @@
|
||||
#include "BKE_scene.h"
|
||||
#include "BKE_screen.h"
|
||||
#include "BKE_speaker.h"
|
||||
#include "BKE_volume.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
#include "RNA_define.h"
|
||||
@@ -1095,6 +1096,39 @@ void OBJECT_OT_speaker_add(wmOperatorType *ot)
|
||||
ED_object_add_generic_props(ot, true);
|
||||
}
|
||||
|
||||
/********************* Add Volume Operator ********************/
|
||||
|
||||
static int object_volume_add_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob;
|
||||
unsigned int layer;
|
||||
float loc[3], rot[3];
|
||||
|
||||
if (!ED_object_add_generic_get_opts(C, op, 'Z', loc, rot, NULL, &layer, NULL))
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
ob = ED_object_add_type(C, OB_VOLUME, NULL, loc, rot, false, layer);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void OBJECT_OT_volume_add(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name = "Add volume";
|
||||
ot->description = "Add a volume object to the scene";
|
||||
ot->idname = "OBJECT_OT_volume_add";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec = object_volume_add_exec;
|
||||
ot->poll = ED_operator_objectmode;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
ED_object_add_generic_props(ot, true);
|
||||
}
|
||||
|
||||
/**************************** Delete Object *************************/
|
||||
|
||||
static void object_delete_check_glsl_update(Object *ob)
|
||||
@@ -2182,6 +2216,15 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
|
||||
}
|
||||
id_us_min(id);
|
||||
}
|
||||
case OB_VOLUME:
|
||||
if (dupflag != 0) {
|
||||
ID_NEW_REMAP_US2(obn->data)
|
||||
else {
|
||||
obn->data = ID_NEW_SET(obn->data, BKE_volume_copy(bmain, obn->data));
|
||||
didit = 1;
|
||||
}
|
||||
id_us_min(id);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
@@ -122,6 +122,7 @@ void OBJECT_OT_lamp_add(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_effector_add(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_camera_add(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_speaker_add(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_volume_add(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_group_instance_add(struct wmOperatorType *ot);
|
||||
|
||||
void OBJECT_OT_duplicates_make_real(struct wmOperatorType *ot);
|
||||
|
@@ -117,6 +117,7 @@ void ED_operatortypes_object(void)
|
||||
WM_operatortype_append(OBJECT_OT_lamp_add);
|
||||
WM_operatortype_append(OBJECT_OT_camera_add);
|
||||
WM_operatortype_append(OBJECT_OT_speaker_add);
|
||||
WM_operatortype_append(OBJECT_OT_volume_add);
|
||||
WM_operatortype_append(OBJECT_OT_add);
|
||||
WM_operatortype_append(OBJECT_OT_add_named);
|
||||
WM_operatortype_append(OBJECT_OT_effector_add);
|
||||
|
@@ -91,6 +91,7 @@
|
||||
#include "BKE_speaker.h"
|
||||
#include "BKE_texture.h"
|
||||
#include "BKE_editmesh.h"
|
||||
#include "BKE_volume.h"
|
||||
|
||||
#include "WM_api.h"
|
||||
#include "WM_types.h"
|
||||
@@ -1919,6 +1920,9 @@ static void single_obdata_users(Main *bmain, Scene *scene, const int flag)
|
||||
case OB_SPEAKER:
|
||||
ob->data = ID_NEW_SET(ob->data, BKE_speaker_copy(bmain, ob->data));
|
||||
break;
|
||||
case OB_VOLUME:
|
||||
ob->data = ID_NEW_SET(ob->data, BKE_volume_copy(bmain, ob->data));
|
||||
break;
|
||||
default:
|
||||
if (G.debug & G_DEBUG)
|
||||
printf("ERROR %s: can't copy %s\n", __func__, id->name);
|
||||
|
@@ -208,6 +208,7 @@ static int buttons_context_path_data(ButsContextPath *path, int type)
|
||||
else if (RNA_struct_is_a(ptr->type, &RNA_Camera) && (type == -1 || type == OB_CAMERA)) return 1;
|
||||
else if (RNA_struct_is_a(ptr->type, &RNA_Lamp) && (type == -1 || type == OB_LAMP)) return 1;
|
||||
else if (RNA_struct_is_a(ptr->type, &RNA_Speaker) && (type == -1 || type == OB_SPEAKER)) return 1;
|
||||
else if (RNA_struct_is_a(ptr->type, &RNA_Volume) && (type == -1 || type == OB_VOLUME)) return 1;
|
||||
/* try to get an object in the path, no pinning supported here */
|
||||
else if (buttons_context_path_object(path)) {
|
||||
ob = path->ptr[path->len - 1].data;
|
||||
@@ -744,7 +745,7 @@ const char *buttons_context_dir[] = {
|
||||
"texture", "texture_user", "texture_user_property", "bone", "edit_bone",
|
||||
"pose_bone", "particle_system", "particle_system_editable", "particle_settings",
|
||||
"cloth", "soft_body", "fluid", "smoke", "collision", "brush", "dynamic_paint",
|
||||
"line_style", NULL
|
||||
"line_style", "volume", NULL
|
||||
};
|
||||
|
||||
int buttons_context(const bContext *C, const char *member, bContextDataResult *result)
|
||||
@@ -809,6 +810,10 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
|
||||
set_pointer_type(path, result, &RNA_Speaker);
|
||||
return 1;
|
||||
}
|
||||
else if (CTX_data_equals(member, "volume")) {
|
||||
set_pointer_type(path, result, &RNA_Volume);
|
||||
return 1;
|
||||
}
|
||||
else if (CTX_data_equals(member, "material")) {
|
||||
set_pointer_type(path, result, &RNA_Material);
|
||||
return 1;
|
||||
|
@@ -2335,9 +2335,9 @@ static void filelist_readjob_main_rec(Main *bmain, FileList *filelist)
|
||||
if (filelist->dir[0] == 0) {
|
||||
/* make directories */
|
||||
#ifdef WITH_FREESTYLE
|
||||
filelist->filelist.nbr_entries = 24;
|
||||
filelist->filelist.nbr_entries = 25;
|
||||
#else
|
||||
filelist->filelist.nbr_entries = 23;
|
||||
filelist->filelist.nbr_entries = 24;
|
||||
#endif
|
||||
filelist_resize(filelist, filelist->filelist.nbr_entries);
|
||||
|
||||
@@ -2368,8 +2368,9 @@ static void filelist_readjob_main_rec(Main *bmain, FileList *filelist)
|
||||
filelist->filelist.entries[20].entry->relpath = BLI_strdup("Action");
|
||||
filelist->filelist.entries[21].entry->relpath = BLI_strdup("NodeTree");
|
||||
filelist->filelist.entries[22].entry->relpath = BLI_strdup("Speaker");
|
||||
filelist->filelist.entries[23].entry->relpath = BLI_strdup("Volume");
|
||||
#ifdef WITH_FREESTYLE
|
||||
filelist->filelist.entries[23].entry->relpath = BLI_strdup("FreestyleLineStyle");
|
||||
filelist->filelist.entries[24].entry->relpath = BLI_strdup("FreestyleLineStyle");
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
|
@@ -221,7 +221,7 @@ 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_TE | FILTER_ID_TXT | FILTER_ID_VF | FILTER_ID_WO | FILTER_ID_CF | FILTER_ID_VO;
|
||||
|
||||
if (U.uiflag & USER_HIDE_DOT) {
|
||||
params->flag |= FILE_HIDE_DOT;
|
||||
|
@@ -145,6 +145,7 @@ bool nla_panel_context(const bContext *C, PointerRNA *adt_ptr, PointerRNA *nlt_p
|
||||
case ANIMTYPE_DSLINESTYLE:
|
||||
case ANIMTYPE_DSSPK:
|
||||
case ANIMTYPE_DSGPENCIL:
|
||||
case ANIMTYPE_DSVOLUME:
|
||||
{
|
||||
/* for these channels, we only do AnimData */
|
||||
if (ale->adt && adt_ptr) {
|
||||
|
@@ -184,6 +184,7 @@ static int mouse_nla_channels(bContext *C, bAnimContext *ac, float x, int channe
|
||||
case ANIMTYPE_DSLINESTYLE:
|
||||
case ANIMTYPE_DSSPK:
|
||||
case ANIMTYPE_DSGPENCIL:
|
||||
case ANIMTYPE_DSVOLUME:
|
||||
{
|
||||
/* sanity checking... */
|
||||
if (ale->adt) {
|
||||
|
@@ -1269,6 +1269,8 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto
|
||||
tselem_draw_icon_uibut(&arg, ICON_OUTLINER_OB_SURFACE); break;
|
||||
case OB_SPEAKER:
|
||||
tselem_draw_icon_uibut(&arg, ICON_OUTLINER_OB_SPEAKER); break;
|
||||
case OB_VOLUME:
|
||||
tselem_draw_icon_uibut(&arg, ICON_OUTLINER_OB_VOLUME); break;
|
||||
case OB_EMPTY:
|
||||
tselem_draw_icon_uibut(&arg, ICON_OUTLINER_OB_EMPTY); break;
|
||||
}
|
||||
@@ -1332,6 +1334,8 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto
|
||||
tselem_draw_icon_uibut(&arg, ICON_SCRIPT); break;
|
||||
case ID_GR:
|
||||
tselem_draw_icon_uibut(&arg, ICON_GROUP); break;
|
||||
case ID_VO:
|
||||
tselem_draw_icon_uibut(&arg, ICON_VOLUME); break;
|
||||
case ID_LI:
|
||||
if (tselem->id->tag & LIB_TAG_MISSING) {
|
||||
tselem_draw_icon_uibut(&arg, ICON_LIBRARY_DATA_BROKEN);
|
||||
|
@@ -61,7 +61,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_VO) || \
|
||||
ELEM(GS((_id)->name), ID_SCR, ID_WM, ID_TXT, ID_VF, ID_SO, ID_CF, ID_PAL, ID_MC)) /* Only in 'blendfile' mode ... :/ */
|
||||
|
||||
/* TreeElement->flag */
|
||||
|
@@ -53,6 +53,7 @@
|
||||
#include "DNA_speaker_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_linestyle_types.h"
|
||||
#include "DNA_volume_types.h"
|
||||
|
||||
#include "BLI_blenlib.h"
|
||||
#include "BLI_utildefines.h"
|
||||
@@ -882,6 +883,14 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ID_VO:
|
||||
{
|
||||
Volume *volume = (Volume *)id;
|
||||
|
||||
if (outliner_animdata_test(volume->adt))
|
||||
outliner_add_element(soops, &te->subtree, volume, te, TSE_ANIM_DATA, 0);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@@ -2230,6 +2230,14 @@ static void drawspeaker(Scene *UNUSED(scene), View3D *UNUSED(v3d), RegionView3D
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
|
||||
/* flag similar to draw_object() */
|
||||
static void drawvolume(Scene *UNUSED(scene), View3D *UNUSED(v3d), RegionView3D *UNUSED(rv3d),
|
||||
Object *UNUSED(ob), int UNUSED(flag))
|
||||
{
|
||||
drawcube_size(1.0f);
|
||||
}
|
||||
|
||||
|
||||
static void lattice_draw_verts(Lattice *lt, DispList *dl, BPoint *actbp, short sel)
|
||||
{
|
||||
BPoint *bp = lt->def;
|
||||
@@ -7766,6 +7774,9 @@ void draw_object(Main *bmain, Scene *scene, ARegion *ar, View3D *v3d, Base *base
|
||||
}
|
||||
}
|
||||
break;
|
||||
case OB_VOLUME:
|
||||
drawvolume(scene, v3d, rv3d, ob, dflag);
|
||||
break;
|
||||
default:
|
||||
if (!render_override) {
|
||||
drawaxes(rv3d->viewmatob, 1.0, OB_ARROWS);
|
||||
|
@@ -257,6 +257,7 @@ typedef enum ID_Type {
|
||||
ID_PAL = MAKE_ID2('P', 'L'), /* Palette */
|
||||
ID_PC = MAKE_ID2('P', 'C'), /* PaintCurve */
|
||||
ID_CF = MAKE_ID2('C', 'F'), /* CacheFile */
|
||||
ID_VO = MAKE_ID2('V', 'O'), /* Volume */
|
||||
} ID_Type;
|
||||
|
||||
/* Only used as 'placeholder' in .blend files for directly linked datablocks. */
|
||||
@@ -401,6 +402,7 @@ enum {
|
||||
FILTER_ID_WO = (1 << 26),
|
||||
FILTER_ID_PA = (1 << 27),
|
||||
FILTER_ID_CF = (1 << 28),
|
||||
FILTER_ID_VO = (1 << 29),
|
||||
};
|
||||
|
||||
/* IMPORTANT: this enum matches the order currently use in set_lisbasepointers,
|
||||
@@ -440,6 +442,7 @@ enum {
|
||||
INDEX_ID_SCE,
|
||||
INDEX_ID_WM,
|
||||
INDEX_ID_MSK,
|
||||
INDEX_ID_VO,
|
||||
INDEX_ID_NULL,
|
||||
};
|
||||
|
||||
|
@@ -644,6 +644,7 @@ typedef enum eDopeSheet_Flag {
|
||||
ADS_FLAG_NO_DB_SORT = (1 << 3), /* do not sort datablocks (mostly objects) by name (NOTE: potentially expensive operation) */
|
||||
|
||||
/* NOTE: datablock filter flags continued (1 << 10) onwards... */
|
||||
ADS_FILTER_NOVOLUME = (1 << 10), /* TODO ADS_FILTER_NOOBDATA */
|
||||
} eDopeSheet_Flag;
|
||||
|
||||
|
||||
|
@@ -366,6 +366,7 @@ enum {
|
||||
|
||||
/* 23 and 24 are for life and sector (old file compat.) */
|
||||
OB_ARMATURE = 25,
|
||||
OB_VOLUME = 26,
|
||||
};
|
||||
|
||||
/* check if the object type supports materials */
|
||||
@@ -384,10 +385,10 @@ enum {
|
||||
|
||||
/* is this ID type used as object data */
|
||||
#define OB_DATA_SUPPORT_ID(_id_type) \
|
||||
(ELEM(_id_type, ID_ME, ID_CU, ID_MB, ID_LA, ID_SPK, ID_CA, ID_LT, ID_AR))
|
||||
(ELEM(_id_type, ID_ME, ID_CU, ID_MB, ID_LA, ID_SPK, ID_CA, ID_LT, ID_AR, ID_VO))
|
||||
|
||||
#define OB_DATA_SUPPORT_ID_CASE \
|
||||
ID_ME: case ID_CU: case ID_MB: case ID_LA: case ID_SPK: case ID_CA: case ID_LT: case ID_AR
|
||||
ID_ME: case ID_CU: case ID_MB: case ID_LA: case ID_SPK: case ID_CA: case ID_LT: case ID_AR: case ID_VO
|
||||
|
||||
/* partype: first 4 bits: type */
|
||||
enum {
|
||||
|
61
source/blender/makesdna/DNA_volume_types.h
Normal file
61
source/blender/makesdna/DNA_volume_types.h
Normal file
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* ***** 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): Jörg Müller.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
/** \file DNA_volume_types.h
|
||||
* \ingroup DNA
|
||||
*/
|
||||
|
||||
#ifndef __DNA_VOLUME_TYPES_H__
|
||||
#define __DNA_VOLUME_TYPES_H__
|
||||
|
||||
#include "DNA_ID.h"
|
||||
|
||||
struct PackedFile;
|
||||
|
||||
typedef struct VolumeGrid {
|
||||
struct VolumeGrid *next, *prev;
|
||||
|
||||
char name[64]; /* MAX_NAME */
|
||||
void *openvdb_handle;
|
||||
} VolumeGrid;
|
||||
|
||||
typedef struct Volume {
|
||||
ID id;
|
||||
struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */
|
||||
|
||||
char filepath[1024]; /* FILE_MAX */
|
||||
|
||||
struct PackedFile *packedfile;
|
||||
|
||||
ListBase grids;
|
||||
|
||||
int flag;
|
||||
int pad[3];
|
||||
} Volume;
|
||||
|
||||
/* **************** VOLUME ********************* */
|
||||
|
||||
/* flag */
|
||||
#define VO_DS_EXPAND (1<<0)
|
||||
|
||||
#endif /* __DNA_VOLUME_TYPES_H__ */
|
||||
|
@@ -130,6 +130,7 @@ static const char *includefiles[] = {
|
||||
"DNA_freestyle_types.h",
|
||||
"DNA_linestyle_types.h",
|
||||
"DNA_cachefile_types.h",
|
||||
"DNA_volume_types.h",
|
||||
/* see comment above before editing! */
|
||||
|
||||
/* empty string to indicate end of includefiles */
|
||||
@@ -1343,4 +1344,5 @@ int main(int argc, char **argv)
|
||||
#include "DNA_freestyle_types.h"
|
||||
#include "DNA_linestyle_types.h"
|
||||
#include "DNA_cachefile_types.h"
|
||||
#include "DNA_volume_types.h"
|
||||
/* end of list */
|
||||
|
@@ -698,6 +698,7 @@ extern StructRNA RNA_WaveModifier;
|
||||
extern StructRNA RNA_VertexWeightEditModifier;
|
||||
extern StructRNA RNA_VertexWeightMixModifier;
|
||||
extern StructRNA RNA_VertexWeightProximityModifier;
|
||||
extern StructRNA RNA_Volume;
|
||||
extern StructRNA RNA_Window;
|
||||
extern StructRNA RNA_WindowManager;
|
||||
extern StructRNA RNA_WipeSequence;
|
||||
|
@@ -93,6 +93,7 @@ set(DEFSRC
|
||||
rna_ui.c
|
||||
rna_userdef.c
|
||||
rna_vfont.c
|
||||
rna_volume.c
|
||||
rna_wm.c
|
||||
rna_world.c
|
||||
)
|
||||
|
@@ -3407,6 +3407,7 @@ static RNAProcessItem PROCESS_ITEMS[] = {
|
||||
{"rna_ui.c", "rna_ui_api.c", RNA_def_ui},
|
||||
{"rna_userdef.c", NULL, RNA_def_userdef},
|
||||
{"rna_vfont.c", "rna_vfont_api.c", RNA_def_vfont},
|
||||
{"rna_volume.c", NULL, RNA_def_volume},
|
||||
{"rna_wm.c", "rna_wm_api.c", RNA_def_wm},
|
||||
{"rna_world.c", NULL, RNA_def_world},
|
||||
{"rna_movieclip.c", NULL, RNA_def_movieclip},
|
||||
|
@@ -81,6 +81,7 @@ const EnumPropertyItem rna_enum_id_type_items[] = {
|
||||
{ID_SPK, "SPEAKER", ICON_SPEAKER, "Speaker", ""},
|
||||
{ID_TXT, "TEXT", ICON_TEXT, "Text", ""},
|
||||
{ID_TE, "TEXTURE", ICON_TEXTURE_DATA, "Texture", ""},
|
||||
{ID_VO, "VOLUME", ICON_VOLUME, "Volume", ""},
|
||||
{ID_WM, "WINDOWMANAGER", ICON_FULLSCREEN, "Window Manager", ""},
|
||||
{ID_WO, "WORLD", ICON_WORLD_DATA, "World", ""},
|
||||
{0, NULL, 0, NULL, NULL}
|
||||
@@ -175,6 +176,7 @@ short RNA_type_to_ID_code(const StructRNA *type)
|
||||
if (base_type == &RNA_Texture) return ID_TE;
|
||||
if (base_type == &RNA_Text) return ID_TXT;
|
||||
if (base_type == &RNA_VectorFont) return ID_VF;
|
||||
if (base_type == &RNA_Volume) return ID_VO;
|
||||
if (base_type == &RNA_World) return ID_WO;
|
||||
if (base_type == &RNA_WindowManager) return ID_WM;
|
||||
|
||||
@@ -217,6 +219,7 @@ StructRNA *ID_code_to_RNA_type(short idcode)
|
||||
case ID_TE: return &RNA_Texture;
|
||||
case ID_TXT: return &RNA_Text;
|
||||
case ID_VF: return &RNA_VectorFont;
|
||||
case ID_VO: return &RNA_Volume;
|
||||
case ID_WM: return &RNA_WindowManager;
|
||||
case ID_WO: return &RNA_World;
|
||||
|
||||
|
@@ -508,6 +508,12 @@ static void rna_def_dopesheet(BlenderRNA *brna)
|
||||
RNA_def_property_ui_icon(prop, ICON_SPEAKER, 0);
|
||||
RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
|
||||
|
||||
prop = RNA_def_property(srna, "show_volumes", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", ADS_FILTER_NOVOLUME); /* TODO */
|
||||
RNA_def_property_ui_text(prop, "Display Volume", "Include visualization of volume related animation data");
|
||||
RNA_def_property_ui_icon(prop, ICON_VOLUME, 0);
|
||||
RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
|
||||
|
||||
prop = RNA_def_property(srna, "show_gpencil", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOGPENCIL);
|
||||
RNA_def_property_ui_text(prop, "Display Grease Pencil", "Include visualization of Grease Pencil related animation data and frames");
|
||||
|
@@ -185,6 +185,7 @@ void RNA_def_sound(struct BlenderRNA *brna);
|
||||
void RNA_def_ui(struct BlenderRNA *brna);
|
||||
void RNA_def_userdef(struct BlenderRNA *brna);
|
||||
void RNA_def_vfont(struct BlenderRNA *brna);
|
||||
void RNA_def_volume(struct BlenderRNA *brna);
|
||||
void RNA_def_wm(struct BlenderRNA *brna);
|
||||
void RNA_def_world(struct BlenderRNA *brna);
|
||||
void RNA_def_movieclip(struct BlenderRNA *brna);
|
||||
@@ -336,6 +337,7 @@ void RNA_def_main_masks(BlenderRNA *brna, PropertyRNA *cprop);
|
||||
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_volumes(BlenderRNA *brna, PropertyRNA *cprop);
|
||||
|
||||
/* ID Properties */
|
||||
|
||||
|
@@ -293,6 +293,12 @@ static void rna_Main_paintcurves_begin(CollectionPropertyIterator *iter, Pointer
|
||||
rna_iterator_listbase_begin(iter, &bmain->paintcurves, NULL);
|
||||
}
|
||||
|
||||
static void rna_Main_volumes_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
|
||||
{
|
||||
Main *bmain = (Main *)ptr->data;
|
||||
rna_iterator_listbase_begin(iter, &bmain->volume, NULL);
|
||||
}
|
||||
|
||||
static void rna_Main_version_get(PointerRNA *ptr, int *value)
|
||||
{
|
||||
Main *bmain = (Main *)ptr->data;
|
||||
@@ -368,6 +374,7 @@ void RNA_def_main(BlenderRNA *brna)
|
||||
{"linestyles", "FreestyleLineStyle", "rna_Main_linestyle_begin", "Line Styles", "Line Style data-blocks", RNA_def_main_linestyles},
|
||||
{"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},
|
||||
{"volumes", "Volume", "rna_Main_volumes_begin", "Volumes", "Volume data-blocks", RNA_def_main_volumes},
|
||||
{NULL, NULL, NULL, NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
|
@@ -84,6 +84,7 @@
|
||||
#include "BKE_mask.h"
|
||||
#include "BKE_gpencil.h"
|
||||
#include "BKE_linestyle.h"
|
||||
#include "BKE_volume.h"
|
||||
|
||||
#include "DNA_armature_types.h"
|
||||
#include "DNA_camera_types.h"
|
||||
@@ -106,6 +107,7 @@
|
||||
#include "DNA_movieclip_types.h"
|
||||
#include "DNA_mask_types.h"
|
||||
#include "DNA_gpencil_types.h"
|
||||
#include "DNA_volume_types.h"
|
||||
|
||||
#include "ED_screen.h"
|
||||
|
||||
@@ -227,6 +229,9 @@ static Object *rna_Main_objects_new(Main *bmain, ReportList *reports, const char
|
||||
case ID_AR:
|
||||
type = OB_ARMATURE;
|
||||
break;
|
||||
case ID_VO:
|
||||
type = OB_VOLUME;
|
||||
break;
|
||||
default:
|
||||
{
|
||||
const char *idname;
|
||||
@@ -574,6 +579,16 @@ static FreestyleLineStyle *rna_Main_linestyles_new(Main *bmain, const char *name
|
||||
return linestyle;
|
||||
}
|
||||
|
||||
static Volume *rna_Main_volumes_new(Main *bmain, const char *name)
|
||||
{
|
||||
char safe_name[MAX_ID_NAME - 2];
|
||||
rna_idname_validate(name, safe_name);
|
||||
|
||||
Volume *volume = BKE_volume_add(bmain, safe_name);
|
||||
id_us_min(&volume->id);
|
||||
return volume;
|
||||
}
|
||||
|
||||
/* 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, bool value) { \
|
||||
@@ -616,6 +631,7 @@ RNA_MAIN_ID_TAG_FUNCS_DEF(masks, mask, ID_MSK)
|
||||
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(volumes, volume, ID_VO)
|
||||
|
||||
#undef RNA_MAIN_ID_TAG_FUNCS_DEF
|
||||
|
||||
@@ -1928,4 +1944,47 @@ void RNA_def_main_linestyles(BlenderRNA *brna, PropertyRNA *cprop)
|
||||
RNA_def_property_boolean_funcs(prop, "rna_Main_linestyle_is_updated_get", NULL);
|
||||
}
|
||||
|
||||
void RNA_def_main_volumes(BlenderRNA *brna, PropertyRNA *cprop)
|
||||
{
|
||||
StructRNA *srna;
|
||||
FunctionRNA *func;
|
||||
PropertyRNA *parm;
|
||||
PropertyRNA *prop;
|
||||
|
||||
RNA_def_property_srna(cprop, "BlendDataVolumes");
|
||||
srna = RNA_def_struct(brna, "BlendDataVolumes", NULL);
|
||||
RNA_def_struct_sdna(srna, "Main");
|
||||
RNA_def_struct_ui_text(srna, "Main Volumes", "Collection of volumes");
|
||||
|
||||
func = RNA_def_function(srna, "new", "rna_Main_volumes_new");
|
||||
RNA_def_function_ui_description(func, "Add a new volume to the main database");
|
||||
parm = RNA_def_string(func, "name", "Volume", 0, "", "New name for the data-block");
|
||||
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
||||
/* return type */
|
||||
parm = RNA_def_pointer(func, "volume", "Volume", "", "New volume 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 volume from the current blendfile");
|
||||
parm = RNA_def_pointer(func, "volume", "Volume", "", "Volume 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 volume before deleting it "
|
||||
"(WARNING: will also delete objects instancing that volume data)");
|
||||
RNA_def_boolean(func, "do_id_user", true, "",
|
||||
"Decrement user counter of all datablocks used by this volume data");
|
||||
RNA_def_boolean(func, "do_ui_user", true, "",
|
||||
"Make sure interface does not reference this volume data");
|
||||
|
||||
func = RNA_def_function(srna, "tag", "rna_Main_volumes_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_volumes_is_updated_get", NULL);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@@ -140,6 +140,7 @@ const EnumPropertyItem rna_enum_object_type_items[] = {
|
||||
OBTYPE_CU_SURF,
|
||||
{OB_MBALL, "META", 0, "Meta", ""},
|
||||
OBTYPE_CU_FONT,
|
||||
{OB_VOLUME, "VOLUME", 0, "Volume", ""},
|
||||
{0, "", 0, NULL, NULL},
|
||||
{OB_ARMATURE, "ARMATURE", 0, "Armature", ""},
|
||||
{OB_LATTICE, "LATTICE", 0, "Lattice", ""},
|
||||
@@ -434,6 +435,7 @@ static StructRNA *rna_Object_data_typef(PointerRNA *ptr)
|
||||
case OB_LATTICE: return &RNA_Lattice;
|
||||
case OB_ARMATURE: return &RNA_Armature;
|
||||
case OB_SPEAKER: return &RNA_Speaker;
|
||||
case OB_VOLUME: return &RNA_Volume;
|
||||
default: return &RNA_ID;
|
||||
}
|
||||
}
|
||||
|
@@ -3899,6 +3899,7 @@ static void rna_def_fileselect_params(BlenderRNA *brna)
|
||||
{FILTER_ID_TE, "TEXTURE", ICON_TEXTURE_DATA, "Textures", "Show/hide Texture data-blocks"},
|
||||
{FILTER_ID_TXT, "TEXT", ICON_TEXT, "Texts", "Show/hide Text data-blocks"},
|
||||
{FILTER_ID_VF, "FONT", ICON_FONT_DATA, "Fonts", "Show/hide Font data-blocks"},
|
||||
{FILTER_ID_VO, "VOLUME", ICON_VOLUME_DATA, "Volumes", "Show/hide Volume data-blocks"},
|
||||
{FILTER_ID_WO, "WORLD", ICON_WORLD_DATA, "Worlds", "Show/hide World data-blocks"},
|
||||
{0, NULL, 0, NULL, NULL}
|
||||
};
|
||||
@@ -3910,8 +3911,8 @@ static void rna_def_fileselect_params(BlenderRNA *brna)
|
||||
"ANIMATION", ICON_ANIM_DATA, "Animations", "Show/hide animation data"},
|
||||
{FILTER_ID_OB | FILTER_ID_GR,
|
||||
"OBJECT", ICON_GROUP, "Objects & Groups", "Show/hide objects and groups"},
|
||||
{FILTER_ID_AR | FILTER_ID_CU | FILTER_ID_LT | FILTER_ID_MB | FILTER_ID_ME,
|
||||
"GEOMETRY", ICON_MESH_DATA, "Geometry", "Show/hide meshes, curves, lattice, armatures and metaballs data"},
|
||||
{FILTER_ID_AR | FILTER_ID_CU | FILTER_ID_LT | FILTER_ID_MB | FILTER_ID_ME | FILTER_ID_VO,
|
||||
"GEOMETRY", ICON_MESH_DATA, "Geometry", "Show/hide meshes, curves, lattice, armatures, metaballs and volume data"},
|
||||
{FILTER_ID_LS | FILTER_ID_MA | FILTER_ID_NT | FILTER_ID_TE,
|
||||
"SHADING", ICON_MATERIAL_DATA, "Shading",
|
||||
"Show/hide materials, nodetrees, textures and Freestyle's linestyles"},
|
||||
|
141
source/blender/makesrna/intern/rna_volume.c
Normal file
141
source/blender/makesrna/intern/rna_volume.c
Normal file
@@ -0,0 +1,141 @@
|
||||
/*
|
||||
* ***** 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): Jörg Müller.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
/** \file blender/makesrna/intern/rna_volume.c
|
||||
* \ingroup RNA
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "RNA_define.h"
|
||||
#include "RNA_enum_types.h"
|
||||
|
||||
#include "rna_internal.h"
|
||||
|
||||
#include "DNA_volume_types.h"
|
||||
|
||||
#include "BLI_math_base.h"
|
||||
|
||||
#ifdef RNA_RUNTIME
|
||||
|
||||
#include "BKE_volume.h"
|
||||
|
||||
static void rna_VolumeGrid_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
|
||||
{
|
||||
}
|
||||
|
||||
static void rna_Volume_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
|
||||
{
|
||||
Volume *volume = ptr->data;
|
||||
BKE_volume_reload(bmain, volume);
|
||||
}
|
||||
|
||||
static void rna_VolumeGrids_active_grid_index_range(
|
||||
PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
|
||||
{
|
||||
Volume *volume = (Volume *)ptr->data;
|
||||
|
||||
*min = 0;
|
||||
*max = max_ii(0, BLI_listbase_count(&volume->grids) - 1);
|
||||
}
|
||||
|
||||
static int rna_VolumeGrids_active_grid_index_get(PointerRNA *ptr)
|
||||
{
|
||||
Volume *volume = (Volume *)ptr->data;
|
||||
return 0; // TODO
|
||||
}
|
||||
|
||||
static void rna_VolumeGrids_active_grid_index_set(PointerRNA *ptr, int value)
|
||||
{
|
||||
Volume *volume = (Volume *)ptr->data;
|
||||
// TODO
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static void rna_def_volume_grid(BlenderRNA *brna)
|
||||
{
|
||||
StructRNA *srna;
|
||||
PropertyRNA *prop;
|
||||
|
||||
srna = RNA_def_struct(brna, "VolumeGrid", NULL);
|
||||
RNA_def_struct_ui_text(srna, "Volume Grid", "3D volume grid");
|
||||
RNA_def_struct_ui_icon(srna, ICON_VOLUME);
|
||||
|
||||
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
|
||||
RNA_def_property_ui_text(prop, "Name", "Volume grid name");
|
||||
RNA_def_property_update(prop, 0, "rna_VolumeGrid_update");
|
||||
}
|
||||
|
||||
static void rna_def_volume_grids(BlenderRNA *brna, PropertyRNA *cprop)
|
||||
{
|
||||
StructRNA *srna;
|
||||
PropertyRNA *prop;
|
||||
|
||||
RNA_def_property_srna(cprop, "VolumeGrids");
|
||||
srna = RNA_def_struct(brna, "VolumeGrids", NULL);
|
||||
RNA_def_struct_sdna(srna, "Volume");
|
||||
RNA_def_struct_ui_text(srna, "Volume Grids", "3D volume grids");
|
||||
|
||||
prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
|
||||
RNA_def_property_int_funcs(prop, "rna_VolumeGrids_active_grid_index_get",
|
||||
"rna_VolumeGrids_active_grid_index_set",
|
||||
"rna_VolumeGrids_active_grid_index_range");
|
||||
RNA_def_property_ui_text(prop, "Active Grid Index", "Index of active volume grid");
|
||||
}
|
||||
|
||||
static void rna_def_volume(BlenderRNA *brna)
|
||||
{
|
||||
StructRNA *srna;
|
||||
PropertyRNA *prop;
|
||||
|
||||
srna = RNA_def_struct(brna, "Volume", "ID");
|
||||
RNA_def_struct_ui_text(srna, "Volume", "Volume data-block for 3D volume grids");
|
||||
RNA_def_struct_ui_icon(srna, ICON_VOLUME);
|
||||
|
||||
prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
|
||||
RNA_def_property_ui_text(prop, "File Path", "Volume sample file used by this Volume data-block");
|
||||
RNA_def_property_update(prop, 0, "rna_Volume_update");
|
||||
|
||||
prop = RNA_def_property(srna, "packed_file", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_pointer_sdna(prop, NULL, "packedfile");
|
||||
RNA_def_property_ui_text(prop, "Packed File", "");
|
||||
|
||||
prop = RNA_def_property(srna, "grids", PROP_COLLECTION, PROP_NONE);
|
||||
RNA_def_property_struct_type(prop, "VolumeGrid");
|
||||
RNA_def_property_ui_text(prop, "Grids", "3D volume grids");
|
||||
rna_def_volume_grids(brna, prop);
|
||||
|
||||
|
||||
/* common */
|
||||
rna_def_animdata_common(srna);
|
||||
}
|
||||
|
||||
|
||||
void RNA_def_volume(BlenderRNA *brna)
|
||||
{
|
||||
rna_def_volume_grid(brna);
|
||||
rna_def_volume(brna);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user