From e280c0441bd84e73c47dffb66104ed40af9ea592 Mon Sep 17 00:00:00 2001 From: swann Date: Fri, 17 Jan 2020 19:14:23 +0100 Subject: 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 --- source/blender/blenkernel/intern/object.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source/blender/blenkernel/intern/object.c') diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 1378e862034..7f318ab634b 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -804,6 +804,8 @@ static const char *get_obdata_defname(int type) return DATA_("Empty"); case OB_GPENCIL: return DATA_("GPencil"); + case OB_LIGHTPROBE: + return DATA_("LightProbe"); default: CLOG_ERROR(&LOG, "Internal error, bad type: %d", type); return DATA_("Empty"); -- cgit v1.2.3