Fix selected to active Cycles Baking
Since we started using looptris we no longer need a triangulation modifier in the highpoly object. In fact having was causing a bug where baking would be utterly broken. This fix normal baking. Combined pass still needs a fix to hide the objects during baking.
This commit is contained in:
@@ -856,7 +856,6 @@ static int bake(
|
|||||||
|
|
||||||
/* populate highpoly array */
|
/* populate highpoly array */
|
||||||
for (link = selected_objects->first; link; link = link->next) {
|
for (link = selected_objects->first; link; link = link->next) {
|
||||||
TriangulateModifierData *tmd;
|
|
||||||
Object *ob_iter = link->ptr.data;
|
Object *ob_iter = link->ptr.data;
|
||||||
|
|
||||||
if (ob_iter == ob_low)
|
if (ob_iter == ob_low)
|
||||||
@@ -866,14 +865,6 @@ static int bake(
|
|||||||
highpoly[i].ob = ob_iter;
|
highpoly[i].ob = ob_iter;
|
||||||
highpoly[i].restrict_flag = ob_iter->restrictflag;
|
highpoly[i].restrict_flag = ob_iter->restrictflag;
|
||||||
|
|
||||||
/* triangulating so BVH returns the primitive_id that will be used for rendering */
|
|
||||||
highpoly[i].tri_mod = ED_object_modifier_add(
|
|
||||||
reports, bmain, scene, highpoly[i].ob,
|
|
||||||
"TmpTriangulate", eModifierType_Triangulate);
|
|
||||||
tmd = (TriangulateModifierData *)highpoly[i].tri_mod;
|
|
||||||
tmd->quad_method = MOD_TRIANGULATE_QUAD_FIXED;
|
|
||||||
tmd->ngon_method = MOD_TRIANGULATE_NGON_EARCLIP;
|
|
||||||
|
|
||||||
highpoly[i].me = bake_mesh_new_from_object(depsgraph, bmain, scene, highpoly[i].ob);
|
highpoly[i].me = bake_mesh_new_from_object(depsgraph, bmain, scene, highpoly[i].ob);
|
||||||
highpoly[i].ob->restrictflag &= ~OB_RESTRICT_RENDER;
|
highpoly[i].ob->restrictflag &= ~OB_RESTRICT_RENDER;
|
||||||
|
|
||||||
@@ -1091,9 +1082,6 @@ cleanup:
|
|||||||
for (i = 0; i < tot_highpoly; i++) {
|
for (i = 0; i < tot_highpoly; i++) {
|
||||||
highpoly[i].ob->restrictflag = highpoly[i].restrict_flag;
|
highpoly[i].ob->restrictflag = highpoly[i].restrict_flag;
|
||||||
|
|
||||||
if (highpoly[i].tri_mod)
|
|
||||||
ED_object_modifier_remove(reports, bmain, highpoly[i].ob, highpoly[i].tri_mod);
|
|
||||||
|
|
||||||
if (highpoly[i].me)
|
if (highpoly[i].me)
|
||||||
BKE_libblock_free(bmain, highpoly[i].me);
|
BKE_libblock_free(bmain, highpoly[i].me);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,7 +59,6 @@ typedef struct BakePixel {
|
|||||||
|
|
||||||
typedef struct BakeHighPolyData {
|
typedef struct BakeHighPolyData {
|
||||||
struct Object *ob;
|
struct Object *ob;
|
||||||
struct ModifierData *tri_mod;
|
|
||||||
struct Mesh *me;
|
struct Mesh *me;
|
||||||
char restrict_flag;
|
char restrict_flag;
|
||||||
bool is_flip_object;
|
bool is_flip_object;
|
||||||
|
|||||||
Reference in New Issue
Block a user