Blender Git Loki
Git Commits -> Revision 97641a0
Revision 97641a0 by Dalai Felinto (master) May 3, 2014, 00:19 (GMT) |
Bake API - bpy.ops.object.bake() New operator that can calls a bake function to the current render engine when available. This commit provides no feature for the users, but allows external engines to be accessed by the operator and be integrated with the baking api. The API itself is simple. Blender sends a populated array of BakePixels to the renderer, and gets back an array of floats with the result. The Blender Internal (and multires) system is still running independent, but we eventually will pipe it through the API as well. Cycles baking will come next as a separated commit Python Operator: ---------------- The operator can be called with some arguments, or a user interface can be created for it. In that case the arguments can be ommited and the interface can expose the settings from bpy.context.scene.render.bake bpy.ops.object.bake(type='COMBINED', filepath="", width=512, height=512, margin=16, use_selected_to_active=False, cage_extrusion=0, cage="", normal_space='TANGENT', normal_r='POS_X', normal_g='POS_Y', normal_b='POS_Z', save_mode='INTERNAL', use_clear=False, use_split_materials=False, use_automatic_name=False) Note: external save mode is currently disabled. Supported Features: ------------------ * Margin - Baked result is extended this many pixels beyond the border of each UV "island," to soften seams in the texture. * Selected to Active - bake shading on the surface of selected object to the active object. The rays are cast from the lowpoly object inwards towards the highpoly object. If the highpoly object is not entirely involved by the lowpoly object, you can tweak the rays start point with Cage Extrusion. For even more control of the cage you can use a Cage object. * Cage Extrusion - distance to use for the inward ray cast when using selected to active * Custom Cage - object to use as cage (instead of the lowpoly object). * Normal swizzle - change the axis that gets mapped to RGB * Normal space - save as tangent or object normal spaces Supported Passes: ----------------- Any pass that is supported by Blender renderlayer system. Though it's up to the external engine to provide a valid enum with its supported passes. Normal passes get a special treatment since we post-process them to converted and "swizzled" Development Notes for External Engines: --------------------------------------- (read them in bake_api.c) * For a complete implementation example look at the Cycles Bake commit (next). Review: D421 Reviewed by: Campbell Barton, Brecht van Lommel, Sergey Sharybin, Thomas Dinge Normal map pipeline "consulting" by Andy Davies (metalliandy) Original design by Brecht van Lommel. The entire commit history can be found on the branch: bake-cycles |
Commit Details:
Full Hash: 97641a0ec946005d9a042f075697109c6590a28d
Parent Commit: 3312b20
Lines Changed: +2743, -280
3 Added Paths:
/source/blender/editors/object/object_bake_api.c (+1082, -0) (View)
/source/blender/render/extern/include/RE_bake.h (+105, -0) (View)
/source/blender/render/intern/source/bake_api.c (+829, -0) (View)
/source/blender/render/extern/include/RE_bake.h (+105, -0) (View)
/source/blender/render/intern/source/bake_api.c (+829, -0) (View)
18 Modified Paths:
/source/blender/blenkernel/BKE_mesh.h (+3, -0) (Diff)
/source/blender/blenkernel/intern/mesh.c (+219, -0) (Diff)
/source/blender/blenkernel/intern/scene.c (+17, -0) (Diff)
/source/blender/blenloader/intern/versioning_270.c (+25, -0) (Diff)
/source/blender/editors/object/CMakeLists.txt (+1, -0) (Diff)
/source/blender/editors/object/object_bake.c (+2, -0) (Diff)
/source/blender/editors/object/object_intern.h (+1, -0) (Diff)
/source/blender/editors/object/object_ops.c (+1, -0) (Diff)
/source/blender/makesdna/DNA_scene_types.h (+74, -31) (Diff)
/source/blender/makesrna/intern/rna_main_api.c (+1, -198) (Diff)
/source/blender/makesrna/intern/rna_render.c (+133, -38) (Diff)
/source/blender/makesrna/intern/rna_scene.c (+152, -10) (Diff)
/source/blender/makesrna/RNA_enum_types.h (+8, -1) (Diff)
/source/blender/render/CMakeLists.txt (+2, -0) (Diff)
/source/blender/render/extern/include/RE_engine.h (+4, -0) (Diff)
/source/blender/render/intern/source/bake.c (+2, -0) (Diff)
/source/blender/render/intern/source/external_engine.c (+81, -2) (Diff)
/source/blender/windowmanager/WM_api.h (+1, -0) (Diff)
/source/blender/blenkernel/intern/mesh.c (+219, -0) (Diff)
/source/blender/blenkernel/intern/scene.c (+17, -0) (Diff)
/source/blender/blenloader/intern/versioning_270.c (+25, -0) (Diff)
/source/blender/editors/object/CMakeLists.txt (+1, -0) (Diff)
/source/blender/editors/object/object_bake.c (+2, -0) (Diff)
/source/blender/editors/object/object_intern.h (+1, -0) (Diff)
/source/blender/editors/object/object_ops.c (+1, -0) (Diff)
/source/blender/makesdna/DNA_scene_types.h (+74, -31) (Diff)
/source/blender/makesrna/intern/rna_main_api.c (+1, -198) (Diff)
/source/blender/makesrna/intern/rna_render.c (+133, -38) (Diff)
/source/blender/makesrna/intern/rna_scene.c (+152, -10) (Diff)
/source/blender/makesrna/RNA_enum_types.h (+8, -1) (Diff)
/source/blender/render/CMakeLists.txt (+2, -0) (Diff)
/source/blender/render/extern/include/RE_engine.h (+4, -0) (Diff)
/source/blender/render/intern/source/bake.c (+2, -0) (Diff)
/source/blender/render/intern/source/external_engine.c (+81, -2) (Diff)
/source/blender/windowmanager/WM_api.h (+1, -0) (Diff)