uvcalc_lightmap would raise an error on meshes with no faces.

auto-threads wasnt working for baking.
This commit is contained in:
Campbell Barton
2008-05-14 16:40:25 +00:00
parent b65d4f95fc
commit 540c0e0795
4 changed files with 17 additions and 2 deletions

View File

@@ -517,7 +517,7 @@ def main():
if not Draw.PupBlock('Lightmap Pack', [\
'Context...',
('Active Object', PREF_ACT_ONLY, 'If disabled, use all objects for packing the lightmap.'),\
('Active Object', PREF_ACT_ONLY, 'If disabled, include other selected objects for packing the lightmap.'),\
('Selected Faces', PREF_SEL_ONLY, 'Use only selected faces from all selected meshes.'),\
'Image & UVs...',
('Share Tex Space', PREF_PACK_IN_ONE, 'Objects Share texture space, map all objects into 1 uvmap'),\
@@ -538,7 +538,7 @@ def main():
return
meshes = [ ob.getData(mesh=1) ]
else:
meshes = dict([ (me.name, me) for ob in scn.objects.context for me in (ob.getData(mesh=1),) if not me.lib])
meshes = dict([ (me.name, me) for ob in scn.objects.context for me in (ob.getData(mesh=1),) if not me.lib if len(me.faces)])
meshes = meshes.values()
if not meshes:
Draw.PupMenu('Error%t|No mesh objects selected.')

View File

@@ -177,6 +177,9 @@ void RE_DataBase_ApplyWindow(struct Render *re);
/* override the scene setting for amount threads, commandline */
void RE_set_max_threads(int threads);
/* set the render threads based on the commandline and autothreads setting */
void RE_init_threadcount(Render *re);
/* the main processor, assumes all was set OK! */
void RE_TileProcessor(struct Render *re, int firsttile, int threaded);

View File

@@ -5417,6 +5417,9 @@ void RE_Database_Baking(Render *re, Scene *scene, int type, Object *actob)
/* renderdata setup and exceptions */
re->r= scene->r;
RE_init_threadcount(re);
re->flag |= R_GLOB_NOPUNOFLIP;
re->excludeob= actob;
if(type == RE_BAKE_LIGHT)

View File

@@ -2675,3 +2675,12 @@ void RE_set_max_threads(int threads)
printf("Error, threads has to be in range 1-%d\n", BLENDER_MAX_THREADS);
}
}
void RE_init_threadcount(Render *re)
{
if ((re->r.mode & R_FIXED_THREADS)==0 || commandline_threads == 0) { /* Automatic threads */
re->r.threads = BLI_system_thread_count();
} else if(commandline_threads >= 1 && commandline_threads<=BLENDER_MAX_THREADS) {
re->r.threads= commandline_threads;
}
}