From 9a076dd95a01135ea50f9ccc675668db9f2155f4 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 12 Sep 2019 04:34:55 +1000 Subject: DNA: defaults for ID types --- source/blender/makesdna/DNA_brush_defaults.h | 105 +++++++++++++++ source/blender/makesdna/DNA_cachefile_defaults.h | 49 +++++++ source/blender/makesdna/DNA_camera_defaults.h | 67 ++++++++++ source/blender/makesdna/DNA_curve_defaults.h | 59 ++++++++ source/blender/makesdna/DNA_image_defaults.h | 46 +++++++ source/blender/makesdna/DNA_lattice_defaults.h | 44 ++++++ source/blender/makesdna/DNA_light_defaults.h | 76 +++++++++++ source/blender/makesdna/DNA_lightprobe_defaults.h | 51 +++++++ source/blender/makesdna/DNA_linestyle_defaults.h | 61 +++++++++ source/blender/makesdna/DNA_meta_defaults.h | 44 ++++++ source/blender/makesdna/DNA_speaker_defaults.h | 51 +++++++ source/blender/makesdna/DNA_texture_defaults.h | 155 ++++++++++++++++++++++ source/blender/makesdna/DNA_world_defaults.h | 49 +++++++ source/blender/makesdna/intern/CMakeLists.txt | 11 ++ source/blender/makesdna/intern/dna_defaults.c | 115 +++++++++++++++- 15 files changed, 980 insertions(+), 3 deletions(-) create mode 100644 source/blender/makesdna/DNA_brush_defaults.h create mode 100644 source/blender/makesdna/DNA_cachefile_defaults.h create mode 100644 source/blender/makesdna/DNA_camera_defaults.h create mode 100644 source/blender/makesdna/DNA_curve_defaults.h create mode 100644 source/blender/makesdna/DNA_image_defaults.h create mode 100644 source/blender/makesdna/DNA_lattice_defaults.h create mode 100644 source/blender/makesdna/DNA_light_defaults.h create mode 100644 source/blender/makesdna/DNA_lightprobe_defaults.h create mode 100644 source/blender/makesdna/DNA_linestyle_defaults.h create mode 100644 source/blender/makesdna/DNA_meta_defaults.h create mode 100644 source/blender/makesdna/DNA_speaker_defaults.h create mode 100644 source/blender/makesdna/DNA_texture_defaults.h create mode 100644 source/blender/makesdna/DNA_world_defaults.h (limited to 'source/blender/makesdna') diff --git a/source/blender/makesdna/DNA_brush_defaults.h b/source/blender/makesdna/DNA_brush_defaults.h new file mode 100644 index 00000000000..cf4e74dfd41 --- /dev/null +++ b/source/blender/makesdna/DNA_brush_defaults.h @@ -0,0 +1,105 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** \file + * \ingroup DNA + */ + +#ifndef __DNA_BRUSH_DEFAULTS_H__ +#define __DNA_BRUSH_DEFAULTS_H__ + +#include "DNA_texture_defaults.h" + +/* Struct members on own line. */ +/* clang-format off */ + +/* -------------------------------------------------------------------- */ +/** \name Brush Struct + * \{ */ + +#define _DNA_DEFAULT_Brush \ + { \ + .blend = 0, \ + .flag = (BRUSH_ALPHA_PRESSURE | BRUSH_SPACE | BRUSH_SPACE_ATTEN), \ + \ + .ob_mode = OB_MODE_ALL_PAINT, \ + \ + /* BRUSH SCULPT TOOL SETTINGS */ \ + .weight = 1.0f, /* weight of brush 0 - 1.0 */ \ + .size = 35, /* radius of the brush in pixels */ \ + .alpha = 0.5f, /* brush strength/intensity probably variable should be renamed? */ \ + .autosmooth_factor = 0.0f, \ + .topology_rake_factor = 0.0f, \ + .crease_pinch_factor = 0.5f, \ + .normal_radius_factor = 0.5f, \ + .sculpt_plane = SCULPT_DISP_DIR_AREA, \ + /* How far above or below the plane that is found by averaging the faces. */ \ + .plane_offset = 0.0f, \ + .plane_trim = 0.5f, \ + .clone.alpha = 0.5f, \ + .normal_weight = 0.0f, \ + .fill_threshold = 0.2f, \ + \ + /* BRUSH PAINT TOOL SETTINGS */ \ + /* Default rgb color of the brush when painting - white. */ \ + .rgb = {1.0f, 1.0f, 1.0f}, \ + \ + .secondary_rgb = {0, 0, 0}, \ + \ + /* BRUSH STROKE SETTINGS */ \ + /* How far each brush dot should be spaced as a percentage of brush diameter. */ \ + .spacing = 10, \ + \ + .smooth_stroke_radius = 75, \ + .smooth_stroke_factor = 0.9f, \ + \ + /* Time delay between dots of paint or sculpting when doing airbrush mode. */ \ + .rate = 0.1f, \ + \ + .jitter = 0.0f, \ + \ + .texture_sample_bias = 0, /* value to added to texture samples */ \ + .texture_overlay_alpha = 33, \ + .mask_overlay_alpha = 33, \ + .cursor_overlay_alpha = 33, \ + .overlay_flags = 0, \ + \ + /* brush appearance */ \ + \ + /* add mode color is light red */ \ + .add_col = {1.0, 0.39, 0.39}, \ + \ + /* subtract mode color is light blue */ \ + .sub_col = {0.39, 0.39, 1.0}, \ + \ + .stencil_pos = {256, 256}, \ + .stencil_dimension = {256, 256}, \ + \ + /* sculpting defaults to the draw tool for new brushes */ \ + .sculpt_tool = SCULPT_TOOL_DRAW, \ + \ + /* A kernel radius of 1 has almost no effect (T63233). */ \ + .blur_kernel_radius = 2, \ + \ + .mtex = _DNA_DEFAULT_MTex, \ + .mask_mtex = _DNA_DEFAULT_MTex, \ + } + +/** \} */ + +/* clang-format on */ + +#endif /* __DNA_BRUSH_DEFAULTS_H__ */ diff --git a/source/blender/makesdna/DNA_cachefile_defaults.h b/source/blender/makesdna/DNA_cachefile_defaults.h new file mode 100644 index 00000000000..4c4ff53ed90 --- /dev/null +++ b/source/blender/makesdna/DNA_cachefile_defaults.h @@ -0,0 +1,49 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** \file + * \ingroup DNA + */ + +#ifndef __DNA_CACHEFILE_DEFAULTS_H__ +#define __DNA_CACHEFILE_DEFAULTS_H__ + +/* Struct members on own line. */ +/* clang-format off */ + +/* -------------------------------------------------------------------- */ +/** \name CacheFile Struct + * \{ */ + +#define _DNA_DEFAULT_CacheFile \ + { \ + .filepath[0] = '\0', \ + .override_frame = false, \ + .frame = 0.0f, \ + .is_sequence = false, \ + .scale = 1.0f, \ + .object_paths ={NULL, NULL}, \ + \ + .handle = NULL, \ + .handle_filepath[0] = '\0', \ + .handle_readers = NULL, \ + } + +/** \} */ + +/* clang-format on */ + +#endif /* __DNA_CACHEFILE_DEFAULTS_H__ */ diff --git a/source/blender/makesdna/DNA_camera_defaults.h b/source/blender/makesdna/DNA_camera_defaults.h new file mode 100644 index 00000000000..7a28f673ee4 --- /dev/null +++ b/source/blender/makesdna/DNA_camera_defaults.h @@ -0,0 +1,67 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** \file + * \ingroup DNA + */ + +#ifndef __DNA_CAMERA_DEFAULTS_H__ +#define __DNA_CAMERA_DEFAULTS_H__ + +/* Struct members on own line. */ +/* clang-format off */ + +/* -------------------------------------------------------------------- */ +/** \name Camera Struct + * \{ */ + +#define _DNA_DEFAULT_CameraDOFSettings \ + { \ + .aperture_fstop = 2.8f, \ + .aperture_ratio = 1.0f, \ + .focus_distance = 10.0f, \ + } + +#define _DNA_DEFAULT_CameraStereoSettings \ + { \ + .interocular_distance = 0.065f, \ + .convergence_distance = 30.f * 0.065f, \ + .pole_merge_angle_from = DEG2RADF(60.0f), \ + .pole_merge_angle_to = DEG2RADF(75.0f), \ + } + +#define _DNA_DEFAULT_Camera \ + { \ + .lens = 50.0f, \ + .sensor_x = DEFAULT_SENSOR_WIDTH, \ + .sensor_y = DEFAULT_SENSOR_HEIGHT, \ + .clip_start = 0.1f, \ + .clip_end = 1000.0f, \ + .drawsize = 1.0f, \ + .ortho_scale = 6.0, \ + .flag = CAM_SHOWPASSEPARTOUT, \ + .passepartalpha = 0.5f, \ + \ + .dof = _DNA_DEFAULT_CameraDOFSettings, \ + \ + .stereo = _DNA_DEFAULT_CameraStereoSettings, \ + } + +/** \} */ + +/* clang-format on */ + +#endif /* __DNA_CAMERA_DEFAULTS_H__ */ diff --git a/source/blender/makesdna/DNA_curve_defaults.h b/source/blender/makesdna/DNA_curve_defaults.h new file mode 100644 index 00000000000..0fdfd5713e9 --- /dev/null +++ b/source/blender/makesdna/DNA_curve_defaults.h @@ -0,0 +1,59 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** \file + * \ingroup DNA + */ + +#ifndef __DNA_CURVE_DEFAULTS_H__ +#define __DNA_CURVE_DEFAULTS_H__ + +/* Struct members on own line. */ +/* clang-format off */ + +/* -------------------------------------------------------------------- */ +/** \name Curve Struct + * \{ */ + +#define _DNA_DEFAULT_Curve \ + { \ + .size = {1, 1, 1}, \ + .flag = CU_DEFORM_BOUNDS_OFF | CU_PATH_RADIUS, \ + .pathlen = 100, \ + .resolu = 12, \ + .resolv = 12, \ + .width = 1.0, \ + .wordspace = 1.0, \ + .spacing = 1.0f, \ + .linedist = 1.0, \ + .fsize = 1.0, \ + .ulheight = 0.05, \ + .texflag = CU_AUTOSPACE, \ + .smallcaps_scale = 0.75f, \ + /* This one seems to be the best one in most cases, at least for curve deform. */ \ + .twist_mode = CU_TWIST_MINIMUM, \ + .bevfac1 = 0.0f, \ + .bevfac2 = 1.0f, \ + .bevfac1_mapping = CU_BEVFAC_MAP_RESOLU, \ + .bevfac2_mapping = CU_BEVFAC_MAP_RESOLU, \ + .bevresol = 4, \ + } + +/** \} */ + +/* clang-format on */ + +#endif /* __DNA_CURVE_DEFAULTS_H__ */ diff --git a/source/blender/makesdna/DNA_image_defaults.h b/source/blender/makesdna/DNA_image_defaults.h new file mode 100644 index 00000000000..e115f9e2b16 --- /dev/null +++ b/source/blender/makesdna/DNA_image_defaults.h @@ -0,0 +1,46 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** \file + * \ingroup DNA + */ + +#ifndef __DNA_IMAGE_DEFAULTS_H__ +#define __DNA_IMAGE_DEFAULTS_H__ + +/* Struct members on own line. */ +/* clang-format off */ + +/* -------------------------------------------------------------------- */ +/** \name Image Struct + * \{ */ + +#define _DNA_DEFAULT_Image \ + { \ + .aspx = 1.0, \ + .aspy = 1.0, \ + .gen_x = 1024, \ + .gen_y = 1024, \ + .gen_type = IMA_GENTYPE_GRID, \ + \ + .gpuframenr = INT_MAX, \ + } + +/** \} */ + +/* clang-format on */ + +#endif /* __DNA_IMAGE_DEFAULTS_H__ */ diff --git a/source/blender/makesdna/DNA_lattice_defaults.h b/source/blender/makesdna/DNA_lattice_defaults.h new file mode 100644 index 00000000000..052aaba51d7 --- /dev/null +++ b/source/blender/makesdna/DNA_lattice_defaults.h @@ -0,0 +1,44 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** \file + * \ingroup DNA + */ + +#ifndef __DNA_LATTICE_DEFAULTS_H__ +#define __DNA_LATTICE_DEFAULTS_H__ + +/* Struct members on own line. */ +/* clang-format off */ + +/* -------------------------------------------------------------------- */ +/** \name Lattice Struct + * \{ */ + +#define _DNA_DEFAULT_Lattice \ + { \ + .flag = LT_GRID, \ + .typeu = KEY_BSPLINE, \ + .typev = KEY_BSPLINE, \ + .typew = KEY_BSPLINE, \ + .actbp = LT_ACTBP_NONE, \ + } + +/** \} */ + +/* clang-format on */ + +#endif /* __DNA_LATTICE_DEFAULTS_H__ */ diff --git a/source/blender/makesdna/DNA_light_defaults.h b/source/blender/makesdna/DNA_light_defaults.h new file mode 100644 index 00000000000..dceaaf7c278 --- /dev/null +++ b/source/blender/makesdna/DNA_light_defaults.h @@ -0,0 +1,76 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** \file + * \ingroup DNA + */ + +#ifndef __DNA_LIGHT_DEFAULTS_H__ +#define __DNA_LIGHT_DEFAULTS_H__ + +/* Struct members on own line. */ +/* clang-format off */ + +/* -------------------------------------------------------------------- */ +/** \name Light Struct + * \{ */ + +#define _DNA_DEFAULT_Light \ + { \ + .r = 1.0f, \ + .g = 1.0f, \ + .b = 1.0f, \ + .k = 1.0f, \ + .energy = 10.0f, \ + .dist = 25.0f, \ + .spotsize = DEG2RADF(45.0f), \ + .spotblend = 0.15f, \ + .att2 = 1.0f, \ + .mode = LA_SHADOW, \ + .bufsize = 512, \ + .clipsta = 0.05f, \ + .clipend = 40.0f, \ + .bleedexp = 2.5f, \ + .samp = 3, \ + .bias = 1.0f, \ + .soft = 3.0f, \ + .area_size = 0.25f, \ + .area_sizey = 0.25f, \ + .area_sizez = 0.25f, \ + .buffers = 1, \ + .preview = NULL, \ + .falloff_type = LA_FALLOFF_INVSQUARE, \ + .coeff_const = 1.0f, \ + .coeff_lin = 0.0f, \ + .coeff_quad = 0.0f, \ + .cascade_max_dist = 200.0f, \ + .cascade_count = 4, \ + .cascade_exponent = 0.8f, \ + .cascade_fade = 0.1f, \ + .contact_dist = 0.2f, \ + .contact_bias = 0.03f, \ + .contact_spread = 0.2f, \ + .contact_thickness = 0.2f, \ + .spec_fac = 1.0f, \ + .att_dist = 40.0f, \ + .sun_angle = DEG2RADF(0.526f), \ + } + +/** \} */ + +/* clang-format on */ + +#endif /* __DNA_LIGHT_DEFAULTS_H__ */ diff --git a/source/blender/makesdna/DNA_lightprobe_defaults.h b/source/blender/makesdna/DNA_lightprobe_defaults.h new file mode 100644 index 00000000000..7c7732d17e4 --- /dev/null +++ b/source/blender/makesdna/DNA_lightprobe_defaults.h @@ -0,0 +1,51 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** \file + * \ingroup DNA + */ + +#ifndef __DNA_LIGHTPROBE_DEFAULTS_H__ +#define __DNA_LIGHTPROBE_DEFAULTS_H__ + +/* Struct members on own line. */ +/* clang-format off */ + +/* -------------------------------------------------------------------- */ +/** \name LightProbe Struct + * \{ */ + +#define _DNA_DEFAULT_LightProbe \ + { \ + .grid_resolution_x = 4, \ + .grid_resolution_y = 4, \ + .grid_resolution_z = 4, \ + .distinf = 2.5f, \ + .distpar = 2.5f, \ + .falloff = 0.2f, \ + .clipsta = 0.8f, \ + .clipend = 40.0f, \ + .vis_bias = 1.0f, \ + .vis_blur = 0.2f, \ + .intensity = 1.0f, \ + .flag = LIGHTPROBE_FLAG_SHOW_INFLUENCE, \ + } + +/** \} */ + +/* clang-format on */ + +#endif /* __DNA_LIGHTPROBE_DEFAULTS_H__ */ diff --git a/source/blender/makesdna/DNA_linestyle_defaults.h b/source/blender/makesdna/DNA_linestyle_defaults.h new file mode 100644 index 00000000000..2f9203050d1 --- /dev/null +++ b/source/blender/makesdna/DNA_linestyle_defaults.h @@ -0,0 +1,61 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** \file + * \ingroup DNA + */ + +#ifndef __DNA_LINESTYLE_DEFAULTS_H__ +#define __DNA_LINESTYLE_DEFAULTS_H__ + +/* Struct members on own line. */ +/* clang-format off */ + +/* -------------------------------------------------------------------- */ +/** \name FreestyleLineStyle Struct + * \{ */ + +#define _DNA_DEFAULT_FreestyleLineStyle \ + { \ + .panel = LS_PANEL_STROKES, \ + .r = 0, \ + .g = 0, \ + .b = 0, \ + .alpha = 1.0f, \ + .thickness = 3.0f, \ + .thickness_position = LS_THICKNESS_CENTER, \ + .thickness_ratio = 0.5f, \ + .flag = LS_SAME_OBJECT | LS_NO_SORTING | LS_TEXTURE, \ + .chaining = LS_CHAINING_PLAIN, \ + .rounds = 3, \ + .min_angle = DEG2RADF(0.0f), \ + .max_angle = DEG2RADF(0.0f), \ + .min_length = 0.0f, \ + .max_length = 10000.0f, \ + .split_length = 100, \ + .chain_count = 10, \ + .sort_key = LS_SORT_KEY_DISTANCE_FROM_CAMERA, \ + .integration_type = LS_INTEGRATION_MEAN, \ + .texstep = 1.0f, \ + .pr_texture = TEX_PR_TEXTURE, \ + .caps = LS_CAPS_BUTT, \ + } + +/** \} */ + +/* clang-format on */ + +#endif /* __DNA_LINESTYLE_DEFAULTS_H__ */ diff --git a/source/blender/makesdna/DNA_meta_defaults.h b/source/blender/makesdna/DNA_meta_defaults.h new file mode 100644 index 00000000000..723f178ed58 --- /dev/null +++ b/source/blender/makesdna/DNA_meta_defaults.h @@ -0,0 +1,44 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** \file + * \ingroup DNA + */ + +#ifndef __DNA_META_DEFAULTS_H__ +#define __DNA_META_DEFAULTS_H__ + +/* Struct members on own line. */ +/* clang-format off */ + +/* -------------------------------------------------------------------- */ +/** \name MetaBall Struct + * \{ */ + +#define _DNA_DEFAULT_MetaBall \ + { \ + .size = {1, 1, 1}, \ + .texflag = MB_AUTOSPACE, \ + .wiresize = 0.4f, \ + .rendersize = 0.2f, \ + .thresh = 0.6f, \ + } + +/** \} */ + +/* clang-format on */ + +#endif /* __DNA_META_DEFAULTS_H__ */ diff --git a/source/blender/makesdna/DNA_speaker_defaults.h b/source/blender/makesdna/DNA_speaker_defaults.h new file mode 100644 index 00000000000..d252a447701 --- /dev/null +++ b/source/blender/makesdna/DNA_speaker_defaults.h @@ -0,0 +1,51 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** \file + * \ingroup DNA + */ + +#ifndef __DNA_SPEAKER_DEFAULTS_H__ +#define __DNA_SPEAKER_DEFAULTS_H__ + +/* Struct members on own line. */ +/* clang-format off */ + +/* -------------------------------------------------------------------- */ +/** \name Speaker Struct + * \{ */ + +#define _DNA_DEFAULT_Speaker \ + { \ + .attenuation = 1.0f, \ + .cone_angle_inner = 360.0f, \ + .cone_angle_outer = 360.0f, \ + .cone_volume_outer = 1.0f, \ + .distance_max = FLT_MAX, \ + .distance_reference = 1.0f, \ + .flag = 0, \ + .pitch = 1.0f, \ + .sound = NULL, \ + .volume = 1.0f, \ + .volume_max = 1.0f, \ + .volume_min = 0.0f, \ + } + +/** \} */ + +/* clang-format on */ + +#endif /* __DNA_SPEAKER_DEFAULTS_H__ */ diff --git a/source/blender/makesdna/DNA_texture_defaults.h b/source/blender/makesdna/DNA_texture_defaults.h new file mode 100644 index 00000000000..d5097c5ea21 --- /dev/null +++ b/source/blender/makesdna/DNA_texture_defaults.h @@ -0,0 +1,155 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** \file + * \ingroup DNA + */ + +#ifndef __DNA_TEXTURE_DEFAULTS_H__ +#define __DNA_TEXTURE_DEFAULTS_H__ + +/* Struct members on own line. */ +/* clang-format off */ + +/* -------------------------------------------------------------------- */ +/** \name Texture Struct + * \{ */ + +#define _DNA_DEFAULT_MTex \ + { \ + .texco = TEXCO_UV, \ + .mapto = MAP_COL, \ + .object = NULL, \ + .projx = PROJ_X, \ + .projy = PROJ_Y, \ + .projz = PROJ_Z, \ + .mapping = MTEX_FLAT, \ + .ofs[0] = 0.0, \ + .ofs[1] = 0.0, \ + .ofs[2] = 0.0, \ + .size[0] = 1.0, \ + .size[1] = 1.0, \ + .size[2] = 1.0, \ + .tex = NULL, \ + .colormodel = 0, \ + .r = 1.0, \ + .g = 0.0, \ + .b = 1.0, \ + .k = 1.0, \ + .def_var = 1.0, \ + .blendtype = MTEX_BLEND, \ + .colfac = 1.0, \ + .norfac = 1.0, \ + .varfac = 1.0, \ + .dispfac = 0.2, \ + .colspecfac = 1.0f, \ + .mirrfac = 1.0f, \ + .alphafac = 1.0f, \ + .difffac = 1.0f, \ + .specfac = 1.0f, \ + .emitfac = 1.0f, \ + .hardfac = 1.0f, \ + .raymirrfac = 1.0f, \ + .translfac = 1.0f, \ + .ambfac = 1.0f, \ + .colemitfac = 1.0f, \ + .colreflfac = 1.0f, \ + .coltransfac = 1.0f, \ + .densfac = 1.0f, \ + .scatterfac = 1.0f, \ + .reflfac = 1.0f, \ + .shadowfac = 1.0f, \ + .zenupfac = 1.0f, \ + .zendownfac = 1.0f, \ + .blendfac = 1.0f, \ + .timefac = 1.0f, \ + .lengthfac = 1.0f, \ + .clumpfac = 1.0f, \ + .kinkfac = 1.0f, \ + .kinkampfac = 1.0f, \ + .roughfac = 1.0f, \ + .twistfac = 1.0f, \ + .padensfac = 1.0f, \ + .lifefac = 1.0f, \ + .sizefac = 1.0f, \ + .ivelfac = 1.0f, \ + .dampfac = 1.0f, \ + .gravityfac = 1.0f, \ + .fieldfac = 1.0f, \ + .normapspace = MTEX_NSPACE_TANGENT, \ + .brush_map_mode = MTEX_MAP_MODE_TILED, \ + .random_angle = 2.0f * (float)M_PI, \ + .brush_angle_mode = 0, \ + } \ + +#define _DNA_DEFAULT_Tex \ + { \ + .type = TEX_IMAGE, \ + .ima = NULL, \ + .stype = 0, \ + .flag = TEX_CHECKER_ODD, \ + .imaflag = TEX_INTERPOL | TEX_MIPMAP | TEX_USEALPHA, \ + .extend = TEX_REPEAT, \ + .cropxmin = 0.0, \ + .cropymin = 0.0, \ + .cropxmax = 1.0, \ + .cropymax = 1.0, \ + .texfilter = TXF_EWA, \ + .afmax = 8, \ + .xrepeat = 1, \ + .yrepeat = 1, \ + .sfra = 1, \ + .frames = 0, \ + .offset = 0, \ + .noisesize = 0.25, \ + .noisedepth = 2, \ + .turbul = 5.0, \ + .nabla = 0.025, /* also in do_versions. */ \ + .bright = 1.0, \ + .contrast = 1.0, \ + .saturation = 1.0, \ + .filtersize = 1.0, \ + .rfac = 1.0, \ + .gfac = 1.0, \ + .bfac = 1.0, \ + /* newnoise: init. */ \ + .noisebasis = 0, \ + .noisebasis2 = 0, \ + /* musgrave */ \ + .mg_H = 1.0, \ + .mg_lacunarity = 2.0, \ + .mg_octaves = 2.0, \ + .mg_offset = 1.0, \ + .mg_gain = 1.0, \ + .ns_outscale = 1.0, \ + /* distnoise */ \ + .dist_amount = 1.0, \ + /* voronoi */ \ + .vn_w1 = 1.0, \ + .vn_w2 = 0.0, \ + .vn_w3 = 0.0, \ + .vn_w4 = 0.0, \ + .vn_mexp = 2.5, \ + .vn_distm = 0, \ + .vn_coltype = 0, \ + .preview = NULL, \ + } + +/** \} */ + +/* clang-format on */ + +#endif /* __DNA_TEXTURE_DEFAULTS_H__ */ diff --git a/source/blender/makesdna/DNA_world_defaults.h b/source/blender/makesdna/DNA_world_defaults.h new file mode 100644 index 00000000000..c4d934381b4 --- /dev/null +++ b/source/blender/makesdna/DNA_world_defaults.h @@ -0,0 +1,49 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** \file + * \ingroup DNA + */ + +#ifndef __DNA_WORLD_DEFAULTS_H__ +#define __DNA_WORLD_DEFAULTS_H__ + +/* Struct members on own line. */ +/* clang-format off */ + +/* -------------------------------------------------------------------- */ +/** \name World Struct + * \{ */ + +#define _DNA_DEFAULT_World \ + { \ + .horr = 0.05f, \ + .horg = 0.05f, \ + .horb = 0.05f, \ + \ + .aodist = 10.0f, \ + .aoenergy = 1.0f, \ + \ + .preview = NULL, \ + .miststa = 5.0f, \ + .mistdist = 25.0f, \ + } + +/** \} */ + +/* clang-format on */ + +#endif /* __DNA_WORLD_DEFAULTS_H__ */ diff --git a/source/blender/makesdna/intern/CMakeLists.txt b/source/blender/makesdna/intern/CMakeLists.txt index 342e466c3f7..bca27442e65 100644 --- a/source/blender/makesdna/intern/CMakeLists.txt +++ b/source/blender/makesdna/intern/CMakeLists.txt @@ -128,10 +128,21 @@ set(SRC ../../blenlib/intern/hash_mm2a.c ../../blenlib/intern/listbase.c + ../DNA_brush_defaults.h + ../DNA_cachefile_defaults.h + ../DNA_camera_defaults.h + ../DNA_curve_defaults.h + ../DNA_image_defaults.h + ../DNA_lattice_defaults.h + ../DNA_light_defaults.h + ../DNA_lightprobe_defaults.h + ../DNA_linestyle_defaults.h ../DNA_material_defaults.h ../DNA_mesh_defaults.h + ../DNA_meta_defaults.h ../DNA_object_defaults.h ../DNA_scene_defaults.h + ../DNA_texture_defaults.h ../DNA_vec_defaults.h ../DNA_view3d_defaults.h ) diff --git a/source/blender/makesdna/intern/dna_defaults.c b/source/blender/makesdna/intern/dna_defaults.c index 4662f3a0b01..7aecbb1789e 100644 --- a/source/blender/makesdna/intern/dna_defaults.c +++ b/source/blender/makesdna/intern/dna_defaults.c @@ -54,33 +54,100 @@ #include "DNA_defaults.h" +#include "DNA_brush_types.h" +#include "DNA_cachefile_types.h" +#include "DNA_camera_types.h" #include "DNA_curve_types.h" +#include "DNA_image_types.h" +#include "DNA_key_types.h" +#include "DNA_lattice_types.h" +#include "DNA_light_types.h" +#include "DNA_lightprobe_types.h" +#include "DNA_linestyle_types.h" #include "DNA_material_types.h" #include "DNA_mesh_types.h" +#include "DNA_meta_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" +#include "DNA_speaker_types.h" +#include "DNA_texture_types.h" +#include "DNA_world_types.h" +#include "DNA_brush_defaults.h" +#include "DNA_cachefile_defaults.h" +#include "DNA_camera_defaults.h" +#include "DNA_curve_defaults.h" +#include "DNA_image_defaults.h" +#include "DNA_lattice_defaults.h" +#include "DNA_light_defaults.h" +#include "DNA_lightprobe_defaults.h" +#include "DNA_linestyle_defaults.h" #include "DNA_material_defaults.h" #include "DNA_mesh_defaults.h" +#include "DNA_meta_defaults.h" #include "DNA_object_defaults.h" #include "DNA_scene_defaults.h" +#include "DNA_speaker_defaults.h" +#include "DNA_texture_defaults.h" +#include "DNA_world_defaults.h" #define SDNA_DEFAULT_DECL_STRUCT(struct_name) \ const struct_name DNA_DEFAULT_##struct_name = _DNA_DEFAULT_##struct_name -/* DNA_scene_material.h */ +/* DNA_brush_defaults.h */ +SDNA_DEFAULT_DECL_STRUCT(Brush); + +/* DNA_cachefile_defaults.h */ +SDNA_DEFAULT_DECL_STRUCT(CacheFile); + +/* DNA_camera_defaults.h */ +SDNA_DEFAULT_DECL_STRUCT(Camera); +SDNA_DEFAULT_DECL_STRUCT(CameraDOFSettings); +SDNA_DEFAULT_DECL_STRUCT(CameraStereoSettings); + +/* DNA_curve_defaults.h */ +SDNA_DEFAULT_DECL_STRUCT(Curve); + +/* DNA_image_defaults.h */ +SDNA_DEFAULT_DECL_STRUCT(Image); + +/* DNA_lattice_defaults.h */ +SDNA_DEFAULT_DECL_STRUCT(Lattice); + +/* DNA_light_defaults.h */ +SDNA_DEFAULT_DECL_STRUCT(Light); + +/* DNA_lightprobe_defaults.h */ +SDNA_DEFAULT_DECL_STRUCT(LightProbe); + +/* DNA_linestyle_defaults.h */ +SDNA_DEFAULT_DECL_STRUCT(FreestyleLineStyle); + +/* DNA_material_defaults.h */ SDNA_DEFAULT_DECL_STRUCT(Material); -/* DNA_scene_mesh.h */ +/* DNA_mesh_defaults.h */ SDNA_DEFAULT_DECL_STRUCT(Mesh); -/* DNA_scene_object.h */ +/* DNA_meta_defaults.h */ +SDNA_DEFAULT_DECL_STRUCT(MetaBall); + +/* DNA_object_defaults.h */ SDNA_DEFAULT_DECL_STRUCT(Object); /* DNA_scene_defaults.h */ SDNA_DEFAULT_DECL_STRUCT(Scene); SDNA_DEFAULT_DECL_STRUCT(ToolSettings); +/* DNA_speaker_defaults.h */ +SDNA_DEFAULT_DECL_STRUCT(Speaker); + +/* DNA_texture_defaults.h */ +SDNA_DEFAULT_DECL_STRUCT(Tex); + +/* DNA_world_defaults.h */ +SDNA_DEFAULT_DECL_STRUCT(World); + #undef SDNA_DEFAULT_DECL_STRUCT /* Reuse existing definitions. */ @@ -108,12 +175,44 @@ extern const bTheme U_theme_default; /** Keep headers sorted. */ const void *DNA_default_table[SDNA_TYPE_MAX] = { + /* DNA_brush_defaults.h */ + SDNA_DEFAULT_DECL(Brush), + + /* DNA_cachefile_defaults.h */ + SDNA_DEFAULT_DECL(CacheFile), + + /* DNA_camera_defaults.h */ + SDNA_DEFAULT_DECL(Camera), + SDNA_DEFAULT_DECL_EX(CameraDOFSettings, Camera.dof), + SDNA_DEFAULT_DECL_EX(CameraStereoSettings, Camera.stereo), + + /* DNA_curve_defaults.h */ + SDNA_DEFAULT_DECL(Curve), + + /* DNA_image_defaults.h */ + SDNA_DEFAULT_DECL(Image), + + /* DNA_lattice_defaults.h */ + SDNA_DEFAULT_DECL(Lattice), + + /* DNA_light_defaults.h */ + SDNA_DEFAULT_DECL(Light), + + /* DNA_lightprobe_defaults.h */ + SDNA_DEFAULT_DECL(LightProbe), + + /* DNA_linestyle_defaults.h */ + SDNA_DEFAULT_DECL(FreestyleLineStyle), + /* DNA_material_defaults.h */ SDNA_DEFAULT_DECL(Material), /* DNA_mesh_defaults.h */ SDNA_DEFAULT_DECL(Mesh), + /* DNA_meta_defaults.h */ + SDNA_DEFAULT_DECL(MetaBall), + /* DNA_object_defaults.h */ SDNA_DEFAULT_DECL(Object), @@ -137,6 +236,13 @@ const void *DNA_default_table[SDNA_TYPE_MAX] = { SDNA_DEFAULT_DECL_EX(GP_Sculpt_Settings, ToolSettings.gp_sculpt), SDNA_DEFAULT_DECL_EX(GP_Sculpt_Guide, ToolSettings.gp_sculpt.guide), + /* DNA_speaker_defaults.h */ + SDNA_DEFAULT_DECL(Speaker), + + /* DNA_texture_defaults.h */ + SDNA_DEFAULT_DECL(Tex), + SDNA_DEFAULT_DECL_EX(MTex, Brush.mtex), + /* DNA_userdef_types.h */ SDNA_DEFAULT_DECL(UserDef), SDNA_DEFAULT_DECL(bTheme), @@ -146,6 +252,9 @@ const void *DNA_default_table[SDNA_TYPE_MAX] = { /* DNA_view3d_defaults.h */ SDNA_DEFAULT_DECL_EX(View3DShading, Scene.display.shading), SDNA_DEFAULT_DECL_EX(View3DCursor, Scene.cursor), + + /* DNA_world_defaults.h */ + SDNA_DEFAULT_DECL(World), }; #undef SDNA_DEFAULT_DECL #undef SDNA_DEFAULT_DECL_EX -- cgit v1.2.3