Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorswann <slumber>2020-01-17 21:14:23 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-01-17 21:14:51 +0300
commite280c0441bd84e73c47dffb66104ed40af9ea592 (patch)
tree912b3ce096ab25e1eb40c404ab94453e8d443463 /source/blender/makesrna/intern/rna_object.c
parentf185a9b97c45ae23f159f00e78ec3593d26e47b3 (diff)
Fix lightprobe creation from python data API
### Description of the problem Until now, it is only possible to correctly add a lightprobe in python via an operator: `bpy.ops.object.lightprobe_add()` ### Description of the proposed solution The idea of this patch is to fix the lack of consistency lightprobe creation without operator. It allow creation of different lightprobe type directly via `bpy.data.lightprobes.new(name, type)` (such as for curves). In order to make it possible I had to: 1. Add a function `BKE_lightprobe_configure` in charge of lightprobe settings configuration (avoid code redundancy) 2. Allow an object to take lightprobe datablock as data during is initialization. ### A short example of this patch usage ``` lp = bpy.data.lightprobes.new('some_name','PLANAR') bpy.data.objects.new('toto', lp) ``` Reviewed By: fclem Differential Revision: https://developer.blender.org/D6396
Diffstat (limited to 'source/blender/makesrna/intern/rna_object.c')
-rw-r--r--source/blender/makesrna/intern/rna_object.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 75594d1b295..a83a36fbd9d 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -25,6 +25,7 @@
#include "DNA_brush_types.h"
#include "DNA_collection_types.h"
#include "DNA_customdata_types.h"
+#include "DNA_lightprobe_types.h"
#include "DNA_material_types.h"
#include "DNA_mesh_types.h"
#include "DNA_object_force_types.h"
@@ -196,6 +197,13 @@ const EnumPropertyItem rna_enum_metaelem_type_items[] = {
{0, NULL, 0, NULL, NULL},
};
+const EnumPropertyItem rna_enum_lightprobes_type_items[] = {
+ {LIGHTPROBE_TYPE_CUBE, "CUBE", ICON_LIGHTPROBE_CUBEMAP, "Cube", ""},
+ {LIGHTPROBE_TYPE_PLANAR, "PLANAR", ICON_LIGHTPROBE_PLANAR, "Planar", ""},
+ {LIGHTPROBE_TYPE_GRID, "GRID", ICON_LIGHTPROBE_GRID, "Grid", ""},
+ {0, NULL, 0, NULL, NULL},
+};
+
/* used for 2 enums */
#define OBTYPE_CU_CURVE \
{ \