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:
authorSebastian Parborg <darkdefende@gmail.com>2020-05-18 16:50:36 +0300
committerSebastian Parborg <darkdefende@gmail.com>2020-05-18 16:50:36 +0300
commit27cac4a102b917f9045ed4a4682bd8740852458c (patch)
tree858faf0aa0be0ce814ed19d009da5c92366e12a4 /source/blender/editors/object/object_bake_api.c
parentdcf67fdf7f7239c7c1c4fc867541bf7d5da561e6 (diff)
Fix T62422: Baking ray distance do not work
The previous naming scheme for the "selected to active" baking options lead to confusion and they were not describing what they actually did. To remedy this, I've added a new settings that does what the older setting implied it did. Reviewed By: Brecht, Dalai, Andy Davies Differential Revision: http://developer.blender.org/D7733
Diffstat (limited to 'source/blender/editors/object/object_bake_api.c')
-rw-r--r--source/blender/editors/object/object_bake_api.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/source/blender/editors/object/object_bake_api.c b/source/blender/editors/object/object_bake_api.c
index c31de7f371c..e84dbca2469 100644
--- a/source/blender/editors/object/object_bake_api.c
+++ b/source/blender/editors/object/object_bake_api.c
@@ -96,6 +96,7 @@ typedef struct BakeAPIRender {
bool is_cage;
float cage_extrusion;
+ float max_ray_distance;
int normal_space;
eBakeNormalSwizzle normal_swizzle[3];
@@ -737,6 +738,7 @@ static int bake(Render *re,
const bool is_selected_to_active,
const bool is_cage,
const float cage_extrusion,
+ const float max_ray_distance,
const int normal_space,
const eBakeNormalSwizzle normal_swizzle[],
const char *custom_cage,
@@ -1010,6 +1012,7 @@ static int bake(Render *re,
num_pixels,
ob_cage != NULL,
cage_extrusion,
+ max_ray_distance,
ob_low_eval->obmat,
(ob_cage ? ob_cage->obmat : ob_low_eval->obmat),
me_cage)) {
@@ -1305,6 +1308,7 @@ static void bake_init_api_data(wmOperator *op, bContext *C, BakeAPIRender *bkr)
bkr->is_selected_to_active = RNA_boolean_get(op->ptr, "use_selected_to_active");
bkr->is_cage = RNA_boolean_get(op->ptr, "use_cage");
bkr->cage_extrusion = RNA_float_get(op->ptr, "cage_extrusion");
+ bkr->max_ray_distance = RNA_float_get(op->ptr, "max_ray_distance");
bkr->normal_space = RNA_enum_get(op->ptr, "normal_space");
bkr->normal_swizzle[0] = RNA_enum_get(op->ptr, "normal_r");
@@ -1394,6 +1398,7 @@ static int bake_exec(bContext *C, wmOperator *op)
true,
bkr.is_cage,
bkr.cage_extrusion,
+ bkr.max_ray_distance,
bkr.normal_space,
bkr.normal_swizzle,
bkr.custom_cage,
@@ -1426,6 +1431,7 @@ static int bake_exec(bContext *C, wmOperator *op)
false,
bkr.is_cage,
bkr.cage_extrusion,
+ bkr.max_ray_distance,
bkr.normal_space,
bkr.normal_swizzle,
bkr.custom_cage,
@@ -1495,6 +1501,7 @@ static void bake_startjob(void *bkv, short *UNUSED(stop), short *do_update, floa
true,
bkr->is_cage,
bkr->cage_extrusion,
+ bkr->max_ray_distance,
bkr->normal_space,
bkr->normal_swizzle,
bkr->custom_cage,
@@ -1527,6 +1534,7 @@ static void bake_startjob(void *bkv, short *UNUSED(stop), short *do_update, floa
false,
bkr->is_cage,
bkr->cage_extrusion,
+ bkr->max_ray_distance,
bkr->normal_space,
bkr->normal_swizzle,
bkr->custom_cage,
@@ -1586,6 +1594,11 @@ static void bake_set_props(wmOperator *op, Scene *scene)
RNA_property_boolean_set(op->ptr, prop, (bake->flag & R_BAKE_TO_ACTIVE) != 0);
}
+ prop = RNA_struct_find_property(op->ptr, "max_ray_distance");
+ if (!RNA_property_is_set(op->ptr, prop)) {
+ RNA_property_float_set(op->ptr, prop, bake->max_ray_distance);
+ }
+
prop = RNA_struct_find_property(op->ptr, "cage_extrusion");
if (!RNA_property_is_set(op->ptr, prop)) {
RNA_property_float_set(op->ptr, prop, bake->cage_extrusion);
@@ -1766,12 +1779,23 @@ void OBJECT_OT_bake(wmOperatorType *ot)
"Selected to Active",
"Bake shading on the surface of selected objects to the active object");
RNA_def_float(ot->srna,
+ "max_ray_distance",
+ 0.0f,
+ 0.0f,
+ FLT_MAX,
+ "Max Ray Distance",
+ "The maximum ray distance for matching points between the active and selected "
+ "objects. If zero, there is no limit",
+ 0.0f,
+ 1.0f);
+ RNA_def_float(ot->srna,
"cage_extrusion",
0.0f,
0.0f,
FLT_MAX,
"Cage Extrusion",
- "Distance to use for the inward ray cast when using selected to active",
+ "Inflate the active object by the specified distance for baking. This helps "
+ "matching to points nearer to the outside of the selected object meshes",
0.0f,
1.0f);
RNA_def_string(ot->srna,