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:
-rw-r--r--CMakeLists.txt14
-rw-r--r--SConstruct4
-rwxr-xr-xbuild_files/cmake/example_scripts/make_quicky.py119
-rw-r--r--build_files/scons/config/freebsd7-config.py8
-rw-r--r--build_files/scons/config/freebsd8-config.py8
-rw-r--r--build_files/scons/config/freebsd9-config.py8
-rw-r--r--build_files/scons/config/linux2-config.py6
-rw-r--r--build_files/scons/tools/Blender.py34
-rw-r--r--build_files/scons/tools/btools.py30
-rw-r--r--doc/BL-license.txt2
-rw-r--r--doc/bf-members.txt2
-rw-r--r--extern/bullet2/src/BulletCollision/CollisionShapes/btConvexHullShape.cpp7
-rw-r--r--extern/libopenjpeg/CMakeLists.txt2
-rw-r--r--extern/lzma/CMakeLists.txt5
-rw-r--r--extern/lzma/SConscript2
-rw-r--r--extern/lzo/CMakeLists.txt2
-rw-r--r--extern/lzo/SConscript2
-rw-r--r--intern/boolop/CMakeLists.txt2
-rw-r--r--intern/boolop/SConscript4
-rw-r--r--intern/bsp/CMakeLists.txt2
-rw-r--r--intern/bsp/SConscript2
-rw-r--r--intern/container/CMakeLists.txt2
-rw-r--r--intern/container/SConscript2
-rw-r--r--intern/decimation/CMakeLists.txt2
-rw-r--r--intern/decimation/SConscript2
-rw-r--r--intern/elbeem/CMakeLists.txt2
-rw-r--r--intern/elbeem/SConscript2
-rw-r--r--intern/ghost/CMakeLists.txt2
-rw-r--r--intern/ghost/SConscript2
-rw-r--r--intern/ghost/intern/GHOST_WindowManager.cpp2
-rw-r--r--intern/guardedalloc/CMakeLists.txt4
-rw-r--r--intern/guardedalloc/SConscript2
-rw-r--r--intern/iksolver/CMakeLists.txt2
-rw-r--r--intern/iksolver/SConscript2
-rw-r--r--intern/itasc/CMakeLists.txt2
-rw-r--r--intern/itasc/SConscript2
-rw-r--r--intern/memutil/CMakeLists.txt2
-rw-r--r--intern/memutil/SConscript2
-rw-r--r--intern/moto/CMakeLists.txt2
-rw-r--r--intern/moto/SConscript2
-rw-r--r--intern/opennl/CMakeLists.txt2
-rw-r--r--intern/opennl/SConscript4
-rw-r--r--intern/smoke/CMakeLists.txt2
-rw-r--r--intern/smoke/SConscript2
-rw-r--r--intern/string/CMakeLists.txt2
-rw-r--r--intern/string/SConscript2
-rw-r--r--release/scripts/io/export_ply.py327
-rw-r--r--release/scripts/io/import_shape_mdd.py154
-rw-r--r--release/scripts/io/netrender/__init__.py7
-rw-r--r--release/scripts/keyingsets/keyingsets_utils.py2
-rw-r--r--release/scripts/modules/bpy/ops.py4
-rw-r--r--release/scripts/modules/bpy_types.py11
-rw-r--r--release/scripts/modules/rigify/neck_flex.py4
-rw-r--r--release/scripts/modules/rigify/palm_curl.py2
-rw-r--r--release/scripts/modules/rigify/spine_pivot_flex.py4
-rw-r--r--release/scripts/modules/rigify/tongue.py4
-rw-r--r--release/scripts/modules/rigify_utils.py2
-rw-r--r--release/scripts/modules/rna_prop_ui.py11
-rw-r--r--release/scripts/op/add_mesh_torus.py6
-rw-r--r--[-rwxr-xr-x]release/scripts/op/animsys_update.py4
-rw-r--r--release/scripts/op/io_anim_bvh/__init__.py74
-rw-r--r--release/scripts/op/io_anim_bvh/import_bvh.py (renamed from release/scripts/io/import_anim_bvh.py)84
-rw-r--r--release/scripts/op/io_mesh_ply/__init__.py76
-rw-r--r--release/scripts/op/io_mesh_ply/export_ply.py206
-rw-r--r--release/scripts/op/io_scene_3ds/__init__.py86
-rw-r--r--release/scripts/op/io_scene_3ds/export_3ds.py (renamed from release/scripts/io/export_3ds.py)270
-rw-r--r--release/scripts/op/io_scene_3ds/import_3ds.py (renamed from release/scripts/io/import_scene_3ds.py)384
-rw-r--r--release/scripts/op/io_scene_fbx/__init__.py102
-rw-r--r--release/scripts/op/io_scene_fbx/export_fbx.py (renamed from release/scripts/io/export_fbx.py)545
-rw-r--r--release/scripts/op/io_scene_obj/__init__.py144
-rw-r--r--release/scripts/op/io_scene_obj/export_obj.py (renamed from release/scripts/io/export_obj.py)232
-rw-r--r--release/scripts/op/io_scene_obj/import_obj.py (renamed from release/scripts/io/import_scene_obj.py)711
-rw-r--r--release/scripts/op/io_scene_x3d/__init__.py61
-rw-r--r--release/scripts/op/io_scene_x3d/export_x3d.py (renamed from release/scripts/io/export_x3d.py)262
-rw-r--r--release/scripts/op/io_shape_mdd/__init__.py115
-rw-r--r--release/scripts/op/io_shape_mdd/export_mdd.py131
-rw-r--r--release/scripts/op/io_shape_mdd/import_mdd.py105
-rw-r--r--release/scripts/op/nla.py4
-rw-r--r--release/scripts/op/object.py19
-rw-r--r--release/scripts/op/presets.py4
-rw-r--r--release/scripts/op/uv.py4
-rw-r--r--release/scripts/op/uvcalc_follow_active.py12
-rw-r--r--release/scripts/op/uvcalc_smart_project.py6
-rw-r--r--release/scripts/op/wm.py8
-rw-r--r--release/scripts/presets/interaction/blender.py4
-rw-r--r--release/scripts/presets/interaction/maya.py448
-rw-r--r--release/scripts/templates/operator.py2
-rw-r--r--release/scripts/templates/operator_modal.py2
-rw-r--r--release/scripts/templates/operator_modal_draw.py2
-rw-r--r--release/scripts/templates/operator_modal_view3d.py2
-rw-r--r--release/scripts/templates/operator_uv.py6
-rw-r--r--release/scripts/ui/properties_animviz.py4
-rw-r--r--release/scripts/ui/properties_data_armature.py13
-rw-r--r--release/scripts/ui/properties_data_armature_rigify.py4
-rw-r--r--release/scripts/ui/properties_data_bone.py34
-rw-r--r--release/scripts/ui/properties_data_camera.py2
-rw-r--r--release/scripts/ui/properties_data_curve.py2
-rw-r--r--release/scripts/ui/properties_data_lamp.py10
-rw-r--r--release/scripts/ui/properties_data_lattice.py4
-rw-r--r--release/scripts/ui/properties_data_mesh.py20
-rw-r--r--release/scripts/ui/properties_data_metaball.py6
-rw-r--r--release/scripts/ui/properties_data_modifier.py36
-rw-r--r--release/scripts/ui/properties_game.py2
-rw-r--r--release/scripts/ui/properties_material.py22
-rw-r--r--release/scripts/ui/properties_object.py12
-rw-r--r--release/scripts/ui/properties_object_constraint.py8
-rw-r--r--release/scripts/ui/properties_particle.py76
-rw-r--r--release/scripts/ui/properties_physics_cloth.py20
-rw-r--r--release/scripts/ui/properties_physics_common.py4
-rw-r--r--release/scripts/ui/properties_physics_field.py4
-rw-r--r--release/scripts/ui/properties_physics_fluid.py16
-rw-r--r--release/scripts/ui/properties_physics_smoke.py18
-rw-r--r--release/scripts/ui/properties_physics_softbody.py20
-rw-r--r--release/scripts/ui/properties_render.py18
-rw-r--r--release/scripts/ui/properties_scene.py19
-rw-r--r--release/scripts/ui/properties_texture.py18
-rw-r--r--release/scripts/ui/properties_world.py10
-rw-r--r--release/scripts/ui/space_dopesheet.py50
-rw-r--r--release/scripts/ui/space_filebrowser.py7
-rw-r--r--release/scripts/ui/space_graph.py4
-rw-r--r--release/scripts/ui/space_image.py8
-rw-r--r--release/scripts/ui/space_info.py18
-rw-r--r--release/scripts/ui/space_nla.py4
-rw-r--r--release/scripts/ui/space_outliner.py4
-rw-r--r--release/scripts/ui/space_sequencer.py2
-rw-r--r--release/scripts/ui/space_time.py2
-rw-r--r--release/scripts/ui/space_userpref.py26
-rw-r--r--release/scripts/ui/space_userpref_keymap.py112
-rw-r--r--release/scripts/ui/space_view3d.py17
-rw-r--r--release/scripts/ui/space_view3d_toolbar.py22
-rw-r--r--source/blender/blenkernel/BKE_constraint.h1
-rw-r--r--source/blender/blenkernel/BKE_customdata.h2
-rw-r--r--source/blender/blenkernel/BKE_fcurve.h1
-rw-r--r--source/blender/blenkernel/BKE_material.h7
-rw-r--r--source/blender/blenkernel/BKE_mball.h1
-rw-r--r--source/blender/blenkernel/BKE_particle.h3
-rw-r--r--source/blender/blenkernel/BKE_sequencer.h2
-rw-r--r--source/blender/blenkernel/BKE_texture.h1
-rw-r--r--source/blender/blenkernel/intern/anim.c6
-rw-r--r--source/blender/blenkernel/intern/blender.c16
-rw-r--r--source/blender/blenkernel/intern/boids.c1
-rw-r--r--source/blender/blenkernel/intern/constraint.c11
-rw-r--r--source/blender/blenkernel/intern/context.c2
-rw-r--r--source/blender/blenkernel/intern/customdata.c4
-rw-r--r--source/blender/blenkernel/intern/fmodifier.c7
-rw-r--r--source/blender/blenkernel/intern/font.c6
-rw-r--r--source/blender/blenkernel/intern/image.c8
-rw-r--r--source/blender/blenkernel/intern/library.c14
-rw-r--r--source/blender/blenkernel/intern/material.c86
-rw-r--r--source/blender/blenkernel/intern/mball.c49
-rw-r--r--source/blender/blenkernel/intern/object.c2
-rw-r--r--source/blender/blenkernel/intern/packedFile.c2
-rw-r--r--source/blender/blenkernel/intern/particle.c59
-rw-r--r--source/blender/blenkernel/intern/particle_system.c73
-rw-r--r--source/blender/blenkernel/intern/report.c2
-rw-r--r--source/blender/blenkernel/intern/sca.c19
-rw-r--r--source/blender/blenkernel/intern/sequencer.c2
-rw-r--r--source/blender/blenkernel/intern/sound.c2
-rw-r--r--source/blender/blenkernel/intern/texture.c43
-rw-r--r--source/blender/blenlib/BLI_math_color.h6
-rw-r--r--source/blender/blenlib/BLI_math_vector.h6
-rw-r--r--source/blender/blenlib/BLI_rect.h3
-rwxr-xr-xsource/blender/blenlib/BLI_sparsemap.h73
-rw-r--r--source/blender/blenlib/BLI_string.h3
-rw-r--r--source/blender/blenlib/intern/math_color.c34
-rw-r--r--source/blender/blenlib/intern/math_vector.c6
-rw-r--r--source/blender/blenlib/intern/rct.c20
-rw-r--r--source/blender/blenlib/intern/string.c111
-rw-r--r--source/blender/blenloader/BLO_readfile.h13
-rw-r--r--source/blender/blenloader/intern/readblenentry.c9
-rw-r--r--source/blender/blenloader/intern/readfile.c4
-rw-r--r--source/blender/collada/CMakeLists.txt4
-rw-r--r--source/blender/collada/DocumentExporter.cpp18
-rw-r--r--source/blender/collada/SConscript5
-rw-r--r--source/blender/editors/animation/anim_draw.c1
-rw-r--r--source/blender/editors/animation/anim_ops.c2
-rw-r--r--source/blender/editors/animation/fmodifier_ui.c2
-rw-r--r--source/blender/editors/armature/armature_ops.c2
-rw-r--r--source/blender/editors/armature/editarmature.c15
-rw-r--r--source/blender/editors/armature/poselib.c12
-rw-r--r--source/blender/editors/curve/curve_intern.h4
-rw-r--r--source/blender/editors/curve/curve_ops.c4
-rw-r--r--source/blender/editors/curve/editcurve.c40
-rw-r--r--source/blender/editors/gpencil/drawgpencil.c48
-rw-r--r--source/blender/editors/gpencil/gpencil_ops.c3
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c32
-rw-r--r--source/blender/editors/include/ED_gpencil.h2
-rw-r--r--source/blender/editors/include/ED_mesh.h97
-rw-r--r--source/blender/editors/include/ED_view3d.h7
-rw-r--r--source/blender/editors/include/UI_icons.h10
-rw-r--r--source/blender/editors/include/UI_interface.h8
-rw-r--r--source/blender/editors/interface/interface.c10
-rw-r--r--source/blender/editors/interface/interface_handlers.c41
-rw-r--r--source/blender/editors/interface/interface_intern.h2
-rw-r--r--source/blender/editors/interface/interface_templates.c87
-rw-r--r--source/blender/editors/interface/interface_widgets.c14
-rw-r--r--source/blender/editors/interface/resources.c4
-rw-r--r--source/blender/editors/mesh/editbmesh_add.c6
-rw-r--r--source/blender/editors/mesh/loopcut.c2
-rw-r--r--source/blender/editors/mesh/mesh_data.c83
-rw-r--r--source/blender/editors/mesh/mesh_intern.h2
-rw-r--r--source/blender/editors/mesh/mesh_ops.c2
-rw-r--r--source/blender/editors/metaball/mball_edit.c51
-rw-r--r--source/blender/editors/object/object_add.c16
-rw-r--r--source/blender/editors/object/object_modifier.c24
-rw-r--r--source/blender/editors/object/object_relations.c2
-rw-r--r--source/blender/editors/object/object_vgroup.c2
-rw-r--r--source/blender/editors/physics/particle_edit.c7
-rw-r--r--source/blender/editors/render/render_opengl.c16
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c2
-rw-r--r--source/blender/editors/space_buttons/space_buttons.c2
-rw-r--r--source/blender/editors/space_file/Makefile2
-rw-r--r--source/blender/editors/space_file/file_draw.c7
-rw-r--r--source/blender/editors/space_image/image_ops.c6
-rw-r--r--source/blender/editors/space_image/space_image.c2
-rw-r--r--source/blender/editors/space_logic/logic_window.c2
-rw-r--r--source/blender/editors/space_node/drawnode.c20
-rw-r--r--source/blender/editors/space_outliner/outliner.c58
-rw-r--r--source/blender/editors/space_time/space_time.c8
-rw-r--r--source/blender/editors/space_view3d/drawobject.c21
-rw-r--r--source/blender/editors/space_view3d/drawvolume.c2
-rw-r--r--source/blender/editors/space_view3d/space_view3d.c58
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c160
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c53
-rw-r--r--source/blender/editors/space_view3d/view3d_intern.h4
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c6
-rw-r--r--source/blender/editors/transform/SConscript2
-rw-r--r--source/blender/editors/transform/transform.c6
-rw-r--r--source/blender/editors/transform/transform_ops.c6
-rw-r--r--source/blender/editors/util/undo.c2
-rw-r--r--source/blender/gpu/intern/gpu_buffers.c3
-rw-r--r--source/blender/gpu/intern/gpu_draw.c2
-rw-r--r--source/blender/imbuf/intern/cineon/cineon_dpx.c2
-rw-r--r--source/blender/imbuf/intern/scaling.c2
-rw-r--r--source/blender/imbuf/intern/thumbs_blend.c2
-rw-r--r--source/blender/makesdna/DNA_node_types.h1
-rw-r--r--source/blender/makesdna/DNA_object_types.h2
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h2
-rw-r--r--source/blender/makesdna/DNA_view3d_types.h4
-rw-r--r--source/blender/makesdna/intern/SConscript2
-rw-r--r--source/blender/makesdna/intern/makesdna.c2
-rw-r--r--source/blender/makesrna/RNA_access.h2
-rw-r--r--source/blender/makesrna/RNA_define.h1
-rw-r--r--source/blender/makesrna/RNA_types.h8
-rw-r--r--source/blender/makesrna/intern/SConscript4
-rw-r--r--source/blender/makesrna/intern/makesrna.c60
-rw-r--r--source/blender/makesrna/intern/rna_ID.c27
-rw-r--r--source/blender/makesrna/intern/rna_access.c54
-rw-r--r--source/blender/makesrna/intern/rna_action.c14
-rw-r--r--source/blender/makesrna/intern/rna_action_api.c24
-rw-r--r--source/blender/makesrna/intern/rna_animation.c29
-rw-r--r--source/blender/makesrna/intern/rna_armature.c8
-rw-r--r--source/blender/makesrna/intern/rna_cloth.c6
-rw-r--r--source/blender/makesrna/intern/rna_color.c3
-rw-r--r--source/blender/makesrna/intern/rna_constraint.c2
-rw-r--r--source/blender/makesrna/intern/rna_context.c8
-rw-r--r--source/blender/makesrna/intern/rna_curve.c25
-rw-r--r--source/blender/makesrna/intern/rna_define.c13
-rw-r--r--source/blender/makesrna/intern/rna_fcurve.c31
-rw-r--r--source/blender/makesrna/intern/rna_image.c2
-rw-r--r--source/blender/makesrna/intern/rna_internal.h6
-rw-r--r--source/blender/makesrna/intern/rna_lamp.c4
-rw-r--r--source/blender/makesrna/intern/rna_main.c8
-rw-r--r--source/blender/makesrna/intern/rna_main_api.c52
-rw-r--r--source/blender/makesrna/intern/rna_material.c93
-rw-r--r--source/blender/makesrna/intern/rna_material_api.c85
-rw-r--r--source/blender/makesrna/intern/rna_mesh.c186
-rw-r--r--source/blender/makesrna/intern/rna_mesh_api.c33
-rw-r--r--source/blender/makesrna/intern/rna_meta.c91
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c31
-rw-r--r--source/blender/makesrna/intern/rna_object.c163
-rw-r--r--source/blender/makesrna/intern/rna_object_api.c40
-rw-r--r--source/blender/makesrna/intern/rna_object_force.c32
-rw-r--r--source/blender/makesrna/intern/rna_pose.c67
-rw-r--r--source/blender/makesrna/intern/rna_render.c24
-rw-r--r--source/blender/makesrna/intern/rna_rna.c12
-rw-r--r--source/blender/makesrna/intern/rna_scene.c171
-rw-r--r--source/blender/makesrna/intern/rna_scene_api.c46
-rw-r--r--source/blender/makesrna/intern/rna_sequencer.c2
-rw-r--r--source/blender/makesrna/intern/rna_space.c6
-rw-r--r--source/blender/makesrna/intern/rna_ui.c19
-rw-r--r--source/blender/makesrna/intern/rna_ui_api.c12
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c8
-rw-r--r--source/blender/makesrna/intern/rna_wm.c161
-rw-r--r--source/blender/makesrna/intern/rna_wm_api.c73
-rw-r--r--source/blender/makesrna/intern/rna_world.c4
-rw-r--r--source/blender/makesrna/rna_cleanup/rna_properties.txt35
-rwxr-xr-xsource/blender/makesrna/rna_cleanup/rna_update.sh2
-rw-r--r--source/blender/modifiers/SConscript2
-rw-r--r--source/blender/modifiers/intern/MOD_screw.c2
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c15
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_crop.c7
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_displace.c30
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_rotate.c5
-rw-r--r--source/blender/python/SConscript2
-rw-r--r--source/blender/python/doc/epy/Geometry.py2
-rw-r--r--source/blender/python/doc/epy/IDProp.py2
-rw-r--r--source/blender/python/doc/examples/mathutils.Euler.py2
-rw-r--r--source/blender/python/doc/examples/mathutils.Matrix.py2
-rw-r--r--source/blender/python/doc/examples/mathutils.Quaternion.py2
-rw-r--r--source/blender/python/doc/examples/mathutils.py2
-rw-r--r--source/blender/python/doc/sphinx_doc_gen.py18
-rwxr-xr-xsource/blender/python/doc/sphinx_doc_gen.sh13
-rw-r--r--source/blender/python/generic/CMakeLists.txt2
-rw-r--r--source/blender/python/generic/IDProp.c39
-rw-r--r--source/blender/python/generic/bpy_internal_import.c7
-rw-r--r--source/blender/python/generic/mathutils_euler.c2
-rw-r--r--source/blender/python/generic/mathutils_matrix.c1
-rw-r--r--source/blender/python/generic/mathutils_vector.c65
-rw-r--r--source/blender/python/generic/py_capi_utils.c271
-rw-r--r--source/blender/python/generic/py_capi_utils.h41
-rw-r--r--source/blender/python/intern/bpy.h2
-rw-r--r--source/blender/python/intern/bpy_array.c41
-rw-r--r--source/blender/python/intern/bpy_interface.c1
-rw-r--r--source/blender/python/intern/bpy_operator.c41
-rw-r--r--source/blender/python/intern/bpy_props.c20
-rw-r--r--source/blender/python/intern/bpy_rna.c482
-rw-r--r--source/blender/python/intern/bpy_rna.h11
-rw-r--r--source/blender/python/intern/bpy_util.c201
-rw-r--r--source/blender/python/intern/bpy_util.h13
-rw-r--r--source/blender/quicktime/quicktime_import.h2
-rw-r--r--source/blender/render/CMakeLists.txt2
-rw-r--r--source/blender/render/intern/source/imagetexture.c2
-rw-r--r--source/blender/render/intern/source/pipeline.c23
-rw-r--r--source/blender/windowmanager/WM_api.h4
-rw-r--r--source/blender/windowmanager/WM_types.h1
-rw-r--r--source/blender/windowmanager/intern/wm.c4
-rw-r--r--source/blender/windowmanager/intern/wm_cursors.c2
-rw-r--r--source/blender/windowmanager/intern/wm_draw.c2
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c10
-rw-r--r--source/blender/windowmanager/intern/wm_files.c6
-rw-r--r--source/blender/windowmanager/intern/wm_keymap.c6
-rw-r--r--source/blenderplayer/CMakeLists.txt24
-rw-r--r--source/blenderplayer/bad_level_call_stubs/CMakeLists.txt1
-rw-r--r--source/blenderplayer/bad_level_call_stubs/SConscript3
-rw-r--r--source/blenderplayer/bad_level_call_stubs/stubs.c13
-rw-r--r--source/creator/CMakeLists.txt145
-rw-r--r--source/creator/creator.c11
-rw-r--r--source/gameengine/Converter/BL_BlenderDataConversion.cpp10
-rw-r--r--source/gameengine/Physics/Bullet/CcdPhysicsController.cpp16
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp2
-rw-r--r--source/kernel/gen_system/GEN_HashedPtr.cpp2
342 files changed, 6130 insertions, 4804 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index cb131c6e5e1..898254ef6c6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -294,9 +294,9 @@ IF(UNIX AND NOT APPLE)
SET(EXPAT_LIB expat)
ENDIF (WITH_OPENCOLLADA)
+ FIND_PACKAGE(X11 REQUIRED)
- # Could use ${X11_Xinput_LIB} ${X11_X11_LIB} too
- SET(LLIBS "-lXi -lutil -lc -lm -lpthread -lstdc++ -lX11")
+ SET(LLIBS "-lutil -lc -lm -lpthread -lstdc++ ${X11_X11_LIB} ${X11_Xinput_LIB}")
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
# BSD's dont use libdl.so
@@ -415,11 +415,19 @@ IF(WIN32)
SET(CMAKE_CXX_FLAGS "/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /wd4800 /wd4244 /wd4305" CACHE STRING "MSVC MT C++ flags " FORCE)
SET(CMAKE_C_FLAGS "/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /wd4800 /wd4244 /wd4305" CACHE STRING "MSVC MT C++ flags " FORCE)
+ IF(CMAKE_CL_64)
+ SET(CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG /Od /Gm /EHsc /RTC1 /MTd /W3 /nologo /Zi /J" CACHE STRING "MSVC MT flags " FORCE)
+ ELSE(CMAKE_CL_64)
SET(CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG /Od /Gm /EHsc /RTC1 /MTd /W3 /nologo /ZI /J" CACHE STRING "MSVC MT flags " FORCE)
+ ENDIF(CMAKE_CL_64)
SET(CMAKE_CXX_FLAGS_RELEASE "/O2 /Ob2 /DNDEBUG /EHsc /MT /W3 /nologo /J" CACHE STRING "MSVC MT flags " FORCE)
SET(CMAKE_CXX_FLAGS_MINSIZEREL "/O1 /Ob1 /DNDEBUG /EHsc /MT /W3 /nologo /J" CACHE STRING "MSVC MT flags " FORCE)
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/O2 /Ob1 /DNDEBUG /EHsc /MT /W3 /nologo /Zi /J" CACHE STRING "MSVC MT flags " FORCE)
+ IF(CMAKE_CL_64)
+ SET(CMAKE_C_FLAGS_DEBUG "/D_DEBUG /Od /Gm /EHsc /RTC1 /MTd /W3 /nologo /Zi /J" CACHE STRING "MSVC MT flags " FORCE)
+ ELSE(CMAKE_CL_64)
SET(CMAKE_C_FLAGS_DEBUG "/D_DEBUG /Od /Gm /EHsc /RTC1 /MTd /W3 /nologo /ZI /J" CACHE STRING "MSVC MT flags " FORCE)
+ ENDIF(CMAKE_CL_64)
SET(CMAKE_C_FLAGS_RELEASE "/O2 /Ob2 /DNDEBUG /EHsc /MT /W3 /nologo /J" CACHE STRING "MSVC MT flags " FORCE)
SET(CMAKE_C_FLAGS_MINSIZEREL "/O1 /Ob1 /DNDEBUG /EHsc /MT /W3 /nologo /J" CACHE STRING "MSVC MT flags " FORCE)
SET(CMAKE_C_FLAGS_RELWITHDEBINFO "/O2 /Ob1 /DNDEBUG /EHsc /MT /W3 /nologo /Zi /J" CACHE STRING "MSVC MT flags " FORCE)
@@ -873,7 +881,7 @@ ENDIF(WITH_RAYOPTIMIZATION)
IF(WITH_IMAGE_OPENJPEG)
set(OPENJPEG ${CMAKE_SOURCE_DIR}/extern/libopenjpeg)
set(OPENJPEG_INC ${OPENJPEG})
- set(OPENJPEG_LIb extern_libopenjpeg)
+ set(OPENJPEG_LIb extern_openjpeg)
ENDIF(WITH_IMAGE_OPENJPEG)
#-----------------------------------------------------------------------------
diff --git a/SConstruct b/SConstruct
index 28f54252bfb..9a0b0bea26f 100644
--- a/SConstruct
+++ b/SConstruct
@@ -406,12 +406,12 @@ thestatlibs, thelibincs = B.setup_staticlibs(env)
thesyslibs = B.setup_syslibs(env)
if 'blender' in B.targets or not env['WITH_BF_NOBLENDER']:
- env.BlenderProg(B.root_build_dir, "blender", dobj + mainlist + thestatlibs, [], thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blender')
+ env.BlenderProg(B.root_build_dir, "blender", mainlist + thestatlibs + dobj, thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blender')
if env['WITH_BF_PLAYER']:
playerlist = B.create_blender_liblist(env, 'player')
playerlist += B.create_blender_liblist(env, 'intern')
playerlist += B.create_blender_liblist(env, 'extern')
- env.BlenderProg(B.root_build_dir, "blenderplayer", dobj + playerlist, [], thestatlibs + thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blenderplayer')
+ env.BlenderProg(B.root_build_dir, "blenderplayer", playerlist, thestatlibs + dobj + thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blenderplayer')
##### Now define some targets
diff --git a/build_files/cmake/example_scripts/make_quicky.py b/build_files/cmake/example_scripts/make_quicky.py
new file mode 100755
index 00000000000..69f7604c8cc
--- /dev/null
+++ b/build_files/cmake/example_scripts/make_quicky.py
@@ -0,0 +1,119 @@
+#! /usr/bin/env python
+
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+def print_help(targets):
+ print("CMake quicky wrapper, no valid targets given.")
+ print(" * targets can contain a subset of the full target name.")
+ print(" * arguments with a '-' prefix are passed onto make.")
+ print(" * this must run from the cmake build dir")
+ print(" * alias this with a short command for speedy access, in bash:")
+ print(" alias mk='../blender/build_files/cmake/example_scripts/make_quicky.py'")
+ print("")
+ print(" eg: make_quicky.py -j3 extern python")
+ print(" ...will execute")
+ print(" make -j3 extern_binreloc extern_glew bf_python bf_python_ext blender/fast")
+ print("")
+ print("Target List:")
+ for t in targets:
+ print(" %s" % t)
+ print("...exiting")
+
+
+def main():
+ targets = set()
+
+ # collect targets
+ file = open("Makefile", "r")
+ for line in file:
+ line = line.rstrip()
+ if not line or line[0] in ". \t@$#":
+ continue
+
+ line = line.split("#", 1)[0]
+ if ":" not in line:
+ continue
+
+ line = line.split(":", 1)[0]
+
+ if "/" in line: # cmake terget options, dont need these
+ continue
+
+ targets.add(line)
+ file.close()
+
+
+ # remove cmake targets
+ bad = set([
+ "help",
+ "clean",
+ "all",
+ "preinstall",
+ "install",
+ "default_target",
+ "edit_cache",
+ "cmake_force",
+ "rebuild_cache",
+ "depend",
+ "cmake_check_build_system",
+ ])
+
+ targets -= set(bad)
+
+
+ # parse args
+ targets = list(targets)
+ targets.sort()
+
+ import sys
+ if len(sys.argv) == 1:
+ print_help(targets)
+ return
+
+ targets_new = []
+ args = []
+ for arg in sys.argv[1:]:
+ if arg[0] in "/-":
+ args.append(arg)
+ else:
+ found = False
+ for t in targets:
+ if arg in t and t not in targets_new:
+ targets_new.append(t)
+ found = True
+
+ if not found:
+ print("Error '%s' not found in...")
+ for t in targets:
+ print(" %s" % t)
+ print("...aborting.")
+ return
+
+ # execute
+ cmd = "make %s %s blender/fast" % (" ".join(args), " ".join(targets_new))
+ print("cmake building with targets: %s" % " ".join(targets_new))
+ print("executing: %s" % cmd)
+
+ import os
+ os.system(cmd)
+
+if __name__ == "__main__":
+ main()
diff --git a/build_files/scons/config/freebsd7-config.py b/build_files/scons/config/freebsd7-config.py
index 7d66a69a2dc..5678b4bda0a 100644
--- a/build_files/scons/config/freebsd7-config.py
+++ b/build_files/scons/config/freebsd7-config.py
@@ -57,7 +57,6 @@ BF_OPENEXR_LIB = 'Half IlmImf Iex Imath '
BF_OPENEXR_LIB_STATIC = '${BF_OPENEXR}/lib/libHalf.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_OPENEXR}/lib/libIex.a ${BF_OPENEXR}/lib/libImath.a ${BF_OPENEXR}/lib/libIlmThread.a'
# BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
-
WITH_BF_DDS = True
WITH_BF_JPEG = True
@@ -87,7 +86,7 @@ BF_GETTEXT_INC = '${BF_GETTEXT}/include'
BF_GETTEXT_LIB = 'gettextlib'
BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
-WITH_BF_GAMEENGINE = True
+WITH_BF_GAMEENGINE = False
WITH_BF_PLAYER = True
WITH_BF_BULLET = True
@@ -100,7 +99,8 @@ BF_FREETYPE = '/usr/local'
BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
BF_FREETYPE_LIB = 'freetype'
-WITH_BF_QUICKTIME = True # -DWITH_QUICKTIME
+### XXX Find what this actually wants; it doesn't want libquicktime.
+WITH_BF_QUICKTIME = False # -DWITH_QUICKTIME
BF_QUICKTIME = '/usr/local'
BF_QUICKTIME_INC = '${BF_QUICKTIME}/include'
@@ -195,7 +195,7 @@ CXX_WARN = ['-Wno-invalid-offsetof', '-Wno-sign-compare']
##FIX_STUBS_WARNINGS = -Wno-unused
-LLIBS = ['util', 'c', 'm', 'dl', 'pthread', 'stdc++']
+LLIBS = ['util', 'c', 'm', 'pthread', 'stdc++']
##LOPTS = --dynamic
##DYNLDFLAGS = -shared $(LDFLAGS)
diff --git a/build_files/scons/config/freebsd8-config.py b/build_files/scons/config/freebsd8-config.py
index c0df29df335..bc09e87d59f 100644
--- a/build_files/scons/config/freebsd8-config.py
+++ b/build_files/scons/config/freebsd8-config.py
@@ -57,7 +57,6 @@ BF_OPENEXR_LIB = 'Half IlmImf Iex Imath '
BF_OPENEXR_LIB_STATIC = '${BF_OPENEXR}/lib/libHalf.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_OPENEXR}/lib/libIex.a ${BF_OPENEXR}/lib/libImath.a ${BF_OPENEXR}/lib/libIlmThread.a'
# BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
-
WITH_BF_DDS = True
WITH_BF_JPEG = True
@@ -87,7 +86,7 @@ BF_GETTEXT_INC = '${BF_GETTEXT}/include'
BF_GETTEXT_LIB = 'gettextlib'
BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
-WITH_BF_GAMEENGINE = True
+WITH_BF_GAMEENGINE = False
WITH_BF_PLAYER = True
WITH_BF_BULLET = True
@@ -100,7 +99,8 @@ BF_FREETYPE = '/usr/local'
BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
BF_FREETYPE_LIB = 'freetype'
-WITH_BF_QUICKTIME = True # -DWITH_QUICKTIME
+### XXX Find what this actually wants; it doesn't want libquicktime.
+WITH_BF_QUICKTIME = False # -DWITH_QUICKTIME
BF_QUICKTIME = '/usr/local'
BF_QUICKTIME_INC = '${BF_QUICKTIME}/include'
@@ -195,7 +195,7 @@ CXX_WARN = ['-Wno-invalid-offsetof', '-Wno-sign-compare']
##FIX_STUBS_WARNINGS = -Wno-unused
-LLIBS = ['util', 'c', 'm', 'dl', 'pthread', 'stdc++']
+LLIBS = ['util', 'c', 'm', 'pthread', 'stdc++']
##LOPTS = --dynamic
##DYNLDFLAGS = -shared $(LDFLAGS)
diff --git a/build_files/scons/config/freebsd9-config.py b/build_files/scons/config/freebsd9-config.py
index c344046d8cc..3fb4ebe7cd6 100644
--- a/build_files/scons/config/freebsd9-config.py
+++ b/build_files/scons/config/freebsd9-config.py
@@ -57,7 +57,6 @@ BF_OPENEXR_LIB = 'Half IlmImf Iex Imath '
BF_OPENEXR_LIB_STATIC = '${BF_OPENEXR}/lib/libHalf.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_OPENEXR}/lib/libIex.a ${BF_OPENEXR}/lib/libImath.a ${BF_OPENEXR}/lib/libIlmThread.a'
# BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
-
WITH_BF_DDS = True
WITH_BF_JPEG = True
@@ -87,7 +86,7 @@ BF_GETTEXT_INC = '${BF_GETTEXT}/include'
BF_GETTEXT_LIB = 'gettextlib'
BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
-WITH_BF_GAMEENGINE = True
+WITH_BF_GAMEENGINE = False
WITH_BF_PLAYER = True
WITH_BF_BULLET = True
@@ -100,7 +99,8 @@ BF_FREETYPE = '/usr/local'
BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
BF_FREETYPE_LIB = 'freetype'
-WITH_BF_QUICKTIME = True # -DWITH_QUICKTIME
+### XXX Find what this actually wants; it doesn't want libquicktime.
+WITH_BF_QUICKTIME = False # -DWITH_QUICKTIME
BF_QUICKTIME = '/usr/local'
BF_QUICKTIME_INC = '${BF_QUICKTIME}/include'
@@ -195,7 +195,7 @@ CXX_WARN = ['-Wno-invalid-offsetof', '-Wno-sign-compare']
##FIX_STUBS_WARNINGS = -Wno-unused
-LLIBS = ['util', 'c', 'm', 'dl', 'pthread', 'stdc++']
+LLIBS = ['util', 'c', 'm', 'pthread', 'stdc++']
##LOPTS = --dynamic
##DYNLDFLAGS = -shared $(LDFLAGS)
diff --git a/build_files/scons/config/linux2-config.py b/build_files/scons/config/linux2-config.py
index 7a350a74ed5..75428937b39 100644
--- a/build_files/scons/config/linux2-config.py
+++ b/build_files/scons/config/linux2-config.py
@@ -84,6 +84,8 @@ BF_GETTEXT = '/usr'
BF_GETTEXT_INC = '${BF_GETTEXT}/include'
BF_GETTEXT_LIB = 'gettextlib'
BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
+#WITH_BF_GETTEXT_STATIC = True
+#BF_GETTEXT_LIB_STATIC = '${BF_GETTEXT}/lib/libgettextlib.a'
WITH_BF_GAMEENGINE = True
WITH_BF_PLAYER = False
@@ -97,6 +99,8 @@ BF_BULLET_LIB = 'extern_bullet'
BF_FREETYPE = '/usr'
BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
BF_FREETYPE_LIB = 'freetype'
+#WITH_BF_FREETYPE_STATIC = True
+#BF_FREETYPE_LIB_STATIC = '${BF_FREETYPE}/lib/libfreetype.a'
WITH_BF_QUICKTIME = False # -DWITH_QUICKTIME
BF_QUICKTIME = '/usr/local'
@@ -116,6 +120,8 @@ BF_FFMPEG = '/usr'
BF_FFMPEG_LIB = 'avformat avcodec swscale avutil avdevice'
BF_FFMPEG_INC = '${BF_FFMPEG}/include'
BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
+#WITH_BF_STATICFFMPEG = True
+#BF_FFMPEG_LIB_STATIC = '${BF_FFMPEG_LIBPATH}/libavformat.a ${BF_FFMPEG_LIBPATH/libavcodec.a ${BF_FFMPEG_LIBPATH}/libswscale.a ${BF_FFMPEG_LIBPATH}/libavutil.a ${BF_FFMPEG_LIBPATH}/libavdevice.a'
# enable ogg, vorbis and theora in ffmpeg
WITH_BF_OGG = False # -DWITH_OGG
diff --git a/build_files/scons/tools/Blender.py b/build_files/scons/tools/Blender.py
index 89c4ef9cac9..b7804d66324 100644
--- a/build_files/scons/tools/Blender.py
+++ b/build_files/scons/tools/Blender.py
@@ -23,6 +23,7 @@ import sys
import zipfile
import shutil
import cStringIO
+import platform
from SCons.Script.SConscript import SConsEnvironment
import SCons.Action
@@ -153,8 +154,14 @@ def setup_staticlibs(lenv):
libincs += Split(lenv['BF_TIFF_LIBPATH'])
if lenv['WITH_BF_FFTW3']:
libincs += Split(lenv['BF_FFTW3_LIBPATH'])
+ if lenv['WITH_BF_FFMPEG'] and lenv['WITH_BF_STATICFFMPEG']:
+ statlibs += Split(lenv['BF_FFMPEG_LIB_STATIC'])
if lenv['WITH_BF_INTERNATIONAL']:
libincs += Split(lenv['BF_GETTEXT_LIBPATH'])
+ if lenv['WITH_BF_GETTEXT_STATIC']:
+ statlibs += Split(lenv['BF_GETTEXT_LIB_STATIC'])
+ if lenv['WITH_BF_FREETYPE_STATIC']:
+ statlibs += Split(lenv['BF_FREETYPE_LIB_STATIC'])
if lenv['WITH_BF_OPENAL']:
libincs += Split(lenv['BF_OPENAL_LIBPATH'])
if lenv['WITH_BF_STATICOPENAL']:
@@ -195,13 +202,14 @@ def setup_syslibs(lenv):
lenv['BF_LIBSAMPLERATE_LIB']
]
+ if not lenv['WITH_BF_FREETYPE_STATIC']:
syslibs += Split(lenv['BF_FREETYPE_LIB'])
if lenv['WITH_BF_PYTHON'] and not lenv['WITH_BF_STATICPYTHON']:
if lenv['BF_DEBUG'] and lenv['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw'):
syslibs.append(lenv['BF_PYTHON_LIB']+'_d')
else:
syslibs.append(lenv['BF_PYTHON_LIB'])
- if lenv['WITH_BF_INTERNATIONAL']:
+ if lenv['WITH_BF_INTERNATIONAL'] and not lenv['WITH_BF_GETTEXT_STATIC']:
syslibs += Split(lenv['BF_GETTEXT_LIB'])
if lenv['WITH_BF_OPENAL']:
if not lenv['WITH_BF_STATICOPENAL']:
@@ -218,7 +226,7 @@ def setup_syslibs(lenv):
syslibs += Split(lenv['BF_OPENEXR_LIB'])
if lenv['WITH_BF_TIFF']:
syslibs += Split(lenv['BF_TIFF_LIB'])
- if lenv['WITH_BF_FFMPEG']:
+ if lenv['WITH_BF_FFMPEG'] and not lenv['WITH_BF_STATICFFMPEG']:
syslibs += Split(lenv['BF_FFMPEG_LIB'])
if lenv['WITH_BF_OGG']:
syslibs += Split(lenv['BF_OGG_LIB'])
@@ -269,15 +277,21 @@ def buildinfo(lenv, build_type):
build_date = time.strftime ("%Y-%m-%d")
build_time = time.strftime ("%H:%M:%S")
build_rev = os.popen('svnversion').read()[:-1] # remove \n
+ if build_rev == '':
+ build_rev = '<UNKNOWN>'
+ if lenv['BF_DEBUG']:
+ build_type = "Debug"
+ else:
+ build_type = "Release"
obj = []
if lenv['BF_BUILDINFO']:
- lenv.Append (CPPDEFINES = ['BUILD_TIME=\'"%s"\''%(build_time),
- 'BUILD_DATE=\'"%s"\''%(build_date),
- 'BUILD_TYPE=\'"dynamic"\'',
- 'BUILD_REV=\'"%s"\''%(build_rev),
+ lenv.Append (CPPDEFINES = ['BUILD_TIME="%s"'%(build_time),
+ 'BUILD_DATE="%s"'%(build_date),
+ 'BUILD_TYPE="%s"'%(build_type),
+ 'BUILD_REV="%s"'%(build_rev),
'NAN_BUILDINFO',
- 'BUILD_PLATFORM=\'"%s"\''%(sys.platform)])
+ 'BUILD_PLATFORM="%s:%s"'%(platform.system(), platform.architecture()[0])])
obj = [lenv.Object (root_build_dir+'source/creator/%s_buildinfo'%build_type,
[root_build_dir+'source/creator/buildinfo.c'])]
return obj
@@ -463,6 +477,9 @@ def WinPyBundle(target=None, source=None, env=None):
py_zip= env.subst( env['LCGDIR'] )
if py_zip[0]=='#':
py_zip= py_zip[1:]
+ if env['BF_DEBUG']:
+ py_zip+= '/release/python' + env['BF_PYTHON_VERSION'].replace('.','') + '_d.zip'
+ else:
py_zip+= '/release/python' + env['BF_PYTHON_VERSION'].replace('.','') + '.zip'
py_target = env.subst( env['BF_INSTALLDIR'] )
@@ -722,7 +739,7 @@ class BlenderEnvironment(SConsEnvironment):
# note: libs is a global
add_lib_to_dict(self, libs, libtype, libname, priority)
- def BlenderProg(self=None, builddir=None, progname=None, sources=None, includes=None, libs=None, libpath=None, binarykind=''):
+ def BlenderProg(self=None, builddir=None, progname=None, sources=None, libs=None, libpath=None, binarykind=''):
global vcp
print bc.HEADER+'Configuring program '+bc.ENDC+bc.OKGREEN+progname+bc.ENDC
lenv = self.Clone()
@@ -748,7 +765,6 @@ class BlenderEnvironment(SConsEnvironment):
lenv.Append(LINKFLAGS = lenv['BF_OPENGL_LINKFLAGS'])
if lenv['BF_PROFILE']:
lenv.Append(LINKFLAGS = lenv['BF_PROFILE_LINKFLAGS'])
- lenv.Append(CPPPATH=includes)
if root_build_dir[0]==os.sep or root_build_dir[1]==':':
lenv.Append(LIBPATH=root_build_dir + '/lib')
lenv.Append(LIBPATH=libpath)
diff --git a/build_files/scons/tools/btools.py b/build_files/scons/tools/btools.py
index c930c150cb6..894a32c14a1 100644
--- a/build_files/scons/tools/btools.py
+++ b/build_files/scons/tools/btools.py
@@ -38,6 +38,7 @@ def validate_arguments(args, bc):
'WITH_BF_OPENEXR', 'BF_OPENEXR', 'BF_OPENEXR_INC', 'BF_OPENEXR_LIB', 'BF_OPENEXR_LIBPATH', 'WITH_BF_STATICOPENEXR', 'BF_OPENEXR_LIB_STATIC',
'WITH_BF_DDS', 'WITH_BF_CINEON', 'WITH_BF_HDR',
'WITH_BF_FFMPEG', 'BF_FFMPEG_LIB','BF_FFMPEG_EXTRA', 'BF_FFMPEG', 'BF_FFMPEG_INC',
+ 'WITH_BF_STATICFFMPEG', 'BF_FFMPEG_LIB_STATIC',
'WITH_BF_OGG', 'BF_OGG', 'BF_OGG_LIB',
'WITH_BF_JPEG', 'BF_JPEG', 'BF_JPEG_INC', 'BF_JPEG_LIB', 'BF_JPEG_LIBPATH',
'WITH_BF_OPENJPEG', 'BF_OPENJPEG', 'BF_OPENJPEG_INC', 'BF_OPENJPEG_LIB', 'BF_OPENJPEG_LIBPATH',
@@ -46,11 +47,11 @@ def validate_arguments(args, bc):
'WITH_BF_TIFF', 'BF_TIFF', 'BF_TIFF_INC', 'BF_TIFF_LIB', 'BF_TIFF_LIBPATH',
'WITH_BF_ZLIB', 'BF_ZLIB', 'BF_ZLIB_INC', 'BF_ZLIB_LIB', 'BF_ZLIB_LIBPATH',
'WITH_BF_INTERNATIONAL',
- 'BF_GETTEXT', 'BF_GETTEXT_INC', 'BF_GETTEXT_LIB', 'BF_GETTEXT_LIBPATH',
+ 'BF_GETTEXT', 'BF_GETTEXT_INC', 'BF_GETTEXT_LIB', 'WITH_BF_GETTEXT_STATIC', 'BF_GETTEXT_LIB_STATIC', 'BF_GETTEXT_LIBPATH',
'WITH_BF_ICONV', 'BF_ICONV', 'BF_ICONV_INC', 'BF_ICONV_LIB', 'BF_ICONV_LIBPATH',
'WITH_BF_GAMEENGINE', 'WITH_BF_BULLET', 'BF_BULLET', 'BF_BULLET_INC', 'BF_BULLET_LIB',
'BF_WINTAB', 'BF_WINTAB_INC',
- 'WITH_BF_FREETYPE', 'BF_FREETYPE', 'BF_FREETYPE_INC', 'BF_FREETYPE_LIB', 'BF_FREETYPE_LIBPATH',
+ 'WITH_BF_FREETYPE', 'BF_FREETYPE', 'BF_FREETYPE_INC', 'BF_FREETYPE_LIB', 'BF_FREETYPE_LIBPATH', 'BF_FREETYPE_LIB_STATIC', 'WITH_BF_FREETYPE_STATIC',
'WITH_BF_QUICKTIME', 'BF_QUICKTIME', 'BF_QUICKTIME_INC', 'BF_QUICKTIME_LIB', 'BF_QUICKTIME_LIBPATH',
'WITH_BF_FFTW3', 'BF_FFTW3', 'BF_FFTW3_INC', 'BF_FFTW3_LIB', 'BF_FFTW3_LIBPATH',
'WITH_BF_STATICOPENGL', 'BF_OPENGL', 'BF_OPENGL_INC', 'BF_OPENGL_LIB', 'BF_OPENGL_LIBPATH', 'BF_OPENGL_LIB_STATIC',
@@ -236,6 +237,8 @@ def read_opts(env, cfg, args):
('BF_FFMPEG_INC', 'FFMPEG includes', ''),
('BF_FFMPEG_LIBPATH', 'FFMPEG library path', ''),
+ (BoolVariable('WITH_BF_STATICFFMPEG', 'Use static FFMPEG if true', False)),
+ ('BF_FFMPEG_LIB_STATIC', 'Static FFMPEG libraries', ''),
(BoolVariable('WITH_BF_OGG', 'Use OGG, THEORA, VORBIS in FFMPEG if true',
False)),
@@ -289,6 +292,8 @@ def read_opts(env, cfg, args):
('BF_GETTEXT', 'gettext base path', ''),
('BF_GETTEXT_INC', 'gettext include path', ''),
('BF_GETTEXT_LIB', 'gettext library', ''),
+ (BoolVariable('WITH_BF_GETTEXT_STATIC', 'Use static gettext library if true', False)),
+ ('BF_GETTEXT_LIB_STATIC', 'static gettext library', ''),
('BF_GETTEXT_LIBPATH', 'gettext library path', ''),
(BoolVariable('WITH_BF_ICONV', 'Use iconv if true', True)),
@@ -309,29 +314,14 @@ def read_opts(env, cfg, args):
('BF_CXX', 'c++ base path for libstdc++, only used when static linking', ''),
(BoolVariable('WITH_BF_STATICCXX', 'static link to stdc++', False)),
('BF_CXX_LIB_STATIC', 'static library path for stdc++', ''),
-##
-##WITH_BF_NSPR = True
-##BF_NSPR = $(LCGDIR)/nspr
-##BF_NSPR_INC = -I$(BF_NSPR)/include -I$(BF_NSPR)/include/nspr
-##BF_NSPR_LIB =
-### Uncomment the following line to use Mozilla inplace of netscape
-##CPPFLAGS += -DMOZ_NOT_NET
-### Location of MOZILLA/Netscape header files...
-##BF_MOZILLA = $(LCGDIR)/mozilla
-##BF_MOZILLA_INC = -I$(BF_MOZILLA)/include/mozilla/nspr -I$(BF_MOZILLA)/include/mozilla -I$(BF_MOZILLA)/include/mozilla/xpcom -I$(BF_MOZILLA)/include/mozilla/idl
-##BF_MOZILLA_LIB =
-### Will fall back to look in BF_MOZILLA_INC/nspr and BF_MOZILLA_LIB
-### if this is not set.
-##
-### Be paranoid regarding library creation (do not update archives)
-##BF_PARANOID = True
-##
-### enable freetype2 support for text objects
+
(BoolVariable('WITH_BF_FREETYPE', 'Use FreeType2 if true', True)),
('BF_FREETYPE', 'Freetype base path', ''),
('BF_FREETYPE_INC', 'Freetype include path', ''),
('BF_FREETYPE_LIB', 'Freetype library', ''),
('BF_FREETYPE_LIBPATH', 'Freetype library path', ''),
+ (BoolVariable('WITH_BF_FREETYPE_STATIC', 'Use Static Freetype if true', False)),
+ ('BF_FREETYPE_LIB_STATIC', 'Static Freetype library', ''),
(BoolVariable('WITH_BF_OPENMP', 'Use OpenMP if true', False)),
('BF_OPENMP', 'Base path to OpenMP (used when cross-compiling with older versions of WinGW)', ''),
diff --git a/doc/BL-license.txt b/doc/BL-license.txt
index 2ba19e96ec3..3f079767198 100644
--- a/doc/BL-license.txt
+++ b/doc/BL-license.txt
@@ -32,4 +32,4 @@ license@blender.org for further information.
Ton Roosendaal
Chairman Blender Foundation.
-June 2005 \ No newline at end of file
+June 2005
diff --git a/doc/bf-members.txt b/doc/bf-members.txt
index 181ed152081..41aad8b7264 100644
--- a/doc/bf-members.txt
+++ b/doc/bf-members.txt
@@ -1390,4 +1390,4 @@ Radoslav Dejanovic
James H. Cloos, Jr.
Karl Erlandsen (LethalSideParting)
Kari Pulli
-Dave Shemano \ No newline at end of file
+Dave Shemano
diff --git a/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexHullShape.cpp b/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexHullShape.cpp
index 2b067367767..7b45fad12df 100644
--- a/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexHullShape.cpp
+++ b/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexHullShape.cpp
@@ -24,12 +24,13 @@ btConvexHullShape ::btConvexHullShape (const btScalar* points,int numPoints,int
m_shapeType = CONVEX_HULL_SHAPE_PROXYTYPE;
m_unscaledPoints.resize(numPoints);
- unsigned char* pointsBaseAddress = (unsigned char*)points;
+ unsigned char* pointsAddress = (unsigned char*)points;
for (int i=0;i<numPoints;i++)
{
- btVector3* point = (btVector3*)(pointsBaseAddress + i*stride);
- m_unscaledPoints[i] = point[0];
+ btScalar* point = (btScalar*)pointsAddress;
+ m_unscaledPoints[i] = btVector3(point[0], point[1], point[2]);
+ pointsAddress += stride;
}
recalcLocalAabb();
diff --git a/extern/libopenjpeg/CMakeLists.txt b/extern/libopenjpeg/CMakeLists.txt
index 0a985aceb37..d7b25ed1412 100644
--- a/extern/libopenjpeg/CMakeLists.txt
+++ b/extern/libopenjpeg/CMakeLists.txt
@@ -28,5 +28,5 @@ SET(INC . src)
FILE(GLOB SRC *.c except t1_generate_luts.c)
ADD_DEFINITIONS(-DWITH_OPENJPEG)
-BLENDERLIB(extern_libopenjpeg "${SRC}" "${INC}")
+BLENDERLIB(extern_openjpeg "${SRC}" "${INC}")
#, libtype=['international','player'], priority=[5, 210])
diff --git a/extern/lzma/CMakeLists.txt b/extern/lzma/CMakeLists.txt
index 235cd8c7f8e..15aa5264e37 100644
--- a/extern/lzma/CMakeLists.txt
+++ b/extern/lzma/CMakeLists.txt
@@ -28,7 +28,4 @@ SET(INC . )
FILE(GLOB SRC ./*.c)
-
-
-BLENDERLIB(bf_lzma "${SRC}" "${INC}")
-#, libtype='blender', priority = 0 )
+BLENDERLIB(extern_lzma "${SRC}" "${INC}")
diff --git a/extern/lzma/SConscript b/extern/lzma/SConscript
index 015cdfe339f..d0cfed87cb6 100644
--- a/extern/lzma/SConscript
+++ b/extern/lzma/SConscript
@@ -6,4 +6,4 @@ sources = env.Glob('./*.c')
defs = ''
incs = ' . '
-env.BlenderLib ('bf_lzma', sources, Split(incs), Split(defs), libtype=['intern'], priority=[40] )
+env.BlenderLib ('extern_lzma', sources, Split(incs), Split(defs), libtype=['intern'], priority=[40] )
diff --git a/extern/lzo/CMakeLists.txt b/extern/lzo/CMakeLists.txt
index b640cf658da..8bc887c923e 100644
--- a/extern/lzo/CMakeLists.txt
+++ b/extern/lzo/CMakeLists.txt
@@ -30,5 +30,5 @@ FILE(GLOB SRC minilzo/*.c)
-BLENDERLIB(bf_minilzo "${SRC}" "${INC}")
+BLENDERLIB(extern_minilzo "${SRC}" "${INC}")
#, libtype='blender', priority = 0 )
diff --git a/extern/lzo/SConscript b/extern/lzo/SConscript
index 81bedad25d8..a87034d197a 100644
--- a/extern/lzo/SConscript
+++ b/extern/lzo/SConscript
@@ -6,4 +6,4 @@ sources = env.Glob('minilzo/*.c')
defs = ''
incs = ' include '
-env.BlenderLib ('bf_minilzo', sources, Split(incs), Split(defs), libtype=['intern'], priority=[40] )
+env.BlenderLib ('extern_minilzo', sources, Split(incs), Split(defs), libtype=['intern'], priority=[40] )
diff --git a/intern/boolop/CMakeLists.txt b/intern/boolop/CMakeLists.txt
index e06b19a5d39..99923bc99dc 100644
--- a/intern/boolop/CMakeLists.txt
+++ b/intern/boolop/CMakeLists.txt
@@ -28,5 +28,5 @@ SET(INC . intern extern ../moto/include ../container ../memutil ../../source/ble
FILE(GLOB SRC intern/*.cpp)
-BLENDERLIB(blender_bop "${SRC}" "${INC}")
+BLENDERLIB(bf_intern_bop "${SRC}" "${INC}")
#, libtype='common', priority=5 )
diff --git a/intern/boolop/SConscript b/intern/boolop/SConscript
index 6a85b2d69be..5cf32862f96 100644
--- a/intern/boolop/SConscript
+++ b/intern/boolop/SConscript
@@ -8,7 +8,7 @@ incs += ' ../../source/blender/makesdna ../../intern/guardedalloc'
incs += ' ../../source/blender/blenlib'
if (env['OURPLATFORM'] == 'win32-mingw'):
- env.BlenderLib ('blender_bop', sources, Split(incs) , [], libtype='intern', priority = 5 )
+ env.BlenderLib ('bf_intern_bop', sources, Split(incs) , [], libtype='intern', priority = 5 )
else:
- env.BlenderLib ('blender_bop', sources, Split(incs) , [], libtype='intern', priority = 5 )
+ env.BlenderLib ('bf_intern_bop', sources, Split(incs) , [], libtype='intern', priority = 5 )
diff --git a/intern/bsp/CMakeLists.txt b/intern/bsp/CMakeLists.txt
index c95752ed5ed..4f87e161030 100644
--- a/intern/bsp/CMakeLists.txt
+++ b/intern/bsp/CMakeLists.txt
@@ -28,5 +28,5 @@ SET(INC intern ../container ../moto/include ../memutil)
FILE(GLOB SRC intern/*.cpp)
-BLENDERLIB(blender_BSP "${SRC}" "${INC}")
+BLENDERLIB(bf_intern_bsp "${SRC}" "${INC}")
#, libtype='core', priority=15 )
diff --git a/intern/bsp/SConscript b/intern/bsp/SConscript
index ff5a213d7b8..705c31193f3 100644
--- a/intern/bsp/SConscript
+++ b/intern/bsp/SConscript
@@ -5,5 +5,5 @@ sources = env.Glob('intern/*.cpp')
incs = 'intern ../container ../moto/include ../memutil'
-env.BlenderLib ('blender_BSP', sources, Split(incs), [], libtype='core', priority=200 )
+env.BlenderLib ('bf_intern_bsp', sources, Split(incs), [], libtype='core', priority=200 )
diff --git a/intern/container/CMakeLists.txt b/intern/container/CMakeLists.txt
index 5835d561abd..462b62ae8bb 100644
--- a/intern/container/CMakeLists.txt
+++ b/intern/container/CMakeLists.txt
@@ -28,5 +28,5 @@ SET(INC .)
FILE(GLOB SRC intern/*.cpp)
-BLENDERLIB(blender_CTR "${SRC}" "${INC}")
+BLENDERLIB(bf_intern_ctr "${SRC}" "${INC}")
#, libtype=['intern'], priority = 10 )
diff --git a/intern/container/SConscript b/intern/container/SConscript
index d05104da562..2d93e90b555 100644
--- a/intern/container/SConscript
+++ b/intern/container/SConscript
@@ -4,4 +4,4 @@ Import ('env')
sources = env.Glob('intern/*.cpp')
incs = '.'
-env.BlenderLib ('blender_CTR', sources, Split(incs) , [], libtype='intern', priority = 10 )
+env.BlenderLib ('bf_intern_ctr', sources, Split(incs) , [], libtype='intern', priority = 10 )
diff --git a/intern/decimation/CMakeLists.txt b/intern/decimation/CMakeLists.txt
index e7aff161692..7fdf08978a4 100644
--- a/intern/decimation/CMakeLists.txt
+++ b/intern/decimation/CMakeLists.txt
@@ -28,5 +28,5 @@ SET(INC . ../moto/include ../container ../memutil)
FILE(GLOB SRC intern/*.cpp)
-BLENDERLIB(bf_decimation "${SRC}" "${INC}")
+BLENDERLIB(bf_intern_decimate "${SRC}" "${INC}")
#, libtype=['core','common','player'], priority = [10, 20, 25] )
diff --git a/intern/decimation/SConscript b/intern/decimation/SConscript
index 2dd86c44cf1..2fc7781bd59 100644
--- a/intern/decimation/SConscript
+++ b/intern/decimation/SConscript
@@ -5,4 +5,4 @@ sources = env.Glob('intern/*.cpp')
incs = '. ../moto/include ../container ../memutil'
-env.BlenderLib ('bf_decimation', sources, Split(incs) , [], libtype=['core'], priority = [200] )
+env.BlenderLib ('bf_intern_decimate', sources, Split(incs) , [], libtype=['core'], priority = [200] )
diff --git a/intern/elbeem/CMakeLists.txt b/intern/elbeem/CMakeLists.txt
index e45a210bd88..d0e100907b1 100644
--- a/intern/elbeem/CMakeLists.txt
+++ b/intern/elbeem/CMakeLists.txt
@@ -37,5 +37,5 @@ IF(WITH_OPENMP)
ADD_DEFINITIONS(-DPARALLEL=1)
ENDIF(WITH_OPENMP)
-BLENDERLIB_NOLIST(bf_elbeem "${SRC}" "${INC}")
+BLENDERLIB_NOLIST(bf_intern_elbeem "${SRC}" "${INC}")
#, libtype='blender', priority=0 )
diff --git a/intern/elbeem/SConscript b/intern/elbeem/SConscript
index f0417f74001..9c035c0c285 100644
--- a/intern/elbeem/SConscript
+++ b/intern/elbeem/SConscript
@@ -19,4 +19,4 @@ if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
incs += ' ' + env['BF_PNG_INC'] + ' ' + env['BF_ZLIB_INC']
incs += ' extern '
-env.BlenderLib ('bf_elbeem', sources, Split(incs), Split(defs), libtype='intern', priority=0 )
+env.BlenderLib ('bf_intern_elbeem', sources, Split(incs), Split(defs), libtype='intern', priority=0 )
diff --git a/intern/ghost/CMakeLists.txt b/intern/ghost/CMakeLists.txt
index c262ea8aadd..c6ffd4b1913 100644
--- a/intern/ghost/CMakeLists.txt
+++ b/intern/ghost/CMakeLists.txt
@@ -90,5 +90,5 @@ ELSEIF(UNIX)
ENDIF(APPLE)
-BLENDERLIB(bf_ghost "${SRC}" "${INC}")
+BLENDERLIB(bf_intern_ghost "${SRC}" "${INC}")
diff --git a/intern/ghost/SConscript b/intern/ghost/SConscript
index 9ecd61857ce..8af1926efc8 100644
--- a/intern/ghost/SConscript
+++ b/intern/ghost/SConscript
@@ -60,4 +60,4 @@ if env['BF_GHOST_DEBUG']:
incs = '. ../string #extern/glew/include #source/blender/imbuf #source/blender/makesdna ' + env['BF_OPENGL_INC']
if window_system in ('win32-vc', 'win32-mingw', 'cygwin', 'linuxcross', 'win64-vc'):
incs = env['BF_WINTAB_INC'] + ' ' + incs
-env.BlenderLib ('bf_ghost', sources, Split(incs), defines=defs, libtype=['intern','player'], priority = [40,15] ) \ No newline at end of file
+env.BlenderLib ('bf_intern_ghost', sources, Split(incs), defines=defs, libtype=['intern','player'], priority = [40,15] )
diff --git a/intern/ghost/intern/GHOST_WindowManager.cpp b/intern/ghost/intern/GHOST_WindowManager.cpp
index 1ac357ac97f..aa932663e16 100644
--- a/intern/ghost/intern/GHOST_WindowManager.cpp
+++ b/intern/ghost/intern/GHOST_WindowManager.cpp
@@ -212,4 +212,4 @@ bool GHOST_WindowManager::getAnyModifiedState()
}
return isAnyModified;
-} \ No newline at end of file
+}
diff --git a/intern/guardedalloc/CMakeLists.txt b/intern/guardedalloc/CMakeLists.txt
index 21f43b7320e..642b04fdb60 100644
--- a/intern/guardedalloc/CMakeLists.txt
+++ b/intern/guardedalloc/CMakeLists.txt
@@ -28,10 +28,10 @@ SET(INC .)
FILE(GLOB SRC intern/*.c)
-BLENDERLIB(bf_guardedalloc "${SRC}" "${INC}")
+BLENDERLIB(bf_intern_guardedalloc "${SRC}" "${INC}")
# Override C++ alloc optional
IF(WITH_CXX_GUARDEDALLOC)
FILE(GLOB SRC cpp/*.cpp)
- BLENDERLIB(bf_guardedalloc_cpp "${SRC}" "${INC}")
+ BLENDERLIB(bf_intern_guardedalloc_cpp "${SRC}" "${INC}")
ENDIF(WITH_CXX_GUARDEDALLOC)
diff --git a/intern/guardedalloc/SConscript b/intern/guardedalloc/SConscript
index 2ee0f84b464..0c9c7d13608 100644
--- a/intern/guardedalloc/SConscript
+++ b/intern/guardedalloc/SConscript
@@ -5,4 +5,4 @@ Import('env')
sources = env.Glob('intern/*.c')
incs = '.'
-env.BlenderLib ('bf_guardedalloc', sources, Split(incs), defines=[], libtype=['intern','player'], priority = [5,150] )
+env.BlenderLib ('bf_intern_guardedalloc', sources, Split(incs), defines=[], libtype=['intern','player'], priority = [5,150] )
diff --git a/intern/iksolver/CMakeLists.txt b/intern/iksolver/CMakeLists.txt
index 3c345ae7e6a..8ea05ac994d 100644
--- a/intern/iksolver/CMakeLists.txt
+++ b/intern/iksolver/CMakeLists.txt
@@ -28,5 +28,5 @@ SET(INC intern ../moto/include ../memutil)
FILE(GLOB SRC intern/*.cpp)
-BLENDERLIB(bf_IK "${SRC}" "${INC}")
+BLENDERLIB(bf_intern_ik "${SRC}" "${INC}")
#, libtype=['blender'], priority = [10] )
diff --git a/intern/iksolver/SConscript b/intern/iksolver/SConscript
index 7adb2d50893..bdf7cd350ff 100644
--- a/intern/iksolver/SConscript
+++ b/intern/iksolver/SConscript
@@ -5,5 +5,5 @@ sources = env.Glob('intern/*.cpp')
incs = 'intern ../moto/include ../memutil'
-env.BlenderLib ('bf_IK', sources, Split(incs), [], libtype=['intern','player'], priority=[100,90] )
+env.BlenderLib ('bf_intern_ik', sources, Split(incs), [], libtype=['intern','player'], priority=[100,90] )
diff --git a/intern/itasc/CMakeLists.txt b/intern/itasc/CMakeLists.txt
index 7b442446d62..39443bd2b22 100644
--- a/intern/itasc/CMakeLists.txt
+++ b/intern/itasc/CMakeLists.txt
@@ -28,5 +28,5 @@ SET(INC ../../extern/Eigen2)
FILE(GLOB SRC *.cpp kdl/*.cpp kdl/utilities/*.cpp)
-BLENDERLIB(bf_ITASC "${SRC}" "${INC}")
+BLENDERLIB(bf_intern_itasc "${SRC}" "${INC}")
#, libtype=['blender'], priority = [10] )
diff --git a/intern/itasc/SConscript b/intern/itasc/SConscript
index 9e11b6c7119..5fa4246d711 100644
--- a/intern/itasc/SConscript
+++ b/intern/itasc/SConscript
@@ -7,5 +7,5 @@ sources += env.Glob('kdl/utilities/*.cpp')
incs = '. ../../extern/Eigen2'
-env.BlenderLib ('bf_ITASC', sources, Split(incs), [], libtype=['intern','player'], priority=[20,100] )
+env.BlenderLib ('bf_intern_itasc', sources, Split(incs), [], libtype=['intern','player'], priority=[20,100] )
diff --git a/intern/memutil/CMakeLists.txt b/intern/memutil/CMakeLists.txt
index 51391bd3006..3dc725acb50 100644
--- a/intern/memutil/CMakeLists.txt
+++ b/intern/memutil/CMakeLists.txt
@@ -28,5 +28,5 @@ SET(INC . ..)
FILE(GLOB SRC intern/*.cpp)
-BLENDERLIB(bf_memutil "${SRC}" "${INC}")
+BLENDERLIB(bf_intern_memutil "${SRC}" "${INC}")
#, libtype=['intern', 'player'], priority = [0, 180] )
diff --git a/intern/memutil/SConscript b/intern/memutil/SConscript
index 318d4a3997e..c9a03982615 100644
--- a/intern/memutil/SConscript
+++ b/intern/memutil/SConscript
@@ -5,4 +5,4 @@ sources = env.Glob('intern/*.cpp')
incs = '. ..'
-env.BlenderLib ('bf_memutil', sources, Split(incs), [], libtype=['intern','player'], priority = [0,155] )
+env.BlenderLib ('bf_intern_memutil', sources, Split(incs), [], libtype=['intern','player'], priority = [0,155] )
diff --git a/intern/moto/CMakeLists.txt b/intern/moto/CMakeLists.txt
index a5ed0f729de..3d6d3d1a783 100644
--- a/intern/moto/CMakeLists.txt
+++ b/intern/moto/CMakeLists.txt
@@ -28,5 +28,5 @@ SET(INC include)
FILE(GLOB SRC intern/*.cpp)
-BLENDERLIB(bf_moto "${SRC}" "${INC}")
+BLENDERLIB(bf_intern_moto "${SRC}" "${INC}")
#, libtype=['intern','game','game2','player'], priority = [15, 55, 100, 135] )
diff --git a/intern/moto/SConscript b/intern/moto/SConscript
index d9bbafe4623..ba257a33b14 100644
--- a/intern/moto/SConscript
+++ b/intern/moto/SConscript
@@ -5,4 +5,4 @@ sources = env.Glob('intern/*.cpp')
incs = 'include'
-env.BlenderLib ('bf_moto', sources, Split(incs), [], libtype=['intern','player'], priority = [130,95] )
+env.BlenderLib ('bf_intern_moto', sources, Split(incs), [], libtype=['intern','player'], priority = [130,95] )
diff --git a/intern/opennl/CMakeLists.txt b/intern/opennl/CMakeLists.txt
index d76abe12a00..0551c94e586 100644
--- a/intern/opennl/CMakeLists.txt
+++ b/intern/opennl/CMakeLists.txt
@@ -28,6 +28,6 @@ SET(INC extern superlu)
FILE(GLOB SRC intern/*.c superlu/*.c)
-BLENDERLIB(blender_ONL "${SRC}" "${INC}")
+BLENDERLIB(bf_intern_opennl "${SRC}" "${INC}")
#, libtype='core', priority=55 )
diff --git a/intern/opennl/SConscript b/intern/opennl/SConscript
index f68810d2f16..ff66b4ad6e1 100644
--- a/intern/opennl/SConscript
+++ b/intern/opennl/SConscript
@@ -6,7 +6,7 @@ sources = env.Glob('intern/*.c') + env.Glob('superlu/*.c')
incs = 'extern superlu'
if (env['OURPLATFORM'] == 'win32-mingw'):
- env.BlenderLib ('blender_ONL', sources, Split(incs), [], libtype=['core','intern'], priority=[1,80] )
+ env.BlenderLib ('bf_intern_opennl', sources, Split(incs), [], libtype=['core','intern'], priority=[1,80] )
else:
- env.BlenderLib ('blender_ONL', sources, Split(incs), [], libtype=['core'], priority=[55] )
+ env.BlenderLib ('bf_intern_opennl', sources, Split(incs), [], libtype=['core'], priority=[55] )
diff --git a/intern/smoke/CMakeLists.txt b/intern/smoke/CMakeLists.txt
index 8579c76b322..f099efd2bb8 100644
--- a/intern/smoke/CMakeLists.txt
+++ b/intern/smoke/CMakeLists.txt
@@ -38,5 +38,5 @@ IF(WITH_FFTW3)
ENDIF(WITH_FFTW3)
-BLENDERLIB(bf_smoke "${SRC}" "${INC}")
+BLENDERLIB(bf_intern_smoke "${SRC}" "${INC}")
#, libtype='blender', priority = 0 )
diff --git a/intern/smoke/SConscript b/intern/smoke/SConscript
index 2fc8798fc78..fa32c5f36c3 100644
--- a/intern/smoke/SConscript
+++ b/intern/smoke/SConscript
@@ -19,4 +19,4 @@ if env['WITH_BF_FFTW3']:
defs += ' FFTW3=1'
incs += env['BF_FFTW3_INC']
-env.BlenderLib ('bf_smoke', sources, Split(incs), Split(defs), libtype=['intern'], priority=[40] )
+env.BlenderLib ('bf_intern_smoke', sources, Split(incs), Split(defs), libtype=['intern'], priority=[40] )
diff --git a/intern/string/CMakeLists.txt b/intern/string/CMakeLists.txt
index c726f7483e5..7aeace4ca83 100644
--- a/intern/string/CMakeLists.txt
+++ b/intern/string/CMakeLists.txt
@@ -28,5 +28,5 @@ SET(INC .)
FILE(GLOB SRC intern/*.cpp)
-BLENDERLIB(bf_string "${SRC}" "${INC}")
+BLENDERLIB(bf_intern_string "${SRC}" "${INC}")
#, libtype=['core', 'player'], priority = [30,10] )
diff --git a/intern/string/SConscript b/intern/string/SConscript
index 4aca220183c..f8342bf12c2 100644
--- a/intern/string/SConscript
+++ b/intern/string/SConscript
@@ -4,4 +4,4 @@ Import ('env')
sources = env.Glob('intern/*.cpp')
incs = '.'
-env.BlenderLib ('bf_string', sources, Split(incs), [], libtype=['intern','player'], priority = [50,10] )
+env.BlenderLib ('bf_intern_string', sources, Split(incs), [], libtype=['intern','player'], priority = [50,10] )
diff --git a/release/scripts/io/export_ply.py b/release/scripts/io/export_ply.py
deleted file mode 100644
index 1a4fd7a6ff9..00000000000
--- a/release/scripts/io/export_ply.py
+++ /dev/null
@@ -1,327 +0,0 @@
-# ##### BEGIN GPL LICENSE BLOCK #####
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# ##### END GPL LICENSE BLOCK #####
-
-# <pep8 compliant>
-
-import bpy
-
-__author__ = "Bruce Merry"
-__version__ = "0.93"
-__bpydoc__ = """\
-This script exports Stanford PLY files from Blender. It supports normals,
-colours, and texture coordinates per face or per vertex.
-Only one mesh can be exported at a time.
-"""
-
-# Copyright (C) 2004, 2005: Bruce Merry, bmerry@cs.uct.ac.za
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-# Vector rounding se we can use as keys
-#
-# Updated on Aug 11, 2008 by Campbell Barton
-# - added 'comment' prefix to comments - Needed to comply with the PLY spec.
-#
-# Updated on Jan 1, 2007 by Gabe Ghearing
-# - fixed normals so they are correctly smooth/flat
-# - fixed crash when the model doesn't have uv coords or vertex colors
-# - fixed crash when the model has vertex colors but doesn't have uv coords
-# - changed float32 to float and uint8 to uchar for compatibility
-# Errata/Notes as of Jan 1, 2007
-# - script exports texture coords if they exist even if TexFace isn't selected (not a big deal to me)
-# - ST(R) should probably be renamed UV(T) like in most PLY files (importer needs to be updated to take either)
-#
-# Updated on Jan 3, 2007 by Gabe Ghearing
-# - fixed "sticky" vertex UV exporting
-# - added pupmenu to enable/disable exporting normals, uv coords, and colors
-# Errata/Notes as of Jan 3, 2007
-# - ST(R) coords should probably be renamed UV(T) like in most PLY files (importer needs to be updated to take either)
-# - edges should be exported since PLY files support them
-# - code is getting spaghettish, it should be refactored...
-#
-
-
-def rvec3d(v):
- return round(v[0], 6), round(v[1], 6), round(v[2], 6)
-
-
-def rvec2d(v):
- return round(v[0], 6), round(v[1], 6)
-
-
-def write(filename, scene, ob, \
- EXPORT_APPLY_MODIFIERS=True,\
- EXPORT_NORMALS=True,\
- EXPORT_UV=True,\
- EXPORT_COLORS=True):
-
- if not filename.lower().endswith('.ply'):
- filename += '.ply'
-
- if not ob:
- raise Exception("Error, Select 1 active object")
- return
-
- file = open(filename, 'w')
-
-
- #EXPORT_EDGES = Draw.Create(0)
- """
- is_editmode = Blender.Window.EditMode()
- if is_editmode:
- Blender.Window.EditMode(0, '', 0)
-
- Window.WaitCursor(1)
- """
- if scene.objects.active:
- bpy.ops.object.mode_set(mode='OBJECT')
-
- #mesh = BPyMesh.getMeshFromObject(ob, None, EXPORT_APPLY_MODIFIERS, False, scn) # XXX
- if EXPORT_APPLY_MODIFIERS:
- mesh = ob.create_mesh(scene, True, 'PREVIEW')
- else:
- mesh = ob.data
-
- if not mesh:
- raise ("Error, could not get mesh data from active object")
- return
-
- # mesh.transform(ob.matrix_world) # XXX
-
- faceUV = (len(mesh.uv_textures) > 0)
- vertexUV = (len(mesh.sticky) > 0)
- vertexColors = len(mesh.vertex_colors) > 0
-
- if (not faceUV) and (not vertexUV):
- EXPORT_UV = False
- if not vertexColors:
- EXPORT_COLORS = False
-
- if not EXPORT_UV:
- faceUV = vertexUV = False
- if not EXPORT_COLORS:
- vertexColors = False
-
- if faceUV:
- active_uv_layer = mesh.active_uv_texture
- if not active_uv_layer:
- EXPORT_UV = False
- faceUV = None
- else:
- active_uv_layer = active_uv_layer.data
-
- if vertexColors:
- active_col_layer = mesh.active_vertex_color
- if not active_col_layer:
- EXPORT_COLORS = False
- vertexColors = None
- else:
- active_col_layer = active_col_layer.data
-
- # incase
- color = uvcoord = uvcoord_key = normal = normal_key = None
-
- mesh_verts = mesh.vertices # save a lookup
- ply_verts = [] # list of dictionaries
- # vdict = {} # (index, normal, uv) -> new index
- vdict = [{} for i in range(len(mesh_verts))]
- ply_faces = [[] for f in range(len(mesh.faces))]
- vert_count = 0
- for i, f in enumerate(mesh.faces):
-
-
- smooth = f.use_smooth
- if not smooth:
- normal = tuple(f.normal)
- normal_key = rvec3d(normal)
-
- if faceUV:
- uv = active_uv_layer[i]
- uv = uv.uv1, uv.uv2, uv.uv3, uv.uv4 # XXX - crufty :/
- if vertexColors:
- col = active_col_layer[i]
- col = col.color1, col.color2, col.color3, col.color4
-
- f_verts = f.vertices
-
- pf = ply_faces[i]
- for j, vidx in enumerate(f_verts):
- v = mesh_verts[vidx]
-
- if smooth:
- normal = tuple(v.normal)
- normal_key = rvec3d(normal)
-
- if faceUV:
- uvcoord = uv[j][0], 1.0 - uv[j][1]
- uvcoord_key = rvec2d(uvcoord)
- elif vertexUV:
- uvcoord = v.uvco[0], 1.0 - v.uvco[1]
- uvcoord_key = rvec2d(uvcoord)
-
- if vertexColors:
- color = col[j]
- color = int(color[0] * 255.0), int(color[1] * 255.0), int(color[2] * 255.0)
-
-
- key = normal_key, uvcoord_key, color
-
- vdict_local = vdict[vidx]
- pf_vidx = vdict_local.get(key) # Will be None initially
-
- if pf_vidx == None: # same as vdict_local.has_key(key)
- pf_vidx = vdict_local[key] = vert_count
- ply_verts.append((vidx, normal, uvcoord, color))
- vert_count += 1
-
- pf.append(pf_vidx)
-
- file.write('ply\n')
- file.write('format ascii 1.0\n')
- file.write('comment Created by Blender %s - www.blender.org, source file: %s\n' % (bpy.app.version_string, bpy.data.filepath.split('/')[-1].split('\\')[-1]))
-
- file.write('element vertex %d\n' % len(ply_verts))
-
- file.write('property float x\n')
- file.write('property float y\n')
- file.write('property float z\n')
-
- if EXPORT_NORMALS:
- file.write('property float nx\n')
- file.write('property float ny\n')
- file.write('property float nz\n')
- if EXPORT_UV:
- file.write('property float s\n')
- file.write('property float t\n')
- if EXPORT_COLORS:
- file.write('property uchar red\n')
- file.write('property uchar green\n')
- file.write('property uchar blue\n')
-
- file.write('element face %d\n' % len(mesh.faces))
- file.write('property list uchar uint vertex_indices\n')
- file.write('end_header\n')
-
- for i, v in enumerate(ply_verts):
- file.write('%.6f %.6f %.6f ' % tuple(mesh_verts[v[0]].co)) # co
- if EXPORT_NORMALS:
- file.write('%.6f %.6f %.6f ' % v[1]) # no
- if EXPORT_UV:
- file.write('%.6f %.6f ' % v[2]) # uv
- if EXPORT_COLORS:
- file.write('%u %u %u' % v[3]) # col
- file.write('\n')
-
- for pf in ply_faces:
- if len(pf) == 3:
- file.write('3 %d %d %d\n' % tuple(pf))
- else:
- file.write('4 %d %d %d %d\n' % tuple(pf))
-
- file.close()
- print("writing", filename, "done")
-
- if EXPORT_APPLY_MODIFIERS:
- bpy.data.meshes.remove(mesh)
-
- # XXX
- """
- if is_editmode:
- Blender.Window.EditMode(1, '', 0)
- """
-
-from bpy.props import *
-
-
-class ExportPLY(bpy.types.Operator):
- '''Export a single object as a stanford PLY with normals, colours and texture coordinates.'''
- bl_idname = "export.ply"
- bl_label = "Export PLY"
-
- # List of operator properties, the attributes will be assigned
- # to the class instance from the operator settings before calling.
-
-
- filepath = StringProperty(name="File Path", description="Filepath used for exporting the PLY file", maxlen=1024, default="")
- check_existing = BoolProperty(name="Check Existing", description="Check and warn on overwriting existing files", default=True, options={'HIDDEN'})
- use_modifiers = BoolProperty(name="Apply Modifiers", description="Apply Modifiers to the exported mesh", default=True)
- use_normals = BoolProperty(name="Normals", description="Export Normals for smooth and hard shaded faces", default=True)
- use_uvs = BoolProperty(name="UVs", description="Exort the active UV layer", default=True)
- use_colors = BoolProperty(name="Vertex Colors", description="Exort the active vertex color layer", default=True)
-
- @classmethod
- def poll(cls, context):
- return context.active_object != None
-
- def execute(self, context):
- filepath = self.properties.filepath
- filepath = bpy.path.ensure_ext(filepath, ".ply")
-
- write(filepath, context.scene, context.active_object,\
- EXPORT_APPLY_MODIFIERS=self.properties.use_modifiers,
- EXPORT_NORMALS=self.properties.use_normals,
- EXPORT_UV=self.properties.use_uvs,
- EXPORT_COLORS=self.properties.use_colors,
- )
-
- return {'FINISHED'}
-
- def invoke(self, context, event):
- import os
- if not self.properties.is_property_set("filepath"):
- self.properties.filepath = os.path.splitext(bpy.data.filepath)[0] + ".ply"
-
- context.manager.add_fileselect(self)
- return {'RUNNING_MODAL'}
-
- def draw(self, context):
- layout = self.layout
- props = self.properties
-
- row = layout.row()
- row.prop(props, "use_modifiers")
- row.prop(props, "use_normals")
- row = layout.row()
- row.prop(props, "use_uvs")
- row.prop(props, "use_colors")
-
-
-def menu_func(self, context):
- self.layout.operator(ExportPLY.bl_idname, text="Stanford (.ply)")
-
-
-def register():
- bpy.types.INFO_MT_file_export.append(menu_func)
-
-
-def unregister():
- bpy.types.INFO_MT_file_export.remove(menu_func)
-
-if __name__ == "__main__":
- register()
diff --git a/release/scripts/io/import_shape_mdd.py b/release/scripts/io/import_shape_mdd.py
deleted file mode 100644
index c7b199918a2..00000000000
--- a/release/scripts/io/import_shape_mdd.py
+++ /dev/null
@@ -1,154 +0,0 @@
-# ***** BEGIN GPL LICENSE BLOCK *****
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# ***** END GPL LICENCE BLOCK *****
-
-# <pep8 compliant>
-
-# mdd importer by Bill L.Nieuwendorp
-# conversion to blender 2.5: Ivo Grigull (loolarge)
-#
-# Warning if the vertex order or vertex count differs from the
-# origonal model the mdd was Baked out from their will be Strange
-# behavior
-#
-# vertex animation to ShapeKeys with ipo and gives the frame a value of 1.0
-# A modifier to read mdd files would be Ideal but thats for another day :)
-#
-# Please send any fixes,updates,bugs to Slow67_at_Gmail.com
-# Bill Niewuendorp
-
-import bpy
-from struct import unpack
-
-
-def mdd_import(filepath, ob, scene, PREF_START_FRAME=0, PREF_JUMP=1):
-
- print('\n\nimporting mdd "%s"' % filepath)
-
- bpy.ops.object.mode_set(mode='OBJECT')
-
- file = open(filepath, 'rb')
- frames, points = unpack(">2i", file.read(8))
- time = unpack((">%df" % frames), file.read(frames * 4))
-
- print('\tpoints:%d frames:%d' % (points, frames))
-
- # If target object doesn't have Basis shape key, create it.
- try:
- num_keys = len(ob.data.shape_keys.keys)
- except:
- basis = ob.add_shape_key()
- basis.name = "Basis"
- ob.data.update()
-
- scene.frame_current = PREF_START_FRAME
-
- def UpdateMesh(ob, fr):
-
- # Insert new shape key
- new_shapekey = ob.add_shape_key()
- new_shapekey.name = ("frame_%.4d" % fr)
- new_shapekey_name = new_shapekey.name
-
- ob.active_shape_key_index = len(ob.data.shape_keys.keys)-1
- index = len(ob.data.shape_keys.keys)-1
- ob.show_shape_key = True
-
- verts = ob.data.shape_keys.keys[len(ob.data.shape_keys.keys)-1].data
-
-
- for v in verts: # 12 is the size of 3 floats
- v.co[:] = unpack('>3f', file.read(12))
- #me.update()
- ob.show_shape_key = False
-
-
- # insert keyframes
- shape_keys = ob.data.shape_keys
-
- scene.frame_current -= 1
- ob.data.shape_keys.keys[index].value = 0.0
- shape_keys.keys[len(ob.data.shape_keys.keys)-1].keyframe_insert("value")
-
- scene.frame_current += 1
- ob.data.shape_keys.keys[index].value = 1.0
- shape_keys.keys[len(ob.data.shape_keys.keys)-1].keyframe_insert("value")
-
- scene.frame_current += 1
- ob.data.shape_keys.keys[index].value = 0.0
- shape_keys.keys[len(ob.data.shape_keys.keys)-1].keyframe_insert("value")
-
- ob.data.update()
-
-
- for i in range(frames):
- UpdateMesh(ob, i)
-
-
-from bpy.props import *
-
-
-class importMDD(bpy.types.Operator):
- '''Import MDD vertex keyframe file to shape keys'''
- bl_idname = "import_shape.mdd"
- bl_label = "Import MDD"
-
- # get first scene to get min and max properties for frames, fps
-
- minframe = 1
- maxframe = 300000
- minfps = 1
- maxfps = 120
-
- # List of operator properties, the attributes will be assigned
- # to the class instance from the operator settings before calling.
- filepath = StringProperty(name="File Path", description="Filepath used for importing the MDD file", maxlen=1024)
- #fps = IntProperty(name="Frames Per Second", description="Number of frames/second", min=minfps, max=maxfps, default=25)
- frame_start = IntProperty(name="Start Frame", description="Start frame for inserting animation", min=minframe, max=maxframe, default=0)
-
- @classmethod
- def poll(cls, context):
- ob = context.active_object
- return (ob and ob.type == 'MESH')
-
- def execute(self, context):
- if not self.properties.filepath:
- raise Exception("filename not set")
-
- mdd_import(self.properties.filepath, bpy.context.active_object, context.scene, self.properties.frame_start, 1)
-
- return {'FINISHED'}
-
- def invoke(self, context, event):
- wm = context.manager
- wm.add_fileselect(self)
- return {'RUNNING_MODAL'}
-
-
-def menu_func(self, context):
- self.layout.operator(importMDD.bl_idname, text="Lightwave Point Cache (.mdd)")
-
-
-def register():
- bpy.types.INFO_MT_file_import.append(menu_func)
-
-
-def unregister():
- bpy.types.INFO_MT_file_import.remove(menu_func)
-
-if __name__ == "__main__":
- register()
diff --git a/release/scripts/io/netrender/__init__.py b/release/scripts/io/netrender/__init__.py
index 5a705e95aa8..e4f6bf65fe2 100644
--- a/release/scripts/io/netrender/__init__.py
+++ b/release/scripts/io/netrender/__init__.py
@@ -19,9 +19,7 @@
# This directory is a Python package.
# To support reload properly, try to access a package var, if it's there, reload everything
-try:
- init_data
-
+if "bpy" in locals():
reload(model)
reload(operators)
reload(client)
@@ -32,7 +30,7 @@ try:
reload(balancing)
reload(ui)
reload(repath)
-except:
+else:
from netrender import model
from netrender import operators
from netrender import client
@@ -49,7 +47,6 @@ slaves = []
blacklist = []
init_file = ""
-init_data = True
init_address = True
def register():
diff --git a/release/scripts/keyingsets/keyingsets_utils.py b/release/scripts/keyingsets/keyingsets_utils.py
index a26483e57ce..901aa715296 100644
--- a/release/scripts/keyingsets/keyingsets_utils.py
+++ b/release/scripts/keyingsets/keyingsets_utils.py
@@ -116,7 +116,7 @@ def RKS_GEN_rotation(ksi, context, ks, data):
# rotation mode affects the property used
if data.rotation_mode == 'QUATERNION':
path = path_add_property(base_path, "rotation_quaternion")
- elif data.rotation_mode == 'AXISANGLE':
+ elif data.rotation_mode == 'AXIS_ANGLE':
path = path_add_property(base_path, "rotation_axis_angle")
else:
path = path_add_property(base_path, "rotation_euler")
diff --git a/release/scripts/modules/bpy/ops.py b/release/scripts/modules/bpy/ops.py
index 15e5df15246..223a5a89471 100644
--- a/release/scripts/modules/bpy/ops.py
+++ b/release/scripts/modules/bpy/ops.py
@@ -23,6 +23,7 @@ from _bpy import ops as ops_module
# op_add = ops_module.add
op_dir = ops_module.dir
+op_poll = ops_module.poll
op_call = ops_module.call
op_as_string = ops_module.as_string
op_get_rna = ops_module.get_rna
@@ -120,6 +121,9 @@ class bpy_ops_submodule_op(object):
self.module = module
self.func = func
+ def poll(self, context=None):
+ return op_poll(self.idname_py(), context)
+
def idname(self):
# submod.foo -> SUBMOD_OT_foo
return self.module.upper() + "_OT_" + self.func
diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py
index 5030e9f4868..84d05a7a48d 100644
--- a/release/scripts/modules/bpy_types.py
+++ b/release/scripts/modules/bpy_types.py
@@ -306,7 +306,9 @@ class Mesh(bpy_types.ID):
Make a mesh from a list of verts/edges/faces
Until we have a nicer way to make geometry, use this.
"""
- self.add_geometry(len(verts), len(edges), len(faces))
+ self.vertices.add(len(verts))
+ self.edges.add(len(edges))
+ self.faces.add(len(faces))
verts_flat = [f for v in verts for f in v]
self.vertices.foreach_set("co", verts_flat)
@@ -318,8 +320,11 @@ class Mesh(bpy_types.ID):
def treat_face(f):
if len(f) == 3:
- return f[0], f[1], f[2], 0
- elif f[3] == 0:
+ if f[2] == 0:
+ return f[2], f[0], f[1], 0
+ else:
+ return f[0], f[1], f[2], 0
+ elif f[2] == 0 or f[3] == 0:
return f[3], f[0], f[1], f[2]
return f
diff --git a/release/scripts/modules/rigify/neck_flex.py b/release/scripts/modules/rigify/neck_flex.py
index 1ab14e281b9..7daf3d3bb4b 100644
--- a/release/scripts/modules/rigify/neck_flex.py
+++ b/release/scripts/modules/rigify/neck_flex.py
@@ -262,7 +262,7 @@ def main(obj, bone_definition, base_names, options):
fcurve = ex.head_ctrl_p.driver_add('["bend_tot"]')
driver = fcurve.driver
driver.type = 'SUM'
- fcurve.modifiers.remove(0) # grr dont need a modifier
+ fcurve.modifiers.remove(fcurve.modifiers[0]) # grr dont need a modifier
for i in range(len(neck_chain)):
var = driver.variables.new()
@@ -301,7 +301,7 @@ def main(obj, bone_definition, base_names, options):
driver.type = 'SCRIPTED'
driver.expression = "bend/bend_tot"
- fcurve.modifiers.remove(0) # grr dont need a modifier
+ fcurve.modifiers.remove(fcurve.modifiers[0]) # grr dont need a modifier
# add target
diff --git a/release/scripts/modules/rigify/palm_curl.py b/release/scripts/modules/rigify/palm_curl.py
index 369d6928e45..c063e2b31c9 100644
--- a/release/scripts/modules/rigify/palm_curl.py
+++ b/release/scripts/modules/rigify/palm_curl.py
@@ -194,7 +194,7 @@ def main(obj, bone_definition, base_names, options):
driver.expression = "(1.0-cos(x))-s"
for fcurve in driver_fcurves:
- fcurve.modifiers.remove(0) # grr dont need a modifier
+ fcurve.modifiers.remove(fcurve.modifiers[0]) # grr dont need a modifier
var = driver.variables.new()
var.name = "x"
diff --git a/release/scripts/modules/rigify/spine_pivot_flex.py b/release/scripts/modules/rigify/spine_pivot_flex.py
index 645ee4045cc..7782380eedb 100644
--- a/release/scripts/modules/rigify/spine_pivot_flex.py
+++ b/release/scripts/modules/rigify/spine_pivot_flex.py
@@ -353,7 +353,7 @@ def main(obj, bone_definition, base_names, options):
fcurve = ex.ribcage_copy_p.driver_add('["bend_tot"]')
driver = fcurve.driver
driver.type = 'SUM'
- fcurve.modifiers.remove(0) # grr dont need a modifier
+ fcurve.modifiers.remove(fcurve.modifiers[0]) # grr dont need a modifier
for i in range(spine_chain_len - 1):
var = driver.variables.new()
@@ -390,7 +390,7 @@ def main(obj, bone_definition, base_names, options):
driver.type = 'SCRIPTED'
driver.expression = "bend/bend_tot"
- fcurve.modifiers.remove(0) # grr dont need a modifier
+ fcurve.modifiers.remove(fcurve.modifiers[0]) # grr dont need a modifier
# add target
diff --git a/release/scripts/modules/rigify/tongue.py b/release/scripts/modules/rigify/tongue.py
index fd32f3d0556..36c4316adc5 100644
--- a/release/scripts/modules/rigify/tongue.py
+++ b/release/scripts/modules/rigify/tongue.py
@@ -266,7 +266,7 @@ def main(obj, bone_definition, base_names, options):
fcurve = ex.head_ctrl_p.driver_add('["bend_tot"]')
driver = fcurve.driver
driver.type = 'SUM'
- fcurve.modifiers.remove(0) # grr dont need a modifier
+ fcurve.modifiers.remove(fcurve.modifiers[0]) # grr dont need a modifier
for i in range(len(neck_chain)):
var = driver.variables.new()
@@ -313,7 +313,7 @@ def main(obj, bone_definition, base_names, options):
driver.type = 'SCRIPTED'
driver.expression = "bend/bend_tot"
- fcurve.modifiers.remove(0) # grr dont need a modifier
+ fcurve.modifiers.remove(fcurve.modifiers[0]) # grr dont need a modifier
# add target
diff --git a/release/scripts/modules/rigify_utils.py b/release/scripts/modules/rigify_utils.py
index a270af949da..1ffe366e0d5 100644
--- a/release/scripts/modules/rigify_utils.py
+++ b/release/scripts/modules/rigify_utils.py
@@ -157,7 +157,7 @@ def blend_bone_list(obj, apply_bones, from_bones, to_bones, target_bone=None, ta
fcurve = con.driver_add("influence")
driver = fcurve.driver
driver.type = 'AVERAGE'
- fcurve.modifiers.remove(0) # grr dont need a modifier
+ fcurve.modifiers.remove(fcurve.modifiers[0]) # grr dont need a modifier
blend_target(driver)
diff --git a/release/scripts/modules/rna_prop_ui.py b/release/scripts/modules/rna_prop_ui.py
index 63762855737..4a9460d8271 100644
--- a/release/scripts/modules/rna_prop_ui.py
+++ b/release/scripts/modules/rna_prop_ui.py
@@ -84,6 +84,8 @@ def draw(layout, context, context_member, use_edit=True):
props.data_path = context_member
del row
+ rna_properties = {prop.identifier for prop in rna_item.bl_rna.properties if prop.is_runtime} if items else None
+
for key, val in items:
if key == '_RNA_UI':
@@ -113,7 +115,10 @@ def draw(layout, context, context_member, use_edit=True):
if convert_to_pyobject and not hasattr(val_orig, "len"):
row.label(text=val_draw)
else:
- row.prop(rna_item, '["%s"]' % key, text="")
+ if key in rna_properties:
+ row.prop(rna_item, key, text="")
+ else:
+ row.prop(rna_item, '["%s"]' % key, text="")
if use_edit:
row = split.row(align=True)
@@ -130,11 +135,11 @@ class PropertyPanel():
and the variable '_context_path' MUST be set.
"""
bl_label = "Custom Properties"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
- bool(eval("context.%s" % cls._context_path))
+ return bool(eval("context.%s" % cls._context_path))
def draw(self, context):
draw(self.layout, context, self._context_path)
diff --git a/release/scripts/op/add_mesh_torus.py b/release/scripts/op/add_mesh_torus.py
index e19f2b4e18c..70e394671fe 100644
--- a/release/scripts/op/add_mesh_torus.py
+++ b/release/scripts/op/add_mesh_torus.py
@@ -121,7 +121,9 @@ class AddTorus(bpy.types.Operator):
mesh = bpy.data.meshes.new("Torus")
- mesh.add_geometry(int(len(verts_loc) / 3), 0, int(len(faces) / 4))
+ mesh.vertices.add(len(verts_loc) // 3)
+ mesh.faces.add(len(faces) // 4)
+
mesh.vertices.foreach_set("co", verts_loc)
mesh.faces.foreach_set("vertices_raw", faces)
mesh.update()
@@ -133,7 +135,7 @@ class AddTorus(bpy.types.Operator):
def menu_func(self, context):
- self.layout.operator(AddTorus.bl_idname, text="Torus", icon='MESH_DONUT')
+ self.layout.operator(AddTorus.bl_idname, text="Torus", icon='MESH_TORUS')
def register():
diff --git a/release/scripts/op/animsys_update.py b/release/scripts/op/animsys_update.py
index 0fe03a0cc4d..698021fca7f 100755..100644
--- a/release/scripts/op/animsys_update.py
+++ b/release/scripts/op/animsys_update.py
@@ -681,7 +681,7 @@ import bpy
class UpdateAnimData(bpy.types.Operator):
- ''''''
+ '''Update data paths from 2.53 to edited data paths of drivers and fcurves'''
bl_idname = "anim.update_data_paths"
bl_label = "Update Animation Data"
@@ -696,4 +696,4 @@ if __name__ == "__main__":
bpy.ops.anim.update_data_paths()
def register():
- pass \ No newline at end of file
+ pass
diff --git a/release/scripts/op/io_anim_bvh/__init__.py b/release/scripts/op/io_anim_bvh/__init__.py
new file mode 100644
index 00000000000..6b529f87dd7
--- /dev/null
+++ b/release/scripts/op/io_anim_bvh/__init__.py
@@ -0,0 +1,74 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+# To support reload properly, try to access a package var, if it's there, reload everything
+if "bpy" in locals():
+ # only reload if we alredy loaded, highly annoying
+ import sys
+ reload(sys.modules.get("io_mesh_ply.export_ply", sys))
+
+
+import bpy
+from bpy.props import *
+from io_utils import ImportHelper
+
+
+class BvhImporter(bpy.types.Operator, ImportHelper):
+ '''Load a OBJ Motion Capture File'''
+ bl_idname = "import_anim.bvh"
+ bl_label = "Import BVH"
+
+ filename_ext = ".bvh"
+
+ scale = FloatProperty(name="Scale", description="Scale the BVH by this value", min=0.0001, max=1000000.0, soft_min=0.001, soft_max=100.0, default=0.1)
+ frame_start = IntProperty(name="Start Frame", description="Starting frame for the animation", default=1)
+ loop = BoolProperty(name="Loop", description="Loop the animation playback", default=False)
+ rotate_mode = EnumProperty(items=(
+ ('QUATERNION', "Quaternion", "Convert rotations to quaternions"),
+ ('NATIVE', "Euler (Native)", "Use the rotation order defined in the BVH file"),
+ ('XYZ', "Euler (XYZ)", "Convert rotations to euler XYZ"),
+ ('XZY', "Euler (XZY)", "Convert rotations to euler XZY"),
+ ('YXZ', "Euler (YXZ)", "Convert rotations to euler YXZ"),
+ ('YZX', "Euler (YZX)", "Convert rotations to euler YZX"),
+ ('ZXY', "Euler (ZXY)", "Convert rotations to euler ZXY"),
+ ('ZYX', "Euler (ZYX)", "Convert rotations to euler ZYX"),
+ ),
+ name="Rotation",
+ description="Rotation conversion.",
+ default='NATIVE')
+
+ def execute(self, context):
+ import io_anim_bvh.import_bvh
+ return io_anim_bvh.import_bvh.load(self, context, **self.properties)
+
+
+def menu_func(self, context):
+ self.layout.operator(BvhImporter.bl_idname, text="Motion Capture (.bvh)")
+
+
+def register():
+ bpy.types.INFO_MT_file_import.append(menu_func)
+
+
+def unregister():
+ bpy.types.INFO_MT_file_import.remove(menu_func)
+
+if __name__ == "__main__":
+ register()
diff --git a/release/scripts/io/import_anim_bvh.py b/release/scripts/op/io_anim_bvh/import_bvh.py
index 04cae915a49..5f9de6cbd90 100644
--- a/release/scripts/io/import_anim_bvh.py
+++ b/release/scripts/op/io_anim_bvh/import_bvh.py
@@ -18,6 +18,8 @@
# <pep8 compliant>
+# Script copyright (C) Campbell Barton
+
import math
from math import radians
@@ -349,7 +351,7 @@ def bvh_node_dict2armature(context, bvh_nodes, ROT_MODE='XYZ', IMPORT_START_FRAM
for ob in scn.objects:
ob.select = False
- scn.set_frame(IMPORT_START_FRAME)
+ scn.frame_set(IMPORT_START_FRAME)
arm_data = bpy.data.armatures.new("MyBVH")
arm_ob = bpy.data.objects.new("MyBVH", arm_data)
@@ -553,70 +555,24 @@ def bvh_node_dict2armature(context, bvh_nodes, ROT_MODE='XYZ', IMPORT_START_FRAM
return arm_ob
-from bpy.props import *
-
-
-class BvhImporter(bpy.types.Operator):
- '''Load a OBJ Motion Capture File'''
- bl_idname = "import_anim.bvh"
- bl_label = "Import BVH"
-
- filepath = StringProperty(name="File Path", description="Filepath used for importing the OBJ file", maxlen=1024, default="")
- scale = FloatProperty(name="Scale", description="Scale the BVH by this value", min=0.0001, max=1000000.0, soft_min=0.001, soft_max=100.0, default=0.1)
- frame_start = IntProperty(name="Start Frame", description="Starting frame for the animation", default=1)
- loop = BoolProperty(name="Loop", description="Loop the animation playback", default=False)
- rotate_mode = EnumProperty(items=(
- ('QUATERNION', "Quaternion", "Convert rotations to quaternions"),
- ('NATIVE', "Euler (Native)", "Use the rotation order defined in the BVH file"),
- ('XYZ', "Euler (XYZ)", "Convert rotations to euler XYZ"),
- ('XZY', "Euler (XZY)", "Convert rotations to euler XZY"),
- ('YXZ', "Euler (YXZ)", "Convert rotations to euler YXZ"),
- ('YZX', "Euler (YZX)", "Convert rotations to euler YZX"),
- ('ZXY', "Euler (ZXY)", "Convert rotations to euler ZXY"),
- ('ZYX', "Euler (ZYX)", "Convert rotations to euler ZYX"),
- ),
- name="Rotation",
- description="Rotation conversion.",
- default='NATIVE')
-
- def execute(self, context):
- # print("Selected: " + context.active_object.name)
- import time
- t1 = time.time()
- print('\tparsing bvh...', end="")
-
- bvh_nodes = read_bvh(context, self.properties.filepath,
- ROT_MODE=self.properties.rotate_mode,
- GLOBAL_SCALE=self.properties.scale)
-
- print('%.4f' % (time.time() - t1))
- t1 = time.time()
- print('\timporting to blender...', end="")
-
- bvh_node_dict2armature(context, bvh_nodes,
- ROT_MODE=self.properties.rotate_mode,
- IMPORT_START_FRAME=self.properties.frame_start,
- IMPORT_LOOP=self.properties.loop)
-
- print('Done in %.4f\n' % (time.time() - t1))
- return {'FINISHED'}
-
- def invoke(self, context, event):
- wm = context.manager
- wm.add_fileselect(self)
- return {'RUNNING_MODAL'}
-
-
-def menu_func(self, context):
- self.layout.operator(BvhImporter.bl_idname, text="Motion Capture (.bvh)")
-
+def load(operator, context, filepath="", rotate_mode='NATIVE', scale=1.0, use_cyclic=False, frame_start=1):
+ import time
+ t1 = time.time()
+ print('\tparsing bvh %r...' % filepath, end="")
-def register():
- bpy.types.INFO_MT_file_import.append(menu_func)
+ bvh_nodes = read_bvh(context, filepath,
+ ROT_MODE=rotate_mode,
+ GLOBAL_SCALE=scale)
+ print('%.4f' % (time.time() - t1))
+ t1 = time.time()
+ print('\timporting to blender...', end="")
-def unregister():
- bpy.types.INFO_MT_file_import.remove(menu_func)
+ bvh_node_dict2armature(context, bvh_nodes,
+ ROT_MODE=rotate_mode,
+ IMPORT_START_FRAME=frame_start,
+ IMPORT_LOOP=use_cyclic)
-if __name__ == "__main__":
- register()
+ print('Done in %.4f\n' % (time.time() - t1))
+
+ return {'FINISHED'}
diff --git a/release/scripts/op/io_mesh_ply/__init__.py b/release/scripts/op/io_mesh_ply/__init__.py
new file mode 100644
index 00000000000..c174b16f46c
--- /dev/null
+++ b/release/scripts/op/io_mesh_ply/__init__.py
@@ -0,0 +1,76 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# To support reload properly, try to access a package var, if it's there, reload everything
+if "bpy" in locals():
+ import sys
+ reload(sys.modules.get("io_mesh_ply.export_ply", sys))
+
+
+import bpy
+from bpy.props import *
+from io_utils import ExportHelper
+
+
+class ExportPLY(bpy.types.Operator, ExportHelper):
+ '''Export a single object as a stanford PLY with normals, colours and texture coordinates.'''
+ bl_idname = "export.ply"
+ bl_label = "Export PLY"
+
+ filename_ext = ".ply"
+
+ use_modifiers = BoolProperty(name="Apply Modifiers", description="Apply Modifiers to the exported mesh", default=True)
+ use_normals = BoolProperty(name="Normals", description="Export Normals for smooth and hard shaded faces", default=True)
+ use_uv_coords = BoolProperty(name="UVs", description="Exort the active UV layer", default=True)
+ use_colors = BoolProperty(name="Vertex Colors", description="Exort the active vertex color layer", default=True)
+
+ @classmethod
+ def poll(cls, context):
+ return context.active_object != None
+
+ def execute(self, context):
+ filepath = self.properties.filepath
+ filepath = bpy.path.ensure_ext(filepath, self.filename_ext)
+ import io_mesh_ply.export_ply
+ return io_mesh_ply.export_ply.save(self, context, **self.properties)
+
+ def draw(self, context):
+ layout = self.layout
+ props = self.properties
+
+ row = layout.row()
+ row.prop(props, "use_modifiers")
+ row.prop(props, "use_normals")
+ row = layout.row()
+ row.prop(props, "use_uv_coords")
+ row.prop(props, "use_colors")
+
+
+def menu_func(self, context):
+ self.layout.operator(ExportPLY.bl_idname, text="Stanford (.ply)")
+
+
+def register():
+ bpy.types.INFO_MT_file_export.append(menu_func)
+
+
+def unregister():
+ bpy.types.INFO_MT_file_export.remove(menu_func)
+
+if __name__ == "__main__":
+ register()
diff --git a/release/scripts/op/io_mesh_ply/export_ply.py b/release/scripts/op/io_mesh_ply/export_ply.py
new file mode 100644
index 00000000000..aef4df43841
--- /dev/null
+++ b/release/scripts/op/io_mesh_ply/export_ply.py
@@ -0,0 +1,206 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+# Copyright (C) 2004, 2005: Bruce Merry, bmerry@cs.uct.ac.za
+# Contributors: Bruce Merry, Campbell Barton
+
+"""
+This script exports Stanford PLY files from Blender. It supports normals,
+colours, and texture coordinates per face or per vertex.
+Only one mesh can be exported at a time.
+"""
+
+import bpy
+import os
+
+
+def save(operator, context, filepath="", use_modifiers=True, use_normals=True, use_uv_coords=True, use_colors=True):
+
+ def rvec3d(v):
+ return round(v[0], 6), round(v[1], 6), round(v[2], 6)
+
+
+ def rvec2d(v):
+ return round(v[0], 6), round(v[1], 6)
+
+ scene = context.scene
+ obj = context.object
+
+ if not obj:
+ raise Exception("Error, Select 1 active object")
+
+ file = open(filepath, 'w')
+
+ if scene.objects.active:
+ bpy.ops.object.mode_set(mode='OBJECT')
+
+ if use_modifiers:
+ mesh = obj.create_mesh(scene, True, 'PREVIEW')
+ else:
+ mesh = obj.data
+
+ if not mesh:
+ raise Exception("Error, could not get mesh data from active object")
+
+ # mesh.transform(obj.matrix_world) # XXX
+
+ faceUV = (len(mesh.uv_textures) > 0)
+ vertexUV = (len(mesh.sticky) > 0)
+ vertexColors = len(mesh.vertex_colors) > 0
+
+ if (not faceUV) and (not vertexUV):
+ use_uv_coords = False
+ if not vertexColors:
+ use_colors = False
+
+ if not use_uv_coords:
+ faceUV = vertexUV = False
+ if not use_colors:
+ vertexColors = False
+
+ if faceUV:
+ active_uv_layer = mesh.uv_textures.active
+ if not active_uv_layer:
+ use_uv_coords = False
+ faceUV = None
+ else:
+ active_uv_layer = active_uv_layer.data
+
+ if vertexColors:
+ active_col_layer = mesh.vertex_colors.active
+ if not active_col_layer:
+ use_colors = False
+ vertexColors = None
+ else:
+ active_col_layer = active_col_layer.data
+
+ # incase
+ color = uvcoord = uvcoord_key = normal = normal_key = None
+
+ mesh_verts = mesh.vertices # save a lookup
+ ply_verts = [] # list of dictionaries
+ # vdict = {} # (index, normal, uv) -> new index
+ vdict = [{} for i in range(len(mesh_verts))]
+ ply_faces = [[] for f in range(len(mesh.faces))]
+ vert_count = 0
+ for i, f in enumerate(mesh.faces):
+
+
+ smooth = f.use_smooth
+ if not smooth:
+ normal = tuple(f.normal)
+ normal_key = rvec3d(normal)
+
+ if faceUV:
+ uv = active_uv_layer[i]
+ uv = uv.uv1, uv.uv2, uv.uv3, uv.uv4 # XXX - crufty :/
+ if vertexColors:
+ col = active_col_layer[i]
+ col = col.color1, col.color2, col.color3, col.color4
+
+ f_verts = f.vertices
+
+ pf = ply_faces[i]
+ for j, vidx in enumerate(f_verts):
+ v = mesh_verts[vidx]
+
+ if smooth:
+ normal = tuple(v.normal)
+ normal_key = rvec3d(normal)
+
+ if faceUV:
+ uvcoord = uv[j][0], 1.0 - uv[j][1]
+ uvcoord_key = rvec2d(uvcoord)
+ elif vertexUV:
+ uvcoord = v.uvco[0], 1.0 - v.uvco[1]
+ uvcoord_key = rvec2d(uvcoord)
+
+ if vertexColors:
+ color = col[j]
+ color = int(color[0] * 255.0), int(color[1] * 255.0), int(color[2] * 255.0)
+
+
+ key = normal_key, uvcoord_key, color
+
+ vdict_local = vdict[vidx]
+ pf_vidx = vdict_local.get(key) # Will be None initially
+
+ if pf_vidx == None: # same as vdict_local.has_key(key)
+ pf_vidx = vdict_local[key] = vert_count
+ ply_verts.append((vidx, normal, uvcoord, color))
+ vert_count += 1
+
+ pf.append(pf_vidx)
+
+ file.write('ply\n')
+ file.write('format ascii 1.0\n')
+ file.write('comment Created by Blender %s - www.blender.org, source file: %r\n' % (bpy.app.version_string, os.path.basename(bpy.data.filepath)))
+
+ file.write('element vertex %d\n' % len(ply_verts))
+
+ file.write('property float x\n')
+ file.write('property float y\n')
+ file.write('property float z\n')
+
+ if use_normals:
+ file.write('property float nx\n')
+ file.write('property float ny\n')
+ file.write('property float nz\n')
+ if use_uv_coords:
+ file.write('property float s\n')
+ file.write('property float t\n')
+ if use_colors:
+ file.write('property uchar red\n')
+ file.write('property uchar green\n')
+ file.write('property uchar blue\n')
+
+ file.write('element face %d\n' % len(mesh.faces))
+ file.write('property list uchar uint vertex_indices\n')
+ file.write('end_header\n')
+
+ for i, v in enumerate(ply_verts):
+ file.write('%.6f %.6f %.6f ' % tuple(mesh_verts[v[0]].co)) # co
+ if use_normals:
+ file.write('%.6f %.6f %.6f ' % v[1]) # no
+ if use_uv_coords:
+ file.write('%.6f %.6f ' % v[2]) # uv
+ if use_colors:
+ file.write('%u %u %u' % v[3]) # col
+ file.write('\n')
+
+ for pf in ply_faces:
+ if len(pf) == 3:
+ file.write('3 %d %d %d\n' % tuple(pf))
+ else:
+ file.write('4 %d %d %d %d\n' % tuple(pf))
+
+ file.close()
+ print("writing %r done" % filepath)
+
+ if use_modifiers:
+ bpy.data.meshes.remove(mesh)
+
+ # XXX
+ """
+ if is_editmode:
+ Blender.Window.EditMode(1, '', 0)
+ """
+
+ return {'FINISHED'}
diff --git a/release/scripts/op/io_scene_3ds/__init__.py b/release/scripts/op/io_scene_3ds/__init__.py
new file mode 100644
index 00000000000..cff8feb7255
--- /dev/null
+++ b/release/scripts/op/io_scene_3ds/__init__.py
@@ -0,0 +1,86 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+# To support reload properly, try to access a package var, if it's there, reload everything
+if "bpy" in locals():
+ import sys
+ reload(sys.modules.get("io_scene_3ds.import_3ds", sys))
+ reload(sys.modules.get("io_scene_3ds.export_3ds", sys))
+
+
+import bpy
+from bpy.props import *
+from io_utils import ImportHelper, ExportHelper
+
+
+class Import3DS(bpy.types.Operator, ImportHelper):
+ '''Import from 3DS file format (.3ds)'''
+ bl_idname = "import_scene.autodesk_3ds"
+ bl_label = 'Import 3DS'
+
+ filename_ext = ".3ds"
+
+ constrain_size = FloatProperty(name="Size Constraint", description="Scale the model by 10 until it reacehs the size constraint. Zero Disables.", min=0.0, max=1000.0, soft_min=0.0, soft_max=1000.0, default=10.0)
+ use_image_search = BoolProperty(name="Image Search", description="Search subdirectories for any assosiated images (Warning, may be slow)", default=True)
+ use_apply_transform = BoolProperty(name="Apply Transform", description="Workaround for object transformations importing incorrectly", default=False)
+
+ def execute(self, context):
+ import io_scene_3ds.import_3ds
+ return io_scene_3ds.import_3ds.load(self, context, **self.properties)
+
+
+class Export3DS(bpy.types.Operator, ExportHelper):
+ '''Export to 3DS file format (.3ds)'''
+ bl_idname = "export_scene.autodesk_3ds"
+ bl_label = 'Export 3DS'
+
+ filename_ext = ".3ds"
+
+ def execute(self, context):
+ import io_scene_3ds.export_3ds
+ return io_scene_3ds.export_3ds.save(self, context, **self.properties)
+
+
+# Add to a menu
+def menu_func_export(self, context):
+ self.layout.operator(Export3DS.bl_idname, text="3D Studio (.3ds)")
+
+def menu_func_import(self, context):
+ self.layout.operator(Import3DS.bl_idname, text="3D Studio (.3ds)")
+
+def register():
+ bpy.types.INFO_MT_file_import.append(menu_func_import)
+ bpy.types.INFO_MT_file_export.append(menu_func_export)
+
+
+def unregister():
+ bpy.types.INFO_MT_file_import.remove(menu_func_import)
+ bpy.types.INFO_MT_file_export.remove(menu_func_export)
+
+if __name__ == "__main__":
+ register()
+
+# NOTES:
+# why add 1 extra vertex? and remove it when done? - "Answer - eekadoodle - would need to re-order UV's without this since face order isnt always what we give blender, BMesh will solve :D"
+# disabled scaling to size, this requires exposing bb (easy) and understanding how it works (needs some time)
+
+if __name__ == "__main__":
+ register()
+
diff --git a/release/scripts/io/export_3ds.py b/release/scripts/op/io_scene_3ds/export_3ds.py
index 4a5521bd9e9..3d1cc02a8d8 100644
--- a/release/scripts/io/export_3ds.py
+++ b/release/scripts/op/io_scene_3ds/export_3ds.py
@@ -1,4 +1,3 @@
-# coding: utf-8
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
@@ -19,157 +18,95 @@
# <pep8 compliant>
-__author__ = ["Campbell Barton", "Bob Holcomb", "Richard Lärkäng", "Damien McGinnes", "Mark Stijnman"]
-__url__ = ("blenderartists.org", "www.blender.org", "www.gametutorials.com", "lib3ds.sourceforge.net/")
-__version__ = "0.90a"
-__bpydoc__ = """\
-
-3ds Exporter
-
-This script Exports a 3ds file.
+# Script copyright (C) Bob Holcomb
+# Contributors: Campbell Barton, Bob Holcomb, Richard Lärkäng, Damien McGinnes, Mark Stijnman
+"""
Exporting is based on 3ds loader from www.gametutorials.com(Thanks DigiBen) and using information
from the lib3ds project (http://lib3ds.sourceforge.net/) sourcecode.
"""
-# ***** BEGIN GPL LICENSE BLOCK *****
-#
-# Script copyright (C) Bob Holcomb
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# ***** END GPL LICENCE BLOCK *****
-# --------------------------------------------------------------------------
-
-
-######################################################
-# Importing modules
-######################################################
-
-import struct
-import os
-import time
-
-import bpy
-
-# import Blender
-# from BPyMesh import getMeshFromObject
-# from BPyObject import getDerivedObjects
-# try:
-# import struct
-# except:
-# struct = None
-
-# also used by X3D exporter
-# return a tuple (free, object list), free is True if memory should be freed later with free_derived_objects()
-def create_derived_objects(scene, ob):
- if ob.parent and ob.parent.dupli_type != 'NONE':
- return False, None
-
- if ob.dupli_type != 'NONE':
- ob.create_dupli_list(scene)
- return True, [(dob.object, dob.matrix) for dob in ob.dupli_list]
- else:
- return False, [(ob, ob.matrix_world)]
-
-# also used by X3D exporter
-def free_derived_objects(ob):
- ob.free_dupli_list()
-
-# So 3ds max can open files, limit names to 12 in length
-# this is verry annoying for filenames!
-name_unique = []
-name_mapping = {}
-def sane_name(name):
- name_fixed = name_mapping.get(name)
- if name_fixed != None:
- return name_fixed
-
- if len(name) > 12:
- new_name = name[:12]
- else:
- new_name = name
-
- i = 0
-
- while new_name in name_unique:
- new_name = new_name[:-4] + '.%.3d' % i
- i+=1
-
- name_unique.append(new_name)
- name_mapping[name] = new_name
- return new_name
-
######################################################
# Data Structures
######################################################
#Some of the chunks that we will export
#----- Primary Chunk, at the beginning of each file
-PRIMARY= int("0x4D4D",16)
+PRIMARY= 0x4D4D
#------ Main Chunks
-OBJECTINFO = int("0x3D3D",16); #This gives the version of the mesh and is found right before the material and object information
-VERSION = int("0x0002",16); #This gives the version of the .3ds file
-KFDATA = int("0xB000",16); #This is the header for all of the key frame info
+OBJECTINFO = 0x3D3D #This gives the version of the mesh and is found right before the material and object information
+VERSION = 0x0002 #This gives the version of the .3ds file
+KFDATA = 0xB000 #This is the header for all of the key frame info
#------ sub defines of OBJECTINFO
MATERIAL=45055 #0xAFFF // This stored the texture info
OBJECT=16384 #0x4000 // This stores the faces, vertices, etc...
#>------ sub defines of MATERIAL
-MATNAME = int("0xA000",16); # This holds the material name
-MATAMBIENT = int("0xA010",16); # Ambient color of the object/material
-MATDIFFUSE = int("0xA020",16); # This holds the color of the object/material
-MATSPECULAR = int("0xA030",16); # SPecular color of the object/material
-MATSHINESS = int("0xA040",16); # ??
-MATMAP = int("0xA200",16); # This is a header for a new material
-MATMAPFILE = int("0xA300",16); # This holds the file name of the texture
+MATNAME = 0xA000 # This holds the material name
+MATAMBIENT = 0xA010 # Ambient color of the object/material
+MATDIFFUSE = 0xA020 # This holds the color of the object/material
+MATSPECULAR = 0xA030 # SPecular color of the object/material
+MATSHINESS = 0xA040 # ??
+MATMAP = 0xA200 # This is a header for a new material
+MATMAPFILE = 0xA300 # This holds the file name of the texture
-RGB1= int("0x0011",16)
-RGB2= int("0x0012",16)
+RGB1= 0x0011
+RGB2= 0x0012
#>------ sub defines of OBJECT
-OBJECT_MESH = int("0x4100",16); # This lets us know that we are reading a new object
-OBJECT_LIGHT = int("0x4600",16); # This lets un know we are reading a light object
-OBJECT_CAMERA= int("0x4700",16); # This lets un know we are reading a camera object
+OBJECT_MESH = 0x4100 # This lets us know that we are reading a new object
+OBJECT_LIGHT = 0x4600 # This lets un know we are reading a light object
+OBJECT_CAMERA= 0x4700 # This lets un know we are reading a camera object
#>------ sub defines of CAMERA
-OBJECT_CAM_RANGES= int("0x4720",16); # The camera range values
+OBJECT_CAM_RANGES= 0x4720 # The camera range values
#>------ sub defines of OBJECT_MESH
-OBJECT_VERTICES = int("0x4110",16); # The objects vertices
-OBJECT_FACES = int("0x4120",16); # The objects faces
-OBJECT_MATERIAL = int("0x4130",16); # This is found if the object has a material, either texture map or color
-OBJECT_UV = int("0x4140",16); # The UV texture coordinates
-OBJECT_TRANS_MATRIX = int("0x4160",16); # The Object Matrix
+OBJECT_VERTICES = 0x4110 # The objects vertices
+OBJECT_FACES = 0x4120 # The objects faces
+OBJECT_MATERIAL = 0x4130 # This is found if the object has a material, either texture map or color
+OBJECT_UV = 0x4140 # The UV texture coordinates
+OBJECT_TRANS_MATRIX = 0x4160 # The Object Matrix
#>------ sub defines of KFDATA
-KFDATA_KFHDR = int("0xB00A",16);
-KFDATA_KFSEG = int("0xB008",16);
-KFDATA_KFCURTIME = int("0xB009",16);
-KFDATA_OBJECT_NODE_TAG = int("0xB002",16);
+KFDATA_KFHDR = 0xB00A
+KFDATA_KFSEG = 0xB008
+KFDATA_KFCURTIME = 0xB009
+KFDATA_OBJECT_NODE_TAG = 0xB002
#>------ sub defines of OBJECT_NODE_TAG
-OBJECT_NODE_ID = int("0xB030",16);
-OBJECT_NODE_HDR = int("0xB010",16);
-OBJECT_PIVOT = int("0xB013",16);
-OBJECT_INSTANCE_NAME = int("0xB011",16);
-POS_TRACK_TAG = int("0xB020",16);
-ROT_TRACK_TAG = int("0xB021",16);
-SCL_TRACK_TAG = int("0xB022",16);
+OBJECT_NODE_ID = 0xB030
+OBJECT_NODE_HDR = 0xB010
+OBJECT_PIVOT = 0xB013
+OBJECT_INSTANCE_NAME = 0xB011
+POS_TRACK_TAG = 0xB020
+ROT_TRACK_TAG = 0xB021
+SCL_TRACK_TAG = 0xB022
+
+import struct
+
+# So 3ds max can open files, limit names to 12 in length
+# this is verry annoying for filenames!
+name_unique = []
+name_mapping = {}
+def sane_name(name):
+ name_fixed = name_mapping.get(name)
+ if name_fixed is not None:
+ return name_fixed
+
+ new_name = name[:12]
+
+ i = 0
+
+ while new_name in name_unique:
+ new_name = new_name[:-4] + '.%.3d' % i
+ i+=1
+
+ name_unique.append(new_name)
+ name_mapping[name] = new_name
+ return new_name
def uv_key(uv):
return round(uv[0], 6), round(uv[1], 6)
@@ -379,7 +316,7 @@ class _3ds_named_variable(object):
if (self.value!=None):
spaces=""
for i in range(indent):
- spaces+=" ";
+ spaces += " "
if (self.name!=""):
print(spaces, self.name, " = ", self.value)
else:
@@ -444,7 +381,7 @@ class _3ds_chunk(object):
Uses the dump function of the named variables and the subchunks to do the actual work.'''
spaces=""
for i in range(indent):
- spaces+=" ";
+ spaces += " "
print(spaces, "ID=", hex(self.ID.value), "size=", self.get_size())
for variable in self.variables:
variable.dump(indent+1)
@@ -479,11 +416,11 @@ def make_material_subchunk(id, color):
Used for color subchunks, such as diffuse color or ambient color subchunks.'''
mat_sub = _3ds_chunk(id)
col1 = _3ds_chunk(RGB1)
- col1.add_variable("color1", _3ds_rgb_color(color));
+ col1.add_variable("color1", _3ds_rgb_color(color))
mat_sub.add_subchunk(col1)
# optional:
# col2 = _3ds_chunk(RGB1)
-# col2.add_variable("color2", _3ds_rgb_color(color));
+# col2.add_variable("color2", _3ds_rgb_color(color))
# mat_sub.add_subchunk(col2)
return mat_sub
@@ -567,7 +504,7 @@ def extract_triangles(mesh):
f_v = face.vertices
# f_v = face.v
- uf = mesh.active_uv_texture.data[i] if do_uv else None
+ uf = mesh.uv_textures.active.data[i] if do_uv else None
if do_uv:
f_uv = uf.uv
@@ -921,27 +858,21 @@ def make_kf_obj_node(obj, name_to_id):
return kf_obj_node
"""
-# import BPyMessages
-def write(filename, context):
+
+def save(operator, context, filepath=""):
+ import bpy
+ import time
+ from io_utils import create_derived_objects, free_derived_objects
+
'''Save the Blender scene to a 3ds file.'''
+
# Time the export
-
- if not filename.lower().endswith('.3ds'):
- filename += '.3ds'
-
- # XXX
-# if not BPyMessages.Warning_SaveOver(filename):
-# return
-
- # XXX
time1 = time.clock()
-# time1= Blender.sys.time()
# Blender.Window.WaitCursor(1)
sce = context.scene
-# sce= bpy.data.scenes.active
- if context.object:
+ if bpy.ops.object.mode_set.poll():
bpy.ops.object.mode_set(mode='OBJECT')
# Initialize the main chunk (primary):
@@ -998,7 +929,7 @@ def write(filename, context):
if not mat_ls:
mat = mat_name = None
- for f, uf in zip(data.faces, data.active_uv_texture.data):
+ for f, uf in zip(data.faces, data.uv_textures.active.data):
if mat_ls:
mat_index = f.material_index
# mat_index = f.mat
@@ -1090,7 +1021,7 @@ def write(filename, context):
# Check the size:
primary.get_size()
# Open the file for writing:
- file = open( filename, 'wb' )
+ file = open(filepath, 'wb')
# Recursively write the chunks to file:
primary.write(file)
@@ -1098,56 +1029,15 @@ def write(filename, context):
# Close the file:
file.close()
+ # Clear name mapping vars, could make locals too
+ name_unique[:] = []
+ name_mapping.clear()
+
# Debugging only: report the exporting time:
# Blender.Window.WaitCursor(0)
print("3ds export time: %.2f" % (time.clock() - time1))
-# print("3ds export time: %.2f" % (Blender.sys.time() - time1))
# Debugging only: dump the chunk hierarchy:
#primary.dump()
-
-
-# # write('/test_b.3ds')
-from bpy.props import *
-class Export3DS(bpy.types.Operator):
- '''Export to 3DS file format (.3ds)'''
- bl_idname = "export.autodesk_3ds"
- bl_label = 'Export 3DS'
-
- filepath = StringProperty(name="File Path", description="Filepath used for exporting the 3DS file", maxlen= 1024, default= "")
- check_existing = BoolProperty(name="Check Existing", description="Check and warn on overwriting existing files", default=True, options={'HIDDEN'})
-
- @classmethod
- def poll(cls, context): # Poll isnt working yet
- return context.active_object != None
-
- def execute(self, context):
- filepath = self.properties.filepath
- filepath = bpy.path.ensure_ext(filepath, ".3ds")
-
- write(filepath, context)
- return {'FINISHED'}
-
- def invoke(self, context, event):
- import os
- if not self.properties.is_property_set("filepath"):
- self.properties.filepath = os.path.splitext(bpy.data.filepath)[0] + ".3ds"
-
- context.manager.add_fileselect(self)
- return {'RUNNING_MODAL'}
-
-
-# Add to a menu
-def menu_func(self, context):
- self.layout.operator(Export3DS.bl_idname, text="3D Studio (.3ds)")
-
-
-def register():
- bpy.types.INFO_MT_file_export.append(menu_func)
-
-
-def unregister():
- bpy.types.INFO_MT_file_export.remove(menu_func)
-
-if __name__ == "__main__":
- register()
+
+ return {'FINISHED'}
diff --git a/release/scripts/io/import_scene_3ds.py b/release/scripts/op/io_scene_3ds/import_3ds.py
index 6378d93df62..0eed3562b7b 100644
--- a/release/scripts/io/import_scene_3ds.py
+++ b/release/scripts/op/io_scene_3ds/import_3ds.py
@@ -18,130 +18,14 @@
# <pep8 compliant>
-__author__= ['Bob Holcomb', 'Richard L?rk?ng', 'Damien McGinnes', 'Campbell Barton', 'Mario Lapin']
-__url__ = ("blenderartists.org", "www.blender.org", "www.gametutorials.com", "lib3ds.sourceforge.net/")
-__version__= '0.996'
-__bpydoc__= '''\
-
-3ds Importer
-
-This script imports a 3ds file and the materials into Blender for editing.
-
-Loader is based on 3ds loader from www.gametutorials.com (Thanks DigiBen).
-
-0.996 by Mario Lapin (mario.lapin@gmail.com) 13/04/200 <br>
- - Implemented workaround to correct association between name, geometry and materials of
- imported meshes.
-
- Without this patch, version 0.995 of this importer would associate to each mesh object the
- geometry and the materials of the previously parsed mesh object. By so, the name of the
- first mesh object would be thrown away, and the name of the last mesh object would be
- automatically merged with a '.001' at the end. No object would desappear, however object's
- names and materials would be completely jumbled.
-
-0.995 by Campbell Barton<br>
-- workaround for buggy mesh vert delete
-- minor tweaks
-
-0.99 by Bob Holcomb<br>
-- added support for floating point color values that previously broke on import.
-
-0.98 by Campbell Barton<br>
-- import faces and verts to lists instead of a mesh, convert to a mesh later
-- use new index mapping feature of mesh to re-map faces that were not added.
-
-0.97 by Campbell Barton<br>
-- Strip material names of spaces
-- Added import as instance to import the 3ds into its own
- scene and add a group instance to the current scene
-- New option to scale down imported objects so they are within a limited bounding area.
-
-0.96 by Campbell Barton<br>
-- Added workaround for bug in setting UV's for Zero vert index UV faces.
-- Removed unique name function, let blender make the names unique.
-
-0.95 by Campbell Barton<br>
-- Removed workarounds for Blender 2.41
-- Mesh objects split by material- many 3ds objects used more then 16 per mesh.
-- Removed a lot of unneeded variable creation.
-
-0.94 by Campbell Barton<br>
-- Face import tested to be about overall 16x speedup over 0.93.
-- Material importing speedup.
-- Tested with more models.
-- Support some corrupt models.
-
-0.93 by Campbell Barton<br>
-- Tested with 400 3ds files from turbosquid and samples.
-- Tactfully ignore faces that used the same verts twice.
-- Rollback to 0.83 sloppy un-reorganized code, this broke UV coord loading.
-- Converted from NMesh to Mesh.
-- Faster and cleaner new names.
-- Use external comprehensive image loader.
-- Re intergrated 0.92 and 0.9 changes
-- Fixes for 2.41 compat.
-- Non textured faces do not use a texture flag.
-
-0.92<br>
-- Added support for diffuse, alpha, spec, bump maps in a single material
-
-0.9<br>
-- Reorganized code into object/material block functions<br>
-- Use of Matrix() to copy matrix data<br>
-- added support for material transparency<br>
-
-0.83 2005-08-07: Campell Barton
-- Aggressive image finding and case insensitivy for posisx systems.
-
-0.82a 2005-07-22
-- image texture loading (both for face uv and renderer)
-
-0.82 - image texture loading (for face uv)
-
-0.81a (fork- not 0.9) Campbell Barton 2005-06-08
-- Simplified import code
-- Never overwrite data
-- Faster list handling
-- Leaves import selected
-
-0.81 Damien McGinnes 2005-01-09
-- handle missing images better
-
-0.8 Damien McGinnes 2005-01-08
-- copies sticky UV coords to face ones
-- handles images better
-- Recommend that you run 'RemoveDoubles' on each imported mesh after using this script
-
-'''
-
-# ***** BEGIN GPL LICENSE BLOCK *****
-#
# Script copyright (C) Bob Holcomb
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# ***** END GPL LICENCE BLOCK *****
-# --------------------------------------------------------------------------
-
-# Importing modules
+# Contributors: Bob Holcomb, Richard L?rk?ng, Damien McGinnes, Campbell Barton, Mario Lapin
import os
import time
import struct
-from import_scene_obj import load_image
+from io_utils import load_image
import bpy
import mathutils
@@ -158,9 +42,9 @@ BOUNDS_3DS = []
PRIMARY = int('0x4D4D',16)
#------ Main Chunks
-OBJECTINFO = int('0x3D3D',16); #This gives the version of the mesh and is found right before the material and object information
-VERSION = int('0x0002',16); #This gives the version of the .3ds file
-EDITKEYFRAME= int('0xB000',16); #This is the header for all of the key frame info
+OBJECTINFO = 0x3D3D #This gives the version of the mesh and is found right before the material and object information
+VERSION = 0x0002 #This gives the version of the .3ds file
+EDITKEYFRAME= 0xB000 #This is the header for all of the key frame info
#------ sub defines of OBJECTINFO
MATERIAL = 45055 #0xAFFF // This stored the texture info
@@ -168,62 +52,62 @@ OBJECT = 16384 #0x4000 // This stores the faces, vertices, etc...
#>------ sub defines of MATERIAL
#------ sub defines of MATERIAL_BLOCK
-MAT_NAME = int('0xA000',16) # This holds the material name
-MAT_AMBIENT = int('0xA010',16) # Ambient color of the object/material
-MAT_DIFFUSE = int('0xA020',16) # This holds the color of the object/material
-MAT_SPECULAR = int('0xA030',16) # SPecular color of the object/material
-MAT_SHINESS = int('0xA040',16) # ??
-MAT_TRANSPARENCY= int('0xA050',16) # Transparency value of material
-MAT_SELF_ILLUM = int('0xA080',16) # Self Illumination value of material
-MAT_WIRE = int('0xA085',16) # Only render's wireframe
-
-MAT_TEXTURE_MAP = int('0xA200',16) # This is a header for a new texture map
-MAT_SPECULAR_MAP= int('0xA204',16) # This is a header for a new specular map
-MAT_OPACITY_MAP = int('0xA210',16) # This is a header for a new opacity map
-MAT_REFLECTION_MAP= int('0xA220',16) # This is a header for a new reflection map
-MAT_BUMP_MAP = int('0xA230',16) # This is a header for a new bump map
-MAT_MAP_FILENAME = int('0xA300',16) # This holds the file name of the texture
-
-MAT_FLOAT_COLOR = int ('0x0010', 16) #color defined as 3 floats
-MAT_24BIT_COLOR = int ('0x0011', 16) #color defined as 3 bytes
+MAT_NAME = 0xA000 # This holds the material name
+MAT_AMBIENT = 0xA010 # Ambient color of the object/material
+MAT_DIFFUSE = 0xA020 # This holds the color of the object/material
+MAT_SPECULAR = 0xA030 # SPecular color of the object/material
+MAT_SHINESS = 0xA040 # ??
+MAT_TRANSPARENCY= 0xA050 # Transparency value of material
+MAT_SELF_ILLUM = 0xA080 # Self Illumination value of material
+MAT_WIRE = 0xA085 # Only render's wireframe
+
+MAT_TEXTURE_MAP = 0xA200 # This is a header for a new texture map
+MAT_SPECULAR_MAP= 0xA204 # This is a header for a new specular map
+MAT_OPACITY_MAP = 0xA210 # This is a header for a new opacity map
+MAT_REFLECTION_MAP= 0xA220 # This is a header for a new reflection map
+MAT_BUMP_MAP = 0xA230 # This is a header for a new bump map
+MAT_MAP_FILEPATH = 0xA300 # This holds the file name of the texture
+
+MAT_FLOAT_COLOR = 0x0010 #color defined as 3 floats
+MAT_24BIT_COLOR = 0x0011 #color defined as 3 bytes
#>------ sub defines of OBJECT
-OBJECT_MESH = int('0x4100',16); # This lets us know that we are reading a new object
-OBJECT_LAMP = int('0x4600',16); # This lets un know we are reading a light object
-OBJECT_LAMP_SPOT = int('0x4610',16); # The light is a spotloght.
-OBJECT_LAMP_OFF = int('0x4620',16); # The light off.
-OBJECT_LAMP_ATTENUATE = int('0x4625',16);
-OBJECT_LAMP_RAYSHADE = int('0x4627',16);
-OBJECT_LAMP_SHADOWED = int('0x4630',16);
-OBJECT_LAMP_LOCAL_SHADOW = int('0x4640',16);
-OBJECT_LAMP_LOCAL_SHADOW2 = int('0x4641',16);
-OBJECT_LAMP_SEE_CONE = int('0x4650',16);
-OBJECT_LAMP_SPOT_RECTANGULAR = int('0x4651',16);
-OBJECT_LAMP_SPOT_OVERSHOOT = int('0x4652',16);
-OBJECT_LAMP_SPOT_PROJECTOR = int('0x4653',16);
-OBJECT_LAMP_EXCLUDE = int('0x4654',16);
-OBJECT_LAMP_RANGE = int('0x4655',16);
-OBJECT_LAMP_ROLL = int('0x4656',16);
-OBJECT_LAMP_SPOT_ASPECT = int('0x4657',16);
-OBJECT_LAMP_RAY_BIAS = int('0x4658',16);
-OBJECT_LAMP_INNER_RANGE = int('0x4659',16);
-OBJECT_LAMP_OUTER_RANGE = int('0x465A',16);
-OBJECT_LAMP_MULTIPLIER = int('0x465B',16);
-OBJECT_LAMP_AMBIENT_LIGHT = int('0x4680',16);
-
-
-
-OBJECT_CAMERA= int('0x4700',16); # This lets un know we are reading a camera object
+OBJECT_MESH = 0x4100 # This lets us know that we are reading a new object
+OBJECT_LAMP = 0x4600 # This lets un know we are reading a light object
+OBJECT_LAMP_SPOT = 0x4610 # The light is a spotloght.
+OBJECT_LAMP_OFF = 0x4620 # The light off.
+OBJECT_LAMP_ATTENUATE = 0x4625
+OBJECT_LAMP_RAYSHADE = 0x4627
+OBJECT_LAMP_SHADOWED = 0x4630
+OBJECT_LAMP_LOCAL_SHADOW = 0x4640
+OBJECT_LAMP_LOCAL_SHADOW2 = 0x4641
+OBJECT_LAMP_SEE_CONE = 0x4650
+OBJECT_LAMP_SPOT_RECTANGULAR = 0x4651
+OBJECT_LAMP_SPOT_OVERSHOOT = 0x4652
+OBJECT_LAMP_SPOT_PROJECTOR = 0x4653
+OBJECT_LAMP_EXCLUDE = 0x4654
+OBJECT_LAMP_RANGE = 0x4655
+OBJECT_LAMP_ROLL = 0x4656
+OBJECT_LAMP_SPOT_ASPECT = 0x4657
+OBJECT_LAMP_RAY_BIAS = 0x4658
+OBJECT_LAMP_INNER_RANGE = 0x4659
+OBJECT_LAMP_OUTER_RANGE = 0x465A
+OBJECT_LAMP_MULTIPLIER = 0x465B
+OBJECT_LAMP_AMBIENT_LIGHT = 0x4680
+
+
+
+OBJECT_CAMERA= 0x4700 # This lets un know we are reading a camera object
#>------ sub defines of CAMERA
-OBJECT_CAM_RANGES= int('0x4720',16); # The camera range values
+OBJECT_CAM_RANGES= 0x4720 # The camera range values
#>------ sub defines of OBJECT_MESH
-OBJECT_VERTICES = int('0x4110',16); # The objects vertices
-OBJECT_FACES = int('0x4120',16); # The objects faces
-OBJECT_MATERIAL = int('0x4130',16); # This is found if the object has a material, either texture map or color
-OBJECT_UV = int('0x4140',16); # The UV texture coordinates
-OBJECT_TRANS_MATRIX = int('0x4160',16); # The Object Matrix
+OBJECT_VERTICES = 0x4110 # The objects vertices
+OBJECT_FACES = 0x4120 # The objects faces
+OBJECT_MATERIAL = 0x4130 # This is found if the object has a material, either texture map or color
+OBJECT_UV = 0x4140 # The UV texture coordinates
+OBJECT_TRANS_MATRIX = 0x4160 # The Object Matrix
global scn
scn = None
@@ -266,12 +150,10 @@ def read_string(file):
s += struct.unpack('<c', file.read(1))[0]
#print 'string: ',s
+ #remove the null character from the string
s = str(s[:-1], 'ASCII')
# print("read string", s)
-
- #remove the null character from the string
return s
-# return s[:-1]
######################################################
# IMPORT
@@ -300,9 +182,20 @@ def add_texture_to_material(image, texture, material, mapto):
if image:
texture.image = image
-# if image: texture.setImage(image) # double check its an image.
- material.add_texture(texture, "UV", mapto)
+ mtex = material.texture_slots.add()
+ mtex.texture = texture
+ mtex.texture_coords = 'UV'
+ mtex.use_map_color_diffuse = False
+
+ if mapto == 'COLOR':
+ mtex.use_map_color_diffuse = True
+ elif mapto == 'SPECULARITY':
+ mtex.use_map_specular = True
+ elif mapto == 'ALPHA':
+ mtex.use_map_alpha = True
+ elif mapto == 'NORMAL':
+ mtex.use_map_normal = True
def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
@@ -337,7 +230,8 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
bmesh = bpy.data.meshes.new(contextObName)
if myContextMesh_vertls:
- bmesh.add_geometry(len(myContextMesh_vertls)//3, 0, len(myContextMesh_facels))
+ bmesh.vertices.add(len(myContextMesh_vertls)//3)
+ bmesh.faces.add(len(myContextMesh_facels))
bmesh.vertices.foreach_set("co", myContextMesh_vertls)
eekadoodle_faces = []
@@ -346,19 +240,20 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
bmesh.faces.foreach_set("vertices_raw", eekadoodle_faces)
if bmesh.faces and contextMeshUV:
- bmesh.add_uv_texture()
- uv_faces = bmesh.active_uv_texture.data[:]
+ bmesh.uv_textures.new()
+ uv_faces = bmesh.uv_textures.active.data[:]
else:
uv_faces = None
for mat_idx, (matName, faces) in enumerate(myContextMeshMaterials.items()):
if matName is None:
- bmesh.add_material(None)
+ bmat = None
else:
bmat = MATDICT[matName][1]
- bmesh.add_material(bmat) # can be None
img = TEXTURE_DICT.get(bmat.name)
-
+
+ bmesh.materials.append(bmat) # can be None
+
if uv_faces and img:
for fidx in faces:
bmesh.faces[fidx].material_index = mat_idx
@@ -414,16 +309,14 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
return [float(col)/255 for col in struct.unpack('<3B', temp_data)] # data [0,1,2] == rgb
def read_texture(new_chunk, temp_chunk, name, mapto):
- new_texture = bpy.data.textures.new(name)
- new_texture.type = 'IMAGE'
- new_texture = new_texture.recast_type()
+ new_texture = bpy.data.textures.new(name, type='IMAGE')
img = None
while (new_chunk.bytes_read < new_chunk.length):
#print 'MAT_TEXTURE_MAP..while', new_chunk.bytes_read, new_chunk.length
read_chunk(file, temp_chunk)
- if (temp_chunk.ID == MAT_MAP_FILENAME):
+ if (temp_chunk.ID == MAT_MAP_FILEPATH):
texture_name = read_string(file)
img = TEXTURE_DICT[contextMaterial.name] = load_image(texture_name, dirname)
new_chunk.bytes_read += (len(texture_name)+1) #plus one for the null character that gets removed
@@ -437,7 +330,7 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
if img:
add_texture_to_material(img, new_texture, contextMaterial, mapto)
- dirname = os.path.dirname(FILENAME)
+ dirname = os.path.dirname(file.name)
#loop through all the data for this chunk (previous chunk) and see what it is
while (previous_chunk.bytes_read < previous_chunk.length):
@@ -723,14 +616,14 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
#contextMatrix = contextMatrix * tx
#contextMatrix = contextMatrix *tx
- elif (new_chunk.ID == MAT_MAP_FILENAME):
+ elif (new_chunk.ID == MAT_MAP_FILEPATH):
texture_name = read_string(file)
try:
TEXTURE_DICT[contextMaterial.name]
except:
- #img = TEXTURE_DICT[contextMaterial.name]= BPyImage.comprehensiveImageLoad(texture_name, FILENAME)
+ #img = TEXTURE_DICT[contextMaterial.name]= BPyImage.comprehensiveImageLoad(texture_name, FILEPATH)
img = TEXTURE_DICT[contextMaterial.name] = load_image(texture_name, dirname)
-# img = TEXTURE_DICT[contextMaterial.name]= BPyImage.comprehensiveImageLoad(texture_name, FILENAME, PLACE_HOLDER=False, RECURSIVE=IMAGE_SEARCH)
+# img = TEXTURE_DICT[contextMaterial.name]= BPyImage.comprehensiveImageLoad(texture_name, FILEPATH, PLACE_HOLDER=False, RECURSIVE=IMAGE_SEARCH)
new_chunk.bytes_read += len(texture_name)+1 #plus one for the null character that gets removed
@@ -753,30 +646,27 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
if CreateBlenderObject:
putContextMesh(contextMesh_vertls, contextMesh_facels, contextMeshMaterials)
-def load_3ds(filename, context, IMPORT_CONSTRAIN_BOUNDS=10.0, IMAGE_SEARCH=True, APPLY_MATRIX=False):
- global FILENAME, SCN
-# global FILENAME, SCN_OBJECTS
+def load_3ds(filepath, context, IMPORT_CONSTRAIN_BOUNDS=10.0, IMAGE_SEARCH=True, APPLY_MATRIX=False):
+ global SCN
# XXX
-# if BPyMessages.Error_NoFile(filename):
+# if BPyMessages.Error_NoFile(filepath):
# return
- print('\n\nImporting 3DS: "%s"' % (filename))
-# print('\n\nImporting 3DS: "%s"' % (Blender.sys.expandpath(filename)))
+ print('\n\nImporting 3DS: %r' % (filepath))
time1 = time.clock()
# time1 = Blender.sys.time()
- FILENAME = filename
current_chunk = chunk()
- file = open(filename,'rb')
+ file = open(filepath, 'rb')
#here we go!
# print 'reading the first chunk'
read_chunk(file, current_chunk)
if (current_chunk.ID!=PRIMARY):
- print('\tFatal Error: Not a valid 3ds file: ', filename)
+ print('\tFatal Error: Not a valid 3ds file: %r' % filepath)
file.close()
return
@@ -837,7 +727,7 @@ def load_3ds(filename, context, IMPORT_CONSTRAIN_BOUNDS=10.0, IMAGE_SEARCH=True,
# Done DUMMYVERT
"""
if IMPORT_AS_INSTANCE:
- name = filename.split('\\')[-1].split('/')[-1]
+ name = filepath.split('\\')[-1].split('/')[-1]
# Create a group for this import.
group_scn = Scene.New(name)
for ob in importedObjects:
@@ -895,96 +785,10 @@ def load_3ds(filename, context, IMPORT_CONSTRAIN_BOUNDS=10.0, IMAGE_SEARCH=True,
# Done constraining to bounds.
# Select all new objects.
- print('finished importing: "%s" in %.4f sec.' % (filename, (time.clock()-time1)))
-# print('finished importing: "%s" in %.4f sec.' % (filename, (Blender.sys.time()-time1)))
+ print('finished importing: %r in %.4f sec.' % (filepath, (time.clock()-time1)))
file.close()
-DEBUG = False
-# For testing compatibility
-#load_3ds('/metavr/convert/vehicle/truck_002/TruckTanker1.3DS', False)
-#load_3ds('/metavr/archive/convert/old/arranged_3ds_to_hpx-2/only-need-engine-trains/Engine2.3DS', False)
-'''
-
-else:
- import os
- # DEBUG ONLY
- TIME = Blender.sys.time()
- import os
- print 'Searching for files'
- os.system('find /metavr/ -iname "*.3ds" > /tmp/temp3ds_list')
- # os.system('find /storage/ -iname "*.3ds" > /tmp/temp3ds_list')
- print '...Done'
- file = open('/tmp/temp3ds_list', 'r')
- lines = file.readlines()
- file.close()
- # sort by filesize for faster testing
- lines_size = [(os.path.getsize(f[:-1]), f[:-1]) for f in lines]
- lines_size.sort()
- lines = [f[1] for f in lines_size]
-
-
- def between(v,a,b):
- if v <= max(a,b) and v >= min(a,b):
- return True
- return False
-
- for i, _3ds in enumerate(lines):
- if between(i, 650,800):
- #_3ds= _3ds[:-1]
- print 'Importing', _3ds, '\nNUMBER', i, 'of', len(lines)
- _3ds_file= _3ds.split('/')[-1].split('\\')[-1]
- newScn = Blender.Scene.New(_3ds_file)
- newScn.makeCurrent()
- load_3ds(_3ds, False)
-
- print 'TOTAL TIME: %.6f' % (Blender.sys.time() - TIME)
-
-'''
-from bpy.props import *
-
-
-class IMPORT_OT_autodesk_3ds(bpy.types.Operator):
- '''Import from 3DS file format (.3ds)'''
- bl_idname = "import_scene.autodesk_3ds"
- bl_label = 'Import 3DS'
-
- # List of operator properties, the attributes will be assigned
- # to the class instance from the operator settings before calling.
- filepath = StringProperty(name="File Path", description="Filepath used for importing the 3DS file", maxlen= 1024, default= "")
-
- constrain_size = FloatProperty(name="Size Constraint", description="Scale the model by 10 until it reacehs the size constraint. Zero Disables.", min=0.0, max=1000.0, soft_min=0.0, soft_max=1000.0, default=10.0)
- search_images = BoolProperty(name="Image Search", description="Search subdirectories for any assosiated images (Warning, may be slow)", default=True)
- apply_transform = BoolProperty(name="Apply Transform", description="Workaround for object transformations importing incorrectly", default=False)
-
- def execute(self, context):
- load_3ds(self.properties.filepath,
- context,
- IMPORT_CONSTRAIN_BOUNDS=self.properties.constrain_size,
- IMAGE_SEARCH=self.properties.search_images,
- APPLY_MATRIX=self.properties.apply_transform)
-
- return {'FINISHED'}
-
- def invoke(self, context, event):
- wm = context.manager
- wm.add_fileselect(self)
- return {'RUNNING_MODAL'}
-
-
-def menu_func(self, context):
- self.layout.operator(IMPORT_OT_autodesk_3ds.bl_idname, text="3D Studio (.3ds)")
-
-def register():
- bpy.types.INFO_MT_file_import.append(menu_func)
-
-def unregister():
- bpy.types.INFO_MT_file_import.remove(menu_func)
-
-# NOTES:
-# why add 1 extra vertex? and remove it when done? - "Answer - eekadoodle - would need to re-order UV's without this since face order isnt always what we give blender, BMesh will solve :D"
-# disabled scaling to size, this requires exposing bb (easy) and understanding how it works (needs some time)
-
-if __name__ == "__main__":
- register()
-
+def load(operator, context, filepath="", constrain_size=0.0, use_image_search=True, use_apply_transform=True):
+ load_3ds(filepath, context, IMPORT_CONSTRAIN_BOUNDS=constrain_size, IMAGE_SEARCH=use_image_search, APPLY_MATRIX=use_apply_transform)
+ return {'FINISHED'}
diff --git a/release/scripts/op/io_scene_fbx/__init__.py b/release/scripts/op/io_scene_fbx/__init__.py
new file mode 100644
index 00000000000..f7195600de5
--- /dev/null
+++ b/release/scripts/op/io_scene_fbx/__init__.py
@@ -0,0 +1,102 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+# To support reload properly, try to access a package var, if it's there, reload everything
+if "bpy" in locals():
+ # only reload if we alredy loaded, highly annoying
+ import sys
+ reload(sys.modules.get("io_scene_fbx.export_fbx", sys))
+
+
+import bpy
+from bpy.props import *
+from io_utils import ExportHelper
+
+
+class ExportFBX(bpy.types.Operator, ExportHelper):
+ '''Selection to an ASCII Autodesk FBX'''
+ bl_idname = "export_scene.fbx"
+ bl_label = "Export FBX"
+
+ filename_ext = ".fbx"
+
+ # List of operator properties, the attributes will be assigned
+ # to the class instance from the operator settings before calling.
+
+ EXP_OBS_SELECTED = BoolProperty(name="Selected Objects", description="Export selected objects on visible layers", default=True)
+# EXP_OBS_SCENE = BoolProperty(name="Scene Objects", description="Export all objects in this scene", default=True)
+ TX_SCALE = FloatProperty(name="Scale", description="Scale all data, (Note! some imports dont support scaled armatures)", min=0.01, max=1000.0, soft_min=0.01, soft_max=1000.0, default=1.0)
+ TX_XROT90 = BoolProperty(name="Rot X90", description="Rotate all objects 90 degrees about the X axis", default=True)
+ TX_YROT90 = BoolProperty(name="Rot Y90", description="Rotate all objects 90 degrees about the Y axis", default=False)
+ TX_ZROT90 = BoolProperty(name="Rot Z90", description="Rotate all objects 90 degrees about the Z axis", default=False)
+ EXP_EMPTY = BoolProperty(name="Empties", description="Export empty objects", default=True)
+ EXP_CAMERA = BoolProperty(name="Cameras", description="Export camera objects", default=True)
+ EXP_LAMP = BoolProperty(name="Lamps", description="Export lamp objects", default=True)
+ EXP_ARMATURE = BoolProperty(name="Armatures", description="Export armature objects", default=True)
+ EXP_MESH = BoolProperty(name="Meshes", description="Export mesh objects", default=True)
+ EXP_MESH_APPLY_MOD = BoolProperty(name="Modifiers", description="Apply modifiers to mesh objects", default=True)
+ EXP_MESH_HQ_NORMALS = BoolProperty(name="HQ Normals", description="Generate high quality normals", default=True)
+ EXP_IMAGE_COPY = BoolProperty(name="Copy Image Files", description="Copy image files to the destination path", default=False)
+ # armature animation
+ ANIM_ENABLE = BoolProperty(name="Enable Animation", description="Export keyframe animation", default=True)
+ ANIM_OPTIMIZE = BoolProperty(name="Optimize Keyframes", description="Remove double keyframes", default=True)
+ ANIM_OPTIMIZE_PRECISSION = FloatProperty(name="Precision", description="Tolerence for comparing double keyframes (higher for greater accuracy)", min=1, max=16, soft_min=1, soft_max=16, default=6.0)
+# ANIM_ACTION_ALL = BoolProperty(name="Current Action", description="Use actions currently applied to the armatures (use scene start/end frame)", default=True)
+ ANIM_ACTION_ALL = BoolProperty(name="All Actions", description="Use all actions for armatures, if false, use current action", default=False)
+ # batch
+ BATCH_ENABLE = BoolProperty(name="Enable Batch", description="Automate exporting multiple scenes or groups to files", default=False)
+ BATCH_GROUP = BoolProperty(name="Group > File", description="Export each group as an FBX file, if false, export each scene as an FBX file", default=False)
+ BATCH_OWN_DIR = BoolProperty(name="Own Dir", description="Create a dir for each exported file", default=True)
+ BATCH_FILE_PREFIX = StringProperty(name="Prefix", description="Prefix each file with this name", maxlen=1024, default="")
+
+
+ def execute(self, context):
+ import math
+ from mathutils import Matrix
+ if not self.properties.filepath:
+ raise Exception("filepath not set")
+
+ mtx4_x90n = Matrix.Rotation(-math.pi/2.0, 4, 'X')
+ mtx4_y90n = Matrix.Rotation(-math.pi/2.0, 4, 'Y')
+ mtx4_z90n = Matrix.Rotation(-math.pi/2.0, 4, 'Z')
+
+ GLOBAL_MATRIX = Matrix()
+ GLOBAL_MATRIX[0][0] = GLOBAL_MATRIX[1][1] = GLOBAL_MATRIX[2][2] = self.properties.TX_SCALE
+ if self.properties.TX_XROT90: GLOBAL_MATRIX = mtx4_x90n * GLOBAL_MATRIX
+ if self.properties.TX_YROT90: GLOBAL_MATRIX = mtx4_y90n * GLOBAL_MATRIX
+ if self.properties.TX_ZROT90: GLOBAL_MATRIX = mtx4_z90n * GLOBAL_MATRIX
+
+ import io_scene_fbx.export_fbx
+ return io_scene_fbx.export_fbx.save(self, context, GLOBAL_MATRIX=GLOBAL_MATRIX, **self.properties)
+
+
+def menu_func(self, context):
+ self.layout.operator(ExportFBX.bl_idname, text="Autodesk FBX (.fbx)")
+
+
+def register():
+ bpy.types.INFO_MT_file_export.append(menu_func)
+
+
+def unregister():
+ bpy.types.INFO_MT_file_export.remove(menu_func)
+
+if __name__ == "__main__":
+ register()
diff --git a/release/scripts/io/export_fbx.py b/release/scripts/op/io_scene_fbx/export_fbx.py
index 60e9e90e11b..51a5f86a5e4 100644
--- a/release/scripts/io/export_fbx.py
+++ b/release/scripts/op/io_scene_fbx/export_fbx.py
@@ -18,36 +18,13 @@
# <pep8 compliant>
-__author__ = "Campbell Barton"
-__url__ = ['www.blender.org', 'blenderartists.org']
-__version__ = "1.2"
+# Script copyright (C) Campbell Barton
-__bpydoc__ = """\
+"""
This script is an exporter to the FBX file format.
http://wiki.blender.org/index.php/Scripts/Manual/Export/autodesk_fbx
"""
-# --------------------------------------------------------------------------
-# FBX Export v0.1 by Campbell Barton (AKA Ideasman)
-# --------------------------------------------------------------------------
-# ***** BEGIN GPL LICENSE BLOCK *****
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# ***** END GPL LICENCE BLOCK *****
-# --------------------------------------------------------------------------
import os
import time
@@ -57,19 +34,10 @@ import shutil # for file copying
import bpy
from mathutils import Vector, Euler, Matrix
-def copy_file(source, dest):
- # XXX - remove, can use shutil
- file = open(source, 'rb')
- data = file.read()
- file.close()
-
- file = open(dest, 'wb')
- file.write(data)
- file.close()
-
-
# XXX not used anymore, images are copied one at a time
def copy_images(dest_dir, textures):
+ import shutil
+
if not dest_dir.endswith(os.sep):
dest_dir += os.sep
@@ -84,12 +52,12 @@ def copy_images(dest_dir, textures):
# Make a name for the target path.
dest_image_path = dest_dir + image_path.split('\\')[-1].split('/')[-1]
if not Blender.sys.exists(dest_image_path): # Image isnt already there
- print('\tCopying "%s" > "%s"' % (image_path, dest_image_path))
+ print("\tCopying %r > %r" % (image_path, dest_image_path))
try:
- copy_file(image_path, dest_image_path)
+ shutil.copy(image_path, dest_image_path)
copyCount+=1
except:
- print('\t\tWarning, file failed to copy, skipping.')
+ print("\t\tWarning, file failed to copy, skipping.")
print('\tCopied %d images' % copyCount)
@@ -104,27 +72,11 @@ def eulerRadToDeg(eul):
return ret
-mtx4_identity = Matrix()
-
-# testing
-mtx_x90 = Matrix.Rotation( math.pi/2, 3, 'X') # used
-#mtx_x90n = Matrix.Rotation(-90, 3, 'x')
-#mtx_y90 = Matrix.Rotation( 90, 3, 'y')
-#mtx_y90n = Matrix.Rotation(-90, 3, 'y')
-#mtx_z90 = Matrix.Rotation( 90, 3, 'z')
-#mtx_z90n = Matrix.Rotation(-90, 3, 'z')
-
-#mtx4_x90 = Matrix.Rotation( 90, 4, 'x')
-mtx4_x90n = Matrix.Rotation(-math.pi/2, 4, 'X') # used
-#mtx4_y90 = Matrix.Rotation( 90, 4, 'y')
-mtx4_y90n = Matrix.Rotation(-math.pi/2, 4, 'Y') # used
-mtx4_z90 = Matrix.Rotation( math.pi/2, 4, 'Z') # used
-mtx4_z90n = Matrix.Rotation(-math.pi/2, 4, 'Z') # used
# def strip_path(p):
# return p.split('\\')[-1].split('/')[-1]
-# Used to add the scene name into the filename without using odd chars
+# Used to add the scene name into the filepath without using odd chars
sane_name_mapping_ob = {}
sane_name_mapping_mat = {}
sane_name_mapping_tex = {}
@@ -197,7 +149,7 @@ def sane_groupname(data): return sane_name(data, sane_name_mapping_group)
# '''
# fname_orig - blender path, can be relative
# basepath - fname_rel will be relative to this
-# FORCE_CWD - dont use the basepath, just add a ./ to the filename.
+# FORCE_CWD - dont use the basepath, just add a ./ to the filepath.
# use when we know the file will be in the basepath.
# '''
# fname = bpy.path.abspath(fname_orig)
@@ -282,19 +234,17 @@ header_comment = \
'''
-# This func can be called with just the filename
-def write(filename, batch_objects = None, \
- context = None,
+# This func can be called with just the filepath
+def save(operator, context, filepath="", \
EXP_OBS_SELECTED = True,
EXP_MESH = True,
EXP_MESH_APPLY_MOD = True,
-# EXP_MESH_HQ_NORMALS = False,
EXP_ARMATURE = True,
EXP_LAMP = True,
EXP_CAMERA = True,
EXP_EMPTY = True,
EXP_IMAGE_COPY = False,
- GLOBAL_MATRIX = Matrix(),
+ GLOBAL_MATRIX = None,
ANIM_ENABLE = True,
ANIM_OPTIMIZE = True,
ANIM_OPTIMIZE_PRECISSION = 6,
@@ -305,16 +255,26 @@ def write(filename, batch_objects = None, \
BATCH_OWN_DIR = False
):
- if bpy.context.object:
+ #XXX, missing arg
+ batch_objects = None
+
+ # testing
+ mtx_x90 = Matrix.Rotation( math.pi/2.0, 3, 'X') # used
+ mtx4_z90 = Matrix.Rotation( math.pi/2.0, 4, 'Z')
+
+ if GLOBAL_MATRIX is None:
+ GLOBAL_MATRIX = Matrix()
+
+ if bpy.ops.object.mode_set.poll():
bpy.ops.object.mode_set(mode='OBJECT')
# ----------------- Batch support!
if BATCH_ENABLE:
if os == None: BATCH_OWN_DIR = False
- fbxpath = filename
+ fbxpath = filepath
- # get the path component of filename
+ # get the path component of filepath
tmp_exists = bpy.utils.exists(fbxpath)
# tmp_exists = Blender.sys.exists(fbxpath)
@@ -323,7 +283,7 @@ def write(filename, batch_objects = None, \
# while fbxpath and fbxpath[-1] not in ('/', '\\'):
# fbxpath = fbxpath[:-1]
if not fbxpath:
-# if not filename:
+# if not filepath:
# XXX
print('Error%t|Directory does not exist!')
# Draw.PupMenu('Error%t|Directory does not exist!')
@@ -368,9 +328,9 @@ def write(filename, batch_objects = None, \
os.mkdir(new_fbxpath)
- filename = new_fbxpath + newname + '.fbx'
+ filepath = new_fbxpath + newname + '.fbx'
- print('\nBatch exporting %s as...\n\t"%s"' % (data, filename))
+ print('\nBatch exporting %s as...\n\t%r' % (data, filepath))
# XXX don't know what to do with this, probably do the same? (Arystan)
if BATCH_GROUP: #group
@@ -393,12 +353,11 @@ def write(filename, batch_objects = None, \
# Call self with modified args
# Dont pass batch options since we already usedt them
- write(filename, data.objects,
+ write(filepath, data.objects,
context,
False,
EXP_MESH,
EXP_MESH_APPLY_MOD,
-# EXP_MESH_HQ_NORMALS,
EXP_ARMATURE,
EXP_LAMP,
EXP_CAMERA,
@@ -423,9 +382,9 @@ def write(filename, batch_objects = None, \
# end batch support
# Use this for working out paths relative to the export location
- basepath = os.path.dirname(filename) or '.'
+ basepath = os.path.dirname(filepath) or '.'
basepath += os.sep
-# basepath = Blender.sys.dirname(filename)
+# basepath = Blender.sys.dirname(filepath)
# ----------------------------------------------
# storage classes
@@ -572,11 +531,11 @@ def write(filename, batch_objects = None, \
- print('\nFBX export starting...', filename)
+ print('\nFBX export starting... %r' % filepath)
start_time = time.clock()
# start_time = Blender.sys.time()
try:
- file = open(filename, 'w')
+ file = open(filepath, 'w')
except:
return False
@@ -1630,7 +1589,7 @@ def write(filename, batch_objects = None, \
# if me.vertexColors:
collayers = me.vertex_colors
# collayers = me.getColorLayerNames()
- collayer_orig = me.active_vertex_color
+ collayer_orig = me.vertex_colors.active
# collayer_orig = me.activeColorLayer
for colindex, collayer in enumerate(collayers):
# me.activeColorLayer = collayer
@@ -1700,7 +1659,7 @@ def write(filename, batch_objects = None, \
if do_uvs:
uvlayers = me.uv_textures
# uvlayers = me.getUVLayerNames()
- uvlayer_orig = me.active_uv_texture
+ uvlayer_orig = me.uv_textures.active
# uvlayer_orig = me.activeUVLayer
for uvindex, uvlayer in enumerate(me.uv_textures):
# for uvindex, uvlayer in enumerate(uvlayers):
@@ -1834,8 +1793,8 @@ def write(filename, batch_objects = None, \
mats = my_mesh.blenMaterialList
- if me.active_uv_texture:
- uv_faces = me.active_uv_texture.data
+ if me.uv_textures.active:
+ uv_faces = me.uv_textures.active.data
else:
uv_faces = [None] * len(me.faces)
@@ -2006,7 +1965,7 @@ def write(filename, batch_objects = None, \
ob_base.update(scene)
# This causes the makeDisplayList command to effect the mesh
- scene.set_frame(scene.frame_current)
+ scene.frame_set(scene.frame_current)
# Blender.Set('curframe', Blender.Get('curframe'))
@@ -2103,7 +2062,7 @@ def write(filename, batch_objects = None, \
material_mapping_local = {}
if len(me.uv_textures) > 0:
# if me.faceUV:
- uvlayer_orig = me.active_uv_texture
+ uvlayer_orig = me.uv_textures.active
# uvlayer_orig = me.activeUVLayer
for uvlayer in me.uv_textures:
# for uvlayer in me.getUVLayerNames():
@@ -2179,7 +2138,7 @@ def write(filename, batch_objects = None, \
if ob_base.type == 'ARMATURE':
ob_base.update(scene)
# This causes the makeDisplayList command to effect the mesh
- scene.set_frame(scene.frame_current)
+ scene.frame_set(scene.frame_current)
# Blender.Set('curframe', Blender.Get('curframe'))
del tmp_ob_type, tmp_objects
@@ -2472,7 +2431,7 @@ Objects: {''')
file.write('\n\t\tPoseNode: {')
file.write('\n\t\t\tNode: "Model::%s"' % fbxName )
if matrix: file.write('\n\t\t\tMatrix: %s' % mat4x4str(matrix))
- else: file.write('\n\t\t\tMatrix: %s' % mat4x4str(mtx4_identity))
+ else: file.write('\n\t\t\tMatrix: %s' % mat4x4str(Matrix()))
file.write('\n\t\t}')
file.write('\n\t}')
@@ -2760,7 +2719,9 @@ Takes: {''')
else:
file.write('\n\tTake: "%s" {' % sane_takename(blenAction))
- act_start, act_end = blenAction.get_frame_range()
+ act_start, act_end = blenAction.frame_range
+ act_start = int(act_start)
+ act_end = int(act_end)
# tmp = blenAction.getFrameNumbers()
# if tmp:
# act_start = min(tmp)
@@ -2797,7 +2758,7 @@ Takes: {''')
'''
i = act_start
while i <= act_end:
- scene.set_frame(i)
+ scene.frame_set(i)
# Blender.Set('curframe', i)
for ob_generic in ob_anim_lists:
for my_ob in ob_generic:
@@ -2937,8 +2898,7 @@ Takes: {''')
file.write('\n}')
- scene.set_frame(frame_orig)
-# Blender.Set('curframe', frame_orig)
+ scene.frame_set(frame_orig)
else:
# no animation
@@ -2961,18 +2921,16 @@ Takes: {''')
# --------------------------- Footer
if world:
- m = world.mist
+ m = world.mist_settings
has_mist = m.use_mist
mist_intense = m.intensity
mist_start = m.start
mist_end = m.depth
mist_height = m.height
-# mist_intense, mist_start, mist_end, mist_height = world.mist
world_hor = world.horizon_color
-# world_hor = world.hor
else:
has_mist = mist_intense = mist_start = mist_end = mist_height = 0
- world_hor = 0,0,0
+ world_hor = 0, 0, 0
file.write('\n;Version 5 settings')
file.write('\n;------------------------------------------------------------------')
@@ -3024,394 +2982,7 @@ Takes: {''')
# bpy.util.copy_images( [ tex[1] for tex in textures if tex[1] != None ], basepath)
print('export finished in %.4f sec.' % (time.clock() - start_time))
-# print 'export finished in %.4f sec.' % (Blender.sys.time() - start_time)
- return True
-
-
-# --------------------------------------------
-# UI Function - not a part of the exporter.
-# this is to separate the user interface from the rest of the exporter.
-# from Blender import Draw, Window
-EVENT_NONE = 0
-EVENT_EXIT = 1
-EVENT_REDRAW = 2
-EVENT_FILESEL = 3
-
-GLOBALS = {}
-
-# export opts
-
-def do_redraw(e,v): GLOBALS['EVENT'] = e
-
-# toggle between these 2, only allow one on at once
-def do_obs_sel(e,v):
- GLOBALS['EVENT'] = e
- GLOBALS['EXP_OBS_SCENE'].val = 0
- GLOBALS['EXP_OBS_SELECTED'].val = 1
-
-def do_obs_sce(e,v):
- GLOBALS['EVENT'] = e
- GLOBALS['EXP_OBS_SCENE'].val = 1
- GLOBALS['EXP_OBS_SELECTED'].val = 0
-
-def do_batch_type_grp(e,v):
- GLOBALS['EVENT'] = e
- GLOBALS['BATCH_GROUP'].val = 1
- GLOBALS['BATCH_SCENE'].val = 0
-
-def do_batch_type_sce(e,v):
- GLOBALS['EVENT'] = e
- GLOBALS['BATCH_GROUP'].val = 0
- GLOBALS['BATCH_SCENE'].val = 1
-
-def do_anim_act_all(e,v):
- GLOBALS['EVENT'] = e
- GLOBALS['ANIM_ACTION_ALL'][0].val = 1
- GLOBALS['ANIM_ACTION_ALL'][1].val = 0
-
-def do_anim_act_cur(e,v):
- if GLOBALS['BATCH_ENABLE'].val and GLOBALS['BATCH_GROUP'].val:
- Draw.PupMenu('Warning%t|Cant use this with batch export group option')
- else:
- GLOBALS['EVENT'] = e
- GLOBALS['ANIM_ACTION_ALL'][0].val = 0
- GLOBALS['ANIM_ACTION_ALL'][1].val = 1
-
-def fbx_ui_exit(e,v):
- GLOBALS['EVENT'] = e
-
-def do_help(e,v):
- url = 'http://wiki.blender.org/index.php/Scripts/Manual/Export/autodesk_fbx'
- print('Trying to open web browser with documentation at this address...')
- print('\t' + url)
-
- try:
- import webbrowser
- webbrowser.open(url)
- except:
- Blender.Draw.PupMenu("Error%t|Opening a webbrowser requires a full python installation")
- print('...could not open a browser window.')
-
-
-
-# run when export is pressed
-#def fbx_ui_write(e,v):
-def fbx_ui_write(filename, context):
-
- # Dont allow overwriting files when saving normally
- if not GLOBALS['BATCH_ENABLE'].val:
- if not BPyMessages.Warning_SaveOver(filename):
- return
-
- GLOBALS['EVENT'] = EVENT_EXIT
-
- # Keep the order the same as above for simplicity
- # the [] is a dummy arg used for objects
-
- Blender.Window.WaitCursor(1)
-
- # Make the matrix
- GLOBAL_MATRIX = mtx4_identity
- GLOBAL_MATRIX[0][0] = GLOBAL_MATRIX[1][1] = GLOBAL_MATRIX[2][2] = GLOBALS['_SCALE'].val
- if GLOBALS['_XROT90'].val: GLOBAL_MATRIX = mtx4_x90n * GLOBAL_MATRIX
- if GLOBALS['_YROT90'].val: GLOBAL_MATRIX = mtx4_y90n * GLOBAL_MATRIX
- if GLOBALS['_ZROT90'].val: GLOBAL_MATRIX = mtx4_z90n * GLOBAL_MATRIX
-
- ret = write(\
- filename, None,\
- context,
- GLOBALS['EXP_OBS_SELECTED'].val,\
- GLOBALS['EXP_MESH'].val,\
- GLOBALS['EXP_MESH_APPLY_MOD'].val,\
- GLOBALS['EXP_MESH_HQ_NORMALS'].val,\
- GLOBALS['EXP_ARMATURE'].val,\
- GLOBALS['EXP_LAMP'].val,\
- GLOBALS['EXP_CAMERA'].val,\
- GLOBALS['EXP_EMPTY'].val,\
- GLOBALS['EXP_IMAGE_COPY'].val,\
- GLOBAL_MATRIX,\
- GLOBALS['ANIM_ENABLE'].val,\
- GLOBALS['ANIM_OPTIMIZE'].val,\
- GLOBALS['ANIM_OPTIMIZE_PRECISSION'].val,\
- GLOBALS['ANIM_ACTION_ALL'][0].val,\
- GLOBALS['BATCH_ENABLE'].val,\
- GLOBALS['BATCH_GROUP'].val,\
- GLOBALS['BATCH_SCENE'].val,\
- GLOBALS['BATCH_FILE_PREFIX'].val,\
- GLOBALS['BATCH_OWN_DIR'].val,\
- )
-
- Blender.Window.WaitCursor(0)
- GLOBALS.clear()
-
- if ret == False:
- Draw.PupMenu('Error%t|Path cannot be written to!')
-
-
-def fbx_ui():
- # Only to center the UI
- x,y = GLOBALS['MOUSE']
- x-=180; y-=0 # offset... just to get it centered
-
- Draw.Label('Export Objects...', x+20,y+165, 200, 20)
-
- if not GLOBALS['BATCH_ENABLE'].val:
- Draw.BeginAlign()
- GLOBALS['EXP_OBS_SELECTED'] = Draw.Toggle('Selected Objects', EVENT_REDRAW, x+20, y+145, 160, 20, GLOBALS['EXP_OBS_SELECTED'].val, 'Export selected objects on visible layers', do_obs_sel)
- GLOBALS['EXP_OBS_SCENE'] = Draw.Toggle('Scene Objects', EVENT_REDRAW, x+180, y+145, 160, 20, GLOBALS['EXP_OBS_SCENE'].val, 'Export all objects in this scene', do_obs_sce)
- Draw.EndAlign()
-
- Draw.BeginAlign()
- GLOBALS['_SCALE'] = Draw.Number('Scale:', EVENT_NONE, x+20, y+120, 140, 20, GLOBALS['_SCALE'].val, 0.01, 1000.0, 'Scale all data, (Note! some imports dont support scaled armatures)')
- GLOBALS['_XROT90'] = Draw.Toggle('Rot X90', EVENT_NONE, x+160, y+120, 60, 20, GLOBALS['_XROT90'].val, 'Rotate all objects 90 degrees about the X axis')
- GLOBALS['_YROT90'] = Draw.Toggle('Rot Y90', EVENT_NONE, x+220, y+120, 60, 20, GLOBALS['_YROT90'].val, 'Rotate all objects 90 degrees about the Y axis')
- GLOBALS['_ZROT90'] = Draw.Toggle('Rot Z90', EVENT_NONE, x+280, y+120, 60, 20, GLOBALS['_ZROT90'].val, 'Rotate all objects 90 degrees about the Z axis')
- Draw.EndAlign()
-
- y -= 35
-
- Draw.BeginAlign()
- GLOBALS['EXP_EMPTY'] = Draw.Toggle('Empty', EVENT_NONE, x+20, y+120, 60, 20, GLOBALS['EXP_EMPTY'].val, 'Export empty objects')
- GLOBALS['EXP_CAMERA'] = Draw.Toggle('Camera', EVENT_NONE, x+80, y+120, 60, 20, GLOBALS['EXP_CAMERA'].val, 'Export camera objects')
- GLOBALS['EXP_LAMP'] = Draw.Toggle('Lamp', EVENT_NONE, x+140, y+120, 60, 20, GLOBALS['EXP_LAMP'].val, 'Export lamp objects')
- GLOBALS['EXP_ARMATURE'] = Draw.Toggle('Armature', EVENT_NONE, x+200, y+120, 60, 20, GLOBALS['EXP_ARMATURE'].val, 'Export armature objects')
- GLOBALS['EXP_MESH'] = Draw.Toggle('Mesh', EVENT_REDRAW, x+260, y+120, 80, 20, GLOBALS['EXP_MESH'].val, 'Export mesh objects', do_redraw) #, do_axis_z)
- Draw.EndAlign()
-
- if GLOBALS['EXP_MESH'].val:
- # below mesh but
- Draw.BeginAlign()
- GLOBALS['EXP_MESH_APPLY_MOD'] = Draw.Toggle('Modifiers', EVENT_NONE, x+260, y+100, 80, 20, GLOBALS['EXP_MESH_APPLY_MOD'].val, 'Apply modifiers to mesh objects') #, do_axis_z)
- GLOBALS['EXP_MESH_HQ_NORMALS'] = Draw.Toggle('HQ Normals', EVENT_NONE, x+260, y+80, 80, 20, GLOBALS['EXP_MESH_HQ_NORMALS'].val, 'Generate high quality normals') #, do_axis_z)
- Draw.EndAlign()
-
- GLOBALS['EXP_IMAGE_COPY'] = Draw.Toggle('Copy Image Files', EVENT_NONE, x+20, y+80, 160, 20, GLOBALS['EXP_IMAGE_COPY'].val, 'Copy image files to the destination path') #, do_axis_z)
-
-
- Draw.Label('Export Armature Animation...', x+20,y+45, 300, 20)
-
- GLOBALS['ANIM_ENABLE'] = Draw.Toggle('Enable Animation', EVENT_REDRAW, x+20, y+25, 160, 20, GLOBALS['ANIM_ENABLE'].val, 'Export keyframe animation', do_redraw)
- if GLOBALS['ANIM_ENABLE'].val:
- Draw.BeginAlign()
- GLOBALS['ANIM_OPTIMIZE'] = Draw.Toggle('Optimize Keyframes', EVENT_REDRAW, x+20, y+0, 160, 20, GLOBALS['ANIM_OPTIMIZE'].val, 'Remove double keyframes', do_redraw)
- if GLOBALS['ANIM_OPTIMIZE'].val:
- GLOBALS['ANIM_OPTIMIZE_PRECISSION'] = Draw.Number('Precission: ', EVENT_NONE, x+180, y+0, 160, 20, GLOBALS['ANIM_OPTIMIZE_PRECISSION'].val, 1, 16, 'Tolerence for comparing double keyframes (higher for greater accuracy)')
- Draw.EndAlign()
-
- Draw.BeginAlign()
- GLOBALS['ANIM_ACTION_ALL'][1] = Draw.Toggle('Current Action', EVENT_REDRAW, x+20, y-25, 160, 20, GLOBALS['ANIM_ACTION_ALL'][1].val, 'Use actions currently applied to the armatures (use scene start/end frame)', do_anim_act_cur)
- GLOBALS['ANIM_ACTION_ALL'][0] = Draw.Toggle('All Actions', EVENT_REDRAW, x+180,y-25, 160, 20, GLOBALS['ANIM_ACTION_ALL'][0].val, 'Use all actions for armatures', do_anim_act_all)
- Draw.EndAlign()
-
-
- Draw.Label('Export Batch...', x+20,y-60, 300, 20)
- GLOBALS['BATCH_ENABLE'] = Draw.Toggle('Enable Batch', EVENT_REDRAW, x+20, y-80, 160, 20, GLOBALS['BATCH_ENABLE'].val, 'Automate exporting multiple scenes or groups to files', do_redraw)
-
- if GLOBALS['BATCH_ENABLE'].val:
- Draw.BeginAlign()
- GLOBALS['BATCH_GROUP'] = Draw.Toggle('Group > File', EVENT_REDRAW, x+20, y-105, 160, 20, GLOBALS['BATCH_GROUP'].val, 'Export each group as an FBX file', do_batch_type_grp)
- GLOBALS['BATCH_SCENE'] = Draw.Toggle('Scene > File', EVENT_REDRAW, x+180, y-105, 160, 20, GLOBALS['BATCH_SCENE'].val, 'Export each scene as an FBX file', do_batch_type_sce)
-
- # Own dir requires OS module
- if os:
- GLOBALS['BATCH_OWN_DIR'] = Draw.Toggle('Own Dir', EVENT_NONE, x+20, y-125, 80, 20, GLOBALS['BATCH_OWN_DIR'].val, 'Create a dir for each exported file')
- GLOBALS['BATCH_FILE_PREFIX'] = Draw.String('Prefix: ', EVENT_NONE, x+100, y-125, 240, 20, GLOBALS['BATCH_FILE_PREFIX'].val, 64, 'Prefix each file with this name ')
- else:
- GLOBALS['BATCH_FILE_PREFIX'] = Draw.String('Prefix: ', EVENT_NONE, x+20, y-125, 320, 20, GLOBALS['BATCH_FILE_PREFIX'].val, 64, 'Prefix each file with this name ')
-
-
- Draw.EndAlign()
-
- #y+=80
-
- '''
- Draw.BeginAlign()
- GLOBALS['FILENAME'] = Draw.String('path: ', EVENT_NONE, x+20, y-170, 300, 20, GLOBALS['FILENAME'].val, 64, 'Prefix each file with this name ')
- Draw.PushButton('..', EVENT_FILESEL, x+320, y-170, 20, 20, 'Select the path', do_redraw)
- '''
- # Until batch is added
- #
-
-
- #Draw.BeginAlign()
- Draw.PushButton('Online Help', EVENT_REDRAW, x+20, y-160, 100, 20, 'Open online help in a browser window', do_help)
- Draw.PushButton('Cancel', EVENT_EXIT, x+130, y-160, 100, 20, 'Exit the exporter', fbx_ui_exit)
- Draw.PushButton('Export', EVENT_FILESEL, x+240, y-160, 100, 20, 'Export the fbx file', do_redraw)
-
- #Draw.PushButton('Export', EVENT_EXIT, x+180, y-160, 160, 20, 'Export the fbx file', fbx_ui_write)
- #Draw.EndAlign()
-
- # exit when mouse out of the view?
- # GLOBALS['EVENT'] = EVENT_EXIT
-
-#def write_ui(filename):
-def write_ui():
-
- # globals
- GLOBALS['EVENT'] = EVENT_REDRAW
- #GLOBALS['MOUSE'] = Window.GetMouseCoords()
- GLOBALS['MOUSE'] = [i/2 for i in Window.GetScreenSize()]
- GLOBALS['FILENAME'] = ''
- '''
- # IF called from the fileselector
- if filename == None:
- GLOBALS['FILENAME'] = filename # Draw.Create(Blender.sys.makename(ext='.fbx'))
- else:
- GLOBALS['FILENAME'].val = filename
- '''
- GLOBALS['EXP_OBS_SELECTED'] = Draw.Create(1) # dont need 2 variables but just do this for clarity
- GLOBALS['EXP_OBS_SCENE'] = Draw.Create(0)
-
- GLOBALS['EXP_MESH'] = Draw.Create(1)
- GLOBALS['EXP_MESH_APPLY_MOD'] = Draw.Create(1)
- GLOBALS['EXP_MESH_HQ_NORMALS'] = Draw.Create(0)
- GLOBALS['EXP_ARMATURE'] = Draw.Create(1)
- GLOBALS['EXP_LAMP'] = Draw.Create(1)
- GLOBALS['EXP_CAMERA'] = Draw.Create(1)
- GLOBALS['EXP_EMPTY'] = Draw.Create(1)
- GLOBALS['EXP_IMAGE_COPY'] = Draw.Create(0)
- # animation opts
- GLOBALS['ANIM_ENABLE'] = Draw.Create(1)
- GLOBALS['ANIM_OPTIMIZE'] = Draw.Create(1)
- GLOBALS['ANIM_OPTIMIZE_PRECISSION'] = Draw.Create(4) # decimal places
- GLOBALS['ANIM_ACTION_ALL'] = [Draw.Create(0), Draw.Create(1)] # not just the current action
-
- # batch export options
- GLOBALS['BATCH_ENABLE'] = Draw.Create(0)
- GLOBALS['BATCH_GROUP'] = Draw.Create(1) # cant have both of these enabled at once.
- GLOBALS['BATCH_SCENE'] = Draw.Create(0) # see above
- GLOBALS['BATCH_FILE_PREFIX'] = Draw.Create(Blender.sys.makename(ext='_').split('\\')[-1].split('/')[-1])
- GLOBALS['BATCH_OWN_DIR'] = Draw.Create(0)
- # done setting globals
-
- # Used by the user interface
- GLOBALS['_SCALE'] = Draw.Create(1.0)
- GLOBALS['_XROT90'] = Draw.Create(True)
- GLOBALS['_YROT90'] = Draw.Create(False)
- GLOBALS['_ZROT90'] = Draw.Create(False)
-
- # best not do move the cursor
- # Window.SetMouseCoords(*[i/2 for i in Window.GetScreenSize()])
-
- # hack so the toggle buttons redraw. this is not nice at all
- while GLOBALS['EVENT'] != EVENT_EXIT:
-
- if GLOBALS['BATCH_ENABLE'].val and GLOBALS['BATCH_GROUP'].val and GLOBALS['ANIM_ACTION_ALL'][1].val:
- #Draw.PupMenu("Warning%t|Cant batch export groups with 'Current Action' ")
- GLOBALS['ANIM_ACTION_ALL'][0].val = 1
- GLOBALS['ANIM_ACTION_ALL'][1].val = 0
-
- if GLOBALS['EVENT'] == EVENT_FILESEL:
- if GLOBALS['BATCH_ENABLE'].val:
- txt = 'Batch FBX Dir'
- name = Blender.sys.expandpath('//')
- else:
- txt = 'Export FBX'
- name = Blender.sys.makename(ext='.fbx')
-
- Blender.Window.FileSelector(fbx_ui_write, txt, name)
- #fbx_ui_write('/test.fbx')
- break
-
- Draw.UIBlock(fbx_ui, 0)
-
-
- # GLOBALS.clear()
-from bpy.props import *
-class ExportFBX(bpy.types.Operator):
- '''Selection to an ASCII Autodesk FBX'''
- bl_idname = "export.fbx"
- bl_label = "Export FBX"
-
- # List of operator properties, the attributes will be assigned
- # to the class instance from the operator settings before calling.
-
-
- filepath = StringProperty(name="File Path", description="Filepath used for exporting the FBX file", maxlen= 1024, default="")
- check_existing = BoolProperty(name="Check Existing", description="Check and warn on overwriting existing files", default=True, options={'HIDDEN'})
-
- EXP_OBS_SELECTED = BoolProperty(name="Selected Objects", description="Export selected objects on visible layers", default=True)
-# EXP_OBS_SCENE = BoolProperty(name="Scene Objects", description="Export all objects in this scene", default=True)
- TX_SCALE = FloatProperty(name="Scale", description="Scale all data, (Note! some imports dont support scaled armatures)", min=0.01, max=1000.0, soft_min=0.01, soft_max=1000.0, default=1.0)
- TX_XROT90 = BoolProperty(name="Rot X90", description="Rotate all objects 90 degrees about the X axis", default=True)
- TX_YROT90 = BoolProperty(name="Rot Y90", description="Rotate all objects 90 degrees about the Y axis", default=False)
- TX_ZROT90 = BoolProperty(name="Rot Z90", description="Rotate all objects 90 degrees about the Z axis", default=False)
- EXP_EMPTY = BoolProperty(name="Empties", description="Export empty objects", default=True)
- EXP_CAMERA = BoolProperty(name="Cameras", description="Export camera objects", default=True)
- EXP_LAMP = BoolProperty(name="Lamps", description="Export lamp objects", default=True)
- EXP_ARMATURE = BoolProperty(name="Armatures", description="Export armature objects", default=True)
- EXP_MESH = BoolProperty(name="Meshes", description="Export mesh objects", default=True)
- EXP_MESH_APPLY_MOD = BoolProperty(name="Modifiers", description="Apply modifiers to mesh objects", default=True)
- EXP_MESH_HQ_NORMALS = BoolProperty(name="HQ Normals", description="Generate high quality normals", default=True)
- EXP_IMAGE_COPY = BoolProperty(name="Copy Image Files", description="Copy image files to the destination path", default=False)
- # armature animation
- ANIM_ENABLE = BoolProperty(name="Enable Animation", description="Export keyframe animation", default=True)
- ANIM_OPTIMIZE = BoolProperty(name="Optimize Keyframes", description="Remove double keyframes", default=True)
- ANIM_OPTIMIZE_PRECISSION = FloatProperty(name="Precision", description="Tolerence for comparing double keyframes (higher for greater accuracy)", min=1, max=16, soft_min=1, soft_max=16, default=6.0)
-# ANIM_ACTION_ALL = BoolProperty(name="Current Action", description="Use actions currently applied to the armatures (use scene start/end frame)", default=True)
- ANIM_ACTION_ALL = BoolProperty(name="All Actions", description="Use all actions for armatures, if false, use current action", default=False)
- # batch
- BATCH_ENABLE = BoolProperty(name="Enable Batch", description="Automate exporting multiple scenes or groups to files", default=False)
- BATCH_GROUP = BoolProperty(name="Group > File", description="Export each group as an FBX file, if false, export each scene as an FBX file", default=False)
- BATCH_OWN_DIR = BoolProperty(name="Own Dir", description="Create a dir for each exported file", default=True)
- BATCH_FILE_PREFIX = StringProperty(name="Prefix", description="Prefix each file with this name", maxlen=1024, default="")
-
-
- @classmethod
- def poll(cls, context):
- return context.active_object
-
- def execute(self, context):
- if not self.properties.filepath:
- raise Exception("filepath not set")
-
- filepath = self.properties.filepath
- filepath = bpy.path.ensure_ext(filepath, ".fbx")
-
- GLOBAL_MATRIX = mtx4_identity
- GLOBAL_MATRIX[0][0] = GLOBAL_MATRIX[1][1] = GLOBAL_MATRIX[2][2] = self.properties.TX_SCALE
- if self.properties.TX_XROT90: GLOBAL_MATRIX = mtx4_x90n * GLOBAL_MATRIX
- if self.properties.TX_YROT90: GLOBAL_MATRIX = mtx4_y90n * GLOBAL_MATRIX
- if self.properties.TX_ZROT90: GLOBAL_MATRIX = mtx4_z90n * GLOBAL_MATRIX
-
- write(filepath,
- None, # XXX
- context,
- self.properties.EXP_OBS_SELECTED,
- self.properties.EXP_MESH,
- self.properties.EXP_MESH_APPLY_MOD,
-# self.properties.EXP_MESH_HQ_NORMALS,
- self.properties.EXP_ARMATURE,
- self.properties.EXP_LAMP,
- self.properties.EXP_CAMERA,
- self.properties.EXP_EMPTY,
- self.properties.EXP_IMAGE_COPY,
- GLOBAL_MATRIX,
- self.properties.ANIM_ENABLE,
- self.properties.ANIM_OPTIMIZE,
- self.properties.ANIM_OPTIMIZE_PRECISSION,
- self.properties.ANIM_ACTION_ALL,
- self.properties.BATCH_ENABLE,
- self.properties.BATCH_GROUP,
- self.properties.BATCH_FILE_PREFIX,
- self.properties.BATCH_OWN_DIR,
- )
-
- return {'FINISHED'}
-
- def invoke(self, context, event):
- import os
- if not self.properties.is_property_set("filepath"):
- self.properties.filepath = os.path.splitext(bpy.data.filepath)[0] + ".fbx"
-
- context.manager.add_fileselect(self)
- return {'RUNNING_MODAL'}
-
-
-
-
-# if __name__ == "__main__":
-# bpy.ops.EXPORT_OT_ply(filepath="/tmp/test.ply")
+ return {'FINISHED'}
# NOTES (all line numbers correspond to original export_fbx.py (under release/scripts)
@@ -3432,21 +3003,3 @@ class ExportFBX(bpy.types.Operator):
# - bpy.sys.time move to bpy.sys.util?
# - new scene creation, activation: lines 327-342, 368
# - uses bpy.path.abspath, *.relpath - replace at least relpath
-
-# SMALL or COSMETICAL
-# - find a way to get blender version, and put it in bpy.util?, old was Blender.Get('version')
-
-
-def menu_func(self, context):
- self.layout.operator(ExportFBX.bl_idname, text="Autodesk FBX (.fbx)")
-
-
-def register():
- bpy.types.INFO_MT_file_export.append(menu_func)
-
-
-def unregister():
- bpy.types.INFO_MT_file_export.remove(menu_func)
-
-if __name__ == "__main__":
- register()
diff --git a/release/scripts/op/io_scene_obj/__init__.py b/release/scripts/op/io_scene_obj/__init__.py
new file mode 100644
index 00000000000..d3791d1cd95
--- /dev/null
+++ b/release/scripts/op/io_scene_obj/__init__.py
@@ -0,0 +1,144 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+# To support reload properly, try to access a package var, if it's there, reload everything
+if "bpy" in locals():
+ # only reload if we alredy loaded, highly annoying
+ import sys
+ reload(sys.modules.get("io_scene_obj.import_obj", sys))
+ reload(sys.modules.get("io_scene_obj.export_obj", sys))
+
+
+import bpy
+from bpy.props import *
+from io_utils import ExportHelper, ImportHelper
+
+
+class ImportOBJ(bpy.types.Operator, ImportHelper):
+ '''Load a Wavefront OBJ File'''
+ bl_idname = "import_scene.obj"
+ bl_label = "Import OBJ"
+
+ filename_ext = ".obj"
+
+ CREATE_SMOOTH_GROUPS = BoolProperty(name="Smooth Groups", description="Surround smooth groups by sharp edges", default= True)
+ CREATE_FGONS = BoolProperty(name="NGons as FGons", description="Import faces with more then 4 verts as fgons", default= True)
+ CREATE_EDGES = BoolProperty(name="Lines as Edges", description="Import lines and faces with 2 verts as edge", default= True)
+ SPLIT_OBJECTS = BoolProperty(name="Object", description="Import OBJ Objects into Blender Objects", default= True)
+ SPLIT_GROUPS = BoolProperty(name="Group", description="Import OBJ Groups into Blender Objects", default= True)
+ # old comment: only used for user feedback
+ # disabled this option because in old code a handler for it disabled SPLIT* params, it's not passed to load_obj
+ # KEEP_VERT_ORDER = BoolProperty(name="Keep Vert Order", description="Keep vert and face order, disables split options, enable for morph targets", default= True)
+ ROTATE_X90 = BoolProperty(name="-X90", description="Rotate X 90.", default= True)
+ CLAMP_SIZE = FloatProperty(name="Clamp Scale", description="Clamp the size to this maximum (Zero to Disable)", min=0.0, max=1000.0, soft_min=0.0, soft_max=1000.0, default=0.0)
+ POLYGROUPS = BoolProperty(name="Poly Groups", description="Import OBJ groups as vertex groups.", default= True)
+ IMAGE_SEARCH = BoolProperty(name="Image Search", description="Search subdirs for any assosiated images (Warning, may be slow)", default= True)
+
+
+ def execute(self, context):
+ # print("Selected: " + context.active_object.name)
+ import io_scene_obj.import_obj
+ return io_scene_obj.import_obj.load(self, context, **self.properties)
+ '''
+ load_obj(self.properties.filepath,
+ context,
+ self.properties.CLAMP_SIZE,
+ self.properties.CREATE_FGONS,
+ self.properties.CREATE_SMOOTH_GROUPS,
+ self.properties.CREATE_EDGES,
+ self.properties.SPLIT_OBJECTS,
+ self.properties.SPLIT_GROUPS,
+ self.properties.ROTATE_X90,
+ self.properties.IMAGE_SEARCH,
+ self.properties.POLYGROUPS)
+ '''
+
+ return {'FINISHED'}
+
+
+class ExportOBJ(bpy.types.Operator, ExportHelper):
+ '''Save a Wavefront OBJ File'''
+
+ bl_idname = "export_scene.obj"
+ bl_label = 'Export OBJ'
+
+ filename_ext = ".obj"
+
+ # List of operator properties, the attributes will be assigned
+ # to the class instance from the operator settings before calling.
+
+ # context group
+ use_selection = BoolProperty(name="Selection Only", description="Export selected objects only", default= False)
+ use_all_scenes = BoolProperty(name="All Scenes", description="", default= False)
+ use_animation = BoolProperty(name="Animation", description="", default= False)
+
+ # object group
+ use_modifiers = BoolProperty(name="Apply Modifiers", description="Apply modifiers (preview resolution)", default= True)
+ use_rotate_x90 = BoolProperty(name="Rotate X90", description="", default= True)
+
+ # extra data group
+ use_edges = BoolProperty(name="Edges", description="", default=True)
+ use_normals = BoolProperty(name="Normals", description="", default=False)
+ use_hq_normals = BoolProperty(name="High Quality Normals", description="", default=True)
+ use_uvs = BoolProperty(name="UVs", description="", default= True)
+ use_materials = BoolProperty(name="Materials", description="", default=True)
+ copy_images = BoolProperty(name="Copy Images", description="", default=False)
+ use_triangles = BoolProperty(name="Triangulate", description="", default=False)
+ use_vertex_groups = BoolProperty(name="Polygroups", description="", default=False)
+ use_nurbs = BoolProperty(name="Nurbs", description="", default=False)
+
+ # grouping group
+ use_blen_objects = BoolProperty(name="Objects as OBJ Objects", description="", default= True)
+ group_by_object = BoolProperty(name="Objects as OBJ Groups ", description="", default= False)
+ group_by_material = BoolProperty(name="Material Groups", description="", default= False)
+ keep_vertex_order = BoolProperty(name="Keep Vertex Order", description="", default= False)
+
+
+ def execute(self, context):
+ import io_scene_obj.export_obj
+ print(self.properties.keys())
+ return io_scene_obj.export_obj.save(self, context, **self.properties)
+
+
+def menu_func_import(self, context):
+ self.layout.operator(ImportOBJ.bl_idname, text="Wavefront (.obj)")
+
+
+def menu_func_export(self, context):
+ self.layout.operator(ExportOBJ.bl_idname, text="Wavefront (.obj)")
+
+
+def register():
+ bpy.types.INFO_MT_file_import.append(menu_func_import)
+ bpy.types.INFO_MT_file_export.append(menu_func_export)
+
+def unregister():
+ bpy.types.INFO_MT_file_import.remove(menu_func_import)
+ bpy.types.INFO_MT_file_export.remove(menu_func_export)
+
+
+# CONVERSION ISSUES
+# - matrix problem
+# - duplis - only tested dupliverts
+# - all scenes export
+# + normals calculation
+
+if __name__ == "__main__":
+ register()
diff --git a/release/scripts/io/export_obj.py b/release/scripts/op/io_scene_obj/export_obj.py
index 53c4a324ed1..01f5b221546 100644
--- a/release/scripts/io/export_obj.py
+++ b/release/scripts/op/io_scene_obj/export_obj.py
@@ -18,23 +18,6 @@
# <pep8 compliant>
-__author__ = "Campbell Barton, Jiri Hnidek, Paolo Ciccone"
-__url__ = ['http://wiki.blender.org/index.php/Scripts/Manual/Export/wavefront_obj', 'www.blender.org', 'blenderartists.org']
-__version__ = "1.21"
-
-__bpydoc__ = """\
-This script is an exporter to OBJ file format.
-
-Usage:
-
-Select the objects you wish to export and run this script from "File->Export" menu.
-Selecting the default options from the popup box will be good in most cases.
-All objects that can be represented as a mesh (mesh, curve, metaball, surface, text3d)
-will be exported as mesh data.
-"""
-
-# import math and other in functions that use them for the sake of fast Blender startup
-# import math
import os
import time
import shutil
@@ -122,7 +105,7 @@ def write_mtl(scene, filepath, copy_images, mtl_dict):
try:
filepath = copy_image(mtex.texture.image)
# filepath = mtex.texture.image.filepath.split('\\')[-1].split('/')[-1]
- file.write('map_Kd %s\n' % filepath) # Diffuse mapping image
+ file.write('map_Kd %s\n' % repr(filepath)[1:-1]) # Diffuse mapping image
break
except:
# Texture has no image though its an image type, best ignore.
@@ -184,50 +167,48 @@ def copy_images(dest_dir):
# paths= bpy.util.copy_images(uniqueImages.values(), dest_dir)
print('\tCopied %d images' % copyCount)
-# print('\tCopied %d images' % copyCount)
-# XXX not converted
+
def test_nurbs_compat(ob):
- if ob.type != 'Curve':
+ if ob.type != 'CURVE':
return False
- for nu in ob.data:
- if (not nu.knotsV) and nu.type != 1: # not a surface and not bezier
+ for nu in ob.data.splines:
+ if nu.point_count_v == 1 and nu.type != 'BEZIER': # not a surface and not bezier
return True
return False
-# XXX not converted
def write_nurb(file, ob, ob_mat):
tot_verts = 0
cu = ob.data
# use negative indices
- Vector = Blender.mathutils.Vector
- for nu in cu:
-
- if nu.type==0: DEG_ORDER_U = 1
- else: DEG_ORDER_U = nu.orderU-1 # Tested to be correct
+ for nu in cu.splines:
+ if nu.type == 'POLY':
+ DEG_ORDER_U = 1
+ else:
+ DEG_ORDER_U = nu.order_u - 1 # odd but tested to be correct
- if nu.type==1:
+ if nu.type == 'BEZIER':
print("\tWarning, bezier curve:", ob.name, "only poly and nurbs curves supported")
continue
- if nu.knotsV:
+ if nu.point_count_v > 1:
print("\tWarning, surface:", ob.name, "only poly and nurbs curves supported")
continue
- if len(nu) <= DEG_ORDER_U:
- print("\tWarning, orderU is lower then vert count, skipping:", ob.name)
+ if len(nu.points) <= DEG_ORDER_U:
+ print("\tWarning, order_u is lower then vert count, skipping:", ob.name)
continue
pt_num = 0
- do_closed = (nu.flagU & 1)
- do_endpoints = (do_closed==0) and (nu.flagU & 2)
+ do_closed = nu.use_cyclic_u
+ do_endpoints = (do_closed == 0) and nu.use_endpoint_u
- for pt in nu:
- pt = Vector(pt[0], pt[1], pt[2]) * ob_mat
+ for pt in nu.points:
+ pt = ob_mat * pt.co.copy().resize3D()
file.write('v %.6f %.6f %.6f\n' % (pt[0], pt[1], pt[2]))
pt_num += 1
tot_verts += pt_num
@@ -247,7 +228,7 @@ def write_nurb(file, ob, ob_mat):
pt_num += DEG_ORDER_U
curve_ls = curve_ls + curve_ls[0:DEG_ORDER_U]
- file.write('curv 0.0 1.0 %s\n' % (' '.join( [str(i) for i in curve_ls] ))) # Blender has no U and V values for the curve
+ file.write('curv 0.0 1.0 %s\n' % (' '.join([str(i) for i in curve_ls]))) # Blender has no U and V values for the curve
# 'parm' keyword
tot_parm = (DEG_ORDER_U + 1) + pt_num
@@ -334,7 +315,7 @@ def write_file(filepath, objects, scene,
return ret
- print('OBJ Export path: "%s"' % filepath)
+ print('OBJ Export path: %r' % filepath)
temp_mesh_name = '~tmp-mesh'
time1 = time.clock()
@@ -344,13 +325,13 @@ def write_file(filepath, objects, scene,
file = open(filepath, "w")
# Write Header
- file.write('# Blender v%s OBJ File: %s\n' % (bpy.app.version_string, bpy.data.filepath.split('/')[-1].split('\\')[-1] ))
+ file.write('# Blender v%s OBJ File: %r\n' % (bpy.app.version_string, os.path.basename(bpy.data.filepath)))
file.write('# www.blender.org\n')
# Tell the obj file what material file to use.
if EXPORT_MTL:
- mtlfilepath = '%s.mtl' % '.'.join(filepath.split('.')[:-1])
- file.write('mtllib %s\n' % ( mtlfilepath.split('\\')[-1].split('/')[-1] ))
+ mtlfilepath = os.path.splitext(filepath)[0] + ".mtl"
+ file.write('mtllib %s\n' % repr(os.path.basename(mtlfilepath))[1:-1]) # filepath can contain non utf8 chars, use repr
if EXPORT_ROTX90:
mat_xrot90= mathutils.Matrix.Rotation(-math.pi/2, 4, 'X')
@@ -390,16 +371,13 @@ def write_file(filepath, objects, scene,
for ob, ob_mat in obs:
- # XXX postponed
-# # Nurbs curve support
-# if EXPORT_CURVE_AS_NURBS and test_nurbs_compat(ob):
-# if EXPORT_ROTX90:
-# ob_mat = ob_mat * mat_xrot90
-
-# totverts += write_nurb(file, ob, ob_mat)
-
-# continue
-# end nurbs
+ # Nurbs curve support
+ if EXPORT_CURVE_AS_NURBS and test_nurbs_compat(ob):
+ if EXPORT_ROTX90:
+ ob_mat = ob_mat * mat_xrot90
+ totverts += write_nurb(file, ob, ob_mat)
+ continue
+ # END NURBS
if ob.type != 'MESH':
continue
@@ -418,7 +396,8 @@ def write_file(filepath, objects, scene,
if EXPORT_UV:
faceuv = len(me.uv_textures) > 0
- uv_layer = me.active_uv_texture.data[:]
+ if faceuv:
+ uv_layer = me.uv_textures.active.data[:]
else:
faceuv = False
@@ -542,7 +521,7 @@ def write_file(filepath, objects, scene,
uv_face_mapping = [[0,0,0,0] for i in range(len(face_index_pairs))] # a bit of a waste for tri's :/
uv_dict = {} # could use a set() here
- uv_layer = me.active_uv_texture.data
+ uv_layer = me.uv_textures.active.data
for f, f_index in face_index_pairs:
for uv_index, uv in enumerate(uv_layer[f_index].uv):
uvkey = veckey2d(uv)
@@ -755,7 +734,8 @@ def write_file(filepath, objects, scene,
print("OBJ Export time: %.2f" % (time.clock() - time1))
-def write(filepath, context,
+#
+def _write(context, filepath,
EXPORT_TRI, # ok
EXPORT_EDGES,
EXPORT_NORMALS, # not yet
@@ -781,7 +761,7 @@ def write(filepath, context,
orig_scene = context.scene
# Exit edit mode before exporting, so current object states are exported properly.
- if context.object:
+ if bpy.ops.object.mode_set.poll():
bpy.ops.object.mode_set(mode='OBJECT')
# if EXPORT_ALL_SCENES:
@@ -852,105 +832,51 @@ def write(filepath, context,
'''
Currently the exporter lacks these features:
-* nurbs
* multiple scene export (only active scene is written)
* particles
'''
-from bpy.props import *
-
-class ExportOBJ(bpy.types.Operator):
- '''Save a Wavefront OBJ File'''
-
- bl_idname = "export.obj"
- bl_label = 'Export OBJ'
-
- # List of operator properties, the attributes will be assigned
- # to the class instance from the operator settings before calling.
-
- filepath = StringProperty(name="File Path", description="Filepath used for exporting the OBJ file", maxlen= 1024, default= "")
- check_existing = BoolProperty(name="Check Existing", description="Check and warn on overwriting existing files", default=True, options={'HIDDEN'})
-
- # context group
- use_selection = BoolProperty(name="Selection Only", description="Export selected objects only", default= False)
- use_all_scenes = BoolProperty(name="All Scenes", description="", default= False)
- use_animation = BoolProperty(name="Animation", description="", default= False)
-
- # object group
- use_modifiers = BoolProperty(name="Apply Modifiers", description="Apply modifiers (preview resolution)", default= True)
- use_rotate90 = BoolProperty(name="Rotate X90", description="", default= True)
-
- # extra data group
- use_edges = BoolProperty(name="Edges", description="", default= True)
- use_normals = BoolProperty(name="Normals", description="", default= False)
- use_hq_normals = BoolProperty(name="High Quality Normals", description="", default= True)
- use_uvs = BoolProperty(name="UVs", description="", default= True)
- use_materials = BoolProperty(name="Materials", description="", default= True)
- copy_images = BoolProperty(name="Copy Images", description="", default= False)
- use_triangles = BoolProperty(name="Triangulate", description="", default= False)
- use_vertex_groups = BoolProperty(name="Polygroups", description="", default= False)
- use_nurbs = BoolProperty(name="Nurbs", description="", default= False)
-
- # grouping group
- use_blen_objects = BoolProperty(name="Objects as OBJ Objects", description="", default= True)
- group_by_object = BoolProperty(name="Objects as OBJ Groups ", description="", default= False)
- group_by_material = BoolProperty(name="Material Groups", description="", default= False)
- keep_vertex_order = BoolProperty(name="Keep Vertex Order", description="", default= False)
-
-
- def execute(self, context):
-
- filepath = self.properties.filepath
- filepath = bpy.path.ensure_ext(filepath, ".obj")
-
- write(filepath, context,
- EXPORT_TRI=self.properties.use_triangles,
- EXPORT_EDGES=self.properties.use_edges,
- EXPORT_NORMALS=self.properties.use_normals,
- EXPORT_NORMALS_HQ=self.properties.use_hq_normals,
- EXPORT_UV=self.properties.use_uvs,
- EXPORT_MTL=self.properties.use_materials,
- EXPORT_COPY_IMAGES=self.properties.copy_images,
- EXPORT_APPLY_MODIFIERS=self.properties.use_modifiers,
- EXPORT_ROTX90=self.properties.use_rotate90,
- EXPORT_BLEN_OBS=self.properties.use_blen_objects,
- EXPORT_GROUP_BY_OB=self.properties.group_by_object,
- EXPORT_GROUP_BY_MAT=self.properties.group_by_material,
- EXPORT_KEEP_VERT_ORDER=self.properties.keep_vertex_order,
- EXPORT_POLYGROUPS=self.properties.use_vertex_groups,
- EXPORT_CURVE_AS_NURBS=self.properties.use_nurbs,
- EXPORT_SEL_ONLY=self.properties.use_selection,
- EXPORT_ALL_SCENES=self.properties.use_all_scenes,
- EXPORT_ANIMATION=self.properties.use_animation)
-
- return {'FINISHED'}
-
- def invoke(self, context, event):
- import os
- if not self.properties.is_property_set("filepath"):
- self.properties.filepath = os.path.splitext(bpy.data.filepath)[0] + ".obj"
-
- context.manager.add_fileselect(self)
- return {'RUNNING_MODAL'}
-
-
-def menu_func(self, context):
- self.layout.operator(ExportOBJ.bl_idname, text="Wavefront (.obj)")
-
-
-def register():
- bpy.types.INFO_MT_file_export.append(menu_func)
-
-def unregister():
- bpy.types.INFO_MT_file_export.remove(menu_func)
-
-
-# CONVERSION ISSUES
-# - matrix problem
-# - duplis - only tested dupliverts
-# - NURBS - needs API additions
-# - all scenes export
-# + normals calculation
-if __name__ == "__main__":
- register()
+def save(operator, context, filepath="",
+ use_triangles=False,
+ use_edges=False,
+ use_normals=False,
+ use_hq_normals=False,
+ use_uvs=True,
+ use_materials=True,
+ copy_images=False,
+ use_modifiers=True,
+ use_rotate_x90=True,
+ use_blen_objects=True,
+ group_by_object=False,
+ group_by_material=False,
+ keep_vertex_order=False,
+ use_vertex_groups=False,
+ use_nurbs=True,
+ use_selection=True,
+ use_all_scenes=False,
+ use_animation=False,
+ ):
+
+ _write(context, filepath,
+ EXPORT_TRI=use_triangles,
+ EXPORT_EDGES=use_edges,
+ EXPORT_NORMALS=use_normals,
+ EXPORT_NORMALS_HQ=use_hq_normals,
+ EXPORT_UV=use_uvs,
+ EXPORT_MTL=use_materials,
+ EXPORT_COPY_IMAGES=copy_images,
+ EXPORT_APPLY_MODIFIERS=use_modifiers,
+ EXPORT_ROTX90=use_rotate_x90,
+ EXPORT_BLEN_OBS=use_blen_objects,
+ EXPORT_GROUP_BY_OB=group_by_object,
+ EXPORT_GROUP_BY_MAT=group_by_material,
+ EXPORT_KEEP_VERT_ORDER=keep_vertex_order,
+ EXPORT_POLYGROUPS=use_vertex_groups,
+ EXPORT_CURVE_AS_NURBS=use_nurbs,
+ EXPORT_SEL_ONLY=use_selection,
+ EXPORT_ALL_SCENES=use_all_scenes,
+ EXPORT_ANIMATION=use_animation,
+ )
+
+ return {'FINISHED'}
diff --git a/release/scripts/io/import_scene_obj.py b/release/scripts/op/io_scene_obj/import_obj.py
index 655f797750e..a5605d23cb3 100644
--- a/release/scripts/io/import_scene_obj.py
+++ b/release/scripts/op/io_scene_obj/import_obj.py
@@ -18,85 +18,26 @@
# <pep8 compliant>
-__author__= "Campbell Barton", "Jiri Hnidek", "Paolo Ciccone"
-__url__= ['http://wiki.blender.org/index.php/Scripts/Manual/Import/wavefront_obj', 'blender.org', 'blenderartists.org']
-__version__= "2.11"
+# Script copyright (C) Campbell Barton
+# Contributors: Campbell Barton, Jiri Hnidek, Paolo Ciccone
-__bpydoc__= """\
+"""
This script imports a Wavefront OBJ files to Blender.
Usage:
Run this script from "File->Import" menu and then load the desired OBJ file.
Note, This loads mesh objects and materials only, nurbs and curves are not supported.
-"""
-# ***** BEGIN GPL LICENSE BLOCK *****
-#
-# Script copyright (C) Campbell J Barton 2007
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# ***** END GPL LICENCE BLOCK *****
-# --------------------------------------------------------------------------
+http://wiki.blender.org/index.php/Scripts/Manual/Import/wavefront_obj
+"""
import os
import time
import bpy
import mathutils
from geometry import PolyFill
+from io_utils import load_image, unpack_list, unpack_face_list
-# from Blender import Mesh, Draw, Window, Texture, Material, sys
-# # import BPyMesh
-# import BPyImage
-# import BPyMessages
-
-# try: import os
-# except: os= False
-
-def stripExt(name): # name is a string
- '''Strips the prefix off the name before writing'''
- index= name.rfind('.')
- if index != -1:
- return name[ : index ]
- else:
- return name
-# end path funcs
-
-def unpack_list(list_of_tuples):
- l = []
- for t in list_of_tuples:
- l.extend(t)
- return l
-
-# same as above except that it adds 0 for triangle faces
-def unpack_face_list(list_of_tuples):
- # allocate the entire list
- flat_ls = [0] * (len(list_of_tuples) * 4)
- i = 0
-
- for t in list_of_tuples:
- if len(t) == 3:
- if t[2] == 0:
- t = t[1], t[2], t[0]
- else: # assuem quad
- if t[3] == 0 or t[2] == 0:
- t = t[2], t[3], t[0], t[1]
-
- flat_ls[i:i + len(t)] = t
- i += 4
- return flat_ls
def BPyMesh_ngon(from_data, indices, PREF_FIX_LOOPS= True):
'''
@@ -116,7 +57,7 @@ def BPyMesh_ngon(from_data, indices, PREF_FIX_LOOPS= True):
if not indices:
return []
- # return []
+ # return []
def rvec(co): return round(co.x, 6), round(co.y, 6), round(co.z, 6)
def mlen(co): return abs(co[0])+abs(co[1])+abs(co[2]) # manhatten length of a vector, faster then length
@@ -297,21 +238,6 @@ def line_value(line_split):
elif length > 2:
return ' '.join( line_split[1:] )
-# limited replacement for BPyImage.comprehensiveImageLoad
-def load_image(imagepath, dirname):
-
- if os.path.exists(imagepath):
- return bpy.data.images.load(imagepath)
-
- variants = [imagepath, os.path.join(dirname, imagepath), os.path.join(dirname, os.path.basename(imagepath))]
-
- for filepath in variants:
- for nfilepath in (filepath, bpy.path.resolve_ncase(filepath)):
- if os.path.exists(nfilepath):
- return bpy.data.images.load(nfilepath)
-
- # TODO comprehensiveImageLoad also searched in bpy.config.textureDir
- return None
def obj_image_load(imagepath, DIR, IMAGE_SEARCH):
if '_' in imagepath:
@@ -327,21 +253,21 @@ def obj_image_load(imagepath, DIR, IMAGE_SEARCH):
return None
# def obj_image_load(imagepath, DIR, IMAGE_SEARCH):
-# '''
-# Mainly uses comprehensiveImageLoad
-# but tries to replace '_' with ' ' for Max's exporter replaces spaces with underscores.
-# '''
+# '''
+# Mainly uses comprehensiveImageLoad
+# but tries to replace '_' with ' ' for Max's exporter replaces spaces with underscores.
+# '''
-# if '_' in imagepath:
-# image= BPyImage.comprehensiveImageLoad(imagepath, DIR, PLACE_HOLDER= False, RECURSIVE= IMAGE_SEARCH)
-# if image: return image
-# # Did the exporter rename the image?
-# image= BPyImage.comprehensiveImageLoad(imagepath.replace('_', ' '), DIR, PLACE_HOLDER= False, RECURSIVE= IMAGE_SEARCH)
-# if image: return image
+# if '_' in imagepath:
+# image= BPyImage.comprehensiveImageLoad(imagepath, DIR, PLACE_HOLDER= False, RECURSIVE= IMAGE_SEARCH)
+# if image: return image
+# # Did the exporter rename the image?
+# image= BPyImage.comprehensiveImageLoad(imagepath.replace('_', ' '), DIR, PLACE_HOLDER= False, RECURSIVE= IMAGE_SEARCH)
+# if image: return image
-# # Return an image, placeholder if it dosnt exist
-# image= BPyImage.comprehensiveImageLoad(imagepath, DIR, PLACE_HOLDER= True, RECURSIVE= IMAGE_SEARCH)
-# return image
+# # Return an image, placeholder if it dosnt exist
+# image= BPyImage.comprehensiveImageLoad(imagepath, DIR, PLACE_HOLDER= True, RECURSIVE= IMAGE_SEARCH)
+# return image
def create_materials(filepath, material_libs, unique_materials, unique_material_images, IMAGE_SEARCH):
@@ -356,18 +282,15 @@ def create_materials(filepath, material_libs, unique_materials, unique_material_
#==================================================================================#
def load_material_image(blender_material, context_material_name, imagepath, type):
- texture= bpy.data.textures.new(type)
- texture.type= 'IMAGE'
- texture = texture.recast_type() # Workaround for limitation in rna api.
-# texture= bpy.data.textures.new(type)
-# texture.setType('Image')
+ texture= bpy.data.textures.new(name=type, type='IMAGE')
# Absolute path - c:\.. etc would work here
- image= obj_image_load(imagepath, DIR, IMAGE_SEARCH)
- has_data = image.has_data if image else False
+ image = obj_image_load(imagepath, DIR, IMAGE_SEARCH)
+ has_data = False
if image:
texture.image = image
+ has_data = image.has_data
# Adds textures for materials (rendering)
if type == 'Kd':
@@ -375,42 +298,65 @@ def create_materials(filepath, material_libs, unique_materials, unique_material_
# Image has alpha
# XXX bitmask won't work?
- blender_material.add_texture(texture, 'UV', {'COLOR', 'ALPHA'})
+ mtex = blender_material.texture_slots.add()
+ mtex.texture = texture
+ mtex.texture_coords = 'UV'
+ mtex.use_map_color_diffuse = True
+ mtex.use_map_alpha = True
+
texture.mipmap = True
texture.interpolation = True
texture.use_alpha = True
blender_material.use_transparency = True
blender_material.alpha = 0.0
else:
- blender_material.add_texture(texture, 'UV', 'COLOR')
+ mtex = blender_material.texture_slots.add()
+ mtex.texture = texture
+ mtex.texture_coords = 'UV'
+ mtex.use_map_color_diffuse = True
# adds textures to faces (Textured/Alt-Z mode)
# Only apply the diffuse texture to the face if the image has not been set with the inline usemat func.
unique_material_images[context_material_name]= image, has_data # set the texface image
elif type == 'Ka':
- blender_material.add_texture(texture, 'UV', 'AMBIENT')
-# blender_material.setTexture(1, texture, Texture.TexCo.UV, Texture.MapTo.CMIR) # TODO- Add AMB to BPY API
+ mtex = blender_material.texture_slots.add()
+ mtex.texture = texture
+ mtex.texture_coords = 'UV'
+ mtex.use_map_ambient = True
+# blender_material.setTexture(1, texture, Texture.TexCo.UV, Texture.MapTo.CMIR) # TODO- Add AMB to BPY API
elif type == 'Ks':
- blender_material.add_texture(texture, 'UV', 'SPECULARITY')
-# blender_material.setTexture(2, texture, Texture.TexCo.UV, Texture.MapTo.SPEC)
+ mtex = blender_material.texture_slots.add()
+ mtex.texture = texture
+ mtex.texture_coords = 'UV'
+ mtex.use_map_specular = True
+# blender_material.setTexture(2, texture, Texture.TexCo.UV, Texture.MapTo.SPEC)
elif type == 'Bump':
- blender_material.add_texture(texture, 'UV', 'NORMAL')
-# blender_material.setTexture(3, texture, Texture.TexCo.UV, Texture.MapTo.NOR)
+ mtex = blender_material.texture_slots.add()
+ mtex.texture = texture
+ mtex.texture_coords = 'UV'
+ mtex.use_map_normal = True
+# blender_material.setTexture(3, texture, Texture.TexCo.UV, Texture.MapTo.NOR)
elif type == 'D':
- blender_material.add_texture(texture, 'UV', 'ALPHA')
+ mtex = blender_material.texture_slots.add()
+ mtex.texture = texture
+ mtex.texture_coords = 'UV'
+ mtex.use_map_alpha = True
blender_material.z_transparency = True
blender_material.alpha = 0.0
-# blender_material.setTexture(4, texture, Texture.TexCo.UV, Texture.MapTo.ALPHA)
-# blender_material.mode |= Material.Modes.ZTRANSP
-# blender_material.alpha = 0.0
+# blender_material.setTexture(4, texture, Texture.TexCo.UV, Texture.MapTo.ALPHA)
+# blender_material.mode |= Material.Modes.ZTRANSP
+# blender_material.alpha = 0.0
# Todo, unset deffuse material alpha if it has an alpha channel
elif type == 'refl':
- blender_material.add_texture(texture, 'UV', 'REFLECTION')
-# blender_material.setTexture(5, texture, Texture.TexCo.UV, Texture.MapTo.REF)
+ mtex = blender_material.texture_slots.add()
+ mtex.texture = texture
+ mtex.texture_coords = 'UV'
+ mtex.use_map_reflect = True
+# blender_material.setTexture(5, texture, Texture.TexCo.UV, Texture.MapTo.REF)
# Add an MTL with the same name as the obj if no MTLs are spesified.
@@ -451,22 +397,16 @@ def create_materials(filepath, material_libs, unique_materials, unique_material_
line_lower= line.lower().lstrip()
if line_lower.startswith('ka'):
context_material.mirror_color = (float(line_split[1]), float(line_split[2]), float(line_split[3]))
-# context_material.setMirCol((float(line_split[1]), float(line_split[2]), float(line_split[3])))
elif line_lower.startswith('kd'):
context_material.diffuse_color = (float(line_split[1]), float(line_split[2]), float(line_split[3]))
-# context_material.setRGBCol((float(line_split[1]), float(line_split[2]), float(line_split[3])))
elif line_lower.startswith('ks'):
context_material.specular_color = (float(line_split[1]), float(line_split[2]), float(line_split[3]))
-# context_material.setSpecCol((float(line_split[1]), float(line_split[2]), float(line_split[3])))
elif line_lower.startswith('ns'):
context_material.specular_hardness = int((float(line_split[1])*0.51))
-# context_material.setHardness( int((float(line_split[1])*0.51)) )
elif line_lower.startswith('ni'): # Refraction index
- context_material.raytrace_transparency.ior = max(1, min(float(line_split[1]), 3))
-# context_material.setIOR( max(1, min(float(line_split[1]), 3))) # Between 1 and 3
+ context_material.raytrace_transparency.ior = max(1, min(float(line_split[1]), 3)) # Between 1 and 3
elif line_lower.startswith('d') or line_lower.startswith('tr'):
context_material.alpha = float(line_split[1])
-# context_material.setAlpha(float(line_split[1]))
elif line_lower.startswith('map_ka'):
img_filepath= line_value(line.split())
if img_filepath:
@@ -624,14 +564,14 @@ def create_mesh(new_objects, has_ngons, CREATE_FGONS, CREATE_EDGES, verts_loc, v
if has_ngons and len_face_vert_loc_indicies > 4:
ngon_face_indices= BPyMesh_ngon(verts_loc, face_vert_loc_indicies)
- faces.extend(\
- [(\
- [face_vert_loc_indicies[ngon[0]], face_vert_loc_indicies[ngon[1]], face_vert_loc_indicies[ngon[2]] ],\
- [face_vert_tex_indicies[ngon[0]], face_vert_tex_indicies[ngon[1]], face_vert_tex_indicies[ngon[2]] ],\
- context_material,\
- context_smooth_group,\
- context_object)\
- for ngon in ngon_face_indices]\
+ faces.extend(
+ [(
+ [face_vert_loc_indicies[ngon[0]], face_vert_loc_indicies[ngon[1]], face_vert_loc_indicies[ngon[2]] ],
+ [face_vert_tex_indicies[ngon[0]], face_vert_tex_indicies[ngon[1]], face_vert_tex_indicies[ngon[2]] ],
+ context_material,
+ context_smooth_group,
+ context_object)
+ for ngon in ngon_face_indices]
)
# edges to make fgons
@@ -676,30 +616,25 @@ def create_mesh(new_objects, has_ngons, CREATE_FGONS, CREATE_EDGES, verts_loc, v
# make sure the list isnt too big
for material in materials:
- me.add_material(material)
- #me.vertices.extend([(0,0,0)]) # dummy vert
+ me.materials.append(material)
- me.add_geometry(len(verts_loc), 0, len(faces))
+ me.vertices.add(len(verts_loc))
+ me.faces.add(len(faces))
# verts_loc is a list of (x, y, z) tuples
me.vertices.foreach_set("co", unpack_list(verts_loc))
-# me.vertices.extend(verts_loc)
# faces is a list of (vert_indices, texco_indices, ...) tuples
# XXX faces should contain either 3 or 4 verts
# XXX no check for valid face indices
me.faces.foreach_set("vertices_raw", unpack_face_list([f[0] for f in faces]))
-# face_mapping= me.faces.extend([f[0] for f in faces], indexList=True)
if verts_tex and me.faces:
- me.add_uv_texture()
-# me.faceUV= 1
- # TEXMODE= Mesh.FaceModes['TEX']
+ me.uv_textures.new()
context_material_old= -1 # avoid a dict lookup
mat= 0 # rare case it may be un-initialized.
me_faces= me.faces
-# ALPHA= Mesh.FaceTranspModes.ALPHA
for i, face in enumerate(faces):
if len(face[0]) < 2:
@@ -708,14 +643,8 @@ def create_mesh(new_objects, has_ngons, CREATE_FGONS, CREATE_EDGES, verts_loc, v
if CREATE_EDGES:
edges.append(face[0])
else:
-# face_index_map= face_mapping[i]
-
- # since we use foreach_set to add faces, all of them are added
- if 1:
-# if face_index_map!=None: # None means the face wasnt added
blender_face = me.faces[i]
-# blender_face= me_faces[face_index_map]
face_vert_loc_indicies,\
face_vert_tex_indicies,\
@@ -734,7 +663,7 @@ def create_mesh(new_objects, has_ngons, CREATE_FGONS, CREATE_EDGES, verts_loc, v
context_material_old= context_material
blender_face.material_index= mat
-# blender_face.mat= mat
+# blender_face.mat= mat
if verts_tex:
@@ -766,57 +695,57 @@ def create_mesh(new_objects, has_ngons, CREATE_FGONS, CREATE_EDGES, verts_loc, v
if len(face_vert_loc_indicies)==4:
blender_tface.uv4= verts_tex[face_vert_tex_indicies[3]]
-# for ii, uv in enumerate(blender_face.uv):
-# uv.x, uv.y= verts_tex[face_vert_tex_indicies[ii]]
+# for ii, uv in enumerate(blender_face.uv):
+# uv.x, uv.y= verts_tex[face_vert_tex_indicies[ii]]
del me_faces
-# del ALPHA
+# del ALPHA
if CREATE_EDGES:
- me.add_geometry(0, len(edges), 0)
+ me.edges.add(len(edges))
# edges should be a list of (a, b) tuples
me.edges.foreach_set("vertices", unpack_list(edges))
-# me_edges.extend( edges )
+# me_edges.extend( edges )
-# del me_edges
+# del me_edges
# Add edge faces.
-# me_edges= me.edges
+# me_edges= me.edges
def edges_match(e1, e2):
return (e1[0] == e2[0] and e1[1] == e2[1]) or (e1[0] == e2[1] and e1[1] == e2[0])
# XXX slow
-# if CREATE_FGONS and fgon_edges:
-# for fgon_edge in fgon_edges.keys():
-# for ed in me.edges:
-# if edges_match(fgon_edge, ed.vertices):
-# ed.is_fgon = True
-
-# if CREATE_FGONS and fgon_edges:
-# FGON= Mesh.EdgeFlags.FGON
-# for ed in me.findEdges( fgon_edges.keys() ):
-# if ed!=None:
-# me_edges[ed].flag |= FGON
-# del FGON
+# if CREATE_FGONS and fgon_edges:
+# for fgon_edge in fgon_edges.keys():
+# for ed in me.edges:
+# if edges_match(fgon_edge, ed.vertices):
+# ed.is_fgon = True
+
+# if CREATE_FGONS and fgon_edges:
+# FGON= Mesh.EdgeFlags.FGON
+# for ed in me.findEdges( fgon_edges.keys() ):
+# if ed!=None:
+# me_edges[ed].flag |= FGON
+# del FGON
# XXX slow
-# if unique_smooth_groups and sharp_edges:
-# for sharp_edge in sharp_edges.keys():
-# for ed in me.edges:
-# if edges_match(sharp_edge, ed.vertices):
-# ed.use_edge_sharp = True
-
-# if unique_smooth_groups and sharp_edges:
-# SHARP= Mesh.EdgeFlags.SHARP
-# for ed in me.findEdges( sharp_edges.keys() ):
-# if ed!=None:
-# me_edges[ed].flag |= SHARP
-# del SHARP
+# if unique_smooth_groups and sharp_edges:
+# for sharp_edge in sharp_edges.keys():
+# for ed in me.edges:
+# if edges_match(sharp_edge, ed.vertices):
+# ed.use_edge_sharp = True
+
+# if unique_smooth_groups and sharp_edges:
+# SHARP= Mesh.EdgeFlags.SHARP
+# for ed in me.findEdges( sharp_edges.keys() ):
+# if ed!=None:
+# me_edges[ed].flag |= SHARP
+# del SHARP
me.update()
-# me.calcNormals()
+# me.calcNormals()
ob= bpy.data.objects.new("Mesh", me)
new_objects.append(ob)
@@ -825,11 +754,8 @@ def create_mesh(new_objects, has_ngons, CREATE_FGONS, CREATE_EDGES, verts_loc, v
# content of the vertex_groups. If the user selects to NOT have vertex groups saved then
# the following test will never run
for group_name, group_indicies in vertex_groups.items():
- group= ob.add_vertex_group(group_name)
-# me.addVertGroup(group_name)
- for vertex_index in group_indicies:
- ob.add_vertex_to_group(vertex_index, group, 1.0, 'REPLACE')
-# me.assignVertsToGroup(group_name, group_indicies, 1.00, Mesh.AssignModes.REPLACE)
+ group= ob.vertex_groups.new(group_name)
+ ob.vertex_groups.assign(group_indicies, group, 1.0, 'REPLACE')
def create_nurbs(context_nurbs, vert_loc, new_objects):
@@ -857,21 +783,14 @@ def create_nurbs(context_nurbs, vert_loc, new_objects):
print('\tWarning, surfaces not supported')
return
- cu = bpy.data.curves.new(name, 'Curve')
- cu.flag |= 1 # 3D curve
+ cu = bpy.data.curves.new(name, 'CURVE')
+ cu.dimensions = '3D'
- nu = None
- for pt in curv_idx:
+ nu = cu.splines.new('NURBS')
+ nu.points.add(len(curv_idx) - 1) # a point is added to start with
+ nu.points.foreach_set("co", [co_axis for vt_idx in curv_idx for co_axis in (vert_loc[vt_idx] + (1.0,))])
- pt = vert_loc[pt]
- pt = (pt[0], pt[1], pt[2], 1.0)
-
- if nu == None:
- nu = cu.appendNurb(pt)
- else:
- nu.append(pt)
-
- nu.orderU = deg[0]+1
+ nu.order_u = deg[0] + 1
# get for endpoint flag from the weighting
if curv_range and len(parm_u) > deg[0]+1:
@@ -890,7 +809,7 @@ def create_nurbs(context_nurbs, vert_loc, new_objects):
do_endpoints = False
if do_endpoints:
- nu.flagU |= 2
+ nu.use_endpoint_u = True
# close
@@ -905,10 +824,10 @@ def create_nurbs(context_nurbs, vert_loc, new_objects):
break
if do_closed:
- nu.flagU |= 1
+ nu.use_cyclic_u = True
'''
- ob= bpy.data.objects.new("Mesh", me)
+ ob= bpy.data.objects.new("Nurb", cu)
new_objects.append(ob)
@@ -927,7 +846,7 @@ def strip_slash(line_split):
def get_float_func(filepath):
'''
find the float function for this obj file
- - weather to replace commas or not
+ - whether to replace commas or not
'''
file= open(filepath, 'rU')
for line in file: #.xreadlines():
@@ -941,31 +860,29 @@ def get_float_func(filepath):
# incase all vert values were ints
return float
-def load_obj(filepath,
- context,
- CLAMP_SIZE= 0.0,
- CREATE_FGONS= True,
- CREATE_SMOOTH_GROUPS= True,
- CREATE_EDGES= True,
- SPLIT_OBJECTS= True,
- SPLIT_GROUPS= True,
- SPLIT_MATERIALS= True,
- ROTATE_X90= True,
- IMAGE_SEARCH=True,
- POLYGROUPS=False):
+def load(operator, context, filepath,
+ CLAMP_SIZE= 0.0,
+ CREATE_FGONS= True,
+ CREATE_SMOOTH_GROUPS= True,
+ CREATE_EDGES= True,
+ SPLIT_OBJECTS= True,
+ SPLIT_GROUPS= True,
+ ROTATE_X90= True,
+ IMAGE_SEARCH=True,
+ POLYGROUPS=False):
'''
Called by the user interface or another script.
load_obj(path) - should give acceptable results.
This function passes the file and sends the data off
to be split into objects and then converted into mesh objects
'''
- print('\nimporting obj "%s"' % filepath)
+ print('\nimporting obj %r' % filepath)
- if SPLIT_OBJECTS or SPLIT_GROUPS or SPLIT_MATERIALS:
+ if SPLIT_OBJECTS or SPLIT_GROUPS:
POLYGROUPS = False
time_main= time.time()
-# time_main= sys.time()
+# time_main= sys.time()
verts_loc= []
verts_tex= []
@@ -999,12 +916,12 @@ def load_obj(filepath,
# when there are faces that end with \
# it means they are multiline-
# since we use xreadline we cant skip to the next line
- # so we need to know weather
+ # so we need to know whether
context_multi_line= ''
- print('\tparsing obj file "%s"...' % filepath)
+ print("\tparsing obj file...")
time_sub= time.time()
-# time_sub= sys.time()
+# time_sub= sys.time()
file= open(filepath, 'rU')
for line in file: #.xreadlines():
@@ -1055,7 +972,7 @@ def load_obj(filepath,
vert_loc_index= int(obj_vert[0])-1
# Add the vertex to the current group
# *warning*, this wont work for files that have groups defined around verts
- if POLYGROUPS and context_vgroup:
+ if POLYGROUPS and context_vgroup:
vertex_groups[context_vgroup].append(vert_loc_index)
# Make relative negative vert indicies absolute
@@ -1147,8 +1064,7 @@ def load_obj(filepath,
context_material= line_value(line.split())
unique_materials[context_material]= None
elif line.startswith('mtllib'): # usemap or usemat
- material_libs.extend( line.split()[1:] ) # can have multiple mtllib filenames per line
-
+ material_libs = list(set(material_libs) | set(line.split()[1:])) # can have multiple mtllib filenames per line, mtllib can appear more than once, so make sure only occurance of material exists
# Nurbs support
elif line.startswith('cstype '):
@@ -1213,7 +1129,7 @@ def load_obj(filepath,
file.close()
time_new= time.time()
-# time_new= sys.time()
+# time_new= sys.time()
print('%.4f sec' % (time_new-time_sub))
time_sub= time_new
@@ -1222,7 +1138,7 @@ def load_obj(filepath,
create_materials(filepath, material_libs, unique_materials, unique_material_images, IMAGE_SEARCH)
time_new= time.time()
-# time_new= sys.time()
+# time_new= sys.time()
print('%.4f sec' % (time_new-time_sub))
time_sub= time_new
@@ -1230,29 +1146,29 @@ def load_obj(filepath,
verts_loc[:] = [(v[0], v[2], -v[1]) for v in verts_loc]
# deselect all
-# if context.selected_objects:
-# bpy.ops.OBJECT_OT_select_all()
+ bpy.ops.object.select_all(action='DESELECT')
scene = context.scene
-# scn.objects.selected = []
+# scn.objects.selected = []
new_objects= [] # put new objects here
print('\tbuilding geometry...\n\tverts:%i faces:%i materials: %i smoothgroups:%i ...' % ( len(verts_loc), len(faces), len(unique_materials), len(unique_smooth_groups) ))
# Split the mesh by objects/materials, may
- if SPLIT_OBJECTS or SPLIT_GROUPS: SPLIT_OB_OR_GROUP = True
- else: SPLIT_OB_OR_GROUP = False
+ if SPLIT_OBJECTS or SPLIT_GROUPS: SPLIT_OB_OR_GROUP = True
+ else: SPLIT_OB_OR_GROUP = False
for verts_loc_split, faces_split, unique_materials_split, dataname in split_mesh(verts_loc, faces, unique_materials, filepath, SPLIT_OB_OR_GROUP):
# Create meshes from the data, warning 'vertex_groups' wont support splitting
create_mesh(new_objects, has_ngons, CREATE_FGONS, CREATE_EDGES, verts_loc_split, verts_tex, faces_split, unique_materials_split, unique_material_images, unique_smooth_groups, vertex_groups, dataname)
# nurbs support
-# for context_nurbs in nurbs:
-# create_nurbs(scn, context_nurbs, verts_loc, new_objects)
+ for context_nurbs in nurbs:
+ create_nurbs(context_nurbs, verts_loc, new_objects)
# Create new obj
for obj in new_objects:
- scene.objects.link(obj)
+ base = scene.objects.link(obj)
+ base.select = True
scene.update()
@@ -1260,340 +1176,45 @@ def load_obj(filepath,
axis_min= [ 1000000000]*3
axis_max= [-1000000000]*3
-# if CLAMP_SIZE:
-# # Get all object bounds
-# for ob in new_objects:
-# for v in ob.getBoundBox():
-# for axis, value in enumerate(v):
-# if axis_min[axis] > value: axis_min[axis]= value
-# if axis_max[axis] < value: axis_max[axis]= value
+# if CLAMP_SIZE:
+# # Get all object bounds
+# for ob in new_objects:
+# for v in ob.getBoundBox():
+# for axis, value in enumerate(v):
+# if axis_min[axis] > value: axis_min[axis]= value
+# if axis_max[axis] < value: axis_max[axis]= value
-# # Scale objects
-# max_axis= max(axis_max[0]-axis_min[0], axis_max[1]-axis_min[1], axis_max[2]-axis_min[2])
-# scale= 1.0
+# # Scale objects
+# max_axis= max(axis_max[0]-axis_min[0], axis_max[1]-axis_min[1], axis_max[2]-axis_min[2])
+# scale= 1.0
-# while CLAMP_SIZE < max_axis * scale:
-# scale= scale/10.0
+# while CLAMP_SIZE < max_axis * scale:
+# scale= scale/10.0
-# for ob in new_objects:
-# ob.setSize(scale, scale, scale)
+# for ob in new_objects:
+# ob.setSize(scale, scale, scale)
# Better rotate the vert locations
#if not ROTATE_X90:
- # for ob in new_objects:
- # ob.RotX = -1.570796326794896558
+ # for ob in new_objects:
+ # ob.RotX = -1.570796326794896558
time_new= time.time()
-# time_new= sys.time()
-
- print('%.4f sec' % (time_new-time_sub))
- print('finished importing: "%s" in %.4f sec.' % (filepath, (time_new-time_main)))
-
-
-DEBUG= True
-
-
-def load_obj_ui(filepath, BATCH_LOAD= False):
- if BPyMessages.Error_NoFile(filepath):
- return
-
- global CREATE_SMOOTH_GROUPS, CREATE_FGONS, CREATE_EDGES, SPLIT_OBJECTS, SPLIT_GROUPS, CLAMP_SIZE, IMAGE_SEARCH, POLYGROUPS, KEEP_VERT_ORDER, ROTATE_X90
-
- CREATE_SMOOTH_GROUPS= Draw.Create(0)
- CREATE_FGONS= Draw.Create(1)
- CREATE_EDGES= Draw.Create(1)
- SPLIT_OBJECTS= Draw.Create(0)
- SPLIT_GROUPS= Draw.Create(0)
- CLAMP_SIZE= Draw.Create(10.0)
- IMAGE_SEARCH= Draw.Create(1)
- POLYGROUPS= Draw.Create(0)
- KEEP_VERT_ORDER= Draw.Create(1)
- ROTATE_X90= Draw.Create(1)
-
-
- # Get USER Options
- # Note, Works but not pretty, instead use a more complicated GUI
- '''
- pup_block= [\
- 'Import...',\
- ('Smooth Groups', CREATE_SMOOTH_GROUPS, 'Surround smooth groups by sharp edges'),\
- ('Create FGons', CREATE_FGONS, 'Import faces with more then 4 verts as fgons.'),\
- ('Lines', CREATE_EDGES, 'Import lines and faces with 2 verts as edges'),\
- 'Separate objects from obj...',\
- ('Object', SPLIT_OBJECTS, 'Import OBJ Objects into Blender Objects'),\
- ('Group', SPLIT_GROUPS, 'Import OBJ Groups into Blender Objects'),\
- 'Options...',\
- ('Keep Vert Order', KEEP_VERT_ORDER, 'Keep vert and face order, disables some other options.'),\
- ('Clamp Scale:', CLAMP_SIZE, 0.0, 1000.0, 'Clamp the size to this maximum (Zero to Disable)'),\
- ('Image Search', IMAGE_SEARCH, 'Search subdirs for any assosiated images (Warning, may be slow)'),\
- ]
-
- if not Draw.PupBlock('Import OBJ...', pup_block):
- return
-
- if KEEP_VERT_ORDER.val:
- SPLIT_OBJECTS.val = False
- SPLIT_GROUPS.val = False
- '''
-
-
-
- # BEGIN ALTERNATIVE UI *******************
- if True:
-
- EVENT_NONE = 0
- EVENT_EXIT = 1
- EVENT_REDRAW = 2
- EVENT_IMPORT = 3
-
- GLOBALS = {}
- GLOBALS['EVENT'] = EVENT_REDRAW
- #GLOBALS['MOUSE'] = Window.GetMouseCoords()
- GLOBALS['MOUSE'] = [i/2 for i in Window.GetScreenSize()]
-
- def obj_ui_set_event(e,v):
- GLOBALS['EVENT'] = e
-
- def do_split(e,v):
- global SPLIT_OBJECTS, SPLIT_GROUPS, KEEP_VERT_ORDER, POLYGROUPS
- if SPLIT_OBJECTS.val or SPLIT_GROUPS.val:
- KEEP_VERT_ORDER.val = 0
- POLYGROUPS.val = 0
- else:
- KEEP_VERT_ORDER.val = 1
-
- def do_vertorder(e,v):
- global SPLIT_OBJECTS, SPLIT_GROUPS, KEEP_VERT_ORDER
- if KEEP_VERT_ORDER.val:
- SPLIT_OBJECTS.val = SPLIT_GROUPS.val = 0
- else:
- if not (SPLIT_OBJECTS.val or SPLIT_GROUPS.val):
- KEEP_VERT_ORDER.val = 1
-
- def do_polygroups(e,v):
- global SPLIT_OBJECTS, SPLIT_GROUPS, KEEP_VERT_ORDER, POLYGROUPS
- if POLYGROUPS.val:
- SPLIT_OBJECTS.val = SPLIT_GROUPS.val = 0
-
- def do_help(e,v):
- url = __url__[0]
- print('Trying to open web browser with documentation at this address...')
- print('\t' + url)
-
- try:
- import webbrowser
- webbrowser.open(url)
- except:
- print('...could not open a browser window.')
-
- def obj_ui():
- ui_x, ui_y = GLOBALS['MOUSE']
-
- # Center based on overall pup size
- ui_x -= 165
- ui_y -= 90
-
- global CREATE_SMOOTH_GROUPS, CREATE_FGONS, CREATE_EDGES, SPLIT_OBJECTS, SPLIT_GROUPS, CLAMP_SIZE, IMAGE_SEARCH, POLYGROUPS, KEEP_VERT_ORDER, ROTATE_X90
-
- Draw.Label('Import...', ui_x+9, ui_y+159, 220, 21)
- Draw.BeginAlign()
- CREATE_SMOOTH_GROUPS = Draw.Toggle('Smooth Groups', EVENT_NONE, ui_x+9, ui_y+139, 110, 20, CREATE_SMOOTH_GROUPS.val, 'Surround smooth groups by sharp edges')
- CREATE_FGONS = Draw.Toggle('NGons as FGons', EVENT_NONE, ui_x+119, ui_y+139, 110, 20, CREATE_FGONS.val, 'Import faces with more then 4 verts as fgons')
- CREATE_EDGES = Draw.Toggle('Lines as Edges', EVENT_NONE, ui_x+229, ui_y+139, 110, 20, CREATE_EDGES.val, 'Import lines and faces with 2 verts as edges')
- Draw.EndAlign()
-
- Draw.Label('Separate objects by OBJ...', ui_x+9, ui_y+110, 220, 20)
- Draw.BeginAlign()
- SPLIT_OBJECTS = Draw.Toggle('Object', EVENT_REDRAW, ui_x+9, ui_y+89, 55, 21, SPLIT_OBJECTS.val, 'Import OBJ Objects into Blender Objects', do_split)
- SPLIT_GROUPS = Draw.Toggle('Group', EVENT_REDRAW, ui_x+64, ui_y+89, 55, 21, SPLIT_GROUPS.val, 'Import OBJ Groups into Blender Objects', do_split)
- Draw.EndAlign()
-
- # Only used for user feedback
- KEEP_VERT_ORDER = Draw.Toggle('Keep Vert Order', EVENT_REDRAW, ui_x+184, ui_y+89, 113, 21, KEEP_VERT_ORDER.val, 'Keep vert and face order, disables split options, enable for morph targets', do_vertorder)
-
- ROTATE_X90 = Draw.Toggle('-X90', EVENT_REDRAW, ui_x+302, ui_y+89, 38, 21, ROTATE_X90.val, 'Rotate X 90.')
-
- Draw.Label('Options...', ui_x+9, ui_y+60, 211, 20)
- CLAMP_SIZE = Draw.Number('Clamp Scale: ', EVENT_NONE, ui_x+9, ui_y+39, 130, 21, CLAMP_SIZE.val, 0.0, 1000.0, 'Clamp the size to this maximum (Zero to Disable)')
- POLYGROUPS = Draw.Toggle('Poly Groups', EVENT_REDRAW, ui_x+144, ui_y+39, 90, 21, POLYGROUPS.val, 'Import OBJ groups as vertex groups.', do_polygroups)
- IMAGE_SEARCH = Draw.Toggle('Image Search', EVENT_NONE, ui_x+239, ui_y+39, 100, 21, IMAGE_SEARCH.val, 'Search subdirs for any assosiated images (Warning, may be slow)')
- Draw.BeginAlign()
- Draw.PushButton('Online Help', EVENT_REDRAW, ui_x+9, ui_y+9, 110, 21, 'Load the wiki page for this script', do_help)
- Draw.PushButton('Cancel', EVENT_EXIT, ui_x+119, ui_y+9, 110, 21, '', obj_ui_set_event)
- Draw.PushButton('Import', EVENT_IMPORT, ui_x+229, ui_y+9, 110, 21, 'Import with these settings', obj_ui_set_event)
- Draw.EndAlign()
-
-
- # hack so the toggle buttons redraw. this is not nice at all
- while GLOBALS['EVENT'] not in (EVENT_EXIT, EVENT_IMPORT):
- Draw.UIBlock(obj_ui, 0)
-
- if GLOBALS['EVENT'] != EVENT_IMPORT:
- return
-
- # END ALTERNATIVE UI *********************
-
-
-
-
-
-
-
- Window.WaitCursor(1)
-
- if BATCH_LOAD: # load the dir
- try:
- files= [ f for f in os.listdir(filepath) if f.lower().endswith('.obj') ]
- except:
- Window.WaitCursor(0)
- Draw.PupMenu('Error%t|Could not open path ' + filepath)
- return
-
- if not files:
- Window.WaitCursor(0)
- Draw.PupMenu('Error%t|No files at path ' + filepath)
- return
-
- for f in files:
- scn= bpy.data.scenes.new( stripExt(f) )
- scn.makeCurrent()
-
- load_obj(sys.join(filepath, f),\
- CLAMP_SIZE.val,\
- CREATE_FGONS.val,\
- CREATE_SMOOTH_GROUPS.val,\
- CREATE_EDGES.val,\
- SPLIT_OBJECTS.val,\
- SPLIT_GROUPS.val,\
- ROTATE_X90.val,\
- IMAGE_SEARCH.val,\
- POLYGROUPS.val
- )
-
- else: # Normal load
- load_obj(filepath,\
- CLAMP_SIZE.val,\
- CREATE_FGONS.val,\
- CREATE_SMOOTH_GROUPS.val,\
- CREATE_EDGES.val,\
- SPLIT_OBJECTS.val,\
- SPLIT_GROUPS.val,\
- ROTATE_X90.val,\
- IMAGE_SEARCH.val,\
- POLYGROUPS.val
- )
-
- Window.WaitCursor(0)
-
-
-def load_obj_ui_batch(file):
- load_obj_ui(file, True)
-
-DEBUG= False
-
-# if __name__=='__main__' and not DEBUG:
-# if os and Window.GetKeyQualifiers() & Window.Qual.SHIFT:
-# Window.FileSelector(load_obj_ui_batch, 'Import OBJ Dir', '')
-# else:
-# Window.FileSelector(load_obj_ui, 'Import a Wavefront OBJ', '*.obj')
-
- # For testing compatibility
-'''
-else:
- # DEBUG ONLY
- TIME= sys.time()
- DIR = '/fe/obj'
- import os
- print 'Searching for files'
- def fileList(path):
- for dirpath, dirnames, filenames in os.walk(path):
- for filename in filenames:
- yield os.path.join(dirpath, filename)
-
- files = [f for f in fileList(DIR) if f.lower().endswith('.obj')]
- files.sort()
-
- for i, obj_file in enumerate(files):
- if 0 < i < 20:
- print 'Importing', obj_file, '\nNUMBER', i, 'of', len(files)
- newScn= bpy.data.scenes.new(os.path.basename(obj_file))
- newScn.makeCurrent()
- load_obj(obj_file, False, IMAGE_SEARCH=0)
-
- print 'TOTAL TIME: %.6f' % (sys.time() - TIME)
-'''
-
-from bpy.props import *
-
-class IMPORT_OT_obj(bpy.types.Operator):
- '''Load a Wavefront OBJ File'''
- bl_idname = "import_scene.obj"
- bl_label = "Import OBJ"
-
- # List of operator properties, the attributes will be assigned
- # to the class instance from the operator settings before calling.
-
-
- filepath = StringProperty(name="File Path", description="Filepath used for importing the OBJ file", maxlen= 1024, default= "")
-
- CREATE_SMOOTH_GROUPS = BoolProperty(name="Smooth Groups", description="Surround smooth groups by sharp edges", default= True)
- CREATE_FGONS = BoolProperty(name="NGons as FGons", description="Import faces with more then 4 verts as fgons", default= True)
- CREATE_EDGES = BoolProperty(name="Lines as Edges", description="Import lines and faces with 2 verts as edge", default= True)
- SPLIT_OBJECTS = BoolProperty(name="Object", description="Import OBJ Objects into Blender Objects", default= True)
- SPLIT_GROUPS = BoolProperty(name="Group", description="Import OBJ Groups into Blender Objects", default= True)
- # old comment: only used for user feedback
- # disabled this option because in old code a handler for it disabled SPLIT* params, it's not passed to load_obj
- # KEEP_VERT_ORDER = BoolProperty(name="Keep Vert Order", description="Keep vert and face order, disables split options, enable for morph targets", default= True)
- ROTATE_X90 = BoolProperty(name="-X90", description="Rotate X 90.", default= True)
- CLAMP_SIZE = FloatProperty(name="Clamp Scale", description="Clamp the size to this maximum (Zero to Disable)", min=0.0, max=1000.0, soft_min=0.0, soft_max=1000.0, default=0.0)
- POLYGROUPS = BoolProperty(name="Poly Groups", description="Import OBJ groups as vertex groups.", default= True)
- IMAGE_SEARCH = BoolProperty(name="Image Search", description="Search subdirs for any assosiated images (Warning, may be slow)", default= True)
-
-
- def execute(self, context):
- # print("Selected: " + context.active_object.name)
-
- load_obj(self.properties.filepath,
- context,
- self.properties.CLAMP_SIZE,
- self.properties.CREATE_FGONS,
- self.properties.CREATE_SMOOTH_GROUPS,
- self.properties.CREATE_EDGES,
- self.properties.SPLIT_OBJECTS,
- self.properties.SPLIT_GROUPS,
- self.properties.ROTATE_X90,
- self.properties.IMAGE_SEARCH,
- self.properties.POLYGROUPS)
-
- return {'FINISHED'}
-
- def invoke(self, context, event):
- context.manager.add_fileselect(self)
- return {'RUNNING_MODAL'}
-
-
-def menu_func(self, context):
- self.layout.operator(IMPORT_OT_obj.bl_idname, text="Wavefront (.obj)")
-
-
-def register():
- bpy.types.INFO_MT_file_import.append(menu_func)
+# time_new= sys.time()
-def unregister():
- bpy.types.INFO_MT_file_import.remove(menu_func)
+ print('finished importing: %r in %.4f sec.' % (filepath, (time_new-time_main)))
+ return {'FINISHED'}
# NOTES (all line numbers refer to 2.4x import_obj.py, not this file)
# check later: line 489
# can convert now: edge flags, edges: lines 508-528
# ngon (uses python module BPyMesh): 384-414
-# nurbs: 947-
# NEXT clamp size: get bound box with RNA
# get back to l 140 (here)
# search image in bpy.config.textureDir - load_image
# replaced BPyImage.comprehensiveImageLoad with a simplified version that only checks additional directory specified, but doesn't search dirs recursively (obj_image_load)
# bitmask won't work? - 132
-# uses operator bpy.ops.OBJECT_OT_select_all() to deselect all (not necessary?)
# uses bpy.sys.time()
if __name__ == "__main__":
diff --git a/release/scripts/op/io_scene_x3d/__init__.py b/release/scripts/op/io_scene_x3d/__init__.py
new file mode 100644
index 00000000000..4ccd29808bf
--- /dev/null
+++ b/release/scripts/op/io_scene_x3d/__init__.py
@@ -0,0 +1,61 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# To support reload properly, try to access a package var, if it's there, reload everything
+if "bpy" in locals():
+ # only reload if we alredy loaded, highly annoying
+ import sys
+ reload(sys.modules.get("io_scene_x3d.export_x3d", sys))
+
+
+import bpy
+from bpy.props import *
+from io_utils import ExportHelper
+
+
+class ExportX3D(bpy.types.Operator, ExportHelper):
+ '''Export selection to Extensible 3D file (.x3d)'''
+ bl_idname = "export_scene.x3d"
+ bl_label = 'Export X3D'
+
+ filename_ext = ".x3d"
+
+ use_apply_modifiers = BoolProperty(name="Apply Modifiers", description="Use transformed mesh data from each object", default=True)
+ use_triangulate = BoolProperty(name="Triangulate", description="Triangulate quads.", default=False)
+ use_compress = BoolProperty(name="Compress", description="GZip the resulting file, requires a full python install", default=False)
+
+ def execute(self, context):
+ import io_scene_x3d.export_x3d
+ return io_scene_x3d.export_x3d.save(self, context, **self.properties)
+
+
+def menu_func(self, context):
+ self.layout.operator(ExportX3D.bl_idname, text="X3D Extensible 3D (.x3d)")
+
+
+def register():
+ bpy.types.INFO_MT_file_export.append(menu_func)
+
+def unregister():
+ bpy.types.INFO_MT_file_export.remove(menu_func)
+
+# NOTES
+# - blender version is hardcoded
+
+if __name__ == "__main__":
+ register()
diff --git a/release/scripts/io/export_x3d.py b/release/scripts/op/io_scene_x3d/export_x3d.py
index aafb7c922a1..d4188b79351 100644
--- a/release/scripts/io/export_x3d.py
+++ b/release/scripts/op/io_scene_x3d/export_x3d.py
@@ -18,68 +18,29 @@
# <pep8 compliant>
-__author__ = ("Bart", "Campbell Barton")
-__email__ = ["Bart, bart:neeneenee*de"]
-__url__ = ["Author's (Bart) homepage, http://www.neeneenee.de/vrml"]
-__version__ = "2006/01/17"
-__bpydoc__ = """\
+# Contributors: bart:neeneenee*de, http://www.neeneenee.de/vrml, Campbell Barton
+
+"""
This script exports to X3D format.
Usage:
-
Run this script from "File->Export" menu. A pop-up will ask whether you
want to export only selected or all relevant objects.
-Known issues:<br>
+Known issues:
Doesn't handle multiple materials (don't use material indices);<br>
Doesn't handle multiple UV textures on a single mesh (create a mesh for each texture);<br>
Can't get the texture array associated with material * not the UV ones;
"""
-
-# $Id$
-#
-#------------------------------------------------------------------------
-# X3D exporter for blender 2.36 or above
-#
-# ***** BEGIN GPL LICENSE BLOCK *****
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# ***** END GPL LICENCE BLOCK *****
-#
-
-####################################
-# Library dependancies
-####################################
-
import math
import os
import bpy
import mathutils
-from export_3ds import create_derived_objects, free_derived_objects
+from io_utils import create_derived_objects, free_derived_objects
-# import Blender
-# from Blender import Object, Lamp, Draw, Image, Text, sys, Mesh
-# from Blender.Scene import Render
-# import BPyObject
-# import BPyMesh
-
-#
DEG2RAD=0.017453292519943295
MATWORLD= mathutils.Matrix.Rotation(-90, 4, 'X')
@@ -87,8 +48,7 @@ MATWORLD= mathutils.Matrix.Rotation(-90, 4, 'X')
# Global Variables
####################################
-filename = ""
-# filename = Blender.Get('filename')
+filepath = ""
_safeOverwrite = True
extension = ''
@@ -99,7 +59,7 @@ extension = ''
class x3d_class:
- def __init__(self, filename):
+ def __init__(self, filepath):
#--- public you can change these ---
self.writingcolor = 0
self.writingtexture = 0
@@ -122,18 +82,18 @@ class x3d_class:
self.matNames={} # dictionary of materiaNames
self.meshNames={} # dictionary of meshNames
self.indentLevel=0 # keeps track of current indenting
- self.filename=filename
+ self.filepath=filepath
self.file = None
- if filename.lower().endswith('.x3dz'):
+ if filepath.lower().endswith('.x3dz'):
try:
import gzip
- self.file = gzip.open(filename, "w")
+ self.file = gzip.open(filepath, "w")
except:
print("failed to import compression modules, exporting uncompressed")
- self.filename = filename[:-1] # remove trailing z
+ self.filepath = filepath[:-1] # remove trailing z
if self.file == None:
- self.file = open(self.filename, "w")
+ self.file = open(self.filepath, "w")
self.bNav=0
self.nodeID=0
@@ -175,15 +135,15 @@ class x3d_class:
##########################################################
def writeHeader(self):
- #bfile = sys.expandpath( Blender.Get('filename') ).replace('<', '&lt').replace('>', '&gt')
- bfile = self.filename.replace('<', '&lt').replace('>', '&gt') # use outfile name
+ #bfile = sys.expandpath( Blender.Get('filepath') ).replace('<', '&lt').replace('>', '&gt')
+ bfile = repr(os.path.basename(self.filepath).replace('<', '&lt').replace('>', '&gt'))[1:-1] # use outfile name
self.file.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n")
self.file.write("<!DOCTYPE X3D PUBLIC \"ISO//Web3D//DTD X3D 3.0//EN\" \"http://www.web3d.org/specifications/x3d-3.0.dtd\">\n")
self.file.write("<X3D version=\"3.0\" profile=\"Immersive\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema-instance\" xsd:noNamespaceSchemaLocation=\"http://www.web3d.org/specifications/x3d-3.0.xsd\">\n")
self.file.write("<head>\n")
- self.file.write("\t<meta name=\"filename\" content=\"%s\" />\n" % os.path.basename(bfile))
+ self.file.write("\t<meta name=\"filename\" content=\"%s\" />\n" % bfile)
# self.file.write("\t<meta name=\"filename\" content=\"%s\" />\n" % sys.basename(bfile))
- self.file.write("\t<meta name=\"generator\" content=\"Blender %s\" />\n" % '2.5')
+ self.file.write("\t<meta name=\"generator\" content=\"Blender %s\" />\n" % bpy.app.version_string)
# self.file.write("\t<meta name=\"generator\" content=\"Blender %s\" />\n" % Blender.Get('version'))
self.file.write("\t<meta name=\"translator\" content=\"X3D exporter v1.55 (2006/01/17)\" />\n")
self.file.write("</head>\n")
@@ -258,12 +218,9 @@ class x3d_class:
def writeFog(self, world):
if world:
- mtype = world.mist.falloff
- # mtype = world.getMistype()
- mparam = world.mist
- # mparam = world.getMist()
+ mtype = world.mist_settings.falloff
+ mparam = world.mist_settings
grd = world.horizon_color
- # grd = world.getHor()
grd0, grd1, grd2 = grd[0], grd[1], grd[2]
else:
return
@@ -277,7 +234,7 @@ class x3d_class:
return
def writeNavigationInfo(self, scene):
- self.file.write('<NavigationInfo headlight="FALSE" visibilityLimit="0.0" type=\'"EXAMINE","ANY"\' avatarSize="0.25, 1.75, 0.75" />\n')
+ self.file.write('<NavigationInfo headlight="false" visibilityLimit="0.0" type=\'"EXAMINE","ANY"\' avatarSize="0.25, 1.75, 0.75" />\n')
def writeSpotLight(self, ob, mtx, lamp, world):
safeName = self.cleanStr(ob.name)
@@ -402,9 +359,9 @@ class x3d_class:
if len(mesh.faces) == 0: return
mode = []
# mode = 0
- if mesh.active_uv_texture:
+ if mesh.uv_textures.active:
# if mesh.faceUV:
- for face in mesh.active_uv_texture.data:
+ for face in mesh.uv_textures.active.data:
# for face in mesh.faces:
if face.use_halo and 'HALO' not in mode:
mode += ['HALO']
@@ -460,40 +417,39 @@ class x3d_class:
self.writeIndented("<Shape>\n",1)
maters=mesh.materials
- hasImageTexture=0
+ hasImageTexture = False
is_smooth = False
- if len(maters) > 0 or mesh.active_uv_texture:
+ if len(maters) > 0 or mesh.uv_textures.active:
# if len(maters) > 0 or mesh.faceUV:
self.writeIndented("<Appearance>\n", 1)
# right now this script can only handle a single material per mesh.
- if len(maters) >= 1:
- mat=maters[0]
- # matFlags = mat.getMode()
- if not mat.use_face_texture:
- # if not matFlags & Blender.Material.Modes['TEXFACE']:
- self.writeMaterial(mat, self.cleanStr(mat.name,''), world)
- # self.writeMaterial(mat, self.cleanStr(maters[0].name,''), world)
- if len(maters) > 1:
- print("Warning: mesh named %s has multiple materials" % meshName)
- print("Warning: only one material per object handled")
-
+ if len(maters) >= 1 and maters[0].use_face_texture == False:
+ mat = maters[0]
+ self.writeMaterial(mat, self.cleanStr(mat.name,''), world)
+ if len(maters) > 1:
+ print("Warning: mesh named %s has multiple materials" % meshName)
+ print("Warning: only one material per object handled")
+
+ if not len(maters) or maters[0].use_face_texture:
#-- textures
- face = None
- if mesh.active_uv_texture:
- # if mesh.faceUV:
- for face in mesh.active_uv_texture.data:
- # for face in mesh.faces:
- if face.image:
- # if (hasImageTexture == 0) and (face.image):
- self.writeImageTexture(face.image)
- # hasImageTexture=1 # keep track of face texture
- break
- if self.tilenode == 1 and face and face.image:
- # if self.tilenode == 1:
- self.writeIndented("<TextureTransform scale=\"%s %s\" />\n" % (face.image.xrep, face.image.yrep))
- self.tilenode = 0
- self.writeIndented("</Appearance>\n", -1)
+ image = None
+ if mesh.uv_textures.active:
+ for face in mesh.uv_textures.active.data:
+ if face.use_image:
+ image = face.image
+ if image:
+ self.writeImageTexture(image)
+ break
+
+ if image:
+ hasImageTexture = True
+
+ if self.tilenode == 1:
+ self.writeIndented("<TextureTransform scale=\"%s %s\" />\n" % (image.xrep, image.yrep))
+ self.tilenode = 0
+
+ self.writeIndented("</Appearance>\n", -1)
#-- IndexedFaceSet or IndexedLineSet
@@ -525,11 +481,10 @@ class x3d_class:
self.file.write("creaseAngle=\"%s\" " % (round(creaseAngle,self.cp)))
#--- output textureCoordinates if UV texture used
- if mesh.active_uv_texture:
- # if mesh.faceUV:
+ if mesh.uv_textures.active:
if self.matonly == 1 and self.share == 1:
self.writeFaceColors(mesh)
- elif hasImageTexture == 1:
+ elif hasImageTexture == True:
self.writeTextureCoordinates(mesh)
#--- output coordinates
self.writeCoordinates(ob, mesh, meshName, EXPORT_TRI)
@@ -540,9 +495,9 @@ class x3d_class:
self.writeCoordinates(ob, mesh, meshName, EXPORT_TRI)
#--- output textureCoordinates if UV texture used
- if mesh.active_uv_texture:
+ if mesh.uv_textures.active:
# if mesh.faceUV:
- if hasImageTexture == 1:
+ if hasImageTexture == True:
self.writeTextureCoordinates(mesh)
elif self.matonly == 1 and self.share == 1:
self.writeFaceColors(mesh)
@@ -614,7 +569,7 @@ class x3d_class:
texIndexList=[]
j=0
- for face in mesh.active_uv_texture.data:
+ for face in mesh.uv_textures.active.data:
# for face in mesh.faces:
# workaround, since tface.uv iteration is wrong atm
uvs = face.uv
@@ -646,10 +601,10 @@ class x3d_class:
def writeFaceColors(self, mesh):
if self.writingcolor == 0:
self.file.write("colorPerVertex=\"false\" ")
- elif mesh.active_vertex_color:
+ elif mesh.vertex_colors.active:
# else:
self.writeIndented("<Color color=\"", 1)
- for face in mesh.active_vertex_color.data:
+ for face in mesh.vertex_colors.active.data:
c = face.color1
if self.verbose > 2:
print("Debug: face.col r=%d g=%d b=%d" % (c[0], c[1], c[2]))
@@ -717,21 +672,20 @@ class x3d_class:
def writeImageTexture(self, image):
name = image.name
- filename = image.filepath.split('/')[-1].split('\\')[-1]
+ filepath = os.path.basename(image.filepath)
if name in self.texNames:
self.writeIndented("<ImageTexture USE=\"%s\" />\n" % self.cleanStr(name))
self.texNames[name] += 1
- return
else:
self.writeIndented("<ImageTexture DEF=\"%s\" " % self.cleanStr(name), 1)
- self.file.write("url=\"%s\" />" % name)
+ self.file.write("url=\"%s\" />" % filepath)
self.writeIndented("\n",-1)
self.texNames[name] = 1
def writeBackground(self, world, alltextures):
if world: worldname = world.name
else: return
- blending = (world.blend_sky, world.paper_sky, world.use_sky_real)
+ blending = (world.use_sky_blend, world.use_sky_paper, world.use_sky_real)
# blending = world.getSkytype()
grd = world.horizon_color
# grd = world.getHor()
@@ -827,7 +781,7 @@ class x3d_class:
EXPORT_TRI= False,\
):
- print("Info: starting X3D export to " + self.filename + "...")
+ print("Info: starting X3D export to %r..." % self.filepath)
self.writeHeader()
# self.writeScript()
self.writeNavigationInfo(scene)
@@ -925,7 +879,7 @@ class x3d_class:
self.texNames={}
self.matNames={}
self.indentLevel=0
- print("Info: finished X3D export to %s\n" % self.filename)
+ print("Info: finished X3D export to %r" % self.filepath)
def cleanStr(self, name, prefix='rsvd_'):
"""cleanStr(name,prefix) - try to create a valid VRML DEF name from object name"""
@@ -961,9 +915,9 @@ class x3d_class:
faceMap={}
nFaceIndx=0
- if mesh.active_uv_texture:
+ if mesh.uv_textures.active:
# if mesh.faceUV:
- for face in mesh.active_uv_texture.data:
+ for face in mesh.uv_textures.active.data:
# for face in mesh.faces
sidename = "two" if face.use_twoside else "one"
@@ -1135,91 +1089,35 @@ class x3d_class:
# Callbacks, needed before Main
##########################################################
-def write(filename,
- context,
- EXPORT_APPLY_MODIFIERS=False,
- EXPORT_TRI=False,
- EXPORT_GZIP=False):
+def save(operator, context, filepath="",
+ use_apply_modifiers=False,
+ use_triangulate=False,
+ use_compress=False):
- if EXPORT_GZIP:
- if not filename.lower().endswith('.x3dz'):
- filename = '.'.join(filename.split('.')[:-1]) + '.x3dz'
+ if use_compress:
+ if not filepath.lower().endswith('.x3dz'):
+ filepath = '.'.join(filepath.split('.')[:-1]) + '.x3dz'
else:
- if not filename.lower().endswith('.x3d'):
- filename = '.'.join(filename.split('.')[:-1]) + '.x3d'
-
+ if not filepath.lower().endswith('.x3d'):
+ filepath = '.'.join(filepath.split('.')[:-1]) + '.x3d'
scene = context.scene
world = scene.world
- if scene.objects.active:
+ if bpy.ops.object.mode_set.poll():
bpy.ops.object.mode_set(mode='OBJECT')
# XXX these are global textures while .Get() returned only scene's?
alltextures = bpy.data.textures
# alltextures = Blender.Texture.Get()
- wrlexport=x3d_class(filename)
- wrlexport.export(\
- scene,\
- world,\
- alltextures,\
- \
- EXPORT_APPLY_MODIFIERS = EXPORT_APPLY_MODIFIERS,\
- EXPORT_TRI = EXPORT_TRI,\
- )
-
-
-from bpy.props import *
-
-class ExportX3D(bpy.types.Operator):
- '''Export selection to Extensible 3D file (.x3d)'''
- bl_idname = "export.x3d"
- bl_label = 'Export X3D'
-
- # List of operator properties, the attributes will be assigned
- # to the class instance from the operator settings before calling.
- filepath = StringProperty(name="File Path", description="Filepath used for exporting the X3D file", maxlen= 1024, default= "")
- check_existing = BoolProperty(name="Check Existing", description="Check and warn on overwriting existing files", default=True, options={'HIDDEN'})
-
- apply_modifiers = BoolProperty(name="Apply Modifiers", description="Use transformed mesh data from each object", default=True)
- triangulate = BoolProperty(name="Triangulate", description="Triangulate quads.", default=False)
- compress = BoolProperty(name="Compress", description="GZip the resulting file, requires a full python install", default=False)
-
- def execute(self, context):
- filepath = self.properties.filepath
- filepath = bpy.path.ensure_ext(filepath, ".x3d")
-
- write(filepath,
- context,
- self.properties.apply_modifiers,
- self.properties.triangulate,
- self.properties.compress,
- )
-
- return {'FINISHED'}
-
- def invoke(self, context, event):
- import os
- if not self.properties.is_property_set("filepath"):
- self.properties.filepath = os.path.splitext(bpy.data.filepath)[0] + ".x3d"
-
- context.manager.add_fileselect(self)
- return {'RUNNING_MODAL'}
-
-
-def menu_func(self, context):
- self.layout.operator(ExportX3D.bl_idname, text="X3D Extensible 3D (.x3d)")
-
-
-def register():
- bpy.types.INFO_MT_file_export.append(menu_func)
-
-def unregister():
- bpy.types.INFO_MT_file_export.remove(menu_func)
+ wrlexport = x3d_class(filepath)
+ wrlexport.export(scene,
+ world,
+ alltextures,
+ EXPORT_APPLY_MODIFIERS=use_apply_modifiers,
+ EXPORT_TRI=use_triangulate,
+ )
-# NOTES
-# - blender version is hardcoded
+ return {'FINISHED'}
-if __name__ == "__main__":
- register()
diff --git a/release/scripts/op/io_shape_mdd/__init__.py b/release/scripts/op/io_shape_mdd/__init__.py
new file mode 100644
index 00000000000..0af4af92b7c
--- /dev/null
+++ b/release/scripts/op/io_shape_mdd/__init__.py
@@ -0,0 +1,115 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+# To support reload properly, try to access a package var, if it's there, reload everything
+if "bpy" in locals():
+ # only reload if we alredy loaded, highly annoying
+ import sys
+ reload(sys.modules.get("io_shape_mdd.import_mdd", sys))
+ reload(sys.modules.get("io_shape_mdd.export_mdd", sys))
+
+
+import bpy
+from bpy.props import *
+from io_utils import ExportHelper, ImportHelper
+
+
+class ImportMDD(bpy.types.Operator, ImportHelper):
+ '''Import MDD vertex keyframe file to shape keys'''
+ bl_idname = "import_shape.mdd"
+ bl_label = "Import MDD"
+
+ filename_ext = ".mdd"
+ frame_start = IntProperty(name="Start Frame", description="Start frame for inserting animation", min=-300000, max=300000, default=0)
+ frame_step = IntProperty(name="Step", min=1, max=1000, default=1)
+
+ @classmethod
+ def poll(cls, context):
+ ob = context.active_object
+ return (ob and ob.type == 'MESH')
+
+ def execute(self, context):
+
+ # initialize from scene if unset
+ scene = context.scene
+ if not self.properties.is_property_set("frame_start"):
+ self.properties.frame_start = scene.frame_current
+
+ import io_shape_mdd.import_mdd
+ return io_shape_mdd.import_mdd.load(self, context, **self.properties)
+
+class ExportMDD(bpy.types.Operator, ExportHelper):
+ '''Animated mesh to MDD vertex keyframe file'''
+ bl_idname = "export_shape.mdd"
+ bl_label = "Export MDD"
+
+ filename_ext = ".mdd"
+
+ # get first scene to get min and max properties for frames, fps
+
+ minframe = 1
+ maxframe = 300000
+ minfps = 1
+ maxfps = 120
+
+ # List of operator properties, the attributes will be assigned
+ # to the class instance from the operator settings before calling.
+ fps = IntProperty(name="Frames Per Second", description="Number of frames/second", min=minfps, max=maxfps, default=25)
+ frame_start = IntProperty(name="Start Frame", description="Start frame for baking", min=minframe, max=maxframe, default=1)
+ frame_end = IntProperty(name="End Frame", description="End frame for baking", min=minframe, max=maxframe, default=250)
+
+ @classmethod
+ def poll(cls, context):
+ obj = context.active_object
+ return (obj and obj.type == 'MESH')
+
+ def execute(self, context):
+ # initialize from scene if unset
+ scene = context.scene
+ if not self.properties.is_property_set("frame_start"):
+ self.properties.frame_start = scene.frame_start
+ if not self.properties.is_property_set("frame_end"):
+ self.properties.frame_end = scene.frame_end
+ if not self.properties.is_property_set("fps"):
+ self.properties.fps = scene.render.fps
+
+ import io_shape_mdd.export_mdd
+ return io_shape_mdd.export_mdd.save(self, context, **self.properties)
+
+
+def menu_func_import(self, context):
+ self.layout.operator(ImportMDD.bl_idname, text="Lightwave Point Cache (.mdd)")
+
+
+def menu_func_export(self, context):
+ self.layout.operator(ExportMDD.bl_idname, text="Lightwave Point Cache (.mdd)")
+
+
+def register():
+ bpy.types.INFO_MT_file_import.append(menu_func_import)
+ bpy.types.INFO_MT_file_export.append(menu_func_export)
+
+
+def unregister():
+ bpy.types.INFO_MT_file_import.remove(menu_func_import)
+ bpy.types.INFO_MT_file_export.remove(menu_func_export)
+
+if __name__ == "__main__":
+ register()
diff --git a/release/scripts/op/io_shape_mdd/export_mdd.py b/release/scripts/op/io_shape_mdd/export_mdd.py
new file mode 100644
index 00000000000..3c57ae5afa0
--- /dev/null
+++ b/release/scripts/op/io_shape_mdd/export_mdd.py
@@ -0,0 +1,131 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+# Contributors: Bill L.Nieuwendorp
+
+"""
+This script Exports Lightwaves MotionDesigner format.
+
+The .mdd format has become quite a popular Pipeline format<br>
+for moving animations from package to package.
+
+Be sure not to use modifiers that change the number or order of verts in the mesh
+"""
+
+import bpy
+import mathutils
+from struct import pack
+
+
+def zero_file(filepath):
+ '''
+ If a file fails, this replaces it with 1 char, better not remove it?
+ '''
+ file = open(filepath, 'w')
+ file.write('\n') # apparently macosx needs some data in a blank file?
+ file.close()
+
+
+def check_vertcount(mesh, vertcount):
+ '''
+ check and make sure the vertcount is consistent throughout the frame range
+ '''
+ if len(mesh.vertices) != vertcount:
+ raise Exception('Error, number of verts has changed during animation, cannot export')
+ f.close()
+ zero_file(filepath)
+ return
+
+
+def save(operator, context, filepath="", frame_start=1, frame_end=300, fps=25):
+ """
+ Blender.Window.WaitCursor(1)
+
+ mesh_orig = Mesh.New()
+ mesh_orig.getFromObject(obj.name)
+ """
+
+ scene = context.scene
+ obj = context.object
+
+ if bpy.ops.object.mode_set.poll():
+ bpy.ops.object.mode_set(mode='OBJECT')
+
+ orig_frame = scene.frame_current
+ scene.frame_set(frame_start)
+ me = obj.create_mesh(scene, True, 'PREVIEW')
+
+ #Flip y and z
+ mat_flip = mathutils.Matrix(\
+ [1.0, 0.0, 0.0, 0.0],\
+ [0.0, 0.0, 1.0, 0.0],\
+ [0.0, 1.0, 0.0, 0.0],\
+ [0.0, 0.0, 0.0, 1.0],\
+ )
+
+ numverts = len(me.vertices)
+
+ numframes = frame_end - frame_start + 1
+ fps = float(fps)
+ f = open(filepath, 'wb') #no Errors yet:Safe to create file
+
+ # Write the header
+ f.write(pack(">2i", numframes, numverts))
+
+ # Write the frame times (should we use the time IPO??)
+ f.write(pack(">%df" % (numframes), *[frame / fps for frame in range(numframes)])) # seconds
+
+ #rest frame needed to keep frames in sync
+ """
+ Blender.Set('curframe', frame_start)
+ me_tmp.getFromObject(obj.name)
+ """
+
+ check_vertcount(me, numverts)
+ me.transform(mat_flip * obj.matrix_world)
+ f.write(pack(">%df" % (numverts * 3), *[axis for v in me.vertices for axis in v.co]))
+
+ for frame in range(frame_start, frame_end + 1):#in order to start at desired frame
+ """
+ Blender.Set('curframe', frame)
+ me_tmp.getFromObject(obj.name)
+ """
+
+ scene.frame_set(frame)
+ me = obj.create_mesh(scene, True, 'PREVIEW')
+ check_vertcount(me, numverts)
+ me.transform(mat_flip * obj.matrix_world)
+
+ # Write the vertex data
+ f.write(pack(">%df" % (numverts * 3), *[axis for v in me.vertices for axis in v.co]))
+
+ """
+ me_tmp.vertices= None
+ """
+ f.close()
+
+ print('MDD Exported: %r frames:%d\n' % (filepath, numframes - 1))
+ """
+ Blender.Window.WaitCursor(0)
+ Blender.Set('curframe', orig_frame)
+ """
+ scene.frame_set(orig_frame)
+
+ return {'FINISHED'}
diff --git a/release/scripts/op/io_shape_mdd/import_mdd.py b/release/scripts/op/io_shape_mdd/import_mdd.py
new file mode 100644
index 00000000000..d008ff931ff
--- /dev/null
+++ b/release/scripts/op/io_shape_mdd/import_mdd.py
@@ -0,0 +1,105 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+# mdd importer by Bill L.Nieuwendorp
+# conversion to blender 2.5: Ivo Grigull (loolarge)
+#
+# Warning if the vertex order or vertex count differs from the
+# origonal model the mdd was Baked out from their will be Strange
+# behavior
+#
+# vertex animation to ShapeKeys with ipo and gives the frame a value of 1.0
+# A modifier to read mdd files would be Ideal but thats for another day :)
+#
+# Please send any fixes,updates,bugs to Slow67_at_Gmail.com
+# Bill Niewuendorp
+
+import bpy
+from struct import unpack
+
+
+def load(operator, context, filepath, frame_start=0, frame_step=1):
+
+ scene = context.scene
+ obj = context.object
+
+ print('\n\nimporting mdd %r' % filepath)
+
+ if bpy.ops.object.mode_set.poll():
+ bpy.ops.object.mode_set(mode='OBJECT')
+
+ file = open(filepath, 'rb')
+ frames, points = unpack(">2i", file.read(8))
+ time = unpack((">%df" % frames), file.read(frames * 4))
+
+ print('\tpoints:%d frames:%d' % (points, frames))
+
+ # If target object doesn't have Basis shape key, create it.
+ try:
+ num_keys = len(obj.data.shape_keys.keys)
+ except:
+ basis = obj.add_shape_key()
+ basis.name = "Basis"
+ obj.data.update()
+
+ scene.frame_current = frame_start
+
+ def UpdateMesh(ob, fr):
+
+ # Insert new shape key
+ new_shapekey = obj.add_shape_key()
+ new_shapekey.name = ("frame_%.4d" % fr)
+ new_shapekey_name = new_shapekey.name
+
+ obj.active_shape_key_index = len(obj.data.shape_keys.keys)-1
+ index = len(obj.data.shape_keys.keys)-1
+ obj.show_shape_key = True
+
+ verts = obj.data.shape_keys.keys[len(obj.data.shape_keys.keys)-1].data
+
+
+ for v in verts: # 12 is the size of 3 floats
+ v.co[:] = unpack('>3f', file.read(12))
+ #me.update()
+ obj.show_shape_key = False
+
+
+ # insert keyframes
+ shape_keys = obj.data.shape_keys
+
+ scene.frame_current -= 1
+ obj.data.shape_keys.keys[index].value = 0.0
+ shape_keys.keys[len(obj.data.shape_keys.keys)-1].keyframe_insert("value")
+
+ scene.frame_current += 1
+ obj.data.shape_keys.keys[index].value = 1.0
+ shape_keys.keys[len(obj.data.shape_keys.keys)-1].keyframe_insert("value")
+
+ scene.frame_current += 1
+ obj.data.shape_keys.keys[index].value = 0.0
+ shape_keys.keys[len(obj.data.shape_keys.keys)-1].keyframe_insert("value")
+
+ obj.data.update()
+
+
+ for i in range(frames):
+ UpdateMesh(obj, i)
+
+ return {'FINISHED'}
diff --git a/release/scripts/op/nla.py b/release/scripts/op/nla.py
index 44bd5d91e32..27fd83c4482 100644
--- a/release/scripts/op/nla.py
+++ b/release/scripts/op/nla.py
@@ -87,7 +87,7 @@ def bake(frame_start, frame_end, step=1, only_selected=False):
# could spped this up by applying steps here too...
for f in frame_range:
- scene.set_frame(f)
+ scene.frame_set(f)
info = pose_info()
info_ls.append(info)
@@ -169,7 +169,7 @@ class BakeAction(bpy.types.Operator):
return {'FINISHED'}
def invoke(self, context, event):
- wm = context.manager
+ wm = context.window_manager
return wm.invoke_props_dialog(self)
diff --git a/release/scripts/op/object.py b/release/scripts/op/object.py
index 56c43c0728c..b5123776047 100644
--- a/release/scripts/op/object.py
+++ b/release/scripts/op/object.py
@@ -59,7 +59,7 @@ class SelectPattern(bpy.types.Operator):
return {'FINISHED'}
def invoke(self, context, event):
- wm = context.manager
+ wm = context.window_manager
# return wm.invoke_props_popup(self, event)
wm.invoke_props_popup(self, event)
return {'RUNNING_MODAL'}
@@ -427,13 +427,13 @@ class JoinUVs(bpy.types.Operator):
if is_editmode:
bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
- if not mesh.active_uv_texture:
+ if not mesh.uv_textures:
self.report({'WARNING'}, "Object: %s, Mesh: '%s' has no UVs\n" % (obj.name, mesh.name))
else:
len_faces = len(mesh.faces)
uv_array = array.array('f', [0.0] * 8) * len_faces # seems to be the fastest way to create an array
- mesh.active_uv_texture.data.foreach_get("uv_raw", uv_array)
+ mesh.uv_textures.active.data.foreach_get("uv_raw", uv_array)
objects = context.selected_editable_objects[:]
@@ -451,10 +451,9 @@ class JoinUVs(bpy.types.Operator):
if len(mesh_other.faces) != len_faces:
self.report({'WARNING'}, "Object: %s, Mesh: '%s' has %d faces, expected %d\n" % (obj_other.name, mesh_other.name, len(mesh_other.faces), len_faces))
else:
- uv_other = mesh_other.active_uv_texture
+ uv_other = mesh_other.uv_textures.active
if not uv_other:
- mesh_other.add_uv_texture() # should return the texture it adds
- uv_other = mesh_other.active_uv_texture
+ uv_other = mesh_other.uv_textures.new() # should return the texture it adds
# finally do the copy
uv_other.data.foreach_set("uv_raw", uv_array)
@@ -500,11 +499,13 @@ class MakeDupliFace(bpy.types.Operator):
for data, objects in linked.items():
face_verts = [axis for obj in objects for v in matrix_to_quat(obj.matrix_world) for axis in v]
- faces = list(range(int(len(face_verts) / 3)))
+ faces = list(range(len(face_verts) // 3))
mesh = bpy.data.meshes.new(data.name + "_dupli")
- mesh.add_geometry(int(len(face_verts) / 3), 0, int(len(face_verts) / (4 * 3)))
+ mesh.vertices.add(len(face_verts) // 3)
+ mesh.faces.add(len(face_verts) // 12)
+
mesh.vertices.foreach_set("co", face_verts)
mesh.faces.foreach_set("vertices_raw", faces)
mesh.update() # generates edge data
@@ -572,4 +573,4 @@ def unregister():
pass
if __name__ == "__main__":
- register() \ No newline at end of file
+ register()
diff --git a/release/scripts/op/presets.py b/release/scripts/op/presets.py
index 43e2cda5d53..7364f0021ce 100644
--- a/release/scripts/op/presets.py
+++ b/release/scripts/op/presets.py
@@ -50,7 +50,7 @@ class AddPresetBase():
if getattr(self, "save_keyconfig", False):
bpy.ops.wm.keyconfig_export(filepath=filepath, kc_name=self.properties.name)
file_preset = open(filepath, 'a')
- file_preset.write("wm.active_keyconfig = kc\n\n")
+ file_preset.write("wm.keyconfigs.active = kc\n\n")
else:
file_preset = open(filepath, 'w')
file_preset.write("import bpy\n")
@@ -64,7 +64,7 @@ class AddPresetBase():
return {'FINISHED'}
def invoke(self, context, event):
- wm = context.manager
+ wm = context.window_manager
#crashes, TODO - fix
#return wm.invoke_props_popup(self, event)
diff --git a/release/scripts/op/uv.py b/release/scripts/op/uv.py
index cf3d68787c0..011deea1f17 100644
--- a/release/scripts/op/uv.py
+++ b/release/scripts/op/uv.py
@@ -69,7 +69,7 @@ class ExportUVLayout(bpy.types.Operator):
def _face_uv_iter(self, context):
obj = context.active_object
mesh = obj.data
- uv_layer = mesh.active_uv_texture.data
+ uv_layer = mesh.uv_textures.active.data
uv_layer_len = len(uv_layer)
if not self.properties.export_all:
@@ -207,7 +207,7 @@ class ExportUVLayout(bpy.types.Operator):
return {'FINISHED'}
def invoke(self, context, event):
- wm = context.manager
+ wm = context.window_manager
wm.add_fileselect(self)
return {'RUNNING_MODAL'}
diff --git a/release/scripts/op/uvcalc_follow_active.py b/release/scripts/op/uvcalc_follow_active.py
index 1f80e704f93..9f809dd39f8 100644
--- a/release/scripts/op/uvcalc_follow_active.py
+++ b/release/scripts/op/uvcalc_follow_active.py
@@ -28,8 +28,8 @@ def extend(obj, operator, EXTEND_MODE):
me = obj.data
me_verts = me.vertices
# script will fail without UVs
- if not me.active_uv_texture:
- me.add_uv_texture()
+ if not me.uv_textures:
+ me.uv_textures.new()
# Toggle Edit mode
@@ -57,10 +57,10 @@ def extend(obj, operator, EXTEND_MODE):
vidx_source = face_source.vertices
vidx_target = face_target.vertices
- faceUVsource = me.active_uv_texture.data[face_source.index]
+ faceUVsource = me.uv_textures.active.data[face_source.index]
uvs_source = [faceUVsource.uv1, faceUVsource.uv2, faceUVsource.uv3, faceUVsource.uv4]
- faceUVtarget = me.active_uv_texture.data[face_target.index]
+ faceUVtarget = me.uv_textures.active.data[face_target.index]
uvs_target = [faceUVtarget.uv1, faceUVtarget.uv2, faceUVtarget.uv3, faceUVtarget.uv4]
# vertex index is the key, uv is the value
@@ -138,8 +138,8 @@ def extend(obj, operator, EXTEND_MODE):
uvs_vhash_target[edgepair_outer_target[iA]][:] = uvs_vhash_source[edgepair_inner_source[1]] + (uvs_vhash_source[edgepair_inner_source[1]] - uvs_vhash_source[edgepair_outer_source[0]])
- if me.active_uv_texture == None:
- me.add_uv_texture
+ if not me.uv_textures:
+ me.uv_textures.new()
face_act = me.faces.active
if face_act == -1:
diff --git a/release/scripts/op/uvcalc_smart_project.py b/release/scripts/op/uvcalc_smart_project.py
index 0589b7e861a..c4e19afc810 100644
--- a/release/scripts/op/uvcalc_smart_project.py
+++ b/release/scripts/op/uvcalc_smart_project.py
@@ -892,10 +892,10 @@ def main(context, island_margin, projection_limit):
# Tag as used
me.tag = True
- if len(me.uv_textures)==0: # Mesh has no UV Coords, dont bother.
- me.add_uv_texture()
+ if not me.uv_textures: # Mesh has no UV Coords, dont bother.
+ me.uv_textures.new()
- uv_layer = me.active_uv_texture.data
+ uv_layer = me.uv_textures.active.data
me_verts = list(me.vertices)
if USER_ONLY_SELECTED_FACES:
diff --git a/release/scripts/op/wm.py b/release/scripts/op/wm.py
index cc35a0ab3dd..c5f465a435a 100644
--- a/release/scripts/op/wm.py
+++ b/release/scripts/op/wm.py
@@ -449,7 +449,7 @@ class WM_OT_context_modal_mouse(bpy.types.Operator):
else:
self.properties.initial_x = event.mouse_x
- context.manager.add_modal_handler(self)
+ context.window_manager.add_modal_handler(self)
return {'RUNNING_MODAL'}
@@ -505,7 +505,7 @@ class WM_OT_doc_view(bpy.types.Operator):
bl_label = "View Documentation"
doc_id = doc_id
- _prefix = 'http://www.blender.org/documentation/250PythonDoc'
+ _prefix = "http://www.blender.org/documentation/blender_python_api_%s" % "_".join(str(v) for v in bpy.app.version)
def _nested_class_string(self, class_string):
ls = []
@@ -608,7 +608,7 @@ class WM_OT_doc_edit(bpy.types.Operator):
layout.prop(props, "doc_new", text="")
def invoke(self, context, event):
- wm = context.manager
+ wm = context.window_manager
return wm.invoke_props_dialog(self, width=600)
@@ -692,7 +692,7 @@ class WM_OT_properties_edit(bpy.types.Operator):
self.properties.max = prop_ui.get("max", 1000000000)
self.properties.description = prop_ui.get("description", "")
- wm = context.manager
+ wm = context.window_manager
# This crashes, TODO - fix
#return wm.invoke_props_popup(self, event)
diff --git a/release/scripts/presets/interaction/blender.py b/release/scripts/presets/interaction/blender.py
index 229aa657b2f..7ac9cd1eb0b 100644
--- a/release/scripts/presets/interaction/blender.py
+++ b/release/scripts/presets/interaction/blender.py
@@ -1,8 +1,8 @@
# Configuration Blender
import bpy
-wm = bpy.context.manager
-wm.active_keyconfig = wm.keyconfigs['Blender']
+wm = bpy.context.window_manager
+wm.keyconfigs.active = wm.keyconfigs['Blender']
bpy.context.user_preferences.view.use_mouse_auto_depth = False
bpy.context.user_preferences.view.use_zoom_to_mouse = False
diff --git a/release/scripts/presets/interaction/maya.py b/release/scripts/presets/interaction/maya.py
index ccd95abf75e..4a40326325e 100644
--- a/release/scripts/presets/interaction/maya.py
+++ b/release/scripts/presets/interaction/maya.py
@@ -1,381 +1,381 @@
# Configuration Maya
import bpy
-wm = bpy.context.manager
-kc = wm.add_keyconfig('Maya')
+wm = bpy.context.window_manager
+kc = wm.keyconfigs.new('Maya')
# Map 3D View
-km = kc.add_keymap('3D View', space_type='VIEW_3D', region_type='WINDOW', modal=False)
+km = kc.keymaps.new('3D View', space_type='VIEW_3D', region_type='WINDOW', modal=False)
-kmi = km.items.add('view3d.show_manipulator', 'LEFTMOUSE', 'PRESS', any=True)
+kmi = km.items.new('view3d.manipulator', 'LEFTMOUSE', 'PRESS', any=True)
kmi.properties.release_confirm = True
-kmi = km.items.add('view3d.cursor3d', 'ACTIONMOUSE', 'PRESS')
-kmi = km.items.add('view3d.rotate', 'LEFTMOUSE', 'PRESS', alt=True)
-kmi = km.items.add('view3d.move', 'MIDDLEMOUSE', 'PRESS', alt=True)
-kmi = km.items.add('view3d.zoom', 'RIGHTMOUSE', 'PRESS', alt=True)
-kmi = km.items.add('view3d.view_selected', 'NUMPAD_PERIOD', 'PRESS')
-kmi = km.items.add('view3d.view_center_cursor', 'NUMPAD_PERIOD', 'PRESS', ctrl=True)
-kmi = km.items.add('view3d.fly', 'F', 'PRESS', shift=True)
-kmi = km.items.add('view3d.smoothview', 'TIMER1', 'ANY', any=True)
-kmi = km.items.add('view3d.rotate', 'TRACKPADPAN', 'ANY', alt=True)
-kmi = km.items.add('view3d.rotate', 'MOUSEROTATE', 'ANY')
-kmi = km.items.add('view3d.move', 'TRACKPADPAN', 'ANY')
-kmi = km.items.add('view3d.zoom', 'TRACKPADZOOM', 'ANY')
-kmi = km.items.add('view3d.zoom', 'NUMPAD_PLUS', 'PRESS')
+kmi = km.items.new('view3d.cursor3d', 'ACTIONMOUSE', 'PRESS')
+kmi = km.items.new('view3d.rotate', 'LEFTMOUSE', 'PRESS', alt=True)
+kmi = km.items.new('view3d.move', 'MIDDLEMOUSE', 'PRESS', alt=True)
+kmi = km.items.new('view3d.zoom', 'RIGHTMOUSE', 'PRESS', alt=True)
+kmi = km.items.new('view3d.view_selected', 'NUMPAD_PERIOD', 'PRESS')
+kmi = km.items.new('view3d.view_center_cursor', 'NUMPAD_PERIOD', 'PRESS', ctrl=True)
+kmi = km.items.new('view3d.fly', 'F', 'PRESS', shift=True)
+kmi = km.items.new('view3d.smoothview', 'TIMER1', 'ANY', any=True)
+kmi = km.items.new('view3d.rotate', 'TRACKPADPAN', 'ANY', alt=True)
+kmi = km.items.new('view3d.rotate', 'MOUSEROTATE', 'ANY')
+kmi = km.items.new('view3d.move', 'TRACKPADPAN', 'ANY')
+kmi = km.items.new('view3d.zoom', 'TRACKPADZOOM', 'ANY')
+kmi = km.items.new('view3d.zoom', 'NUMPAD_PLUS', 'PRESS')
kmi.properties.delta = 1
-kmi = km.items.add('view3d.zoom', 'NUMPAD_MINUS', 'PRESS')
+kmi = km.items.new('view3d.zoom', 'NUMPAD_MINUS', 'PRESS')
kmi.properties.delta = -1
-kmi = km.items.add('view3d.zoom', 'EQUAL', 'PRESS', ctrl=True)
+kmi = km.items.new('view3d.zoom', 'EQUAL', 'PRESS', ctrl=True)
kmi.properties.delta = 1
-kmi = km.items.add('view3d.zoom', 'MINUS', 'PRESS', ctrl=True)
+kmi = km.items.new('view3d.zoom', 'MINUS', 'PRESS', ctrl=True)
kmi.properties.delta = -1
-kmi = km.items.add('view3d.zoom', 'WHEELINMOUSE', 'PRESS')
+kmi = km.items.new('view3d.zoom', 'WHEELINMOUSE', 'PRESS')
kmi.properties.delta = 1
-kmi = km.items.add('view3d.zoom', 'WHEELOUTMOUSE', 'PRESS')
+kmi = km.items.new('view3d.zoom', 'WHEELOUTMOUSE', 'PRESS')
kmi.properties.delta = -1
-kmi = km.items.add('view3d.view_all', 'HOME', 'PRESS')
+kmi = km.items.new('view3d.view_all', 'HOME', 'PRESS')
kmi.properties.center = False
-kmi = km.items.add('view3d.view_all', 'C', 'PRESS', shift=True)
+kmi = km.items.new('view3d.view_all', 'C', 'PRESS', shift=True)
kmi.properties.center = True
-kmi = km.items.add('view3d.viewnumpad', 'NUMPAD_0', 'PRESS')
+kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_0', 'PRESS')
kmi.properties.type = 'CAMERA'
-kmi = km.items.add('view3d.viewnumpad', 'NUMPAD_1', 'PRESS')
+kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_1', 'PRESS')
kmi.properties.type = 'FRONT'
-kmi = km.items.add('view3d.view_orbit', 'NUMPAD_2', 'PRESS')
+kmi = km.items.new('view3d.view_orbit', 'NUMPAD_2', 'PRESS')
kmi.properties.type = 'ORBITDOWN'
-kmi = km.items.add('view3d.viewnumpad', 'NUMPAD_3', 'PRESS')
+kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_3', 'PRESS')
kmi.properties.type = 'RIGHT'
-kmi = km.items.add('view3d.view_orbit', 'NUMPAD_4', 'PRESS')
+kmi = km.items.new('view3d.view_orbit', 'NUMPAD_4', 'PRESS')
kmi.properties.type = 'ORBITLEFT'
-kmi = km.items.add('view3d.view_persportho', 'NUMPAD_5', 'PRESS')
-kmi = km.items.add('view3d.view_orbit', 'NUMPAD_6', 'PRESS')
+kmi = km.items.new('view3d.view_persportho', 'NUMPAD_5', 'PRESS')
+kmi = km.items.new('view3d.view_orbit', 'NUMPAD_6', 'PRESS')
kmi.properties.type = 'ORBITRIGHT'
-kmi = km.items.add('view3d.viewnumpad', 'NUMPAD_7', 'PRESS')
+kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_7', 'PRESS')
kmi.properties.type = 'TOP'
-kmi = km.items.add('view3d.view_orbit', 'NUMPAD_8', 'PRESS')
+kmi = km.items.new('view3d.view_orbit', 'NUMPAD_8', 'PRESS')
kmi.properties.type = 'ORBITUP'
-kmi = km.items.add('view3d.viewnumpad', 'NUMPAD_1', 'PRESS', ctrl=True)
+kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_1', 'PRESS', ctrl=True)
kmi.properties.type = 'BACK'
-kmi = km.items.add('view3d.viewnumpad', 'NUMPAD_3', 'PRESS', ctrl=True)
+kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_3', 'PRESS', ctrl=True)
kmi.properties.type = 'LEFT'
-kmi = km.items.add('view3d.viewnumpad', 'NUMPAD_7', 'PRESS', ctrl=True)
+kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_7', 'PRESS', ctrl=True)
kmi.properties.type = 'BOTTOM'
-kmi = km.items.add('view3d.view_pan', 'NUMPAD_2', 'PRESS', ctrl=True)
+kmi = km.items.new('view3d.view_pan', 'NUMPAD_2', 'PRESS', ctrl=True)
kmi.properties.type = 'PANDOWN'
-kmi = km.items.add('view3d.view_pan', 'NUMPAD_4', 'PRESS', ctrl=True)
+kmi = km.items.new('view3d.view_pan', 'NUMPAD_4', 'PRESS', ctrl=True)
kmi.properties.type = 'PANLEFT'
-kmi = km.items.add('view3d.view_pan', 'NUMPAD_6', 'PRESS', ctrl=True)
+kmi = km.items.new('view3d.view_pan', 'NUMPAD_6', 'PRESS', ctrl=True)
kmi.properties.type = 'PANRIGHT'
-kmi = km.items.add('view3d.view_pan', 'NUMPAD_8', 'PRESS', ctrl=True)
+kmi = km.items.new('view3d.view_pan', 'NUMPAD_8', 'PRESS', ctrl=True)
kmi.properties.type = 'PANUP'
-kmi = km.items.add('view3d.view_pan', 'WHEELUPMOUSE', 'PRESS', ctrl=True)
+kmi = km.items.new('view3d.view_pan', 'WHEELUPMOUSE', 'PRESS', ctrl=True)
kmi.properties.type = 'PANRIGHT'
-kmi = km.items.add('view3d.view_pan', 'WHEELDOWNMOUSE', 'PRESS', ctrl=True)
+kmi = km.items.new('view3d.view_pan', 'WHEELDOWNMOUSE', 'PRESS', ctrl=True)
kmi.properties.type = 'PANLEFT'
-kmi = km.items.add('view3d.view_pan', 'WHEELUPMOUSE', 'PRESS', shift=True)
+kmi = km.items.new('view3d.view_pan', 'WHEELUPMOUSE', 'PRESS', shift=True)
kmi.properties.type = 'PANUP'
-kmi = km.items.add('view3d.view_pan', 'WHEELDOWNMOUSE', 'PRESS', shift=True)
+kmi = km.items.new('view3d.view_pan', 'WHEELDOWNMOUSE', 'PRESS', shift=True)
kmi.properties.type = 'PANDOWN'
-kmi = km.items.add('view3d.view_orbit', 'WHEELUPMOUSE', 'PRESS', ctrl=True, alt=True)
+kmi = km.items.new('view3d.view_orbit', 'WHEELUPMOUSE', 'PRESS', ctrl=True, alt=True)
kmi.properties.type = 'ORBITLEFT'
-kmi = km.items.add('view3d.view_orbit', 'WHEELDOWNMOUSE', 'PRESS', ctrl=True, alt=True)
+kmi = km.items.new('view3d.view_orbit', 'WHEELDOWNMOUSE', 'PRESS', ctrl=True, alt=True)
kmi.properties.type = 'ORBITRIGHT'
-kmi = km.items.add('view3d.view_orbit', 'WHEELUPMOUSE', 'PRESS', shift=True, alt=True)
+kmi = km.items.new('view3d.view_orbit', 'WHEELUPMOUSE', 'PRESS', shift=True, alt=True)
kmi.properties.type = 'ORBITUP'
-kmi = km.items.add('view3d.view_orbit', 'WHEELDOWNMOUSE', 'PRESS', shift=True, alt=True)
+kmi = km.items.new('view3d.view_orbit', 'WHEELDOWNMOUSE', 'PRESS', shift=True, alt=True)
kmi.properties.type = 'ORBITDOWN'
-kmi = km.items.add('view3d.viewnumpad', 'NUMPAD_1', 'PRESS', shift=True)
+kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_1', 'PRESS', shift=True)
kmi.properties.align_active = True
kmi.properties.type = 'FRONT'
-kmi = km.items.add('view3d.viewnumpad', 'NUMPAD_3', 'PRESS', shift=True)
+kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_3', 'PRESS', shift=True)
kmi.properties.align_active = True
kmi.properties.type = 'RIGHT'
-kmi = km.items.add('view3d.viewnumpad', 'NUMPAD_7', 'PRESS', shift=True)
+kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_7', 'PRESS', shift=True)
kmi.properties.align_active = True
kmi.properties.type = 'TOP'
-kmi = km.items.add('view3d.viewnumpad', 'NUMPAD_1', 'PRESS', shift=True, ctrl=True)
+kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_1', 'PRESS', shift=True, ctrl=True)
kmi.properties.align_active = True
kmi.properties.type = 'BACK'
-kmi = km.items.add('view3d.viewnumpad', 'NUMPAD_3', 'PRESS', shift=True, ctrl=True)
+kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_3', 'PRESS', shift=True, ctrl=True)
kmi.properties.align_active = True
kmi.properties.type = 'LEFT'
-kmi = km.items.add('view3d.viewnumpad', 'NUMPAD_7', 'PRESS', shift=True, ctrl=True)
+kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_7', 'PRESS', shift=True, ctrl=True)
kmi.properties.align_active = True
kmi.properties.type = 'BOTTOM'
-kmi = km.items.add('view3d.localview', 'NUMPAD_SLASH', 'PRESS')
-kmi = km.items.add('view3d.layers', 'ACCENT_GRAVE', 'PRESS')
+kmi = km.items.new('view3d.localview', 'NUMPAD_SLASH', 'PRESS')
+kmi = km.items.new('view3d.layers', 'ACCENT_GRAVE', 'PRESS')
kmi.properties.nr = 0
-kmi = km.items.add('view3d.layers', 'ONE', 'PRESS', any=True)
+kmi = km.items.new('view3d.layers', 'ONE', 'PRESS', any=True)
kmi.properties.nr = 1
-kmi = km.items.add('view3d.layers', 'TWO', 'PRESS', any=True)
+kmi = km.items.new('view3d.layers', 'TWO', 'PRESS', any=True)
kmi.properties.nr = 2
-kmi = km.items.add('view3d.layers', 'THREE', 'PRESS', any=True)
+kmi = km.items.new('view3d.layers', 'THREE', 'PRESS', any=True)
kmi.properties.nr = 3
-kmi = km.items.add('view3d.layers', 'FOUR', 'PRESS', any=True)
+kmi = km.items.new('view3d.layers', 'FOUR', 'PRESS', any=True)
kmi.properties.nr = 4
-kmi = km.items.add('view3d.layers', 'FIVE', 'PRESS', any=True)
+kmi = km.items.new('view3d.layers', 'FIVE', 'PRESS', any=True)
kmi.properties.nr = 5
-kmi = km.items.add('view3d.layers', 'SIX', 'PRESS', any=True)
+kmi = km.items.new('view3d.layers', 'SIX', 'PRESS', any=True)
kmi.properties.nr = 6
-kmi = km.items.add('view3d.layers', 'SEVEN', 'PRESS', any=True)
+kmi = km.items.new('view3d.layers', 'SEVEN', 'PRESS', any=True)
kmi.properties.nr = 7
-kmi = km.items.add('view3d.layers', 'EIGHT', 'PRESS', any=True)
+kmi = km.items.new('view3d.layers', 'EIGHT', 'PRESS', any=True)
kmi.properties.nr = 8
-kmi = km.items.add('view3d.layers', 'NINE', 'PRESS', any=True)
+kmi = km.items.new('view3d.layers', 'NINE', 'PRESS', any=True)
kmi.properties.nr = 9
-kmi = km.items.add('view3d.layers', 'ZERO', 'PRESS', any=True)
+kmi = km.items.new('view3d.layers', 'ZERO', 'PRESS', any=True)
kmi.properties.nr = 10
-kmi = km.items.add('wm.context_toggle_enum', 'Z', 'PRESS')
+kmi = km.items.new('wm.context_toggle_enum', 'Z', 'PRESS')
kmi.properties.data_path = 'space_data.viewport_shade'
kmi.properties.value_1 = 'SOLID'
kmi.properties.value_2 = 'WIREFRAME'
-kmi = km.items.add('wm.context_toggle_enum', 'Z', 'PRESS', alt=True)
+kmi = km.items.new('wm.context_toggle_enum', 'Z', 'PRESS', alt=True)
kmi.properties.data_path = 'space_data.viewport_shade'
kmi.properties.value_1 = 'TEXTURED'
kmi.properties.value_2 = 'SOLID'
-kmi = km.items.add('view3d.select', 'SELECTMOUSE', 'PRESS')
-kmi = km.items.add('view3d.select', 'SELECTMOUSE', 'PRESS', shift=True)
+kmi = km.items.new('view3d.select', 'SELECTMOUSE', 'PRESS')
+kmi = km.items.new('view3d.select', 'SELECTMOUSE', 'PRESS', shift=True)
kmi.properties.extend = True
-kmi = km.items.add('view3d.select', 'SELECTMOUSE', 'PRESS', ctrl=True)
+kmi = km.items.new('view3d.select', 'SELECTMOUSE', 'PRESS', ctrl=True)
kmi.properties.center = True
-kmi = km.items.add('view3d.select', 'SELECTMOUSE', 'PRESS', alt=True)
+kmi = km.items.new('view3d.select', 'SELECTMOUSE', 'PRESS', alt=True)
kmi.properties.enumerate = True
-kmi = km.items.add('view3d.select', 'SELECTMOUSE', 'PRESS', shift=True, ctrl=True)
+kmi = km.items.new('view3d.select', 'SELECTMOUSE', 'PRESS', shift=True, ctrl=True)
kmi.properties.center = True
kmi.properties.extend = True
-kmi = km.items.add('view3d.select', 'SELECTMOUSE', 'PRESS', ctrl=True, alt=True)
+kmi = km.items.new('view3d.select', 'SELECTMOUSE', 'PRESS', ctrl=True, alt=True)
kmi.properties.center = True
kmi.properties.enumerate = True
-kmi = km.items.add('view3d.select', 'SELECTMOUSE', 'PRESS', shift=True, alt=True)
+kmi = km.items.new('view3d.select', 'SELECTMOUSE', 'PRESS', shift=True, alt=True)
kmi.properties.enumerate = True
kmi.properties.extend = True
-kmi = km.items.add('view3d.select', 'SELECTMOUSE', 'PRESS', shift=True, ctrl=True, alt=True)
+kmi = km.items.new('view3d.select', 'SELECTMOUSE', 'PRESS', shift=True, ctrl=True, alt=True)
kmi.properties.center = True
kmi.properties.enumerate = True
kmi.properties.extend = True
-kmi = km.items.add('view3d.select_border', 'EVT_TWEAK_S', 'ANY')
+kmi = km.items.new('view3d.select_border', 'EVT_TWEAK_S', 'ANY')
kmi.properties.extend = False
-kmi = km.items.add('view3d.select_lasso', 'EVT_TWEAK_A', 'ANY', ctrl=True)
-kmi = km.items.add('view3d.select_lasso', 'EVT_TWEAK_A', 'ANY', shift=True, ctrl=True)
+kmi = km.items.new('view3d.select_lasso', 'EVT_TWEAK_A', 'ANY', ctrl=True)
+kmi = km.items.new('view3d.select_lasso', 'EVT_TWEAK_A', 'ANY', shift=True, ctrl=True)
kmi.properties.deselect = True
-kmi = km.items.add('view3d.select_circle', 'C', 'PRESS')
-kmi = km.items.add('view3d.clip_border', 'B', 'PRESS', alt=True)
-kmi = km.items.add('view3d.zoom_border', 'B', 'PRESS', shift=True)
-kmi = km.items.add('view3d.render_border', 'B', 'PRESS', shift=True)
-kmi = km.items.add('view3d.camera_to_view', 'NUMPAD_0', 'PRESS', ctrl=True, alt=True)
-kmi = km.items.add('view3d.object_as_camera', 'NUMPAD_0', 'PRESS', ctrl=True)
-kmi = km.items.add('wm.call_menu', 'S', 'PRESS', shift=True)
+kmi = km.items.new('view3d.select_circle', 'C', 'PRESS')
+kmi = km.items.new('view3d.clip_border', 'B', 'PRESS', alt=True)
+kmi = km.items.new('view3d.zoom_border', 'B', 'PRESS', shift=True)
+kmi = km.items.new('view3d.render_border', 'B', 'PRESS', shift=True)
+kmi = km.items.new('view3d.camera_to_view', 'NUMPAD_0', 'PRESS', ctrl=True, alt=True)
+kmi = km.items.new('view3d.object_as_camera', 'NUMPAD_0', 'PRESS', ctrl=True)
+kmi = km.items.new('wm.call_menu', 'S', 'PRESS', shift=True)
kmi.properties.name = 'VIEW3D_MT_snap'
-kmi = km.items.add('wm.context_set_enum', 'COMMA', 'PRESS')
+kmi = km.items.new('wm.context_set_enum', 'COMMA', 'PRESS')
kmi.properties.data_path = 'space_data.pivot_point'
kmi.properties.value = 'BOUNDING_BOX_CENTER'
-kmi = km.items.add('wm.context_set_enum', 'COMMA', 'PRESS', ctrl=True)
+kmi = km.items.new('wm.context_set_enum', 'COMMA', 'PRESS', ctrl=True)
kmi.properties.data_path = 'space_data.pivot_point'
kmi.properties.value = 'MEDIAN_POINT'
-kmi = km.items.add('wm.context_toggle', 'COMMA', 'PRESS', alt=True)
+kmi = km.items.new('wm.context_toggle', 'COMMA', 'PRESS', alt=True)
kmi.properties.data_path = 'space_data.use_pivot_point_align'
-kmi = km.items.add('wm.context_toggle', 'Q', 'PRESS')
+kmi = km.items.new('wm.context_toggle', 'Q', 'PRESS')
kmi.properties.data_path = 'space_data.show_manipulator'
-kmi = km.items.add('wm.context_set_enum', 'PERIOD', 'PRESS')
+kmi = km.items.new('wm.context_set_enum', 'PERIOD', 'PRESS')
kmi.properties.data_path = 'space_data.pivot_point'
kmi.properties.value = 'CURSOR'
-kmi = km.items.add('wm.context_set_enum', 'PERIOD', 'PRESS', ctrl=True)
+kmi = km.items.new('wm.context_set_enum', 'PERIOD', 'PRESS', ctrl=True)
kmi.properties.data_path = 'space_data.pivot_point'
kmi.properties.value = 'INDIVIDUAL_ORIGINS'
-kmi = km.items.add('wm.context_set_enum', 'PERIOD', 'PRESS', alt=True)
+kmi = km.items.new('wm.context_set_enum', 'PERIOD', 'PRESS', alt=True)
kmi.properties.data_path = 'space_data.pivot_point'
kmi.properties.value = 'ACTIVE_ELEMENT'
-kmi = km.items.add('transform.translate', 'G', 'PRESS', shift=True)
-kmi = km.items.add('transform.translate', 'EVT_TWEAK_S', 'ANY')
-kmi = km.items.add('transform.rotate', 'R', 'PRESS', shift=True)
-kmi = km.items.add('transform.resize', 'S', 'PRESS', shift=True)
-kmi = km.items.add('transform.warp', 'W', 'PRESS', shift=True)
-kmi = km.items.add('transform.tosphere', 'S', 'PRESS', shift=True, alt=True)
-kmi = km.items.add('transform.shear', 'S', 'PRESS', shift=True, ctrl=True, alt=True)
-kmi = km.items.add('transform.select_orientation', 'SPACE', 'PRESS', alt=True)
-kmi = km.items.add('transform.create_orientation', 'SPACE', 'PRESS', ctrl=True, alt=True)
+kmi = km.items.new('transform.translate', 'G', 'PRESS', shift=True)
+kmi = km.items.new('transform.translate', 'EVT_TWEAK_S', 'ANY')
+kmi = km.items.new('transform.rotate', 'R', 'PRESS', shift=True)
+kmi = km.items.new('transform.resize', 'S', 'PRESS', shift=True)
+kmi = km.items.new('transform.warp', 'W', 'PRESS', shift=True)
+kmi = km.items.new('transform.tosphere', 'S', 'PRESS', shift=True, alt=True)
+kmi = km.items.new('transform.shear', 'S', 'PRESS', shift=True, ctrl=True, alt=True)
+kmi = km.items.new('transform.select_orientation', 'SPACE', 'PRESS', alt=True)
+kmi = km.items.new('transform.create_orientation', 'SPACE', 'PRESS', ctrl=True, alt=True)
kmi.properties.use = True
-kmi = km.items.add('transform.mirror', 'M', 'PRESS', ctrl=True)
-kmi = km.items.add('wm.context_toggle', 'TAB', 'PRESS', shift=True)
-kmi.properties.data_path = 'tool_settings.snap'
-kmi = km.items.add('transform.snap_type', 'TAB', 'PRESS', shift=True, ctrl=True)
-kmi = km.items.add('view3d.enable_manipulator', 'W', 'PRESS')
+kmi = km.items.new('transform.mirror', 'M', 'PRESS', ctrl=True)
+kmi = km.items.new('wm.context_toggle', 'TAB', 'PRESS', shift=True)
+kmi.properties.data_path = 'tool_settings.use_snap'
+kmi = km.items.new('transform.snap_type', 'TAB', 'PRESS', shift=True, ctrl=True)
+kmi = km.items.new('view3d.enable_manipulator', 'W', 'PRESS')
kmi.properties.translate = True
-kmi = km.items.add('view3d.enable_manipulator', 'E', 'PRESS')
+kmi = km.items.new('view3d.enable_manipulator', 'E', 'PRESS')
kmi.properties.rotate = True
-kmi = km.items.add('view3d.enable_manipulator', 'R', 'PRESS')
+kmi = km.items.new('view3d.enable_manipulator', 'R', 'PRESS')
kmi.properties.scale = True
-kmi = km.items.add('view3d.select_border', 'EVT_TWEAK_S', 'ANY', shift=True)
+kmi = km.items.new('view3d.select_border', 'EVT_TWEAK_S', 'ANY', shift=True)
kmi.properties.extend = True
# Map Object Mode
-km = kc.add_keymap('Object Mode', space_type='EMPTY', region_type='WINDOW', modal=False)
+km = kc.keymaps.new('Object Mode', space_type='EMPTY', region_type='WINDOW', modal=False)
-kmi = km.items.add('wm.context_cycle_enum', 'O', 'PRESS', shift=True)
+kmi = km.items.new('wm.context_cycle_enum', 'O', 'PRESS', shift=True)
kmi.properties.data_path = 'tool_settings.proportional_edit_falloff'
-kmi = km.items.add('wm.context_toggle_enum', 'O', 'PRESS')
+kmi = km.items.new('wm.context_toggle_enum', 'O', 'PRESS')
kmi.properties.data_path = 'tool_settings.proportional_edit'
kmi.properties.value_1 = 'DISABLED'
kmi.properties.value_2 = 'ENABLED'
-kmi = km.items.add('view3d.game_start', 'P', 'PRESS')
-kmi = km.items.add('object.select_all', 'A', 'PRESS')
-kmi = km.items.add('object.select_inverse', 'I', 'PRESS', ctrl=True)
-kmi = km.items.add('object.select_linked', 'L', 'PRESS', shift=True)
-kmi = km.items.add('object.select_grouped', 'G', 'PRESS', shift=True)
-kmi = km.items.add('object.select_mirror', 'M', 'PRESS', shift=True, ctrl=True)
-kmi = km.items.add('object.select_hierarchy', 'LEFT_BRACKET', 'PRESS')
+kmi = km.items.new('view3d.game_start', 'P', 'PRESS')
+kmi = km.items.new('object.select_all', 'A', 'PRESS')
+kmi = km.items.new('object.select_inverse', 'I', 'PRESS', ctrl=True)
+kmi = km.items.new('object.select_linked', 'L', 'PRESS', shift=True)
+kmi = km.items.new('object.select_grouped', 'G', 'PRESS', shift=True)
+kmi = km.items.new('object.select_mirror', 'M', 'PRESS', shift=True, ctrl=True)
+kmi = km.items.new('object.select_hierarchy', 'LEFT_BRACKET', 'PRESS')
kmi.properties.direction = 'PARENT'
-kmi = km.items.add('object.select_hierarchy', 'LEFT_BRACKET', 'PRESS', shift=True)
+kmi = km.items.new('object.select_hierarchy', 'LEFT_BRACKET', 'PRESS', shift=True)
kmi.properties.direction = 'PARENT'
kmi.properties.extend = True
-kmi = km.items.add('object.select_hierarchy', 'RIGHT_BRACKET', 'PRESS')
+kmi = km.items.new('object.select_hierarchy', 'RIGHT_BRACKET', 'PRESS')
kmi.properties.direction = 'CHILD'
-kmi = km.items.add('object.select_hierarchy', 'RIGHT_BRACKET', 'PRESS', shift=True)
+kmi = km.items.new('object.select_hierarchy', 'RIGHT_BRACKET', 'PRESS', shift=True)
kmi.properties.direction = 'CHILD'
kmi.properties.extend = True
-kmi = km.items.add('object.parent_set', 'P', 'PRESS', ctrl=True)
-kmi = km.items.add('object.parent_no_inverse_set', 'P', 'PRESS', shift=True, ctrl=True)
-kmi = km.items.add('object.parent_clear', 'P', 'PRESS', alt=True)
-kmi = km.items.add('object.track_set', 'T', 'PRESS', ctrl=True)
-kmi = km.items.add('object.track_clear', 'T', 'PRESS', alt=True)
-kmi = km.items.add('object.constraint_add_with_targets', 'C', 'PRESS', shift=True, ctrl=True)
-kmi = km.items.add('object.constraints_clear', 'C', 'PRESS', ctrl=True, alt=True)
-kmi = km.items.add('object.location_clear', 'G', 'PRESS', alt=True)
-kmi = km.items.add('object.rotation_clear', 'R', 'PRESS', alt=True)
-kmi = km.items.add('object.scale_clear', 'S', 'PRESS', alt=True)
-kmi = km.items.add('object.origin_clear', 'O', 'PRESS', alt=True)
-kmi = km.items.add('object.hide_view_clear', 'H', 'PRESS', alt=True)
-kmi = km.items.add('object.hide_view_set', 'H', 'PRESS')
-kmi = km.items.add('object.hide_view_set', 'H', 'PRESS', shift=True)
+kmi = km.items.new('object.parent_set', 'P', 'PRESS', ctrl=True)
+kmi = km.items.new('object.parent_no_inverse_set', 'P', 'PRESS', shift=True, ctrl=True)
+kmi = km.items.new('object.parent_clear', 'P', 'PRESS', alt=True)
+kmi = km.items.new('object.track_set', 'T', 'PRESS', ctrl=True)
+kmi = km.items.new('object.track_clear', 'T', 'PRESS', alt=True)
+kmi = km.items.new('object.constraint_add_with_targets', 'C', 'PRESS', shift=True, ctrl=True)
+kmi = km.items.new('object.constraints_clear', 'C', 'PRESS', ctrl=True, alt=True)
+kmi = km.items.new('object.location_clear', 'G', 'PRESS', alt=True)
+kmi = km.items.new('object.rotation_clear', 'R', 'PRESS', alt=True)
+kmi = km.items.new('object.scale_clear', 'S', 'PRESS', alt=True)
+kmi = km.items.new('object.origin_clear', 'O', 'PRESS', alt=True)
+kmi = km.items.new('object.hide_view_clear', 'H', 'PRESS', alt=True)
+kmi = km.items.new('object.hide_view_set', 'H', 'PRESS')
+kmi = km.items.new('object.hide_view_set', 'H', 'PRESS', shift=True)
kmi.properties.unselected = True
-kmi = km.items.add('object.move_to_layer', 'M', 'PRESS')
-kmi = km.items.add('object.delete', 'X', 'PRESS')
-kmi = km.items.add('object.delete', 'DEL', 'PRESS')
-kmi = km.items.add('wm.call_menu', 'A', 'PRESS', shift=True)
+kmi = km.items.new('object.move_to_layer', 'M', 'PRESS')
+kmi = km.items.new('object.delete', 'X', 'PRESS')
+kmi = km.items.new('object.delete', 'DEL', 'PRESS')
+kmi = km.items.new('wm.call_menu', 'A', 'PRESS', shift=True)
kmi.properties.name = 'INFO_MT_add'
-kmi = km.items.add('object.duplicates_make_real', 'A', 'PRESS', shift=True, ctrl=True)
-kmi = km.items.add('wm.call_menu', 'A', 'PRESS', ctrl=True)
+kmi = km.items.new('object.duplicates_make_real', 'A', 'PRESS', shift=True, ctrl=True)
+kmi = km.items.new('wm.call_menu', 'A', 'PRESS', ctrl=True)
kmi.properties.name = 'VIEW3D_MT_object_apply'
-kmi = km.items.add('wm.call_menu', 'U', 'PRESS')
+kmi = km.items.new('wm.call_menu', 'U', 'PRESS')
kmi.properties.name = 'VIEW3D_MT_make_single_user'
-kmi = km.items.add('wm.call_menu', 'L', 'PRESS', ctrl=True)
+kmi = km.items.new('wm.call_menu', 'L', 'PRESS', ctrl=True)
kmi.properties.name = 'VIEW3D_MT_make_links'
-kmi = km.items.add('object.duplicate_move', 'D', 'PRESS', shift=True)
-kmi = km.items.add('object.duplicate_move_linked', 'D', 'PRESS', alt=True)
-kmi = km.items.add('object.join', 'J', 'PRESS', ctrl=True)
-kmi = km.items.add('object.convert', 'C', 'PRESS', alt=True)
-kmi = km.items.add('object.proxy_make', 'P', 'PRESS', ctrl=True, alt=True)
-kmi = km.items.add('object.make_local', 'L', 'PRESS')
-kmi = km.items.add('anim.keyframe_insert_menu', 'I', 'PRESS')
-kmi = km.items.add('anim.keyframe_delete_v3d', 'I', 'PRESS', alt=True)
-kmi = km.items.add('anim.keying_set_active_set', 'I', 'PRESS', shift=True, ctrl=True, alt=True)
-kmi = km.items.add('group.create', 'G', 'PRESS', ctrl=True)
-kmi = km.items.add('group.objects_remove', 'G', 'PRESS', ctrl=True, alt=True)
-kmi = km.items.add('group.objects_add_active', 'G', 'PRESS', shift=True, ctrl=True)
-kmi = km.items.add('group.objects_remove_active', 'G', 'PRESS', shift=True, alt=True)
-kmi = km.items.add('wm.call_menu', 'W', 'PRESS', ctrl=True)
+kmi = km.items.new('object.duplicate_move', 'D', 'PRESS', shift=True)
+kmi = km.items.new('object.duplicate_move_linked', 'D', 'PRESS', alt=True)
+kmi = km.items.new('object.join', 'J', 'PRESS', ctrl=True)
+kmi = km.items.new('object.convert', 'C', 'PRESS', alt=True)
+kmi = km.items.new('object.proxy_make', 'P', 'PRESS', ctrl=True, alt=True)
+kmi = km.items.new('object.make_local', 'L', 'PRESS')
+kmi = km.items.new('anim.keyframe_insert_menu', 'I', 'PRESS')
+kmi = km.items.new('anim.keyframe_delete_v3d', 'I', 'PRESS', alt=True)
+kmi = km.items.new('anim.keying_set_active_set', 'I', 'PRESS', shift=True, ctrl=True, alt=True)
+kmi = km.items.new('group.create', 'G', 'PRESS', ctrl=True)
+kmi = km.items.new('group.objects_remove', 'G', 'PRESS', ctrl=True, alt=True)
+kmi = km.items.new('group.objects_add_active', 'G', 'PRESS', shift=True, ctrl=True)
+kmi = km.items.new('group.objects_remove_active', 'G', 'PRESS', shift=True, alt=True)
+kmi = km.items.new('wm.call_menu', 'W', 'PRESS', ctrl=True)
kmi.properties.name = 'VIEW3D_MT_object_specials'
-kmi = km.items.add('object.subdivision_set', 'ZERO', 'PRESS', ctrl=True)
+kmi = km.items.new('object.subdivision_set', 'ZERO', 'PRESS', ctrl=True)
kmi.properties.level = 0
-kmi = km.items.add('object.subdivision_set', 'ONE', 'PRESS', ctrl=True)
+kmi = km.items.new('object.subdivision_set', 'ONE', 'PRESS', ctrl=True)
kmi.properties.level = 1
-kmi = km.items.add('object.subdivision_set', 'TWO', 'PRESS', ctrl=True)
+kmi = km.items.new('object.subdivision_set', 'TWO', 'PRESS', ctrl=True)
kmi.properties.level = 2
-kmi = km.items.add('object.subdivision_set', 'THREE', 'PRESS', ctrl=True)
+kmi = km.items.new('object.subdivision_set', 'THREE', 'PRESS', ctrl=True)
kmi.properties.level = 3
-kmi = km.items.add('object.subdivision_set', 'FOUR', 'PRESS', ctrl=True)
+kmi = km.items.new('object.subdivision_set', 'FOUR', 'PRESS', ctrl=True)
kmi.properties.level = 4
-kmi = km.items.add('object.subdivision_set', 'FIVE', 'PRESS', ctrl=True)
+kmi = km.items.new('object.subdivision_set', 'FIVE', 'PRESS', ctrl=True)
kmi.properties.level = 5
-kmi = km.items.add('object.select_all', 'SELECTMOUSE', 'CLICK')
+kmi = km.items.new('object.select_all', 'SELECTMOUSE', 'CLICK')
kmi.properties.action = 'DESELECT'
# Map Mesh
-km = kc.add_keymap('Mesh', space_type='EMPTY', region_type='WINDOW', modal=False)
+km = kc.keymaps.new('Mesh', space_type='EMPTY', region_type='WINDOW', modal=False)
-kmi = km.items.add('mesh.loopcut_slide', 'R', 'PRESS', ctrl=True)
-kmi = km.items.add('mesh.loop_select', 'SELECTMOUSE', 'PRESS', ctrl=True, alt=True)
-kmi = km.items.add('mesh.loop_select', 'SELECTMOUSE', 'PRESS', shift=True, alt=True)
+kmi = km.items.new('mesh.loopcut_slide', 'R', 'PRESS', ctrl=True)
+kmi = km.items.new('mesh.loop_select', 'SELECTMOUSE', 'PRESS', ctrl=True, alt=True)
+kmi = km.items.new('mesh.loop_select', 'SELECTMOUSE', 'PRESS', shift=True, alt=True)
kmi.properties.extend = True
-kmi = km.items.add('mesh.edgering_select', 'SELECTMOUSE', 'PRESS', ctrl=True, alt=True)
-kmi = km.items.add('mesh.edgering_select', 'SELECTMOUSE', 'PRESS', shift=True, ctrl=True, alt=True)
+kmi = km.items.new('mesh.edgering_select', 'SELECTMOUSE', 'PRESS', ctrl=True, alt=True)
+kmi = km.items.new('mesh.edgering_select', 'SELECTMOUSE', 'PRESS', shift=True, ctrl=True, alt=True)
kmi.properties.extend = True
-kmi = km.items.add('mesh.select_shortest_path', 'SELECTMOUSE', 'PRESS', ctrl=True)
-kmi = km.items.add('mesh.select_all', 'A', 'PRESS')
-kmi = km.items.add('mesh.select_more', 'NUMPAD_PLUS', 'PRESS', ctrl=True)
-kmi = km.items.add('mesh.select_less', 'NUMPAD_MINUS', 'PRESS', ctrl=True)
-kmi = km.items.add('mesh.select_inverse', 'I', 'PRESS', ctrl=True)
-kmi = km.items.add('mesh.select_non_manifold', 'M', 'PRESS', shift=True, ctrl=True, alt=True)
-kmi = km.items.add('mesh.select_linked', 'L', 'PRESS', ctrl=True)
-kmi = km.items.add('mesh.select_linked_pick', 'L', 'PRESS')
-kmi = km.items.add('mesh.select_linked_pick', 'L', 'PRESS', shift=True)
+kmi = km.items.new('mesh.select_shortest_path', 'SELECTMOUSE', 'PRESS', ctrl=True)
+kmi = km.items.new('mesh.select_all', 'A', 'PRESS')
+kmi = km.items.new('mesh.select_more', 'NUMPAD_PLUS', 'PRESS', ctrl=True)
+kmi = km.items.new('mesh.select_less', 'NUMPAD_MINUS', 'PRESS', ctrl=True)
+kmi = km.items.new('mesh.select_inverse', 'I', 'PRESS', ctrl=True)
+kmi = km.items.new('mesh.select_non_manifold', 'M', 'PRESS', shift=True, ctrl=True, alt=True)
+kmi = km.items.new('mesh.select_linked', 'L', 'PRESS', ctrl=True)
+kmi = km.items.new('mesh.select_linked_pick', 'L', 'PRESS')
+kmi = km.items.new('mesh.select_linked_pick', 'L', 'PRESS', shift=True)
kmi.properties.deselect = True
-kmi = km.items.add('mesh.faces_select_linked_flat', 'F', 'PRESS', shift=True, ctrl=True, alt=True)
+kmi = km.items.new('mesh.faces_select_linked_flat', 'F', 'PRESS', shift=True, ctrl=True, alt=True)
kmi.properties.sharpness = 135.0
-kmi = km.items.add('mesh.select_similar', 'G', 'PRESS', shift=True)
-kmi = km.items.add('wm.call_menu', 'TAB', 'PRESS', ctrl=True)
+kmi = km.items.new('mesh.select_similar', 'G', 'PRESS', shift=True)
+kmi = km.items.new('wm.call_menu', 'TAB', 'PRESS', ctrl=True)
kmi.properties.name = 'VIEW3D_MT_edit_mesh_selection_mode'
-kmi = km.items.add('mesh.hide', 'H', 'PRESS')
-kmi = km.items.add('mesh.hide', 'H', 'PRESS', shift=True)
+kmi = km.items.new('mesh.hide', 'H', 'PRESS')
+kmi = km.items.new('mesh.hide', 'H', 'PRESS', shift=True)
kmi.properties.unselected = True
-kmi = km.items.add('mesh.reveal', 'H', 'PRESS', alt=True)
-kmi = km.items.add('mesh.normals_make_consistent', 'N', 'PRESS', ctrl=True)
-kmi = km.items.add('mesh.normals_make_consistent', 'N', 'PRESS', shift=True, ctrl=True)
+kmi = km.items.new('mesh.reveal', 'H', 'PRESS', alt=True)
+kmi = km.items.new('mesh.normals_make_consistent', 'N', 'PRESS', ctrl=True)
+kmi = km.items.new('mesh.normals_make_consistent', 'N', 'PRESS', shift=True, ctrl=True)
kmi.properties.inside = True
-kmi = km.items.add('view3d.edit_mesh_extrude_move_normal', 'E', 'PRESS', ctrl=True)
-kmi = km.items.add('view3d.edit_mesh_extrude_individual_move', 'E', 'PRESS', shift=True)
-kmi = km.items.add('wm.call_menu', 'E', 'PRESS', alt=True)
+kmi = km.items.new('view3d.edit_mesh_extrude_move_normal', 'E', 'PRESS', ctrl=True)
+kmi = km.items.new('view3d.edit_mesh_extrude_individual_move', 'E', 'PRESS', shift=True)
+kmi = km.items.new('wm.call_menu', 'E', 'PRESS', alt=True)
kmi.properties.name = 'VIEW3D_MT_edit_mesh_extrude'
-kmi = km.items.add('mesh.spin', 'R', 'PRESS', alt=True)
-kmi = km.items.add('mesh.fill', 'F', 'PRESS', alt=True)
-kmi = km.items.add('mesh.beautify_fill', 'F', 'PRESS', shift=True, alt=True)
-kmi = km.items.add('mesh.quads_convert_to_tris', 'T', 'PRESS', ctrl=True)
-kmi = km.items.add('mesh.tris_convert_to_quads', 'J', 'PRESS', alt=True)
-kmi = km.items.add('mesh.edge_flip', 'F', 'PRESS', shift=True, ctrl=True)
-kmi = km.items.add('mesh.rip_move', 'V', 'PRESS')
-kmi = km.items.add('mesh.merge', 'M', 'PRESS', alt=True)
-kmi = km.items.add('transform.shrink_fatten', 'S', 'PRESS', ctrl=True, alt=True)
-kmi = km.items.add('mesh.edge_face_add', 'F', 'PRESS')
-kmi = km.items.add('mesh.duplicate_move', 'D', 'PRESS', shift=True)
-kmi = km.items.add('wm.call_menu', 'A', 'PRESS', shift=True)
+kmi = km.items.new('mesh.spin', 'R', 'PRESS', alt=True)
+kmi = km.items.new('mesh.fill', 'F', 'PRESS', alt=True)
+kmi = km.items.new('mesh.beautify_fill', 'F', 'PRESS', shift=True, alt=True)
+kmi = km.items.new('mesh.quads_convert_to_tris', 'T', 'PRESS', ctrl=True)
+kmi = km.items.new('mesh.tris_convert_to_quads', 'J', 'PRESS', alt=True)
+kmi = km.items.new('mesh.edge_flip', 'F', 'PRESS', shift=True, ctrl=True)
+kmi = km.items.new('mesh.rip_move', 'V', 'PRESS')
+kmi = km.items.new('mesh.merge', 'M', 'PRESS', alt=True)
+kmi = km.items.new('transform.shrink_fatten', 'S', 'PRESS', ctrl=True, alt=True)
+kmi = km.items.new('mesh.edge_face_add', 'F', 'PRESS')
+kmi = km.items.new('mesh.duplicate_move', 'D', 'PRESS', shift=True)
+kmi = km.items.new('wm.call_menu', 'A', 'PRESS', shift=True)
kmi.properties.name = 'INFO_MT_mesh_add'
-kmi = km.items.add('mesh.separate', 'P', 'PRESS')
-kmi = km.items.add('mesh.split', 'Y', 'PRESS')
-kmi = km.items.add('mesh.dupli_extrude_cursor', 'ACTIONMOUSE', 'CLICK', ctrl=True)
-kmi = km.items.add('mesh.delete', 'X', 'PRESS')
-kmi = km.items.add('mesh.delete', 'DEL', 'PRESS')
-kmi = km.items.add('mesh.knife_cut', 'LEFTMOUSE', 'PRESS', key_modifier='K')
-kmi = km.items.add('mesh.knife_cut', 'LEFTMOUSE', 'PRESS', shift=True, key_modifier='K')
+kmi = km.items.new('mesh.separate', 'P', 'PRESS')
+kmi = km.items.new('mesh.split', 'Y', 'PRESS')
+kmi = km.items.new('mesh.dupli_extrude_cursor', 'ACTIONMOUSE', 'CLICK', ctrl=True)
+kmi = km.items.new('mesh.delete', 'X', 'PRESS')
+kmi = km.items.new('mesh.delete', 'DEL', 'PRESS')
+kmi = km.items.new('mesh.knife_cut', 'LEFTMOUSE', 'PRESS', key_modifier='K')
+kmi = km.items.new('mesh.knife_cut', 'LEFTMOUSE', 'PRESS', shift=True, key_modifier='K')
kmi.properties.type = 'MIDPOINTS'
-kmi = km.items.add('object.vertex_parent_set', 'P', 'PRESS', ctrl=True)
-kmi = km.items.add('wm.call_menu', 'W', 'PRESS', ctrl=True)
+kmi = km.items.new('object.vertex_parent_set', 'P', 'PRESS', ctrl=True)
+kmi = km.items.new('wm.call_menu', 'W', 'PRESS', ctrl=True)
kmi.properties.name = 'VIEW3D_MT_edit_mesh_specials'
-kmi = km.items.add('wm.call_menu', 'F', 'PRESS', ctrl=True)
+kmi = km.items.new('wm.call_menu', 'F', 'PRESS', ctrl=True)
kmi.properties.name = 'VIEW3D_MT_edit_mesh_faces'
-kmi = km.items.add('wm.call_menu', 'E', 'PRESS', ctrl=True)
+kmi = km.items.new('wm.call_menu', 'E', 'PRESS', ctrl=True)
kmi.properties.name = 'VIEW3D_MT_edit_mesh_edges'
-kmi = km.items.add('wm.call_menu', 'V', 'PRESS', ctrl=True)
+kmi = km.items.new('wm.call_menu', 'V', 'PRESS', ctrl=True)
kmi.properties.name = 'VIEW3D_MT_edit_mesh_vertices'
-kmi = km.items.add('wm.call_menu', 'H', 'PRESS', ctrl=True)
+kmi = km.items.new('wm.call_menu', 'H', 'PRESS', ctrl=True)
kmi.properties.name = 'VIEW3D_MT_hook'
-kmi = km.items.add('wm.call_menu', 'U', 'PRESS')
+kmi = km.items.new('wm.call_menu', 'U', 'PRESS')
kmi.properties.name = 'VIEW3D_MT_uv_map'
-kmi = km.items.add('wm.call_menu', 'G', 'PRESS', ctrl=True)
+kmi = km.items.new('wm.call_menu', 'G', 'PRESS', ctrl=True)
kmi.properties.name = 'VIEW3D_MT_vertex_group'
-kmi = km.items.add('wm.context_cycle_enum', 'O', 'PRESS', shift=True)
+kmi = km.items.new('wm.context_cycle_enum', 'O', 'PRESS', shift=True)
kmi.properties.data_path = 'tool_settings.proportional_edit_falloff'
-kmi = km.items.add('wm.context_toggle_enum', 'O', 'PRESS')
+kmi = km.items.new('wm.context_toggle_enum', 'O', 'PRESS')
kmi.properties.data_path = 'tool_settings.proportional_edit'
kmi.properties.value_1 = 'DISABLED'
kmi.properties.value_2 = 'ENABLED'
-kmi = km.items.add('wm.context_toggle_enum', 'O', 'PRESS', alt=True)
+kmi = km.items.new('wm.context_toggle_enum', 'O', 'PRESS', alt=True)
kmi.properties.data_path = 'tool_settings.proportional_edit'
kmi.properties.value_1 = 'DISABLED'
kmi.properties.value_2 = 'CONNECTED'
-kmi = km.items.add('mesh.select_all', 'SELECTMOUSE', 'CLICK')
+kmi = km.items.new('mesh.select_all', 'SELECTMOUSE', 'CLICK')
kmi.properties.action = 'DESELECT'
-wm.active_keyconfig = kc
+wm.keyconfigs.active = kc
bpy.context.user_preferences.edit.use_drag_immediately = True
bpy.context.user_preferences.edit.use_insertkey_xyz_to_rgb = False
diff --git a/release/scripts/templates/operator.py b/release/scripts/templates/operator.py
index 5a525784b51..423b0b85402 100644
--- a/release/scripts/templates/operator.py
+++ b/release/scripts/templates/operator.py
@@ -38,7 +38,7 @@ class ExportSomeData(bpy.types.Operator):
return {'FINISHED'}
def invoke(self, context, event):
- wm = context.manager
+ wm = context.window_manager
if True:
# File selector
diff --git a/release/scripts/templates/operator_modal.py b/release/scripts/templates/operator_modal.py
index 0c5db47674b..1e88ef3a3f6 100644
--- a/release/scripts/templates/operator_modal.py
+++ b/release/scripts/templates/operator_modal.py
@@ -25,7 +25,7 @@ class ModalOperator(bpy.types.Operator):
def invoke(self, context, event):
if context.object:
- context.manager.add_modal_handler(self)
+ context.window_manager.add_modal_handler(self)
self.properties.first_mouse_x = event.mouse_x
self.properties.first_value = context.object.location.x
return {'RUNNING_MODAL'}
diff --git a/release/scripts/templates/operator_modal_draw.py b/release/scripts/templates/operator_modal_draw.py
index 56ffb95f555..2a3db3e3018 100644
--- a/release/scripts/templates/operator_modal_draw.py
+++ b/release/scripts/templates/operator_modal_draw.py
@@ -52,7 +52,7 @@ class ModalDrawOperator(bpy.types.Operator):
def invoke(self, context, event):
if context.area.type == 'VIEW_3D':
- context.manager.add_modal_handler(self)
+ context.window_manager.add_modal_handler(self)
# Add the region OpenGL drawing callback
# draw in view space with 'POST_VIEW' and 'PRE_VIEW'
diff --git a/release/scripts/templates/operator_modal_view3d.py b/release/scripts/templates/operator_modal_view3d.py
index 9b49fd947ad..d7d691dacf2 100644
--- a/release/scripts/templates/operator_modal_view3d.py
+++ b/release/scripts/templates/operator_modal_view3d.py
@@ -39,7 +39,7 @@ class ViewOperator(bpy.types.Operator):
v3d = context.space_data
rv3d = v3d.region_3d
- context.manager.add_modal_handler(self)
+ context.window_manager.add_modal_handler(self)
if rv3d.view_perspective == 'CAMERA':
rv3d.view_perspective = 'PERSP'
diff --git a/release/scripts/templates/operator_uv.py b/release/scripts/templates/operator_uv.py
index a18aaf358c8..305496e31ce 100644
--- a/release/scripts/templates/operator_uv.py
+++ b/release/scripts/templates/operator_uv.py
@@ -9,11 +9,11 @@ def main(context):
bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
- if not mesh.active_uv_texture:
- bpy.ops.mesh.uv_texture_add()
+ if not mesh.uv_textures:
+ uvtex = bpy.ops.mesh.uv_texture_add()
# adjust UVs
- for i, uv in enumerate(mesh.active_uv_texture.data):
+ for i, uv in enumerate(uvtex.data):
uvs = uv.uv1, uv.uv2, uv.uv3, uv.uv4
for j, v_idx in enumerate(mesh.faces[i].vertices):
if uv.select_uv[j]:
diff --git a/release/scripts/ui/properties_animviz.py b/release/scripts/ui/properties_animviz.py
index 9b605d02215..2a463331ac7 100644
--- a/release/scripts/ui/properties_animviz.py
+++ b/release/scripts/ui/properties_animviz.py
@@ -27,7 +27,7 @@ class MotionPathButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_label = "Motion Paths"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
def draw_settings(self, context, avs, bones=False):
layout = self.layout
@@ -65,7 +65,7 @@ class OnionSkinButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_label = "Onion Skinning"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
def draw(self, context):
layout = self.layout
diff --git a/release/scripts/ui/properties_data_armature.py b/release/scripts/ui/properties_data_armature.py
index 7de06554751..17186378cb0 100644
--- a/release/scripts/ui/properties_data_armature.py
+++ b/release/scripts/ui/properties_data_armature.py
@@ -33,7 +33,7 @@ class ArmatureButtonsPanel():
class DATA_PT_context_arm(ArmatureButtonsPanel, bpy.types.Panel):
bl_label = ""
- bl_show_header = False
+ bl_options = {'HIDE_HEADER'}
def draw(self, context):
layout = self.layout
@@ -119,14 +119,14 @@ class DATA_PT_bone_groups(ArmatureButtonsPanel, bpy.types.Panel):
pose = ob.pose
row = layout.row()
- row.template_list(pose, "bone_groups", pose, "active_bone_group_index", rows=2)
+ row.template_list(pose, "bone_groups", pose.bone_groups, "active_index", rows=2)
col = row.column(align=True)
col.active = (ob.proxy is None)
col.operator("pose.group_add", icon='ZOOMIN', text="")
col.operator("pose.group_remove", icon='ZOOMOUT', text="")
- group = pose.active_bone_group
+ group = pose.bone_groups.active
if group:
col = layout.column()
col.active = (ob.proxy is None)
@@ -139,7 +139,10 @@ class DATA_PT_bone_groups(ArmatureButtonsPanel, bpy.types.Panel):
col.prop(group, "color_set")
if group.color_set:
col = split.column()
- col.template_triColorSet(group, "colors")
+ subrow = col.row(align=True)
+ subrow.prop(group.colors, "normal", text="")
+ subrow.prop(group.colors, "select", text="")
+ subrow.prop(group.colors, "active", text="")
row = layout.row()
row.active = (ob.proxy is None)
@@ -184,7 +187,7 @@ class DATA_PT_ghost(ArmatureButtonsPanel, bpy.types.Panel):
class DATA_PT_iksolver_itasc(ArmatureButtonsPanel, bpy.types.Panel):
bl_label = "iTaSC parameters"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
diff --git a/release/scripts/ui/properties_data_armature_rigify.py b/release/scripts/ui/properties_data_armature_rigify.py
index 1c2370cbb28..aca41d59d3a 100644
--- a/release/scripts/ui/properties_data_armature_rigify.py
+++ b/release/scripts/ui/properties_data_armature_rigify.py
@@ -38,7 +38,7 @@ class DATA_PT_template(bpy.types.Panel):
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "data"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
templates = []
@@ -250,7 +250,7 @@ class AsScript(bpy.types.Operator):
import os
obj = context.object
self.properties.filepath = os.path.splitext(bpy.data.filepath)[0] + "-" + bpy.path.clean_name(obj.name) + ".py"
- wm = context.manager
+ wm = context.window_manager
wm.add_fileselect(self)
return {'RUNNING_MODAL'}
diff --git a/release/scripts/ui/properties_data_bone.py b/release/scripts/ui/properties_data_bone.py
index 663d576a9c0..3ed05d914ed 100644
--- a/release/scripts/ui/properties_data_bone.py
+++ b/release/scripts/ui/properties_data_bone.py
@@ -33,7 +33,7 @@ class BoneButtonsPanel():
class BONE_PT_context_bone(BoneButtonsPanel, bpy.types.Panel):
bl_label = ""
- bl_show_header = False
+ bl_options = {'HIDE_HEADER'}
def draw(self, context):
layout = self.layout
@@ -95,7 +95,7 @@ class BONE_PT_transform(BoneButtonsPanel, bpy.types.Panel):
class BONE_PT_transform_locks(BoneButtonsPanel, bpy.types.Panel):
bl_label = "Transform Locks"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
@@ -151,14 +151,14 @@ class BONE_PT_relations(BoneButtonsPanel, bpy.types.Panel):
if ob and pchan:
col.label(text="Bone Group:")
- col.prop_object(pchan, "bone_group", ob.pose, "bone_groups", text="")
+ col.prop_search(pchan, "bone_group", ob.pose, "bone_groups", text="")
col = split.column()
col.label(text="Parent:")
if context.bone:
col.prop(bone, "parent", text="")
else:
- col.prop_object(bone, "parent", arm, "edit_bones", text="")
+ col.prop_search(bone, "parent", arm, "edit_bones", text="")
sub = col.column()
sub.active = (bone.parent is not None)
@@ -202,12 +202,12 @@ class BONE_PT_display(BoneButtonsPanel, bpy.types.Panel):
col.label(text="Custom Shape:")
col.prop(pchan, "custom_shape", text="")
if pchan.custom_shape:
- col.prop_object(pchan, "custom_shape_transform", ob.pose, "bones", text="At")
+ col.prop_search(pchan, "custom_shape_transform", ob.pose, "bones", text="At")
class BONE_PT_inverse_kinematics(BoneButtonsPanel, bpy.types.Panel):
bl_label = "Inverse Kinematics"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
@@ -224,7 +224,7 @@ class BONE_PT_inverse_kinematics(BoneButtonsPanel, bpy.types.Panel):
row.prop(ob.pose, "ik_solver")
split = layout.split(percentage=0.25)
- split.prop(pchan, "lock_ik_x", text="Lock X")
+ split.prop(pchan, "lock_ik_x", icon='LOCKED' if pchan.lock_ik_x else 'UNLOCKED', text="X")
split.active = pchan.is_in_ik_chain
row = split.row()
row.prop(pchan, "ik_stiffness_x", text="Stiffness", slider=True)
@@ -241,8 +241,8 @@ class BONE_PT_inverse_kinematics(BoneButtonsPanel, bpy.types.Panel):
sub.active = pchan.lock_ik_x == False and pchan.use_ik_limit_x and pchan.is_in_ik_chain
split = layout.split(percentage=0.25)
- split.prop(pchan, "lock_ik_y", text="Y")
- split.active = pchan.is_in_ik_chain and pchan.is_in_ik_chain
+ split.prop(pchan, "lock_ik_y", icon='LOCKED' if pchan.lock_ik_y else 'UNLOCKED', text="Y")
+ split.active = pchan.is_in_ik_chain
row = split.row()
row.prop(pchan, "ik_stiffness_y", text="Stiffness", slider=True)
row.active = pchan.lock_ik_y == False and pchan.is_in_ik_chain
@@ -259,8 +259,8 @@ class BONE_PT_inverse_kinematics(BoneButtonsPanel, bpy.types.Panel):
sub.active = pchan.lock_ik_y == False and pchan.use_ik_limit_y and pchan.is_in_ik_chain
split = layout.split(percentage=0.25)
- split.prop(pchan, "lock_ik_z", text="Z")
- split.active = pchan.is_in_ik_chain and pchan.is_in_ik_chain
+ split.prop(pchan, "lock_ik_z", icon='LOCKED' if pchan.lock_ik_z else 'UNLOCKED', text="Z")
+ split.active = pchan.is_in_ik_chain
sub = split.row()
sub.prop(pchan, "ik_stiffness_z", text="Stiffness", slider=True)
sub.active = pchan.lock_ik_z == False and pchan.is_in_ik_chain
@@ -274,10 +274,12 @@ class BONE_PT_inverse_kinematics(BoneButtonsPanel, bpy.types.Panel):
sub.prop(pchan, "ik_min_z", text="")
sub.prop(pchan, "ik_max_z", text="")
sub.active = pchan.lock_ik_z == False and pchan.use_ik_limit_z and pchan.is_in_ik_chain
- split = layout.split()
- split.prop(pchan, "ik_stretch", text="Stretch", slider=True)
- split.label()
- split.active = pchan.is_in_ik_chain
+
+ split = layout.split(percentage=0.25)
+ split.label(text="Stretch:")
+ sub = split.row()
+ sub.prop(pchan, "ik_stretch", text="", slider=True)
+ sub.active = pchan.is_in_ik_chain
if ob.pose.ik_solver == 'ITASC':
split = layout.split()
@@ -295,7 +297,7 @@ class BONE_PT_inverse_kinematics(BoneButtonsPanel, bpy.types.Panel):
class BONE_PT_deform(BoneButtonsPanel, bpy.types.Panel):
bl_label = "Deform"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
def draw_header(self, context):
bone = context.bone
diff --git a/release/scripts/ui/properties_data_camera.py b/release/scripts/ui/properties_data_camera.py
index 1e4ec6deb18..f7a7ec6b7a9 100644
--- a/release/scripts/ui/properties_data_camera.py
+++ b/release/scripts/ui/properties_data_camera.py
@@ -34,7 +34,7 @@ class CameraButtonsPanel():
class DATA_PT_context_camera(CameraButtonsPanel, bpy.types.Panel):
bl_label = ""
- bl_show_header = False
+ bl_options = {'HIDE_HEADER'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
def draw(self, context):
diff --git a/release/scripts/ui/properties_data_curve.py b/release/scripts/ui/properties_data_curve.py
index 3008db11b36..375136a335f 100644
--- a/release/scripts/ui/properties_data_curve.py
+++ b/release/scripts/ui/properties_data_curve.py
@@ -50,7 +50,7 @@ class CurveButtonsPanelActive(CurveButtonsPanel):
class DATA_PT_context_curve(CurveButtonsPanel, bpy.types.Panel):
bl_label = ""
- bl_show_header = False
+ bl_options = {'HIDE_HEADER'}
def draw(self, context):
layout = self.layout
diff --git a/release/scripts/ui/properties_data_lamp.py b/release/scripts/ui/properties_data_lamp.py
index ce0d404434d..a5ac3bd62ae 100644
--- a/release/scripts/ui/properties_data_lamp.py
+++ b/release/scripts/ui/properties_data_lamp.py
@@ -42,7 +42,7 @@ class DataButtonsPanel():
class DATA_PT_context_lamp(DataButtonsPanel, bpy.types.Panel):
bl_label = ""
- bl_show_header = False
+ bl_options = {'HIDE_HEADER'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
def draw(self, context):
@@ -54,13 +54,15 @@ class DATA_PT_context_lamp(DataButtonsPanel, bpy.types.Panel):
split = layout.split(percentage=0.65)
+ texture_count = len(lamp.texture_slots.keys())
+
if ob:
split.template_ID(ob, "data")
- split.separator()
elif lamp:
split.template_ID(space, "pin_id")
- split.separator()
+ if texture_count != 0:
+ split.label(text=str(texture_count), icon='TEXTURE')
class DATA_PT_preview(DataButtonsPanel, bpy.types.Panel):
bl_label = "Preview"
@@ -367,7 +369,7 @@ class DATA_PT_spot(DataButtonsPanel, bpy.types.Panel):
class DATA_PT_falloff_curve(DataButtonsPanel, bpy.types.Panel):
bl_label = "Falloff Curve"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@classmethod
diff --git a/release/scripts/ui/properties_data_lattice.py b/release/scripts/ui/properties_data_lattice.py
index 9abdb23ea23..05b331ea0a2 100644
--- a/release/scripts/ui/properties_data_lattice.py
+++ b/release/scripts/ui/properties_data_lattice.py
@@ -33,7 +33,7 @@ class DataButtonsPanel():
class DATA_PT_context_lattice(DataButtonsPanel, bpy.types.Panel):
bl_label = ""
- bl_show_header = False
+ bl_options = {'HIDE_HEADER'}
def draw(self, context):
layout = self.layout
@@ -79,7 +79,7 @@ class DATA_PT_lattice(DataButtonsPanel, bpy.types.Panel):
row = layout.row()
row.prop(lat, "use_outside")
- row.prop_object(lat, "vertex_group", context.object, "vertex_groups", text="")
+ row.prop_search(lat, "vertex_group", context.object, "vertex_groups", text="")
class DATA_PT_custom_props_lattice(DataButtonsPanel, PropertyPanel, bpy.types.Panel):
diff --git a/release/scripts/ui/properties_data_mesh.py b/release/scripts/ui/properties_data_mesh.py
index aaf70692681..5d34bd9d4ad 100644
--- a/release/scripts/ui/properties_data_mesh.py
+++ b/release/scripts/ui/properties_data_mesh.py
@@ -60,7 +60,7 @@ class MeshButtonsPanel():
class DATA_PT_context_mesh(MeshButtonsPanel, bpy.types.Panel):
bl_label = ""
- bl_show_header = False
+ bl_options = {'HIDE_HEADER'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
def draw(self, context):
@@ -127,14 +127,14 @@ class DATA_PT_vertex_groups(MeshButtonsPanel, bpy.types.Panel):
layout = self.layout
ob = context.object
- group = ob.active_vertex_group
+ group = ob.vertex_groups.active
rows = 2
if group:
rows = 5
row = layout.row()
- row.template_list(ob, "vertex_groups", ob, "active_vertex_group_index", rows=rows)
+ row.template_list(ob, "vertex_groups", ob.vertex_groups, "active_index", rows=rows)
col = row.column(align=True)
col.operator("object.vertex_group_add", icon='ZOOMIN', text="")
@@ -245,8 +245,8 @@ class DATA_PT_shape_keys(MeshButtonsPanel, bpy.types.Panel):
col = split.column(align=True)
col.active = enable_edit_value
col.label(text="Blend:")
- col.prop_object(kb, "vertex_group", ob, "vertex_groups", text="")
- col.prop_object(kb, "relative_key", key, "keys", text="")
+ col.prop_search(kb, "vertex_group", ob, "vertex_groups", text="")
+ col.prop_search(kb, "relative_key", key, "keys", text="")
else:
row = layout.row()
@@ -266,13 +266,13 @@ class DATA_PT_uv_texture(MeshButtonsPanel, bpy.types.Panel):
row = layout.row()
col = row.column()
- col.template_list(me, "uv_textures", me, "active_uv_texture_index", rows=2)
+ col.template_list(me, "uv_textures", me.uv_textures, "active_index", rows=2)
col = row.column(align=True)
col.operator("mesh.uv_texture_add", icon='ZOOMIN', text="")
col.operator("mesh.uv_texture_remove", icon='ZOOMOUT', text="")
- lay = me.active_uv_texture
+ lay = me.uv_textures.active
if lay:
layout.prop(lay, "name")
@@ -300,7 +300,7 @@ class DATA_PT_texface(MeshButtonsPanel, bpy.types.Panel):
split = layout.split()
col = split.column()
- col.prop(tf, "use_bitmap_text")
+ col.prop(tf, "use_image")
col.prop(tf, "use_light")
col.prop(tf, "hide")
col.prop(tf, "use_collision")
@@ -335,13 +335,13 @@ class DATA_PT_vertex_colors(MeshButtonsPanel, bpy.types.Panel):
row = layout.row()
col = row.column()
- col.template_list(me, "vertex_colors", me, "active_vertex_color_index", rows=2)
+ col.template_list(me, "vertex_colors", me.vertex_colors, "active_index", rows=2)
col = row.column(align=True)
col.operator("mesh.vertex_color_add", icon='ZOOMIN', text="")
col.operator("mesh.vertex_color_remove", icon='ZOOMOUT', text="")
- lay = me.active_vertex_color
+ lay = me.vertex_colors.active
if lay:
layout.prop(lay, "name")
diff --git a/release/scripts/ui/properties_data_metaball.py b/release/scripts/ui/properties_data_metaball.py
index 83e5e642d0e..b4bf8dc5d70 100644
--- a/release/scripts/ui/properties_data_metaball.py
+++ b/release/scripts/ui/properties_data_metaball.py
@@ -33,7 +33,7 @@ class DataButtonsPanel():
class DATA_PT_context_metaball(DataButtonsPanel, bpy.types.Panel):
bl_label = ""
- bl_show_header = False
+ bl_options = {'HIDE_HEADER'}
def draw(self, context):
layout = self.layout
@@ -80,12 +80,12 @@ class DATA_PT_metaball_element(DataButtonsPanel, bpy.types.Panel):
@classmethod
def poll(cls, context):
- return (context.meta_ball and context.meta_ball.active_element)
+ return (context.meta_ball and context.meta_ball.elements.active)
def draw(self, context):
layout = self.layout
- metaelem = context.meta_ball.active_element
+ metaelem = context.meta_ball.elements.active
layout.prop(metaelem, "type")
diff --git a/release/scripts/ui/properties_data_modifier.py b/release/scripts/ui/properties_data_modifier.py
index 46ac5ae570f..8950a017022 100644
--- a/release/scripts/ui/properties_data_modifier.py
+++ b/release/scripts/ui/properties_data_modifier.py
@@ -55,7 +55,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, bpy.types.Panel):
col = split.column()
col.label(text="Vertex Group::")
- col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
+ col.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
sub = col.column()
sub.active = bool(md.vertex_group)
sub.prop(md, "invert_vertex_group")
@@ -182,7 +182,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, bpy.types.Panel):
col = split.column()
col.label(text="Vertex Group:")
- col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
+ col.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
col = split.column()
col.label(text="Control Object:")
col.prop(md, "object", text="")
@@ -203,7 +203,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, bpy.types.Panel):
col.prop(md, "object", text="")
col = split.column()
col.label(text="Vertex Group:")
- col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
+ col.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
layout.label(text="Deformation Axis:")
layout.row().prop(md, "deform_axis", expand=True)
@@ -218,7 +218,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, bpy.types.Panel):
col.label(text="Texture:")
col.prop(md, "texture", text="")
col.label(text="Vertex Group:")
- col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
+ col.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
col = split.column()
col.label(text="Direction:")
@@ -228,7 +228,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, bpy.types.Panel):
if md.texture_coords == 'OBJECT':
layout.prop(md, "texture_coordinate_object", text="Object")
elif md.texture_coords == 'UV' and ob.type == 'MESH':
- layout.prop_object(md, "uv_layer", ob.data, "uv_textures")
+ layout.prop_search(md, "uv_layer", ob.data, "uv_textures")
layout.separator()
@@ -257,7 +257,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, bpy.types.Panel):
col = split.column()
col.label(text="Vertex group:")
- col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
+ col.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
sub = col.column()
sub.active = bool(md.vertex_group)
sub.prop(md, "protect")
@@ -282,10 +282,10 @@ class DATA_PT_modifiers(ModifierButtonsPanel, bpy.types.Panel):
col.prop(md, "object", text="")
if md.object and md.object.type == 'ARMATURE':
col.label(text="Bone:")
- col.prop_object(md, "subtarget", md.object.data, "bones", text="")
+ col.prop_search(md, "subtarget", md.object.data, "bones", text="")
col = split.column()
col.label(text="Vertex Group:")
- col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
+ col.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
layout.separator()
@@ -314,7 +314,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, bpy.types.Panel):
col = split.column()
col.label(text="Vertex Group:")
- col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
+ col.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
def MASK(self, layout, ob, md):
split = layout.split()
@@ -328,7 +328,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, bpy.types.Panel):
col.prop(md, "armature", text="")
elif md.mode == 'VERTEX_GROUP':
col.label(text="Vertex Group:")
- col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
+ col.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
sub = col.column()
sub.active = bool(md.vertex_group)
@@ -343,7 +343,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, bpy.types.Panel):
sub.active = not md.is_bound
col = split.column()
col.label(text="Vertex Group:")
- col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
+ col.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
sub = col.column()
sub.active = bool(md.vertex_group)
@@ -480,7 +480,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, bpy.types.Panel):
col.prop(md, "target", text="")
col = split.column()
col.label(text="Vertex Group:")
- col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
+ col.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
split = layout.split()
@@ -528,7 +528,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, bpy.types.Panel):
col = split.column()
col.label(text="Vertex Group:")
- col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
+ col.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
split = layout.split()
@@ -563,7 +563,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, bpy.types.Panel):
col.prop(md, "factor")
col.prop(md, "iterations")
col.label(text="Vertex Group:")
- col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
+ col.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
def SOFT_BODY(self, layout, ob, md):
layout.label(text="See Soft Body panel.")
@@ -574,7 +574,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, bpy.types.Panel):
col = split.column()
col.prop(md, "thickness")
- col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
+ col.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
col.label(text="Crease:")
col.prop(md, "edge_crease_inner", text="Inner")
@@ -623,7 +623,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, bpy.types.Panel):
col = split.column()
col.label(text="UV Layer:")
- col.prop_object(md, "uv_layer", ob.data, "uv_textures", text="")
+ col.prop_search(md, "uv_layer", ob.data, "uv_textures", text="")
split = layout.split()
col = split.column()
@@ -677,11 +677,11 @@ class DATA_PT_modifiers(ModifierButtonsPanel, bpy.types.Panel):
layout.separator()
layout.prop(md, "start_position_object")
- layout.prop_object(md, "vertex_group", ob, "vertex_groups")
+ layout.prop_search(md, "vertex_group", ob, "vertex_groups")
layout.prop(md, "texture")
layout.prop(md, "texture_coords")
if md.texture_coords == 'MAP_UV' and ob.type == 'MESH':
- layout.prop_object(md, "uv_layer", ob.data, "uv_textures")
+ layout.prop_search(md, "uv_layer", ob.data, "uv_textures")
elif md.texture_coords == 'OBJECT':
layout.prop(md, "texture_coords_object")
diff --git a/release/scripts/ui/properties_game.py b/release/scripts/ui/properties_game.py
index 8d2f075fce0..e703f4a9812 100644
--- a/release/scripts/ui/properties_game.py
+++ b/release/scripts/ui/properties_game.py
@@ -368,7 +368,7 @@ class WorldButtonsPanel():
class WORLD_PT_game_context_world(WorldButtonsPanel, bpy.types.Panel):
bl_label = ""
- bl_show_header = False
+ bl_options = {'HIDE_HEADER'}
COMPAT_ENGINES = {'BLENDER_GAME'}
@classmethod
diff --git a/release/scripts/ui/properties_material.py b/release/scripts/ui/properties_material.py
index 265f7e08d3a..e965719007f 100644
--- a/release/scripts/ui/properties_material.py
+++ b/release/scripts/ui/properties_material.py
@@ -65,7 +65,7 @@ class MaterialButtonsPanel():
class MATERIAL_PT_context_material(MaterialButtonsPanel, bpy.types.Panel):
bl_label = ""
- bl_show_header = False
+ bl_options = {'HIDE_HEADER'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@classmethod
@@ -300,7 +300,7 @@ class MATERIAL_PT_shading(MaterialButtonsPanel, bpy.types.Panel):
class MATERIAL_PT_transp(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Transparency"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_RENDER'}
@classmethod
@@ -362,7 +362,7 @@ class MATERIAL_PT_transp(MaterialButtonsPanel, bpy.types.Panel):
class MATERIAL_PT_mirror(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Mirror"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_RENDER'}
@classmethod
@@ -420,7 +420,7 @@ class MATERIAL_PT_mirror(MaterialButtonsPanel, bpy.types.Panel):
class MATERIAL_PT_sss(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Subsurface Scattering"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_RENDER'}
@classmethod
@@ -581,7 +581,7 @@ class MATERIAL_PT_physics(MaterialButtonsPanel, bpy.types.Panel):
class MATERIAL_PT_strand(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Strand"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_RENDER'}
@classmethod
@@ -615,7 +615,7 @@ class MATERIAL_PT_strand(MaterialButtonsPanel, bpy.types.Panel):
col.prop(tan, "width_fade")
ob = context.object
if ob and ob.type == 'MESH':
- col.prop_object(tan, "uv_layer", ob.data, "uv_textures", text="")
+ col.prop_search(tan, "uv_layer", ob.data, "uv_textures", text="")
else:
col.prop(tan, "uv_layer", text="")
col.separator()
@@ -673,7 +673,7 @@ class MATERIAL_PT_options(MaterialButtonsPanel, bpy.types.Panel):
class MATERIAL_PT_shadow(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Shadow"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@classmethod
@@ -710,7 +710,7 @@ class MATERIAL_PT_shadow(MaterialButtonsPanel, bpy.types.Panel):
class MATERIAL_PT_transp_game(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Transparency"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_GAME'}
@classmethod
@@ -755,7 +755,6 @@ class VolumeButtonsPanel():
class MATERIAL_PT_volume_density(VolumeButtonsPanel, bpy.types.Panel):
bl_label = "Density"
- bl_default_closed = False
COMPAT_ENGINES = {'BLENDER_RENDER'}
def draw(self, context):
@@ -773,7 +772,6 @@ class MATERIAL_PT_volume_density(VolumeButtonsPanel, bpy.types.Panel):
class MATERIAL_PT_volume_shading(VolumeButtonsPanel, bpy.types.Panel):
bl_label = "Shading"
- bl_default_closed = False
COMPAT_ENGINES = {'BLENDER_RENDER'}
def draw(self, context):
@@ -799,7 +797,6 @@ class MATERIAL_PT_volume_shading(VolumeButtonsPanel, bpy.types.Panel):
class MATERIAL_PT_volume_lighting(VolumeButtonsPanel, bpy.types.Panel):
bl_label = "Lighting"
- bl_default_closed = False
COMPAT_ENGINES = {'BLENDER_RENDER'}
def draw(self, context):
@@ -847,7 +844,6 @@ class MATERIAL_PT_volume_transp(VolumeButtonsPanel, bpy.types.Panel):
class MATERIAL_PT_volume_integration(VolumeButtonsPanel, bpy.types.Panel):
bl_label = "Integration"
- bl_default_closed = False
COMPAT_ENGINES = {'BLENDER_RENDER'}
def draw(self, context):
@@ -871,7 +867,7 @@ class MATERIAL_PT_volume_integration(VolumeButtonsPanel, bpy.types.Panel):
class MATERIAL_PT_volume_options(VolumeButtonsPanel, bpy.types.Panel):
bl_label = "Options"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
def draw(self, context):
layout = self.layout
diff --git a/release/scripts/ui/properties_object.py b/release/scripts/ui/properties_object.py
index a87a43a7998..66189f62dbf 100644
--- a/release/scripts/ui/properties_object.py
+++ b/release/scripts/ui/properties_object.py
@@ -29,7 +29,7 @@ class ObjectButtonsPanel():
class OBJECT_PT_context_object(ObjectButtonsPanel, bpy.types.Panel):
bl_label = ""
- bl_show_header = False
+ bl_options = {'HIDE_HEADER'}
def draw(self, context):
layout = self.layout
@@ -72,7 +72,7 @@ class OBJECT_PT_transform(ObjectButtonsPanel, bpy.types.Panel):
class OBJECT_PT_transform_locks(ObjectButtonsPanel, bpy.types.Panel):
bl_label = "Transform Locks"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
def draw(self, context):
layout = self.layout
@@ -119,7 +119,7 @@ class OBJECT_PT_relations(ObjectButtonsPanel, bpy.types.Panel):
sub.prop(ob, "parent_type", text="")
parent = ob.parent
if parent and ob.parent_type == 'BONE' and parent.type == 'ARMATURE':
- sub.prop_object(ob, "parent_bone", parent.data, "bones", text="")
+ sub.prop_search(ob, "parent_bone", parent.data, "bones", text="")
sub.active = (parent is not None)
@@ -142,7 +142,7 @@ class OBJECT_PT_groups(ObjectButtonsPanel, bpy.types.Panel):
if ob.name in group.objects:
col = layout.column(align=True)
- col.set_context_pointer("group", group)
+ col.context_pointer_set("group", group)
row = col.box().row()
row.prop(group, "name", text="")
@@ -238,7 +238,7 @@ class OBJECT_PT_duplication(ObjectButtonsPanel, bpy.types.Panel):
class OBJECT_PT_animation(ObjectButtonsPanel, bpy.types.Panel):
bl_label = "Animation Hacks"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
def draw(self, context):
layout = self.layout
@@ -312,7 +312,7 @@ class OBJECT_PT_onion_skinning(OnionSkinButtonsPanel): #, bpy.types.Panel): # in
self.draw_settings(context, ob.animation_visualisation)
-class OBJECT_PT_custom_props(ObjectButtonsPanel, PropertyPanel, bpy.types.Panel):
+class OBJECT_PT_custom_props(bpy.types.Panel, PropertyPanel, ObjectButtonsPanel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
_context_path = "object"
diff --git a/release/scripts/ui/properties_object_constraint.py b/release/scripts/ui/properties_object_constraint.py
index 8a8142a790f..a2350155ed5 100644
--- a/release/scripts/ui/properties_object_constraint.py
+++ b/release/scripts/ui/properties_object_constraint.py
@@ -59,21 +59,21 @@ class ConstraintButtonsPanel():
if con.target and subtargets:
if con.target.type == 'ARMATURE':
- layout.prop_object(con, "subtarget", con.target.data, "bones", text="Bone")
+ layout.prop_search(con, "subtarget", con.target.data, "bones", text="Bone")
if con.type in ('COPY_LOCATION', 'STRETCH_TO', 'TRACK_TO', 'PIVOT'):
row = layout.row()
row.label(text="Head/Tail:")
row.prop(con, "head_tail", text="")
elif con.target.type in ('MESH', 'LATTICE'):
- layout.prop_object(con, "subtarget", con.target, "vertex_groups", text="Vertex Group")
+ layout.prop_search(con, "subtarget", con.target, "vertex_groups", text="Vertex Group")
def ik_template(self, layout, con):
# only used for iTaSC
layout.prop(con, "pole_target")
if con.pole_target and con.pole_target.type == 'ARMATURE':
- layout.prop_object(con, "pole_subtarget", con.pole_target.data, "bones", text="Bone")
+ layout.prop_search(con, "pole_subtarget", con.pole_target.data, "bones", text="Bone")
if con.pole_target:
row = layout.row()
@@ -147,7 +147,7 @@ class ConstraintButtonsPanel():
layout.prop(con, "pole_target")
if con.pole_target and con.pole_target.type == 'ARMATURE':
- layout.prop_object(con, "pole_subtarget", con.pole_target.data, "bones", text="Bone")
+ layout.prop_search(con, "pole_subtarget", con.pole_target.data, "bones", text="Bone")
if con.pole_target:
row = layout.row()
diff --git a/release/scripts/ui/properties_particle.py b/release/scripts/ui/properties_particle.py
index 27d02ac97cd..8366012c232 100644
--- a/release/scripts/ui/properties_particle.py
+++ b/release/scripts/ui/properties_particle.py
@@ -52,7 +52,7 @@ class ParticleButtonsPanel():
class PARTICLE_PT_context_particles(ParticleButtonsPanel, bpy.types.Panel):
bl_label = ""
- bl_show_header = False
+ bl_options = {'HIDE_HEADER'}
COMPAT_ENGINES = {'BLENDER_RENDER'}
@classmethod
@@ -69,7 +69,7 @@ class PARTICLE_PT_context_particles(ParticleButtonsPanel, bpy.types.Panel):
if ob:
row = layout.row()
- row.template_list(ob, "particle_systems", ob, "active_particle_system_index", rows=2)
+ row.template_list(ob, "particle_systems", ob.particle_systems, "active_index", rows=2)
col = row.column(align=True)
col.operator("object.particle_system_add", icon='ZOOMIN', text="")
@@ -196,7 +196,7 @@ class PARTICLE_PT_emission(ParticleButtonsPanel, bpy.types.Panel):
class PARTICLE_PT_hair_dynamics(ParticleButtonsPanel, bpy.types.Panel):
bl_label = "Hair dynamics"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_RENDER'}
@classmethod
@@ -254,7 +254,7 @@ class PARTICLE_PT_hair_dynamics(ParticleButtonsPanel, bpy.types.Panel):
class PARTICLE_PT_cache(ParticleButtonsPanel, bpy.types.Panel):
bl_label = "Cache"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_RENDER'}
@classmethod
@@ -487,12 +487,12 @@ class PARTICLE_PT_physics(ParticleButtonsPanel, bpy.types.Panel):
col.prop(boids, "air_ave_max", slider=True)
col.prop(boids, "air_personal_space")
row = col.row()
- row.active = (boids.use_land or boids.allow_climb) and boids.allow_flight
+ row.active = (boids.use_land or boids.use_climb) and boids.use_flight
row.prop(boids, "land_smooth")
sub = split.column()
col = sub.column(align=True)
- col.active = boids.use_land or boids.allow_climb
+ col.active = boids.use_land or boids.use_climb
col.prop(boids, "land_speed_max")
col.prop(boids, "land_jump_speed")
col.prop(boids, "land_acc_max", slider=True)
@@ -828,7 +828,7 @@ class PARTICLE_PT_render(ParticleButtonsPanel, bpy.types.Panel):
class PARTICLE_PT_draw(ParticleButtonsPanel, bpy.types.Panel):
bl_label = "Display"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_RENDER'}
@classmethod
@@ -862,6 +862,15 @@ class PARTICLE_PT_draw(ParticleButtonsPanel, bpy.types.Panel):
else:
row.label(text="")
+ if part.draw_percentage != 100:
+ if part.type == 'HAIR':
+ if psys.hair_dynamics and psys.point_cache.is_baked == False:
+ layout.row().label(text="Display percentage makes dynamics inaccurate without baking!")
+ else:
+ phystype = part.physics_type
+ if phystype != 'NO' and phystype != 'KEYED' and psys.point_cache.is_baked == False:
+ layout.row().label(text="Display percentage makes dynamics inaccurate without baking!")
+
row = layout.row()
col = row.column()
col.prop(part, "show_size")
@@ -884,7 +893,7 @@ class PARTICLE_PT_draw(ParticleButtonsPanel, bpy.types.Panel):
class PARTICLE_PT_children(ParticleButtonsPanel, bpy.types.Panel):
bl_label = "Children"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_RENDER'}
@classmethod
@@ -966,7 +975,7 @@ class PARTICLE_PT_children(ParticleButtonsPanel, bpy.types.Panel):
class PARTICLE_PT_field_weights(ParticleButtonsPanel, bpy.types.Panel):
bl_label = "Field Weights"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_RENDER'}
def draw(self, context):
@@ -979,7 +988,7 @@ class PARTICLE_PT_field_weights(ParticleButtonsPanel, bpy.types.Panel):
class PARTICLE_PT_force_fields(ParticleButtonsPanel, bpy.types.Panel):
bl_label = "Force Field Settings"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_RENDER'}
def draw(self, context):
@@ -1007,7 +1016,7 @@ class PARTICLE_PT_force_fields(ParticleButtonsPanel, bpy.types.Panel):
class PARTICLE_PT_vertexgroups(ParticleButtonsPanel, bpy.types.Panel):
bl_label = "Vertexgroups"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_RENDER'}
def draw(self, context):
@@ -1025,52 +1034,53 @@ class PARTICLE_PT_vertexgroups(ParticleButtonsPanel, bpy.types.Panel):
row = layout.row()
- row.prop_object(psys, "vertex_group_density", ob, "vertex_groups", text="Density")
+ row.prop_search(psys, "vertex_group_density", ob, "vertex_groups", text="Density")
row.prop(psys, "invert_vertex_group_density", text="")
- row = layout.row()
- row.prop_object(psys, "vertex_group_velocity", ob, "vertex_groups", text="Velocity")
- row.prop(psys, "invert_vertex_group_velocity", text="")
+ # Commented out vertex groups don't work and are still waiting for better implementation
+ # row = layout.row()
+ # row.prop_search(psys, "vertex_group_velocity", ob, "vertex_groups", text="Velocity")
+ # row.prop(psys, "invert_vertex_group_velocity", text="")
row = layout.row()
- row.prop_object(psys, "vertex_group_length", ob, "vertex_groups", text="Length")
+ row.prop_search(psys, "vertex_group_length", ob, "vertex_groups", text="Length")
row.prop(psys, "invert_vertex_group_length", text="")
row = layout.row()
- row.prop_object(psys, "vertex_group_clump", ob, "vertex_groups", text="Clump")
+ row.prop_search(psys, "vertex_group_clump", ob, "vertex_groups", text="Clump")
row.prop(psys, "invert_vertex_group_clump", text="")
row = layout.row()
- row.prop_object(psys, "vertex_group_kink", ob, "vertex_groups", text="Kink")
+ row.prop_search(psys, "vertex_group_kink", ob, "vertex_groups", text="Kink")
row.prop(psys, "invert_vertex_group_kink", text="")
row = layout.row()
- row.prop_object(psys, "vertex_group_roughness_1", ob, "vertex_groups", text="Roughness 1")
+ row.prop_search(psys, "vertex_group_roughness_1", ob, "vertex_groups", text="Roughness 1")
row.prop(psys, "invert_vertex_group_roughness_1", text="")
row = layout.row()
- row.prop_object(psys, "vertex_group_roughness_2", ob, "vertex_groups", text="Roughness 2")
+ row.prop_search(psys, "vertex_group_roughness_2", ob, "vertex_groups", text="Roughness 2")
row.prop(psys, "invert_vertex_group_roughness_2", text="")
row = layout.row()
- row.prop_object(psys, "vertex_group_roughness_end", ob, "vertex_groups", text="Roughness End")
+ row.prop_search(psys, "vertex_group_roughness_end", ob, "vertex_groups", text="Roughness End")
row.prop(psys, "invert_vertex_group_roughness_end", text="")
- row = layout.row()
- row.prop_object(psys, "vertex_group_size", ob, "vertex_groups", text="Size")
- row.prop(psys, "invert_vertex_group_size", text="")
+ # row = layout.row()
+ # row.prop_search(psys, "vertex_group_size", ob, "vertex_groups", text="Size")
+ # row.prop(psys, "invert_vertex_group_size", text="")
- row = layout.row()
- row.prop_object(psys, "vertex_group_tangent", ob, "vertex_groups", text="Tangent")
- row.prop(psys, "invert_vertex_group_tangent", text="")
+ # row = layout.row()
+ # row.prop_search(psys, "vertex_group_tangent", ob, "vertex_groups", text="Tangent")
+ # row.prop(psys, "invert_vertex_group_tangent", text="")
- row = layout.row()
- row.prop_object(psys, "vertex_group_rotation", ob, "vertex_groups", text="Rotation")
- row.prop(psys, "invert_vertex_group_rotation", text="")
+ # row = layout.row()
+ # row.prop_search(psys, "vertex_group_rotation", ob, "vertex_groups", text="Rotation")
+ # row.prop(psys, "invert_vertex_group_rotation", text="")
- row = layout.row()
- row.prop_object(psys, "vertex_group_field", ob, "vertex_groups", text="Field")
- row.prop(psys, "invert_vertex_group_field", text="")
+ # row = layout.row()
+ # row.prop_search(psys, "vertex_group_field", ob, "vertex_groups", text="Field")
+ # row.prop(psys, "invert_vertex_group_field", text="")
class PARTICLE_PT_custom_props(ParticleButtonsPanel, PropertyPanel, bpy.types.Panel):
diff --git a/release/scripts/ui/properties_physics_cloth.py b/release/scripts/ui/properties_physics_cloth.py
index 30619de5814..2e50babfcfd 100644
--- a/release/scripts/ui/properties_physics_cloth.py
+++ b/release/scripts/ui/properties_physics_cloth.py
@@ -63,7 +63,7 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel, bpy.types.Panel):
if md:
# remove modifier + settings
- split.set_context_pointer("modifier", md)
+ split.context_pointer_set("modifier", md)
split.operator("object.modifier_remove", text="Remove")
row = split.row(align=True)
@@ -105,7 +105,7 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel, bpy.types.Panel):
col.prop(cloth, "use_pin_cloth", text="Pinning")
sub = col.column()
sub.active = cloth.use_pin_cloth
- sub.prop_object(cloth, "mass_vertex_group", ob, "vertex_groups", text="")
+ sub.prop_search(cloth, "vertex_group_mass", ob, "vertex_groups", text="")
sub.prop(cloth, "pin_stiffness", text="Stiffness")
col.label(text="Pre roll:")
@@ -113,7 +113,7 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel, bpy.types.Panel):
# Disabled for now
"""
- if cloth.mass_vertex_group:
+ if cloth.vertex_group_mass:
layout.label(text="Goal:")
col = layout.column_flow()
@@ -126,12 +126,12 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel, bpy.types.Panel):
if key:
col.label(text="Rest Shape Key:")
- col.prop_object(cloth, "rest_shape_key", key, "keys", text="")
+ col.prop_search(cloth, "rest_shape_key", key, "keys", text="")
class PHYSICS_PT_cloth_cache(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Cloth Cache"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
@@ -144,7 +144,7 @@ class PHYSICS_PT_cloth_cache(PhysicButtonsPanel, bpy.types.Panel):
class PHYSICS_PT_cloth_collision(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Cloth Collision"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
@@ -183,7 +183,7 @@ class PHYSICS_PT_cloth_collision(PhysicButtonsPanel, bpy.types.Panel):
class PHYSICS_PT_cloth_stiffness(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Cloth Stiffness Scaling"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
@@ -208,18 +208,18 @@ class PHYSICS_PT_cloth_stiffness(PhysicButtonsPanel, bpy.types.Panel):
col = split.column()
col.label(text="Structural Stiffness:")
- col.prop_object(cloth, "structural_stiffness_vertex_group", ob, "vertex_groups", text="")
+ col.prop_search(cloth, "vertex_group_structural_stiffness", ob, "vertex_groups", text="")
col.prop(cloth, "structural_stiffness_max", text="Max")
col = split.column()
col.label(text="Bending Stiffness:")
- col.prop_object(cloth, "bending_vertex_group", ob, "vertex_groups", text="")
+ col.prop_search(cloth, "vertex_group_bending", ob, "vertex_groups", text="")
col.prop(cloth, "bending_stiffness_max", text="Max")
class PHYSICS_PT_cloth_field_weights(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Cloth Field Weights"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
diff --git a/release/scripts/ui/properties_physics_common.py b/release/scripts/ui/properties_physics_common.py
index fb9f2f981ae..68b93386099 100644
--- a/release/scripts/ui/properties_physics_common.py
+++ b/release/scripts/ui/properties_physics_common.py
@@ -26,10 +26,10 @@ import bpy
def point_cache_ui(self, context, cache, enabled, cachetype):
layout = self.layout
- layout.set_context_pointer("point_cache", cache)
+ layout.context_pointer_set("point_cache", cache)
row = layout.row()
- row.template_list(cache, "point_caches", cache, "active_point_cache_index", rows=2)
+ row.template_list(cache, "point_caches", cache.point_caches, "active_index", rows=2)
col = row.column(align=True)
col.operator("ptcache.add", icon='ZOOMIN', text="")
col.operator("ptcache.remove", icon='ZOOMOUT', text="")
diff --git a/release/scripts/ui/properties_physics_field.py b/release/scripts/ui/properties_physics_field.py
index 80ea999eedb..a72103f5132 100644
--- a/release/scripts/ui/properties_physics_field.py
+++ b/release/scripts/ui/properties_physics_field.py
@@ -158,7 +158,7 @@ class PHYSICS_PT_field(PhysicButtonsPanel, bpy.types.Panel):
class PHYSICS_PT_collision(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Collision"
- #bl_default_closed = True
+ #bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
@@ -175,7 +175,7 @@ class PHYSICS_PT_collision(PhysicButtonsPanel, bpy.types.Panel):
if md:
# remove modifier + settings
- split.set_context_pointer("modifier", md)
+ split.context_pointer_set("modifier", md)
split.operator("object.modifier_remove", text="Remove")
col = split.column()
diff --git a/release/scripts/ui/properties_physics_fluid.py b/release/scripts/ui/properties_physics_fluid.py
index 035eefe6c2a..dcdb2de8b52 100644
--- a/release/scripts/ui/properties_physics_fluid.py
+++ b/release/scripts/ui/properties_physics_fluid.py
@@ -44,7 +44,7 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel, bpy.types.Panel):
if md:
# remove modifier + settings
- split.set_context_pointer("modifier", md)
+ split.context_pointer_set("modifier", md)
split.operator("object.modifier_remove", text="Remove")
row = split.row(align=True)
@@ -58,10 +58,8 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel, bpy.types.Panel):
split.operator("object.modifier_add", text="Add").type = 'FLUID_SIMULATION'
split.label()
- fluid = None
-
- if fluid:
+ if md:
row = layout.row()
row.prop(fluid, "type")
if fluid.type not in ('NONE', 'DOMAIN', 'PARTICLE'):
@@ -72,7 +70,7 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel, bpy.types.Panel):
layout.active = fluid.use
if fluid.type == 'DOMAIN':
- layout.operator("fluid.bake", text="Bake Fluid Simulation", icon='MOD_FLUIDSIM')
+ layout.operator("fluid.bake", text="Bake (Req. Memory: %s)" % fluid.memory_estimate, icon='MOD_FLUIDSIM')
split = layout.split()
col = split.column()
@@ -82,7 +80,7 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel, bpy.types.Panel):
col.prop(fluid, "render_display_mode", text="")
col = split.column()
- col.label(text="Required Memory: " + fluid.memory_estimate)
+ col.label()
col.prop(fluid, "preview_resolution", text="Preview")
col.label(text="Viewport Display:")
col.prop(fluid, "viewport_display_mode", text="")
@@ -201,7 +199,7 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel, bpy.types.Panel):
class PHYSICS_PT_domain_gravity(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Domain World"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
@@ -251,7 +249,7 @@ class PHYSICS_PT_domain_gravity(PhysicButtonsPanel, bpy.types.Panel):
class PHYSICS_PT_domain_boundary(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Domain Boundary"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
@@ -279,7 +277,7 @@ class PHYSICS_PT_domain_boundary(PhysicButtonsPanel, bpy.types.Panel):
class PHYSICS_PT_domain_particles(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Domain Particles"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
diff --git a/release/scripts/ui/properties_physics_smoke.py b/release/scripts/ui/properties_physics_smoke.py
index d2e37ef29fb..1db6785f36f 100644
--- a/release/scripts/ui/properties_physics_smoke.py
+++ b/release/scripts/ui/properties_physics_smoke.py
@@ -49,7 +49,7 @@ class PHYSICS_PT_smoke(PhysicButtonsPanel, bpy.types.Panel):
if md:
# remove modifier + settings
- split.set_context_pointer("modifier", md)
+ split.context_pointer_set("modifier", md)
split.operator("object.modifier_remove", text="Remove")
row = split.row(align=True)
@@ -97,10 +97,10 @@ class PHYSICS_PT_smoke(PhysicButtonsPanel, bpy.types.Panel):
col = split.column()
col.prop(flow, "use_outflow")
col.label(text="Particle System:")
- col.prop_object(flow, "psys", ob, "particle_systems", text="")
+ col.prop_search(flow, "particle_system", ob, "particle_systems", text="")
sub = col.column()
- sub.active = not md.flow_settings.outflow
+ sub.active = not md.flow_settings.use_outflow
sub.prop(flow, "initial_velocity", text="Initial Velocity")
sub = sub.column()
@@ -109,7 +109,7 @@ class PHYSICS_PT_smoke(PhysicButtonsPanel, bpy.types.Panel):
sub = split.column()
- sub.active = not md.flow_settings.outflow
+ sub.active = not md.flow_settings.use_outflow
sub.label(text="Behavior:")
sub.prop(flow, "temperature")
sub.prop(flow, "density")
@@ -121,7 +121,7 @@ class PHYSICS_PT_smoke(PhysicButtonsPanel, bpy.types.Panel):
class PHYSICS_PT_smoke_groups(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Smoke Groups"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
@@ -149,7 +149,7 @@ class PHYSICS_PT_smoke_groups(PhysicButtonsPanel, bpy.types.Panel):
class PHYSICS_PT_smoke_cache(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Smoke Cache"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
@@ -170,7 +170,7 @@ class PHYSICS_PT_smoke_cache(PhysicButtonsPanel, bpy.types.Panel):
class PHYSICS_PT_smoke_highres(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Smoke High Resolution"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
@@ -205,7 +205,7 @@ class PHYSICS_PT_smoke_highres(PhysicButtonsPanel, bpy.types.Panel):
class PHYSICS_PT_smoke_cache_highres(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Smoke High Resolution Cache"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
@@ -226,7 +226,7 @@ class PHYSICS_PT_smoke_cache_highres(PhysicButtonsPanel, bpy.types.Panel):
class PHYSICS_PT_smoke_field_weights(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Smoke Field Weights"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
diff --git a/release/scripts/ui/properties_physics_softbody.py b/release/scripts/ui/properties_physics_softbody.py
index 3722182caa1..08abf048c50 100644
--- a/release/scripts/ui/properties_physics_softbody.py
+++ b/release/scripts/ui/properties_physics_softbody.py
@@ -55,7 +55,7 @@ class PHYSICS_PT_softbody(PhysicButtonsPanel, bpy.types.Panel):
if md:
# remove modifier + settings
- split.set_context_pointer("modifier", md)
+ split.context_pointer_set("modifier", md)
split.operator("object.modifier_remove", text="Remove")
row = split.row(align=True)
@@ -77,7 +77,7 @@ class PHYSICS_PT_softbody(PhysicButtonsPanel, bpy.types.Panel):
col.label(text="Object:")
col.prop(softbody, "friction")
col.prop(softbody, "mass")
- col.prop_object(softbody, "mass_vertex_group", ob, "vertex_groups", text="Mass:")
+ col.prop_search(softbody, "vertex_group_mass", ob, "vertex_groups", text="Mass:")
col = split.column()
col.label(text="Simulation:")
@@ -86,7 +86,7 @@ class PHYSICS_PT_softbody(PhysicButtonsPanel, bpy.types.Panel):
class PHYSICS_PT_softbody_cache(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Soft Body Cache"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
@@ -99,7 +99,7 @@ class PHYSICS_PT_softbody_cache(PhysicButtonsPanel, bpy.types.Panel):
class PHYSICS_PT_softbody_goal(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Soft Body Goal"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
@@ -137,12 +137,12 @@ class PHYSICS_PT_softbody_goal(PhysicButtonsPanel, bpy.types.Panel):
col.prop(softbody, "goal_spring", text="Stiffness")
col.prop(softbody, "goal_friction", text="Damping")
- layout.prop_object(softbody, "goal_vertex_group", ob, "vertex_groups", text="Vertex Group")
+ layout.prop_search(softbody, "vertex_group_goal", ob, "vertex_groups", text="Vertex Group")
class PHYSICS_PT_softbody_edge(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Soft Body Edges"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
@@ -173,7 +173,7 @@ class PHYSICS_PT_softbody_edge(PhysicButtonsPanel, bpy.types.Panel):
col.prop(softbody, "plastic")
col.prop(softbody, "bend")
col.prop(softbody, "spring_length", text="Length")
- col.prop_object(softbody, "spring_vertex_group", ob, "vertex_groups", text="Springs:")
+ col.prop_search(softbody, "vertex_group_spring", ob, "vertex_groups", text="Springs:")
col = split.column()
col.prop(softbody, "use_stiff_quads")
@@ -196,7 +196,7 @@ class PHYSICS_PT_softbody_edge(PhysicButtonsPanel, bpy.types.Panel):
class PHYSICS_PT_softbody_collision(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Soft Body Self Collision"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
@@ -228,7 +228,7 @@ class PHYSICS_PT_softbody_collision(PhysicButtonsPanel, bpy.types.Panel):
class PHYSICS_PT_softbody_solver(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Soft Body Solver"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
@@ -264,7 +264,7 @@ class PHYSICS_PT_softbody_solver(PhysicButtonsPanel, bpy.types.Panel):
class PHYSICS_PT_softbody_field_weights(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Soft Body Field Weights"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
diff --git a/release/scripts/ui/properties_render.py b/release/scripts/ui/properties_render.py
index 2072aa00b76..aef95056391 100644
--- a/release/scripts/ui/properties_render.py
+++ b/release/scripts/ui/properties_render.py
@@ -68,7 +68,7 @@ class RENDER_PT_render(RenderButtonsPanel, bpy.types.Panel):
class RENDER_PT_layers(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Layers"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_RENDER'}
def draw(self, context):
@@ -78,13 +78,13 @@ class RENDER_PT_layers(RenderButtonsPanel, bpy.types.Panel):
rd = scene.render
row = layout.row()
- row.template_list(rd, "layers", rd, "active_layer_index", rows=2)
+ row.template_list(rd, "layers", rd.layers, "active_index", rows=2)
col = row.column(align=True)
col.operator("scene.render_layer_add", icon='ZOOMIN', text="")
col.operator("scene.render_layer_remove", icon='ZOOMOUT', text="")
- rl = rd.layers[rd.active_layer_index]
+ rl = rd.layers.active
if rl:
layout.prop(rl, "name")
@@ -194,7 +194,7 @@ class RENDER_PT_shading(RenderButtonsPanel, bpy.types.Panel):
class RENDER_PT_performance(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Performance"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_RENDER'}
def draw(self, context):
@@ -236,7 +236,7 @@ class RENDER_PT_performance(RenderButtonsPanel, bpy.types.Panel):
class RENDER_PT_post_processing(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Post Processing"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_RENDER'}
def draw(self, context):
@@ -389,7 +389,7 @@ class RENDER_PT_output(RenderButtonsPanel, bpy.types.Panel):
class RENDER_PT_encoding(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Encoding"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_RENDER'}
@classmethod
@@ -485,7 +485,7 @@ class RENDER_PT_antialiasing(RenderButtonsPanel, bpy.types.Panel):
class RENDER_PT_motion_blur(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Full Sample Motion Blur"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_RENDER'}
def draw_header(self, context):
@@ -550,7 +550,7 @@ class RENDER_PT_dimensions(RenderButtonsPanel, bpy.types.Panel):
class RENDER_PT_stamp(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Stamp"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_RENDER'}
def draw_header(self, context):
@@ -594,7 +594,7 @@ class RENDER_PT_stamp(RenderButtonsPanel, bpy.types.Panel):
class RENDER_PT_bake(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Bake"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_RENDER'}
def draw(self, context):
diff --git a/release/scripts/ui/properties_scene.py b/release/scripts/ui/properties_scene.py
index c6b9d7522e0..c8c76904829 100644
--- a/release/scripts/ui/properties_scene.py
+++ b/release/scripts/ui/properties_scene.py
@@ -76,13 +76,13 @@ class SCENE_PT_keying_sets(SceneButtonsPanel, bpy.types.Panel):
row = layout.row()
col = row.column()
- col.template_list(scene, "keying_sets", scene, "active_keying_set_index", rows=2)
+ col.template_list(scene, "keying_sets", scene.keying_sets, "active_index", rows=2)
col = row.column(align=True)
col.operator("anim.keying_set_add", icon='ZOOMIN', text="")
col.operator("anim.keying_set_remove", icon='ZOOMOUT', text="")
- ks = scene.active_keying_set
+ ks = scene.keying_sets.active
if ks and ks.is_path_absolute:
row = layout.row()
@@ -106,13 +106,14 @@ class SCENE_PT_keying_set_paths(SceneButtonsPanel, bpy.types.Panel):
@classmethod
def poll(cls, context):
- return (context.scene.active_keying_set and context.scene.active_keying_set.is_path_absolute)
+ ks = context.scene.keying_sets.active
+ return (ks and ks.is_path_absolute)
def draw(self, context):
layout = self.layout
scene = context.scene
- ks = scene.active_keying_set
+ ks = scene.keying_sets.active
row = layout.row()
row.label(text="Paths:")
@@ -120,13 +121,13 @@ class SCENE_PT_keying_set_paths(SceneButtonsPanel, bpy.types.Panel):
row = layout.row()
col = row.column()
- col.template_list(ks, "paths", ks, "active_path_index", rows=2)
+ col.template_list(ks, "paths", ks.paths, "active_index", rows=2)
col = row.column(align=True)
col.operator("anim.keying_set_path_add", icon='ZOOMIN', text="")
col.operator("anim.keying_set_path_remove", icon='ZOOMOUT', text="")
- ksp = ks.active_path
+ ksp = ks.paths.active
if ksp:
col = layout.column()
col.label(text="Target:")
@@ -227,7 +228,7 @@ class ANIM_OT_keying_set_export(bpy.types.Operator):
raise Exception("Could not open file.")
scene = context.scene
- ks = scene.active_keying_set
+ ks = scene.keying_sets.active
f.write("# Keying Set: %s\n" % ks.name)
@@ -237,7 +238,7 @@ class ANIM_OT_keying_set_export(bpy.types.Operator):
# Add KeyingSet and set general settings
f.write("# Keying Set Level declarations\n")
- f.write("ks= scene.add_keying_set(name=\"%s\")\n" % ks.name)
+ f.write("ks= scene.keying_sets.new(name=\"%s\")\n" % ks.name)
if not ks.is_path_absolute:
f.write("ks.is_path_absolute = False\n")
@@ -313,7 +314,7 @@ class ANIM_OT_keying_set_export(bpy.types.Operator):
return {'FINISHED'}
def invoke(self, context, event):
- wm = context.manager
+ wm = context.window_manager
wm.add_fileselect(self)
return {'RUNNING_MODAL'}
diff --git a/release/scripts/ui/properties_texture.py b/release/scripts/ui/properties_texture.py
index 5163ae884ed..d6d5a806a9c 100644
--- a/release/scripts/ui/properties_texture.py
+++ b/release/scripts/ui/properties_texture.py
@@ -76,7 +76,7 @@ class TextureButtonsPanel():
class TEXTURE_PT_context_texture(TextureButtonsPanel, bpy.types.Panel):
bl_label = ""
- bl_show_header = False
+ bl_options = {'HIDE_HEADER'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@classmethod
@@ -157,7 +157,7 @@ class TEXTURE_PT_preview(TextureButtonsPanel, bpy.types.Panel):
class TEXTURE_PT_colors(TextureButtonsPanel, bpy.types.Panel):
bl_label = "Colors"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
def draw(self, context):
@@ -243,7 +243,7 @@ class TEXTURE_PT_mapping(TextureSlotPanel, bpy.types.Panel):
split.label(text="Layer:")
ob = context.object
if ob and ob.type == 'MESH':
- split.prop_object(tex, "uv_layer", ob.data, "uv_textures", text="")
+ split.prop_search(tex, "uv_layer", ob.data, "uv_textures", text="")
else:
split.prop(tex, "uv_layer", text="")
@@ -362,8 +362,8 @@ class TEXTURE_PT_influence(TextureSlotPanel, bpy.types.Panel):
col = split.column()
factor_but(col, tex.use_map_density, "use_map_density", "density_factor", "Density")
factor_but(col, tex.use_map_emission, "use_map_emission", "emission_factor", "Emission")
- factor_but(col, tex.use_map_scatter, "use_map_scattering", "scattering_factor", "Scattering")
- factor_but(col, tex.use_map_reflect, "use_map_reflection", "reflection_factor", "Reflection")
+ factor_but(col, tex.use_map_scatter, "use_map_scatter", "scattering_factor", "Scattering")
+ factor_but(col, tex.use_map_reflect, "use_map_reflect", "reflection_factor", "Reflection")
col = split.column()
col.label(text=" ")
@@ -592,7 +592,7 @@ def texture_filter_common(tex, layout):
class TEXTURE_PT_image_sampling(TextureTypePanel, bpy.types.Panel):
bl_label = "Image Sampling"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
tex_type = 'IMAGE'
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@@ -630,7 +630,7 @@ class TEXTURE_PT_image_sampling(TextureTypePanel, bpy.types.Panel):
class TEXTURE_PT_image_mapping(TextureTypePanel, bpy.types.Panel):
bl_label = "Image Mapping"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
tex_type = 'IMAGE'
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@@ -721,7 +721,7 @@ class TEXTURE_PT_envmap(TextureTypePanel, bpy.types.Panel):
class TEXTURE_PT_envmap_sampling(TextureTypePanel, bpy.types.Panel):
bl_label = "Environment Map Sampling"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
tex_type = 'ENVIRONMENT_MAP'
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@@ -904,7 +904,7 @@ class TEXTURE_PT_pointdensity(TextureButtonsPanel, bpy.types.Panel):
sub.enabled = bool(pd.object)
if pd.object:
sub.label(text="System:")
- sub.prop_object(pd, "particle_system", pd.object, "particle_systems", text="")
+ sub.prop_search(pd, "particle_system", pd.object, "particle_systems", text="")
sub.label(text="Cache:")
sub.prop(pd, "particle_cache_space", text="")
else:
diff --git a/release/scripts/ui/properties_world.py b/release/scripts/ui/properties_world.py
index a42516a63b4..50192744e84 100644
--- a/release/scripts/ui/properties_world.py
+++ b/release/scripts/ui/properties_world.py
@@ -36,7 +36,7 @@ class WorldButtonsPanel():
class WORLD_PT_context_world(WorldButtonsPanel, bpy.types.Panel):
bl_label = ""
- bl_show_header = False
+ bl_options = {'HIDE_HEADER'}
COMPAT_ENGINES = {'BLENDER_RENDER'}
@classmethod
@@ -51,12 +51,16 @@ class WORLD_PT_context_world(WorldButtonsPanel, bpy.types.Panel):
world = context.world
space = context.space_data
+ texture_count = len(world.texture_slots.keys())
+
split = layout.split(percentage=0.65)
if scene:
split.template_ID(scene, "world", new="world.new")
elif world:
split.template_ID(space, "pin_id")
+ if texture_count != 0:
+ split.label(text=str(texture_count), icon='TEXTURE')
class WORLD_PT_preview(WorldButtonsPanel, bpy.types.Panel):
bl_label = "Preview"
@@ -204,7 +208,7 @@ class WORLD_PT_gather(WorldButtonsPanel, bpy.types.Panel):
class WORLD_PT_mist(WorldButtonsPanel, bpy.types.Panel):
bl_label = "Mist"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_RENDER'}
def draw_header(self, context):
@@ -233,7 +237,7 @@ class WORLD_PT_mist(WorldButtonsPanel, bpy.types.Panel):
class WORLD_PT_stars(WorldButtonsPanel, bpy.types.Panel):
bl_label = "Stars"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_RENDER'}
def draw_header(self, context):
diff --git a/release/scripts/ui/space_dopesheet.py b/release/scripts/ui/space_dopesheet.py
index 110ddd9606b..d4d613e05b9 100644
--- a/release/scripts/ui/space_dopesheet.py
+++ b/release/scripts/ui/space_dopesheet.py
@@ -21,6 +21,53 @@
import bpy
+def dopesheet_filter(layout, context):
+ dopesheet = context.space_data.dopesheet
+ is_nla = context.area.type == 'NLA_EDITOR'
+
+ row = layout.row(align=True)
+ row.prop(dopesheet, "show_only_selected", text="")
+ row.prop(dopesheet, "show_hidden", text="")
+
+ row = layout.row(align=True)
+ row.prop(dopesheet, "show_transforms", text="")
+
+ if is_nla:
+ row.prop(dopesheet, "show_missing_nla", text="")
+
+ row = layout.row(align=True)
+ row.prop(dopesheet, "show_scenes", text="")
+ row.prop(dopesheet, "show_worlds", text="")
+ row.prop(dopesheet, "show_nodes", text="")
+
+ if bpy.data.meshes:
+ row.prop(dopesheet, "show_meshes", text="")
+ if bpy.data.shape_keys:
+ row.prop(dopesheet, "show_shapekeys", text="")
+ if bpy.data.materials:
+ row.prop(dopesheet, "show_materials", text="")
+ if bpy.data.lamps:
+ row.prop(dopesheet, "show_lamps", text="")
+ if bpy.data.textures:
+ row.prop(dopesheet, "show_textures", text="")
+ if bpy.data.cameras:
+ row.prop(dopesheet, "show_cameras", text="")
+ if bpy.data.curves:
+ row.prop(dopesheet, "show_curves", text="")
+ if bpy.data.metaballs:
+ row.prop(dopesheet, "show_metaballs", text="")
+ if bpy.data.armatures:
+ row.prop(dopesheet, "show_armatures", text="")
+ if bpy.data.particles:
+ row.prop(dopesheet, "show_particles", text="")
+
+ if bpy.data.groups:
+ row = layout.row(align=True)
+ row.prop(dopesheet, "show_only_group_objects", text="")
+ if dopesheet.show_only_group_objects:
+ row.prop(dopesheet, "filter_group", text="")
+
+
class DOPESHEET_HT_header(bpy.types.Header):
bl_space_type = 'DOPESHEET_EDITOR'
@@ -51,7 +98,8 @@ class DOPESHEET_HT_header(bpy.types.Header):
layout.prop(st.dopesheet, "show_summary", text="Summary")
if st.mode == 'DOPESHEET':
- layout.template_dopesheet_filter(st.dopesheet)
+ dopesheet_filter(layout, context)
+
elif st.mode == 'ACTION':
layout.template_ID(st, "action", new="action.new")
diff --git a/release/scripts/ui/space_filebrowser.py b/release/scripts/ui/space_filebrowser.py
index cb95ac87eef..7f335caf708 100644
--- a/release/scripts/ui/space_filebrowser.py
+++ b/release/scripts/ui/space_filebrowser.py
@@ -27,7 +27,6 @@ class FILEBROWSER_HT_header(bpy.types.Header):
layout = self.layout
st = context.space_data
- params = st.params
layout.template_header(menus=False)
@@ -46,10 +45,14 @@ class FILEBROWSER_HT_header(bpy.types.Header):
row = layout.row(align=True)
row.operator("file.directory_new", text="", icon='NEWFOLDER')
+ params = st.params
+
+ # can be None when save/reload with a file selector open
+ if params:
layout.prop(params, "display_type", expand=True, text="")
layout.prop(params, "sort_method", expand=True, text="")
- layout.prop(params, "show_hidden", text="Hide Invisible")
+ layout.prop(params, "show_hidden")
layout.prop(params, "use_filter", text="", icon='FILTER')
row = layout.row(align=True)
diff --git a/release/scripts/ui/space_graph.py b/release/scripts/ui/space_graph.py
index e5ba894f8ad..9b08da801c9 100644
--- a/release/scripts/ui/space_graph.py
+++ b/release/scripts/ui/space_graph.py
@@ -25,6 +25,8 @@ class GRAPH_HT_header(bpy.types.Header):
bl_space_type = 'GRAPH_EDITOR'
def draw(self, context):
+ from space_dopesheet import dopesheet_filter
+
layout = self.layout
st = context.space_data
@@ -42,7 +44,7 @@ class GRAPH_HT_header(bpy.types.Header):
layout.prop(st, "mode", text="")
- layout.template_dopesheet_filter(st.dopesheet)
+ dopesheet_filter(layout, context)
layout.prop(st, "auto_snap", text="")
layout.prop(st, "pivot_point", text="", icon_only=True)
diff --git a/release/scripts/ui/space_image.py b/release/scripts/ui/space_image.py
index 11324b59b3b..bd59aaa42fa 100644
--- a/release/scripts/ui/space_image.py
+++ b/release/scripts/ui/space_image.py
@@ -316,7 +316,7 @@ class IMAGE_HT_header(bpy.types.Header):
row.prop(toolsettings, "snap_element", text="", icon_only=True)
# mesh = context.edit_object.data
- # row.prop_object(mesh, "active_uv_layer", mesh, "uv_textures")
+ # row.prop_search(mesh.uv_textures, "active", mesh, "uv_textures")
if ima:
# layers
@@ -604,7 +604,7 @@ class IMAGE_PT_paint(bpy.types.Panel):
class IMAGE_PT_tools_brush_texture(BrushButtonsPanel, bpy.types.Panel):
bl_label = "Texture"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
def draw(self, context):
layout = self.layout
@@ -621,7 +621,7 @@ class IMAGE_PT_tools_brush_texture(BrushButtonsPanel, bpy.types.Panel):
class IMAGE_PT_paint_stroke(BrushButtonsPanel, bpy.types.Panel):
bl_label = "Paint Stroke"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
def draw(self, context):
layout = self.layout
@@ -645,7 +645,7 @@ class IMAGE_PT_paint_stroke(BrushButtonsPanel, bpy.types.Panel):
class IMAGE_PT_paint_curve(BrushButtonsPanel, bpy.types.Panel):
bl_label = "Paint Curve"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
def draw(self, context):
layout = self.layout
diff --git a/release/scripts/ui/space_info.py b/release/scripts/ui/space_info.py
index 500e80fe120..8d049e29e98 100644
--- a/release/scripts/ui/space_info.py
+++ b/release/scripts/ui/space_info.py
@@ -26,11 +26,7 @@ class INFO_HT_header(bpy.types.Header):
def draw(self, context):
layout = self.layout
- wm = context.manager
- if wm and wm.operators:
- last_op = wm.operators[-1]
- else:
- last_op = None
+ wm = context.window_manager
window = context.window
scene = context.scene
rd = scene.render
@@ -173,7 +169,7 @@ class INFO_MT_mesh_add(bpy.types.Menu):
layout.operator("mesh.primitive_circle_add", icon='MESH_CIRCLE', text="Circle")
layout.operator("mesh.primitive_uv_sphere_add", icon='MESH_UVSPHERE', text="UV Sphere")
layout.operator("mesh.primitive_ico_sphere_add", icon='MESH_ICOSPHERE', text="Icosphere")
- layout.operator("mesh.primitive_tube_add", icon='MESH_TUBE', text="Tube")
+ layout.operator("mesh.primitive_cylinder_add", icon='MESH_CYLINDER', text="Cylinder")
layout.operator("mesh.primitive_cone_add", icon='MESH_CONE', text="Cone")
layout.separator()
layout.operator("mesh.primitive_grid_add", icon='MESH_GRID', text="Grid")
@@ -204,9 +200,9 @@ class INFO_MT_surface_add(bpy.types.Menu):
layout.operator("surface.primitive_nurbs_surface_curve_add", icon='SURFACE_NCURVE', text="NURBS Curve")
layout.operator("surface.primitive_nurbs_surface_circle_add", icon='SURFACE_NCIRCLE', text="NURBS Circle")
layout.operator("surface.primitive_nurbs_surface_surface_add", icon='SURFACE_NSURFACE', text="NURBS Surface")
- layout.operator("surface.primitive_nurbs_surface_tube_add", icon='SURFACE_NTUBE', text="NURBS Tube")
+ layout.operator("surface.primitive_nurbs_surface_cylinder_add", icon='SURFACE_NCYLINDER', text="NURBS Cylinder")
layout.operator("surface.primitive_nurbs_surface_sphere_add", icon='SURFACE_NSPHERE', text="NURBS Sphere")
- layout.operator("surface.primitive_nurbs_surface_donut_add", icon='SURFACE_NDONUT', text="NURBS Torus")
+ layout.operator("surface.primitive_nurbs_surface_torus_add", icon='SURFACE_NTORUS', text="NURBS Torus")
class INFO_MT_armature_add(bpy.types.Menu):
@@ -320,8 +316,10 @@ class INFO_MT_help(bpy.types.Menu):
layout.separator()
layout.operator("wm.url_open", text="Report a Bug", icon='URL').url = 'http://projects.blender.org/tracker/?atid=498&group_id=9&func=browse'
layout.separator()
- layout.operator("wm.url_open", text="Python API Reference", icon='URL').url = 'http://www.blender.org/documentation/250PythonDoc/contents.html'
- layout.operator("help.operator_cheat_sheet")
+ layout.operator("wm.url_open", text="Python API Reference", icon='URL').url = "http://www.blender.org/documentation/blender_python_api_%s/contents.html" % "_".join(str(v) for v in bpy.app.version)
+ layout.operator("help.operator_cheat_sheet", icon='TEXT')
+ layout.separator()
+ layout.operator("anim.update_data_paths", text="FCurve/Driver 2.54 fix", icon='HELP')
layout.separator()
layout.operator("wm.splash")
diff --git a/release/scripts/ui/space_nla.py b/release/scripts/ui/space_nla.py
index bb979e0573e..3b187d707ec 100644
--- a/release/scripts/ui/space_nla.py
+++ b/release/scripts/ui/space_nla.py
@@ -25,6 +25,8 @@ class NLA_HT_header(bpy.types.Header):
bl_space_type = 'NLA_EDITOR'
def draw(self, context):
+ from space_dopesheet import dopesheet_filter
+
layout = self.layout
st = context.space_data
@@ -40,7 +42,7 @@ class NLA_HT_header(bpy.types.Header):
sub.menu("NLA_MT_edit")
sub.menu("NLA_MT_add")
- layout.template_dopesheet_filter(st.dopesheet)
+ dopesheet_filter(layout, context)
layout.prop(st, "auto_snap", text="")
diff --git a/release/scripts/ui/space_outliner.py b/release/scripts/ui/space_outliner.py
index e170dc0322c..38e749c4a75 100644
--- a/release/scripts/ui/space_outliner.py
+++ b/release/scripts/ui/space_outliner.py
@@ -28,7 +28,7 @@ class OUTLINER_HT_header(bpy.types.Header):
space = context.space_data
scene = context.scene
- ks = context.scene.active_keying_set
+ ks = context.scene.keying_sets.active
row = layout.row(align=True)
row.template_header()
@@ -53,7 +53,7 @@ class OUTLINER_HT_header(bpy.types.Header):
if ks:
row = layout.row(align=False)
- row.prop_object(scene, "active_keying_set", scene, "keying_sets", text="")
+ row.prop_search(scene.keying_sets, "active", scene, "keying_sets", text="")
row = layout.row(align=True)
row.operator("anim.keyframe_insert", text="", icon='KEY_HLT')
diff --git a/release/scripts/ui/space_sequencer.py b/release/scripts/ui/space_sequencer.py
index ec607629757..34100da5772 100644
--- a/release/scripts/ui/space_sequencer.py
+++ b/release/scripts/ui/space_sequencer.py
@@ -743,7 +743,7 @@ class SEQUENCER_PT_proxy(SequencerButtonsPanel, bpy.types.Panel):
flow.prop(strip, "use_proxy_custom_directory")
flow.prop(strip, "use_proxy_custom_file")
if strip.proxy: # TODO - need to add this somehow
- if strip.proxy_custom_directory and not strip.use_proxy_custom_file:
+ if strip.use_proxy_custom_directory and not strip.use_proxy_custom_file:
flow.prop(strip.proxy, "directory")
if strip.use_proxy_custom_file:
flow.prop(strip.proxy, "filepath")
diff --git a/release/scripts/ui/space_time.py b/release/scripts/ui/space_time.py
index cfd8401b46b..168e6f63c55 100644
--- a/release/scripts/ui/space_time.py
+++ b/release/scripts/ui/space_time.py
@@ -77,7 +77,7 @@ class TIME_HT_header(bpy.types.Header):
layout.separator()
row = layout.row(align=True)
- row.prop_object(scene, "active_keying_set", scene, "keying_sets_all", text="")
+ row.prop_search(scene.keying_sets_all, "active", scene, "keying_sets_all", text="")
row.operator("anim.keyframe_insert", text="", icon='KEY_HLT')
row.operator("anim.keyframe_delete", text="", icon='KEY_DEHLT')
diff --git a/release/scripts/ui/space_userpref.py b/release/scripts/ui/space_userpref.py
index feeae5d3f9b..4870c789aee 100644
--- a/release/scripts/ui/space_userpref.py
+++ b/release/scripts/ui/space_userpref.py
@@ -100,7 +100,7 @@ class USERPREF_PT_tabs(bpy.types.Panel):
bl_label = ""
bl_space_type = 'USER_PREFERENCES'
bl_region_type = 'WINDOW'
- bl_show_header = False
+ bl_options = {'HIDE_HEADER'}
def draw(self, context):
layout = self.layout
@@ -134,7 +134,7 @@ class USERPREF_PT_interface(bpy.types.Panel):
bl_space_type = 'USER_PREFERENCES'
bl_label = "Interface"
bl_region_type = 'WINDOW'
- bl_show_header = False
+ bl_options = {'HIDE_HEADER'}
@classmethod
def poll(cls, context):
@@ -229,7 +229,7 @@ class USERPREF_PT_edit(bpy.types.Panel):
bl_space_type = 'USER_PREFERENCES'
bl_label = "Edit"
bl_region_type = 'WINDOW'
- bl_show_header = False
+ bl_options = {'HIDE_HEADER'}
@classmethod
def poll(cls, context):
@@ -344,7 +344,7 @@ class USERPREF_PT_system(bpy.types.Panel):
bl_space_type = 'USER_PREFERENCES'
bl_label = "System"
bl_region_type = 'WINDOW'
- bl_show_header = False
+ bl_options = {'HIDE_HEADER'}
@classmethod
def poll(cls, context):
@@ -369,6 +369,7 @@ class USERPREF_PT_system(bpy.types.Panel):
col.prop(system, "dpi")
col.prop(system, "frame_server_port")
col.prop(system, "scrollback", text="Console Scrollback")
+ col.prop(system, "author", text="Author")
col.prop(system, "use_scripts_auto_execute")
col.prop(system, "use_tabs_as_spaces")
@@ -479,7 +480,7 @@ class USERPREF_PT_theme(bpy.types.Panel):
bl_space_type = 'USER_PREFERENCES'
bl_label = "Themes"
bl_region_type = 'WINDOW'
- bl_show_header = False
+ bl_options = {'HIDE_HEADER'}
@staticmethod
def _theme_generic(split, themedata):
@@ -642,7 +643,7 @@ class USERPREF_PT_file(bpy.types.Panel):
bl_space_type = 'USER_PREFERENCES'
bl_label = "Files"
bl_region_type = 'WINDOW'
- bl_show_header = False
+ bl_options = {'HIDE_HEADER'}
@classmethod
def poll(cls, context):
@@ -788,7 +789,7 @@ class USERPREF_PT_input(InputKeyMapPanel):
#start = time.time()
userpref = context.user_preferences
- wm = context.manager
+ wm = context.window_manager
inputs = userpref.inputs
@@ -807,7 +808,7 @@ class USERPREF_PT_addons(bpy.types.Panel):
bl_space_type = 'USER_PREFERENCES'
bl_label = "Addons"
bl_region_type = 'WINDOW'
- bl_show_header = False
+ bl_options = {'HIDE_HEADER'}
_addons_fake_modules = {}
@@ -972,7 +973,8 @@ class USERPREF_PT_addons(bpy.types.Panel):
rowsub = row.row()
rowsub.active = is_enabled
- rowsub.label(text=info["name"], icon='ERROR' if info["warning"] else 'BLENDER')
+ rowsub.label(text='%s: %s' % (info['category'], info["name"]))
+ if info["warning"]: rowsub.label(icon='ERROR')
if is_enabled:
row.operator("wm.addon_disable", icon='CHECKBOX_HLT', text="", emboss=False).module = module_name
@@ -996,7 +998,7 @@ class USERPREF_PT_addons(bpy.types.Panel):
if info["version"]:
split = colsub.row().split(percentage=0.15)
split.label(text='Version:')
- split.label(text=info["version"])
+ split.label(text='.'.join([str(x) for x in info["version"]]))
if info["warning"]:
split = colsub.row().split(percentage=0.15)
split.label(text="Warning:")
@@ -1037,7 +1039,7 @@ class USERPREF_PT_addons(bpy.types.Panel):
from bpy.props import *
-def addon_info_get(mod, info_basis={"name": "", "author": "", "version": "", "blender": "", "location": "", "description": "", "wiki_url": "", "tracker_url": "", "category": "", "warning": "", "show_expanded": False}):
+def addon_info_get(mod, info_basis={"name": "", "author": "", "version": (), "blender": (), "api": 0, "location": "", "description": "", "wiki_url": "", "tracker_url": "", "category": "", "warning": "", "show_expanded": False}):
addon_info = getattr(mod, "bl_addon_info", {})
# avoid re-initializing
@@ -1181,7 +1183,7 @@ class WM_OT_addon_install(bpy.types.Operator):
self.report({'ERROR'}, "No 'addons' path could be found in " + str(bpy.utils.script_paths()))
return {'CANCELLED'}
- wm = context.manager
+ wm = context.window_manager
wm.add_fileselect(self)
return {'RUNNING_MODAL'}
diff --git a/release/scripts/ui/space_userpref_keymap.py b/release/scripts/ui/space_userpref_keymap.py
index f966f8a7e8b..d77acabd66b 100644
--- a/release/scripts/ui/space_userpref_keymap.py
+++ b/release/scripts/ui/space_userpref_keymap.py
@@ -20,7 +20,6 @@
import bpy
import os
-KM_MOD_PREFIX = "keyconfig_"
KM_HIERARCHY = [
('Window', 'EMPTY', 'WINDOW', []), # file save, window change, exit
@@ -129,7 +128,7 @@ class InputKeyMapPanel(bpy.types.Panel):
bl_space_type = 'USER_PREFERENCES'
bl_label = "Input"
bl_region_type = 'WINDOW'
- bl_show_header = False
+ bl_options = {'HIDE_HEADER'}
def draw_entry(self, display_keymaps, entry, col, level=0):
idname, spaceid, regionid, children = entry
@@ -139,10 +138,10 @@ class InputKeyMapPanel(bpy.types.Panel):
self.draw_km(display_keymaps, kc, km, children, col, level)
'''
- km = kc.find_keymap(idname, space_type=spaceid, region_type=regionid)
+ km = kc.keymaps.find(idname, space_type=spaceid, region_type=regionid)
if not km:
kc = defkc
- km = kc.find_keymap(idname, space_type=spaceid, region_type=regionid)
+ km = kc.keymaps.find(idname, space_type=spaceid, region_type=regionid)
if km:
self.draw_km(kc, km, children, col, level)
@@ -162,7 +161,7 @@ class InputKeyMapPanel(bpy.types.Panel):
def draw_km(self, display_keymaps, kc, km, children, layout, level):
km = km.active()
- layout.set_context_pointer("keymap", km)
+ layout.context_pointer_set("keymap", km)
col = self.indented_layout(layout, level)
@@ -313,17 +312,17 @@ class InputKeyMapPanel(bpy.types.Panel):
# Modal key maps attached to this operator
if not km.is_modal:
- kmm = kc.find_keymap_modal(kmi.idname)
+ kmm = kc.keymaps.find_modal(kmi.idname)
if kmm:
self.draw_km(display_keymaps, kc, kmm, None, layout, level + 1)
- layout.set_context_pointer("keymap", km)
+ layout.context_pointer_set("keymap", km)
- def draw_filtered(self, display_keymaps, filter, layout):
+ def draw_filtered(self, display_keymaps, filter_text, layout):
for km, kc in display_keymaps:
km = km.active()
- layout.set_context_pointer("keymap", km)
+ layout.context_pointer_set("keymap", km)
- filtered_items = [kmi for kmi in km.items if filter in kmi.name.lower()]
+ filtered_items = [kmi for kmi in km.items if filter_text in kmi.name.lower()]
if len(filtered_items) != 0:
col = layout.column()
@@ -353,9 +352,9 @@ class InputKeyMapPanel(bpy.types.Panel):
self.draw_entry(display_keymaps, entry, layout)
def draw_keymaps(self, context, layout):
- wm = context.manager
- kc = wm.active_keyconfig
- defkc = wm.default_keyconfig
+ wm = context.window_manager
+ kc = wm.keyconfigs.active
+ defkc = wm.keyconfigs.default
col = layout.column()
sub = col.column()
@@ -364,8 +363,8 @@ class InputKeyMapPanel(bpy.types.Panel):
subcol = subsplit.column()
row = subcol.row()
- row.prop_object(wm, "active_keyconfig", wm, "keyconfigs", text="Key Config:")
- layout.set_context_pointer("keyconfig", wm.active_keyconfig)
+ row.prop_search(wm.keyconfigs, "active", wm, "keyconfigs", text="Key Config:")
+ layout.context_pointer_set("keyconfig", wm.keyconfigs.active)
row.operator("wm.keyconfig_remove", text="", icon='X')
row.prop(context.space_data, "filter_text", icon="VIEWZOOM")
@@ -375,7 +374,7 @@ class InputKeyMapPanel(bpy.types.Panel):
display_keymaps = _merge_keymaps(kc, defkc)
if context.space_data.filter_text != "":
filter_text = context.space_data.filter_text.lower()
- self.draw_filtered(display_keymaps, filter, col)
+ self.draw_filtered(display_keymaps, filter_text, col)
else:
self.draw_hierarchy(display_keymaps, col)
@@ -387,7 +386,8 @@ def export_properties(prefix, properties, lines=None):
if lines is None:
lines = []
- for value, pname in properties.items():
+ for pname, value in properties.items():
+ print()
if not properties.is_property_hidden(pname):
if isinstance(value, bpy.types.OperatorProperties):
export_properties(prefix + "." + pname, value, lines)
@@ -408,9 +408,9 @@ class WM_OT_keyconfig_test(bpy.types.Operator):
def kmistr(kmi):
if km.is_modal:
- s = ["kmi = km.items.add_modal(\'%s\', \'%s\', \'%s\'" % (kmi.propvalue, kmi.type, kmi.value)]
+ s = ["kmi = km.items.new_modal(\'%s\', \'%s\', \'%s\'" % (kmi.propvalue, kmi.type, kmi.value)]
else:
- s = ["kmi = km.items.add(\'%s\', \'%s\', \'%s\'" % (kmi.idname, kmi.type, kmi.value)]
+ s = ["kmi = km.items.new(\'%s\', \'%s\', \'%s\'" % (kmi.idname, kmi.type, kmi.value)]
if kmi.any:
s.append(", any=True")
@@ -437,7 +437,7 @@ class WM_OT_keyconfig_test(bpy.types.Operator):
idname, spaceid, regionid, children = entry
- km = kc.find_keymap(idname, space_type=spaceid, region_type=regionid)
+ km = kc.keymaps.find(idname, space_type=spaceid, region_type=regionid)
if km:
km = km.active()
@@ -486,8 +486,8 @@ class WM_OT_keyconfig_test(bpy.types.Operator):
return result
def execute(self, context):
- wm = context.manager
- kc = wm.default_keyconfig
+ wm = context.window_manager
+ kc = wm.keyconfigs.default
if self.testConfig(kc):
print("CONFLICT")
@@ -529,8 +529,8 @@ class WM_OT_keyconfig_import(bpy.types.Operator):
config_name = None
for line in f:
- if line.startswith("kc = wm.add_keyconfig("):
- config_name = line[23:-3]
+ if line.startswith("kc = wm.keyconfigs.new("):
+ config_name = line[24:-3]
break
if config_name is None:
@@ -552,23 +552,23 @@ class WM_OT_keyconfig_import(bpy.types.Operator):
shutil.move(self.properties.filepath, path)
# sneaky way to check we're actually running the code.
- wm = context.manager
+ wm = context.window_manager
while config_name in wm.keyconfigs:
- wm.remove_keyconfig(wm.keyconfigs[config_name])
+ wm.keyconfigs.remove(wm.keyconfigs[config_name])
- wm = context.manager
+ wm = context.window_manager
totmap = len(wm.keyconfigs)
mod = __import__(config_name)
if totmap == len(wm.keyconfigs):
reload(mod)
- wm = bpy.context.manager
- wm.active_keyconfig = wm.keyconfigs[config_name]
+ wm = bpy.context.window_manager
+ wm.keyconfigs.active = wm.keyconfigs[config_name]
return {'FINISHED'}
def invoke(self, context, event):
- wm = context.manager
+ wm = context.window_manager
wm.add_fileselect(self)
return {'RUNNING_MODAL'}
@@ -594,8 +594,8 @@ class WM_OT_keyconfig_export(bpy.types.Operator):
if not f:
raise Exception("Could not open file")
- wm = context.manager
- kc = wm.active_keyconfig
+ wm = context.window_manager
+ kc = wm.keyconfigs.active
if self.properties.kc_name != '':
name = self.properties.kc_name
@@ -607,8 +607,8 @@ class WM_OT_keyconfig_export(bpy.types.Operator):
f.write("# Configuration %s\n" % name)
f.write("import bpy\n\n")
- f.write("wm = bpy.context.manager\n")
- f.write("kc = wm.add_keyconfig('%s')\n\n" % name)
+ f.write("wm = bpy.context.window_manager\n")
+ f.write("kc = wm.keyconfigs.new('%s')\n\n" % name)
# Generate a list of keymaps to export:
#
@@ -624,7 +624,7 @@ class WM_OT_keyconfig_export(bpy.types.Operator):
edited_kc = FakeKeyConfig()
edited_kc.keymaps.extend(context.user_preferences.inputs.edited_keymaps)
# merge edited keymaps with non-default keyconfig, if it exists
- if kc != wm.default_keyconfig:
+ if kc != wm.keyconfigs.default:
export_keymaps = _merge_keymaps(edited_kc, kc)
else:
export_keymaps = _merge_keymaps(edited_kc, edited_kc)
@@ -634,12 +634,12 @@ class WM_OT_keyconfig_export(bpy.types.Operator):
km = km.active()
f.write("# Map %s\n" % km.name)
- f.write("km = kc.add_keymap('%s', space_type='%s', region_type='%s', modal=%s)\n\n" % (km.name, km.space_type, km.region_type, km.is_modal))
+ f.write("km = kc.keymaps.new('%s', space_type='%s', region_type='%s', modal=%s)\n\n" % (km.name, km.space_type, km.region_type, km.is_modal))
for kmi in km.items:
if km.is_modal:
- f.write("kmi = km.items.add_modal('%s', '%s', '%s'" % (kmi.propvalue, kmi.type, kmi.value))
+ f.write("kmi = km.items.new_modal('%s', '%s', '%s'" % (kmi.propvalue, kmi.type, kmi.value))
else:
- f.write("kmi = km.items.add('%s', '%s', '%s'" % (kmi.idname, kmi.type, kmi.value))
+ f.write("kmi = km.items.new('%s', '%s', '%s'" % (kmi.idname, kmi.type, kmi.value))
if kmi.any:
f.write(", any=True")
else:
@@ -667,7 +667,7 @@ class WM_OT_keyconfig_export(bpy.types.Operator):
return {'FINISHED'}
def invoke(self, context, event):
- wm = context.manager
+ wm = context.window_manager
wm.add_fileselect(self)
return {'RUNNING_MODAL'}
@@ -678,7 +678,7 @@ class WM_OT_keymap_edit(bpy.types.Operator):
bl_label = "Edit Key Map"
def execute(self, context):
- wm = context.manager
+ wm = context.window_manager
km = context.keymap
km.copy_to_user()
return {'FINISHED'}
@@ -692,10 +692,10 @@ class WM_OT_keymap_restore(bpy.types.Operator):
all = BoolProperty(attr="all", name="All Keymaps", description="Restore all keymaps to default")
def execute(self, context):
- wm = context.manager
+ wm = context.window_manager
if self.properties.all:
- for km in wm.default_keyconfig.keymaps:
+ for km in wm.keyconfigs.default.keymaps:
km.restore_to_default()
else:
km = context.keymap
@@ -712,9 +712,9 @@ class WM_OT_keyitem_restore(bpy.types.Operator):
item_id = IntProperty(attr="item_id", name="Item Identifier", description="Identifier of the item to remove")
def execute(self, context):
- wm = context.manager
+ wm = context.window_manager
km = context.keymap
- kmi = km.item_from_id(self.properties.item_id)
+ kmi = km.items.from_id(self.properties.item_id)
km.restore_item_to_default(kmi)
@@ -727,14 +727,14 @@ class WM_OT_keyitem_add(bpy.types.Operator):
bl_label = "Add Key Map Item"
def execute(self, context):
- wm = context.manager
+ wm = context.window_manager
km = context.keymap
- kc = wm.default_keyconfig
+ kc = wm.keyconfigs.default
if km.is_modal:
- km.items.add_modal("", 'A', 'PRESS') # kmi
+ km.items.new_modal("", 'A', 'PRESS') # kmi
else:
- km.items.add("none", 'A', 'PRESS') # kmi
+ km.items.new("none", 'A', 'PRESS') # kmi
# clear filter and expand keymap so we can see the newly added item
if context.space_data.filter_text != "":
@@ -753,10 +753,10 @@ class WM_OT_keyitem_remove(bpy.types.Operator):
item_id = IntProperty(attr="item_id", name="Item Identifier", description="Identifier of the item to remove")
def execute(self, context):
- wm = context.manager
+ wm = context.window_manager
km = context.keymap
- kmi = km.item_from_id(self.properties.item_id)
- km.remove_item(kmi)
+ kmi = km.items.from_id(self.properties.item_id)
+ km.items.remove(kmi)
return {'FINISHED'}
@@ -767,14 +767,14 @@ class WM_OT_keyconfig_remove(bpy.types.Operator):
@classmethod
def poll(cls, context):
- wm = context.manager
- return wm.active_keyconfig.is_user_defined
+ wm = context.window_manager
+ return wm.keyconfigs.active.is_user_defined
def execute(self, context):
import sys
- wm = context.manager
+ wm = context.window_manager
- keyconfig = wm.active_keyconfig
+ keyconfig = wm.keyconfigs.active
module = sys.modules.get(keyconfig.name)
@@ -788,7 +788,7 @@ class WM_OT_keyconfig_remove(bpy.types.Operator):
if os.path.exists(path):
os.remove(path)
- wm.remove_keyconfig(keyconfig)
+ wm.keyconfigs.remove(keyconfig)
return {'FINISHED'}
def register():
diff --git a/release/scripts/ui/space_view3d.py b/release/scripts/ui/space_view3d.py
index b8b220cad0c..fa2cd753e86 100644
--- a/release/scripts/ui/space_view3d.py
+++ b/release/scripts/ui/space_view3d.py
@@ -966,14 +966,14 @@ class VIEW3D_MT_vertex_group(bpy.types.Menu):
ob = context.active_object
if ob.mode == 'EDIT':
- if ob.vertex_groups and ob.active_vertex_group:
+ if ob.vertex_groups.active:
layout.separator()
layout.operator("object.vertex_group_assign", text="Assign to Active Group")
layout.operator("object.vertex_group_remove_from", text="Remove from Active Group")
layout.operator("object.vertex_group_remove_from", text="Remove from All").all = True
layout.separator()
- if ob.vertex_groups and ob.active_vertex_group:
+ if ob.vertex_groups.active:
layout.operator_menu_enum("object.vertex_group_set_active", "group", text="Set Active Group")
layout.operator("object.vertex_group_remove", text="Remove Active Group")
layout.operator("object.vertex_group_remove", text="Remove All Groups").all = True
@@ -1141,6 +1141,7 @@ class VIEW3D_MT_pose(bpy.types.Menu):
layout.separator()
+ layout.menu("VIEW3D_MT_object_parent")
layout.menu("VIEW3D_MT_pose_ik")
layout.menu("VIEW3D_MT_pose_constraints")
@@ -1957,7 +1958,7 @@ class VIEW3D_PT_view3d_properties(bpy.types.Panel):
col.label(text="Lock to Object:")
col.prop(view, "lock_object", text="")
if view.lock_object and view.lock_object.type == 'ARMATURE':
- col.prop_object(view, "lock_bone", view.lock_object.data, "bones", text="")
+ col.prop_search(view, "lock_bone", view.lock_object.data, "bones", text="")
col = layout.column(align=True)
col.label(text="Clip:")
@@ -2001,7 +2002,7 @@ class VIEW3D_PT_view3d_display(bpy.types.Panel):
bl_space_type = 'VIEW_3D'
bl_region_type = 'UI'
bl_label = "Display"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
@@ -2129,7 +2130,7 @@ class VIEW3D_PT_background_image(bpy.types.Panel):
bl_space_type = 'VIEW_3D'
bl_region_type = 'UI'
bl_label = "Background Images"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
@@ -2179,7 +2180,7 @@ class VIEW3D_PT_transform_orientations(bpy.types.Panel):
bl_space_type = 'VIEW_3D'
bl_region_type = 'UI'
bl_label = "Transform Orientations"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
@@ -2207,7 +2208,7 @@ class VIEW3D_PT_etch_a_ton(bpy.types.Panel):
bl_space_type = 'VIEW_3D'
bl_region_type = 'UI'
bl_label = "Skeleton Sketching"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
@@ -2251,7 +2252,7 @@ class VIEW3D_PT_context_properties(bpy.types.Panel):
bl_space_type = 'VIEW_3D'
bl_region_type = 'UI'
bl_label = "Properties"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
def _active_context_member(context):
obj = context.object
diff --git a/release/scripts/ui/space_view3d_toolbar.py b/release/scripts/ui/space_view3d_toolbar.py
index 9769107a5c9..712f06c8fe3 100644
--- a/release/scripts/ui/space_view3d_toolbar.py
+++ b/release/scripts/ui/space_view3d_toolbar.py
@@ -719,7 +719,7 @@ class VIEW3D_PT_tools_brush(PaintPanel, bpy.types.Panel):
class VIEW3D_PT_tools_brush_texture(PaintPanel, bpy.types.Panel):
bl_label = "Texture"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
@@ -818,7 +818,7 @@ class VIEW3D_PT_tools_brush_texture(PaintPanel, bpy.types.Panel):
class VIEW3D_PT_tools_brush_tool(PaintPanel, bpy.types.Panel):
bl_label = "Tool"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
@@ -854,7 +854,7 @@ class VIEW3D_PT_tools_brush_tool(PaintPanel, bpy.types.Panel):
class VIEW3D_PT_tools_brush_stroke(PaintPanel, bpy.types.Panel):
bl_label = "Stroke"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
@@ -952,7 +952,7 @@ class VIEW3D_PT_tools_brush_stroke(PaintPanel, bpy.types.Panel):
class VIEW3D_PT_tools_brush_curve(PaintPanel, bpy.types.Panel):
bl_label = "Curve"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
@@ -979,7 +979,7 @@ class VIEW3D_PT_tools_brush_curve(PaintPanel, bpy.types.Panel):
class VIEW3D_PT_sculpt_options(PaintPanel, bpy.types.Panel):
bl_label = "Options"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
@@ -1018,7 +1018,7 @@ class VIEW3D_PT_sculpt_options(PaintPanel, bpy.types.Panel):
class VIEW3D_PT_sculpt_symmetry(PaintPanel, bpy.types.Panel):
bl_label = "Symmetry"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
@@ -1053,7 +1053,7 @@ class VIEW3D_PT_sculpt_symmetry(PaintPanel, bpy.types.Panel):
class VIEW3D_PT_tools_brush_appearance(PaintPanel, bpy.types.Panel):
bl_label = "Appearance"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
@@ -1244,7 +1244,7 @@ class VIEW3D_PT_tools_projectpaint(View3DPanel, bpy.types.Panel):
class VIEW3D_PT_imagepaint_options(PaintPanel):
bl_label = "Options"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
@@ -1300,16 +1300,16 @@ class VIEW3D_PT_tools_particlemode(View3DPanel, bpy.types.Panel):
if pe.type == 'PARTICLES':
if ob.particle_systems:
if len(ob.particle_systems) > 1:
- layout.template_list(ob, "particle_systems", ob, "active_particle_system_index", type='ICONS')
+ layout.template_list(ob, "particle_systems", ob.particle_systems, "active_index", type='ICONS')
- ptcache = ob.particle_systems[ob.active_particle_system_index].point_cache
+ ptcache = ob.particle_systems.active.point_cache
else:
for md in ob.modifiers:
if md.type == pe.type:
ptcache = md.point_cache
if ptcache and len(ptcache.point_caches) > 1:
- layout.template_list(ptcache, "point_caches", ptcache, "active_point_cache_index", type='ICONS')
+ layout.template_list(ptcache, "point_caches", ptcache.point_caches, "active_index", type='ICONS')
if not pe.is_editable:
diff --git a/source/blender/blenkernel/BKE_constraint.h b/source/blender/blenkernel/BKE_constraint.h
index 64e9636cae7..d6e0075df1e 100644
--- a/source/blender/blenkernel/BKE_constraint.h
+++ b/source/blender/blenkernel/BKE_constraint.h
@@ -136,7 +136,6 @@ struct bConstraint *add_ob_constraint(struct Object *ob, const char *name, short
struct bConstraint *add_pose_constraint(struct Object *ob, struct bPoseChannel *pchan, const char *name, short type);
int remove_constraint(ListBase *list, struct bConstraint *con);
-int remove_constraint_index(ListBase *list, int index);
void remove_constraints_type(ListBase *list, short type, short last_only);
/* Constraints + Proxies function prototypes */
diff --git a/source/blender/blenkernel/BKE_customdata.h b/source/blender/blenkernel/BKE_customdata.h
index ae38d4b4a41..7e59aa5ac8e 100644
--- a/source/blender/blenkernel/BKE_customdata.h
+++ b/source/blender/blenkernel/BKE_customdata.h
@@ -117,7 +117,7 @@ void *CustomData_add_layer(struct CustomData *data, int type, int alloctype,
void *layer, int totelem);
/*same as above but accepts a name */
void *CustomData_add_layer_named(struct CustomData *data, int type, int alloctype,
- void *layer, int totelem, char *name);
+ void *layer, int totelem, const char *name);
/* frees the active or first data layer with the give type.
* returns 1 on succes, 0 if no layer with the given type is found
diff --git a/source/blender/blenkernel/BKE_fcurve.h b/source/blender/blenkernel/BKE_fcurve.h
index 6de0c55af3b..95e0cfc3a91 100644
--- a/source/blender/blenkernel/BKE_fcurve.h
+++ b/source/blender/blenkernel/BKE_fcurve.h
@@ -161,7 +161,6 @@ struct FModifier *add_fmodifier(ListBase *modifiers, int type);
struct FModifier *copy_fmodifier(struct FModifier *src);
void copy_fmodifiers(ListBase *dst, ListBase *src);
int remove_fmodifier(ListBase *modifiers, struct FModifier *fcm);
-int remove_fmodifier_index(ListBase *modifiers, int index);
void free_fmodifiers(ListBase *modifiers);
struct FModifier *find_active_fmodifier(ListBase *modifiers);
diff --git a/source/blender/blenkernel/BKE_material.h b/source/blender/blenkernel/BKE_material.h
index a220153523e..40d98394a8e 100644
--- a/source/blender/blenkernel/BKE_material.h
+++ b/source/blender/blenkernel/BKE_material.h
@@ -57,6 +57,9 @@ void automatname(struct Material *);
struct Material ***give_matarar(struct Object *ob);
short *give_totcolp(struct Object *ob);
+struct Material ***give_matarar_id(struct ID *id); /* same but for ID's */
+short *give_totcolp_id(struct ID *id);
+
struct Material *give_current_material(struct Object *ob, int act);
struct ID *material_from(struct Object *ob, int act);
void assign_material(struct Object *ob, struct Material *ma, int act);
@@ -67,6 +70,10 @@ int find_material_index(struct Object *ob, struct Material *ma);
int object_add_material_slot(struct Object *ob);
int object_remove_material_slot(struct Object *ob);
+/* rna api */
+void material_append_id(struct ID *id, struct Material *ma);
+struct Material *material_pop_id(struct ID *id, int index);
+
/* rendering */
void init_render_material(struct Material *, int, float *);
diff --git a/source/blender/blenkernel/BKE_mball.h b/source/blender/blenkernel/BKE_mball.h
index 8d7d205e847..7fa4fc1a05e 100644
--- a/source/blender/blenkernel/BKE_mball.h
+++ b/source/blender/blenkernel/BKE_mball.h
@@ -162,6 +162,7 @@ void free_mball(struct MetaBall *mb);
struct MetaBall *add_mball(char *name);
struct MetaBall *copy_mball(struct MetaBall *mb);
void make_local_mball(struct MetaBall *mb);
+struct MetaElem *add_metaball_element(struct MetaBall *mb, const int type);
void tex_space_mball(struct Object *ob);
float *make_orco_mball(struct Object *ob, struct ListBase *dispbase);
void copy_mball_properties(struct Scene *scene, struct Object *active_object);
diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h
index fcef00ae9b3..1416e1280cf 100644
--- a/source/blender/blenkernel/BKE_particle.h
+++ b/source/blender/blenkernel/BKE_particle.h
@@ -253,6 +253,7 @@ ParticleThread *psys_threads_create(struct ParticleSimulationData *sim);
void psys_threads_free(ParticleThread *threads);
void psys_make_billboard(ParticleBillboardData *bb, float xvec[3], float yvec[3], float zvec[3], float center[3]);
+void psys_apply_hair_lattice(struct Scene *scene, struct Object *ob, struct ParticleSystem *psys);
/* particle_system.c */
struct ParticleSystem *psys_get_target_system(struct Object *ob, struct ParticleTarget *pt);
@@ -282,6 +283,8 @@ void psys_mat_hair_to_object(struct Object *ob, struct DerivedMesh *dm, short fr
void psys_mat_hair_to_global(struct Object *ob, struct DerivedMesh *dm, short from, struct ParticleData *pa, float hairmat[][4]);
void psys_mat_hair_to_orco(struct Object *ob, struct DerivedMesh *dm, short from, struct ParticleData *pa, float hairmat[][4]);
+float psys_get_dietime_from_cache(struct PointCache *cache, int index);
+
void psys_free_pdd(struct ParticleSystem *psys);
float *psys_cache_vgroup(struct DerivedMesh *dm, struct ParticleSystem *psys, int vgroup);
diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h
index a9fb45c6e14..0766012b4a5 100644
--- a/source/blender/blenkernel/BKE_sequencer.h
+++ b/source/blender/blenkernel/BKE_sequencer.h
@@ -276,7 +276,7 @@ struct Sequence *sequencer_add_sound_strip(struct bContext *C, ListBase *seqbase
struct Sequence *sequencer_add_movie_strip(struct bContext *C, ListBase *seqbasep, struct SeqLoadInfo *seq_load);
/* view3d draw callback, run when not in background view */
-typedef struct ImBuf *(*SequencerDrawView)(struct Scene *, int, int, int);
+typedef struct ImBuf *(*SequencerDrawView)(struct Scene *, int, int, unsigned int, int);
extern SequencerDrawView sequencer_view3d_cb;
/* copy/paste */
diff --git a/source/blender/blenkernel/BKE_texture.h b/source/blender/blenkernel/BKE_texture.h
index 380672dae04..99bb8db44ed 100644
--- a/source/blender/blenkernel/BKE_texture.h
+++ b/source/blender/blenkernel/BKE_texture.h
@@ -70,6 +70,7 @@ struct Tex *add_texture(const char *name);
void tex_set_type(struct Tex *tex, int type);
void default_mtex(struct MTex *mtex);
struct MTex *add_mtex(void);
+struct MTex *add_mtex_id(struct ID *id, int slot);
struct Tex *copy_texture(struct Tex *tex);
void make_local_texture(struct Tex *tex);
void autotexname(struct Tex *tex);
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c
index 5d8a57f46f5..167ceab23eb 100644
--- a/source/blender/blenkernel/intern/anim.c
+++ b/source/blender/blenkernel/intern/anim.c
@@ -1284,6 +1284,12 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
size = psys_get_child_size(psys, cpa, ctime, 0);
}
+ /* some hair paths might be non-existent so they can't be used for duplication */
+ if(hair &&
+ ((a < totpart && psys->pathcache[a]->steps < 0) ||
+ (a >= totpart && psys->childcache[a-totpart]->steps < 0)))
+ continue;
+
if(part->ren_as==PART_DRAW_GR) {
/* for groups, pick the object based on settings */
if(part->draw&PART_DRAW_RAND_GR)
diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c
index 95e9d419f44..0f2218b8766 100644
--- a/source/blender/blenkernel/intern/blender.c
+++ b/source/blender/blenkernel/intern/blender.c
@@ -231,7 +231,7 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, char *filename)
curscene= bfd->curscene;
if(curscene==NULL) curscene= bfd->main->scene.first;
/* and we enforce curscene to be in current screen */
- curscreen->scene= curscene;
+ if(curscreen) curscreen->scene= curscene; /* can run in bgmode */
/* clear_global will free G.main, here we can still restore pointers */
lib_link_screen_restore(bfd->main, curscreen, curscene);
@@ -460,13 +460,16 @@ static UndoElem *curundo= NULL;
static int read_undosave(bContext *C, UndoElem *uel)
{
- char scestr[FILE_MAXDIR+FILE_MAXFILE];
+ char scestr[FILE_MAXDIR+FILE_MAXFILE]; /* we should eventually just use G.main->name */
+ char mainstr[FILE_MAXDIR+FILE_MAXFILE];
int success=0, fileflags;
/* This is needed so undoing/redoing doesnt crash with threaded previews going */
WM_jobs_stop_all(CTX_wm_manager(C));
strcpy(scestr, G.sce); /* temporal store */
+ strcpy(mainstr, G.main->name); /* temporal store */
+
fileflags= G.fileflags;
G.fileflags |= G_FILE_NO_UI;
@@ -476,7 +479,8 @@ static int read_undosave(bContext *C, UndoElem *uel)
success= BKE_read_file_from_memfile(C, &uel->memfile, NULL);
/* restore */
- strcpy(G.sce, scestr);
+ strcpy(G.sce, scestr); /* restore */
+ strcpy(G.main->name, mainstr); /* restore */
G.fileflags= fileflags;
if(success)
@@ -641,7 +645,11 @@ void BKE_undo_number(bContext *C, int nr)
/* go back to the last occurance of name in stack */
void BKE_undo_name(bContext *C, const char *name)
{
- UndoElem *uel= BLI_findstring(&undobase, name, offsetof(UndoElem, name));
+ UndoElem *uel;
+
+ for(uel= undobase.last; uel; uel= uel->prev)
+ if(strcmp(name, uel->name)==0)
+ break;
if(uel && uel->prev) {
curundo= uel->prev;
diff --git a/source/blender/blenkernel/intern/boids.c b/source/blender/blenkernel/intern/boids.c
index 7ae65d0113a..54ffda6c0a9 100644
--- a/source/blender/blenkernel/intern/boids.c
+++ b/source/blender/blenkernel/intern/boids.c
@@ -910,6 +910,7 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa)
if(bpa->data.health <= 0.0f) {
pa->alive = PARS_DYING;
+ pa->dietime = bbd->cfra;
return;
}
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index dbf32c4224f..fd8bd67e8f4 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -3989,17 +3989,6 @@ int remove_constraint (ListBase *list, bConstraint *con)
return 0;
}
-/* Remove the nth constraint from the given constraint stack */
-int remove_constraint_index (ListBase *list, int index)
-{
- bConstraint *con= BLI_findlink(list, index);
-
- if (con)
- return remove_constraint(list, con);
- else
- return 0;
-}
-
/* Remove all the constraints of the specified type from the given constraint stack */
void remove_constraints_type (ListBase *list, short type, short last_only)
{
diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c
index 24dcb4c5846..7928424e47c 100644
--- a/source/blender/blenkernel/intern/context.c
+++ b/source/blender/blenkernel/intern/context.c
@@ -701,7 +701,7 @@ Main *CTX_data_main(const bContext *C)
{
Main *bmain;
- if(ctx_data_pointer_verify(C, "main", (void*)&bmain))
+ if(ctx_data_pointer_verify(C, "blend_data", (void*)&bmain))
return bmain;
else
return C->data.main;
diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c
index d029573b2e9..b067001cb98 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -1443,7 +1443,7 @@ static CustomDataLayer *customData_add_layer__internal(CustomData *data,
data->layers[index].flag = flag;
data->layers[index].data = newlayerdata;
- if(name) {
+ if(name || (name=typeInfo->defaultname)) {
strcpy(data->layers[index].name, name);
CustomData_set_layer_unique_name(data, index);
}
@@ -1485,7 +1485,7 @@ void *CustomData_add_layer(CustomData *data, int type, int alloctype,
/*same as above but accepts a name*/
void *CustomData_add_layer_named(CustomData *data, int type, int alloctype,
- void *layerdata, int totelem, char *name)
+ void *layerdata, int totelem, const char *name)
{
CustomDataLayer *layer;
diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c
index f054f2e8738..1642fadf33d 100644
--- a/source/blender/blenkernel/intern/fmodifier.c
+++ b/source/blender/blenkernel/intern/fmodifier.c
@@ -1087,13 +1087,6 @@ int remove_fmodifier (ListBase *modifiers, FModifier *fcm)
}
}
-/* Remove and free the nth F-Modifier from the given stack */
-int remove_fmodifier_index (ListBase *modifiers, int index)
-{
- FModifier *fcm= BLI_findlink(modifiers, index);
- return remove_fmodifier(modifiers, fcm);
-}
-
/* Remove all of a given F-Curve's modifiers */
void free_fmodifiers (ListBase *modifiers)
{
diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c
index 39b74be3d40..501de668000 100644
--- a/source/blender/blenkernel/intern/font.c
+++ b/source/blender/blenkernel/intern/font.c
@@ -266,12 +266,10 @@ void free_ttfont(void)
{
struct TmpFont *tf;
- tf= ttfdata.first;
- while(tf) {
- freePackedFile(tf->pf);
+ for(tf= ttfdata.first; tf; tf= tf->next) {
+ if(tf->pf) freePackedFile(tf->pf); /* NULL when the font file can't be found on disk */
tf->pf= NULL;
tf->vfont= NULL;
- tf= tf->next;
}
BLI_freelistN(&ttfdata);
}
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index d2612e90945..0e282aa6449 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -1979,8 +1979,14 @@ static ImBuf *image_get_ibuf_threadsafe(Image *ima, ImageUser *iuser, int *frame
ibuf= image_get_ibuf(ima, 0, frame);
/* XXX temp stuff? */
- if(ima->lastframe != frame)
+ if(ima->lastframe != frame) {
ima->tpageflag |= IMA_TPAGE_REFRESH;
+ if(ibuf) {
+ /* without this the image name only updates
+ * on first load which is quite confusing */
+ BLI_strncpy(ima->name, ibuf->name, sizeof(ima->name));
+ }
+ }
ima->lastframe = frame;
}
else if(ima->type==IMA_TYPE_MULTILAYER) {
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index 26be4114db0..687b212ec2e 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -1185,8 +1185,15 @@ int new_id(ListBase *lb, ID *id, const char *tname)
* easier to assign each time then to check if its needed */
name[sizeof(name)-1]= 0;
- if(name[0] == '\0')
+ if(name[0] == '\0') {
+ /* disallow empty names */
strcpy(name, ID_FALLBACK_NAME);
+ }
+ else {
+ /* disallow non utf8 chars,
+ * the interface checks for this but new ID's based on file names dont */
+ BLI_utf8_invalid_strip(name, strlen(name));
+ }
result = check_for_dupid(lb, id, name);
strcpy(id->name+2, name);
@@ -1377,8 +1384,9 @@ void text_idbutton(struct ID *id, char *text)
text[4]= 0;
}
}
- else
- strcpy(text, "");
+ else {
+ text[0]= '\0';
+}
}
void rename_id(ID *id, char *name)
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index 9774e97f69b..7e52f746ebc 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -434,6 +434,90 @@ short *give_totcolp(Object *ob)
return NULL;
}
+/* same as above but for ID's */
+Material ***give_matarar_id(ID *id)
+{
+ switch(GS(id->name)) {
+ case ID_ME:
+ return &(((Mesh *)id)->mat);
+ break;
+ case ID_CU:
+ return &(((Curve *)id)->mat);
+ break;
+ case ID_MB:
+ return &(((Curve *)id)->mat);
+ break;
+ }
+ return NULL;
+}
+
+short *give_totcolp_id(ID *id)
+{
+ switch(GS(id->name)) {
+ case ID_ME:
+ return &(((Mesh *)id)->totcol);
+ break;
+ case ID_CU:
+ return &(((Curve *)id)->totcol);
+ break;
+ case ID_MB:
+ return &(((Curve *)id)->totcol);
+ break;
+ }
+ return NULL;
+}
+
+void material_append_id(ID *id, Material *ma)
+{
+ Material ***matar;
+ if((matar= give_matarar_id(id))) {
+ short *totcol= give_totcolp_id(id);
+ Material **mat= MEM_callocN(sizeof(void *) * ((*totcol) + 1), "newmatar");
+ if(*totcol) memcpy(mat, *matar, sizeof(void *) * (*totcol));
+ if(*matar) MEM_freeN(*matar);
+
+ *matar= mat;
+ (*matar)[(*totcol)++]= ma;
+
+ id_us_plus((ID *)ma);
+ test_object_materials(id);
+ }
+}
+
+Material *material_pop_id(ID *id, int index)
+{
+ Material *ret= NULL;
+ Material ***matar;
+ if((matar= give_matarar_id(id))) {
+ short *totcol= give_totcolp_id(id);
+ if(index >= 0 && index < (*totcol)) {
+ ret= (*matar)[index];
+ if(*totcol <= 1) {
+ *totcol= 0;
+ MEM_freeN(*matar);
+ *matar= NULL;
+ }
+ else {
+ Material **mat;
+
+ if(index + 1 != (*totcol))
+ memmove((*matar), (*matar) + 1, (*totcol) - (index + 1));
+
+ (*totcol)--;
+
+ mat= MEM_callocN(sizeof(void *) * (*totcol), "newmatar");
+ memcpy(mat, *matar, sizeof(void *) * (*totcol));
+ MEM_freeN(*matar);
+
+ *matar= mat;
+ test_object_materials(id);
+ }
+ }
+ }
+
+ return ret;
+}
+
Material *give_current_material(Object *ob, int act)
{
Material ***matarar, *ma;
@@ -453,7 +537,7 @@ Material *give_current_material(Object *ob, int act)
}
else { /* in data */
- /* check for inconsistancy */
+ /* check for inconsistency */
if(*totcolp < ob->totcol)
ob->totcol= *totcolp;
if(act>ob->totcol) act= ob->totcol;
diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c
index e35d8bce886..e6f38e04d76 100644
--- a/source/blender/blenkernel/intern/mball.c
+++ b/source/blender/blenkernel/intern/mball.c
@@ -176,6 +176,55 @@ void make_local_mball(MetaBall *mb)
}
}
}
+
+/* most simple meta-element adding function
+ * dont do context menipulation here (rna uses) */
+MetaElem *add_metaball_element(MetaBall *mb, const int type)
+{
+ MetaElem *ml= MEM_callocN(sizeof(MetaElem), "metaelem");
+
+ unit_qt(ml->quat);
+
+ ml->rad= 2.0;
+ ml->s= 2.0;
+ ml->flag= MB_SCALE_RAD;
+
+ switch(type) {
+ case MB_BALL:
+ ml->type = MB_BALL;
+ ml->expx= ml->expy= ml->expz= 1.0;
+
+ break;
+ case MB_TUBE:
+ ml->type = MB_TUBE;
+ ml->expx= ml->expy= ml->expz= 1.0;
+
+ break;
+ case MB_PLANE:
+ ml->type = MB_PLANE;
+ ml->expx= ml->expy= ml->expz= 1.0;
+
+ break;
+ case MB_ELIPSOID:
+ ml->type = MB_ELIPSOID;
+ ml->expx= 1.2f;
+ ml->expy= 0.8f;
+ ml->expz= 1.0;
+
+ break;
+ case MB_CUBE:
+ ml->type = MB_CUBE;
+ ml->expx= ml->expy= ml->expz= 1.0;
+
+ break;
+ default:
+ break;
+ }
+
+ BLI_addtail(&mb->elems, ml);
+
+ return ml;
+}
/** Compute bounding box of all MetaElems/MetaBalls.
*
* Bounding box is computed from polygonized surface. Object *ob is
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 2649d95dd88..20c4a8030af 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -2564,7 +2564,7 @@ void object_handle_update(Scene *scene, Object *ob)
while(psys) {
if(psys_check_enabled(ob, psys)) {
/* check use of dupli objects here */
- if(psys->part && psys->part->draw_as == PART_DRAW_REND &&
+ if(psys->part && (psys->part->draw_as == PART_DRAW_REND || G.rendering) &&
((psys->part->ren_as == PART_DRAW_OB && psys->part->dup_ob)
|| (psys->part->ren_as == PART_DRAW_GR && psys->part->dup_group)))
ob->transflag |= OB_DUPLIPARTS;
diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c
index b01f570898e..919a724d1ec 100644
--- a/source/blender/blenkernel/intern/packedFile.c
+++ b/source/blender/blenkernel/intern/packedFile.c
@@ -220,7 +220,7 @@ void packAll(Main *bmain, ReportList *reports)
ima->packedfile = newPackedFile(reports, ima->name);
for(vf=bmain->vfont.first; vf; vf=vf->id.next)
- if(vf->packedfile == NULL && vf->id.lib==NULL)
+ if(vf->packedfile == NULL && vf->id.lib==NULL && strcmp(vf->name, "<builtin>") != 0)
vf->packedfile = newPackedFile(reports, vf->name);
for(sound=bmain->sound.first; sound; sound=sound->id.next)
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index 993eefcb6f9..dbc598071f9 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -710,6 +710,10 @@ void psys_render_set(Object *ob, ParticleSystem *psys, float viewmat[][4], float
data->timeoffset= timeoffset;
psys->renderdata= data;
+
+ /* Hair can and has to be recalculated if everything isn't displayed. */
+ if(psys->part->disp != 100 && psys->part->type == PART_HAIR)
+ psys->recalc |= PSYS_RECALC_RESET;
}
void psys_render_restore(Object *ob, ParticleSystem *psys)
@@ -1118,6 +1122,24 @@ static int get_pointcache_times_for_particle(PointCache *cache, int index, float
return ret == 2;
}
+
+float psys_get_dietime_from_cache(PointCache *cache, int index) {
+ PTCacheMem *pm;
+ int dietime = 10000000; /* some max value so that we can default to pa->time+lifetime */
+
+ for(pm=cache->mem_cache.last; pm; pm=pm->prev) {
+ if(pm->index_array) {
+ if(pm->index_array[index])
+ return (float)pm->frame;
+ }
+ else {
+ return (float)pm->frame;
+ }
+ }
+
+ return (float)dietime;
+}
+
static void init_particle_interpolation(Object *ob, ParticleSystem *psys, ParticleData *pa, ParticleInterpolationData *pind)
{
@@ -2010,6 +2032,10 @@ void precalc_guides(ParticleSimulationData *sim, ListBase *effectors)
LOOP_PARTICLES {
psys_particle_on_emitter(sim->psmd,sim->psys->part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,state.co,0,0,0,0,0);
+
+ mul_m4_v3(sim->ob->obmat, state.co);
+ mul_mat3_m4_v3(sim->ob->obmat, state.vel);
+
pd_point_from_particle(sim, pa, &state, &point);
for(eff = effectors->first; eff; eff=eff->next) {
@@ -3165,7 +3191,7 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf
/* at the moment this is only used for weight painting.
* will need to move out of this check if its used elsewhere. */
- t2 = birthtime + ((float)(k+1)/(float)steps) * (dietime - birthtime);
+ t2 = birthtime + ((float)k/(float)steps) * (dietime - birthtime);
while (pind.hkey[1]->time < t2) pind.hkey[1]++;
pind.hkey[0] = pind.hkey[1] - 1;
@@ -4424,3 +4450,34 @@ void psys_make_billboard(ParticleBillboardData *bb, float xvec[3], float yvec[3]
VECADDFAC(center, center, yvec, bb->offset[1]);
}
+
+void psys_apply_hair_lattice(Scene *scene, Object *ob, ParticleSystem *psys) {
+ ParticleSimulationData sim = {scene, ob, psys, psys_get_modifier(ob, psys)};
+
+ psys->lattice = psys_get_lattice(&sim);
+
+ if(psys->lattice) {
+ ParticleData *pa = psys->particles;
+ HairKey *hkey;
+ int p, h;
+ float hairmat[4][4], imat[4][4];
+
+ for(p=0; p<psys->totpart; p++, pa++) {
+ psys_mat_hair_to_global(sim.ob, sim.psmd->dm, psys->part->from, pa, hairmat);
+ invert_m4_m4(imat, hairmat);
+
+ hkey = pa->hair;
+ for(h=0; h<pa->totkey; h++, hkey++) {
+ mul_m4_v3(hairmat, hkey->co);
+ calc_latt_deform(psys->lattice, hkey->co, 1.0f);
+ mul_m4_v3(imat, hkey->co);
+ }
+ }
+
+ end_latt_deform(psys->lattice);
+ psys->lattice= NULL;
+
+ /* protect the applied shape */
+ psys->flag |= PSYS_EDITED;
+ }
+}
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 2b43ce1ea36..955de554e00 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -106,20 +106,26 @@
/* Reacting to system events */
/************************************************/
-static int get_current_display_percentage(ParticleSystem *psys)
+static int particles_are_dynamic(ParticleSystem *psys) {
+ if(psys->pointcache->flag & PTCACHE_BAKED)
+ return 0;
+
+ if(psys->part->type == PART_HAIR)
+ return psys->flag & PSYS_HAIR_DYNAMICS;
+ else
+ return ELEM3(psys->part->phystype, PART_PHYS_NEWTON, PART_PHYS_BOIDS, PART_PHYS_FLUID);
+}
+int psys_get_current_display_percentage(ParticleSystem *psys)
{
ParticleSettings *part=psys->part;
- if(psys->renderdata || (part->child_nbr && part->childtype)
- || (psys->pointcache->flag & PTCACHE_BAKING))
+ if((psys->renderdata && !particles_are_dynamic(psys)) /* non-dynamic particles can be rendered fully */
+ || (part->child_nbr && part->childtype) /* display percentage applies to children */
+ || (psys->pointcache->flag & PTCACHE_BAKING)) /* baking is always done with full amount */
return 100;
- if(part->phystype==PART_PHYS_KEYED){
return psys->part->disp;
}
- else
- return psys->part->disp;
-}
void psys_reset(ParticleSystem *psys, int mode)
{
@@ -1568,8 +1574,6 @@ void initialize_particle(ParticleSimulationData *sim, ParticleData *pa, int p)
psys_get_texture(sim,ma,pa,&ptex,MAP_PA_INIT);
}
- pa->lifetime= part->lifetime*ptex.life;
-
if(part->type==PART_HAIR)
pa->time= 0.0f;
//else if(part->type==PART_REACTOR && (part->flag&PART_REACT_STA_END)==0)
@@ -1584,25 +1588,6 @@ void initialize_particle(ParticleSimulationData *sim, ParticleData *pa, int p)
pa->time= part->sta + (part->end - part->sta)*ptex.time;
}
-
- if(part->type==PART_HAIR){
- pa->lifetime=100.0f;
- }
- else{
-#if 0 // XXX old animation system
- icu=find_ipocurve(psys->part->ipo,PART_EMIT_LIFE);
- if(icu){
- calc_icu(icu,100*ptex.time);
- pa->lifetime*=icu->curval;
- }
-#endif // XXX old animation system
-
- if(part->randlife!=0.0)
- pa->lifetime*= 1.0f - part->randlife * BLI_frand();
- }
-
- pa->dietime= pa->time+pa->lifetime;
-
if(part->type!=PART_HAIR && part->distr!=PART_DISTR_GRID && part->from != PART_FROM_VERT){
if(ptex.exist < BLI_frand())
pa->flag |= PARS_UNEXIST;
@@ -1695,6 +1680,7 @@ void reset_particle(ParticleSimulationData *sim, ParticleData *pa, float dtime,
part=psys->part;
ptex.ivel=1.0;
+ ptex.life=1.0;
/* we need to get every random even if they're not used so that they don't effect eachother */
r_vel[0] = 2.0f * (PSYS_FRAND(p + 10) - 0.5f);
@@ -1752,7 +1738,7 @@ void reset_particle(ParticleSimulationData *sim, ParticleData *pa, float dtime,
psys_particle_on_emitter(sim->psmd, part->from,pa->num, pa->num_dmcache, pa->fuv,pa->foffset,loc,nor,0,0,0,0);
/* get possible textural influence */
- psys_get_texture(sim, give_current_material(sim->ob,part->omat), pa, &ptex, MAP_PA_IVEL);
+ psys_get_texture(sim, give_current_material(sim->ob,part->omat), pa, &ptex, MAP_PA_IVEL|MAP_PA_LIFE);
//if(vg_vel && pa->num != -1)
// ptex.ivel*=psys_particle_value_from_verts(sim->psmd->dm,part->from,pa,vg_vel);
@@ -1975,8 +1961,25 @@ void reset_particle(ParticleSimulationData *sim, ParticleData *pa, float dtime,
}
}
+
+ if(part->type == PART_HAIR){
+ pa->lifetime = 100.0f;
+ }
+ else{
+ pa->lifetime = part->lifetime*ptex.life;
+
+ if(part->randlife != 0.0)
+ pa->lifetime *= 1.0f - part->randlife * PSYS_FRAND(p + 21);
+ }
+
pa->dietime = pa->time + pa->lifetime;
+ if(sim->psys->pointcache && sim->psys->pointcache->flag & PTCACHE_BAKED &&
+ sim->psys->pointcache->mem_cache.first) {
+ float dietime = psys_get_dietime_from_cache(sim->psys->pointcache, p);
+ pa->dietime = MIN2(pa->dietime, dietime);
+ }
+
if(pa->time > cfra)
pa->alive = PARS_UNBORN;
else if(pa->dietime <= cfra)
@@ -3052,7 +3055,7 @@ static void deflect_particle(ParticleSimulationData *sim, int p, float dfra, flo
/* Stickness to surface */
normalize_v3(nor_vec);
- madd_v3_v3fl(pa->state.vel, nor_vec, -pd->pdef_stickness);
+ madd_v3_v3fl(pa->state.vel, col.nor, -pd->pdef_stickness);
}
col.t = dt;
@@ -3250,7 +3253,7 @@ static void hair_step(ParticleSimulationData *sim, float cfra)
ParticleSystem *psys = sim->psys;
/* ParticleSettings *part = psys->part; */
PARTICLE_P;
- float disp = (float)get_current_display_percentage(psys)/100.0f;
+ float disp = (float)psys_get_current_display_percentage(psys)/100.0f;
BLI_srandom(psys->seed);
@@ -3518,7 +3521,7 @@ static void cached_step(ParticleSimulationData *sim, float cfra)
psys_update_effectors(sim);
- disp= (float)get_current_display_percentage(psys)/100.0f;
+ disp= (float)psys_get_current_display_percentage(psys)/100.0f;
LOOP_PARTICLES {
pa->size = part->size;
@@ -3785,7 +3788,7 @@ static void system_step(ParticleSimulationData *sim, float cfra)
/* 3. do dynamics */
/* set particles to be not calculated TODO: can't work with pointcache */
- disp= (float)get_current_display_percentage(psys)/100.0f;
+ disp= (float)psys_get_current_display_percentage(psys)/100.0f;
BLI_srandom(psys->seed);
LOOP_PARTICLES {
@@ -4035,6 +4038,10 @@ void particle_system_update(Scene *scene, Object *ob, ParticleSystem *psys)
{
PARTICLE_P;
+ /* Particles without dynamics haven't been reset yet because they don't use pointcache */
+ if(psys->recalc & PSYS_RECALC_RESET)
+ psys_reset(psys, PSYS_RESET_ALL);
+
if(emit_particles(&sim, NULL, cfra)) {
free_keyed_keys(psys);
distribute_particles(&sim, part->from);
diff --git a/source/blender/blenkernel/intern/report.c b/source/blender/blenkernel/intern/report.c
index 173c6c136f2..3773757f5d5 100644
--- a/source/blender/blenkernel/intern/report.c
+++ b/source/blender/blenkernel/intern/report.c
@@ -273,4 +273,4 @@ Report *BKE_reports_last_displayable(ReportList *reports)
}
return NULL;
-} \ No newline at end of file
+}
diff --git a/source/blender/blenkernel/intern/sca.c b/source/blender/blenkernel/intern/sca.c
index f5ca7ee3cef..9589b1e4f98 100644
--- a/source/blender/blenkernel/intern/sca.c
+++ b/source/blender/blenkernel/intern/sca.c
@@ -572,9 +572,22 @@ void set_sca_new_poins_ob(Object *ob)
bObjectActuator *oa= act->data;
ID_NEW(oa->reference);
}
- else if(act->type==ACT_SCENE) {
- bSceneActuator *sca= act->data;
- ID_NEW(sca->camera);
+ else if(act->type==ACT_MESSAGE) {
+ bMessageActuator *ma= act->data;
+ ID_NEW(ma->toObject);
+ }
+ else if(act->type==ACT_PARENT) {
+ bParentActuator *para = act->data;
+ ID_NEW(para->ob);
+ }
+ else if(act->type==ACT_ARMATURE) {
+ bArmatureActuator *aa = act->data;
+ ID_NEW(aa->target);
+ ID_NEW(aa->subtarget);
+ }
+ else if(act->type==ACT_PROPERTY) {
+ bPropertyActuator *pa= act->data;
+ ID_NEW(pa->ob);
}
}
act= act->next;
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index b20bb111cb4..b6bb5c3a51b 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -1852,7 +1852,7 @@ static ImBuf * seq_render_scene_strip_impl(
if(sequencer_view3d_cb && BLI_thread_is_main() && doseq_gl && (seq->scene == scene || have_seq==0) && seq->scene->camera) {
/* opengl offscreen render */
scene_update_for_newframe(bmain, seq->scene, seq->scene->lay);
- ibuf= sequencer_view3d_cb(seq->scene, seqrectx, seqrecty,
+ ibuf= sequencer_view3d_cb(seq->scene, seqrectx, seqrecty, IB_rect,
scene->r.seq_prev_type);
}
else {
diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c
index dd0135cfefc..8f3b82643e0 100644
--- a/source/blender/blenkernel/intern/sound.c
+++ b/source/blender/blenkernel/intern/sound.c
@@ -383,7 +383,7 @@ void sound_move_scene_sound(struct Scene *scene, void* handle, int startframe, i
void sound_start_play_scene(struct Scene *scene)
{
scene->sound_scene_handle = AUD_play(scene->sound_scene, 1);
- AUD_setLoop(scene->sound_scene_handle, -1, 0);
+ AUD_setLoop(scene->sound_scene_handle, -1);
}
void sound_play_scene(struct Scene *scene)
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c
index 9075c64d286..77416f4dd12 100644
--- a/source/blender/blenkernel/intern/texture.c
+++ b/source/blender/blenkernel/intern/texture.c
@@ -689,6 +689,49 @@ MTex *add_mtex()
return mtex;
}
+/* slot -1 for first free ID */
+MTex *add_mtex_id(ID *id, int slot)
+{
+ MTex **mtex_ar;
+ short act;
+
+ give_active_mtex(id, &mtex_ar, &act);
+
+ if(mtex_ar==NULL) {
+ return NULL;
+ }
+
+ if(slot==-1) {
+ /* find first free */
+ int i;
+ for (i= 0; i < MAX_MTEX; i++) {
+ if (!mtex_ar[i]) {
+ slot= i;
+ break;
+ }
+ }
+ if(slot == -1) {
+ return NULL;
+ }
+ }
+ else {
+ /* make sure slot is valid */
+ if(slot < 0 || slot >= MAX_MTEX) {
+ return NULL;
+ }
+ }
+
+ if (mtex_ar[slot]) {
+ id_us_min((ID *)mtex_ar[slot]->tex);
+ MEM_freeN(mtex_ar[slot]);
+ mtex_ar[slot]= NULL;
+ }
+
+ mtex_ar[slot]= add_mtex();
+
+ return mtex_ar[slot];
+}
+
/* ------------------------------------------------------------------------- */
Tex *copy_texture(Tex *tex)
diff --git a/source/blender/blenlib/BLI_math_color.h b/source/blender/blenlib/BLI_math_color.h
index 72724c1c0f7..d3f1a842e45 100644
--- a/source/blender/blenlib/BLI_math_color.h
+++ b/source/blender/blenlib/BLI_math_color.h
@@ -76,6 +76,12 @@ float linearrgb_to_srgb(float c);
void srgb_to_linearrgb_v3_v3(float *col_to, float *col_from);
void linearrgb_to_srgb_v3_v3(float *col_to, float *col_from);
+/* rgba buffer convenience functions */
+void srgb_to_linearrgb_rgba_buf(float *col, int tot);
+void linearrgb_to_srgb_rgba_buf(float *col, int tot);
+void srgb_to_linearrgb_rgba_rgba_buf(float *col_to, float *col_from, int tot);
+void linearrgb_to_srgb_rgba_rgba_buf(float *col_to, float *col_from, int tot);
+
/************************** Other *************************/
int constrain_rgb(float *r, float *g, float *b);
diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h
index 2030ea63855..0749e657f08 100644
--- a/source/blender/blenlib/BLI_math_vector.h
+++ b/source/blender/blenlib/BLI_math_vector.h
@@ -153,9 +153,9 @@ void bisect_v3_v3v3v3(float r[3], float a[3], float b[3], float c[3]);
/*********************************** Other ***********************************/
-void print_v2(char *str, float a[2]);
-void print_v3(char *str, float a[3]);
-void print_v4(char *str, float a[4]);
+void print_v2(const char *str, const float a[2]);
+void print_v3(const char *str, const float a[3]);
+void print_v4(const char *str, const float a[4]);
MINLINE void normal_short_to_float_v3(float r[3], const short n[3]);
MINLINE void normal_float_to_short_v3(short r[3], const float n[3]);
diff --git a/source/blender/blenlib/BLI_rect.h b/source/blender/blenlib/BLI_rect.h
index 0b886c17309..13b12fc4e1e 100644
--- a/source/blender/blenlib/BLI_rect.h
+++ b/source/blender/blenlib/BLI_rect.h
@@ -60,7 +60,10 @@ int BLI_isect_rctf(struct rctf *src1, struct rctf *src2, struct rctf *dest);
int BLI_isect_rcti(struct rcti *src1, struct rcti *src2, struct rcti *dest);
void BLI_union_rctf(struct rctf *rcta, struct rctf *rctb);
void BLI_union_rcti(struct rcti *rcti1, struct rcti *rcti2);
+void BLI_copy_rcti_rctf(struct rcti *tar, const struct rctf *src);
+void print_rctf(const char *str, struct rctf *rect);
+void print_rcti(const char *str, struct rcti *rect);
#ifdef __cplusplus
}
diff --git a/source/blender/blenlib/BLI_sparsemap.h b/source/blender/blenlib/BLI_sparsemap.h
new file mode 100755
index 00000000000..0c892997dd4
--- /dev/null
+++ b/source/blender/blenlib/BLI_sparsemap.h
@@ -0,0 +1,73 @@
+#if 0
+/**
+ * $Id:
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung
+ * All rights reserved.
+ *
+ * Contributor(s): Joseph Eagar (original author)
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include "BLI_math_inline.h"
+
+typedef struct SparseMap {
+ int max;
+ int blocksize;
+ void **blocks;
+ int totblock;
+} SparseMap;
+
+MALWAYS_INLINE SparseMap *BLI_sparsemap_new(int blocksize, char *name)
+{
+ SparseMap *sm = MEM_callocN(sizeof(SparseMap), name);
+
+ sm->blocksize = blocksize;
+ return sm;
+}
+
+MALWAYS_INLINE void BLI_sparsemap_free(SparseMap *sm)
+{
+ if (sm->blocks)
+ MEM_freeN(sm->blocks);
+
+ MEM_freeN(sm);
+}
+
+MALWAYS_INLINE void BLI_sparsemap_set(SparseMap *sm, int index, void *ptr)
+{
+ if (index >= sm->max || (sm->blocks && !sm->blocks[index/sm->blocksize])) {
+ int totblock = MAX2((index+1)/sm->blocksize, 2);
+ void *blocks = MEM_callocN(sizeof(void*)*totblock);
+
+ if (sm->blocks)
+ memcpy(blocks, sm->blocks, sizeof(void*)*sm->totblock);
+ sm->totblock = totblock;
+ MEM_freeN(sm->blocks);
+ sm->blocks = blocks;
+ }
+
+ if (!sm->blocks[index/sm->blocksize]) {
+ sm->blocks[index/sm->blocksize] = MEM_mallocN(sizeof(void*)*sm->blocksize);
+ }
+
+ sm->blocks[index/sm->blocksize] = ptr;
+}
+#endif
diff --git a/source/blender/blenlib/BLI_string.h b/source/blender/blenlib/BLI_string.h
index 39123a438df..ccb10190816 100644
--- a/source/blender/blenlib/BLI_string.h
+++ b/source/blender/blenlib/BLI_string.h
@@ -132,6 +132,9 @@ size_t BLI_strnlen(const char *str, size_t maxlen);
void BLI_timestr(double _time, char *str); /* time var is global */
+int BLI_utf8_invalid_byte(const char *str, int length);
+int BLI_utf8_invalid_strip(char *str, int length);
+
#ifdef __cplusplus
}
#endif
diff --git a/source/blender/blenlib/intern/math_color.c b/source/blender/blenlib/intern/math_color.c
index 396f2c52058..693fd885b50 100644
--- a/source/blender/blenlib/intern/math_color.c
+++ b/source/blender/blenlib/intern/math_color.c
@@ -372,6 +372,40 @@ void linearrgb_to_srgb_v3_v3(float *col_to, float *col_from)
col_to[2] = linearrgb_to_srgb(col_from[2]);
}
+/* todo, should these be moved elsewhere?, they dont belong in imbuf */
+void srgb_to_linearrgb_rgba_buf(float *col, int tot)
+{
+ while(tot--) {
+ srgb_to_linearrgb_v3_v3(col, col);
+ col += 4;
+ }
+}
+
+void linearrgb_to_srgb_rgba_buf(float *col, int tot)
+{
+ while(tot--) {
+ linearrgb_to_srgb_v3_v3(col, col);
+ col += 4;
+ }
+}
+
+void srgb_to_linearrgb_rgba_rgba_buf(float *col_to, float *col_from, int tot)
+{
+ while(tot--) {
+ srgb_to_linearrgb_v3_v3(col_to, col_from);
+ col_to += 4;
+ col_from += 4;
+ }
+}
+
+void linearrgb_to_srgb_rgba_rgba_buf(float *col_to, float *col_from, int tot)
+{
+ while(tot--) {
+ linearrgb_to_srgb_v3_v3(col_to, col_from);
+ col_to += 4;
+ col_from += 4;
+ }
+}
void minmax_rgb(short c[])
{
diff --git a/source/blender/blenlib/intern/math_vector.c b/source/blender/blenlib/intern/math_vector.c
index b1cea9ab3c4..6d908ddb1cd 100644
--- a/source/blender/blenlib/intern/math_vector.c
+++ b/source/blender/blenlib/intern/math_vector.c
@@ -298,17 +298,17 @@ void ortho_basis_v3v3_v3(float *v1, float *v2, float *v)
/*********************************** Other ***********************************/
-void print_v2(char *str, float v[2])
+void print_v2(const char *str, const float v[2])
{
printf("%s: %.3f %.3f\n", str, v[0], v[1]);
}
-void print_v3(char *str, float v[3])
+void print_v3(const char *str, const float v[3])
{
printf("%s: %.3f %.3f %.3f\n", str, v[0], v[1], v[2]);
}
-void print_v4(char *str, float v[4])
+void print_v4(const char *str, const float v[4])
{
printf("%s: %.3f %.3f %.3f %.3f\n", str, v[0], v[1], v[2], v[3]);
}
diff --git a/source/blender/blenlib/intern/rct.c b/source/blender/blenlib/intern/rct.c
index 5466acdba9f..aa424c1c2bb 100644
--- a/source/blender/blenlib/intern/rct.c
+++ b/source/blender/blenlib/intern/rct.c
@@ -36,6 +36,8 @@
*/
#include "DNA_vec_types.h"
+#include <stdio.h>
+#include <math.h>
int BLI_rcti_is_empty(rcti * rect)
{
@@ -222,3 +224,21 @@ int BLI_isect_rcti(rcti *src1, rcti *src2, rcti *dest)
return 0;
}
}
+
+void BLI_copy_rcti_rctf(rcti *tar, const rctf *src)
+{
+ tar->xmin= floor(src->xmin + 0.5);
+ tar->xmax= floor((src->xmax - src->xmin) + 0.5);
+ tar->ymin= floor(src->ymin + 0.5);
+ tar->ymax= floor((src->ymax - src->ymin) + 0.5);
+}
+
+void print_rctf(const char *str, rctf *rect)
+{
+ printf("%s: xmin %.3f, xmax %.3f, ymin %.3f, ymax %.3f\n", str, rect->xmin, rect->xmax, rect->ymin, rect->ymax);
+}
+
+void print_rcti(const char *str, rcti *rect)
+{
+ printf("%s: xmin %d, xmax %d, ymin %d, ymax %d\n", str, rect->xmin, rect->xmax, rect->ymin, rect->ymax);
+}
diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c
index c344d8c0711..76193ba9a13 100644
--- a/source/blender/blenlib/intern/string.c
+++ b/source/blender/blenlib/intern/string.c
@@ -348,3 +348,114 @@ size_t BLI_strnlen(const char *str, size_t maxlen)
const char *end = memchr(str, '\0', maxlen);
return end ? (size_t) (end - str) : maxlen;
}
+
+/* from libswish3, originally called u8_isvalid(),
+ * modified to return the index of the bad character (byte index not utf).
+ * http://svn.swish-e.org/libswish3/trunk/src/libswish3/utf8.c r3044 - campbell */
+
+/* based on the valid_utf8 routine from the PCRE library by Philip Hazel
+
+ length is in bytes, since without knowing whether the string is valid
+ it's hard to know how many characters there are! */
+
+static const char trailingBytesForUTF8[256] = {
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5
+};
+
+int BLI_utf8_invalid_byte(const char *str, int length)
+{
+ const unsigned char *p, *pend = (unsigned char*)str + length;
+ unsigned char c;
+ int ab;
+
+ for (p = (unsigned char*)str; p < pend; p++) {
+ c = *p;
+ if (c < 128)
+ continue;
+ if ((c & 0xc0) != 0xc0)
+ goto utf8_error;
+ ab = trailingBytesForUTF8[c];
+ if (length < ab)
+ goto utf8_error;
+ length -= ab;
+
+ p++;
+ /* Check top bits in the second byte */
+ if ((*p & 0xc0) != 0x80)
+ goto utf8_error;
+
+ /* Check for overlong sequences for each different length */
+ switch (ab) {
+ /* Check for xx00 000x */
+ case 1:
+ if ((c & 0x3e) == 0) goto utf8_error;
+ continue; /* We know there aren't any more bytes to check */
+
+ /* Check for 1110 0000, xx0x xxxx */
+ case 2:
+ if (c == 0xe0 && (*p & 0x20) == 0) goto utf8_error;
+ break;
+
+ /* Check for 1111 0000, xx00 xxxx */
+ case 3:
+ if (c == 0xf0 && (*p & 0x30) == 0) goto utf8_error;
+ break;
+
+ /* Check for 1111 1000, xx00 0xxx */
+ case 4:
+ if (c == 0xf8 && (*p & 0x38) == 0) goto utf8_error;
+ break;
+
+ /* Check for leading 0xfe or 0xff,
+ and then for 1111 1100, xx00 00xx */
+ case 5:
+ if (c == 0xfe || c == 0xff ||
+ (c == 0xfc && (*p & 0x3c) == 0)) goto utf8_error;
+ break;
+ }
+
+ /* Check for valid bytes after the 2nd, if any; all must start 10 */
+ while (--ab > 0) {
+ if ((*(p+1) & 0xc0) != 0x80) goto utf8_error;
+ p++; /* do this after so we get usable offset - campbell */
+ }
+ }
+
+ return -1;
+
+utf8_error:
+
+ return (int)((char *)p - (char *)str) - 1;
+}
+
+int BLI_utf8_invalid_strip(char *str, int length)
+{
+ int bad_char, tot= 0;
+
+ while((bad_char= BLI_utf8_invalid_byte(str, length)) != -1) {
+ str += bad_char;
+ length -= bad_char;
+
+ if(length == 0) {
+ /* last character bad, strip it */
+ *str= '\0';
+ tot++;
+ break;
+ }
+ else {
+ /* strip, keep looking */
+ memmove(str, str + 1, length);
+ tot++;
+ }
+ }
+
+ return tot;
+}
+
diff --git a/source/blender/blenloader/BLO_readfile.h b/source/blender/blenloader/BLO_readfile.h
index eeced13b57b..719a3c065ae 100644
--- a/source/blender/blenloader/BLO_readfile.h
+++ b/source/blender/blenloader/BLO_readfile.h
@@ -123,6 +123,19 @@ BLO_blendhandle_from_file(
char *file);
/**
+ * Open a blendhandle from memory.
+ *
+ * @param mem The data to load from.
+ * @param memsize The size of the data.
+ * @return A handle on success, or NULL on failure.
+ */
+
+ BlendHandle*
+BLO_blendhandle_from_memory(
+ void *mem,
+ int memsize);
+
+/**
* Gets the names of all the datablocks in a file
* of a certain type (ie. All the scene names in
* a file).
diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c
index d66d802c8ee..da441214b37 100644
--- a/source/blender/blenloader/intern/readblenentry.c
+++ b/source/blender/blenloader/intern/readblenentry.c
@@ -76,6 +76,15 @@ BlendHandle *BLO_blendhandle_from_file(char *file)
return bh;
}
+BlendHandle *BLO_blendhandle_from_memory(void *mem, int memsize)
+{
+ BlendHandle *bh;
+
+ bh= (BlendHandle*)blo_openblendermemory(mem, memsize, NULL);
+
+ return bh;
+}
+
void BLO_blendhandle_print_sizes(BlendHandle *bh, void *fp)
{
FileData *fd= (FileData*) bh;
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 44cc6b5c1d9..cb051433087 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -5258,7 +5258,9 @@ static void direct_link_screen(FileData *fd, bScreen *sc)
direct_link_gpencil(fd, v3d->gpd);
}
v3d->localvd= newdataadr(fd, v3d->localvd);
- v3d->afterdraw.first= v3d->afterdraw.last= NULL;
+ v3d->afterdraw_transp.first= v3d->afterdraw_transp.last= NULL;
+ v3d->afterdraw_xray.first= v3d->afterdraw_xray.last= NULL;
+ v3d->afterdraw_xraytransp.first= v3d->afterdraw_xraytransp.last= NULL;
v3d->properties_storage= NULL;
view3d_split_250(v3d, &sl->regionbase);
diff --git a/source/blender/collada/CMakeLists.txt b/source/blender/collada/CMakeLists.txt
index 420650a6ff7..a72ecc4be6c 100644
--- a/source/blender/collada/CMakeLists.txt
+++ b/source/blender/collada/CMakeLists.txt
@@ -61,4 +61,8 @@ SET(INC
ENDIF(APPLE)
+IF(WITH_BUILDINFO)
+ ADD_DEFINITIONS(-DNAN_BUILDINFO)
+ENDIF(WITH_BUILDINFO)
+
BLENDERLIB(bf_collada "${SRC}" "${INC}")
diff --git a/source/blender/collada/DocumentExporter.cpp b/source/blender/collada/DocumentExporter.cpp
index ca3aada80c0..5c059a4e9c9 100644
--- a/source/blender/collada/DocumentExporter.cpp
+++ b/source/blender/collada/DocumentExporter.cpp
@@ -48,10 +48,14 @@ extern "C"
#include "BLI_path_util.h"
#include "BLI_fileops.h"
#include "ED_keyframing.h"
+#ifdef NAN_BUILDINFO
+extern char build_rev[];
+#endif
}
#include "MEM_guardedalloc.h"
+#include "BKE_blender.h" // version info
#include "BKE_scene.h"
#include "BKE_global.h"
#include "BKE_main.h"
@@ -1719,11 +1723,7 @@ public:
// most widespread de-facto standard.
texture.setProfileName("FCOLLADA");
texture.setChildElementName("bump");
-#ifdef WIN32 // currently, Windows builds are using revision 746 of OpenCollada while Linux and Mac are using an older revision 721
ep.addExtraTechniqueColorOrTexture(COLLADASW::ColorOrTexture(texture));
-#else
- ep.setExtraTechniqueColorOrTexture(COLLADASW::ColorOrTexture(texture));
-#endif
}
}
// performs the actual writing
@@ -2536,6 +2536,15 @@ void DocumentExporter::exportCurrentScene(Scene *sce, const char* filename)
// XXX ask blender devs about this?
asset.setUnit("decimetre", 0.1);
asset.setUpAxisType(COLLADASW::Asset::Z_UP);
+ // TODO: need an Author field in userpref
+ asset.getContributor().mAuthor = "Blender User";
+#ifdef NAN_BUILDINFO
+ char version_buf[128];
+ sprintf(version_buf, "Blender %d.%02d.%d r%s", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION, build_rev);
+ asset.getContributor().mAuthoringTool = version_buf;
+#else
+ asset.getContributor().mAuthoringTool = "Blender 2.5x";
+#endif
asset.add();
// <library_cameras>
@@ -2596,4 +2605,3 @@ NOTES:
* AnimationExporter::sample_animation enables all curves on armature, this is undesirable for a user
*/
-
diff --git a/source/blender/collada/SConscript b/source/blender/collada/SConscript
index 91c3a381272..a473d31e1de 100644
--- a/source/blender/collada/SConscript
+++ b/source/blender/collada/SConscript
@@ -28,6 +28,7 @@
Import ('env')
sources = env.Glob('*.cpp')
+defs = []
# relative paths to include dirs, space-separated, string
if env['OURPLATFORM']=='darwin':
@@ -35,5 +36,7 @@ if env['OURPLATFORM']=='darwin':
else:
incs = '../blenlib ../blenkernel ../windowmanager ../makesdna ../makesrna ../editors/include ../../../intern/guardedalloc [OPENCOLLADA]/COLLADAStreamWriter/include [OPENCOLLADA]/COLLADABaseUtils/include [OPENCOLLADA]/COLLADAFramework/include [OPENCOLLADA]/COLLADASaxFrameworkLoader/include '.replace('[OPENCOLLADA]', env['BF_OPENCOLLADA_INC'])
-env.BlenderLib ('bf_collada', sources, Split(incs), [], libtype='core', priority=200 )
+if env['BF_BUILDINFO']:
+ defs.append('NAN_BUILDINFO')
+env.BlenderLib ('bf_collada', sources, Split(incs), defs, libtype='core', priority=200 )
diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c
index f5f50e10bcb..b564780f6c0 100644
--- a/source/blender/editors/animation/anim_draw.c
+++ b/source/blender/editors/animation/anim_draw.c
@@ -25,6 +25,7 @@
*
* ***** END GPL LICENSE BLOCK *****
*/
+#include "BLO_sys_types.h"
#include "DNA_anim_types.h"
#include "DNA_object_types.h"
diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c
index 9570fd64433..9b9c9435518 100644
--- a/source/blender/editors/animation/anim_ops.c
+++ b/source/blender/editors/animation/anim_ops.c
@@ -29,6 +29,8 @@
#include <stdlib.h>
#include <math.h>
+#include "BLO_sys_types.h"
+
#include "DNA_anim_types.h"
#include "DNA_scene_types.h"
diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c
index 191316711f4..35e6cb66d45 100644
--- a/source/blender/editors/animation/fmodifier_ui.c
+++ b/source/blender/editors/animation/fmodifier_ui.c
@@ -583,7 +583,7 @@ static void draw_modifier__stepped(uiLayout *layout, ID *id, FModifier *fcm, sho
uiItemR(col, &ptr, "use_frame_end", 0, NULL, 0);
subcol = uiLayoutColumn(col, 1);
- uiLayoutSetActive(subcol, RNA_boolean_get(&ptr, "use_end_frame"));
+ uiLayoutSetActive(subcol, RNA_boolean_get(&ptr, "use_frame_end"));
uiItemR(subcol, &ptr, "frame_end", 0, NULL, 0);
}
diff --git a/source/blender/editors/armature/armature_ops.c b/source/blender/editors/armature/armature_ops.c
index d5bd09cc8f1..908aa5bb432 100644
--- a/source/blender/editors/armature/armature_ops.c
+++ b/source/blender/editors/armature/armature_ops.c
@@ -29,7 +29,7 @@
#include <stdlib.h>
#include <math.h>
-
+#include "BLO_sys_types.h"
#include "BLI_math.h"
#include "BLI_blenlib.h"
diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c
index c0f84064aba..1c25b12c917 100644
--- a/source/blender/editors/armature/editarmature.c
+++ b/source/blender/editors/armature/editarmature.c
@@ -5460,6 +5460,8 @@ void ED_armature_bone_rename(bArmature *arm, char *oldnamep, char *newnamep)
/* do entire dbase - objects */
for (ob= G.main->object.first; ob; ob= ob->id.next) {
+ ModifierData *md;
+
/* we have the object using the armature */
if (arm==ob->data) {
Object *cob;
@@ -5509,6 +5511,19 @@ void ED_armature_bone_rename(bArmature *arm, char *oldnamep, char *newnamep)
}
}
+ /* fix modifiers that might be using this name */
+ for (md= ob->modifiers.first; md; md= md->next) {
+ if (md->type == eModifierType_Hook) {
+ HookModifierData *hmd = (HookModifierData *)md;
+
+ /* uses armature, so may use the affected bone name */
+ if (hmd->object && (hmd->object->data == arm)) {
+ if (!strcmp(hmd->subtarget, oldname))
+ BLI_strncpy(hmd->subtarget, newname, MAXBONENAME);
+ }
+ }
+ }
+
/* Fix animation data attached to this object */
// TODO: should we be using the database wide version instead (since drivers may break)
if (ob->adt) {
diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c
index b0b5aedaa70..6fe584c7f98 100644
--- a/source/blender/editors/armature/poselib.c
+++ b/source/blender/editors/armature/poselib.c
@@ -278,8 +278,16 @@ static void poselib_add_menu_invoke__replacemenu (bContext *C, uiLayout *layout,
uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT);
/* add each marker to this menu */
- for (marker= act->markers.first; marker; marker= marker->next)
- uiItemIntO(layout, marker->name, ICON_ARMATURE_DATA, "POSELIB_OT_pose_add", "frame", marker->frame);
+ for (marker= act->markers.first; marker; marker= marker->next) {
+ PointerRNA props_ptr;
+
+ props_ptr = uiItemFullO(layout, "POSELIB_OT_pose_add",
+ marker->name, ICON_ARMATURE_DATA, NULL,
+ WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
+
+ RNA_int_set(&props_ptr, "frame", marker->frame);
+ RNA_string_set(&props_ptr, "name", marker->name);
+}
}
static int poselib_add_menu_invoke (bContext *C, wmOperator *op, wmEvent *evt)
diff --git a/source/blender/editors/curve/curve_intern.h b/source/blender/editors/curve/curve_intern.h
index 10c1bd84262..2567494ddf3 100644
--- a/source/blender/editors/curve/curve_intern.h
+++ b/source/blender/editors/curve/curve_intern.h
@@ -97,9 +97,9 @@ void CURVE_OT_primitive_nurbs_path_add(struct wmOperatorType *ot);
void SURFACE_OT_primitive_nurbs_surface_curve_add(struct wmOperatorType *ot);
void SURFACE_OT_primitive_nurbs_surface_circle_add(struct wmOperatorType *ot);
void SURFACE_OT_primitive_nurbs_surface_surface_add(struct wmOperatorType *ot);
-void SURFACE_OT_primitive_nurbs_surface_tube_add(struct wmOperatorType *ot);
+void SURFACE_OT_primitive_nurbs_surface_cylinder_add(struct wmOperatorType *ot);
void SURFACE_OT_primitive_nurbs_surface_sphere_add(struct wmOperatorType *ot);
-void SURFACE_OT_primitive_nurbs_surface_donut_add(struct wmOperatorType *ot);
+void SURFACE_OT_primitive_nurbs_surface_torus_add(struct wmOperatorType *ot);
void CURVE_OT_de_select_first(struct wmOperatorType *ot);
void CURVE_OT_de_select_last(struct wmOperatorType *ot);
diff --git a/source/blender/editors/curve/curve_ops.c b/source/blender/editors/curve/curve_ops.c
index b5b6ee4e6da..89c19d93b0f 100644
--- a/source/blender/editors/curve/curve_ops.c
+++ b/source/blender/editors/curve/curve_ops.c
@@ -105,9 +105,9 @@ void ED_operatortypes_curve(void)
WM_operatortype_append(SURFACE_OT_primitive_nurbs_surface_curve_add);
WM_operatortype_append(SURFACE_OT_primitive_nurbs_surface_circle_add);
WM_operatortype_append(SURFACE_OT_primitive_nurbs_surface_surface_add);
- WM_operatortype_append(SURFACE_OT_primitive_nurbs_surface_tube_add);
+ WM_operatortype_append(SURFACE_OT_primitive_nurbs_surface_cylinder_add);
WM_operatortype_append(SURFACE_OT_primitive_nurbs_surface_sphere_add);
- WM_operatortype_append(SURFACE_OT_primitive_nurbs_surface_donut_add);
+ WM_operatortype_append(SURFACE_OT_primitive_nurbs_surface_torus_add);
WM_operatortype_append(CURVE_OT_smooth);
WM_operatortype_append(CURVE_OT_smooth_radius);
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index 8af659c62e3..4564b90880f 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -1804,7 +1804,7 @@ void CURVE_OT_switch_direction(wmOperatorType *ot)
/****************** set weight operator *******************/
-static int set_weight_exec(bContext *C, wmOperator *op)
+static int set_goal_weight_exec(bContext *C, wmOperator *op)
{
Object *obedit= CTX_data_edit_object(C);
ListBase *editnurb= curve_get_editcurve(obedit);
@@ -1842,7 +1842,7 @@ void CURVE_OT_spline_weight_set(wmOperatorType *ot)
ot->idname= "CURVE_OT_spline_weight_set";
/* api callbacks */
- ot->exec= set_weight_exec;
+ ot->exec= set_goal_weight_exec;
ot->invoke= WM_operator_props_popup;
ot->poll= ED_operator_editsurfcurve;
@@ -4109,7 +4109,7 @@ void CURVE_OT_spin(wmOperatorType *ot)
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
- RNA_def_float_vector(ot->srna, "center", 3, NULL, -FLT_MAX, FLT_MAX, "Center", "Center in global view space", -FLT_MAX, FLT_MAX);
+ RNA_def_float_vector_xyz(ot->srna, "center", 3, NULL, -FLT_MAX, FLT_MAX, "Center", "Center in global view space", -FLT_MAX, FLT_MAX);
RNA_def_float_vector(ot->srna, "axis", 3, NULL, -1.0f, 1.0f, "Axis", "Axis in global view space", -FLT_MAX, FLT_MAX);
}
@@ -4278,7 +4278,7 @@ void CURVE_OT_vertex_add(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
- RNA_def_float_vector(ot->srna, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location", "Location to add new vertex at.", -1e4, 1e4);
+ RNA_def_float_vector_xyz(ot->srna, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location", "Location to add new vertex at.", -1e4, 1e4);
}
/***************** extrude operator **********************/
@@ -5867,13 +5867,13 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newname)
makeknots(nu, 2);
}
break;
- case CU_PRIM_TUBE: /* tube */
+ case CU_PRIM_TUBE: /* Cylinder */
if( cutype==CU_NURBS ) {
Curve *cu= (Curve*)obedit->data;
if(newname) {
- rename_id((ID *)obedit, "SurfTube");
- rename_id((ID *)obedit->data, "SurfTube");
+ rename_id((ID *)obedit, "SurfCylinder");
+ rename_id((ID *)obedit->data, "SurfCylinder");
}
nu= add_nurbs_primitive(C, mat, CU_NURBS|CU_PRIM_CIRCLE, 0); /* circle */
@@ -5949,7 +5949,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newname)
BLI_remlink(editnurb, nu);
}
break;
- case CU_PRIM_DONUT: /* donut */
+ case CU_PRIM_DONUT: /* torus */
if( cutype==CU_NURBS ) {
float tmp_cent[3] = {0.f, 0.f, 0.f};
float tmp_vec[3] = {0.f, 0.f, 0.f};
@@ -6235,21 +6235,21 @@ void SURFACE_OT_primitive_nurbs_surface_surface_add(wmOperatorType *ot)
ED_object_add_generic_props(ot, TRUE);
}
-static int add_primitive_nurbs_surface_tube_exec(bContext *C, wmOperator *op)
+static int add_primitive_nurbs_surface_cylinder_exec(bContext *C, wmOperator *op)
{
return surf_prim_add(C, op, CU_PRIM_TUBE|CU_NURBS);
}
-void SURFACE_OT_primitive_nurbs_surface_tube_add(wmOperatorType *ot)
+void SURFACE_OT_primitive_nurbs_surface_cylinder_add(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Surface Tube";
- ot->description= "Construct a Nurbs surface Tube";
- ot->idname= "SURFACE_OT_primitive_nurbs_surface_tube_add";
+ ot->name= "Add Surface Cylinder";
+ ot->description= "Construct a Nurbs surface Cylinder";
+ ot->idname= "SURFACE_OT_primitive_nurbs_surface_cylinder_add";
/* api callbacks */
ot->invoke= ED_object_add_generic_invoke;
- ot->exec= add_primitive_nurbs_surface_tube_exec;
+ ot->exec= add_primitive_nurbs_surface_cylinder_exec;
ot->poll= ED_operator_scene_editable;
/* flags */
@@ -6281,21 +6281,21 @@ void SURFACE_OT_primitive_nurbs_surface_sphere_add(wmOperatorType *ot)
ED_object_add_generic_props(ot, TRUE);
}
-static int add_primitive_nurbs_surface_donut_exec(bContext *C, wmOperator *op)
+static int add_primitive_nurbs_surface_torus_exec(bContext *C, wmOperator *op)
{
return surf_prim_add(C, op, CU_PRIM_DONUT|CU_NURBS);
}
-void SURFACE_OT_primitive_nurbs_surface_donut_add(wmOperatorType *ot)
+void SURFACE_OT_primitive_nurbs_surface_torus_add(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Surface Donut";
- ot->description= "Construct a Nurbs surface Donut";
- ot->idname= "SURFACE_OT_primitive_nurbs_surface_donut_add";
+ ot->name= "Add Surface Torus";
+ ot->description= "Construct a Nurbs surface Torus";
+ ot->idname= "SURFACE_OT_primitive_nurbs_surface_torus_add";
/* api callbacks */
ot->invoke= ED_object_add_generic_invoke;
- ot->exec= add_primitive_nurbs_surface_donut_exec;
+ ot->exec= add_primitive_nurbs_surface_torus_exec;
ot->poll= ED_operator_scene_editable;
/* flags */
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c
index 284dac7a0ae..4b8c58a5308 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -32,6 +32,7 @@
#include <math.h>
#include <float.h>
+#include "BLO_sys_types.h"
#include "IMB_imbuf_types.h"
@@ -42,6 +43,7 @@
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
+#include "DNA_view3d_types.h"
#include "BKE_context.h"
#include "BKE_global.h"
@@ -56,6 +58,7 @@
#include "ED_gpencil.h"
#include "ED_sequencer.h"
+#include "ED_view3d.h"
#include "gpencil_intern.h"
@@ -164,8 +167,8 @@ static void gp_draw_stroke_point (bGPDspoint *points, short thickness, short sfl
co[1]= (points->y * winy) + offsy;
}
else {
- co[0]= (points->x / 100 * winx);
- co[1]= (points->y / 100 * winy);
+ co[0]= (points->x / 100 * winx) + offsx;
+ co[1]= (points->y / 100 * winy) + offsy;
}
/* if thickness is less than GP_DRAWTHICKNESS_SPECIAL, simple dot looks ok
@@ -265,8 +268,8 @@ static void gp_draw_stroke (bGPDspoint *points, int totpoints, short thickness,
glVertex2f(x, y);
}
else {
- const float x= (pt->x / 100 * winx);
- const float y= (pt->y / 100 * winy);
+ const float x= (pt->x / 100 * winx) + offsx;
+ const float y= (pt->y / 100 * winy) + offsy;
glVertex2f(x, y);
}
@@ -305,10 +308,10 @@ static void gp_draw_stroke (bGPDspoint *points, int totpoints, short thickness,
s1[1]= (pt2->y * winy) + offsy;
}
else {
- s0[0]= (pt1->x / 100 * winx);
- s0[1]= (pt1->y / 100 * winy);
- s1[0]= (pt2->x / 100 * winx);
- s1[1]= (pt2->y / 100 * winy);
+ s0[0]= (pt1->x / 100 * winx) + offsx;
+ s0[1]= (pt1->y / 100 * winy) + offsy;
+ s1[0]= (pt2->x / 100 * winx) + offsx;
+ s1[1]= (pt2->y / 100 * winy) + offsy;
}
/* calculate gradient and normal - 'angle'=(ny/nx) */
@@ -453,8 +456,8 @@ static void gp_draw_stroke (bGPDspoint *points, int totpoints, short thickness,
glVertex2f(x, y);
}
else {
- const float x= (float)(pt->x / 100 * winx);
- const float y= (float)(pt->y / 100 * winy);
+ const float x= (float)(pt->x / 100 * winx) + offsx;
+ const float y= (float)(pt->y / 100 * winy) + offsy;
glVertex2f(x, y);
}
@@ -732,25 +735,44 @@ void draw_gpencil_view2d (bContext *C, short onlyv2d)
/* draw grease-pencil sketches to specified 3d-view assuming that matrices are already set correctly
* Note: this gets called twice - first time with only3d=1 to draw 3d-strokes, second time with only3d=0 for screen-aligned strokes
*/
-void draw_gpencil_view3d_ext (Scene *scene, ARegion *ar, short only3d)
+
+void draw_gpencil_view3d_ext (Scene *scene, View3D *v3d, ARegion *ar, short only3d)
{
bGPdata *gpd;
int dflag = 0;
+ rcti rect;
+ RegionView3D *rv3d= ar->regiondata;
/* check that we have grease-pencil stuff to draw */
gpd= gpencil_data_get_active_v3d(scene); // XXX
if(gpd == NULL) return;
+ /* when rendering to the offscreen buffer we dont want to
+ * deal with the camera border, otherwise map the coords to the camera border. */
+ if(rv3d->persp == RV3D_CAMOB && !(G.f & G_RENDER_OGL)) {
+ rctf rectf;
+ view3d_calc_camera_border(scene, ar, rv3d, v3d, &rectf);
+ BLI_copy_rcti_rctf(&rect, &rectf);
+ }
+ else {
+ rect.xmin= 0;
+ rect.ymin= 0;
+ rect.xmax= ar->winx;
+ rect.ymax= ar->winy;
+ }
+
/* draw it! */
if (only3d) dflag |= (GP_DRAWDATA_ONLY3D|GP_DRAWDATA_NOSTATUS);
- gp_draw_data(gpd, 0, 0, ar->winx, ar->winy, CFRA, dflag);
+
+ gp_draw_data(gpd, rect.xmin, rect.ymin, rect.xmax, rect.ymax, CFRA, dflag);
}
void draw_gpencil_view3d (bContext *C, short only3d)
{
ARegion *ar= CTX_wm_region(C);
+ View3D *v3d= CTX_wm_view3d(C);
Scene *scene= CTX_data_scene(C);
- draw_gpencil_view3d_ext(scene, ar, only3d);
+ draw_gpencil_view3d_ext(scene, v3d, ar, only3d);
}
/* ************************************************** */
diff --git a/source/blender/editors/gpencil/gpencil_ops.c b/source/blender/editors/gpencil/gpencil_ops.c
index d9bd43cc851..b6b2675e6c8 100644
--- a/source/blender/editors/gpencil/gpencil_ops.c
+++ b/source/blender/editors/gpencil/gpencil_ops.c
@@ -29,8 +29,9 @@
#include <stddef.h>
#include <stdio.h>
-#include "BLI_blenlib.h"
+#include "BLO_sys_types.h"
+#include "BLI_blenlib.h"
#include "WM_api.h"
#include "WM_types.h"
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index cfa7af99d2a..f218ccd89f1 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -68,6 +68,9 @@ typedef struct tGPsdata {
ScrArea *sa; /* area where painting originated */
ARegion *ar; /* region where painting originated */
View2D *v2d; /* needed for GP_STROKE_2DSPACE */
+ rctf *subrect; /* for using the camera rect within the 3d view */
+ rctf subrect_data;
+
#if 0 // XXX review this 2d image stuff...
ImBuf *ibuf; /* needed for GP_STROKE_2DIMAGE */
@@ -271,9 +274,15 @@ static void gp_stroke_convertcoords (tGPsdata *p, short mval[], float out[], flo
/* 2d - relative to screen (viewport area) */
else {
+ if(p->subrect == NULL) { /* normal 3D view */
out[0] = (float)(mval[0]) / (float)(p->ar->winx) * 100;
out[1] = (float)(mval[1]) / (float)(p->ar->winy) * 100;
}
+ else { /* camera view, use subrect */
+ out[0]= ((mval[0] - p->subrect->xmin) / ((p->subrect->xmax - p->subrect->xmin))) * 100;
+ out[1]= ((mval[1] - p->subrect->ymin) / ((p->subrect->ymax - p->subrect->ymin))) * 100;
+}
+ }
}
/* add current stroke-point to buffer (returns whether point was successfully added) */
@@ -704,9 +713,15 @@ static void gp_stroke_eraser_dostroke (tGPsdata *p, int mval[], int mvalo[], sho
}
#endif
else {
+ if(p->subrect == NULL) { /* normal 3D view */
x0= (int)(gps->points->x / 100 * p->ar->winx);
y0= (int)(gps->points->y / 100 * p->ar->winy);
}
+ else { /* camera view, use subrect */
+ x0= (int)((gps->points->x / 100) * (p->subrect->xmax - p->subrect->xmin)) + p->subrect->xmin;
+ y0= (int)((gps->points->y / 100) * (p->subrect->ymax - p->subrect->ymin)) + p->subrect->ymin;
+ }
+ }
/* do boundbox check first */
if (BLI_in_rcti(rect, x0, y0)) {
@@ -761,11 +776,19 @@ static void gp_stroke_eraser_dostroke (tGPsdata *p, int mval[], int mvalo[], sho
}
#endif
else {
+ if(p->subrect == NULL) { /* normal 3D view */
x0= (int)(pt1->x / 100 * p->ar->winx);
y0= (int)(pt1->y / 100 * p->ar->winy);
x1= (int)(pt2->x / 100 * p->ar->winx);
y1= (int)(pt2->y / 100 * p->ar->winy);
}
+ else { /* camera view, use subrect */
+ x0= (int)((pt1->x / 100) * (p->subrect->xmax - p->subrect->xmin)) + p->subrect->xmin;
+ y0= (int)((pt1->y / 100) * (p->subrect->ymax - p->subrect->ymin)) + p->subrect->ymin;
+ x1= (int)((pt2->x / 100) * (p->subrect->xmax - p->subrect->xmin)) + p->subrect->xmin;
+ y1= (int)((pt2->y / 100) * (p->subrect->ymax - p->subrect->ymin)) + p->subrect->ymin;
+ }
+ }
/* check that point segment of the boundbox of the eraser stroke */
if (BLI_in_rcti(rect, x0, y0) || BLI_in_rcti(rect, x1, y1)) {
@@ -849,7 +872,8 @@ static tGPsdata *gp_session_initpaint (bContext *C)
/* supported views first */
case SPACE_VIEW3D:
{
- //View3D *v3d= curarea->spacedata.first;
+ View3D *v3d= curarea->spacedata.first;
+ RegionView3D *rv3d= ar->regiondata;
/* set current area
* - must verify that region data is 3D-view (and not something else)
@@ -864,6 +888,12 @@ static tGPsdata *gp_session_initpaint (bContext *C)
return p;
}
+ /* for camera view set the subrect */
+ if(rv3d->persp == RV3D_CAMOB) {
+ view3d_calc_camera_border(p->scene, p->ar, NULL, v3d, &p->subrect_data);
+ p->subrect= &p->subrect_data;
+ }
+
#if 0 // XXX will this sort of antiquated stuff be restored?
/* check that gpencil data is allowed to be drawn */
if ((v3d->flag2 & V3D_DISPGP)==0) {
diff --git a/source/blender/editors/include/ED_gpencil.h b/source/blender/editors/include/ED_gpencil.h
index 0003cea8147..6c5a0cc3bf3 100644
--- a/source/blender/editors/include/ED_gpencil.h
+++ b/source/blender/editors/include/ED_gpencil.h
@@ -72,7 +72,7 @@ void ED_operatortypes_gpencil(void);
void draw_gpencil_2dimage(struct bContext *C, struct ImBuf *ibuf);
void draw_gpencil_view2d(struct bContext *C, short onlyv2d);
void draw_gpencil_view3d(struct bContext *C, short only3d);
-void draw_gpencil_view3d_ext(struct Scene *scene, struct ARegion *ar, short only3d);
+void draw_gpencil_view3d_ext(struct Scene *scene, struct View3D *v3d, struct ARegion *ar, short only3d);
void gpencil_panel_standard(const struct bContext *C, struct Panel *pa);
diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h
index ff7ce874303..c898b8b99c3 100644
--- a/source/blender/editors/include/ED_mesh.h
+++ b/source/blender/editors/include/ED_mesh.h
@@ -194,85 +194,9 @@ void ED_keymap_mesh(struct wmKeyConfig *keyconf);
void ED_spacetypes_init(void);
void ED_keymap_mesh(struct wmKeyConfig *keyconf);
-
-struct EditMesh *make_editMesh(struct Scene *scene, struct Object *ob);
-void load_editMesh(struct Scene *scene, struct Object *ob, struct EditMesh *em);
-void remake_editMesh(struct Scene *scene, struct Object *ob);
-void free_editMesh(struct EditMesh *em);
-
-void recalc_editnormals(struct EditMesh *em);
-
-void EM_init_index_arrays(struct EditMesh *em, int forVert, int forEdge, int forFace);
-void EM_free_index_arrays(void);
-struct EditVert *EM_get_vert_for_index(int index);
-struct EditEdge *EM_get_edge_for_index(int index);
-struct EditFace *EM_get_face_for_index(int index);
-int EM_texFaceCheck(struct EditMesh *em);
-int EM_vertColorCheck(struct EditMesh *em);
-
-void undo_push_mesh(struct bContext *C, char *name);
-
-
-/* editmesh_lib.c */
-
-struct EditFace *EM_get_actFace(struct EditMesh *em, int sloppy);
-void EM_set_actFace(struct EditMesh *em, struct EditFace *efa);
-float EM_face_area(struct EditFace *efa);
-void EM_add_data_layer(struct EditMesh *em, struct CustomData *data, int type);
-
-void EM_select_edge(struct EditEdge *eed, int sel);
-void EM_select_face(struct EditFace *efa, int sel);
-void EM_select_face_fgon(struct EditMesh *em, struct EditFace *efa, int val);
-void EM_select_swap(struct EditMesh *em);
-void EM_toggle_select_all(struct EditMesh *em);
-void EM_select_all(struct EditMesh *em);
-void EM_deselect_all(struct EditMesh *em);
-void EM_selectmode_flush(struct EditMesh *em);
-void EM_deselect_flush(struct EditMesh *em);
-void EM_selectmode_set(struct EditMesh *em);
-void EM_select_flush(struct EditMesh *em);
-void EM_convertsel(struct EditMesh *em, short oldmode, short selectmode);
-void EM_validate_selections(struct EditMesh *em);
-void EM_selectmode_to_scene(struct Scene *scene, struct Object *obedit);
-
- /* exported to transform */
-int EM_get_actSelection(struct EditMesh *em, struct EditSelection *ese);
-void EM_editselection_normal(float *normal, struct EditSelection *ese);
-void EM_editselection_plane(float *plane, struct EditSelection *ese);
-void EM_editselection_center(float *center, struct EditSelection *ese);
-
-struct UvVertMap *EM_make_uv_vert_map(struct EditMesh *em, int selected, int do_face_idx_array, float *limit);
-struct UvMapVert *EM_get_uv_map_vert(struct UvVertMap *vmap, unsigned int v);
-void EM_free_uv_vert_map(struct UvVertMap *vmap);
-
-void EM_make_hq_normals(struct EditMesh *em);
-void EM_solidify(struct EditMesh *em, float dist);
-
-int EM_deselect_nth(struct EditMesh *em, int nth);
-
-/* editmesh_mods.c */
+/* bmesh_mods.c */
extern unsigned int bm_vertoffs, bm_solidoffs, bm_wireoffs;
-void EM_cache_x_mirror_vert(struct Object *ob, struct EditMesh *em);
-int mouse_mesh(struct bContext *C, short mval[2], short extend);
-int EM_check_backbuf(unsigned int index);
-int EM_mask_init_backbuf_border(struct ViewContext *vc, short mcords[][2], short tot, short xmin, short ymin, short xmax, short ymax);
-void EM_free_backbuf(void);
-int EM_init_backbuf_border(struct ViewContext *vc, short xmin, short ymin, short xmax, short ymax);
-int EM_init_backbuf_circle(struct ViewContext *vc, short xs, short ys, short rads);
-
-void EM_hide_mesh(struct EditMesh *em, int swap);
-void EM_reveal_mesh(struct EditMesh *em);
-
-void EM_automerge(struct Scene *scene, struct Object *obedit, int update);
-
-/* editface.c */
-struct MTFace *EM_get_active_mtface(struct EditMesh *em, struct EditFace **act_efa, struct MCol **mcol, int sloppy);
-int face_select(struct bContext *C, struct Object *ob, short mval[2], int extend);
-void face_borderselect(struct bContext *C, struct Object *ob, struct rcti *rect, int select, int extend);
-void selectall_tface(struct Object *ob, int action);
-void select_linked_tfaces(struct bContext *C, struct Object *ob, short mval[2], int mode);
-int minmax_tface(struct Scene *sce, float *min, float *max);
/* object_vgroup.c */
@@ -306,25 +230,20 @@ struct BMVert *EDBM_findnearestvert(struct ViewContext *vc, int *dist, short sel
struct BMEdge *EDBM_findnearestedge(struct ViewContext *vc, int *dist);
struct BMFace *EDBM_findnearestface(struct ViewContext *vc, int *dist);
-/*needed by edge slide*/
-struct EditVert *editedge_getOtherVert(struct EditEdge *eed, struct EditVert *eve);
-struct EditVert *editedge_getSharedVert(struct EditEdge *eed, struct EditEdge *eed2);
-int editedge_containsVert(struct EditEdge *eed, struct EditVert *eve);
-int editface_containsVert(struct EditFace *efa, struct EditVert *eve);
-int editface_containsEdge(struct EditFace *efa, struct EditEdge *eed);
-short sharesFace(struct EditMesh *em, struct EditEdge *e1, struct EditEdge *e2);
-
/* mesh_data.c */
+// void ED_mesh_geometry_add(struct Mesh *mesh, struct ReportList *reports, int verts, int edges, int faces);
+void ED_mesh_faces_add(struct Mesh *mesh, struct ReportList *reports, int count);
+void ED_mesh_edges_add(struct Mesh *mesh, struct ReportList *reports, int count);
+void ED_mesh_vertices_add(struct Mesh *mesh, struct ReportList *reports, int count);
-void ED_mesh_geometry_add(struct Mesh *mesh, struct ReportList *reports, int verts, int edges, int faces);
void ED_mesh_transform(struct Mesh *me, float *mat);
void ED_mesh_calc_normals(struct Mesh *me);
-void ED_mesh_material_add(struct Mesh *me, struct Material *ma);
+void ED_mesh_material_link(struct Mesh *me, struct Material *ma);
void ED_mesh_update(struct Mesh *mesh, struct bContext *C, int calc_edges);
-int ED_mesh_uv_texture_add(struct bContext *C, struct Scene *scene, struct Object *ob, struct Mesh *me);
+int ED_mesh_uv_texture_add(struct bContext *C, struct Scene *scene, struct Object *ob, struct Mesh *me, const char *name, int active_set);
int ED_mesh_uv_texture_remove(struct bContext *C, struct Object *ob, struct Mesh *me);
-int ED_mesh_color_add(struct bContext *C, struct Scene *scene, struct Object *ob, struct Mesh *me);
+int ED_mesh_color_add(struct bContext *C, struct Scene *scene, struct Object *ob, struct Mesh *me, const char *name, int active_set);
int ED_mesh_color_remove(struct bContext *C, struct Object *ob, struct Mesh *me);
#endif /* ED_MESH_H */
diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h
index 471ce965d4c..bd4791055e2 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -104,13 +104,14 @@ void viewline(struct ARegion *ar, struct View3D *v3d, float mval[2], float ray_s
void viewray(struct ARegion *ar, struct View3D *v3d, float mval[2], float ray_start[3], float ray_normal[3]);
int get_view3d_cliprange(struct View3D *v3d, struct RegionView3D *rv3d, float *clipsta, float *clipend);
-int get_view3d_viewplane(struct View3D *v3d, struct RegionView3D *rv3d, int winxi, int winyi, rctf *viewplane, float *clipsta, float *clipend, float *pixsize);
+int get_view3d_viewplane(struct View3D *v3d, struct RegionView3D *rv3d, int winxi, int winyi, struct rctf *viewplane, float *clipsta, float *clipend, float *pixsize);
int get_view3d_ortho(struct View3D *v3d, struct RegionView3D *rv3d);
void view3d_get_object_project_mat(struct RegionView3D *v3d, struct Object *ob, float pmat[4][4]);
/* computes screen x/y in vec */
void view3d_project_float(struct ARegion *a, float *vec, float *adr, float mat[4][4]);
/* computes z, as well as x and y */
void view3d_project_float_v3(struct ARegion *a, float *vec, float *adr, float mat[4][4]);
+void view3d_calc_camera_border(struct Scene *scene, struct ARegion *ar, struct RegionView3D *rv3d, struct View3D *v3d, struct rctf *viewborder_r);
/* drawobject.c itterators */
void mesh_foreachScreenVert(struct ViewContext *vc, void (*func)(void *userData, struct BMVert *eve, int x, int y, int index), void *userData, int clipVerts);
@@ -165,8 +166,8 @@ int ED_view3d_context_activate(struct bContext *C);
void ED_view3d_draw_offscreen(struct Scene *scene, struct View3D *v3d, struct ARegion *ar,
int winx, int winy, float viewmat[][4], float winmat[][4]);
-struct ImBuf *ED_view3d_draw_offscreen_imbuf(struct Scene *scene, struct View3D *v3d, struct ARegion *ar, int sizex, int sizey);
-struct ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, int width, int height, int drawtype);
+struct ImBuf *ED_view3d_draw_offscreen_imbuf(struct Scene *scene, struct View3D *v3d, struct ARegion *ar, int sizex, int sizey, unsigned int flag);
+struct ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, int width, int height, unsigned int flag, int drawtype);
void view3d_clipping_local(struct RegionView3D *rv3d, float mat[][4]);
diff --git a/source/blender/editors/include/UI_icons.h b/source/blender/editors/include/UI_icons.h
index 6a139b124a6..3e8420df7eb 100644
--- a/source/blender/editors/include/UI_icons.h
+++ b/source/blender/editors/include/UI_icons.h
@@ -345,8 +345,8 @@ DEF_ICON(ICON_MESH_UVSPHERE)
DEF_ICON(ICON_MESH_ICOSPHERE)
DEF_ICON(ICON_MESH_GRID)
DEF_ICON(ICON_MESH_MONKEY)
-DEF_ICON(ICON_MESH_TUBE)
-DEF_ICON(ICON_MESH_DONUT)
+DEF_ICON(ICON_MESH_CYLINDER)
+DEF_ICON(ICON_MESH_TORUS)
DEF_ICON(ICON_MESH_CONE)
DEF_ICON(ICON_BLANK610)
DEF_ICON(ICON_BLANK611)
@@ -362,16 +362,16 @@ DEF_ICON(ICON_META_PLANE)
DEF_ICON(ICON_META_CUBE)
DEF_ICON(ICON_META_BALL)
DEF_ICON(ICON_META_ELLIPSOID)
-DEF_ICON(ICON_META_TUBE)
+DEF_ICON(ICON_META_CAPSULE)
DEF_ICON(ICON_BLANK625)
/* PRIMITIVES */
DEF_ICON(ICON_SURFACE_NCURVE)
DEF_ICON(ICON_SURFACE_NCIRCLE)
DEF_ICON(ICON_SURFACE_NSURFACE)
-DEF_ICON(ICON_SURFACE_NTUBE)
+DEF_ICON(ICON_SURFACE_NCYLINDER)
DEF_ICON(ICON_SURFACE_NSPHERE)
-DEF_ICON(ICON_SURFACE_NDONUT)
+DEF_ICON(ICON_SURFACE_NTORUS)
DEF_ICON(ICON_BLANK636)
DEF_ICON(ICON_BLANK637)
DEF_ICON(ICON_BLANK638)
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index b126c6235d5..40985a918d4 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -135,7 +135,7 @@ typedef struct uiLayout uiLayout;
#define UI_MAKE_RIGHT 8192
/* button align flag, for drawing groups together */
-#define UI_BUT_ALIGN (15<<14)
+#define UI_BUT_ALIGN (UI_BUT_ALIGN_TOP|UI_BUT_ALIGN_LEFT|UI_BUT_ALIGN_RIGHT|UI_BUT_ALIGN_DOWN)
#define UI_BUT_ALIGN_TOP (1<<14)
#define UI_BUT_ALIGN_LEFT (1<<15)
#define UI_BUT_ALIGN_RIGHT (1<<16)
@@ -151,9 +151,10 @@ typedef struct uiLayout uiLayout;
#define UI_BUT_UNDO (1<<25)
#define UI_BUT_IMMEDIATE (1<<26)
#define UI_BUT_NO_TOOLTIP (1<<27)
+#define UI_BUT_NO_UTF8 (1<<28)
-#define UI_BUT_VEC_SIZE_LOCK (1<<28) /* used to flag if color hsv-circle should keep luminance */
-#define UI_BUT_COLOR_CUBIC (1<<29) /* cubic saturation for the color wheel */
+#define UI_BUT_VEC_SIZE_LOCK (1<<29) /* used to flag if color hsv-circle should keep luminance */
+#define UI_BUT_COLOR_CUBIC (1<<30) /* cubic saturation for the color wheel */
#define UI_PANEL_WIDTH 340
#define UI_COMPACT_PANEL_WIDTH 160
@@ -687,7 +688,6 @@ void uiTemplateWaveform(uiLayout *layout, struct PointerRNA *ptr, char *propname
void uiTemplateVectorscope(uiLayout *layout, struct PointerRNA *ptr, char *propname, int expand);
void uiTemplateCurveMapping(uiLayout *layout, struct PointerRNA *ptr, char *propname, int type, int levels, int brush);
void uiTemplateColorWheel(uiLayout *layout, struct PointerRNA *ptr, char *propname, int value_slider, int lock, int lock_luminosity, int cubic);
-void uiTemplateTriColorSet(uiLayout *layout, struct PointerRNA *ptr, char *propname);
void uiTemplateLayers(uiLayout *layout, struct PointerRNA *ptr, char *propname,
PointerRNA *used_ptr, char *used_propname, int active_layer);
void uiTemplateImage(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, char *propname, struct PointerRNA *userptr, int compact);
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 4c86b9480d4..021dcc940e6 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -1765,9 +1765,11 @@ static void ui_free_but(const bContext *C, uiBut *but)
}
if(but->func_argN) MEM_freeN(but->func_argN);
if(but->active) {
- /* XXX solve later, buttons should be free-able without context? */
+ /* XXX solve later, buttons should be free-able without context ideally,
+ however they may have open tooltips or popup windows, which need to
+ be closed using a context pointer */
if(C)
- ui_button_active_cancel(C, but);
+ ui_button_active_free(C, but);
else
if(but->active)
MEM_freeN(but->active);
@@ -2528,8 +2530,10 @@ uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, char *str, short x1,
}
}
}
- else
+ else {
+ printf("ui_def_but_rna: property not found: %s.%s\n", RNA_struct_identifier(ptr->type), propname);
str= (char*)propname;
+ }
/* now create button */
but= ui_def_but(block, type, retval, str, x1, y1, x2, y2, NULL, min, max, a1, a2, tip);
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 9d99409a741..9b3b194d74b 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -242,6 +242,20 @@ static int ui_is_a_warp_but(uiBut *but)
return FALSE;
}
+/* file selectors are exempt from utf-8 checks */
+static int ui_is_utf8_but(uiBut *but)
+{
+ if (but->rnaprop) {
+ int subtype= RNA_property_subtype(but->rnaprop);
+
+ if(ELEM3(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME)) {
+ return TRUE;
+ }
+ }
+
+ return !(but->flag & UI_BUT_NO_UTF8);
+}
+
/* ********************** button apply/revert ************************/
static ListBase UIAfterFuncs = {NULL, NULL};
@@ -1572,6 +1586,15 @@ static void ui_textedit_begin(bContext *C, uiBut *but, uiHandleButtonData *data)
static void ui_textedit_end(bContext *C, uiBut *but, uiHandleButtonData *data)
{
if(but) {
+ if(ui_is_utf8_but(but)) {
+ int strip= BLI_utf8_invalid_strip(but->editstr, strlen(but->editstr));
+ /* not a file?, strip non utf-8 chars */
+ if(strip) {
+ /* wont happen often so isnt that annoying to keep it here for a while */
+ printf("invalid utf8 - stripped chars %d\n", strip);
+ }
+ }
+
if(data->searchbox) {
if(data->cancel==0)
ui_searchbox_apply(but, data->searchbox);
@@ -4777,7 +4800,7 @@ static void button_activate_init(bContext *C, ARegion *ar, uiBut *but, uiButtonA
button_activate_state(C, but, BUTTON_STATE_WAIT_FLASH);
}
-static void button_activate_exit(bContext *C, uiHandleButtonData *data, uiBut *but, int mousemove)
+static void button_activate_exit(bContext *C, uiHandleButtonData *data, uiBut *but, int mousemove, int onfree)
{
uiBlock *block= but->block;
uiBut *bt;
@@ -4787,6 +4810,7 @@ static void button_activate_exit(bContext *C, uiHandleButtonData *data, uiBut *b
button_activate_state(C, but, BUTTON_STATE_EXIT);
/* apply the button action or value */
+ if(!onfree)
ui_apply_button(C, block, but, data, 0);
/* if this button is in a menu, this will set the button return
@@ -4802,7 +4826,7 @@ static void button_activate_exit(bContext *C, uiHandleButtonData *data, uiBut *b
}
}
- if(!data->cancel) {
+ if(!onfree && !data->cancel) {
/* autokey & undo push */
ui_apply_autokey_undo(C, but);
@@ -4835,6 +4859,7 @@ static void button_activate_exit(bContext *C, uiHandleButtonData *data, uiBut *b
but->active= NULL;
but->flag &= ~(UI_ACTIVE|UI_SELECT);
but->flag |= UI_BUT_LAST_ACTIVE;
+ if(!onfree)
ui_check_but(but);
/* adds empty mousemove in queue for re-init handler, in case mouse is
@@ -4844,7 +4869,7 @@ static void button_activate_exit(bContext *C, uiHandleButtonData *data, uiBut *b
WM_event_add_mousemove(C);
}
-void ui_button_active_cancel(const bContext *C, uiBut *but)
+void ui_button_active_free(const bContext *C, uiBut *but)
{
uiHandleButtonData *data;
@@ -4854,7 +4879,7 @@ void ui_button_active_cancel(const bContext *C, uiBut *but)
if(but->active) {
data= but->active;
data->cancel= 1;
- button_activate_exit((bContext*)C, data, but, 0);
+ button_activate_exit((bContext*)C, data, but, 0, 1);
}
}
@@ -4920,7 +4945,7 @@ static void ui_handle_button_activate(bContext *C, ARegion *ar, uiBut *but, uiBu
if(oldbut) {
data= oldbut->active;
data->cancel= 1;
- button_activate_exit(C, data, oldbut, 0);
+ button_activate_exit(C, data, oldbut, 0, 0);
}
button_activate_init(C, ar, but, type);
@@ -5078,7 +5103,7 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but)
postbut= data->postbut;
posttype= data->posttype;
- button_activate_exit(C, data, but, (postbut == NULL));
+ button_activate_exit(C, data, but, (postbut == NULL), 0);
/* for jumping to the next button with tab while text editing */
if(postbut)
@@ -5182,7 +5207,7 @@ static void ui_handle_button_return_submenu(bContext *C, wmEvent *event, uiBut *
if(menu->menuretval != UI_RETURN_OK)
data->cancel= 1;
- button_activate_exit(C, data, but, 1);
+ button_activate_exit(C, data, but, 1, 0);
}
else if(menu->menuretval == UI_RETURN_OUT) {
if(event->type==MOUSEMOVE && ui_mouse_inside_button(data->region, but, event->x, event->y)) {
@@ -5196,7 +5221,7 @@ static void ui_handle_button_return_submenu(bContext *C, wmEvent *event, uiBut *
}
else {
data->cancel= 1;
- button_activate_exit(C, data, but, 1);
+ button_activate_exit(C, data, but, 1, 0);
}
}
}
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index cb8130573fe..84d6605651b 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -456,7 +456,7 @@ void ui_draw_but_IMAGE(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, rct
/* interface_handlers.c */
extern void ui_button_activate_do(struct bContext *C, struct ARegion *ar, uiBut *but);
-extern void ui_button_active_cancel(const struct bContext *C, uiBut *but);
+extern void ui_button_active_free(const struct bContext *C, uiBut *but);
extern int ui_button_is_active(struct ARegion *ar);
/* interface_widgets.c */
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 4b522c9ddcb..45ebc9bf136 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -69,68 +69,6 @@ void uiTemplateHeader(uiLayout *layout, bContext *C, int menus)
else ED_area_header_switchbutton(C, block, 0);
}
-/********************** DopeSheet Filter Template *************************/
-
-void uiTemplateDopeSheetFilter(uiLayout *layout, bContext *C, PointerRNA *ptr)
-{
- Main *mainptr= CTX_data_main(C);
- ScrArea *sa= CTX_wm_area(C);
- uiLayout *row= layout;
- short nlaActive= ((sa) && (sa->spacetype==SPACE_NLA));
-
- /* most 'generic' filtering options */
- row= uiLayoutRow(layout, 1);
-
- uiItemR(row, ptr, "show_only_selected", 0, "", 0);
- uiItemR(row, ptr, "show_hidden", 0, "", 0);
-
- /* object-level filtering options */
- row= uiLayoutRow(layout, 1);
- uiItemR(row, ptr, "show_transforms", 0, "", 0);
-
- if (nlaActive)
- uiItemR(row, ptr, "show_missing_nla", 0, "", 0);
-
- /* datatype based - only available datatypes are shown */
- row= uiLayoutRow(layout, 1);
-
- uiItemR(row, ptr, "show_scenes", 0, "", 0);
- uiItemR(row, ptr, "show_worlds", 0, "", 0);
- uiItemR(row, ptr, "show_nodes", 0, "", 0);
-
- if (mainptr && mainptr->mesh.first)
- uiItemR(row, ptr, "show_meshes", 0, "", 0);
- if (mainptr && mainptr->key.first)
- uiItemR(row, ptr, "show_shapekeys", 0, "", 0);
- if (mainptr && mainptr->mat.first)
- uiItemR(row, ptr, "show_materials", 0, "", 0);
- if (mainptr && mainptr->lamp.first)
- uiItemR(row, ptr, "show_lamps", 0, "", 0);
- if (mainptr && mainptr->tex.first)
- uiItemR(row, ptr, "show_textures", 0, "", 0);
- if (mainptr && mainptr->camera.first)
- uiItemR(row, ptr, "show_cameras", 0, "", 0);
- if (mainptr && mainptr->curve.first)
- uiItemR(row, ptr, "show_curves", 0, "", 0);
- if (mainptr && mainptr->mball.first)
- uiItemR(row, ptr, "show_metaballs", 0, "", 0);
- if (mainptr && mainptr->armature.first)
- uiItemR(row, ptr, "show_armatures", 0, "", 0);
- if (mainptr && mainptr->particle.first)
- uiItemR(row, ptr, "show_particles", 0, "", 0);
-
- /* group-based filtering (only when groups are available */
- if (mainptr && mainptr->group.first) {
- row= uiLayoutRow(layout, 1);
-
- uiItemR(row, ptr, "show_only_group_objects", 0, "", 0);
-
- /* if enabled, show the group selection field too */
- if (RNA_boolean_get(ptr, "show_only_group_objects"))
- uiItemR(row, ptr, "filter_group", 0, "", 0);
- }
-}
-
/********************** Search Callbacks *************************/
typedef struct TemplateID {
@@ -1884,31 +1822,6 @@ void uiTemplateColorWheel(uiLayout *layout, PointerRNA *ptr, char *propname, int
uiDefButR(block, HSVCUBE, 0, "", WHEEL_SIZE+6, 0, 14, WHEEL_SIZE, ptr, propname, -1, softmin, softmax, 9, 0, "");
}
-
-/********************* TriColor (ThemeWireColorSet) Template ************************/
-
-void uiTemplateTriColorSet(uiLayout *layout, PointerRNA *ptr, char *propname)
-{
- PropertyRNA *prop= RNA_struct_find_property(ptr, propname);
- uiLayout *row;
- PointerRNA csPtr;
-
- if (!prop) {
- printf("uiTemplateTriColorSet: property not found: %s.%s\n", RNA_struct_identifier(ptr->type), propname);
- return;
- }
-
- /* we lay out the data in a row as 3 color swatches */
- row= uiLayoutRow(layout, 1);
-
- /* nselected, selected, active color swatches */
- csPtr= RNA_property_pointer_get(ptr, prop);
-
- uiItemR(row, &csPtr, "normal", 0, "", 0);
- uiItemR(row, &csPtr, "select", 0, "", 0);
- uiItemR(row, &csPtr, "active", 0, "", 0);
-}
-
/********************* Layer Buttons Template ************************/
static void handle_layer_buttons(bContext *C, void *arg1, void *arg2)
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 6b7d88d3c28..539be96c4ce 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -1638,6 +1638,10 @@ void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect)
float centx, centy, radius;
float rgb[3], hsv[3], hsvo[3], col[3], colcent[3];
int a, tot= 32;
+ int color_profile = but->block->color_profile;
+
+ if (but->rnaprop && RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA)
+ color_profile = BLI_PR_NONE;
radstep= 2.0f*M_PI/(float)tot;
centx= (float)(rect->xmin + rect->xmax)/2;
@@ -1656,7 +1660,10 @@ void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect)
/* exception: if 'lock' is set
* lock the value of the color wheel to 1.
* Useful for color correction tools where you're only interested in hue. */
- if (but->flag & UI_BUT_COLOR_LOCK) hsv[2] = 1.f;
+ if (but->flag & UI_BUT_COLOR_LOCK)
+ hsv[2] = 1.f;
+ else if (color_profile)
+ hsv[2] = linearrgb_to_srgb(hsv[2]);
hsv_to_rgb(0.f, 0.f, hsv[2], colcent, colcent+1, colcent+2);
@@ -1884,11 +1891,8 @@ static void ui_draw_but_HSV_v(uiBut *but, rcti *rect)
float rgb[3], hsv[3], v, range;
int color_profile = but->block->color_profile;
- if (but->rnaprop) {
- if (RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA) {
+ if (but->rnaprop && RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA)
color_profile = BLI_PR_NONE;
- }
- }
ui_get_but_vectorf(but, rgb);
rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index 227f3a4de1d..1661cf73d53 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -1006,6 +1006,10 @@ void init_userdef_do_versions(void)
strcpy(U.tempdir, tmp?tmp:"/tmp/");
}
+ if (U.autokey_mode == 0) {
+ /* 'add/replace' but not on */
+ U.autokey_mode = 2;
+ }
if (U.savetime <= 0) {
U.savetime = 1;
// XXX error("startup.blend is buggy, please consider removing it.\n");
diff --git a/source/blender/editors/mesh/editbmesh_add.c b/source/blender/editors/mesh/editbmesh_add.c
index 20bd2d3d82b..9a9a49b25e0 100644
--- a/source/blender/editors/mesh/editbmesh_add.c
+++ b/source/blender/editors/mesh/editbmesh_add.c
@@ -284,7 +284,7 @@ void MESH_OT_primitive_circle_add(wmOperatorType *ot)
ED_object_add_generic_props(ot, TRUE);
}
-static int add_primitive_tube_exec(bContext *C, wmOperator *op)
+static int add_primitive_cylinder_exec(bContext *C, wmOperator *op)
{
Object *obedit;
Mesh *me;
@@ -310,7 +310,7 @@ static int add_primitive_tube_exec(bContext *C, wmOperator *op)
make_prim_finish(C, &state, enter_editmode);
}
-void MESH_OT_primitive_tube_add(wmOperatorType *ot)
+void MESH_OT_primitive_cylinder_add(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Add Tube";
@@ -319,7 +319,7 @@ void MESH_OT_primitive_tube_add(wmOperatorType *ot)
/* api callbacks */
ot->invoke= ED_object_add_generic_invoke;
- ot->exec= add_primitive_tube_exec;
+ ot->exec= add_primitive_cylinder_exec;
ot->poll= ED_operator_scene_editable;
/* flags */
diff --git a/source/blender/editors/mesh/loopcut.c b/source/blender/editors/mesh/loopcut.c
index 68ef56ad3ab..282ed48a476 100644
--- a/source/blender/editors/mesh/loopcut.c
+++ b/source/blender/editors/mesh/loopcut.c
@@ -292,6 +292,8 @@ static void ringsel_finish(bContext *C, wmOperator *op)
em->selectmode &= ~SCE_SELECT_FACE;
CTX_data_tool_settings(C)->selectmode= em->selectmode;
EDBM_selectmode_set(em);
+
+ WM_event_add_notifier(C, NC_SCENE|ND_TOOLSETTINGS, CTX_data_scene(C));
}
WM_event_add_notifier(C, NC_GEOM|ND_SELECT|ND_DATA, lcd->ob->data);
diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c
index 80dc5331cf8..8e95356f748 100644
--- a/source/blender/editors/mesh/mesh_data.c
+++ b/source/blender/editors/mesh/mesh_data.c
@@ -163,7 +163,7 @@ static void delete_customdata_layer(bContext *C, Object *ob, CustomDataLayer *la
}
}
-int ED_mesh_uv_texture_add(bContext *C, Scene *scene, Object *ob, Mesh *me)
+int ED_mesh_uv_texture_add(bContext *C, Scene *scene, Object *ob, Mesh *me, const char *name, int active_set)
{
BMEditMesh *em;
int layernum;
@@ -173,22 +173,26 @@ int ED_mesh_uv_texture_add(bContext *C, Scene *scene, Object *ob, Mesh *me)
layernum= CustomData_number_of_layers(&em->bm->pdata, CD_MTEXPOLY);
if(layernum >= MAX_MTFACE)
- return OPERATOR_CANCELLED;
+ return 0;
- BM_add_data_layer(em->bm, &em->bm->pdata, MAX_MTFACE);
- CustomData_set_layer_active(&em->bm->pdata, MAX_MTFACE, layernum);
+ BM_add_data_layer(em->bm, &em->bm->pdata, CD_MTEXPOLY);
+ CustomData_set_layer_active(&em->bm->pdata, CD_MTEXPOLY, layernum);
+ if(active_set || layernum==0)
+ CustomData_set_layer_active(&em->bm->pdata, CD_MTEXPOLY, layernum);
}
else {
layernum= CustomData_number_of_layers(&me->pdata, MAX_MTFACE);
if(layernum >= MAX_MTFACE)
- return OPERATOR_CANCELLED;
+ return 0;
if(me->mtface)
- CustomData_add_layer(&me->pdata, MAX_MTFACE, CD_DUPLICATE, me->mtpoly, me->totpoly);
+ CustomData_add_layer_named(&me->pdata, CD_MTEXPOLY, CD_DUPLICATE, me->mtpoly, me->totpoly, name);
else
- CustomData_add_layer(&me->pdata, MAX_MTFACE, CD_DEFAULT, NULL, me->totpoly);
+ CustomData_add_layer_named(&me->pdata, CD_MTEXPOLY, CD_DEFAULT, NULL, me->totpoly, name);
+
+ if(active_set || layernum==0)
+ CustomData_set_layer_active(&me->pdata, CD_MTEXPOLY, layernum);
- CustomData_set_layer_active(&me->pdata, MAX_MTFACE, layernum);
mesh_update_customdata_pointers(me);
}
@@ -216,7 +220,7 @@ int ED_mesh_uv_texture_remove(bContext *C, Object *ob, Mesh *me)
return 1;
}
-int ED_mesh_color_add(bContext *C, Scene *scene, Object *ob, Mesh *me)
+int ED_mesh_color_add(bContext *C, Scene *scene, Object *ob, Mesh *me, const char *name, int active_set)
{
BMEditMesh *em;
MLoopCol *mcol;
@@ -231,6 +235,10 @@ int ED_mesh_color_add(bContext *C, Scene *scene, Object *ob, Mesh *me)
BM_add_data_layer(em->bm, &em->bm->pdata, CD_MLOOPCOL);
CustomData_set_layer_active(&em->bm->ldata, CD_MLOOPCOL, layernum);
+
+ if(active_set || layernum==0)
+ CustomData_set_layer_active(&em->bm->ldata, CD_MLOOPCOL, layernum);
+
}
else {
layernum= CustomData_number_of_layers(&me->ldata, CD_MLOOPCOL);
@@ -240,11 +248,13 @@ int ED_mesh_color_add(bContext *C, Scene *scene, Object *ob, Mesh *me)
mcol= me->mloopcol;
if(me->mloopcol)
- CustomData_add_layer(&me->ldata, CD_MLOOPCOL, CD_DUPLICATE, me->mloopcol, me->totloop);
+ CustomData_add_layer_named(&me->ldata, CD_MLOOPCOL, CD_DUPLICATE, me->mloopcol, me->totloop, name);
else
- CustomData_add_layer(&me->ldata, CD_MLOOPCOL, CD_DEFAULT, NULL, me->totloop);
+ CustomData_add_layer_named(&me->ldata, CD_MLOOPCOL, CD_DEFAULT, NULL, me->totloop, name);
+
+ if(active_set || layernum==0)
+ CustomData_set_layer_active(&me->ldata, CD_MLOOPCOL, layernum);
- CustomData_set_layer_active(&me->ldata, CD_MLOOPCOL, layernum);
mesh_update_customdata_pointers(me);
/*BMESH_TODO
@@ -292,7 +302,7 @@ static int uv_texture_add_exec(bContext *C, wmOperator *op)
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
Mesh *me= ob->data;
- if(!ED_mesh_uv_texture_add(C, scene, ob, me))
+ if(!ED_mesh_uv_texture_add(C, scene, ob, me, NULL, TRUE))
return OPERATOR_CANCELLED;
return OPERATOR_FINISHED;
@@ -426,7 +436,7 @@ static int vertex_color_add_exec(bContext *C, wmOperator *op)
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
Mesh *me= ob->data;
- if(!ED_mesh_color_add(C, scene, ob, me))
+ if(!ED_mesh_color_add(C, scene, ob, me, NULL, TRUE))
return OPERATOR_CANCELLED;
return OPERATOR_FINISHED;
@@ -721,6 +731,7 @@ static void mesh_add_faces(Mesh *mesh, int len)
mesh->totface= totface;
}
+/*
void ED_mesh_geometry_add(Mesh *mesh, ReportList *reports, int verts, int edges, int faces)
{
if(mesh->edit_btmesh) {
@@ -735,33 +746,39 @@ void ED_mesh_geometry_add(Mesh *mesh, ReportList *reports, int verts, int edges,
if(faces)
mesh_add_faces(mesh, faces);
}
+*/
-void ED_mesh_calc_normals(Mesh *me)
+void ED_mesh_faces_add(Mesh *mesh, ReportList *reports, int count)
{
- mesh_calc_normals(me->mvert, me->totvert, me->mface, me->totface, NULL);
+ if(mesh->edit_btmesh) {
+ BKE_report(reports, RPT_ERROR, "Can't add faces in edit mode.");
+ return;
}
-void ED_mesh_material_add(Mesh *me, Material *ma)
-{
- int i;
- int totcol = me->totcol + 1;
- Material **mat;
+ mesh_add_faces(mesh, count);
+}
- /* don't add if mesh already has it */
- for(i = 0; i < me->totcol; i++)
- if(me->mat[i] == ma)
+void ED_mesh_edges_add(Mesh *mesh, ReportList *reports, int count)
+{
+ if(mesh->edit_btmesh) {
+ BKE_report(reports, RPT_ERROR, "Can't add edges in edit mode.");
return;
+ }
- mat= MEM_callocN(sizeof(void*)*totcol, "newmatar");
-
- if(me->totcol) memcpy(mat, me->mat, sizeof(void*) * me->totcol);
- if(me->mat) MEM_freeN(me->mat);
+ mesh_add_edges(mesh, count);
+}
- me->mat = mat;
- me->mat[me->totcol++] = ma;
- if(ma)
- ma->id.us++;
+void ED_mesh_vertices_add(Mesh *mesh, ReportList *reports, int count)
+{
+ if(mesh->edit_btmesh) {
+ BKE_report(reports, RPT_ERROR, "Can't add vertices in edit mode.");
+ return;
+ }
- test_object_materials((ID*)me);
+ mesh_add_verts(mesh, count);
}
+void ED_mesh_calc_normals(Mesh *me)
+{
+ mesh_calc_normals(me->mvert, me->totvert, me->mface, me->totface, NULL);
+}
diff --git a/source/blender/editors/mesh/mesh_intern.h b/source/blender/editors/mesh/mesh_intern.h
index 271cd8a8524..28c72121d2f 100644
--- a/source/blender/editors/mesh/mesh_intern.h
+++ b/source/blender/editors/mesh/mesh_intern.h
@@ -127,7 +127,7 @@ void MESH_OT_separate(struct wmOperatorType *ot);
void MESH_OT_primitive_plane_add(struct wmOperatorType *ot);
void MESH_OT_primitive_cube_add(struct wmOperatorType *ot);
void MESH_OT_primitive_circle_add(struct wmOperatorType *ot);
-void MESH_OT_primitive_tube_add(struct wmOperatorType *ot);
+void MESH_OT_primitive_cylinder_add(struct wmOperatorType *ot);
void MESH_OT_primitive_cone_add(struct wmOperatorType *ot);
void MESH_OT_primitive_grid_add(struct wmOperatorType *ot);
void MESH_OT_primitive_monkey_add(struct wmOperatorType *ot);
diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c
index 648e4f04302..621f20144b5 100644
--- a/source/blender/editors/mesh/mesh_ops.c
+++ b/source/blender/editors/mesh/mesh_ops.c
@@ -75,7 +75,7 @@ void ED_operatortypes_mesh(void)
WM_operatortype_append(MESH_OT_primitive_plane_add);
WM_operatortype_append(MESH_OT_primitive_cube_add);
WM_operatortype_append(MESH_OT_primitive_circle_add);
- WM_operatortype_append(MESH_OT_primitive_tube_add);
+ WM_operatortype_append(MESH_OT_primitive_cylinder_add);
WM_operatortype_append(MESH_OT_primitive_cone_add);
WM_operatortype_append(MESH_OT_primitive_grid_add);
WM_operatortype_append(MESH_OT_primitive_monkey_add);
diff --git a/source/blender/editors/metaball/mball_edit.c b/source/blender/editors/metaball/mball_edit.c
index d097caac63d..62ebe84e078 100644
--- a/source/blender/editors/metaball/mball_edit.c
+++ b/source/blender/editors/metaball/mball_edit.c
@@ -45,6 +45,7 @@
#include "BKE_depsgraph.h"
#include "BKE_context.h"
+#include "BKE_mball.h"
#include "ED_screen.h"
#include "ED_view3d.h"
@@ -103,53 +104,11 @@ MetaElem *add_metaball_primitive(bContext *C, float mat[4][4], int type, int new
ml= ml->next;
}
- ml= MEM_callocN(sizeof(MetaElem), "metaelem");
-
- ml->x= mat[3][0];
- ml->y= mat[3][1];
- ml->z= mat[3][2];
- ml->quat[0]= 1.0;
- ml->quat[1]= 0.0;
- ml->quat[2]= 0.0;
- ml->quat[3]= 0.0;
- ml->rad= 2.0;
- ml->s= 2.0;
- ml->flag= SELECT | MB_SCALE_RAD;
-
- switch(type) {
- case MB_BALL:
- ml->type = MB_BALL;
- ml->expx= ml->expy= ml->expz= 1.0;
-
- break;
- case MB_TUBE:
- ml->type = MB_TUBE;
- ml->expx= ml->expy= ml->expz= 1.0;
-
- break;
- case MB_PLANE:
- ml->type = MB_PLANE;
- ml->expx= ml->expy= ml->expz= 1.0;
-
- break;
- case MB_ELIPSOID:
- ml->type = MB_ELIPSOID;
- ml->expx= 1.2f;
- ml->expy= 0.8f;
- ml->expz= 1.0;
-
- break;
- case MB_CUBE:
- ml->type = MB_CUBE;
- ml->expx= ml->expy= ml->expz= 1.0;
-
- break;
- default:
- break;
- }
-
+ ml= add_metaball_element(mball, type);
+ copy_v3_v3(&ml->x, mat[3]);
+
+ ml->flag |= SELECT;
mball->lastelem= ml;
-
return ml;
}
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index e60f9db79f6..e4b71368315 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -176,7 +176,7 @@ void ED_object_add_generic_props(wmOperatorType *ot, int do_editmode)
RNA_def_property_flag(prop, PROP_HIDDEN);
}
- RNA_def_float_vector(ot->srna, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location", "Location for the newly added object.", -FLT_MAX, FLT_MAX);
+ RNA_def_float_vector_xyz(ot->srna, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location", "Location for the newly added object.", -FLT_MAX, FLT_MAX);
RNA_def_float_rotation(ot->srna, "rotation", 3, NULL, -FLT_MAX, FLT_MAX, "Rotation", "Rotation for the newly added object", -FLT_MAX, FLT_MAX);
prop = RNA_def_boolean_layer_member(ot->srna, "layers", 20, NULL, "Layer", "");
@@ -256,7 +256,9 @@ int ED_object_add_generic_get_opts(bContext *C, wmOperator *op, float *loc, floa
if(v3d && v3d->localvd)
*layer |= v3d->lay;
- if (RNA_property_is_set(op->ptr, "view_align"))
+ if(RNA_property_is_set(op->ptr, "rotation"))
+ view_align = FALSE;
+ else if (RNA_property_is_set(op->ptr, "view_align"))
view_align = RNA_boolean_get(op->ptr, "view_align");
else
view_align = U.flag & USER_ADD_VIEWALIGNED;
@@ -303,6 +305,8 @@ Object *ED_object_add_type(bContext *C, int type, float *loc, float *rot, int en
if(enter_editmode)
ED_object_enter_editmode(C, EM_IGNORE_LAYER);
+ WM_event_add_notifier(C, NC_SCENE|ND_LAYER_CONTENT, scene);
+
return ob;
}
@@ -491,7 +495,7 @@ void OBJECT_OT_camera_add(wmOperatorType *ot)
static EnumPropertyItem prop_metaball_types[]= {
{MB_BALL, "MBALL_BALL", ICON_META_BALL, "Meta Ball", ""},
- {MB_TUBE, "MBALL_TUBE", ICON_META_TUBE, "Meta Tube", ""},
+ {MB_TUBE, "MBALL_CAPSULE", ICON_META_CAPSULE, "Meta Capsule", ""},
{MB_PLANE, "MBALL_PLANE", ICON_META_PLANE, "Meta Plane", ""},
{MB_CUBE, "MBALL_CUBE", ICON_META_CUBE, "Meta Cube", ""},
{MB_ELIPSOID, "MBALL_ELLIPSOID", ICON_META_ELLIPSOID, "Meta Ellipsoid", ""},
@@ -501,7 +505,6 @@ static EnumPropertyItem prop_metaball_types[]= {
static int object_metaball_add_exec(bContext *C, wmOperator *op)
{
Object *obedit= CTX_data_edit_object(C);
- MetaBall *mball;
MetaElem *elem;
int newob= 0;
int enter_editmode;
@@ -523,8 +526,6 @@ static int object_metaball_add_exec(bContext *C, wmOperator *op)
ED_object_new_primitive_matrix(C, obedit, loc, rot, mat);
elem= (MetaElem*)add_metaball_primitive(C, mat, RNA_enum_get(op->ptr, "type"), newob);
- mball= (MetaBall*)obedit->data;
- BLI_addtail(mball->editelems, elem);
/* userdef */
if (newob && !enter_editmode) {
@@ -826,7 +827,8 @@ static int object_delete_exec(bContext *C, wmOperator *op)
DAG_scene_sort(bmain, scene);
DAG_ids_flush_update(bmain, 0);
- WM_event_add_notifier(C, NC_SCENE|ND_OB_ACTIVE, CTX_data_scene(C));
+ WM_event_add_notifier(C, NC_SCENE|ND_OB_ACTIVE, scene);
+ WM_event_add_notifier(C, NC_SCENE|ND_LAYER_CONTENT, scene);
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index 8bbfce4dd99..4d70ae34e52 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -142,6 +142,7 @@ ModifierData *ED_object_modifier_add(ReportList *reports, Main *bmain, Scene *sc
int ED_object_modifier_remove(ReportList *reports, Main *bmain, Scene *scene, Object *ob, ModifierData *md)
{
ModifierData *obmd;
+ int sort_depsgraph = 0;
/* It seems on rapid delete it is possible to
* get called twice on same modifier, so make
@@ -174,13 +175,13 @@ int ED_object_modifier_remove(ReportList *reports, Main *bmain, Scene *scene, Ob
if(ob->pd)
ob->pd->deflect= 0;
- DAG_scene_sort(bmain, scene);
+ sort_depsgraph = 1;
}
else if(md->type == eModifierType_Surface) {
if(ob->pd && ob->pd->shape == PFIELD_SHAPE_SURFACE)
ob->pd->shape = PFIELD_SHAPE_PLANE;
- DAG_scene_sort(bmain, scene);
+ sort_depsgraph = 1;
}
else if(md->type == eModifierType_Smoke) {
ob->dt = OB_TEXTURE;
@@ -197,6 +198,10 @@ int ED_object_modifier_remove(ReportList *reports, Main *bmain, Scene *scene, Ob
DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
+ /* sorting has to be done after the update so that dynamic systems can react properly */
+ if(sort_depsgraph)
+ DAG_scene_sort(bmain, scene);
+
return 1;
}
@@ -464,6 +469,21 @@ static int modifier_apply_obdata(ReportList *reports, Scene *scene, Object *ob,
BKE_report(reports, RPT_ERROR, "Cannot apply modifier for this object type");
return 0;
}
+
+ /* lattice modifier can be applied to particle system too */
+ if(ob->particlesystem.first) {
+
+ ParticleSystem *psys = ob->particlesystem.first;
+
+ for(; psys; psys=psys->next) {
+
+ if(psys->part->type != PART_HAIR)
+ continue;
+
+ psys_apply_hair_lattice(scene, ob, psys);
+ }
+ }
+
return 1;
}
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index 76330477418..d23ea57e0e7 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -1106,6 +1106,8 @@ static int move_to_layer_exec(bContext *C, wmOperator *op)
/* warning, active object may be hidden now */
WM_event_add_notifier(C, NC_SCENE|NC_OBJECT|ND_DRAW, scene); /* is NC_SCENE needed ? */
+ WM_event_add_notifier(C, NC_SCENE|ND_LAYER_CONTENT, scene);
+
DAG_scene_sort(bmain, scene);
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c
index 43de351e4c1..3cc0be8d640 100644
--- a/source/blender/editors/object/object_vgroup.c
+++ b/source/blender/editors/object/object_vgroup.c
@@ -85,7 +85,7 @@ bDeformGroup *ED_vgroup_add_name(Object *ob, char *name)
{
bDeformGroup *defgroup;
- if(!ob)
+ if(!ob || !ELEM(ob->type, OB_MESH, OB_LATTICE))
return NULL;
defgroup = MEM_callocN(sizeof(bDeformGroup), "add deformGroup");
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index d3f9926cf8c..eaadd3e7d83 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -4151,6 +4151,13 @@ static int clear_edited_exec(bContext *C, wmOperator *op)
DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
}
}
+ else { /* some operation might have protected hair from editing so let's clear the flag */
+ psys->recalc |= PSYS_RECALC_RESET;
+ psys->flag &= ~PSYS_GLOBAL_HAIR;
+ psys->flag &= ~PSYS_EDITED;
+ WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE|NA_EDITED, ob);
+ DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
+ }
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c
index c0e6ea66bc4..7833f93b3b5 100644
--- a/source/blender/editors/render/render_opengl.c
+++ b/source/blender/editors/render/render_opengl.c
@@ -116,6 +116,17 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
rr= RE_AcquireResultRead(oglrender->re);
+ /* note on color management:
+ * looked into how best to deal with color management here and found heres how it should work.
+ *
+ * OpenGL materials etc are color corrected, so a float buffer from the graphics card is
+ * color corrected, without running any conversion functions.
+ *
+ * With color correction disabled blender expects the rr->rectf to be non-color managed so
+ * just do a direct copy from the byte array to the rectf with no conversion too.
+ * notice IMB_float_from_rect has the profile set so no conversion is done.
+ */
+
if(view_context) {
GPU_offscreen_bind(oglrender->ofs); /* bind */
@@ -133,11 +144,8 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
GPU_offscreen_unbind(oglrender->ofs); /* unbind */
}
else {
- ImBuf *ibuf_view= ED_view3d_draw_offscreen_imbuf_simple(scene, oglrender->sizex, oglrender->sizey, OB_SOLID);
- IMB_float_from_rect(ibuf_view);
-
+ ImBuf *ibuf_view= ED_view3d_draw_offscreen_imbuf_simple(scene, oglrender->sizex, oglrender->sizey, IB_rectfloat, OB_SOLID);
memcpy(rr->rectf, ibuf_view->rect_float, sizeof(float) * 4 * oglrender->sizex * oglrender->sizey);
-
IMB_freeImBuf(ibuf_view);
}
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index 7e922076f4b..dd5a7d60fbd 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -5531,7 +5531,7 @@ static int texture_paint_image_from_view_exec(bContext *C, wmOperator *op)
if(w > maxsize) w= maxsize;
if(h > maxsize) h= maxsize;
- ibuf= ED_view3d_draw_offscreen_imbuf(CTX_data_scene(C), CTX_wm_view3d(C), CTX_wm_region(C), w, h);
+ ibuf= ED_view3d_draw_offscreen_imbuf(CTX_data_scene(C), CTX_wm_view3d(C), CTX_wm_region(C), w, h, IB_rect);
image= BKE_add_image_imbuf(ibuf);
if(image) {
diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c
index 9d34b827ff9..0b6e752574b 100644
--- a/source/blender/editors/space_buttons/space_buttons.c
+++ b/source/blender/editors/space_buttons/space_buttons.c
@@ -350,10 +350,12 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn)
ED_area_tag_redraw(sa);
break;
}
+ break;
/* Listener for preview render, when doing an global undo. */
case NC_WINDOW:
ED_area_tag_redraw(sa);
sbuts->preview= 1;
+ break;
}
if(wmn->data == ND_KEYS)
diff --git a/source/blender/editors/space_file/Makefile b/source/blender/editors/space_file/Makefile
index 1fc27795f08..4597ffa3f6b 100644
--- a/source/blender/editors/space_file/Makefile
+++ b/source/blender/editors/space_file/Makefile
@@ -73,4 +73,4 @@ endif
ifeq ($(WITH_HDR), true)
CPPFLAGS += -DWITH_HDR
-endif \ No newline at end of file
+endif
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c
index f25fab45c7c..5f435aa0cbe 100644
--- a/source/blender/editors/space_file/file_draw.c
+++ b/source/blender/editors/space_file/file_draw.c
@@ -118,7 +118,7 @@ void file_draw_buttons(const bContext *C, ARegion *ar)
const int separator = 4;
/* Additional locals. */
- char name[20];
+ char name[32];
int loadbutton;
int fnumbuttons;
int min_x = 10;
@@ -177,11 +177,14 @@ void file_draw_buttons(const bContext *C, ARegion *ar)
params->dir, 0.0, (float)FILE_MAX-1, 0, 0,
"File path.");
uiButSetCompleteFunc(but, autocomplete_directory, NULL);
+ uiButSetFlag(but, UI_BUT_NO_UTF8);
+
but = uiDefBut(block, TEX, B_FS_FILENAME, "",
min_x, line2_y, line2_w-chan_offs, btn_h,
params->file, 0.0, (float)FILE_MAXFILE-1, 0, 0,
"File name.");
uiButSetCompleteFunc(but, autocomplete_file, NULL);
+ uiButSetFlag(but, UI_BUT_NO_UTF8);
}
/* Filename number increment / decrement buttons. */
@@ -541,6 +544,7 @@ void file_draw_list(const bContext *C, ARegion *ar)
uiBut *but = uiDefBut(block, TEX, 1, "", spos, sy-layout->tile_h-3,
but_width, layout->textheight*2, sfile->params->renameedit, 1.0f, (float)sizeof(sfile->params->renameedit),0,0,"");
uiButSetRenameFunc(but, renamebutton_cb, file);
+ uiButSetFlag(but, UI_BUT_NO_UTF8); /* allow non utf8 names */
if ( 0 == uiButActiveOnly(C, block, but)) {
file->flags &= ~EDITING;
}
@@ -628,4 +632,3 @@ void file_draw_list(const bContext *C, ARegion *ar)
}
-
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index 818a6181626..3b335487557 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -1304,7 +1304,7 @@ static int pack_test(bContext *C, wmOperator *op)
return 0;
if(ima->source==IMA_SRC_SEQUENCE || ima->source==IMA_SRC_MOVIE) {
- BKE_report(op->reports, RPT_ERROR, "Can't pack movie or image sequence.");
+ BKE_report(op->reports, RPT_ERROR, "Packing movies or image sequences not supported.");
return 0;
}
@@ -1481,7 +1481,7 @@ static int unpack_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
if(ima->source==IMA_SRC_SEQUENCE || ima->source==IMA_SRC_MOVIE) {
- BKE_report(op->reports, RPT_ERROR, "Can't unpack movie or image sequence.");
+ BKE_report(op->reports, RPT_ERROR, "Unpacking movies or image sequences not supported.");
return OPERATOR_CANCELLED;
}
@@ -1506,7 +1506,7 @@ static int unpack_invoke(bContext *C, wmOperator *op, wmEvent *event)
return OPERATOR_CANCELLED;
if(ima->source==IMA_SRC_SEQUENCE || ima->source==IMA_SRC_MOVIE) {
- BKE_report(op->reports, RPT_ERROR, "Can't unpack movie or image sequence.");
+ BKE_report(op->reports, RPT_ERROR, "Unpacking movies or image sequences not supported.");
return OPERATOR_CANCELLED;
}
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c
index 32e8be83bc5..60b43844034 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -954,7 +954,7 @@ void ED_spacetype_image(void)
/* regions: statistics/scope buttons */
art= MEM_callocN(sizeof(ARegionType), "spacetype image region");
art->regionid = RGN_TYPE_PREVIEW;
- art->minsizex= 220; // XXX
+ art->prefsizex= 220; // XXX
art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_FRAMES;
art->listener= image_scope_area_listener;
art->init= image_scope_area_init;
diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c
index 8a703c510c4..4b778e80b0e 100644
--- a/source/blender/editors/space_logic/logic_window.c
+++ b/source/blender/editors/space_logic/logic_window.c
@@ -3666,7 +3666,7 @@ static void draw_actuator_action(uiLayout *layout, PointerRNA *ptr)
uiItemR(row, ptr, "use_continue_last_frame", 0, NULL, 0);
row= uiLayoutRow(layout, 0);
- if((RNA_enum_get(ptr, "mode") == ACT_ACTION_FROM_PROP))
+ if((RNA_enum_get(ptr, "play_mode") == ACT_ACTION_FROM_PROP))
uiItemPointerR(row, ptr, "property", &settings_ptr, "properties", NULL, 0);
else {
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index c1b888fcf83..f865c30dc45 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -553,7 +553,7 @@ static void node_composit_buts_dblur(uiLayout *layout, bContext *C, PointerRNA *
uiLayout *col;
uiItemR(layout, ptr, "iterations", 0, NULL, 0);
- uiItemR(layout, ptr, "wrap", 0, NULL, 0);
+ uiItemR(layout, ptr, "use_wrap", 0, NULL, 0);
col= uiLayoutColumn(layout, 1);
uiItemL(col, "Center:", 0);
@@ -601,9 +601,9 @@ static void node_composit_buts_defocus(uiLayout *layout, bContext *C, PointerRNA
uiItemR(layout, ptr, "threshold", 0, NULL, 0);
col = uiLayoutColumn(layout, 0);
- uiItemR(col, ptr, "preview", 0, NULL, 0);
+ uiItemR(col, ptr, "use_preview", 0, NULL, 0);
sub = uiLayoutColumn(col, 0);
- uiLayoutSetActive(sub, RNA_boolean_get(ptr, "preview"));
+ uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_preview"));
uiItemR(sub, ptr, "samples", 0, NULL, 0);
col = uiLayoutColumn(layout, 0);
@@ -707,13 +707,21 @@ static void node_composit_buts_crop(uiLayout *layout, bContext *C, PointerRNA *p
uiLayout *col;
uiItemR(layout, ptr, "use_crop_size", 0, NULL, 0);
+ uiItemR(layout, ptr, "relative", 0, NULL, 0);
col= uiLayoutColumn(layout, 1);
+ if (RNA_boolean_get(ptr, "relative")){
+ uiItemR(col, ptr, "rel_min_x", 0, "Left", 0);
+ uiItemR(col, ptr, "rel_max_x", 0, "Right", 0);
+ uiItemR(col, ptr, "rel_min_y", 0, "Up", 0);
+ uiItemR(col, ptr, "rel_max_y", 0, "Down", 0);
+ } else {
uiItemR(col, ptr, "min_x", 0, "Left", 0);
uiItemR(col, ptr, "max_x", 0, "Right", 0);
uiItemR(col, ptr, "min_y", 0, "Up", 0);
uiItemR(col, ptr, "max_y", 0, "Down", 0);
}
+}
static void node_composit_buts_splitviewer(uiLayout *layout, bContext *C, PointerRNA *ptr)
{
@@ -760,9 +768,9 @@ static void node_composit_buts_hue_sat(uiLayout *layout, bContext *C, PointerRNA
uiLayout *col;
col =uiLayoutColumn(layout, 0);
- uiItemR(col, ptr, "hue", UI_ITEM_R_SLIDER, NULL, 0);
- uiItemR(col, ptr, "sat", UI_ITEM_R_SLIDER, NULL, 0);
- uiItemR(col, ptr, "val", UI_ITEM_R_SLIDER, NULL, 0);
+ uiItemR(col, ptr, "color_hue", UI_ITEM_R_SLIDER, NULL, 0);
+ uiItemR(col, ptr, "color_saturation", UI_ITEM_R_SLIDER, NULL, 0);
+ uiItemR(col, ptr, "color_value", UI_ITEM_R_SLIDER, NULL, 0);
}
static void node_composit_buts_dilateerode(uiLayout *layout, bContext *C, PointerRNA *ptr)
diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c
index 3865fd213b4..2f32c54a1a5 100644
--- a/source/blender/editors/space_outliner/outliner.c
+++ b/source/blender/editors/space_outliner/outliner.c
@@ -102,6 +102,8 @@
#define OL_H 19
#define OL_X 18
+#define OL_Y_OFFSET 2
+
#define OL_TOG_RESTRICT_VIEWX 54
#define OL_TOG_RESTRICT_SELECTX 36
#define OL_TOG_RESTRICT_RENDERX 18
@@ -2402,7 +2404,7 @@ static int do_outliner_item_activate(bContext *C, Scene *scene, ARegion *ar, Spa
return 1;
}
/* name and first icon */
- else if(mval[0]>te->xs && mval[0]<te->xend) {
+ else if(mval[0]>te->xs+OL_X && mval[0]<te->xend) {
/* always makes active object */
if(tselem->type!=TSE_SEQUENCE && tselem->type!=TSE_SEQ_STRIP && tselem->type!=TSE_SEQUENCE_DUP)
@@ -2498,7 +2500,7 @@ static int outliner_item_activate(bContext *C, wmOperator *op, wmEvent *event)
int row;
/* get row number - 100 here is just a dummy value since we don't need the column */
- UI_view2d_listview_view_to_cell(&ar->v2d, 1000, OL_H, 0.0f, 0.0f,
+ UI_view2d_listview_view_to_cell(&ar->v2d, 1000, OL_H, 0.0f, OL_Y_OFFSET,
fmval[0], fmval[1], NULL, &row);
/* select relevant row */
@@ -2599,7 +2601,7 @@ static int do_outliner_item_rename(bContext *C, ARegion *ar, SpaceOops *soops, T
TreeStoreElem *tselem= TREESTORE(te);
/* name and first icon */
- if(mval[0]>te->xs && mval[0]<te->xend) {
+ if(mval[0]>te->xs+OL_X && mval[0]<te->xend) {
/* can't rename rna datablocks entries */
if(ELEM3(tselem->type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM))
@@ -4711,13 +4713,13 @@ static void outliner_draw_struct_marks(ARegion *ar, SpaceOops *soops, ListBase *
/* selection status */
if((tselem->flag & TSE_CLOSED)==0)
if(tselem->type == TSE_RNA_STRUCT)
- glRecti(0, *starty+1, (int)ar->v2d.cur.xmax, *starty+OL_H-1);
+ glRecti(0, *starty+1, (int)ar->v2d.cur.xmax+V2D_SCROLL_WIDTH, *starty+OL_H-1);
*starty-= OL_H;
if((tselem->flag & TSE_CLOSED)==0) {
outliner_draw_struct_marks(ar, soops, &te->subtree, starty);
if(tselem->type == TSE_RNA_STRUCT)
- fdrawline(0, (float)*starty+OL_H-1, ar->v2d.cur.xmax, (float)*starty+OL_H-1);
+ fdrawline(0, (float)*starty+OL_H, ar->v2d.cur.xmax+V2D_SCROLL_WIDTH, (float)*starty+OL_H);
}
}
}
@@ -4752,24 +4754,24 @@ static void outliner_draw_tree(bContext *C, uiBlock *block, Scene *scene, ARegio
/* struct marks */
UI_ThemeColorShadeAlpha(TH_BACK, -15, -200);
//UI_ThemeColorShade(TH_BACK, -20);
- starty= (int)ar->v2d.tot.ymax-OL_H;
+ starty= (int)ar->v2d.tot.ymax-OL_H-OL_Y_OFFSET;
outliner_draw_struct_marks(ar, soops, &soops->tree, &starty);
}
/* always draw selection fill before hierarchy */
UI_GetThemeColor3fv(TH_BACK, col);
glColor3f(col[0]+0.06f, col[1]+0.08f, col[2]+0.10f);
- starty= (int)ar->v2d.tot.ymax-OL_H;
+ starty= (int)ar->v2d.tot.ymax-OL_H-OL_Y_OFFSET;
outliner_draw_selection(ar, soops, &soops->tree, &starty);
// grey hierarchy lines
UI_ThemeColorBlend(TH_BACK, TH_TEXT, 0.2f);
- starty= (int)ar->v2d.tot.ymax-OL_H/2;
+ starty= (int)ar->v2d.tot.ymax-OL_H/2-OL_Y_OFFSET;
startx= 6;
outliner_draw_hierarchy(soops, &soops->tree, startx, &starty);
// items themselves
- starty= (int)ar->v2d.tot.ymax-OL_H;
+ starty= (int)ar->v2d.tot.ymax-OL_H-OL_Y_OFFSET;
startx= 0;
for(te= soops->tree.first; te; te= te->next) {
outliner_draw_tree_element(C, block, scene, ar, soops, te, startx, &starty);
@@ -4783,10 +4785,10 @@ static void outliner_back(ARegion *ar, SpaceOops *soops)
UI_ThemeColorShade(TH_BACK, 6);
ystart= (int)ar->v2d.tot.ymax;
- ystart= OL_H*(ystart/(OL_H));
+ ystart= OL_H*(ystart/(OL_H))-OL_Y_OFFSET;
while(ystart+2*OL_H > ar->v2d.cur.ymin) {
- glRecti(0, ystart, (int)ar->v2d.cur.xmax, ystart+OL_H);
+ glRecti(0, ystart, (int)ar->v2d.cur.xmax+V2D_SCROLL_WIDTH, ystart+OL_H);
ystart-= 2*OL_H;
}
}
@@ -4797,11 +4799,11 @@ static void outliner_draw_restrictcols(ARegion *ar, SpaceOops *soops)
/* background underneath */
UI_ThemeColor(TH_BACK);
- glRecti((int)ar->v2d.cur.xmax-OL_TOGW, (int)ar->v2d.cur.ymin, (int)ar->v2d.cur.xmax, (int)ar->v2d.cur.ymax);
+ glRecti((int)ar->v2d.cur.xmax-OL_TOGW, (int)ar->v2d.cur.ymin-V2D_SCROLL_HEIGHT-1, (int)ar->v2d.cur.xmax+V2D_SCROLL_WIDTH, (int)ar->v2d.cur.ymax);
UI_ThemeColorShade(TH_BACK, 6);
ystart= (int)ar->v2d.tot.ymax;
- ystart= OL_H*(ystart/(OL_H));
+ ystart= OL_H*(ystart/(OL_H))-OL_Y_OFFSET;
while(ystart+2*OL_H > ar->v2d.cur.ymin) {
glRecti((int)ar->v2d.cur.xmax-OL_TOGW, ystart, (int)ar->v2d.cur.xmax, ystart+OL_H);
@@ -4814,19 +4816,19 @@ static void outliner_draw_restrictcols(ARegion *ar, SpaceOops *soops)
fdrawline(ar->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX,
ar->v2d.cur.ymax,
ar->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX,
- ar->v2d.cur.ymin);
+ ar->v2d.cur.ymin - V2D_SCROLL_HEIGHT);
/* render */
fdrawline(ar->v2d.cur.xmax-OL_TOG_RESTRICT_SELECTX,
ar->v2d.cur.ymax,
ar->v2d.cur.xmax-OL_TOG_RESTRICT_SELECTX,
- ar->v2d.cur.ymin);
+ ar->v2d.cur.ymin - V2D_SCROLL_HEIGHT);
/* render */
fdrawline(ar->v2d.cur.xmax-OL_TOG_RESTRICT_RENDERX,
ar->v2d.cur.ymax,
ar->v2d.cur.xmax-OL_TOG_RESTRICT_RENDERX,
- ar->v2d.cur.ymin);
+ ar->v2d.cur.ymin - V2D_SCROLL_HEIGHT);
}
static void restrictbutton_view_cb(bContext *C, void *poin, void *poin2)
@@ -5216,18 +5218,21 @@ static void outliner_draw_rnacols(ARegion *ar, SpaceOops *soops, int sizex)
{
View2D *v2d= &ar->v2d;
+ float miny = v2d->cur.ymin-V2D_SCROLL_HEIGHT;
+ if(miny<v2d->tot.ymin) miny = v2d->tot.ymin;
+
UI_ThemeColorShadeAlpha(TH_BACK, -15, -200);
/* draw column separator lines */
fdrawline((float)sizex,
v2d->cur.ymax,
(float)sizex,
- v2d->cur.ymin);
+ miny);
fdrawline((float)sizex+OL_RNA_COL_SIZEX,
v2d->cur.ymax,
(float)sizex+OL_RNA_COL_SIZEX,
- v2d->cur.ymin);
+ miny);
}
static void outliner_draw_rnabuts(uiBlock *block, Scene *scene, ARegion *ar, SpaceOops *soops, int sizex, ListBase *lb)
@@ -5531,7 +5536,7 @@ static void outliner_buttons(const bContext *C, uiBlock *block, ARegion *ar, Spa
uiBut *bt;
TreeElement *te;
TreeStoreElem *tselem;
- int dx, len;
+ int spx, dx, len;
for(te= lb->first; te; te= te->next) {
tselem= TREESTORE(te);
@@ -5552,8 +5557,10 @@ static void outliner_buttons(const bContext *C, uiBlock *block, ARegion *ar, Spa
dx= (int)UI_GetStringWidth(te->name);
if(dx<100) dx= 100;
+ spx=te->xs+2*OL_X-4;
+ if(spx+dx+10>ar->v2d.cur.xmax) dx = ar->v2d.cur.xmax-spx-10;
- bt= uiDefBut(block, TEX, OL_NAMEBUTTON, "", (short)te->xs+2*OL_X-4, (short)te->ys, dx+10, OL_H-1, te->name, 1.0, (float)len-1, 0, 0, "");
+ bt= uiDefBut(block, TEX, OL_NAMEBUTTON, "", spx, (short)te->ys, dx+10, OL_H-1, te->name, 1.0, (float)len-1, 0, 0, "");
uiButSetRenameFunc(bt, namebutton_cb, tselem);
/* returns false if button got removed */
@@ -5614,20 +5621,20 @@ void draw_outliner(const bContext *C)
/* tweak to display last line (when list bigger than window) */
sizey += V2D_SCROLL_HEIGHT;
+ /* adds vertical offset */
+ sizey += OL_Y_OFFSET;
+
/* update size of tot-rect (extents of data/viewable area) */
UI_view2d_totRect_set(v2d, sizex, sizey);
/* set matrix for 2d-view controls */
UI_view2d_view_ortho(C, v2d);
- /* draw outliner stuff (background and hierachy lines) */
+ /* draw outliner stuff (background, hierachy lines and names) */
outliner_back(ar, soops);
block= uiBeginBlock(C, ar, "outliner buttons", UI_EMBOSS);
outliner_draw_tree((bContext *)C, block, scene, ar, soops);
- /* draw icons and names */
- outliner_buttons(C, block, ar, soops, &soops->tree);
-
if(ELEM(soops->outlinevis, SO_DATABLOCKS, SO_USERDEF)) {
/* draw rna buttons */
outliner_draw_rnacols(ar, soops, sizex_rna);
@@ -5642,6 +5649,9 @@ void draw_outliner(const bContext *C)
outliner_draw_restrictbuts(block, scene, ar, soops, &soops->tree);
}
+ /* draw edit buttons if nessecery */
+ outliner_buttons(C, block, ar, soops, &soops->tree);
+
uiEndBlock(C, block);
uiDrawBlock(C, block);
diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c
index d65422ce327..a3c20ee3341 100644
--- a/source/blender/editors/space_time/space_time.c
+++ b/source/blender/editors/space_time/space_time.c
@@ -509,11 +509,16 @@ static void time_main_area_listener(ARegion *ar, wmNotifier *wmn)
break;
case NC_SCENE:
+ switch (wmn->data) {
+ case ND_FRAME:
+ case ND_FRAME_RANGE:
+ case ND_KEYINGSET:
+ case ND_RENDER_OPTIONS:
ED_region_tag_redraw(ar);
break;
-
}
}
+}
/* ************************ header time area region *********************** */
@@ -540,6 +545,7 @@ static void time_header_area_listener(ARegion *ar, wmNotifier *wmn)
case NC_SCENE:
switch (wmn->data) {
case ND_FRAME:
+ case ND_FRAME_RANGE:
case ND_KEYINGSET:
case ND_RENDER_OPTIONS:
ED_region_tag_redraw(ar);
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index b6983a8c26f..b26b2af5166 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -903,7 +903,7 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
if(drawcone && !v3d->transp) {
/* in this case we need to draw delayed */
- add_view3d_after(v3d, base, V3D_TRANSP, flag);
+ add_view3d_after(&v3d->afterdraw_transp, base, flag);
return;
}
@@ -2968,7 +2968,20 @@ static int draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
}
/* GPU_begin_object_materials checked if this is needed */
- if(do_alpha_pass) add_view3d_after(v3d, base, V3D_TRANSP, flag);
+ if(do_alpha_pass) {
+ if(ob->dtx & OB_DRAWXRAY) {
+ add_view3d_after(&v3d->afterdraw_xraytransp, base, flag);
+ }
+ else {
+ add_view3d_after(&v3d->afterdraw_transp, base, flag);
+ }
+ }
+ else if(ob->dtx & OB_DRAWXRAY && ob->dtx & OB_DRAWTRANSP) {
+ /* special case xray+transp when alpha is 1.0, without this the object vanishes */
+ if(v3d->xray == 0 && v3d->transp == 0) {
+ add_view3d_after(&v3d->afterdraw_xray, base, flag);
+ }
+ }
return retval;
}
@@ -3561,7 +3574,7 @@ static void draw_particle(ParticleKey *state, int draw_as, short draw, float pix
add_v3_v3v3(pdd->vd, bb_center, xvec);
add_v3_v3(pdd->vd, yvec); pdd->vd+=3;
- sub_v3_v3v3(pdd->vd, bb_center, vec);
+ sub_v3_v3v3(pdd->vd, bb_center, xvec);
add_v3_v3(pdd->vd, yvec); pdd->vd+=3;
sub_v3_v3v3(pdd->vd, bb_center, xvec);
@@ -5737,7 +5750,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
if(!(ob->mode & OB_MODE_PARTICLE_EDIT)) {
/* xray and transp are set when it is drawing the 2nd/3rd pass */
if(!v3d->xray && !v3d->transp && (ob->dtx & OB_DRAWXRAY) && !(ob->dtx & OB_DRAWTRANSP)) {
- add_view3d_after(v3d, base, V3D_XRAY, flag);
+ add_view3d_after(&v3d->afterdraw_xray, base, flag);
return;
}
}
diff --git a/source/blender/editors/space_view3d/drawvolume.c b/source/blender/editors/space_view3d/drawvolume.c
index 65786901868..f8cd34cf849 100644
--- a/source/blender/editors/space_view3d/drawvolume.c
+++ b/source/blender/editors/space_view3d/drawvolume.c
@@ -116,6 +116,7 @@ static void tend ( void )
{
gettimeofday ( &_tend,&tz );
}
+ #if 0
static double tval()
{
double t1, t2;
@@ -124,6 +125,7 @@ static double tval()
return t2-t1;
}
#endif
+#endif
struct GPUTexture;
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index ac845ec7ea3..8fbe764c633 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -270,7 +270,6 @@ static void view3d_free(SpaceLink *sl)
if(vd->localvd) MEM_freeN(vd->localvd);
if(vd->properties_storage) MEM_freeN(vd->properties_storage);
-
}
@@ -410,7 +409,6 @@ static int view3d_mat_drop_poll(bContext *C, wmDrag *drag, wmEvent *event)
static int view3d_ima_drop_poll(bContext *C, wmDrag *drag, wmEvent *event)
{
- if( ED_view3d_give_base_under_cursor(C, event->mval) ) {
if(drag->type==WM_DRAG_ID) {
ID *id= (ID *)drag->poin;
if( GS(id->name)==ID_IM )
@@ -420,6 +418,22 @@ static int view3d_ima_drop_poll(bContext *C, wmDrag *drag, wmEvent *event)
if(ELEM(drag->icon, 0, ICON_FILE_IMAGE)) /* rule might not work? */
return 1;
}
+ return 0;
+ }
+
+
+static int view3d_ima_bg_drop_poll(bContext *C, wmDrag *drag, wmEvent *event)
+{
+ if( ED_view3d_give_base_under_cursor(C, event->mval) ) {
+ return 0;
+}
+ return view3d_ima_drop_poll(C, drag, event);
+}
+
+static int view3d_ima_ob_drop_poll(bContext *C, wmDrag *drag, wmEvent *event)
+{
+ if( ED_view3d_give_base_under_cursor(C, event->mval) ) {
+ return view3d_ima_drop_poll(C, drag, event);
}
return 0;
}
@@ -462,7 +476,8 @@ static void view3d_dropboxes(void)
WM_dropbox_add(lb, "OBJECT_OT_add_named_cursor", view3d_ob_drop_poll, view3d_ob_drop_copy);
WM_dropbox_add(lb, "OBJECT_OT_drop_named_material", view3d_mat_drop_poll, view3d_id_drop_copy);
- WM_dropbox_add(lb, "MESH_OT_drop_named_image", view3d_ima_drop_poll, view3d_id_path_drop_copy);
+ WM_dropbox_add(lb, "MESH_OT_drop_named_image", view3d_ima_ob_drop_poll, view3d_id_path_drop_copy);
+ WM_dropbox_add(lb, "VIEW3D_OT_add_background_image", view3d_ima_bg_drop_poll, view3d_id_path_drop_copy);
}
@@ -514,6 +529,37 @@ static void *view3d_main_area_duplicate(void *poin)
return NULL;
}
+static void view3d_recalc_used_layers(ARegion *ar, wmNotifier *wmn)
+{
+ wmWindow *win= wmn->wm->winactive;
+ ScrArea *sa;
+
+ if (!win) return;
+
+ sa= win->screen->areabase.first;
+
+ while(sa) {
+ if(sa->spacetype == SPACE_VIEW3D)
+ if(BLI_findindex(&sa->regionbase, ar) >= 0) {
+ View3D *v3d= sa->spacedata.first;
+ Scene *scene= wmn->reference;
+ Base *base;
+
+ v3d->lay_used= 0;
+ base= scene->base.first;
+ while(base) {
+ v3d->lay_used|= base->lay;
+
+ base= base->next;
+ }
+
+ break;
+ }
+
+ sa= sa->next;
+ }
+}
+
static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn)
{
/* context changes */
@@ -537,6 +583,10 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn)
break;
case NC_SCENE:
switch(wmn->data) {
+ case ND_LAYER_CONTENT:
+ view3d_recalc_used_layers(ar, wmn);
+ ED_region_tag_redraw(ar);
+ break;
case ND_FRAME:
case ND_TRANSFORM:
case ND_OB_ACTIVE:
@@ -678,6 +728,7 @@ static void view3d_header_area_listener(ARegion *ar, wmNotifier *wmn)
case ND_MODE:
case ND_LAYER:
case ND_TOOLSETTINGS:
+ case ND_LAYER_CONTENT:
ED_region_tag_redraw(ar);
break;
}
@@ -729,6 +780,7 @@ static void view3d_buttons_area_listener(ARegion *ar, wmNotifier *wmn)
case ND_OB_SELECT:
case ND_MODE:
case ND_LAYER:
+ case ND_LAYER_CONTENT:
ED_region_tag_redraw(ar);
break;
}
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index d56b2c35773..0dc505e0146 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -865,7 +865,7 @@ static void view3d_get_viewborder_size(Scene *scene, ARegion *ar, float size_r[2
}
}
-void calc_viewborder(Scene *scene, ARegion *ar, RegionView3D *rv3d, View3D *v3d, rctf *viewborder_r)
+void view3d_calc_camera_border(Scene *scene, ARegion *ar, RegionView3D *rv3d, View3D *v3d, rctf *viewborder_r)
{
float zoomfac, size[2];
float dx= 0.0f, dy= 0.0f;
@@ -991,7 +991,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
if(v3d->camera->type==OB_CAMERA)
ca = v3d->camera->data;
- calc_viewborder(scene, ar, rv3d, v3d, &viewborder);
+ view3d_calc_camera_border(scene, ar, rv3d, v3d, &viewborder);
/* the offsets */
x1= viewborder.xmin;
y1= viewborder.ymin;
@@ -1328,7 +1328,7 @@ static void draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d)
if(rv3d->persp==RV3D_CAMOB) {
rctf vb;
- calc_viewborder(scene, ar, rv3d, v3d, &vb);
+ view3d_calc_camera_border(scene, ar, rv3d, v3d, &vb);
x1= vb.xmin;
y1= vb.ymin;
@@ -1422,64 +1422,77 @@ static void draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d)
typedef struct View3DAfter {
struct View3DAfter *next, *prev;
struct Base *base;
- int type, flag;
+ int flag;
} View3DAfter;
/* temp storage of Objects that need to be drawn as last */
-void add_view3d_after(View3D *v3d, Base *base, int type, int flag)
+void add_view3d_after(ListBase *lb, Base *base, int flag)
{
View3DAfter *v3da= MEM_callocN(sizeof(View3DAfter), "View 3d after");
-
- BLI_addtail(&v3d->afterdraw, v3da);
+ BLI_addtail(lb, v3da);
v3da->base= base;
- v3da->type= type;
v3da->flag= flag;
}
+/* disables write in zbuffer and draws it over */
+static void view3d_draw_transp(Scene *scene, ARegion *ar, View3D *v3d)
+{
+ View3DAfter *v3da, *next;
+
+ glDepthMask(0);
+ v3d->transp= TRUE;
+
+ for(v3da= v3d->afterdraw_transp.first; v3da; v3da= next) {
+ next= v3da->next;
+ draw_object(scene, ar, v3d, v3da->base, v3da->flag);
+ BLI_remlink(&v3d->afterdraw_transp, v3da);
+ MEM_freeN(v3da);
+ }
+ v3d->transp= FALSE;
+
+ glDepthMask(1);
+
+}
+
/* clears zbuffer and draws it over */
static void view3d_draw_xray(Scene *scene, ARegion *ar, View3D *v3d, int clear)
{
View3DAfter *v3da, *next;
- int doit= 0;
- for(v3da= v3d->afterdraw.first; v3da; v3da= v3da->next)
- if(v3da->type==V3D_XRAY) doit= 1;
+ if(clear && v3d->zbuf)
+ glClear(GL_DEPTH_BUFFER_BIT);
- if(doit) {
- if(clear && v3d->zbuf) glClear(GL_DEPTH_BUFFER_BIT);
v3d->xray= TRUE;
-
- for(v3da= v3d->afterdraw.first; v3da; v3da= next) {
+ for(v3da= v3d->afterdraw_xray.first; v3da; v3da= next) {
next= v3da->next;
- if(v3da->type==V3D_XRAY) {
draw_object(scene, ar, v3d, v3da->base, v3da->flag);
- BLI_remlink(&v3d->afterdraw, v3da);
+ BLI_remlink(&v3d->afterdraw_xray, v3da);
MEM_freeN(v3da);
}
- }
v3d->xray= FALSE;
}
-}
-/* disables write in zbuffer and draws it over */
-static void view3d_draw_transp(Scene *scene, ARegion *ar, View3D *v3d)
+
+/* clears zbuffer and draws it over */
+static void view3d_draw_xraytransp(Scene *scene, ARegion *ar, View3D *v3d, int clear)
{
View3DAfter *v3da, *next;
- glDepthMask(0);
+ if(clear && v3d->zbuf)
+ glClear(GL_DEPTH_BUFFER_BIT);
+
+ v3d->xray= TRUE;
v3d->transp= TRUE;
- for(v3da= v3d->afterdraw.first; v3da; v3da= next) {
+ for(v3da= v3d->afterdraw_xraytransp.first; v3da; v3da= next) {
next= v3da->next;
- if(v3da->type==V3D_TRANSP) {
draw_object(scene, ar, v3d, v3da->base, v3da->flag);
- BLI_remlink(&v3d->afterdraw, v3da);
+ BLI_remlink(&v3d->afterdraw_xraytransp, v3da);
MEM_freeN(v3da);
}
- }
+
v3d->transp= FALSE;
-
- glDepthMask(1);
+ v3d->xray= FALSE;
}
@@ -1675,7 +1688,7 @@ void draw_depth_gpencil(Scene *scene, ARegion *ar, View3D *v3d)
v3d->zbuf= TRUE;
glEnable(GL_DEPTH_TEST);
- draw_gpencil_view3d_ext(scene, ar, 1);
+ draw_gpencil_view3d_ext(scene, v3d, ar, 1);
v3d->zbuf= zbuf;
@@ -1743,39 +1756,57 @@ void draw_depth(Scene *scene, ARegion *ar, View3D *v3d, int (* func)(void *))
}
/* this isnt that nice, draw xray objects as if they are normal */
- if (v3d->afterdraw.first) {
+ if ( v3d->afterdraw_transp.first ||
+ v3d->afterdraw_xray.first ||
+ v3d->afterdraw_xraytransp.first
+ ) {
View3DAfter *v3da, *next;
- int num = 0;
int mask_orig;
+
v3d->xray= TRUE;
/* transp materials can change the depth mask, see #21388 */
glGetIntegerv(GL_DEPTH_WRITEMASK, &mask_orig);
+
+ if(v3d->afterdraw_xray.first || v3d->afterdraw_xraytransp.first) {
glDepthFunc(GL_ALWAYS); /* always write into the depth bufer, overwriting front z values */
- for(v3da= v3d->afterdraw.first; v3da; v3da= next) {
+ for(v3da= v3d->afterdraw_xray.first; v3da; v3da= next) {
next= v3da->next;
- if(v3da->type==V3D_XRAY) {
draw_object(scene, ar, v3d, v3da->base, 0);
- num++;
}
- /* dont remove this time */
+ glDepthFunc(GL_LEQUAL); /* Now write the depth buffer normally */
}
+
+ /* draw 3 passes, transp/xray/xraytransp */
v3d->xray= FALSE;
+ v3d->transp= TRUE;
+ for(v3da= v3d->afterdraw_transp.first; v3da; v3da= next) {
+ next= v3da->next;
+ draw_object(scene, ar, v3d, v3da->base, 0);
+ BLI_remlink(&v3d->afterdraw_transp, v3da);
+ MEM_freeN(v3da);
+ }
- glDepthFunc(GL_LEQUAL); /* Now write the depth buffer normally */
- for(v3da= v3d->afterdraw.first; v3da; v3da= next) {
+ v3d->xray= TRUE;
+ v3d->transp= FALSE;
+ for(v3da= v3d->afterdraw_xray.first; v3da; v3da= next) {
next= v3da->next;
- if(v3da->type==V3D_XRAY) {
- v3d->xray= TRUE; v3d->transp= FALSE;
- } else if (v3da->type==V3D_TRANSP) {
- v3d->xray= FALSE; v3d->transp= TRUE;
+ draw_object(scene, ar, v3d, v3da->base, 0);
+ BLI_remlink(&v3d->afterdraw_xray, v3da);
+ MEM_freeN(v3da);
}
- draw_object(scene, ar, v3d, v3da->base, 0); /* Draw Xray or Transp objects normally */
- BLI_remlink(&v3d->afterdraw, v3da);
+ v3d->xray= TRUE;
+ v3d->transp= TRUE;
+ for(v3da= v3d->afterdraw_xraytransp.first; v3da; v3da= next) {
+ next= v3da->next;
+ draw_object(scene, ar, v3d, v3da->base, 0);
+ BLI_remlink(&v3d->afterdraw_xraytransp, v3da);
MEM_freeN(v3da);
}
+
+
v3d->xray= FALSE;
v3d->transp= FALSE;
@@ -1979,14 +2010,22 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx,
Base *base;
float backcol[3];
int bwinx, bwiny;
+ rcti brect;
glPushMatrix();
/* set temporary new size */
bwinx= ar->winx;
bwiny= ar->winy;
+ brect= ar->winrct;
+
ar->winx= winx;
ar->winy= winy;
+ ar->winrct.xmin= 0;
+ ar->winrct.ymin= 0;
+ ar->winrct.xmax= winx;
+ ar->winrct.ymax= winy;
+
/* set flags */
G.f |= G_RENDER_OGL;
@@ -2045,8 +2084,9 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx,
}
/* transp and X-ray afterdraw stuff */
- view3d_draw_transp(scene, ar, v3d);
- view3d_draw_xray(scene, ar, v3d, 1); // clears zbuffer if it is used!
+ if(v3d->afterdraw_transp.first) view3d_draw_transp(scene, ar, v3d);
+ if(v3d->afterdraw_xray.first) view3d_draw_xray(scene, ar, v3d, 1); // clears zbuffer if it is used!
+ if(v3d->afterdraw_xraytransp.first) view3d_draw_xraytransp(scene, ar, v3d, 1);
/* cleanup */
if(v3d->zbuf) {
@@ -2055,12 +2095,12 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx,
}
/* draw grease-pencil stuff */
- draw_gpencil_view3d_ext(scene, ar, 1);
+ draw_gpencil_view3d_ext(scene, v3d, ar, 1);
ED_region_pixelspace(ar);
/* draw grease-pencil stuff - needed to get paint-buffer shown too (since it's 2D) */
- draw_gpencil_view3d_ext(scene, ar, 0);
+ draw_gpencil_view3d_ext(scene, v3d, ar, 0);
/* freeing the images again here could be done after the operator runs, leaving for now */
GPU_free_images_anim();
@@ -2068,6 +2108,7 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx,
/* restore size */
ar->winx= bwinx;
ar->winy= bwiny;
+ ar->winrct = brect;
glPopMatrix();
@@ -2077,7 +2118,7 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx,
}
/* utility func for ED_view3d_draw_offscreen */
-ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar, int sizex, int sizey)
+ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar, int sizex, int sizey, unsigned int flag)
{
RegionView3D *rv3d= ar->regiondata;
ImBuf *ibuf;
@@ -2105,7 +2146,11 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar, in
}
/* read in pixels & stamp */
- ibuf= IMB_allocImBuf(sizex, sizey, 24, IB_rect, 0);
+ ibuf= IMB_allocImBuf(sizex, sizey, 32, flag, 0);
+
+ if(ibuf->rect_float)
+ glReadPixels(0, 0, sizex, sizey, GL_RGBA, GL_FLOAT, ibuf->rect_float);
+ else if(ibuf->rect)
glReadPixels(0, 0, sizex, sizey, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect);
//if((scene->r.stamp & R_STAMP_ALL) && (scene->r.stamp & R_STAMP_DRAW))
@@ -2115,11 +2160,14 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar, in
GPU_offscreen_unbind(ofs);
GPU_offscreen_free(ofs);
+ if(ibuf->rect_float && ibuf->rect)
+ IMB_rect_from_float(ibuf);
+
return ibuf;
}
/* creates own 3d views, used by the sequencer */
-ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, int width, int height, int drawtype)
+ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, int width, int height, unsigned int flag, int drawtype)
{
View3D v3d;
ARegion ar;
@@ -2154,7 +2202,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, int width, int height
mul_m4_m4m4(rv3d.persmat, rv3d.viewmat, rv3d.winmat);
invert_m4_m4(rv3d.persinv, rv3d.viewinv);
- return ED_view3d_draw_offscreen_imbuf(scene, &v3d, &ar, width, height);
+ return ED_view3d_draw_offscreen_imbuf(scene, &v3d, &ar, width, height, flag);
// seq_view3d_cb(scene, cfra, render_size, seqrectx, seqrecty);
}
@@ -2323,13 +2371,8 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar)
/* Transp and X-ray afterdraw stuff for sets is done later */
}
- /* extra service in layerbuttons, showing used layers */
- v3d->lay_used = 0;
-
/* then draw not selected and the duplis, but skip editmode object */
for(base= scene->base.first; base; base= base->next) {
- v3d->lay_used |= base->lay;
-
if(v3d->lay & base->lay) {
/* dupli drawing */
@@ -2363,8 +2406,9 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar)
// REEB_draw();
/* Transp and X-ray afterdraw stuff */
- view3d_draw_transp(scene, ar, v3d);
- view3d_draw_xray(scene, ar, v3d, 1); // clears zbuffer if it is used!
+ if(v3d->afterdraw_transp.first) view3d_draw_transp(scene, ar, v3d);
+ if(v3d->afterdraw_xray.first) view3d_draw_xray(scene, ar, v3d, 1); // clears zbuffer if it is used!
+ if(v3d->afterdraw_xraytransp.first) view3d_draw_xraytransp(scene, ar, v3d, 1);
ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW);
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 3dfa62215ed..6d09da2dbcf 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -42,6 +42,8 @@
#include "BLI_rand.h"
#include "BKE_context.h"
+#include "BKE_image.h"
+#include "BKE_library.h"
#include "BKE_object.h"
#include "BKE_paint.h"
#include "BKE_report.h"
@@ -1605,7 +1607,7 @@ static int render_border_exec(bContext *C, wmOperator *op)
rect.ymax= RNA_int_get(op->ptr, "ymax");
/* calculate range */
- calc_viewborder(scene, ar, rv3d, v3d, &vb);
+ view3d_calc_camera_border(scene, ar, rv3d, v3d, &vb);
scene->r.border.xmin= ((float)rect.xmin-vb.xmin)/(vb.xmax-vb.xmin);
scene->r.border.ymin= ((float)rect.ymin-vb.ymin)/(vb.ymax-vb.ymin);
@@ -2200,7 +2202,7 @@ void VIEW3D_OT_view_persportho(wmOperatorType *ot)
/* ******************** add background image operator **************** */
-static int add_background_image_exec(bContext *C, wmOperator *op)
+static BGpic *add_background_image(bContext *C)
{
View3D *v3d= CTX_wm_view3d(C);
@@ -2213,14 +2215,51 @@ static int add_background_image_exec(bContext *C, wmOperator *op)
BLI_addtail(&v3d->bgpicbase, bgpic);
- //ED_region_tag_redraw(v3d);
+ return bgpic;
+}
+
+static int add_background_image_exec(bContext *C, wmOperator *op)
+{
+ add_background_image(C);
return OPERATOR_FINISHED;
}
static int add_background_image_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- return add_background_image_exec(C, op);
+ Scene *scene= CTX_data_scene(C);
+ View3D *v3d= CTX_wm_view3d(C);
+ Image *ima= NULL;
+ BGpic *bgpic;
+ char name[32];
+
+ /* check input variables */
+ if(RNA_property_is_set(op->ptr, "filepath")) {
+ char path[FILE_MAX];
+
+ RNA_string_get(op->ptr, "filepath", path);
+ ima= BKE_add_image_file(path, scene ? scene->r.cfra : 1);
+}
+ else if(RNA_property_is_set(op->ptr, "name")) {
+ RNA_string_get(op->ptr, "name", name);
+ ima= (Image *)find_id("IM", name);
+ }
+
+ bgpic = add_background_image(C);
+
+ if (ima) {
+ bgpic->ima = ima;
+
+ if(ima->id.us==0) id_us_plus(&ima->id);
+ else id_lib_extern(&ima->id);
+
+ if (!(v3d->flag & V3D_DISPBGPICS))
+ v3d->flag |= V3D_DISPBGPICS;
+ }
+
+ WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, v3d);
+
+ return OPERATOR_FINISHED;
}
void VIEW3D_OT_add_background_image(wmOperatorType *ot)
@@ -2237,8 +2276,13 @@ void VIEW3D_OT_add_background_image(wmOperatorType *ot)
/* flags */
ot->flag = 0;
+
+ /* properties */
+ RNA_def_string(ot->srna, "name", "Image", 24, "Name", "Image name to assign.");
+ RNA_def_string(ot->srna, "filepath", "Path", FILE_MAX, "Filepath", "Path to image file");
}
+
/* ***** remove image operator ******* */
static int remove_background_image_exec(bContext *C, wmOperator *op)
{
@@ -2274,6 +2318,7 @@ void VIEW3D_OT_remove_background_image(wmOperatorType *ot)
RNA_def_int(ot->srna, "index", 0, 0, INT_MAX, "Index", "Background image index to remove ", 0, INT_MAX);
}
+
/* ********************* set clipping operator ****************** */
static void calc_clipping_plane(float clip[6][4], BoundBox *clipbb)
diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h
index 173d8256269..7a45a43ddd4 100644
--- a/source/blender/editors/space_view3d/view3d_intern.h
+++ b/source/blender/editors/space_view3d/view3d_intern.h
@@ -56,6 +56,7 @@ struct bMotionPath;
#define V3D_XRAY 1
#define V3D_TRANSP 2
+#define V3D_XRAYTRANSP 4
#define V3D_SELECT_MOUSE 1
@@ -125,8 +126,7 @@ void draw_depth(Scene *scene, struct ARegion *ar, View3D *v3d, int (* func)(void
void draw_depth_gpencil(Scene *scene, ARegion *ar, View3D *v3d);
void view3d_clr_clipping(void);
void view3d_set_clipping(RegionView3D *rv3d);
-void add_view3d_after(View3D *v3d, Base *base, int type, int flag);
-void calc_viewborder(Scene *scene, struct ARegion *ar, struct RegionView3D *rv3d, View3D *v3d, rctf *viewborder_r);
+void add_view3d_after(ListBase *lb, Base *base, int flag);
void circf(float x, float y, float rad);
void circ(float x, float y, float rad);
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index 04a4167175c..64289f9bd0a 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -403,6 +403,10 @@ static int view3d_setcameratoview_exec(bContext *C, wmOperator *op)
View3D *v3d = CTX_wm_view3d(C);
RegionView3D *rv3d= CTX_wm_region_view3d(C);
+ copy_qt_qt(rv3d->lviewquat, rv3d->viewquat);
+ rv3d->lview= rv3d->view;
+ rv3d->lpersp= rv3d->persp;
+
setcameratoview3d(v3d, rv3d, v3d->camera);
rv3d->persp = RV3D_CAMOB;
@@ -1805,7 +1809,7 @@ static int game_engine_exec(bContext *C, wmOperator *op)
if(rv3d->persp==RV3D_CAMOB && startscene->gm.framing.type == SCE_GAMEFRAMING_BARS && startscene->gm.stereoflag != STEREO_DOME) { /* Letterbox */
rctf cam_framef;
- calc_viewborder(startscene, ar, rv3d, CTX_wm_view3d(C), &cam_framef);
+ view3d_calc_camera_border(startscene, ar, rv3d, CTX_wm_view3d(C), &cam_framef);
cam_frame.xmin = cam_framef.xmin + ar->winrct.xmin;
cam_frame.xmax = cam_framef.xmax + ar->winrct.xmin;
cam_frame.ymin = cam_framef.ymin + ar->winrct.ymin;
diff --git a/source/blender/editors/transform/SConscript b/source/blender/editors/transform/SConscript
index 9e5244f8577..173eb8ce31d 100644
--- a/source/blender/editors/transform/SConscript
+++ b/source/blender/editors/transform/SConscript
@@ -8,4 +8,4 @@ incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
incs += ' ../../render/extern/include'
incs += ' ../../gpu ../../makesrna ../../bmesh'
-env.BlenderLib ( 'bf_editors_transform', sources, Split(incs), [], libtype=['core'], priority=[40] ) \ No newline at end of file
+env.BlenderLib ( 'bf_editors_transform', sources, Split(incs), [], libtype=['core'], priority=[40] )
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 8c08b71eacd..08ae8ff10a1 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -3524,7 +3524,7 @@ void initTilt(TransInfo *t)
t->num.increment = t->snap[1];
- t->flag |= T_NO_CONSTRAINT;
+ t->flag |= T_NO_CONSTRAINT|T_NO_PROJECT;
}
@@ -4134,7 +4134,7 @@ void initBoneEnvelope(TransInfo *t)
t->num.increment = t->snap[1];
- t->flag |= T_NO_CONSTRAINT;
+ t->flag |= T_NO_CONSTRAINT|T_NO_PROJECT;
}
int BoneEnvelope(TransInfo *t, short mval[2])
@@ -5229,7 +5229,7 @@ void initBoneRoll(TransInfo *t)
t->num.increment = 1.0f;
- t->flag |= T_NO_CONSTRAINT;
+ t->flag |= T_NO_CONSTRAINT|T_NO_PROJECT;
}
int BoneRoll(TransInfo *t, short mval[2])
diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c
index 4cecc41ae5f..b2d6fe4ea34 100644
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@ -465,7 +465,7 @@ void TRANSFORM_OT_translate(struct wmOperatorType *ot)
ot->cancel = transform_cancel;
ot->poll = ED_operator_areaactive;
- RNA_def_float_vector(ot->srna, "value", 3, NULL, -FLT_MAX, FLT_MAX, "Vector", "", -FLT_MAX, FLT_MAX);
+ RNA_def_float_vector_xyz(ot->srna, "value", 3, NULL, -FLT_MAX, FLT_MAX, "Vector", "", -FLT_MAX, FLT_MAX);
Transform_Properties(ot, P_CONSTRAINT|P_PROPORTIONAL|P_MIRROR|P_ALIGN_SNAP);
}
@@ -851,7 +851,7 @@ void transform_keymap_for_space(wmKeyConfig *keyconf, wmKeyMap *keymap, int spac
km = WM_keymap_add_item(keymap, OP_MIRROR, MKEY, KM_PRESS, KM_CTRL, 0);
km = WM_keymap_add_item(keymap, "WM_OT_context_toggle", TABKEY, KM_PRESS, KM_SHIFT, 0);
- RNA_string_set(km->ptr, "data_path", "tool_settings.snap");
+ RNA_string_set(km->ptr, "data_path", "tool_settings.use_snap");
km = WM_keymap_add_item(keymap, "TRANSFORM_OT_snap_type", TABKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
@@ -929,7 +929,7 @@ void transform_keymap_for_space(wmKeyConfig *keyconf, wmKeyMap *keymap, int spac
km = WM_keymap_add_item(keymap, "TRANSFORM_OT_mirror", MKEY, KM_PRESS, KM_CTRL, 0);
km = WM_keymap_add_item(keymap, "WM_OT_context_toggle", TABKEY, KM_PRESS, KM_SHIFT, 0);
- RNA_string_set(km->ptr, "data_path", "tool_settings.snap");
+ RNA_string_set(km->ptr, "data_path", "tool_settings.use_snap");
break;
default:
break;
diff --git a/source/blender/editors/util/undo.c b/source/blender/editors/util/undo.c
index 283e2b49f0d..e5128ea784a 100644
--- a/source/blender/editors/util/undo.c
+++ b/source/blender/editors/util/undo.c
@@ -163,6 +163,8 @@ static int ed_undo_step(bContext *C, int step, const char *undoname)
BKE_undo_name(C, undoname);
else
BKE_undo_step(C, step);
+
+ WM_event_add_notifier(C, NC_SCENE|ND_LAYER_CONTENT, CTX_data_scene(C));
}
}
diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c
index 46b520be61e..524c05fdc73 100644
--- a/source/blender/gpu/intern/gpu_buffers.c
+++ b/source/blender/gpu/intern/gpu_buffers.c
@@ -148,6 +148,9 @@ void GPU_buffer_pool_free(GPUBufferPool *pool)
MEM_freeN(pool->buffers);
MEM_freeN(pool);
+ /* if we are releasing the global pool, stop keeping a reference to it */
+ if (pool == globalPool)
+ globalPool = NULL;
}
void GPU_buffer_pool_free_unused(GPUBufferPool *pool)
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index 3bf1880cf69..d14070a4c24 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -861,7 +861,7 @@ void GPU_free_images_anim(void)
if(G.main)
for(ima=G.main->image.first; ima; ima=ima->id.next)
- if(ELEM(ima->type, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE))
+ if(ELEM(ima->source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE))
GPU_free_image(ima);
}
diff --git a/source/blender/imbuf/intern/cineon/cineon_dpx.c b/source/blender/imbuf/intern/cineon/cineon_dpx.c
index aa1b8ca3447..a9b229536cb 100644
--- a/source/blender/imbuf/intern/cineon/cineon_dpx.c
+++ b/source/blender/imbuf/intern/cineon/cineon_dpx.c
@@ -53,7 +53,7 @@ static void cineon_conversion_parameters(LogImageByteConversionParameters *param
params->blackPoint = 95;
params->whitePoint = 685;
- params->gamma = 1.7f;
+ params->gamma = 1.0f;
params->doLogarithm = 0;
}
diff --git a/source/blender/imbuf/intern/scaling.c b/source/blender/imbuf/intern/scaling.c
index f26eec51b03..0b8dea01ada 100644
--- a/source/blender/imbuf/intern/scaling.c
+++ b/source/blender/imbuf/intern/scaling.c
@@ -960,7 +960,7 @@ static struct ImBuf *scaledowny(struct ImBuf *ibuf, int newy)
}
if (ibuf->rect_float) {
do_float = 1;
- _newrectf = MEM_mallocN(newy * ibuf->x * sizeof(float) * 4, "scaldownyf");
+ _newrectf = MEM_mallocN(newy * ibuf->x * sizeof(float) * 4, "scaledownyf");
if (_newrectf==NULL) {
if (_newrect) MEM_freeN(_newrect);
return(ibuf);
diff --git a/source/blender/imbuf/intern/thumbs_blend.c b/source/blender/imbuf/intern/thumbs_blend.c
index cb27b1a647f..2fef230f1c2 100644
--- a/source/blender/imbuf/intern/thumbs_blend.c
+++ b/source/blender/imbuf/intern/thumbs_blend.c
@@ -97,7 +97,7 @@ static ImBuf *loadblend_thumb(gzFile gzfile)
/* length */
bhead[1] -= sizeof(int) * 2;
- /* inconsistant image size, quit early */
+ /* inconsistent image size, quit early */
if(bhead[1] != size[0] * size[1] * sizeof(int))
return NULL;
diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h
index e3ac90bf881..fe422bfa689 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -255,6 +255,7 @@ typedef struct NodeChroma {
typedef struct NodeTwoXYs {
short x1, x2, y1, y2;
+ float fac_x1, fac_x2, fac_y1, fac_y2;
} NodeTwoXYs;
typedef struct NodeTwoFloats {
diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h
index 096fd319a17..1d3a2c1059c 100644
--- a/source/blender/makesdna/DNA_object_types.h
+++ b/source/blender/makesdna/DNA_object_types.h
@@ -402,6 +402,7 @@ extern Object workob;
#define OB_BOUND_POLYH 4
#define OB_BOUND_POLYT 5
#define OB_BOUND_DYN_MESH 6
+#define OB_BOUND_CAPSULE 7
/* **************** BASE ********************* */
@@ -564,4 +565,3 @@ typedef enum ObjectMode {
#endif
-
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 97dd99c5abe..153b6acd525 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -380,6 +380,8 @@ typedef struct UserDef {
float sculpt_paint_overlay_col[3];
int pad3;
+
+ char author[80]; /* author name for file formats supporting it */
} UserDef;
extern UserDef U; /* from blenkernel blender.c */
diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h
index c5516a3bff5..520fc56162c 100644
--- a/source/blender/makesdna/DNA_view3d_types.h
+++ b/source/blender/makesdna/DNA_view3d_types.h
@@ -185,7 +185,9 @@ typedef struct View3D {
unsigned int customdata_mask;
/* afterdraw, for xray & transparent */
- struct ListBase afterdraw;
+ struct ListBase afterdraw_transp;
+ struct ListBase afterdraw_xray;
+ struct ListBase afterdraw_xraytransp;
/* drawflags, denoting state */
short zbuf, transp, xray;
diff --git a/source/blender/makesdna/intern/SConscript b/source/blender/makesdna/intern/SConscript
index 897e7c3702b..ac897eaed14 100644
--- a/source/blender/makesdna/intern/SConscript
+++ b/source/blender/makesdna/intern/SConscript
@@ -51,7 +51,7 @@ if not (root_build_dir[0]==os.sep or root_build_dir[1]==':'):
targetdir = '#' + targetdir
#root_build_dir = "#"
-makesdna = makesdna_tool.Program (target = targetdir, source = source_files, LIBS=['bf_guardedalloc', 'bf_blenlib'])
+makesdna = makesdna_tool.Program (target = targetdir, source = source_files, LIBS=['bf_intern_guardedalloc', 'bf_blenlib'])
dna_dict = dna.Dictionary()
dna.Depends ('dna.c', makesdna)
diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c
index 4133afffeed..7a2d659755a 100644
--- a/source/blender/makesdna/intern/makesdna.c
+++ b/source/blender/makesdna/intern/makesdna.c
@@ -972,6 +972,8 @@ int make_structDNA(char *baseDirectory, FILE *file)
dna_write(file, str, 4);
len= nr_names;
dna_write(file, &len, 4);
+ printf("LEEEN %d\n", len);
+
/* calculate size of datablock with strings */
cp= names[nr_names-1];
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index 43697ec5d9e..e454dda0ae6 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -276,7 +276,7 @@ extern StructRNA RNA_LimitScaleConstraint;
extern StructRNA RNA_LockedTrackConstraint;
extern StructRNA RNA_Macro;
extern StructRNA RNA_MagicTexture;
-extern StructRNA RNA_Main;
+extern StructRNA RNA_BlendData;
extern StructRNA RNA_MarbleTexture;
extern StructRNA RNA_MaskModifier;
extern StructRNA RNA_Material;
diff --git a/source/blender/makesrna/RNA_define.h b/source/blender/makesrna/RNA_define.h
index f6ae5dcdbbd..6422950b5e4 100644
--- a/source/blender/makesrna/RNA_define.h
+++ b/source/blender/makesrna/RNA_define.h
@@ -90,6 +90,7 @@ void RNA_def_enum_funcs(PropertyRNA *prop, EnumPropertyItemFunc itemfunc);
PropertyRNA *RNA_def_float(StructOrFunctionRNA *cont, const char *identifier, float default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax);
PropertyRNA *RNA_def_float_vector(StructOrFunctionRNA *cont, const char *identifier, int len, const float *default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax);
+PropertyRNA *RNA_def_float_vector_xyz(StructOrFunctionRNA *cont, const char *identifier, int len, const float *default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax);
PropertyRNA *RNA_def_float_color(StructOrFunctionRNA *cont, const char *identifier, int len, const float *default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax);
PropertyRNA *RNA_def_float_matrix(StructOrFunctionRNA *cont, const char *identifier, int rows, int columns, const float *default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax);
PropertyRNA *RNA_def_float_rotation(StructOrFunctionRNA *cont, const char *identifier, int len, const float *default_value,
diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h
index 887069d6c00..5caae56010f 100644
--- a/source/blender/makesrna/RNA_types.h
+++ b/source/blender/makesrna/RNA_types.h
@@ -22,6 +22,8 @@
* ***** END GPL LICENSE BLOCK *****
*/
+#include "BLO_sys_types.h"
+
#ifndef RNA_TYPES
#define RNA_TYPES
@@ -265,6 +267,12 @@ typedef struct ParameterIterator {
int valid;
} ParameterIterator;
+/* mainly to avoid confusing casts */
+typedef struct ParameterDynAlloc {
+ intptr_t array_tot; /* important, this breaks when set to an int */
+ void *array;
+} ParameterDynAlloc;
+
/* Function */
typedef enum FunctionFlag {
diff --git a/source/blender/makesrna/intern/SConscript b/source/blender/makesrna/intern/SConscript
index cdb9cdd3126..88b29e10d1d 100644
--- a/source/blender/makesrna/intern/SConscript
+++ b/source/blender/makesrna/intern/SConscript
@@ -138,9 +138,9 @@ if not (root_build_dir[0]==os.sep or root_build_dir[1]==':'):
targetpath = '#' + targetpath
if env['OURPLATFORM'] == 'linux2' and root_build_dir[0]==os.sep:
- makesrna = makesrna_tool.Program (target = targetpath, source = source_files, LIBS=['bf_guardedalloc', 'bf_dna', 'bf_blenlib'])
+ makesrna = makesrna_tool.Program (target = targetpath, source = source_files, LIBS=['bf_intern_guardedalloc', 'bf_dna', 'bf_blenlib'])
else:
- makesrna = makesrna_tool.Program (target = targetpath, source = source_files, LIBS=['bf_guardedalloc', 'bf_dna', 'bf_blenlib'])
+ makesrna = makesrna_tool.Program (target = targetpath, source = source_files, LIBS=['bf_intern_guardedalloc', 'bf_dna', 'bf_blenlib'])
rna_dict = rna.Dictionary()
rna.Depends (generated_files, makesrna)
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c
index af0faf5a165..68414eae3f8 100644
--- a/source/blender/makesrna/intern/makesrna.c
+++ b/source/blender/makesrna/intern/makesrna.c
@@ -49,6 +49,7 @@
static int replace_if_different(char *tmpfile)
{
+ // return 0; // use for testing had edited rna
#define REN_IF_DIFF \
remove(orgfile); \
@@ -1412,10 +1413,12 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA
fprintf(f, "\n{\n");
/* variable definitions */
- if((func->flag & FUNC_NO_SELF)==0) {
- if(func->flag & FUNC_USE_SELF_ID)
+
+ if(func->flag & FUNC_USE_SELF_ID) {
fprintf(f, "\tstruct ID *_selfid;\n");
+ }
+ if((func->flag & FUNC_NO_SELF)==0) {
if(dsrna->dnaname) fprintf(f, "\tstruct %s *_self;\n", dsrna->dnaname);
else fprintf(f, "\tstruct %s *_self;\n", srna->identifier);
}
@@ -1441,11 +1444,11 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA
else
ptrstr= pout ? "*" : "";
- fprintf(f, "\t%s%s %s%s;\n", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop), ptrstr, dparm->prop->identifier);
-
/* for dynamic parameters we pass an additional int for the length of the parameter */
if (flag & PROP_DYNAMIC)
fprintf(f, "\tint %s%s_len;\n", pout ? "*" : "", dparm->prop->identifier);
+
+ fprintf(f, "\t%s%s %s%s;\n", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop), ptrstr, dparm->prop->identifier);
}
fprintf(f, "\tchar *_data");
@@ -1454,10 +1457,11 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA
fprintf(f, "\t\n");
/* assign self */
- if((func->flag & FUNC_NO_SELF)==0) {
- if(func->flag & FUNC_USE_SELF_ID)
+ if(func->flag & FUNC_USE_SELF_ID) {
fprintf(f, "\t_selfid= (struct ID*)_ptr->id.data;\n");
+ }
+ if((func->flag & FUNC_NO_SELF)==0) {
if(dsrna->dnaname) fprintf(f, "\t_self= (struct %s *)_ptr->data;\n", dsrna->dnaname);
else fprintf(f, "\t_self= (struct %s *)_ptr->data;\n", srna->identifier);
}
@@ -1474,6 +1478,7 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA
if(dparm->prop==func->c_ret)
fprintf(f, "\t_retdata= _data;\n");
else {
+ char *data_str;
if (cptr || (flag & PROP_DYNAMIC)) {
ptrstr= "**";
valstr= "*";
@@ -1491,16 +1496,20 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA
valstr= "*";
}
+ /* this must be kept in sync with RNA_parameter_length_get_data, we could just call the function directly, but this is faster */
+ if (flag & PROP_DYNAMIC) {
+ fprintf(f, "\t%s_len= %s((int *)_data);\n", dparm->prop->identifier, pout ? "" : "*");
+ data_str= "(&(((char *)_data)[sizeof(void *)]))";
+ }
+ else {
+ data_str= "_data";
+ }
fprintf(f, "\t%s= ", dparm->prop->identifier);
if (!pout)
fprintf(f, "%s", valstr);
- fprintf(f, "((%s%s%s)_data);\n", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop), ptrstr);
-
- /* this must be kept in sync with RNA_parameter_length_get_data, we could just call the function directly, but this is faster */
- if (flag & PROP_DYNAMIC)
- fprintf(f, "\t%s_len= %s((int *)(_data+%d));\n", dparm->prop->identifier, pout ? "" : "*", rna_parameter_size(dparm->prop));
+ fprintf(f, "((%s%s%s)%s);\n", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop), ptrstr, data_str);
}
if(dparm->next)
@@ -1515,10 +1524,13 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA
first= 1;
- if((func->flag & FUNC_NO_SELF)==0) {
- if(func->flag & FUNC_USE_SELF_ID)
- fprintf(f, "_selfid, ");
+ if(func->flag & FUNC_USE_SELF_ID) {
+ fprintf(f, "_selfid");
+ first= 0;
+ }
+ if((func->flag & FUNC_NO_SELF)==0) {
+ if(!first) fprintf(f, ", ");
fprintf(f, "_self");
first= 0;
}
@@ -1543,10 +1555,10 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA
if(!first) fprintf(f, ", ");
first= 0;
- fprintf(f, "%s", dparm->prop->identifier);
-
if (dparm->prop->flag & PROP_DYNAMIC)
- fprintf(f, ", %s_len", dparm->prop->identifier);
+ fprintf(f, "%s_len, %s", dparm->prop->identifier, dparm->prop->identifier);
+ else
+ fprintf(f, "%s", dparm->prop->identifier);
}
fprintf(f, ");\n");
@@ -1820,10 +1832,13 @@ static void rna_generate_static_parameter_prototypes(BlenderRNA *brna, StructRNA
first= 1;
/* self, context and reports parameters */
+ if(func->flag & FUNC_USE_SELF_ID) {
+ fprintf(f, "struct ID *_selfid");
+ first= 0;
+ }
+
if((func->flag & FUNC_NO_SELF)==0) {
- if(func->flag & FUNC_USE_SELF_ID)
- fprintf(f, "struct ID *_selfid, ");
-
+ if(!first) fprintf(f, ", ");
if(dsrna->dnaname) fprintf(f, "struct %s *_self", dsrna->dnaname);
else fprintf(f, "struct %s *_self", srna->identifier);
first= 0;
@@ -1863,13 +1878,14 @@ static void rna_generate_static_parameter_prototypes(BlenderRNA *brna, StructRNA
if(!first) fprintf(f, ", ");
first= 0;
+ if (flag & PROP_DYNAMIC)
+ fprintf(f, "int %s%s_len, ", pout ? "*" : "", dparm->prop->identifier);
+
if(!(flag & PROP_DYNAMIC) && dparm->prop->arraydimension)
fprintf(f, "%s%s %s[%d]", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop), dparm->prop->identifier, dparm->prop->totarraylength);
else
fprintf(f, "%s%s %s%s", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop), ptrstr, dparm->prop->identifier);
- if (flag & PROP_DYNAMIC)
- fprintf(f, ", int %s%s_len", pout ? "*" : "", dparm->prop->identifier);
}
fprintf(f, ");\n");
diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c
index a8b7fb1540b..b9ef92cdca1 100644
--- a/source/blender/makesrna/intern/rna_ID.c
+++ b/source/blender/makesrna/intern/rna_ID.c
@@ -71,6 +71,7 @@ EnumPropertyItem id_type_items[] = {
#include "BKE_idprop.h"
#include "BKE_library.h"
#include "BKE_animsys.h"
+#include "BKE_material.h"
/* name functions that ignore the first two ID characters */
void rna_ID_name_get(PointerRNA *ptr, char *value)
@@ -331,6 +332,31 @@ static void rna_def_ID_properties(BlenderRNA *brna)
RNA_def_struct_name_property(srna, prop);
}
+
+static void rna_def_ID_materials(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ /* for mesh/mball/curve materials */
+ srna= RNA_def_struct(brna, "IDMaterials", NULL);
+ RNA_def_struct_sdna(srna, "ID");
+ RNA_def_struct_ui_text(srna, "ID Materials", "Collection of materials");
+
+ func= RNA_def_function(srna, "append", "material_append_id");
+ RNA_def_function_ui_description(func, "Add a new material to Mesh.");
+ parm= RNA_def_pointer(func, "material", "Material", "", "Material to add.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+
+ func= RNA_def_function(srna, "pop", "material_pop_id");
+ RNA_def_function_ui_description(func, "Add a new material to Mesh.");
+ parm= RNA_def_int(func, "index", 0, 0, INT_MAX, "", "Frame number to set.", 0, INT_MAX);
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ parm= RNA_def_pointer(func, "material", "Material", "", "Material to add.");
+ RNA_def_function_return(func, parm);
+}
+
static void rna_def_ID(BlenderRNA *brna)
{
StructRNA *srna;
@@ -422,6 +448,7 @@ void RNA_def_ID(BlenderRNA *brna)
rna_def_ID(brna);
rna_def_ID_properties(brna);
+ rna_def_ID_materials(brna);
rna_def_library(brna);
}
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index 73af75ca960..2d39cac8c6d 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -95,7 +95,7 @@ PointerRNA PointerRNA_NULL = {{0}, 0, 0};
void RNA_main_pointer_create(struct Main *main, PointerRNA *r_ptr)
{
r_ptr->id.data= NULL;
- r_ptr->type= &RNA_Main;
+ r_ptr->type= &RNA_BlendData;
r_ptr->data= main;
}
@@ -732,7 +732,7 @@ char RNA_property_array_item_char(PropertyRNA *prop, int index)
/* get string to use for array index */
if ((index < 4) && ELEM(subtype, PROP_QUATERNION, PROP_AXISANGLE))
return quatitem[index];
- else if((index < 4) && ELEM6(subtype, PROP_TRANSLATION, PROP_DIRECTION, PROP_XYZ, PROP_EULER, PROP_VELOCITY, PROP_ACCELERATION))
+ else if((index < 4) && ELEM7(subtype, PROP_TRANSLATION, PROP_DIRECTION, PROP_XYZ, PROP_XYZ_LENGTH, PROP_EULER, PROP_VELOCITY, PROP_ACCELERATION))
return vectoritem[index];
else if ((index < 4) && ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA))
return coloritem[index];
@@ -2949,7 +2949,7 @@ int RNA_path_resolve_full(PointerRNA *ptr, const char *path, PointerRNA *r_ptr,
PropertyRNA *prop;
PointerRNA curptr, nextptr;
char fixedbuf[256], *token;
- int type, len, intkey;
+ int type, intkey;
prop= NULL;
curptr= *ptr;
@@ -2993,22 +2993,23 @@ int RNA_path_resolve_full(PointerRNA *ptr, const char *path, PointerRNA *r_ptr,
case PROP_POINTER:
nextptr= RNA_property_pointer_get(&curptr, prop);
- if(nextptr.data)
+ if(nextptr.data) {
curptr= nextptr;
+ prop= NULL; /* now we have a PointerRNA, the prop is our parent so forget it */
+ }
else
return 0;
break;
case PROP_COLLECTION:
if(*path) {
+ if(*path == '[') {
/* resolve the lookup with [] brackets */
token= rna_path_token(&path, fixedbuf, sizeof(fixedbuf), 1);
if(!token)
return 0;
- len= strlen(token);
-
/* check for "" to see if it is a string */
if(rna_token_strip_quotes(token)) {
RNA_property_collection_lookup_string(&curptr, prop, token+1, &nextptr);
@@ -3019,11 +3020,25 @@ int RNA_path_resolve_full(PointerRNA *ptr, const char *path, PointerRNA *r_ptr,
RNA_property_collection_lookup_int(&curptr, prop, intkey, &nextptr);
}
- if(token != fixedbuf)
+ if(token != fixedbuf) {
MEM_freeN(token);
+ }
+ }
+ else {
+ PointerRNA c_ptr;
+
+ /* ensure we quit on invalid values */
+ nextptr.data = NULL;
- if(nextptr.data)
+ if(RNA_property_collection_type_get(&curptr, prop, &c_ptr)) {
+ nextptr= c_ptr;
+ }
+ }
+
+ if(nextptr.data) {
curptr= nextptr;
+ prop= NULL; /* now we have a PointerRNA, the prop is our parent so forget it */
+ }
else
return 0;
}
@@ -3824,7 +3839,14 @@ ParameterList *RNA_parameter_list_create(ParameterList *parms, PointerRNA *ptr,
for(parm= func->cont.properties.first; parm; parm= parm->next) {
size= rna_parameter_size(parm);
- if(!(parm->flag & PROP_REQUIRED)) {
+ /* set length to 0, these need to be set later, see bpy_array.c's py_to_array */
+ if (parm->flag & PROP_DYNAMIC) {
+ ParameterDynAlloc *data_alloc= data;
+ data_alloc->array_tot= 0;
+ data_alloc->array= NULL;
+ }
+
+ if(!(parm->flag & PROP_REQUIRED) && !(parm->flag & PROP_DYNAMIC)) {
switch(parm->type) {
case PROP_BOOLEAN:
if(parm->arraydimension) memcpy(data, &((BooleanPropertyRNA*)parm)->defaultarray, size);
@@ -3853,10 +3875,6 @@ ParameterList *RNA_parameter_list_create(ParameterList *parms, PointerRNA *ptr,
}
}
- /* set length to 0 */
- if (parm->flag & PROP_DYNAMIC)
- *((int *)(((char *)data) + size))= 0;
-
data= ((char*)data) + rna_parameter_size_alloc(parm);
}
@@ -3874,9 +3892,9 @@ void RNA_parameter_list_free(ParameterList *parms)
BLI_freelistN((ListBase*)((char*)parms->data+tot));
else if (parm->flag & PROP_DYNAMIC) {
/* for dynamic arrays and strings, data is a pointer to an array */
- char *array= *(char**)((char*)parms->data+tot);
- if(array)
- MEM_freeN(array);
+ ParameterDynAlloc *data_alloc= (void *)(((char *)parms->data) + tot);
+ if(data_alloc->array)
+ MEM_freeN(data_alloc->array);
}
tot+= rna_parameter_size_alloc(parm);
@@ -4038,12 +4056,12 @@ void RNA_parameter_length_set(ParameterList *parms, PropertyRNA *parm, int lengt
int RNA_parameter_length_get_data(ParameterList *parms, PropertyRNA *parm, void *data)
{
- return *((int *)(((char *)data) + rna_parameter_size(parm)));
+ return *((int *)((char *)data));
}
void RNA_parameter_length_set_data(ParameterList *parms, PropertyRNA *parm, void *data, int length)
{
- *((int *)(((char *)data) + rna_parameter_size(parm)))= length;
+ *((int *)data)= length;
}
int RNA_function_call(bContext *C, ReportList *reports, PointerRNA *ptr, FunctionRNA *func, ParameterList *parms)
diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c
index 623717e469f..42ddf340f12 100644
--- a/source/blender/makesrna/intern/rna_action.c
+++ b/source/blender/makesrna/intern/rna_action.c
@@ -59,7 +59,7 @@ static void rna_ActionGroup_channels_next(CollectionPropertyIterator *iter)
iter->valid= (internal->link != NULL);
}
-static bActionGroup *rna_Action_groups_add(bAction *act, char name[])
+static bActionGroup *rna_Action_groups_new(bAction *act, char name[])
{
return action_groups_add_new(act, name);
}
@@ -149,6 +149,11 @@ static void rna_Action_pose_markers_remove(bAction *act, ReportList *reports, Ti
MEM_freeN(marker);
}
+static void rna_Action_frame_range_get(PointerRNA *ptr,float *values)
+{
+ calc_action_range(ptr->id.data, values, values+1, 1);
+}
+
#else
static void rna_def_dopesheet(BlenderRNA *brna)
@@ -361,7 +366,7 @@ static void rna_def_action_groups(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_struct_sdna(srna, "bAction");
RNA_def_struct_ui_text(srna, "Action Groups", "Collection of action groups");
- func= RNA_def_function(srna, "add", "rna_Action_groups_add");
+ func= RNA_def_function(srna, "new", "rna_Action_groups_new");
RNA_def_function_ui_description(func, "Add a keyframe to the curve.");
parm= RNA_def_string(func, "name", "Group", 0, "", "New name for the action group.");
RNA_def_property_flag(parm, PROP_REQUIRED);
@@ -393,6 +398,7 @@ static void rna_def_action_fcurves(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_ui_description(func, "Add a keyframe to the curve.");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
parm= RNA_def_string(func, "data_path", "", 0, "Data Path", "FCurve data path to use.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
parm= RNA_def_int(func, "array_index", 0, 0, INT_MAX, "Index", "Array index.", 0, INT_MAX);
parm= RNA_def_string(func, "action_group", "", 0, "Action Group", "Acton group to add this fcurve into.");
@@ -463,6 +469,10 @@ static void rna_def_action(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Pose Markers", "Markers specific to this Action, for labeling poses");
rna_def_action_pose_markers(brna, prop);
+ prop= RNA_def_float_vector(srna, "frame_range" , 2 , NULL , 0, 0, "Frame Range" , "The final frame range of all fcurves within this action" , 0 , 0);
+ RNA_def_property_float_funcs(prop, "rna_Action_frame_range_get" , NULL, NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
RNA_api_action(srna);
}
diff --git a/source/blender/makesrna/intern/rna_action_api.c b/source/blender/makesrna/intern/rna_action_api.c
index 0304ef2b0bd..3d661f50115 100644
--- a/source/blender/makesrna/intern/rna_action_api.c
+++ b/source/blender/makesrna/intern/rna_action_api.c
@@ -40,35 +40,11 @@
#include "DNA_anim_types.h"
#include "DNA_curve_types.h"
-/* return frame range of all curves (min, max) or (0, 1) if there are no keys */
-void rna_Action_get_frame_range(bAction *act, int **frame_range, int *length_r)
-{
- int *ret;
- float start, end;
-
- calc_action_range(act, &start, &end, 1);
-
- *length_r= 2;
- ret= MEM_callocN(*length_r * sizeof(int), "rna_Action_get_frame_range");
-
- ret[0]= (int)start;
- ret[1]= (int)end;
-
- *frame_range= ret;
-}
-
#else
void RNA_api_action(StructRNA *srna)
{
- FunctionRNA *func;
- PropertyRNA *parm;
- func= RNA_def_function(srna, "get_frame_range", "rna_Action_get_frame_range");
- RNA_def_function_ui_description(func, "Get action frame range as a (min, max) tuple.");
- parm= RNA_def_int_array(func, "frame_range", 1, NULL, 0, 0, "", "Action frame range.", 0, 0);
- RNA_def_property_flag(parm, PROP_DYNAMIC);
- RNA_def_function_output(func, parm);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c
index 87a002db828..92f146770c2 100644
--- a/source/blender/makesrna/intern/rna_animation.c
+++ b/source/blender/makesrna/intern/rna_animation.c
@@ -528,7 +528,6 @@ static void rna_def_keyingset_path(BlenderRNA *brna)
}
-
/* keyingset.paths */
static void rna_def_keyingset_paths(BlenderRNA *brna, PropertyRNA *cprop)
{
@@ -537,6 +536,8 @@ static void rna_def_keyingset_paths(BlenderRNA *brna, PropertyRNA *cprop)
FunctionRNA *func;
PropertyRNA *parm;
+ PropertyRNA *prop;
+
RNA_def_property_srna(cprop, "KeyingSetPaths");
srna= RNA_def_struct(brna, "KeyingSetPaths", NULL);
RNA_def_struct_sdna(srna, "KeyingSet");
@@ -569,13 +570,25 @@ static void rna_def_keyingset_paths(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_flag(func, FUNC_USE_REPORTS);
/* path to remove */
parm= RNA_def_pointer(func, "path", "KeyingSetPath", "Path", "");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
/* Remove All Paths */
func= RNA_def_function(srna, "clear", "rna_KeyingSet_paths_clear");
RNA_def_function_ui_description(func, "Remove all the paths from the Keying Set.");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
+
+ prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "KeyingSetPath");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_editable_func(prop, "rna_KeyingSet_active_ksPath_editable");
+ RNA_def_property_pointer_funcs(prop, "rna_KeyingSet_active_ksPath_get", "rna_KeyingSet_active_ksPath_set", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Active Keying Set", "Active Keying Set used to insert/delete keyframes");
+
+ prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "active_path");
+ RNA_def_property_int_funcs(prop, "rna_KeyingSet_active_ksPath_index_get", "rna_KeyingSet_active_ksPath_index_set", "rna_KeyingSet_active_ksPath_index_range");
+ RNA_def_property_ui_text(prop, "Active Path Index", "Current Keying Set index");
}
static void rna_def_keyingset(BlenderRNA *brna)
@@ -605,18 +618,6 @@ static void rna_def_keyingset(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Paths", "Keying Set Paths to define settings that get keyframed together");
rna_def_keyingset_paths(brna, prop);
- prop= RNA_def_property(srna, "active_path", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "KeyingSetPath");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_editable_func(prop, "rna_KeyingSet_active_ksPath_editable");
- RNA_def_property_pointer_funcs(prop, "rna_KeyingSet_active_ksPath_get", "rna_KeyingSet_active_ksPath_set", NULL, NULL);
- RNA_def_property_ui_text(prop, "Active Keying Set", "Active Keying Set used to insert/delete keyframes");
-
- prop= RNA_def_property(srna, "active_path_index", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "active_path");
- RNA_def_property_int_funcs(prop, "rna_KeyingSet_active_ksPath_index_get", "rna_KeyingSet_active_ksPath_index_set", "rna_KeyingSet_active_ksPath_index_range");
- RNA_def_property_ui_text(prop, "Active Path Index", "Current Keying Set index");
-
/* Flags */
prop= RNA_def_property(srna, "is_path_absolute", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c
index 8b21fd2c80a..f2abe690218 100644
--- a/source/blender/makesrna/intern/rna_armature.c
+++ b/source/blender/makesrna/intern/rna_armature.c
@@ -108,6 +108,12 @@ void rna_Armature_edit_bone_remove(bArmature *arm, ReportList *reports, EditBone
BKE_reportf(reports, RPT_ERROR, "Armature '%s' not in editmode, cant remove an editbone.", arm->id.name+2);
return;
}
+
+ if(BLI_findindex(arm->edbo, ebone) == -1) {
+ BKE_reportf(reports, RPT_ERROR, "Armature '%s' doesn't contain bone '%s'.", arm->id.name+2, ebone->name);
+ return;
+ }
+
ED_armature_edit_bone_remove(arm, ebone);
}
@@ -712,7 +718,7 @@ static void rna_def_armature_edit_bones(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_ui_description(func, "Remove an existing bone from the armature");
/* target to remove*/
parm= RNA_def_pointer(func, "bone", "EditBone", "", "EditBone to remove");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
static void rna_def_armature(BlenderRNA *brna)
diff --git a/source/blender/makesrna/intern/rna_cloth.c b/source/blender/makesrna/intern/rna_cloth.c
index e40bbcbbf50..71e95248512 100644
--- a/source/blender/makesrna/intern/rna_cloth.c
+++ b/source/blender/makesrna/intern/rna_cloth.c
@@ -253,7 +253,7 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Mass", "Mass of cloth material");
RNA_def_property_update(prop, 0, "rna_cloth_update");
- prop= RNA_def_property(srna, "mass_vertex_group", PROP_STRING, PROP_NONE);
+ prop= RNA_def_property(srna, "vertex_group_mass", PROP_STRING, PROP_NONE);
RNA_def_property_string_funcs(prop, "rna_ClothSettings_mass_vgroup_get", "rna_ClothSettings_mass_vgroup_length", "rna_ClothSettings_mass_vgroup_set");
RNA_def_property_ui_text(prop, "Mass Vertex Group", "Vertex Group for pinning of vertices");
RNA_def_property_update(prop, 0, "rna_cloth_update");
@@ -316,7 +316,7 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Structural Stiffness Maximum", "Maximum structural stiffness value");
RNA_def_property_update(prop, 0, "rna_cloth_update");
- prop= RNA_def_property(srna, "structural_stiffness_vertex_group", PROP_STRING, PROP_NONE);
+ prop= RNA_def_property(srna, "vertex_group_structural_stiffness", PROP_STRING, PROP_NONE);
RNA_def_property_string_funcs(prop, "rna_ClothSettings_struct_vgroup_get", "rna_ClothSettings_struct_vgroup_length", "rna_ClothSettings_struct_vgroup_set");
RNA_def_property_ui_text(prop, "Structural Stiffness Vertex Group", "Vertex group for fine control over structural stiffness");
RNA_def_property_update(prop, 0, "rna_cloth_update");
@@ -334,7 +334,7 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Bending Stiffness Maximum", "Maximum bending stiffness value");
RNA_def_property_update(prop, 0, "rna_cloth_update");
- prop= RNA_def_property(srna, "bending_vertex_group", PROP_STRING, PROP_NONE);
+ prop= RNA_def_property(srna, "vertex_group_bending", PROP_STRING, PROP_NONE);
RNA_def_property_string_funcs(prop, "rna_ClothSettings_bend_vgroup_get", "rna_ClothSettings_bend_vgroup_length", "rna_ClothSettings_bend_vgroup_set");
RNA_def_property_ui_text(prop, "Bending Stiffness Vertex Group", "Vertex group for fine control over bending stiffness");
RNA_def_property_update(prop, 0, "rna_cloth_update");
diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c
index ba3f2b09a20..89f3e459105 100644
--- a/source/blender/makesrna/intern/rna_color.c
+++ b/source/blender/makesrna/intern/rna_color.c
@@ -465,9 +465,8 @@ static void rna_def_color_ramp_element_api(BlenderRNA *brna, PropertyRNA *cprop)
func = RNA_def_function(srna, "remove", "rna_ColorRampElement_remove");
RNA_def_function_ui_description(func, "Delete element from ColorRamp");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
- //parm= RNA_def_int(func, "index", 0, 0, 31, "Index", "Element to delete.", 0, 31);
parm= RNA_def_pointer(func, "element", "ColorRampElement", "", "Element to remove.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
static void rna_def_color_ramp(BlenderRNA *brna)
diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c
index a58807902d8..cf5db930898 100644
--- a/source/blender/makesrna/intern/rna_constraint.c
+++ b/source/blender/makesrna/intern/rna_constraint.c
@@ -1941,7 +1941,7 @@ void RNA_def_constraint(BlenderRNA *brna)
/* flags */
prop= RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_OFF);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_OFF);
RNA_def_property_ui_text(prop, "Enabled", "Enable/Disable Constraint");
prop= RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_context.c b/source/blender/makesrna/intern/rna_context.c
index 6cc93d088ad..ebe0e363b26 100644
--- a/source/blender/makesrna/intern/rna_context.c
+++ b/source/blender/makesrna/intern/rna_context.c
@@ -93,7 +93,7 @@ static PointerRNA rna_Context_region_data_get(PointerRNA *ptr)
static PointerRNA rna_Context_main_get(PointerRNA *ptr)
{
bContext *C= (bContext*)ptr->data;
- return rna_pointer_inherit_refine(ptr, &RNA_Main, CTX_data_main(C));
+ return rna_pointer_inherit_refine(ptr, &RNA_BlendData, CTX_data_main(C));
}
static PointerRNA rna_Context_scene_get(PointerRNA *ptr)
@@ -151,7 +151,7 @@ void RNA_def_context(BlenderRNA *brna)
RNA_def_struct_sdna(srna, "bContext");
/* WM */
- prop= RNA_def_property(srna, "manager", PROP_POINTER, PROP_NONE);
+ prop= RNA_def_property(srna, "window_manager", PROP_POINTER, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_struct_type(prop, "WindowManager");
RNA_def_property_pointer_funcs(prop, "rna_Context_manager_get", NULL, NULL, NULL);
@@ -187,9 +187,9 @@ void RNA_def_context(BlenderRNA *brna)
RNA_def_property_pointer_funcs(prop, "rna_Context_region_data_get", NULL, NULL, NULL);
/* Data */
- prop= RNA_def_property(srna, "main", PROP_POINTER, PROP_NONE);
+ prop= RNA_def_property(srna, "blend_data", PROP_POINTER, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_struct_type(prop, "Main");
+ RNA_def_property_struct_type(prop, "BlendData");
RNA_def_property_pointer_funcs(prop, "rna_Context_main_get", NULL, NULL, NULL);
prop= RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c
index cfca29aaa83..e28212470c3 100644
--- a/source/blender/makesrna/intern/rna_curve.c
+++ b/source/blender/makesrna/intern/rna_curve.c
@@ -356,6 +356,18 @@ static void rna_Curve_resolution_v_update_data(Main *bmain, Scene *scene, Pointe
rna_Curve_update_data(bmain, scene, ptr);
}
+static float rna_Curve_offset_get(PointerRNA *ptr)
+{
+ Curve *cu= (Curve*)ptr->id.data;
+ return cu->width - 1.0f;
+}
+
+static void rna_Curve_offset_set(PointerRNA *ptr, float value)
+{
+ Curve *cu= (Curve*)ptr->id.data;
+ cu->width= 1.0f + value;
+}
+
/* name functions that ignore the first two ID characters */
void rna_Curve_body_get(PointerRNA *ptr, char *value)
{
@@ -482,7 +494,6 @@ static Nurb *rna_Curve_spline_new(Curve *cu, int type)
static void rna_Curve_spline_remove(Curve *cu, ReportList *reports, Nurb *nu)
{
- /* todo, check we're in the list */
int found= 0;
ListBase *nurbs= BKE_curve_nurbs(cu);
@@ -986,7 +997,7 @@ static void rna_def_curve_spline_points(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_ui_description(func, "Remove a spline from a curve.");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
parm= RNA_def_pointer(func, "spline", "Spline", "", "The spline to remove.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
*/
}
@@ -1013,7 +1024,7 @@ static void rna_def_curve_spline_bezpoints(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_ui_description(func, "Remove a spline from a curve.");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
parm= RNA_def_pointer(func, "spline", "Spline", "", "The spline to remove.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
*/
}
@@ -1042,7 +1053,7 @@ static void rna_def_curve_splines(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_ui_description(func, "Remove a spline from a curve.");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
parm= RNA_def_pointer(func, "spline", "Spline", "", "The spline to remove.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "Object");
@@ -1110,8 +1121,9 @@ static void rna_def_curve(BlenderRNA *brna)
prop= RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "width");
- RNA_def_property_ui_range(prop, 0, 2.0, 0.1, 3);
- RNA_def_property_ui_text(prop, "Width", "Scale the original width (1.0) based on given factor");
+ RNA_def_property_ui_range(prop, -1.0, 1.0, 0.1, 3);
+ RNA_def_property_float_funcs(prop, "rna_Curve_offset_get", "rna_Curve_offset_set", NULL);
+ RNA_def_property_ui_text(prop, "Offset", "Offset the curve to adjust the width of a text");
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
prop= RNA_def_property(srna, "extrude", PROP_FLOAT, PROP_NONE);
@@ -1249,6 +1261,7 @@ static void rna_def_curve(BlenderRNA *brna)
RNA_def_property_collection_sdna(prop, NULL, "mat", "totcol");
RNA_def_property_struct_type(prop, "Material");
RNA_def_property_ui_text(prop, "Materials", "");
+ RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.c */
}
static void rna_def_curve_nurb(BlenderRNA *brna)
diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c
index 43bf40d3965..750b1eef2a9 100644
--- a/source/blender/makesrna/intern/rna_define.c
+++ b/source/blender/makesrna/intern/rna_define.c
@@ -2201,6 +2201,17 @@ PropertyRNA *RNA_def_float_vector(StructOrFunctionRNA *cont_, const char *identi
return prop;
}
+PropertyRNA *RNA_def_float_vector_xyz(StructOrFunctionRNA *cont_, const char *identifier, int len, const float *default_value,
+ float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
+{
+ PropertyRNA *prop;
+
+ prop= RNA_def_float_vector(cont_, identifier, len, default_value, hardmin, hardmax, ui_name, ui_description, softmin, softmax);
+ prop->subtype = PROP_XYZ_LENGTH;
+
+ return prop;
+}
+
PropertyRNA *RNA_def_float_color(StructOrFunctionRNA *cont_, const char *identifier, int len, const float *default_value,
float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
{
@@ -2514,7 +2525,7 @@ int rna_parameter_size_alloc(PropertyRNA *parm)
int size = rna_parameter_size(parm);
if (parm->flag & PROP_DYNAMIC)
- size+= sizeof(int);
+ size+= sizeof(((ParameterDynAlloc *)NULL)->array_tot);
return size;
}
diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c
index b37e5f91538..aa377f063e1 100644
--- a/source/blender/makesrna/intern/rna_fcurve.c
+++ b/source/blender/makesrna/intern/rna_fcurve.c
@@ -385,9 +385,13 @@ DriverVar *rna_Driver_new_variable(ChannelDriver *driver)
return driver_add_new_variable(driver);
}
-void rna_Driver_remove_variable(ChannelDriver *driver, DriverVar *dvar)
+void rna_Driver_remove_variable(ChannelDriver *driver, ReportList *reports, DriverVar *dvar)
{
- /* call the API function for this */
+ if(BLI_findindex(&driver->variables, dvar) == -1) {
+ BKE_report(reports, RPT_ERROR, "Variable does not exist in this driver.");
+ return;
+ }
+
driver_free_variable(driver, dvar);
}
@@ -410,9 +414,13 @@ static FModifier *rna_FCurve_modifiers_new(FCurve *fcu, int type)
return add_fmodifier(&fcu->modifiers, type);
}
-static int rna_FCurve_modifiers_remove(FCurve *fcu, int index)
+static void rna_FCurve_modifiers_remove(FCurve *fcu, ReportList *reports, FModifier *fcm)
{
- return remove_fmodifier_index(&fcu->modifiers, index);
+ if(BLI_findindex(&fcu->modifiers, fcm) == -1) {
+ BKE_reportf(reports, RPT_ERROR, "FCurveModifier '%s' not found in fcurve.", fcm->name);
+ return;
+}
+ remove_fmodifier(&fcu->modifiers, fcm);
}
static void rna_FModifier_active_set(PointerRNA *ptr, int value)
@@ -1095,9 +1103,10 @@ static void rna_def_channeldriver_variables(BlenderRNA *brna, PropertyRNA *cprop
/* remove variable */
func= RNA_def_function(srna, "remove", "rna_Driver_remove_variable");
RNA_def_function_ui_description(func, "Remove an existing variable from the driver.");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
/* target to remove */
- parm= RNA_def_pointer(func, "var", "DriverVariable", "", "Variable to remove from the driver.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ parm= RNA_def_pointer(func, "variable", "DriverVariable", "", "Variable to remove from the driver.");
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
static void rna_def_channeldriver(BlenderRNA *brna)
@@ -1282,13 +1291,11 @@ static void rna_def_fcurve_modifiers(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_property_flag(parm, PROP_REQUIRED);
func= RNA_def_function(srna, "remove", "rna_FCurve_modifiers_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Remove a modifier from this fcurve.");
- /* return type */
- parm= RNA_def_boolean(func, "success", 0, "Success", "Removed the constraint successfully.");
- RNA_def_function_return(func, parm);
- /* object to add */
- parm= RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "", 0, INT_MAX);
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ /* modifier to remove */
+ parm= RNA_def_pointer(func, "modifier", "FModifier", "", "Removed modifier.");
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
/* fcurve.keyframe_points */
diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c
index bd121724413..7dffa4aec74 100644
--- a/source/blender/makesrna/intern/rna_image.c
+++ b/source/blender/makesrna/intern/rna_image.c
@@ -254,7 +254,7 @@ static void rna_def_imageuser(BlenderRNA *brna)
prop= RNA_def_property(srna, "fields_per_frame", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "fie_ima");
- RNA_def_property_range(prop, -MAXFRAMEF, MAXFRAMEF);
+ RNA_def_property_range(prop, 1, MAXFRAMEF);
RNA_def_property_ui_text(prop, "Fields per Frame", "The number of fields per rendered frame (2 fields is 1 image)");
RNA_def_property_update(prop, 0, "rna_ImageUser_update");
diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h
index 669fc5d3871..401f9de92d4 100644
--- a/source/blender/makesrna/intern/rna_internal.h
+++ b/source/blender/makesrna/intern/rna_internal.h
@@ -182,7 +182,7 @@ void rna_def_animviz_common(struct StructRNA *srna);
void rna_def_motionpath_common(struct StructRNA *srna);
void rna_def_texmat_common(struct StructRNA *srna, const char *texspace_editable);
-void rna_def_mtex_common(struct StructRNA *srna, const char *begin, const char *activeget, const char *activeset, const char *structname, const char *update);
+void rna_def_mtex_common(struct BlenderRNA *brna, struct StructRNA *srna, const char *begin, const char *activeget, const char *activeset, const char *structname, const char *structname_slots, const char *update);
void rna_def_render_layer_common(struct StructRNA *srna, int scene);
void rna_ID_name_get(struct PointerRNA *ptr, char *value);
@@ -352,6 +352,10 @@ PointerRNA rna_pointer_inherit_refine(struct PointerRNA *ptr, struct StructRNA *
int rna_parameter_size(struct PropertyRNA *parm);
int rna_parameter_size_alloc(struct PropertyRNA *parm);
+// XXX, these should not need to be defined here~!
+struct MTex *rna_mtex_texture_slots_add(struct ID *self, struct ReportList *reports);
+struct MTex *rna_mtex_texture_slots_create(struct ID *self, struct ReportList *reports, int index);
+void rna_mtex_texture_slots_clear(struct ID *self, struct ReportList *reports, int index);
#endif /* RNA_INTERNAL_H */
diff --git a/source/blender/makesrna/intern/rna_lamp.c b/source/blender/makesrna/intern/rna_lamp.c
index c6660450914..fb7bb4a9194 100644
--- a/source/blender/makesrna/intern/rna_lamp.c
+++ b/source/blender/makesrna/intern/rna_lamp.c
@@ -386,8 +386,8 @@ static void rna_def_lamp(BlenderRNA *brna)
rna_def_animdata_common(srna);
/* textures */
- rna_def_mtex_common(srna, "rna_Lamp_mtex_begin", "rna_Lamp_active_texture_get",
- "rna_Lamp_active_texture_set", "LampTextureSlot", "rna_Lamp_update");
+ rna_def_mtex_common(brna, srna, "rna_Lamp_mtex_begin", "rna_Lamp_active_texture_get",
+ "rna_Lamp_active_texture_set", "LampTextureSlot", "LampTextureSlots", "rna_Lamp_update");
}
static void rna_def_lamp_falloff(StructRNA *srna)
diff --git a/source/blender/makesrna/intern/rna_main.c b/source/blender/makesrna/intern/rna_main.c
index 6e44b02834e..99758b8f0fe 100644
--- a/source/blender/makesrna/intern/rna_main.c
+++ b/source/blender/makesrna/intern/rna_main.c
@@ -147,13 +147,11 @@ static void rna_Main_camera_begin(CollectionPropertyIterator *iter, PointerRNA *
rna_iterator_listbase_begin(iter, &bmain->camera, NULL);
}
-#if 0
static void rna_Main_key_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
Main *bmain= (Main*)ptr->data;
rna_iterator_listbase_begin(iter, &bmain->key, NULL);
}
-#endif
static void rna_Main_world_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
@@ -292,7 +290,7 @@ void RNA_def_main(BlenderRNA *brna)
{"brushes", "Brush", "rna_Main_brush_begin", "Brushes", "Brush datablocks.", RNA_def_main_brushes},
{"worlds", "World", "rna_Main_world_begin", "Worlds", "World datablocks.", RNA_def_main_worlds},
{"groups", "Group", "rna_Main_group_begin", "Groups", "Group datablocks.", RNA_def_main_groups},
-/* {"keys", "Key", "rna_Main_key_begin", "Keys", "Key datablocks.", NULL}, */
+ {"shape_keys", "Key", "rna_Main_key_begin", "Keys", "Key datablocks.", NULL},
{"scripts", "ID", "rna_Main_script_begin", "Scripts", "Script datablocks (DEPRECATED).", NULL},
{"texts", "Text", "rna_Main_text_begin", "Texts", "Text datablocks.", RNA_def_main_texts},
{"sounds", "Sound", "rna_Main_sound_begin", "Sounds", "Sound datablocks.", RNA_def_main_sounds},
@@ -304,8 +302,8 @@ void RNA_def_main(BlenderRNA *brna)
int i;
- srna= RNA_def_struct(brna, "Main", NULL);
- RNA_def_struct_ui_text(srna, "Main", "Main data structure representing a .blend file and all its datablocks");
+ srna= RNA_def_struct(brna, "BlendData", NULL);
+ RNA_def_struct_ui_text(srna, "Blendfile Data", "Main data structure representing a .blend file and all its datablocks");
RNA_def_struct_ui_icon(srna, ICON_BLENDER);
prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c
index c850afc22ae..4ba9b7dd367 100644
--- a/source/blender/makesrna/intern/rna_main_api.c
+++ b/source/blender/makesrna/intern/rna_main_api.c
@@ -348,9 +348,10 @@ void rna_Main_fonts_remove(Main *bmain, ReportList *reports, VFont *vfont)
/* XXX python now has invalid pointer? */
}
-Tex *rna_Main_textures_new(Main *bmain, char* name)
+Tex *rna_Main_textures_new(Main *bmain, char* name, int type)
{
Tex *tex= add_texture(name);
+ tex_set_type(tex, type);
tex->id.us--;
return tex;
}
@@ -517,7 +518,7 @@ void RNA_def_main_cameras(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Remove a camera from the current blendfile.");
parm= RNA_def_pointer(func, "camera", "Camera", "", "Camera to remove.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
void RNA_def_main_scenes(BlenderRNA *brna, PropertyRNA *cprop)
@@ -540,10 +541,9 @@ void RNA_def_main_scenes(BlenderRNA *brna, PropertyRNA *cprop)
func= RNA_def_function(srna, "remove", "rna_Main_scenes_remove");
RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_REPORTS);
- parm= RNA_def_pointer(func, "scene", "Scene", "", "Scene to remove.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
RNA_def_function_ui_description(func, "Remove a scene from the current blendfile.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ parm= RNA_def_pointer(func, "scene", "Scene", "", "Scene to remove.");
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
void RNA_def_main_objects(BlenderRNA *brna, PropertyRNA *cprop)
@@ -569,10 +569,10 @@ void RNA_def_main_objects(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_return(func, parm);
func= RNA_def_function(srna, "remove", "rna_Main_objects_remove");
+ RNA_def_function_ui_description(func, "Remove a object from the current blendfile.");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
parm= RNA_def_pointer(func, "object", "Object", "", "Object to remove.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
- RNA_def_function_ui_description(func, "Remove a object from the current blendfile.");
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
void RNA_def_main_materials(BlenderRNA *brna, PropertyRNA *cprop)
@@ -597,7 +597,7 @@ void RNA_def_main_materials(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Remove a material from the current blendfile.");
parm= RNA_def_pointer(func, "material", "Material", "", "Material to remove.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
void RNA_def_main_node_groups(BlenderRNA *brna, PropertyRNA *cprop)
{
@@ -628,7 +628,7 @@ void RNA_def_main_node_groups(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Remove a node tree from the current blendfile.");
parm= RNA_def_pointer(func, "tree", "NodeTree", "", "Node tree to remove.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
#endif
}
void RNA_def_main_meshes(BlenderRNA *brna, PropertyRNA *cprop)
@@ -653,7 +653,7 @@ void RNA_def_main_meshes(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Remove a mesh from the current blendfile.");
parm= RNA_def_pointer(func, "mesh", "Mesh", "", "Mesh to remove.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
void RNA_def_main_lamps(BlenderRNA *brna, PropertyRNA *cprop)
{
@@ -677,7 +677,7 @@ void RNA_def_main_lamps(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Remove a lamp from the current blendfile.");
parm= RNA_def_pointer(func, "lamp", "Lamp", "", "Lamp to remove.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
void RNA_def_main_libraries(BlenderRNA *brna, PropertyRNA *cprop)
{
@@ -726,7 +726,7 @@ void RNA_def_main_images(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Remove an image from the current blendfile.");
parm= RNA_def_pointer(func, "image", "Image", "", "Image to remove.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
void RNA_def_main_lattices(BlenderRNA *brna, PropertyRNA *cprop)
@@ -751,7 +751,7 @@ void RNA_def_main_lattices(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Remove a lattice from the current blendfile.");
parm= RNA_def_pointer(func, "lattice", "Lattice", "", "Lattice to remove.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
void RNA_def_main_curves(BlenderRNA *brna, PropertyRNA *cprop)
{
@@ -767,7 +767,7 @@ void RNA_def_main_curves(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_ui_description(func, "Add a new curve to the main database");
parm= RNA_def_string(func, "name", "Curve", 0, "", "New name for the datablock.");
RNA_def_property_flag(parm, PROP_REQUIRED);
- parm= RNA_def_enum(func, "type", object_type_curve_items, 0, "Type", "The type of curve object to add");
+ parm= RNA_def_enum(func, "type", object_type_curve_items, 0, "Type", "The type of curve to add");
RNA_def_property_flag(parm, PROP_REQUIRED);
/* return type */
parm= RNA_def_pointer(func, "curve", "Curve", "", "New curve datablock.");
@@ -777,7 +777,7 @@ void RNA_def_main_curves(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Remove a curve from the current blendfile.");
parm= RNA_def_pointer(func, "curve", "Curve", "", "Curve to remove.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
void RNA_def_main_metaballs(BlenderRNA *brna, PropertyRNA *cprop)
{
@@ -801,7 +801,7 @@ void RNA_def_main_metaballs(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Remove a metaball from the current blendfile.");
parm= RNA_def_pointer(func, "metaball", "MetaBall", "", "MetaBall to remove.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
void RNA_def_main_fonts(BlenderRNA *brna, PropertyRNA *cprop)
{
@@ -826,7 +826,7 @@ void RNA_def_main_fonts(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Remove a font from the current blendfile.");
parm= RNA_def_pointer(func, "vfont", "VectorFont", "", "Font to remove.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
void RNA_def_main_textures(BlenderRNA *brna, PropertyRNA *cprop)
{
@@ -842,6 +842,8 @@ void RNA_def_main_textures(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_ui_description(func, "Add a new texture to the main database");
parm= RNA_def_string(func, "name", "Texture", 0, "", "New name for the datablock.");
RNA_def_property_flag(parm, PROP_REQUIRED);
+ parm= RNA_def_enum(func, "type", texture_type_items, 0, "Type", "The type of texture to add");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
/* return type */
parm= RNA_def_pointer(func, "texture", "Texture", "", "New texture datablock.");
RNA_def_function_return(func, parm);
@@ -850,7 +852,7 @@ void RNA_def_main_textures(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Remove a texture from the current blendfile.");
parm= RNA_def_pointer(func, "texture", "Texture", "", "Texture to remove.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
void RNA_def_main_brushes(BlenderRNA *brna, PropertyRNA *cprop)
{
@@ -874,7 +876,7 @@ void RNA_def_main_brushes(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Remove a brush from the current blendfile.");
parm= RNA_def_pointer(func, "brush", "Brush", "", "Brush to remove.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
void RNA_def_main_worlds(BlenderRNA *brna, PropertyRNA *cprop)
@@ -899,7 +901,7 @@ void RNA_def_main_worlds(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Remove a world from the current blendfile.");
parm= RNA_def_pointer(func, "world", "World", "", "World to remove.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
void RNA_def_main_groups(BlenderRNA *brna, PropertyRNA *cprop)
@@ -924,7 +926,7 @@ void RNA_def_main_groups(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Remove a group from the current blendfile.");
parm= RNA_def_pointer(func, "group", "Group", "", "Group to remove.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
void RNA_def_main_texts(BlenderRNA *brna, PropertyRNA *cprop)
{
@@ -948,7 +950,7 @@ void RNA_def_main_texts(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Remove a text from the current blendfile.");
parm= RNA_def_pointer(func, "text", "Text", "", "Text to remove.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
/* load func */
func= RNA_def_function(srna, "load", "rna_Main_texts_load");
@@ -986,7 +988,7 @@ void RNA_def_main_armatures(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Remove a armature from the current blendfile.");
parm= RNA_def_pointer(func, "armature", "Armature", "", "Armature to remove.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
void RNA_def_main_actions(BlenderRNA *brna, PropertyRNA *cprop)
{
@@ -1010,7 +1012,7 @@ void RNA_def_main_actions(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Remove a action from the current blendfile.");
parm= RNA_def_pointer(func, "action", "Action", "", "Action to remove.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
void RNA_def_main_particles(BlenderRNA *brna, PropertyRNA *cprop)
{
@@ -1034,7 +1036,7 @@ void RNA_def_main_particles(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Remove a particle settings instance from the current blendfile.");
parm= RNA_def_pointer(func, "particle", "ParticleSettings", "", "Particle Settings to remove.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
void RNA_def_main_gpencil(BlenderRNA *brna, PropertyRNA *cprop)
{
diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c
index 46a89ccce40..a3cd4e2fbde 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -276,6 +276,54 @@ static EnumPropertyItem *rna_Material_texture_coordinates_itemf(bContext *C, Poi
return item;
}
+MTex *rna_mtex_texture_slots_add(ID *self_id, ReportList *reports)
+{
+ MTex *mtex= add_mtex_id(self_id, -1);
+ if (mtex == NULL) {
+ BKE_reportf(reports, RPT_ERROR, "maximum number of textures added %d", MAX_MTEX);
+ return NULL;
+ }
+
+ return mtex;
+}
+
+MTex *rna_mtex_texture_slots_create(ID *self_id, ReportList *reports, int index)
+{
+ MTex *mtex;
+
+ if(index < 0 || index >= MAX_MTEX) {
+ BKE_reportf(reports, RPT_ERROR, "index %d is invalid", index);
+ return NULL;
+ }
+
+ mtex= add_mtex_id(self_id, index);
+
+ return mtex;
+}
+
+void rna_mtex_texture_slots_clear(ID *self_id, ReportList *reports, int index)
+{
+ MTex **mtex_ar;
+ short act;
+
+ give_active_mtex(self_id, &mtex_ar, &act);
+
+ if (mtex_ar == NULL) {
+ BKE_report(reports, RPT_ERROR, "mtex not found for this type");
+ return;
+ }
+
+ if(index < 0 || index >= MAX_MTEX) {
+ BKE_reportf(reports, RPT_ERROR, "index %d is invalid", index);
+ return;
+ }
+
+ if(mtex_ar[index]) {
+ id_us_min((ID *)mtex_ar[index]->tex);
+ MEM_freeN(mtex_ar[index]);
+ mtex_ar[index]= NULL;
+ }
+}
#else
@@ -571,7 +619,7 @@ static void rna_def_material_mtex(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Reflection", "Causes the texture to affect the reflected light's brightness");
RNA_def_property_update(prop, NC_TEXTURE, NULL);
- prop= RNA_def_property(srna, "color_emission_factor", PROP_FLOAT, PROP_NONE);
+ prop= RNA_def_property(srna, "emission_color_factor", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "colemitfac");
RNA_def_property_ui_range(prop, 0, 1, 10, 3);
RNA_def_property_ui_text(prop, "Emission Color Factor", "Amount texture affects emission color");
@@ -1741,8 +1789,8 @@ void RNA_def_material(BlenderRNA *brna)
/* common */
rna_def_animdata_common(srna);
- rna_def_mtex_common(srna, "rna_Material_mtex_begin", "rna_Material_active_texture_get",
- "rna_Material_active_texture_set", "MaterialTextureSlot", "rna_Material_update");
+ rna_def_mtex_common(brna, srna, "rna_Material_mtex_begin", "rna_Material_active_texture_get",
+ "rna_Material_active_texture_set", "MaterialTextureSlot", "MaterialTextureSlots", "rna_Material_update");
/* only material has this one */
prop= RNA_def_property(srna, "use_textures", PROP_BOOLEAN, PROP_NONE);
@@ -1768,7 +1816,43 @@ void RNA_def_material(BlenderRNA *brna)
RNA_api_material(srna);
}
-void rna_def_mtex_common(StructRNA *srna, const char *begin, const char *activeget, const char *activeset, const char *structname, const char *update)
+
+/* curve.splines */
+static void rna_def_texture_slots(BlenderRNA *brna, PropertyRNA *cprop, const char *structname, const char *structname_slots)
+{
+ StructRNA *srna;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, structname_slots);
+ srna= RNA_def_struct(brna, structname_slots, NULL);
+ RNA_def_struct_sdna(srna, "ID");
+ RNA_def_struct_ui_text(srna, "Texture Slots", "Collection of texture slots");
+
+ /* functions */
+ func= RNA_def_function(srna, "add", "rna_mtex_texture_slots_add");
+ RNA_def_function_ui_description(func, "Add a number of points to this spline.");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID|FUNC_NO_SELF|FUNC_USE_REPORTS);
+ parm= RNA_def_pointer(func, "mtex", structname, "", "The newly initialized mtex.");
+ RNA_def_function_return(func, parm);
+
+ func= RNA_def_function(srna, "create", "rna_mtex_texture_slots_create");
+ RNA_def_function_ui_description(func, "Add a number of points to this spline.");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID|FUNC_NO_SELF|FUNC_USE_REPORTS);
+ parm= RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "Slot index to initialize.", 0, INT_MAX);
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ parm= RNA_def_pointer(func, "mtex", structname, "", "The newly initialized mtex.");
+ RNA_def_function_return(func, parm);
+
+ func= RNA_def_function(srna, "clear", "rna_mtex_texture_slots_clear");
+ RNA_def_function_ui_description(func, "Add a number of points to this spline.");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID|FUNC_NO_SELF|FUNC_USE_REPORTS);
+ parm= RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "Slot index to clar.", 0, INT_MAX);
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+}
+
+void rna_def_mtex_common(BlenderRNA *brna, StructRNA *srna, const char *begin, const char *activeget, const char *activeset, const char *structname, const char *structname_slots, const char *update)
{
PropertyRNA *prop;
@@ -1777,6 +1861,7 @@ void rna_def_mtex_common(StructRNA *srna, const char *begin, const char *activeg
RNA_def_property_struct_type(prop, structname);
RNA_def_property_collection_funcs(prop, begin, "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_dereference_get", 0, 0, 0);
RNA_def_property_ui_text(prop, "Textures", "Texture slots defining the mapping and influence of textures");
+ rna_def_texture_slots(brna, prop, structname, structname_slots);
prop= RNA_def_property(srna, "active_texture", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "Texture");
diff --git a/source/blender/makesrna/intern/rna_material_api.c b/source/blender/makesrna/intern/rna_material_api.c
index d271b3b374c..22eb537f24a 100644
--- a/source/blender/makesrna/intern/rna_material_api.c
+++ b/source/blender/makesrna/intern/rna_material_api.c
@@ -35,93 +35,12 @@
#ifdef RNA_RUNTIME
-#include "BKE_material.h"
-#include "BKE_texture.h"
-
-/*
- Adds material to the first free texture slot.
- If all slots are busy, replaces the first.
-*/
-static void rna_Material_add_texture(Material *ma, Tex *tex, int texco, int mapto)
-{
- int i;
- MTex *mtex;
- int slot= -1;
-
- for (i= 0; i < MAX_MTEX; i++) {
- if (!ma->mtex[i]) {
- slot= i;
- break;
- }
- }
-
- if (slot == -1)
- slot= 0;
-
- if (ma->mtex[slot]) {
- ma->mtex[slot]->tex->id.us--;
- }
- else {
- ma->mtex[slot]= add_mtex();
- }
-
- mtex= ma->mtex[slot];
-
- mtex->tex= tex;
- if (tex)
- id_us_plus(&tex->id);
-
- mtex->texco= texco;
- mtex->mapto= mapto;
-}
-
#else
void RNA_api_material(StructRNA *srna)
{
- FunctionRNA *func;
- PropertyRNA *parm;
-
- /* copied from rna_def_material_mtex (rna_material.c) */
- static EnumPropertyItem prop_texture_coordinates_items[] = {
- {TEXCO_GLOB, "GLOBAL", 0, "Global", "Uses global coordinates for the texture coordinates"},
- {TEXCO_OBJECT, "OBJECT", 0, "Object", "Uses linked object's coordinates for texture coordinates"},
- {TEXCO_UV, "UV", 0, "UV", "Uses UV coordinates for texture coordinates"},
- {TEXCO_ORCO, "ORCO", 0, "Generated", "Uses the original undeformed coordinates of the object"},
- {TEXCO_STRAND, "STRAND", 0, "Strand", "Uses normalized strand texture coordinate (1D)"},
- {TEXCO_STICKY, "STICKY", 0, "Sticky", "Uses mesh's sticky coordinates for the texture coordinates"},
- {TEXCO_WINDOW, "WINDOW", 0, "Window", "Uses screen coordinates as texture coordinates"},
- {TEXCO_NORM, "NORMAL", 0, "Normal", "Uses normal vector as texture coordinates"},
- {TEXCO_REFL, "REFLECTION", 0, "Reflection", "Uses reflection vector as texture coordinates"},
- {TEXCO_STRESS, "STRESS", 0, "Stress", "Uses the difference of edge lengths compared to original coordinates of the mesh"},
- {TEXCO_TANGENT, "TANGENT", 0, "Tangent", "Uses the optional tangent vector as texture coordinates"},
-
- {0, NULL, 0, NULL, NULL}};
-
- static EnumPropertyItem prop_texture_mapto_items[] = {
- {MAP_COL, "COLOR", 0, "Color", "Causes the texture to affect basic color of the material"},
- {MAP_NORM, "NORMAL", 0, "Normal", "Causes the texture to affect the rendered normal"},
- {MAP_COLSPEC, "SPECULAR_COLOR", 0, "Specularity Color", "Causes the texture to affect the specularity color"},
- {MAP_COLMIR, "MIRROR", 0, "Mirror", "Causes the texture to affect the mirror color"},
- {MAP_REF, "REFLECTION", 0, "Reflection", "Causes the texture to affect the value of the materials reflectivity"},
- {MAP_SPEC, "SPECULARITY", 0, "Specularity", "Causes the texture to affect the value of specularity"},
- {MAP_EMIT, "EMIT", 0, "Emit", "Causes the texture to affect the emit value"},
- {MAP_ALPHA, "ALPHA", 0, "Alpha", "Causes the texture to affect the alpha value"},
- {MAP_HAR, "HARDNESS", 0, "Hardness", "Causes the texture to affect the hardness value"},
- {MAP_RAYMIRR, "RAY_MIRROR", 0, "Ray-Mirror", "Causes the texture to affect the ray-mirror value"},
- {MAP_TRANSLU, "TRANSLUCENCY", 0, "Translucency", "Causes the texture to affect the translucency value"},
- {MAP_AMB, "AMBIENT", 0, "Ambient", "Causes the texture to affect the value of ambient"},
- {MAP_DISPLACE, "DISPLACEMENT", 0, "Displacement", "Let the texture displace the surface"},
- {MAP_WARP, "WARP", 0, "Warp", "Let the texture warp texture coordinates of next channels"},
- {0, NULL, 0, NULL, NULL}};
-
- func= RNA_def_function(srna, "add_texture", "rna_Material_add_texture");
- RNA_def_function_ui_description(func, "Add a texture to material's free texture slot.");
- parm= RNA_def_pointer(func, "texture", "Texture", "Texture", "Texture to add.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
- parm= RNA_def_enum(func, "texture_coords", prop_texture_coordinates_items, TEXCO_UV, "", "Source of texture coordinate information."); /* optional */
- parm= RNA_def_enum(func, "map_to", prop_texture_mapto_items, MAP_COL, "", "Controls which material property the texture affects."); /* optional */
- RNA_def_property_flag(parm, PROP_ENUM_FLAG);
+ // FunctionRNA *func;
+ // PropertyRNA *parm;
}
#endif
diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c
index 3758f0ad101..af109a688c1 100644
--- a/source/blender/makesrna/intern/rna_mesh.c
+++ b/source/blender/makesrna/intern/rna_mesh.c
@@ -993,6 +993,34 @@ static int rna_Mesh_tot_face_get(PointerRNA *ptr)
return me->edit_btmesh ? me->edit_btmesh->bm->totfacesel : 0;
}
+static CustomDataLayer *rna_Mesh_vertex_color_new(struct Mesh *me, struct bContext *C, char *name)
+{
+ CustomData *ldata;
+ CustomDataLayer *cdl= NULL;
+ int index;
+
+ if(ED_mesh_color_add(C, NULL, NULL, me, name, FALSE)) {
+ ldata= rna_mesh_ldata(me);
+ index= CustomData_get_named_layer_index(ldata, CD_MLOOPCOL, name);
+ cdl= (index == -1)? NULL: &ldata->layers[index];
+ }
+ return cdl;
+}
+
+static CustomDataLayer *rna_Mesh_uv_texture_new(struct Mesh *me, struct bContext *C, char *name)
+{
+ CustomData *pdata;
+ CustomDataLayer *cdl= NULL;
+ int index;
+
+ if(ED_mesh_uv_texture_add(C, NULL, NULL, me, name, FALSE)) {
+ pdata= rna_mesh_pdata(me);
+ index= CustomData_get_named_layer_index(pdata, CD_MTEXPOLY, name);
+ cdl= (index == -1)? NULL: &pdata->layers[index];
+ }
+ return cdl;
+}
+
#else
static void rna_def_mvert_group(BlenderRNA *brna)
@@ -1522,13 +1550,52 @@ void rna_def_texmat_common(StructRNA *srna, const char *texspace_editable)
/* scene.objects */
+/* mesh.vertices */
+static void rna_def_mesh_vertices(BlenderRNA *brna, PropertyRNA *cprop)
+{
+ StructRNA *srna;
+// PropertyRNA *prop;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "MeshVertices");
+ srna= RNA_def_struct(brna, "MeshVertices", NULL);
+ RNA_def_struct_sdna(srna, "Mesh");
+ RNA_def_struct_ui_text(srna, "Mesh Vertices", "Collection of mesh vertices");
+
+ func= RNA_def_function(srna, "add", "ED_mesh_vertices_add");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm= RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of vertices to add.", 0, INT_MAX);
+}
+
+/* mesh.edges */
+static void rna_def_mesh_edges(BlenderRNA *brna, PropertyRNA *cprop)
+{
+ StructRNA *srna;
+// PropertyRNA *prop;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "MeshEdges");
+ srna= RNA_def_struct(brna, "MeshEdges", NULL);
+ RNA_def_struct_sdna(srna, "Mesh");
+ RNA_def_struct_ui_text(srna, "Mesh Edges", "Collection of mesh edges");
+
+ func= RNA_def_function(srna, "add", "ED_mesh_edges_add");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm= RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of vertices to add.", 0, INT_MAX);
+}
+
+/* mesh.faces */
static void rna_def_mesh_faces(BlenderRNA *brna, PropertyRNA *cprop)
{
StructRNA *srna;
PropertyRNA *prop;
-// FunctionRNA *func;
-// PropertyRNA *parm;
+ FunctionRNA *func;
+ PropertyRNA *parm;
RNA_def_property_srna(cprop, "MeshFaces");
srna= RNA_def_struct(brna, "MeshFaces", NULL);
@@ -1538,8 +1605,93 @@ static void rna_def_mesh_faces(BlenderRNA *brna, PropertyRNA *cprop)
prop= RNA_def_property(srna, "active", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "act_face");
RNA_def_property_ui_text(prop, "Active Face", "The active face for this mesh");
+
+ func= RNA_def_function(srna, "add", "ED_mesh_faces_add");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm= RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of vertices to add.", 0, INT_MAX);
}
+/* mesh.vertex_colors */
+static void rna_def_vertex_colors(BlenderRNA *brna, PropertyRNA *cprop)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "VertexColors");
+ srna= RNA_def_struct(brna, "VertexColors", NULL);
+ RNA_def_struct_sdna(srna, "Mesh");
+ RNA_def_struct_ui_text(srna, "Vertex Colors", "Collection of vertex colors");
+
+ func= RNA_def_function(srna, "new", "rna_Mesh_vertex_color_new");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ RNA_def_function_ui_description(func, "Add a vertex color layer to Mesh.");
+ parm= RNA_def_string(func, "name", "UVTex", 0, "", "UV Texture name.");
+ parm= RNA_def_pointer(func, "layer", "MeshColorLayer", "", "The newly created layer.");
+ RNA_def_function_return(func, parm);
+
+/*
+ func= RNA_def_function(srna, "remove", "rna_Mesh_vertex_color_remove");
+ RNA_def_function_ui_description(func, "Remove a vertex color layer.");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm= RNA_def_pointer(func, "layer", "Layer", "", "The layer to remove.");
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
+*/
+ prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_UNSIGNED);
+ RNA_def_property_struct_type(prop, "MeshColorLayer");
+ RNA_def_property_pointer_funcs(prop, "rna_Mesh_active_vertex_color_get", "rna_Mesh_active_vertex_color_set", NULL, NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Active Vertex Color Layer", "Active vertex color layer");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_funcs(prop, "rna_Mesh_active_vertex_color_index_get", "rna_Mesh_active_vertex_color_index_set", "rna_Mesh_active_vertex_color_index_range");
+ RNA_def_property_ui_text(prop, "Active Vertex Color Index", "Active vertex color index");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+}
+
+/* mesh.uv_layers */
+static void rna_def_uv_textures(BlenderRNA *brna, PropertyRNA *cprop)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "UVTextures");
+ srna= RNA_def_struct(brna, "UVTextures", NULL);
+ RNA_def_struct_sdna(srna, "Mesh");
+ RNA_def_struct_ui_text(srna, "UV Textures", "Collection of uv textures");
+
+ func= RNA_def_function(srna, "new", "rna_Mesh_uv_texture_new");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ RNA_def_function_ui_description(func, "Add a UV texture layer to Mesh.");
+ parm= RNA_def_string(func, "name", "UVTex", 0, "", "UV Texture name.");
+ parm= RNA_def_pointer(func, "layer", "MeshTextureFaceLayer", "", "The newly created layer.");
+ RNA_def_function_return(func, parm);
+
+/*
+ func= RNA_def_function(srna, "remove", "rna_Mesh_uv_layers_remove");
+ RNA_def_function_ui_description(func, "Remove a vertex color layer.");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm= RNA_def_pointer(func, "layer", "Layer", "", "The layer to remove.");
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
+*/
+ prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_UNSIGNED);
+ RNA_def_property_struct_type(prop, "MeshTextureFaceLayer");
+ RNA_def_property_pointer_funcs(prop, "rna_Mesh_active_uv_texture_get", "rna_Mesh_active_uv_texture_set", NULL, NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Active UV Texture", "Active UV texture");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_funcs(prop, "rna_Mesh_active_uv_texture_index_get", "rna_Mesh_active_uv_texture_index_set", "rna_Mesh_active_uv_texture_index_range");
+ RNA_def_property_ui_text(prop, "Active UV Texture Index", "Active UV texture index");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+}
static void rna_def_mesh(BlenderRNA *brna)
{
@@ -1554,11 +1706,13 @@ static void rna_def_mesh(BlenderRNA *brna)
RNA_def_property_collection_sdna(prop, NULL, "mvert", "totvert");
RNA_def_property_struct_type(prop, "MeshVertex");
RNA_def_property_ui_text(prop, "Vertices", "Vertices of the mesh");
+ rna_def_mesh_vertices(brna, prop);
prop= RNA_def_property(srna, "edges", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "medge", "totedge");
RNA_def_property_struct_type(prop, "MeshEdge");
RNA_def_property_ui_text(prop, "Edges", "Edges of the mesh");
+ rna_def_mesh_edges(brna, prop);
prop= RNA_def_property(srna, "faces", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "mface", "totface");
@@ -1583,18 +1737,7 @@ static void rna_def_mesh(BlenderRNA *brna)
RNA_def_property_collection_funcs(prop, "rna_Mesh_uv_textures_begin", 0, 0, 0, "rna_Mesh_uv_textures_length", 0, 0);
RNA_def_property_struct_type(prop, "MeshTextureFaceLayer");
RNA_def_property_ui_text(prop, "UV Textures", "");
-
- prop= RNA_def_property(srna, "active_uv_texture", PROP_POINTER, PROP_UNSIGNED);
- RNA_def_property_struct_type(prop, "MeshTextureFaceLayer");
- RNA_def_property_pointer_funcs(prop, "rna_Mesh_active_uv_texture_get", "rna_Mesh_active_uv_texture_set", NULL, NULL);
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Active UV Texture", "Active UV texture");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
-
- prop= RNA_def_property(srna, "active_uv_texture_index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_funcs(prop, "rna_Mesh_active_uv_texture_index_get", "rna_Mesh_active_uv_texture_index_set", "rna_Mesh_active_uv_texture_index_range");
- RNA_def_property_ui_text(prop, "Active UV Texture Index", "Active UV texture index");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+ rna_def_uv_textures(brna, prop);
prop= RNA_def_property(srna, "uv_texture_clone", PROP_POINTER, PROP_UNSIGNED);
RNA_def_property_struct_type(prop, "MeshTextureFaceLayer");
@@ -1623,18 +1766,7 @@ static void rna_def_mesh(BlenderRNA *brna)
RNA_def_property_collection_funcs(prop, "rna_Mesh_vertex_colors_begin", 0, 0, 0, "rna_Mesh_vertex_colors_length", 0, 0);
RNA_def_property_struct_type(prop, "MeshColorLayer");
RNA_def_property_ui_text(prop, "Vertex Colors", "");
-
- prop= RNA_def_property(srna, "active_vertex_color", PROP_POINTER, PROP_UNSIGNED);
- RNA_def_property_struct_type(prop, "MeshColorLayer");
- RNA_def_property_pointer_funcs(prop, "rna_Mesh_active_vertex_color_get", "rna_Mesh_active_vertex_color_set", NULL, NULL);
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Active Vertex Color Layer", "Active vertex color layer");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
-
- prop= RNA_def_property(srna, "active_vertex_color_index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_funcs(prop, "rna_Mesh_active_vertex_color_index_get", "rna_Mesh_active_vertex_color_index_set", "rna_Mesh_active_vertex_color_index_range");
- RNA_def_property_ui_text(prop, "Active Vertex Color Index", "Active vertex color index");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+ rna_def_vertex_colors(brna, prop);
prop= RNA_def_property(srna, "layers_float", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "pdata.layers", "pdata.totlayer");
@@ -1696,7 +1828,7 @@ static void rna_def_mesh(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Texture Space Rotation", "Texture space rotation");
RNA_def_property_editable_func(prop, texspace_editable);
RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");*/
-
+
/* Mesh Draw Options for Edit Mode*/
prop= RNA_def_property(srna, "show_edges", PROP_BOOLEAN, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_mesh_api.c b/source/blender/makesrna/intern/rna_mesh_api.c
index d011ddd27ce..220a66d089a 100644
--- a/source/blender/makesrna/intern/rna_mesh_api.c
+++ b/source/blender/makesrna/intern/rna_mesh_api.c
@@ -37,15 +37,6 @@
#ifdef RNA_RUNTIME
-static void rna_Mesh_uv_texture_add(struct Mesh *me, struct bContext *C)
-{
- ED_mesh_uv_texture_add(C, NULL, NULL, me);
-}
-
-static void rna_Mesh_vertex_color_add(struct Mesh *me, struct bContext *C)
-{
- ED_mesh_color_add(C, NULL, NULL, me);
-}
#else
@@ -59,36 +50,12 @@ void RNA_api_mesh(StructRNA *srna)
parm= RNA_def_float_matrix(func, "matrix", 4, 4, NULL, 0.0f, 0.0f, "", "Matrix.", 0.0f, 0.0f);
RNA_def_property_flag(parm, PROP_REQUIRED);
- func= RNA_def_function(srna, "add_geometry", "ED_mesh_geometry_add");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm= RNA_def_int(func, "vertices", 0, 0, INT_MAX, "Number", "Number of vertices to add.", 0, INT_MAX);
- RNA_def_property_flag(parm, PROP_REQUIRED);
- parm= RNA_def_int(func, "edges", 0, 0, INT_MAX, "Number", "Number of edges to add.", 0, INT_MAX);
- RNA_def_property_flag(parm, PROP_REQUIRED);
- parm= RNA_def_int(func, "faces", 0, 0, INT_MAX, "Number", "Number of faces to add.", 0, INT_MAX);
- RNA_def_property_flag(parm, PROP_REQUIRED);
-
- func= RNA_def_function(srna, "add_uv_texture", "rna_Mesh_uv_texture_add");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
- RNA_def_function_ui_description(func, "Add a UV texture layer to Mesh.");
-
- func= RNA_def_function(srna, "add_vertex_color", "rna_Mesh_vertex_color_add");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
- RNA_def_function_ui_description(func, "Add a vertex color layer to Mesh.");
-
func= RNA_def_function(srna, "calc_normals", "ED_mesh_calc_normals");
RNA_def_function_ui_description(func, "Calculate vertex normals.");
func= RNA_def_function(srna, "update", "ED_mesh_update");
RNA_def_boolean(func, "calc_edges", 0, "Calculate Edges", "Force recalculation of edges.");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
-
- func= RNA_def_function(srna, "add_material", "ED_mesh_material_add");
- RNA_def_function_ui_description(func, "Add a new material to Mesh.");
- parm= RNA_def_pointer(func, "material", "Material", "", "Material to add.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
-
-
}
#endif
diff --git a/source/blender/makesrna/intern/rna_meta.c b/source/blender/makesrna/intern/rna_meta.c
index 0de8455bdb7..0f2c74d962e 100644
--- a/source/blender/makesrna/intern/rna_meta.c
+++ b/source/blender/makesrna/intern/rna_meta.c
@@ -35,6 +35,8 @@
#include "BLI_math.h"
+#include "MEM_guardedalloc.h"
+
#include "DNA_scene_types.h"
#include "DNA_object_types.h"
@@ -89,6 +91,8 @@ static void rna_MetaBall_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
MetaBall *mb= ptr->id.data;
Object *ob;
+ /* cheating way for importers to avoid slow updates */
+ if(mb->id.us > 0) {
for(ob=bmain->object.first; ob; ob= ob->id.next)
if(ob->data == mb)
copy_mball_properties(scene, ob);
@@ -96,21 +100,57 @@ static void rna_MetaBall_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
DAG_id_flush_update(&mb->id, OB_RECALC_DATA);
WM_main_add_notifier(NC_GEOM|ND_DATA, mb);
}
+}
-#else
+static MetaElem *rna_MetaBall_elements_new(MetaBall *mb, int type)
+{
+ MetaElem *ml= add_metaball_element(mb, type);
-static void rna_def_metaelement(BlenderRNA *brna)
+ /* cheating way for importers to avoid slow updates */
+ if(mb->id.us > 0) {
+ DAG_id_flush_update(&mb->id, OB_RECALC_DATA);
+ WM_main_add_notifier(NC_GEOM|ND_DATA, &mb->id);
+ }
+
+ return ml;
+}
+
+static void rna_MetaBall_elements_remove(MetaBall *mb, ReportList *reports, MetaElem *ml)
{
- StructRNA *srna;
- PropertyRNA *prop;
- static EnumPropertyItem prop_type_items[] = {
+ int found= 0;
+
+ found= BLI_remlink_safe(&mb->elems, ml);
+
+ if(!found) {
+ BKE_reportf(reports, RPT_ERROR, "MetaBall \"%s\" does not contain spline given", mb->id.name+2);
+ return;
+ }
+
+ MEM_freeN(ml);
+ /* invalidate pointer!, no can do */
+
+ /* cheating way for importers to avoid slow updates */
+ if(mb->id.us > 0) {
+ DAG_id_flush_update(&mb->id, OB_RECALC_DATA);
+ WM_main_add_notifier(NC_GEOM|ND_DATA, &mb->id);
+ }
+}
+
+#else
+
+static EnumPropertyItem metaelem_type_items[] = {
{MB_BALL, "BALL", ICON_META_BALL, "Ball", ""},
- {MB_TUBE, "TUBE", ICON_META_TUBE, "Tube", ""},
+ {MB_TUBE, "CAPSULE", ICON_META_CAPSULE, "Capsule", ""},
{MB_PLANE, "PLANE", ICON_META_PLANE, "Plane", ""},
{MB_ELIPSOID, "ELLIPSOID", ICON_META_ELLIPSOID, "Ellipsoid", ""}, // NOTE: typo at original definition!
{MB_CUBE, "CUBE", ICON_META_CUBE, "Cube", ""},
{0, NULL, 0, NULL, NULL}};
+static void rna_def_metaelement(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
srna= RNA_def_struct(brna, "MetaElement", NULL);
RNA_def_struct_sdna(srna, "MetaElem");
RNA_def_struct_ui_text(srna, "Meta Element", "Blobby element in a MetaBall datablock");
@@ -118,7 +158,7 @@ static void rna_def_metaelement(BlenderRNA *brna)
/* enums */
prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, prop_type_items);
+ RNA_def_property_enum_items(prop, metaelem_type_items);
RNA_def_property_ui_text(prop, "Type", "Metaball types");
RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
@@ -176,6 +216,37 @@ static void rna_def_metaelement(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
}
+/* mball.elements */
+static void rna_def_metaball_elements(BlenderRNA *brna, PropertyRNA *cprop)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "MetaBallElements");
+ srna= RNA_def_struct(brna, "MetaBallElements", NULL);
+ RNA_def_struct_sdna(srna, "MetaBall");
+ RNA_def_struct_ui_text(srna, "Meta Elements", "Collection of metaball elements");
+
+ func= RNA_def_function(srna, "new", "rna_MetaBall_elements_new");
+ RNA_def_function_ui_description(func, "Add a new spline to the curve.");
+ parm= RNA_def_enum(func, "type", metaelem_type_items, MB_BALL, "", "type for the new meta element.");
+ parm= RNA_def_pointer(func, "element", "MetaElement", "", "The newly created metaelement.");
+ RNA_def_function_return(func, parm);
+
+ func= RNA_def_function(srna, "remove", "rna_MetaBall_elements_remove");
+ RNA_def_function_ui_description(func, "Remove a spline from a curve.");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm= RNA_def_pointer(func, "element", "MetaElement", "", "The element to remove.");
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
+
+ prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "lastelem");
+ RNA_def_property_ui_text(prop, "Active Element", "Last selected element");
+}
+
static void rna_def_metaball(BlenderRNA *brna)
{
StructRNA *srna;
@@ -195,11 +266,8 @@ static void rna_def_metaball(BlenderRNA *brna)
RNA_def_property_collection_sdna(prop, NULL, "elems", NULL);
RNA_def_property_struct_type(prop, "MetaElement");
RNA_def_property_ui_text(prop, "Elements", "Meta elements");
+ rna_def_metaball_elements(brna, prop);
- prop= RNA_def_property(srna, "active_element", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "lastelem");
- RNA_def_property_ui_text(prop, "Last selected element.", "Last selected element");
-
/* enums */
prop= RNA_def_property(srna, "update_method", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "flag");
@@ -257,6 +325,7 @@ static void rna_def_metaball(BlenderRNA *brna)
RNA_def_property_collection_sdna(prop, NULL, "mat", "totcol");
RNA_def_property_struct_type(prop, "Material");
RNA_def_property_ui_text(prop, "Materials", "");
+ RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.c */
/* anim */
rna_def_animdata_common(srna);
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index 0fb79de8c65..47a9f8e7537 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -1057,7 +1057,7 @@ static void def_cmp_image(StructRNA *srna)
prop = RNA_def_property(srna, "frame_duration", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "frames");
- RNA_def_property_range(prop, 1, MAXFRAMEF);
+ RNA_def_property_range(prop, 0, MAXFRAMEF);
RNA_def_property_ui_text(prop, "Frames", "Number of images used in animation");
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
@@ -1638,6 +1638,11 @@ static void def_cmp_crop(StructRNA *srna)
RNA_def_property_ui_text(prop, "Crop Image Size", "Whether to crop the size of the input image");
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "relative", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "custom2", 1);
+ RNA_def_property_ui_text(prop, "Relative", "Use relative values to crop image");
+ RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
+
RNA_def_struct_sdna_from(srna, "NodeTwoXYs", "storage");
prop = RNA_def_property(srna, "min_x", PROP_INT, PROP_NONE);
@@ -1663,6 +1668,30 @@ static void def_cmp_crop(StructRNA *srna)
RNA_def_property_range(prop, 0, 10000);
RNA_def_property_ui_text(prop, "Y2", "");
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "rel_min_x", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "fac_x1");
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_text(prop, "X1", "");
+ RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "rel_max_x", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "fac_x2");
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_text(prop, "X2", "");
+ RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "rel_min_y", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "fac_y1");
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_text(prop, "Y1", "");
+ RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "rel_max_y", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "fac_y2");
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_text(prop, "Y2", "");
+ RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
}
static void def_cmp_dblur(StructRNA *srna)
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index e61044776ca..cf4d554ac4d 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -43,6 +43,9 @@
#include "BKE_tessmesh.h"
+#include "BLO_sys_types.h" /* needed for intptr_t used in ED_mesh.h */
+#include "ED_mesh.h"
+
#include "WM_api.h"
#include "WM_types.h"
//bleh
@@ -75,6 +78,7 @@ static EnumPropertyItem collision_bounds_items[] = {
{OB_BOUND_CONE, "CONE", 0, "Cone", ""},
{OB_BOUND_POLYT, "CONVEX_HULL", 0, "Convex Hull", ""},
{OB_BOUND_POLYH, "TRIANGLE_MESH", 0, "Triangle Mesh", ""},
+ {OB_BOUND_CAPSULE, "CAPSULE", 0, "Capsule", ""},
//{OB_DYN_MESH, "DYNAMIC_MESH", 0, "Dynamic Mesh", ""},
{0, NULL, 0, NULL, NULL}};
@@ -256,6 +260,8 @@ static void rna_Object_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr)
rna_Object_layer_update__internal(bmain, scene, base, ob);
ob->lay= base->lay;
+
+ WM_main_add_notifier(NC_SCENE|ND_LAYER_CONTENT, scene);
}
static void rna_Base_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr)
@@ -265,6 +271,8 @@ static void rna_Base_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr)
rna_Object_layer_update__internal(bmain, scene, base, ob);
ob->lay= base->lay;
+
+ WM_main_add_notifier(NC_SCENE|ND_LAYER_CONTENT, scene);
}
static int rna_Object_data_editable(PointerRNA *ptr)
@@ -379,6 +387,7 @@ static EnumPropertyItem *rna_Object_collision_bounds_itemf(bContext *C, PointerR
RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_CYLINDER);
RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_SPHERE);
RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_BOX);
+ RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_CAPSULE);
}
RNA_enum_item_end(&item, &totitem);
@@ -1016,23 +1025,24 @@ static void rna_Object_active_constraint_set(PointerRNA *ptr, PointerRNA value)
constraints_set_active(&ob->constraints, (bConstraint *)value.data);
}
-static bConstraint *rna_Object_constraint_new(Object *object, int type)
+static bConstraint *rna_Object_constraints_new(Object *object, int type)
{
WM_main_add_notifier(NC_OBJECT|ND_CONSTRAINT|NA_ADDED, object);
return add_ob_constraint(object, NULL, type);
}
-static int rna_Object_constraint_remove(Object *object, int index)
+static void rna_Object_constraints_remove(Object *object, ReportList *reports, bConstraint *con)
{
- int ok = remove_constraint_index(&object->constraints, index);
- if(ok) {
+ if(BLI_findindex(&object->constraints, con) == -1) {
+ BKE_reportf(reports, RPT_ERROR, "Constraint '%s' not found in object '%s'.", con->name, object->id.name+2);
+ return;
+ }
+
+ remove_constraint(&object->constraints, con);
ED_object_constraint_set_active(object, NULL);
WM_main_add_notifier(NC_OBJECT|ND_CONSTRAINT, object);
}
- return ok;
-}
-
static ModifierData *rna_Object_modifier_new(Object *object, bContext *C, ReportList *reports, char *name, int type)
{
return ED_object_modifier_add(reports, CTX_data_main(C), CTX_data_scene(C), object, name, type);
@@ -1056,6 +1066,12 @@ static void rna_Object_boundbox_get(PointerRNA *ptr, float *values)
}
+static void rna_Object_add_vertex_to_group(Object *ob, int index_len, int *index, bDeformGroup *def, float weight, int assignmode)
+{
+ while(index_len--)
+ ED_vgroup_vert_add(ob, def, *index++, weight, assignmode);
+}
+
/* generic poll functions */
int rna_Lattice_object_poll(PointerRNA *ptr, PointerRNA value)
{
@@ -1382,26 +1398,24 @@ static void rna_def_object_constraints(BlenderRNA *brna, PropertyRNA *cprop)
/* Constraint collection */
- func= RNA_def_function(srna, "new", "rna_Object_constraint_new");
+ func= RNA_def_function(srna, "new", "rna_Object_constraints_new");
RNA_def_function_ui_description(func, "Add a new constraint to this object");
- /* return type */
- parm= RNA_def_pointer(func, "constraint", "Constraint", "", "New constraint.");
- RNA_def_function_return(func, parm);
/* object to add */
parm= RNA_def_enum(func, "type", constraint_type_items, 1, "", "Constraint type to add.");
RNA_def_property_flag(parm, PROP_REQUIRED);
-
- func= RNA_def_function(srna, "remove", "rna_Object_constraint_remove");
- RNA_def_function_ui_description(func, "Remove a constraint from this object.");
/* return type */
- parm= RNA_def_boolean(func, "success", 0, "Success", "Removed the constraint successfully.");
+ parm= RNA_def_pointer(func, "constraint", "Constraint", "", "New constraint.");
RNA_def_function_return(func, parm);
- /* object to add */
- parm= RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "", 0, INT_MAX);
- RNA_def_property_flag(parm, PROP_REQUIRED);
+
+ func= RNA_def_function(srna, "remove", "rna_Object_constraints_remove");
+ RNA_def_function_ui_description(func, "Remove a constraint from this object.");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ /* constraint to remove */
+ parm= RNA_def_pointer(func, "constraint", "Constraint", "", "Removed constraint.");
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
-/* armature.bones.* */
+/* object.modifiers */
static void rna_def_object_modifiers(BlenderRNA *brna, PropertyRNA *cprop)
{
StructRNA *srna;
@@ -1446,9 +1460,93 @@ static void rna_def_object_modifiers(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_ui_description(func, "Remove an existing modifier from the object.");
/* target to remove*/
parm= RNA_def_pointer(func, "modifier", "Modifier", "", "Modifier to remove.");
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
+}
+
+/* object.particle_systems */
+static void rna_def_object_particle_systems(BlenderRNA *brna, PropertyRNA *cprop)
+{
+ StructRNA *srna;
+
+ PropertyRNA *prop;
+
+ // FunctionRNA *func;
+ // PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "ParticleSystems");
+ srna= RNA_def_struct(brna, "ParticleSystems", NULL);
+ RNA_def_struct_sdna(srna, "Object");
+ RNA_def_struct_ui_text(srna, "Particle Systems", "Collection of particle systems");
+
+ prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "ParticleSystem");
+ RNA_def_property_pointer_funcs(prop, "rna_Object_active_particle_system_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Active Particle System", "Active particle system being displayed");
+ RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
+
+ prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_funcs(prop, "rna_Object_active_particle_system_index_get", "rna_Object_active_particle_system_index_set", "rna_Object_active_particle_system_index_range");
+ RNA_def_property_ui_text(prop, "Active Particle System Index", "Index of active particle system slot");
+ RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_particle_update");
+}
+
+
+/* object.vertex_groups */
+static void rna_def_object_vertex_groups(BlenderRNA *brna, PropertyRNA *cprop)
+{
+ static EnumPropertyItem assign_mode_items[] = {
+ {WEIGHT_REPLACE, "REPLACE", 0, "Replace", "Replace"},
+ {WEIGHT_ADD, "ADD", 0, "Add", "Add"},
+ {WEIGHT_SUBTRACT, "SUBTRACT", 0, "Subtract", "Subtract"},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ StructRNA *srna;
+
+ PropertyRNA *prop;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "VertexGroups");
+ srna= RNA_def_struct(brna, "VertexGroups", NULL);
+ RNA_def_struct_sdna(srna, "Object");
+ RNA_def_struct_ui_text(srna, "Vertex Groups", "Collection of vertex groups");
+
+ prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "VertexGroup");
+ RNA_def_property_pointer_funcs(prop, "rna_Object_active_vertex_group_get", "rna_Object_active_vertex_group_set", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Active Vertex Group", "Vertex groups of the object");
+ RNA_def_property_update(prop, NC_GEOM|ND_DATA, "rna_Object_internal_update_data");
+
+ prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "actdef");
+ RNA_def_property_int_funcs(prop, "rna_Object_active_vertex_group_index_get", "rna_Object_active_vertex_group_index_set", "rna_Object_active_vertex_group_index_range");
+ RNA_def_property_ui_text(prop, "Active Vertex Group Index", "Active index in vertex group array");
+ RNA_def_property_update(prop, NC_GEOM|ND_DATA, "rna_Object_internal_update_data");
+
+ /* vertex groups */ // add_vertex_group
+ func= RNA_def_function(srna, "new", "ED_vgroup_add_name");
+ RNA_def_function_ui_description(func, "Add vertex group to object.");
+ parm= RNA_def_string(func, "name", "Group", 0, "", "Vertex group name."); /* optional */
+ parm= RNA_def_pointer(func, "group", "VertexGroup", "", "New vertex group.");
+ RNA_def_function_return(func, parm);
+
+ func= RNA_def_function(srna, "assign", "rna_Object_add_vertex_to_group");
+ RNA_def_function_ui_description(func, "Add vertex to a vertex group.");
+ /* TODO, see how array size of 0 works, this shouldnt be used */
+ parm= RNA_def_int_array(func, "index", 1, NULL, 0, 0, "", "Index List.", 0, 0);
+ RNA_def_property_flag(parm, PROP_DYNAMIC);
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ parm= RNA_def_pointer(func, "group", "VertexGroup", "", "Vertex group to add vertex to.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ parm= RNA_def_float(func, "weight", 0, 0.0f, 1.0f, "", "Vertex weight.", 0.0f, 1.0f);
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ parm= RNA_def_enum(func, "type", assign_mode_items, 0, "", "Vertex assign mode.");
RNA_def_property_flag(parm, PROP_REQUIRED);
}
+
static void rna_def_object(BlenderRNA *brna)
{
StructRNA *srna;
@@ -1506,6 +1604,7 @@ static void rna_def_object(BlenderRNA *brna)
{OB_BOUND_CYLINDER, "CYLINDER", 0, "Cylinder", ""},
{OB_BOUND_CONE, "CONE", 0, "Cone", ""},
{OB_BOUND_POLYH, "POLYHEDRON", 0, "Polyhedron", ""},
+ {OB_BOUND_CAPSULE, "CAPSULE", 0, "Capsule", ""},
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem dupli_items[] = {
@@ -1798,18 +1897,7 @@ static void rna_def_object(BlenderRNA *brna)
RNA_def_property_collection_sdna(prop, NULL, "defbase", NULL);
RNA_def_property_struct_type(prop, "VertexGroup");
RNA_def_property_ui_text(prop, "Vertex Groups", "Vertex groups of the object");
-
- prop= RNA_def_property(srna, "active_vertex_group", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "VertexGroup");
- RNA_def_property_pointer_funcs(prop, "rna_Object_active_vertex_group_get", "rna_Object_active_vertex_group_set", NULL, NULL);
- RNA_def_property_ui_text(prop, "Active Vertex Group", "Vertex groups of the object");
- RNA_def_property_update(prop, NC_GEOM|ND_DATA, "rna_Object_internal_update_data");
-
- prop= RNA_def_property(srna, "active_vertex_group_index", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "actdef");
- RNA_def_property_int_funcs(prop, "rna_Object_active_vertex_group_index_get", "rna_Object_active_vertex_group_index_set", "rna_Object_active_vertex_group_index_range");
- RNA_def_property_ui_text(prop, "Active Vertex Group Index", "Active index in vertex group array");
- RNA_def_property_update(prop, NC_GEOM|ND_DATA, "rna_Object_internal_update_data");
+ rna_def_object_vertex_groups(brna, prop);
/* empty */
prop= RNA_def_property(srna, "empty_draw_type", PROP_ENUM, PROP_NONE);
@@ -1858,17 +1946,7 @@ static void rna_def_object(BlenderRNA *brna)
RNA_def_property_collection_sdna(prop, NULL, "particlesystem", NULL);
RNA_def_property_struct_type(prop, "ParticleSystem");
RNA_def_property_ui_text(prop, "Particle Systems", "Particle systems emitted from the object");
-
- prop= RNA_def_property(srna, "active_particle_system", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "ParticleSystem");
- RNA_def_property_pointer_funcs(prop, "rna_Object_active_particle_system_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Active Particle System", "Active particle system being displayed");
- RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
-
- prop= RNA_def_property(srna, "active_particle_system_index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_funcs(prop, "rna_Object_active_particle_system_index_get", "rna_Object_active_particle_system_index_set", "rna_Object_active_particle_system_index_range");
- RNA_def_property_ui_text(prop, "Active Particle System Index", "Index of active particle system slot");
- RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_particle_update");
+ rna_def_object_particle_systems(brna, prop);
/* restrict */
prop= RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
@@ -2159,4 +2237,3 @@ void RNA_def_object(BlenderRNA *brna)
}
#endif
-
diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c
index 17e6630a48a..d48e714ea23 100644
--- a/source/blender/makesrna/intern/rna_object_api.c
+++ b/source/blender/makesrna/intern/rna_object_api.c
@@ -35,9 +35,9 @@
#include "DNA_object_types.h"
-#include "BLO_sys_types.h" /* needed for intptr_t used in ED_mesh.h */
+// #include "BLO_sys_types.h" /* needed for intptr_t used in ED_mesh.h */
-#include "ED_mesh.h"
+// #include "ED_mesh.h"
#ifdef RNA_RUNTIME
@@ -261,17 +261,6 @@ static void rna_Object_free_duplilist(Object *ob, ReportList *reports)
}
}
-static bDeformGroup *rna_Object_add_vertex_group(Object *ob, char *group_name)
-{
- return ED_vgroup_add_name(ob, group_name);
-}
-
-static void rna_Object_add_vertex_to_group(Object *ob, int vertex_index, bDeformGroup *def, float weight, int assignmode)
-{
- /* creates dverts if needed */
- ED_vgroup_vert_add(ob, def, vertex_index, weight, assignmode);
-}
-
/* copied from old API Object.makeDisplayList (Object.c)
* use _ suffix because this exists for internal rna */
static void rna_Object_update(Object *ob, Scene *sce, int object, int data, int time)
@@ -433,13 +422,6 @@ void RNA_api_object(StructRNA *srna)
{0, NULL, 0, NULL, NULL}
};
- static EnumPropertyItem assign_mode_items[] = {
- {WEIGHT_REPLACE, "REPLACE", 0, "Replace", "Replace"}, /* TODO: more meaningful descriptions */
- {WEIGHT_ADD, "ADD", 0, "Add", "Add"},
- {WEIGHT_SUBTRACT, "SUBTRACT", 0, "Subtract", "Subtract"},
- {0, NULL, 0, NULL, NULL}
- };
-
/* mesh */
func= RNA_def_function(srna, "create_mesh", "rna_Object_create_mesh");
RNA_def_function_ui_description(func, "Create a Mesh datablock with modifiers applied.");
@@ -464,24 +446,6 @@ void RNA_api_object(StructRNA *srna)
RNA_def_function_ui_description(func, "Free the list of dupli objects.");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
- /* vertex groups */
- func= RNA_def_function(srna, "add_vertex_group", "rna_Object_add_vertex_group");
- RNA_def_function_ui_description(func, "Add vertex group to object.");
- parm= RNA_def_string(func, "name", "Group", 0, "", "Vertex group name."); /* optional */
- parm= RNA_def_pointer(func, "group", "VertexGroup", "", "New vertex group.");
- RNA_def_function_return(func, parm);
-
- func= RNA_def_function(srna, "add_vertex_to_group", "rna_Object_add_vertex_to_group");
- RNA_def_function_ui_description(func, "Add vertex to a vertex group.");
- parm= RNA_def_int(func, "vertex_index", 0, 0, 0, "", "Vertex index.", 0, 0);
- RNA_def_property_flag(parm, PROP_REQUIRED);
- parm= RNA_def_pointer(func, "group", "VertexGroup", "", "Vertex group to add vertex to.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
- parm= RNA_def_float(func, "weight", 0, 0.0f, 1.0f, "", "Vertex weight.", 0.0f, 1.0f);
- RNA_def_property_flag(parm, PROP_REQUIRED);
- parm= RNA_def_enum(func, "type", assign_mode_items, 0, "", "Vertex assign mode.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
-
/* Armature */
func= RNA_def_function(srna, "find_armature", "rna_Object_find_armature");
RNA_def_function_ui_description(func, "Find armature influencing this object as a parent or via a modifier.");
diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c
index 1eadd0e7676..3a8f66a3773 100644
--- a/source/blender/makesrna/intern/rna_object_force.c
+++ b/source/blender/makesrna/intern/rna_object_force.c
@@ -695,6 +695,26 @@ static EnumPropertyItem *rna_Effector_shape_itemf(bContext *C, PointerRNA *ptr,
#else
+/* ptcache.point_caches */
+static void rna_def_ptcache_point_caches(BlenderRNA *brna, PropertyRNA *cprop)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ // FunctionRNA *func;
+ // PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "PointCaches");
+ srna= RNA_def_struct(brna, "PointCaches", NULL);
+ RNA_def_struct_sdna(srna, "PointCache");
+ RNA_def_struct_ui_text(srna, "Point Caches", "Collection of point caches");
+
+ prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_funcs(prop, "rna_Cache_active_point_cache_index_get", "rna_Cache_active_point_cache_index_set", "rna_Cache_active_point_cache_index_range");
+ RNA_def_property_ui_text(prop, "Active Point Cache Index", "");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_change");
+}
+
static void rna_def_pointcache(BlenderRNA *brna)
{
StructRNA *srna;
@@ -785,11 +805,7 @@ static void rna_def_pointcache(BlenderRNA *brna)
RNA_def_property_collection_funcs(prop, "rna_Cache_list_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0);
RNA_def_property_struct_type(prop, "PointCache");
RNA_def_property_ui_text(prop, "Point Cache List", "Point cache list");
-
- prop= RNA_def_property(srna, "active_point_cache_index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_funcs(prop, "rna_Cache_active_point_cache_index_get", "rna_Cache_active_point_cache_index_set", "rna_Cache_active_point_cache_index_range");
- RNA_def_property_ui_text(prop, "Active Point Cache Index", "");
- RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_change");
+ rna_def_ptcache_point_caches(brna, prop);
}
static void rna_def_collision(BlenderRNA *brna)
@@ -1458,7 +1474,7 @@ static void rna_def_softbody(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Mass", "General Mass value");
RNA_def_property_update(prop, 0, "rna_softbody_update");
- prop= RNA_def_property(srna, "mass_vertex_group", PROP_STRING, PROP_NONE);
+ prop= RNA_def_property(srna, "vertex_group_mass", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "namedVG_Mass");
RNA_def_property_ui_text(prop, "Mass Vertex Group", "Control point mass values");
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SoftBodySettings_mass_vgroup_set");
@@ -1479,7 +1495,7 @@ static void rna_def_softbody(BlenderRNA *brna)
/* Goal */
- prop= RNA_def_property(srna, "goal_vertex_group", PROP_STRING, PROP_NONE);
+ prop= RNA_def_property(srna, "vertex_group_goal", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "vertgroup");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); /* not impossible .. but not supported yet */
RNA_def_property_string_funcs(prop, "rna_SoftBodySettings_goal_vgroup_get", "rna_SoftBodySettings_goal_vgroup_length", "rna_SoftBodySettings_goal_vgroup_set");
@@ -1565,7 +1581,7 @@ static void rna_def_softbody(BlenderRNA *brna)
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Shear", "Shear Stiffness");
- prop= RNA_def_property(srna, "spring_vertex_group", PROP_STRING, PROP_NONE);
+ prop= RNA_def_property(srna, "vertex_group_spring", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "namedVG_Spring_K");
RNA_def_property_ui_text(prop, "Spring Vertex Group", "Control point spring strength values");
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SoftBodySettings_spring_vgroup_set");
diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c
index ce797f21494..edd661760a0 100644
--- a/source/blender/makesrna/intern/rna_pose.c
+++ b/source/blender/makesrna/intern/rna_pose.c
@@ -62,6 +62,8 @@
#include "MEM_guardedalloc.h"
+#include "WM_api.h"
+
#include "RNA_access.h"
static void rna_Pose_update(Main *bmain, Scene *scene, PointerRNA *ptr)
@@ -442,12 +444,17 @@ static bConstraint *rna_PoseChannel_constraints_new(bPoseChannel *pchan, int typ
return add_pose_constraint(NULL, pchan, NULL, type);
}
-static int rna_PoseChannel_constraints_remove(bPoseChannel *pchan, int index)
+static void rna_PoseChannel_constraints_remove(ID *id, bPoseChannel *pchan, ReportList *reports, bConstraint *con)
{
+ if(BLI_findindex(&pchan->constraints, con) == -1) {
+ BKE_reportf(reports, RPT_ERROR, "Constraint '%s' not found in pose bone '%s'.", con->name, pchan->name);
+ return;
+ }
+
// TODO
- //ED_object_constraint_set_active(object, NULL);
- //WM_main_add_notifier(NC_OBJECT|ND_CONSTRAINT, object);
- return remove_constraint_index(&pchan->constraints, index);
+ //ED_object_constraint_set_active(id, NULL);
+ WM_main_add_notifier(NC_OBJECT|ND_CONSTRAINT, id);
+ remove_constraint(&pchan->constraints, con);
}
static int rna_PoseChannel_proxy_editable(PointerRNA *ptr)
@@ -652,12 +659,10 @@ static void rna_def_pose_channel_constraints(BlenderRNA *brna, PropertyRNA *cpro
func= RNA_def_function(srna, "remove", "rna_PoseChannel_constraints_remove");
RNA_def_function_ui_description(func, "Remove a constraint from this object.");
- /* return type */
- parm= RNA_def_boolean(func, "success", 0, "Success", "Removed the constraint successfully.");
- RNA_def_function_return(func, parm);
- /* object to add */
- parm= RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "", 0, INT_MAX);
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_function_flag(func, FUNC_USE_REPORTS|FUNC_USE_SELF_ID); /* ID needed for refresh */
+ /* constraint to remove */
+ parm= RNA_def_pointer(func, "constraint", "Constraint", "", "Removed constraint.");
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
static void rna_def_pose_channel(BlenderRNA *brna)
@@ -1135,6 +1140,34 @@ static void rna_def_pose_ikparam(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "IK Solver", "IK solver for which these parameters are defined, 0 for Legacy, 1 for iTaSC");
}
+/* pose.bone_groups */
+static void rna_def_bone_groups(BlenderRNA *brna, PropertyRNA *cprop)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+// FunctionRNA *func;
+// PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "BoneGroups");
+ srna= RNA_def_struct(brna, "BoneGroups", NULL);
+ RNA_def_struct_sdna(srna, "bPose");
+ RNA_def_struct_ui_text(srna, "Bone Groups", "Collection of bone groups");
+
+ prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "BoneGroup");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_pointer_funcs(prop, "rna_Pose_active_bone_group_get", "rna_Pose_active_bone_group_set", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Active Bone Group", "Active bone group for this pose");
+ RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
+
+ prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "active_group");
+ RNA_def_property_int_funcs(prop, "rna_Pose_active_bone_group_index_get", "rna_Pose_active_bone_group_index_set", "rna_Pose_active_bone_group_index_range");
+ RNA_def_property_ui_text(prop, "Active Bone Group Index", "Active index in bone groups array");
+ RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
+}
+
static void rna_def_pose(BlenderRNA *brna)
{
StructRNA *srna;
@@ -1156,20 +1189,8 @@ static void rna_def_pose(BlenderRNA *brna)
RNA_def_property_collection_sdna(prop, NULL, "agroups", NULL);
RNA_def_property_struct_type(prop, "BoneGroup");
RNA_def_property_ui_text(prop, "Bone Groups", "Groups of the bones");
+ rna_def_bone_groups(brna, prop);
- prop= RNA_def_property(srna, "active_bone_group", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "BoneGroup");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_pointer_funcs(prop, "rna_Pose_active_bone_group_get", "rna_Pose_active_bone_group_set", NULL, NULL);
- RNA_def_property_ui_text(prop, "Active Bone Group", "Active bone group for this pose");
- RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
-
- prop= RNA_def_property(srna, "active_bone_group_index", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "active_group");
- RNA_def_property_int_funcs(prop, "rna_Pose_active_bone_group_index_get", "rna_Pose_active_bone_group_index_set", "rna_Pose_active_bone_group_index_range");
- RNA_def_property_ui_text(prop, "Active Bone Group Index", "Active index in bone groups array");
- RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
-
/* ik solvers */
prop= RNA_def_property(srna, "ik_solver", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "iksolver");
diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c
index e4a89ed3121..e6b86ae8766 100644
--- a/source/blender/makesrna/intern/rna_render.c
+++ b/source/blender/makesrna/intern/rna_render.c
@@ -291,8 +291,8 @@ static void rna_def_render_engine(BlenderRNA *brna)
static void rna_def_render_result(BlenderRNA *brna)
{
StructRNA *srna;
- PropertyRNA *prop;
FunctionRNA *func;
+ PropertyRNA *parm;
srna= RNA_def_struct(brna, "RenderResult", NULL);
RNA_def_struct_ui_text(srna, "Render Result", "Result of rendering, including all layers and passes");
@@ -300,22 +300,22 @@ static void rna_def_render_result(BlenderRNA *brna)
func= RNA_def_function(srna, "load_from_file", "RE_result_load_from_file");
RNA_def_function_ui_description(func, "Copies the pixels of this render result from an image file.");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
- prop= RNA_def_string(func, "filename", "", 0, "Filename", "Filename to load into this render tile, must be no smaller then the render result");
- RNA_def_property_flag(prop, PROP_REQUIRED);
+ parm= RNA_def_string_file_name(func, "filename", "", FILE_MAX, "File Name", "Filename to load into this render tile, must be no smaller then the render result");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
RNA_define_verify_sdna(0);
- prop= RNA_def_property(srna, "resolution_x", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "rectx");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ parm= RNA_def_property(srna, "resolution_x", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(parm, NULL, "rectx");
+ RNA_def_property_clear_flag(parm, PROP_EDITABLE);
- prop= RNA_def_property(srna, "resolution_y", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "recty");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ parm= RNA_def_property(srna, "resolution_y", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(parm, NULL, "recty");
+ RNA_def_property_clear_flag(parm, PROP_EDITABLE);
- prop= RNA_def_property(srna, "layers", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, "RenderLayer");
- RNA_def_property_collection_funcs(prop, "rna_RenderResult_layers_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0);
+ parm= RNA_def_property(srna, "layers", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(parm, "RenderLayer");
+ RNA_def_property_collection_funcs(parm, "rna_RenderResult_layers_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0);
RNA_define_verify_sdna(1);
}
diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c
index 4bfd0e4fd41..81b0df1d840 100644
--- a/source/blender/makesrna/intern/rna_rna.c
+++ b/source/blender/makesrna/intern/rna_rna.c
@@ -493,6 +493,13 @@ static int rna_Property_registered_optional_get(PointerRNA *ptr)
return prop->flag & PROP_REGISTER_OPTIONAL;
}
+static int rna_Property_runtime_get(PointerRNA *ptr)
+{
+ PropertyRNA *prop= (PropertyRNA*)ptr->data;
+ return prop->flag & PROP_RUNTIME;
+}
+
+
static int rna_BoolProperty_default_get(PointerRNA *ptr)
{
PropertyRNA *prop= (PropertyRNA*)ptr->data;
@@ -1018,6 +1025,11 @@ static void rna_def_property(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_boolean_funcs(prop, "rna_Property_registered_optional_get", NULL);
RNA_def_property_ui_text(prop, "Registered Optionally", "Property is optionally registered as part of type registration");
+
+ prop= RNA_def_property(srna, "is_runtime", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_boolean_funcs(prop, "rna_Property_runtime_get", NULL);
+ RNA_def_property_ui_text(prop, "Read Only", "Property is editable through RNA");
}
static void rna_def_function(BlenderRNA *brna)
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 8b3ff3a3904..82fcedd4ac7 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -166,6 +166,7 @@ EnumPropertyItem image_type_items[] = {
#include "BKE_mesh.h"
#include "BKE_sound.h"
#include "BKE_screen.h"
+#include "BKE_animsys.h"
#include "BLI_threads.h"
#include "BLI_editVert.h"
@@ -214,6 +215,8 @@ static Base *rna_Scene_object_link(Scene *scene, bContext *C, ReportList *report
/* slows down importers too much, run scene.update() */
/* DAG_scene_sort(G.main, scene); */
+ WM_main_add_notifier(NC_SCENE|ND_OB_ACTIVE, scene);
+
return base;
}
@@ -646,6 +649,22 @@ static void rna_RenderSettings_active_layer_index_range(PointerRNA *ptr, int *mi
*max= MAX2(0, *max);
}
+static PointerRNA rna_RenderSettings_active_layer_get(PointerRNA *ptr)
+{
+ RenderData *rd= (RenderData*)ptr->data;
+ SceneRenderLayer *srl = BLI_findlink(&rd->layers, rd->actlay);
+
+ return rna_pointer_inherit_refine(ptr, &RNA_SceneRenderLayer, srl);
+}
+
+static void rna_RenderSettings_active_layer_set(PointerRNA *ptr, PointerRNA value)
+{
+ RenderData *rd= (RenderData*)ptr->data;
+ SceneRenderLayer *srl= (SceneRenderLayer*)value.data;
+
+ rd->actlay = BLI_findindex(&rd->layers, srl);
+}
+
static void rna_RenderSettings_engine_set(PointerRNA *ptr, int value)
{
RenderData *rd= (RenderData*)ptr->data;
@@ -922,6 +941,33 @@ static void rna_TimeLine_remove(Scene *scene, ReportList *reports, TimeMarker *m
MEM_freeN(marker);
}
+static KeyingSet *rna_Scene_keying_set_new(Scene *sce, ReportList *reports,
+ char name[], int absolute, int insertkey_needed, int insertkey_visual)
+{
+ KeyingSet *ks= NULL;
+ short flag=0, keyingflag=0;
+
+ /* validate flags */
+ if (absolute)
+ flag |= KEYINGSET_ABSOLUTE;
+ if (insertkey_needed)
+ keyingflag |= INSERTKEY_NEEDED;
+ if (insertkey_visual)
+ keyingflag |= INSERTKEY_MATRIX;
+
+ /* call the API func, and set the active keyingset index */
+ ks= BKE_keyingset_add(&sce->keyingsets, name, flag, keyingflag);
+
+ if (ks) {
+ sce->active_keyingset= BLI_countlist(&sce->keyingsets);
+ return ks;
+ }
+ else {
+ BKE_report(reports, RPT_ERROR, "Keying Set could not be added.");
+ return NULL;
+ }
+}
+
#else
static void rna_def_transform_orientation(BlenderRNA *brna)
@@ -1812,6 +1858,35 @@ static void rna_def_scene_render_layer(BlenderRNA *brna)
rna_def_render_layer_common(srna, 1);
}
+/* curve.splines */
+static void rna_def_render_layers(BlenderRNA *brna, PropertyRNA *cprop)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ // FunctionRNA *func;
+ // PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "RenderLayers");
+ srna= RNA_def_struct(brna, "RenderLayers", NULL);
+ RNA_def_struct_sdna(srna, "RenderData");
+ RNA_def_struct_ui_text(srna, "Render Layers", "Collection of render layers");
+
+ prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "actlay");
+ RNA_def_property_int_funcs(prop, "rna_RenderSettings_active_layer_index_get", "rna_RenderSettings_active_layer_index_set", "rna_RenderSettings_active_layer_index_range");
+ RNA_def_property_ui_text(prop, "Active Layer Index", "Active index in render layer array");
+ RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
+
+ prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_UNSIGNED);
+ RNA_def_property_struct_type(prop, "SceneRenderLayer");
+ RNA_def_property_pointer_funcs(prop, "rna_RenderSettings_active_layer_get", "rna_RenderSettings_active_layer_set", NULL, NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Active Render Layer", "Active Render Layer");
+ RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
+
+}
+
static void rna_def_scene_render_data(BlenderRNA *brna)
{
StructRNA *srna;
@@ -2752,18 +2827,14 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
RNA_def_property_collection_sdna(prop, NULL, "layers", NULL);
RNA_def_property_struct_type(prop, "SceneRenderLayer");
RNA_def_property_ui_text(prop, "Render Layers", "");
+ rna_def_render_layers(brna, prop);
+
prop= RNA_def_property(srna, "use_single_layer", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_SINGLE_LAYER);
RNA_def_property_ui_text(prop, "Single Layer", "Only render the active layer");
RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
- prop= RNA_def_property(srna, "active_layer_index", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "actlay");
- RNA_def_property_int_funcs(prop, "rna_RenderSettings_active_layer_index_get", "rna_RenderSettings_active_layer_index_set", "rna_RenderSettings_active_layer_index_range");
- RNA_def_property_ui_text(prop, "Active Layer Index", "Active index in render layer array");
- RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
-
/* engine */
prop= RNA_def_property(srna, "engine", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, engine_items);
@@ -2891,7 +2962,7 @@ static void rna_def_timeline_markers(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_struct_sdna(srna, "Scene");
RNA_def_struct_ui_text(srna, "Timeline Markers", "Collection of timeline markers");
- func= RNA_def_function(srna, "add", "rna_TimeLine_add");
+ func= RNA_def_function(srna, "new", "rna_TimeLine_add");
RNA_def_function_ui_description(func, "Add a keyframe to the curve.");
parm= RNA_def_string(func, "name", "Marker", 0, "", "New name for the marker (not unique).");
RNA_def_property_flag(parm, PROP_REQUIRED);
@@ -2907,6 +2978,75 @@ static void rna_def_timeline_markers(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
+/* scene.keying_sets */
+static void rna_def_scene_keying_sets(BlenderRNA *brna, PropertyRNA *cprop)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "KeyingSets");
+ srna= RNA_def_struct(brna, "KeyingSets", NULL);
+ RNA_def_struct_sdna(srna, "Scene");
+ RNA_def_struct_ui_text(srna, "Keying Sets", "Scene keying sets");
+
+ /* Add Keying Set */
+ func= RNA_def_function(srna, "new", "rna_Scene_keying_set_new");
+ RNA_def_function_ui_description(func, "Add a new Keying Set to Scene.");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ /* returns the new KeyingSet */
+ parm= RNA_def_pointer(func, "keyingset", "KeyingSet", "", "Newly created Keying Set.");
+ RNA_def_function_return(func, parm);
+ /* name */
+ RNA_def_string(func, "name", "KeyingSet", 64, "Name", "Name of Keying Set");
+ /* flags */
+ RNA_def_boolean(func, "absolute", 1, "Absolute", "Keying Set defines specific paths/settings to be keyframed (i.e. is not reliant on context info)");
+ /* keying flags */
+ RNA_def_boolean(func, "insertkey_needed", 0, "Insert Keyframes - Only Needed", "Only insert keyframes where they're needed in the relevant F-Curves.");
+ RNA_def_boolean(func, "insertkey_visual", 0, "Insert Keyframes - Visual", "Insert keyframes based on 'visual transforms'.");
+
+ prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "KeyingSet");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_pointer_funcs(prop, "rna_Scene_active_keying_set_get", "rna_Scene_active_keying_set_set", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Active Keying Set", "Active Keying Set used to insert/delete keyframes");
+ RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET, NULL);
+
+ prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "active_keyingset");
+ RNA_def_property_int_funcs(prop, "rna_Scene_active_keying_set_index_get", "rna_Scene_active_keying_set_index_set", NULL);
+ RNA_def_property_ui_text(prop, "Active Keying Set Index", "Current Keying Set index (negative for 'builtin' and positive for 'absolute')");
+ RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET, NULL);
+}
+
+static void rna_def_scene_keying_sets_all(BlenderRNA *brna, PropertyRNA *cprop)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ RNA_def_property_srna(cprop, "KeyingSetsAll");
+ srna= RNA_def_struct(brna, "KeyingSetsAll", NULL);
+ RNA_def_struct_sdna(srna, "Scene");
+ RNA_def_struct_ui_text(srna, "Keying Sets All", "All available keying sets");
+
+ /* NOTE: no add/remove available here, without screwing up this amalgamated list... */
+
+ prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "KeyingSet");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_pointer_funcs(prop, "rna_Scene_active_keying_set_get", "rna_Scene_active_keying_set_set", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Active Keying Set", "Active Keying Set used to insert/delete keyframes");
+ RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET, NULL);
+
+ prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "active_keyingset");
+ RNA_def_property_int_funcs(prop, "rna_Scene_active_keying_set_index_get", "rna_Scene_active_keying_set_index_set", NULL);
+ RNA_def_property_ui_text(prop, "Active Keying Set Index", "Current Keying Set index (negative for 'builtin' and positive for 'absolute')");
+ RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET, NULL);
+}
+
void RNA_def_scene(BlenderRNA *brna)
{
StructRNA *srna;
@@ -3091,25 +3231,14 @@ void RNA_def_scene(BlenderRNA *brna)
RNA_def_property_struct_type(prop, "KeyingSet");
RNA_def_property_ui_text(prop, "Absolute Keying Sets", "Absolute Keying Sets for this Scene");
RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET, NULL);
+ rna_def_scene_keying_sets(brna, prop);
prop= RNA_def_property(srna, "keying_sets_all", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_funcs(prop, "rna_Scene_all_keyingsets_begin", "rna_Scene_all_keyingsets_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0);
RNA_def_property_struct_type(prop, "KeyingSet");
- RNA_def_property_ui_text(prop, "All Keying Sets", "All Keying Sets available for use (builtins and Absolute Keying Sets for this Scene)");
- RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET, NULL);
-
- prop= RNA_def_property(srna, "active_keying_set", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "KeyingSet");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_pointer_funcs(prop, "rna_Scene_active_keying_set_get", "rna_Scene_active_keying_set_set", NULL, NULL);
- RNA_def_property_ui_text(prop, "Active Keying Set", "Active Keying Set used to insert/delete keyframes");
- RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET, NULL);
-
- prop= RNA_def_property(srna, "active_keying_set_index", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "active_keyingset");
- RNA_def_property_int_funcs(prop, "rna_Scene_active_keying_set_index_get", "rna_Scene_active_keying_set_index_set", NULL);
- RNA_def_property_ui_text(prop, "Active Keying Set Index", "Current Keying Set index (negative for 'builtin' and positive for 'absolute')");
+ RNA_def_property_ui_text(prop, "All Keying Sets", "All Keying Sets available for use (Builtins and Absolute Keying Sets for this Scene)");
RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET, NULL);
+ rna_def_scene_keying_sets_all(brna, prop);
/* Tool Settings */
prop= RNA_def_property(srna, "tool_settings", PROP_POINTER, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c
index 498bd148508..f6a6453c703 100644
--- a/source/blender/makesrna/intern/rna_scene_api.c
+++ b/source/blender/makesrna/intern/rna_scene_api.c
@@ -47,7 +47,7 @@
-static void rna_Scene_set_frame(Scene *scene, int frame, float subframe)
+static void rna_Scene_frame_set(Scene *scene, int frame, float subframe)
{
scene->r.cfra= frame;
scene->r.subframe= subframe;
@@ -63,33 +63,6 @@ static void rna_Scene_update_tagged(Scene *scene)
scene_update_tagged(G.main, scene);
}
-static KeyingSet *rna_Scene_add_keying_set(Scene *sce, ReportList *reports,
- char name[], int absolute, int insertkey_needed, int insertkey_visual)
-{
- KeyingSet *ks= NULL;
- short flag=0, keyingflag=0;
-
- /* validate flags */
- if (absolute)
- flag |= KEYINGSET_ABSOLUTE;
- if (insertkey_needed)
- keyingflag |= INSERTKEY_NEEDED;
- if (insertkey_visual)
- keyingflag |= INSERTKEY_MATRIX;
-
- /* call the API func, and set the active keyingset index */
- ks= BKE_keyingset_add(&sce->keyingsets, name, flag, keyingflag);
-
- if (ks) {
- sce->active_keyingset= BLI_countlist(&sce->keyingsets);
- return ks;
- }
- else {
- BKE_report(reports, RPT_ERROR, "Keying Set could not be added.");
- return NULL;
- }
-}
-
static void rna_SceneRender_get_frame_path(RenderData *rd, int frame, char *name)
{
if(BKE_imtype_is_movie(rd->imtype))
@@ -105,7 +78,7 @@ void RNA_api_scene(StructRNA *srna)
FunctionRNA *func;
PropertyRNA *parm;
- func= RNA_def_function(srna, "set_frame", "rna_Scene_set_frame");
+ func= RNA_def_function(srna, "frame_set", "rna_Scene_frame_set");
RNA_def_function_ui_description(func, "Set scene frame updating all objects immediately.");
parm= RNA_def_int(func, "frame", 0, MINAFRAME, MAXFRAME, "", "Frame number to set.", MINAFRAME, MAXFRAME);
RNA_def_property_flag(parm, PROP_REQUIRED);
@@ -113,21 +86,6 @@ void RNA_api_scene(StructRNA *srna)
func= RNA_def_function(srna, "update", "rna_Scene_update_tagged");
RNA_def_function_ui_description(func, "Update data tagged to be updated from previous access to data or operators.");
-
- /* Add Keying Set */
- func= RNA_def_function(srna, "add_keying_set", "rna_Scene_add_keying_set");
- RNA_def_function_ui_description(func, "Add a new Keying Set to Scene.");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- /* returns the new KeyingSet */
- parm= RNA_def_pointer(func, "keyingset", "KeyingSet", "", "Newly created Keying Set.");
- RNA_def_function_return(func, parm);
- /* name */
- RNA_def_string(func, "name", "KeyingSet", 64, "Name", "Name of Keying Set");
- /* flags */
- RNA_def_boolean(func, "absolute", 1, "Absolute", "Keying Set defines specific paths/settings to be keyframed (i.e. is not reliant on context info)");
- /* keying flags */
- RNA_def_boolean(func, "use_insertkey_needed", 0, "Insert Keyframes - Only Needed", "Only insert keyframes where they're needed in the relevant F-Curves.");
- RNA_def_boolean(func, "use_insertkey_visual", 0, "Insert Keyframes - Visual", "Insert keyframes based on 'visual transforms'.");
}
void RNA_api_scene_render(StructRNA *srna)
diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c
index d3207f14e24..3593efaa743 100644
--- a/source/blender/makesrna/intern/rna_sequencer.c
+++ b/source/blender/makesrna/intern/rna_sequencer.c
@@ -1336,7 +1336,7 @@ static void rna_def_plugin(BlenderRNA *brna)
RNA_def_struct_ui_text(srna, "Plugin Sequence", "Sequence strip applying an effect, loaded from an external plugin");
RNA_def_struct_sdna_from(srna, "PluginSeq", "plugin");
- prop= RNA_def_property(srna, "filename", PROP_STRING, PROP_FILEPATH);
+ prop= RNA_def_property(srna, "filename", PROP_STRING, PROP_FILENAME);
RNA_def_property_string_sdna(prop, NULL, "name");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Filename", "");
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index f74621e8419..780cc31edea 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -2047,12 +2047,12 @@ static void rna_def_fileselect_params(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Title", "Title for the file browser");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- prop= RNA_def_property(srna, "directory", PROP_STRING, PROP_NONE);
+ prop= RNA_def_property(srna, "directory", PROP_STRING, PROP_DIRPATH);
RNA_def_property_string_sdna(prop, NULL, "dir");
RNA_def_property_ui_text(prop, "Directory", "Directory displayed in the file browser");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
- prop= RNA_def_property(srna, "filename", PROP_STRING, PROP_NONE);
+ prop= RNA_def_property(srna, "filename", PROP_STRING, PROP_FILENAME);
RNA_def_property_string_sdna(prop, NULL, "file");
RNA_def_property_ui_text(prop, "File Name", "Active file in the file browser");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
@@ -2070,7 +2070,7 @@ static void rna_def_fileselect_params(BlenderRNA *brna)
prop= RNA_def_property(srna, "show_hidden", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", FILE_HIDE_DOT);
- RNA_def_property_ui_text(prop, "Hide Dot Files", "Hide hidden dot files");
+ RNA_def_property_ui_text(prop, "Show Hidden", "Show hidden dot files");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_PARAMS , NULL);
prop= RNA_def_property(srna, "sort_method", PROP_ENUM, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c
index a659ff7c260..f2c33f354c2 100644
--- a/source/blender/makesrna/intern/rna_ui.c
+++ b/source/blender/makesrna/intern/rna_ui.c
@@ -583,6 +583,11 @@ static void rna_def_panel(BlenderRNA *brna)
PropertyRNA *parm;
FunctionRNA *func;
+ static EnumPropertyItem panel_flag_items[] = {
+ {PNL_DEFAULT_CLOSED, "DEFAULT_CLOSED", 0, "Default Closed", "Defines if the panel has to be open or collapsed at the time of its creation."},
+ {PNL_NO_HEADER, "HIDE_HEADER", 0, "Show Header", "If set to True, the panel shows a header, which contains a clickable arrow to collapse the panel and the label (see bl_label)."},
+ {0, NULL, 0, NULL, NULL}};
+
srna= RNA_def_struct(brna, "Panel", NULL);
RNA_def_struct_ui_text(srna, "Panel", "Panel containing UI elements");
RNA_def_struct_sdna(srna, "Panel");
@@ -646,15 +651,11 @@ static void rna_def_panel(BlenderRNA *brna)
RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); /* should this be optional? - Campbell */
RNA_def_property_ui_text(prop, "Context", "The context in which the panel belongs to. (TODO: explain the possible combinations bl_context/bl_region_type/bl_space_type)");
- prop= RNA_def_property(srna, "bl_default_closed", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "type->flag", PNL_DEFAULT_CLOSED);
- RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
- RNA_def_property_ui_text(prop, "Default closed", "Defines if the panel has to be open or collapsed at the time of its creation. Note that once the panel has been created with bl_default_closed = True, at reload (F8) it stays open.");
-
- prop= RNA_def_property(srna, "bl_show_header", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "type->flag", PNL_NO_HEADER);
- RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
- RNA_def_property_ui_text(prop, "Show Header", "If set to True, the panel shows a header, which contains a clickable arrow to collapse the panel and the label (see bl_label).");
+ prop= RNA_def_property(srna, "bl_options", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "type->flag");
+ RNA_def_property_enum_items(prop, panel_flag_items);
+ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL|PROP_ENUM_FLAG);
+ RNA_def_property_ui_text(prop, "Options", "Options for this panel type");
}
static void rna_def_header(BlenderRNA *brna)
diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c
index 720666a6180..973de2ae92b 100644
--- a/source/blender/makesrna/intern/rna_ui_api.c
+++ b/source/blender/makesrna/intern/rna_ui_api.c
@@ -182,7 +182,7 @@ void RNA_api_ui_layout(StructRNA *srna)
RNA_def_property_flag(parm, PROP_REQUIRED);
api_ui_item_common(func);
- func= RNA_def_function(srna, "prop_object", "uiItemPointerR");
+ func= RNA_def_function(srna, "prop_search", "uiItemPointerR");
api_ui_item_rna_common(func);
parm= RNA_def_pointer(func, "search_data", "AnyType", "", "Data from which to take collection to search in.");
RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL);
@@ -259,7 +259,7 @@ void RNA_api_ui_layout(StructRNA *srna)
RNA_def_function_ui_description(func, "Item. Inserts empty space into the layout between items.");
/* context */
- func= RNA_def_function(srna, "set_context_pointer", "uiLayoutSetContextPointer");
+ func= RNA_def_function(srna, "context_pointer_set", "uiLayoutSetContextPointer");
parm= RNA_def_string(func, "name", "", 0, "Name", "Name of entry in the context.");
RNA_def_property_flag(parm, PROP_REQUIRED);
parm= RNA_def_pointer(func, "data", "AnyType", "", "Pointer to put in context.");
@@ -270,11 +270,6 @@ void RNA_api_ui_layout(StructRNA *srna)
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
RNA_def_boolean(func, "menus", 1, "", "The header has menus, and should show menu expander.");
- func= RNA_def_function(srna, "template_dopesheet_filter", "uiTemplateDopeSheetFilter");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
- parm= RNA_def_pointer(func, "dopesheet", "DopeSheet", "", "DopeSheet settings holding filter options.");
- RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL);
-
func= RNA_def_function(srna, "template_ID", "uiTemplateID");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
api_ui_item_rna_common(func);
@@ -377,9 +372,6 @@ void RNA_api_ui_layout(StructRNA *srna)
RNA_def_boolean(func, "lock_luminosity", 0, "", "Keep the color at its original vector length");
RNA_def_boolean(func, "cubic", 1, "", "Cubic saturation for picking values close to white");
- func= RNA_def_function(srna, "template_triColorSet", "uiTemplateTriColorSet");
- api_ui_item_rna_common(func);
-
func= RNA_def_function(srna, "template_image_layers", "uiTemplateImageLayers");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
parm= RNA_def_pointer(func, "image", "Image", "", "");
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index b2b22cf2f50..1e6d656d7ce 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -2386,6 +2386,11 @@ static void rna_def_userdef_system(BlenderRNA *brna)
RNA_def_property_range(prop, 32, 32768);
RNA_def_property_ui_text(prop, "Scrollback", "Maximum number of lines to store for the console buffer");
+ prop= RNA_def_property(srna, "author", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "author");
+ RNA_def_property_string_maxlength(prop, 80);
+ RNA_def_property_ui_text(prop, "Author", "Name that will be used in exported files when format supports such feature");
+
/* Language Selection */
prop= RNA_def_property(srna, "language", PROP_ENUM, PROP_NONE);
@@ -2797,7 +2802,7 @@ void rna_def_userdef_addon_collection(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_flag(func, FUNC_NO_SELF);
RNA_def_function_ui_description(func, "Remove addon.");
parm= RNA_def_pointer(func, "addon", "Addon", "", "Addon to remove.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
void RNA_def_userdef(BlenderRNA *brna)
@@ -2886,4 +2891,3 @@ void RNA_def_userdef(BlenderRNA *brna)
}
#endif
-
diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c
index 67b8ca057c8..1cfc80a1730 100644
--- a/source/blender/makesrna/intern/rna_wm.c
+++ b/source/blender/makesrna/intern/rna_wm.c
@@ -612,6 +612,33 @@ static int rna_wmKeyMapItem_name_length(PointerRNA *ptr)
return 0;
}
+static void rna_wmClipboard_get(PointerRNA *ptr, char *value)
+{
+ char *pbuf;
+
+ pbuf= WM_clipboard_text_get(FALSE);
+ strcpy(value, pbuf);
+
+ MEM_freeN(pbuf);
+}
+
+static int rna_wmClipboard_length(PointerRNA *ptr)
+{
+ char *clipboard;
+ int length;
+
+ clipboard = WM_clipboard_text_get(FALSE);
+ length = (clipboard?strlen(clipboard):0);
+ MEM_freeN(clipboard);
+
+ return length;
+}
+
+static void rna_wmClipboard_set(PointerRNA *ptr, const char *value)
+{
+ WM_clipboard_text_set((void *) value, FALSE);
+}
+
#ifndef DISABLE_PYTHON
static void rna_Operator_unregister(const bContext *C, StructRNA *type)
{
@@ -901,7 +928,7 @@ static StructRNA* rna_MacroOperator_refine(PointerRNA *opr)
return (op->type && op->type->ext.srna)? op->type->ext.srna: &RNA_Macro;
}
-static wmKeyMapItem *rna_KeyMap_add_item(wmKeyMap *km, ReportList *reports, char *idname, int type, int value, int any, int shift, int ctrl, int alt, int oskey, int keymodifier)
+static wmKeyMapItem *rna_KeyMap_item_new(wmKeyMap *km, ReportList *reports, char *idname, int type, int value, int any, int shift, int ctrl, int alt, int oskey, int keymodifier)
{
// wmWindowManager *wm = CTX_wm_manager(C);
int modifier= 0;
@@ -922,7 +949,7 @@ static wmKeyMapItem *rna_KeyMap_add_item(wmKeyMap *km, ReportList *reports, char
return WM_keymap_add_item(km, idname, type, value, modifier, keymodifier);
}
-static wmKeyMapItem *rna_KeyMap_add_modal_item(wmKeyMap *km, bContext *C, ReportList *reports, char* propvalue_str, int type, int value, int any, int shift, int ctrl, int alt, int oskey, int keymodifier)
+static wmKeyMapItem *rna_KeyMap_item_new_modal(wmKeyMap *km, bContext *C, ReportList *reports, char* propvalue_str, int type, int value, int any, int shift, int ctrl, int alt, int oskey, int keymodifier)
{
wmWindowManager *wm = CTX_wm_manager(C);
int modifier= 0;
@@ -961,6 +988,30 @@ static wmKeyMapItem *rna_KeyMap_add_modal_item(wmKeyMap *km, bContext *C, Report
return WM_modalkeymap_add_item(km, type, value, modifier, keymodifier, propvalue);
}
+static wmKeyMap *rna_keymap_new(wmKeyConfig *keyconf, char *idname, int spaceid, int regionid, int modal)
+{
+ if (modal == 0) {
+ return WM_keymap_find(keyconf, idname, spaceid, regionid);
+ } else {
+ return WM_modalkeymap_add(keyconf, idname, NULL); /* items will be lazy init */
+ }
+}
+
+static wmKeyMap *rna_keymap_find(wmKeyConfig *keyconf, char *idname, int spaceid, int regionid)
+{
+ return WM_keymap_list_find(&keyconf->keymaps, idname, spaceid, regionid);
+}
+
+static wmKeyMap *rna_keymap_find_modal(wmKeyConfig *keyconf, char *idname)
+{
+ wmOperatorType *ot = WM_operatortype_find(idname, 0);
+
+ if (!ot)
+ return NULL;
+ else
+ return ot->modalkeymap;
+}
+
#else /* RNA_RUNTIME */
static void rna_def_operator(BlenderRNA *brna)
@@ -1237,6 +1288,43 @@ static void rna_def_window(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_Window_screen_update");
}
+/* curve.splines */
+static void rna_def_wm_keyconfigs(BlenderRNA *brna, PropertyRNA *cprop)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "KeyConfigurations");
+ srna= RNA_def_struct(brna, "KeyConfigurations", NULL);
+ RNA_def_struct_sdna(srna, "wmWindowManager");
+ RNA_def_struct_ui_text(srna, "KeyConfigs", "Collection of KeyConfigs");
+
+ prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "KeyConfig");
+ RNA_def_property_pointer_funcs(prop, "rna_WindowManager_active_keyconfig_get", "rna_WindowManager_active_keyconfig_set", NULL, NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Active KeyConfig", "Active wm KeyConfig");
+
+ prop= RNA_def_property(srna, "default", PROP_POINTER, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "defaultconf");
+ RNA_def_property_struct_type(prop, "KeyConfig");
+ RNA_def_property_ui_text(prop, "Default Key Configuration", "");
+
+ /* funcs */
+ func= RNA_def_function(srna, "new", "WM_keyconfig_new_user"); // add_keyconfig
+ parm= RNA_def_string(func, "name", "", 0, "Name", "");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ parm= RNA_def_pointer(func, "keyconfig", "KeyConfig", "Key Configuration", "Added key configuration.");
+ RNA_def_function_return(func, parm);
+
+ func= RNA_def_function(srna, "remove", "WM_keyconfig_remove"); // remove_keyconfig
+ parm= RNA_def_pointer(func, "keyconfig", "KeyConfig", "Key Configuration", "Removed key configuration.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+}
+
static void rna_def_windowmanager(BlenderRNA *brna)
{
StructRNA *srna;
@@ -1258,17 +1346,11 @@ static void rna_def_windowmanager(BlenderRNA *brna)
prop= RNA_def_property(srna, "keyconfigs", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, "KeyConfig");
RNA_def_property_ui_text(prop, "Key Configurations", "Registered key configurations");
+ rna_def_wm_keyconfigs(brna, prop);
- prop= RNA_def_property(srna, "active_keyconfig", PROP_POINTER, PROP_NEVER_NULL);
- RNA_def_property_struct_type(prop, "KeyConfig");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_pointer_funcs(prop, "rna_WindowManager_active_keyconfig_get", "rna_WindowManager_active_keyconfig_set", 0, NULL);
- RNA_def_property_ui_text(prop, "Active Key Configuration", "");
-
- prop= RNA_def_property(srna, "default_keyconfig", PROP_POINTER, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "defaultconf");
- RNA_def_property_struct_type(prop, "KeyConfig");
- RNA_def_property_ui_text(prop, "Default Key Configuration", "");
+ prop= RNA_def_property(srna, "clipboard", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop, "rna_wmClipboard_get", "rna_wmClipboard_length", "rna_wmClipboard_set");
+ RNA_def_property_ui_text(prop, "Text Clipboard", "");
RNA_api_wm(srna);
}
@@ -1287,7 +1369,7 @@ static void rna_def_keymap_items(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_struct_sdna(srna, "wmKeyMap");
RNA_def_struct_ui_text(srna, "KeyMap Items", "Collection of keymap items");
- func= RNA_def_function(srna, "add", "rna_KeyMap_add_item");
+ func= RNA_def_function(srna, "new", "rna_KeyMap_item_new");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
parm= RNA_def_string(func, "idname", "", 0, "Operator Identifier", "");
RNA_def_property_flag(parm, PROP_REQUIRED);
@@ -1304,7 +1386,7 @@ static void rna_def_keymap_items(BlenderRNA *brna, PropertyRNA *cprop)
parm= RNA_def_pointer(func, "item", "KeyMapItem", "Item", "Added key map item.");
RNA_def_function_return(func, parm);
- func= RNA_def_function(srna, "add_modal", "rna_KeyMap_add_modal_item");
+ func= RNA_def_function(srna, "new_modal", "rna_KeyMap_item_new_modal");
RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_REPORTS);
parm= RNA_def_string(func, "propvalue", "", 0, "Property Value", "");
RNA_def_property_flag(parm, PROP_REQUIRED);
@@ -1321,6 +1403,56 @@ static void rna_def_keymap_items(BlenderRNA *brna, PropertyRNA *cprop)
parm= RNA_def_pointer(func, "item", "KeyMapItem", "Item", "Added key map item.");
RNA_def_function_return(func, parm);
+ func= RNA_def_function(srna, "remove", "WM_keymap_remove_item");
+ parm= RNA_def_pointer(func, "item", "KeyMapItem", "Item", "");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+
+ func= RNA_def_function(srna, "from_id", "WM_keymap_item_find_id");
+ parm= RNA_def_property(func, "id", PROP_INT, PROP_NONE);
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_property_ui_text(parm, "id", "ID of the item");
+ parm= RNA_def_pointer(func, "item", "KeyMapItem", "Item", "");
+ RNA_def_function_return(func, parm);
+
+}
+
+static void rna_def_wm_keymaps(BlenderRNA *brna, PropertyRNA *cprop)
+{
+ StructRNA *srna;
+ //PropertyRNA *prop;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+
+ RNA_def_property_srna(cprop, "KeyMaps");
+ srna= RNA_def_struct(brna, "KeyMaps", NULL);
+ RNA_def_struct_sdna(srna, "wmKeyConfig");
+ RNA_def_struct_ui_text(srna, "Key Maps", "Collection of keymaps");
+
+ func= RNA_def_function(srna, "new", "rna_keymap_new"); // add_keymap
+ parm= RNA_def_string(func, "name", "", 0, "Name", "");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_enum(func, "space_type", space_type_items, SPACE_EMPTY, "Space Type", "");
+ RNA_def_enum(func, "region_type", region_type_items, RGN_TYPE_WINDOW, "Region Type", "");
+ RNA_def_boolean(func, "modal", 0, "Modal", "");
+ parm= RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Added key map.");
+ RNA_def_function_return(func, parm);
+
+ func= RNA_def_function(srna, "find", "rna_keymap_find"); // find_keymap
+ parm= RNA_def_string(func, "name", "", 0, "Name", "");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_enum(func, "space_type", space_type_items, SPACE_EMPTY, "Space Type", "");
+ RNA_def_enum(func, "region_type", region_type_items, RGN_TYPE_WINDOW, "Region Type", "");
+ parm= RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Corresponding key map.");
+ RNA_def_function_return(func, parm);
+
+ func= RNA_def_function(srna, "find_modal", "rna_keymap_find_modal"); // find_keymap_modal
+ parm= RNA_def_string(func, "name", "", 0, "Operator Name", "");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ parm= RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Corresponding key map.");
+ RNA_def_function_return(func, parm);
+
}
static void rna_def_keyconfig(BlenderRNA *brna)
@@ -1351,6 +1483,7 @@ static void rna_def_keyconfig(BlenderRNA *brna)
prop= RNA_def_property(srna, "keymaps", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, "KeyMap");
RNA_def_property_ui_text(prop, "Key Maps", "Key maps configured as part of this configuration");
+ rna_def_wm_keymaps(brna, prop);
prop= RNA_def_property(srna, "is_user_defined", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYCONF_USER);
diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c
index a4999e71fcf..6eb9bfeb4c0 100644
--- a/source/blender/makesrna/intern/rna_wm_api.c
+++ b/source/blender/makesrna/intern/rna_wm_api.c
@@ -39,31 +39,6 @@
#include "BKE_context.h"
-
-static wmKeyMap *rna_keymap_add(wmKeyConfig *keyconf, char *idname, int spaceid, int regionid, int modal)
-{
- if (modal == 0) {
- return WM_keymap_find(keyconf, idname, spaceid, regionid);
- } else {
- return WM_modalkeymap_add(keyconf, idname, NULL); /* items will be lazy init */
- }
-}
-
-static wmKeyMap *rna_keymap_find(wmKeyConfig *keyconf, char *idname, int spaceid, int regionid)
-{
- return WM_keymap_list_find(&keyconf->keymaps, idname, spaceid, regionid);
-}
-
-static wmKeyMap *rna_keymap_find_modal(wmKeyConfig *keyconf, char *idname)
-{
- wmOperatorType *ot = WM_operatortype_find(idname, 0);
-
- if (!ot)
- return NULL;
- else
- return ot->modalkeymap;
-}
-
static wmKeyMap *rna_keymap_active(wmKeyMap *km, bContext *C)
{
wmWindowManager *wm = CTX_wm_manager(C);
@@ -132,16 +107,6 @@ void RNA_api_wm(StructRNA *srna)
RNA_def_function_ui_description(func, "Show up the file selector.");
rna_generic_op_invoke(func, 0);
- func= RNA_def_function(srna, "add_keyconfig", "WM_keyconfig_add_user");
- parm= RNA_def_string(func, "name", "", 0, "Name", "");
- RNA_def_property_flag(parm, PROP_REQUIRED);
- parm= RNA_def_pointer(func, "keyconfig", "KeyConfig", "Key Configuration", "Added key configuration.");
- RNA_def_function_return(func, parm);
-
- func= RNA_def_function(srna, "remove_keyconfig", "WM_keyconfig_remove");
- parm= RNA_def_pointer(func, "keyconfig", "KeyConfig", "Key Configuration", "Removed key configuration.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
-
func= RNA_def_function(srna, "add_modal_handler", "rna_event_add_modal_handler");
RNA_def_function_flag(func, FUNC_NO_SELF|FUNC_USE_CONTEXT);
parm= RNA_def_pointer(func, "operator", "Operator", "", "Operator to call.");
@@ -259,31 +224,8 @@ void RNA_api_macro(StructRNA *srna)
void RNA_api_keyconfig(StructRNA *srna)
{
- FunctionRNA *func;
- PropertyRNA *parm;
-
- func= RNA_def_function(srna, "add_keymap", "rna_keymap_add");
- parm= RNA_def_string(func, "name", "", 0, "Name", "");
- RNA_def_property_flag(parm, PROP_REQUIRED);
- RNA_def_enum(func, "space_type", space_type_items, SPACE_EMPTY, "Space Type", "");
- RNA_def_enum(func, "region_type", region_type_items, RGN_TYPE_WINDOW, "Region Type", "");
- RNA_def_boolean(func, "modal", 0, "Modal", "");
- parm= RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Added key map.");
- RNA_def_function_return(func, parm);
-
- func= RNA_def_function(srna, "find_keymap", "rna_keymap_find");
- parm= RNA_def_string(func, "name", "", 0, "Name", "");
- RNA_def_property_flag(parm, PROP_REQUIRED);
- RNA_def_enum(func, "space_type", space_type_items, SPACE_EMPTY, "Space Type", "");
- RNA_def_enum(func, "region_type", region_type_items, RGN_TYPE_WINDOW, "Region Type", "");
- parm= RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Corresponding key map.");
- RNA_def_function_return(func, parm);
-
- func= RNA_def_function(srna, "find_keymap_modal", "rna_keymap_find_modal");
- parm= RNA_def_string(func, "name", "", 0, "Operator Name", "");
- RNA_def_property_flag(parm, PROP_REQUIRED);
- parm= RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Corresponding key map.");
- RNA_def_function_return(func, parm);
+ // FunctionRNA *func;
+ // PropertyRNA *parm;
}
void RNA_api_keymap(StructRNA *srna)
@@ -296,17 +238,6 @@ void RNA_api_keymap(StructRNA *srna)
parm= RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Active key map.");
RNA_def_function_return(func, parm);
- func= RNA_def_function(srna, "remove_item", "WM_keymap_remove_item");
- parm= RNA_def_pointer(func, "item", "KeyMapItem", "Item", "");
- RNA_def_property_flag(parm, PROP_REQUIRED);
-
- func= RNA_def_function(srna, "item_from_id", "WM_keymap_item_find_id");
- parm= RNA_def_property(func, "id", PROP_INT, PROP_NONE);
- RNA_def_property_flag(parm, PROP_REQUIRED);
- RNA_def_property_ui_text(parm, "id", "ID of the item");
- parm= RNA_def_pointer(func, "item", "KeyMapItem", "Item", "");
- RNA_def_function_return(func, parm);
-
func= RNA_def_function(srna, "copy_to_user", "WM_keymap_copy_to_user");
parm= RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "User editable key map.");
RNA_def_function_return(func, parm);
diff --git a/source/blender/makesrna/intern/rna_world.c b/source/blender/makesrna/intern/rna_world.c
index 907042e7453..ecf253acbce 100644
--- a/source/blender/makesrna/intern/rna_world.c
+++ b/source/blender/makesrna/intern/rna_world.c
@@ -469,8 +469,8 @@ void RNA_def_world(BlenderRNA *brna)
RNA_def_struct_ui_icon(srna, ICON_WORLD_DATA);
rna_def_animdata_common(srna);
- rna_def_mtex_common(srna, "rna_World_mtex_begin", "rna_World_active_texture_get",
- "rna_World_active_texture_set", "WorldTextureSlot", "rna_World_update");
+ rna_def_mtex_common(brna, srna, "rna_World_mtex_begin", "rna_World_active_texture_get",
+ "rna_World_active_texture_set", "WorldTextureSlot", "WorldTextureSlots", "rna_World_update");
/* colors */
prop= RNA_def_property(srna, "horizon_color", PROP_FLOAT, PROP_COLOR);
diff --git a/source/blender/makesrna/rna_cleanup/rna_properties.txt b/source/blender/makesrna/rna_cleanup/rna_properties.txt
index b319ce15ba1..92adbf4373e 100644
--- a/source/blender/makesrna/rna_cleanup/rna_properties.txt
+++ b/source/blender/makesrna/rna_cleanup/rna_properties.txt
@@ -313,6 +313,7 @@
#+ * BoneGroup.color_set -> color_set: enum "Custom color set to use"
#+ * BoneGroup.colors -> colors: pointer, "(read-only) Copy of the colors associated with the groups color set"
#+ * BoneGroup.name -> name: string "NO DESCRIPTION"
+#BoneGroups.active -> active: pointer "Active bone group for this pose"
#+ * ClothCollisionSettings.collision_quality -> collision_quality: int "How many collision iterations should be done. (higher is better quality but slower)"
#ClothCollisionSettings.distance_min -> distance_min: float "Minimum distance between collision objects before collision response takes in"
#+ * ClothCollisionSettings.friction -> friction: float "Friction force if a collision happened. (higher = less movement)"
@@ -620,7 +621,7 @@
#+ * CurveMapping.curves -> curves: collection, "(read-only)"
#CurveMapping.use_clip -> use_clip: boolean "Force the curve view to fit a defined boundary"
#+ * CurveMapping.white_level -> white_level: float[3] "For RGB curves, the color that white is mapped to"
-#TODO MOVE TO COLLECTION * CurveSplines.active -> active: pointer "Active curve spline"
+#+ * CurveSplines.active -> active: pointer "Active curve spline"
#DopeSheet.filter_group -> filter_group: pointer "Group that included Object should be a member of"
#DopeSheet.show_armatures -> show_armatures: boolean "Include visualization of Armature related Animation data"
#DopeSheet.show_cameras -> show_cameras: boolean "Include visualization of Camera related Animation data"
@@ -1430,9 +1431,7 @@
#ID|Material.use_vertex_color_light -> use_vertex_color_light: boolean "Add vertex colors as additional lighting"
#ID|Material.use_vertex_color_paint -> use_vertex_color_paint: boolean "Replaces object base color with vertex colors (multiplies with texture face face assigned textures)"
#+ * ID|Material.volume -> volume: pointer, "(read-only) Volume settings for the material"
-#+ * ID|Mesh.active_uv_texture -> active_uv_texture: pointer "Active UV texture"
#+ * ID|Mesh.active_uv_texture_index -> active_uv_texture_index: int "Active UV texture index"
-#+ * ID|Mesh.active_vertex_color -> active_vertex_color: pointer "Active vertex color layer"
#+ * ID|Mesh.active_vertex_color_index -> active_vertex_color_index: int "Active vertex color index"
#+ * ID|Mesh.animation_data -> animation_data: pointer, "(read-only) Animation data for this datablock"
#ID|Mesh.auto_smooth_angle -> auto_smooth_angle: int "Defines maximum angle between face normals that Auto Smooth will operate on"
@@ -1476,7 +1475,6 @@
#+ * ID|Mesh.uv_textures -> uv_textures: collection, "(read-only)"
#+ * ID|Mesh.vertex_colors -> vertex_colors: collection, "(read-only)"
#ID|Mesh.vertices -> vertices: collection, "(read-only) Vertices of the mesh"
-#TODO MOVE TO ELEMENTS * ID|MetaBall.active_element -> active_element: pointer, "(read-only) Last selected element"
#+ * ID|MetaBall.animation_data -> animation_data: pointer, "(read-only) Animation data for this datablock"
#+ * ID|MetaBall.elements -> elements: collection, "(read-only) Meta elements"
#+ * ID|MetaBall.materials -> materials: collection, "(read-only)"
@@ -1722,7 +1720,6 @@
#ID|ParticleSettings.use_whole_group -> use_whole_group: boolean "Use whole group at once"
#+ * ID|ParticleSettings.userjit -> userjit: int "Emission locations / face (0 = automatic)"
#+ * ID|ParticleSettings.virtual_parents -> virtual_parents: float "Relative amount of virtual parents"
-#+ * ID|Scene.active_keying_set -> active_keying_set: pointer "Active Keying Set used to insert/delete keyframes"
#+ * ID|Scene.active_keying_set_index -> active_keying_set_index: int "Current Keying Set index (negative for builtin and positive for absolute)"
#+ * ID|Scene.animation_data -> animation_data: pointer, "(read-only) Animation data for this datablock"
#ID|Scene.audio_distance_model -> audio_distance_model: enum "Distance model for distance attenuation calculation"
@@ -1896,8 +1893,6 @@
#ID|Texture|WoodTexture.wood_type -> wood_type: enum "NO DESCRIPTION"
#+ * ID|VectorFont.filepath -> filepath: string, "(read-only)"
#+ * ID|VectorFont.packed_file -> packed_file: pointer, "(read-only)"
-#TODO, move into collectin * ID|WindowManager.active_keyconfig -> active_keyconfig: pointer "NO DESCRIPTION"
-#+ * ID|WindowManager.default_keyconfig -> default_keyconfig: pointer, "(read-only)"
#+ * ID|WindowManager.keyconfigs -> keyconfigs: collection, "(read-only) Registered key configurations"
#+ * ID|WindowManager.operators -> operators: collection, "(read-only) Operator registry"
#+ * ID|WindowManager.windows -> windows: collection, "(read-only) Open windows"
@@ -1941,6 +1936,8 @@
#KeyConfig.is_user_defined -> is_user_defined: boolean, "(read-only) Indicates that a keyconfig was defined by the user"
#+ * KeyConfig.keymaps -> keymaps: collection, "(read-only) Key maps configured as part of this configuration"
#+ * KeyConfig.name -> name: string "Name of the key configuration"
+#KeyConfigurations.active -> active: pointer "Active wm KeyConfig"
+#KeyConfigurations.default -> default: pointer, "(read-only)"
#KeyMap.is_modal -> is_modal: boolean, "(read-only) Indicates that a keymap is used for translate modal events for an operator"
#KeyMap.is_user_defined -> is_user_defined: boolean "Keymap is defined by the user"
#+ * KeyMap.items -> items: collection, "(read-only) Items in the keymap, linking an operator to an input event"
@@ -1975,7 +1972,6 @@
#+ * Keyframe.select_left_handle -> select_left_handle: boolean "Handle 1 selection status"
#+ * Keyframe.select_right_handle -> select_right_handle: boolean "Handle 2 selection status"
#+ * Keyframe.type -> type: enum "The type of keyframe"
-#TODO MOVE TO COLLECTION * KeyingSet.active_path -> active_path: pointer "Active Keying Set used to insert/delete keyframes"
#+ * KeyingSet.active_path_index -> active_path_index: int "Current Keying Set index"
#KeyingSet.is_path_absolute -> is_path_absolute: boolean, "(read-only) Keying Set defines specific paths/settings to be keyframed (i.e. is not reliant on context info)"
#+ * KeyingSet.name -> name: string "NO DESCRIPTION"
@@ -1999,6 +1995,8 @@
#KeyingSetPath.use_insertkey_needed -> use_insertkey_needed: boolean "Only insert keyframes where theyre needed in the relevant F-Curves"
#KeyingSetPath.use_insertkey_visual -> use_insertkey_visual: boolean "Insert keyframes based on visual transforms"
#KeyingSetPath.use_insertkey_xyz_to_rgb -> use_insertkey_xyz_to_rgb: boolean "Color for newly added transformation F-Curves (Location, Rotation, Scale) and also Color is based on the transform axis"
+#KeyingSetPaths.active -> active: pointer "Active Keying Set used to insert/delete keyframes"
+#KeyingSets.active -> active: pointer "Active Keying Set used to insert/delete keyframes"
#+ * LampSkySettings.atmosphere_distance_factor -> atmosphere_distance_factor: float "Multiplier to convert blender units to physical distance"
#+ * LampSkySettings.atmosphere_extinction -> atmosphere_extinction: float "Extinction scattering contribution factor"
#+ * LampSkySettings.atmosphere_inscattering -> atmosphere_inscattering: float "Scatter contribution factor"
@@ -2063,13 +2061,13 @@
#MaterialHalo.line_count -> line_count: int "Sets the number of star shaped lines rendered over the halo"
#MaterialHalo.ring_count -> ring_count: int "Sets the number of rings rendered over the halo"
#+ * MaterialHalo.seed -> seed: int "Randomizes ring dimension and line location"
-#MaterialHalo.show_shaded -> show_shaded: boolean "Lets halo receive light and shadows from external objects"
#+ * MaterialHalo.size -> size: float "Sets the dimension of the halo"
#MaterialHalo.star_tip_count -> star_tip_count: int "Sets the number of points on the star shaped halo"
#MaterialHalo.use_extreme_alpha -> use_extreme_alpha: boolean "Uses extreme alpha"
#MaterialHalo.use_flare_mode -> use_flare_mode: boolean "Renders halo as a lensflare"
#MaterialHalo.use_lines -> use_lines: boolean "Renders star shaped lines over halo"
#MaterialHalo.use_ring -> use_ring: boolean "Renders rings over halo"
+#MaterialHalo.use_shaded -> use_shaded: boolean "Lets halo receive light and shadows from external objects"
#MaterialHalo.use_soft -> use_soft: boolean "Softens the edges of halos at intersections with other geometry"
#MaterialHalo.use_star -> use_star: boolean "Renders halo as a star"
#MaterialHalo.use_texture -> use_texture: boolean "Gives halo a texture"
@@ -2219,6 +2217,7 @@
#+ * MeshVertex.index -> index: int, "(read-only) Index number of the vertex"
#+ * MeshVertex.normal -> normal: float[3] "Vertex Normal"
#+ * MeshVertex.select -> select: boolean "NO DESCRIPTION"
+#MetaBallElements.active -> active: pointer, "(read-only) Last selected element"
#MetaElement.co -> co: float[3] "NO DESCRIPTION"
#+ * MetaElement.hide -> hide: boolean "Hide element"
#+ * MetaElement.radius -> radius: float "NO DESCRIPTION"
@@ -2393,10 +2392,10 @@
#+ * Modifier|SmokeModifier.flow_settings -> flow_settings: pointer, "(read-only)"
#Modifier|SmokeModifier.smoke_type -> smoke_type: enum "NO DESCRIPTION"
#+ * Modifier|SmoothModifier.factor -> factor: float "NO DESCRIPTION"
-#Modifier|SmoothModifier.ise_x -> ise_x: boolean "NO DESCRIPTION"
-#Modifier|SmoothModifier.ise_y -> ise_y: boolean "NO DESCRIPTION"
-#Modifier|SmoothModifier.ise_z -> ise_z: boolean "NO DESCRIPTION"
#Modifier|SmoothModifier.iterations -> iterations: int "NO DESCRIPTION"
+#Modifier|SmoothModifier.use_x -> use_x: boolean "NO DESCRIPTION"
+#Modifier|SmoothModifier.use_y -> use_y: boolean "NO DESCRIPTION"
+#Modifier|SmoothModifier.use_z -> use_z: boolean "NO DESCRIPTION"
#+ * Modifier|SmoothModifier.vertex_group -> vertex_group: string "Vertex group name"
#+ * Modifier|SoftBodyModifier.point_cache -> point_cache: pointer, "(read-only)"
#+ * Modifier|SoftBodyModifier.settings -> settings: pointer, "(read-only)"
@@ -2880,7 +2879,6 @@
#+ * PointDensity.turbulence_strength -> turbulence_strength: float "NO DESCRIPTION"
#PointDensity.use_turbulence -> use_turbulence: boolean "Add directed noise to the density at render-time"
#PointDensity.vertex_cache_space -> vertex_cache_space: enum "Co-ordinate system to cache vertices in"
-#+ * Pose.active_bone_group -> active_bone_group: pointer "Active bone group for this pose"
#+ * Pose.active_bone_group_index -> active_bone_group_index: int "Active index in bone groups array"
#+ * Pose.animation_visualisation -> animation_visualisation: pointer, "(read-only) Animation data for this datablock"
#+ * Pose.bone_groups -> bone_groups: collection, "(read-only) Groups of the bones"
@@ -3067,9 +3065,6 @@
#+ * RenderSettings.edge_color -> edge_color: float[3] "NO DESCRIPTION"
#+ * RenderSettings.edge_threshold -> edge_threshold: int "Threshold for drawing outlines on geometry edges"
#+ * RenderSettings.engine -> engine: enum "Engine to use for rendering"
-#RenderSettings.exr_codec -> exr_codec: enum "Codec settings for OpenEXR"
-#RenderSettings.exr_preview -> exr_preview: boolean "When rendering animations, save JPG preview images in same directory"
-#RenderSettings.exr_zbuf -> exr_zbuf: boolean "Save the z-depth per pixel (32 bit unsigned int zbuffer)"
#+ * RenderSettings.field_order -> field_order: enum "Order of video fields. Select which lines get rendered first, to create smooth motion for TV output"
#+ * RenderSettings.file_extension -> file_extension: string, "(read-only) The file extension used for saving renders"
#+ * RenderSettings.file_format -> file_format: enum "File format to save the rendered images as"
@@ -3080,9 +3075,6 @@
#+ * RenderSettings.fps_base -> fps_base: float "Framerate base"
#RenderSettings.has_multiple_engines -> has_multiple_engines: boolean, "(read-only) More than one rendering engine is available"
#+ * RenderSettings.is_movie_format -> is_movie_format: boolean, "(read-only) When true the format is a movie"
-#RenderSettings.jpeg2k_depth -> jpeg2k_depth: enum "Bit depth per channel"
-#RenderSettings.jpeg2k_preset -> jpeg2k_preset: enum "Use a DCI Standard preset for saving jpeg2000"
-#RenderSettings.jpeg2k_ycc -> jpeg2k_ycc: boolean "Save luminance-chrominance-chrominance channels instead of RGB colors"
#+ * RenderSettings.layers -> layers: collection, "(read-only)"
#+ * RenderSettings.motion_blur_samples -> motion_blur_samples: int "Number of scene samples to take with motion blur"
#+ * RenderSettings.motion_blur_shutter -> motion_blur_shutter: float "Time taken in frames between shutter open and close"
@@ -3121,7 +3113,6 @@
#RenderSettings.use_crop_to_border -> use_crop_to_border: boolean "Crop the rendered frame to the defined border size"
#RenderSettings.use_edge_enhance -> use_edge_enhance: boolean "Create a toon outline around the edges of geometry"
#+ * RenderSettings.use_envmaps -> use_envmaps: boolean "Calculate environment maps while rendering"
-#RenderSettings.use_exr_half -> use_exr_half: boolean "Use 16 bit floats instead of 32 bit floats per channel"
#RenderSettings.use_fields -> use_fields: boolean "Render image to two fields per frame, for interlaced TV output"
#RenderSettings.use_fields_still -> use_fields_still: boolean "Disable the time difference between fields"
#+ * RenderSettings.use_file_extension -> use_file_extension: boolean "Add the file format extensions to the rendered file name (eg: filename + .jpg)"
@@ -3544,7 +3535,7 @@
#SmokeDomainSettings.collision_extents -> collision_extents: enum "Selects which domain border will be treated as collision object."
#SmokeDomainSettings.collision_group -> collision_group: pointer "Limit collisions to this group"
#+ * SmokeDomainSettings.dissolve_speed -> dissolve_speed: int "Dissolve Speed"
-#+ * SmokeDomainSettings.eff_group -> eff_group: pointer "Limit effectors to this group"
+#SmokeDomainSettings.effector_group -> effector_group: pointer "Limit effectors to this group"
#+ * SmokeDomainSettings.effector_weights -> effector_weights: pointer, "(read-only)"
#+ * SmokeDomainSettings.fluid_group -> fluid_group: pointer "Limit fluid objects to this group"
#+ * SmokeDomainSettings.noise_type -> noise_type: enum "Noise method which is used for creating the high resolution"
@@ -4406,6 +4397,7 @@
+ * UILayout.active -> show_active: boolean "NO DESCRIPTION"
+ * UILayout.enabled -> show_enabled: boolean "When false, this (sub)layout is greyed out."
#+ * UVProjector.object -> object: pointer "Object to use as projector transform"
+#UVTextures.active -> active: pointer "Active UV texture"
#+ * UnitSettings.rotation_units -> rotation_units: enum "Unit to use for displaying/editing rotation values"
#+ * UnitSettings.scale_length -> scale_length: float "Scale to use when converting between blender units and dimensions"
#+ * UnitSettings.system -> system: enum "The unit system to use for button display"
@@ -4562,6 +4554,7 @@
#+ * ValueNodeSocket.name -> name: string, "(read-only) Socket name"
#+ * VectorNodeSocket.default_value -> default_value: float[3] "Default value of the socket when no link is attached"
#+ * VectorNodeSocket.name -> name: string, "(read-only) Socket name"
+#VertexColors.active -> active: pointer "Active vertex color layer"
#+ * VertexGroup.index -> index: int, "(read-only) Index number of the vertex group"
#+ * VertexGroup.name -> name: string "Vertex group name"
#+ * VertexGroupElement.group -> group: int, "(read-only)"
diff --git a/source/blender/makesrna/rna_cleanup/rna_update.sh b/source/blender/makesrna/rna_cleanup/rna_update.sh
index 04d4bbcb0e4..a4d686cc482 100755
--- a/source/blender/makesrna/rna_cleanup/rna_update.sh
+++ b/source/blender/makesrna/rna_cleanup/rna_update.sh
@@ -10,4 +10,4 @@ mv out_work_merged_work.txt rna_properties.txt # overwrite
mv out_work_lost_work.txt rna_properties_lost.txt
cat rna_properties.txt | grep -v "^#" > rna_properties_edits.txt
./rna_cleaner.py rna_properties.txt
-echo "Updated: rna_properties.txt rna_properties_edits.txt rna_properties_lost.txt " \ No newline at end of file
+echo "Updated: rna_properties.txt rna_properties_edits.txt rna_properties_lost.txt "
diff --git a/source/blender/modifiers/SConscript b/source/blender/modifiers/SConscript
index 1722ca276f7..7a810af28a2 100644
--- a/source/blender/modifiers/SConscript
+++ b/source/blender/modifiers/SConscript
@@ -15,6 +15,6 @@ defs = []
if env['BF_NO_ELBEEM']:
defs.append('DISABLE_ELBEEM')
-env.BlenderLib ( libname = 'modifiers', sources = sources,
+env.BlenderLib ( libname = 'bf_modifiers', sources = sources,
includes = Split(incs), defines=defs,
libtype=['core','player'], priority = [165, 20] )
diff --git a/source/blender/modifiers/intern/MOD_screw.c b/source/blender/modifiers/intern/MOD_screw.c
index 783bad15c70..7cec359fd33 100644
--- a/source/blender/modifiers/intern/MOD_screw.c
+++ b/source/blender/modifiers/intern/MOD_screw.c
@@ -436,7 +436,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
vc= vert_connect;
for (i=0; i < totvert; i++, vc++) {
int v_best=-1, ed_loop_closed=0; /* vert and vert new */
- int ed_loop_flip;
+ int ed_loop_flip= 0; /* compiler complains if not initialized, but it should be initialized below */
float fl= -1.0f;
ScrewVertIter lt_iter;
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c b/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c
index 43c6c6d791e..33f5680eaa9 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c
@@ -43,15 +43,24 @@ static bNodeSocketType cmp_node_colorbalance_out[]={
{-1,0,""}
};
+/* this function implements ASC-CDL according to the spec at http://www.asctech.org/
+ Slope
+ S = in * slope
+ Offset
+ O = S + offset
+ = (in * slope) + offset
+ Power
+ out = Clamp(O) ^ power
+ = Clamp((in * slope) + offset) ^ power
+ */
DO_INLINE float colorbalance_cdl(float in, float offset, float power, float slope)
{
float x = in * slope + offset;
/* prevent NaN */
- if (x < 0.f) x = 0.f;
+ CLAMP(x, 0.0, 1.0);
- //powf(in * slope + offset, power)
- return powf(x, 1.f/power);
+ return powf(x, power);
}
/* note: lift_lgg is just 2-lift, gamma_inv is 1.0/gamma */
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_crop.c b/source/blender/nodes/intern/CMP_nodes/CMP_crop.c
index c2edb3dd52f..4585a9ab9a2 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_crop.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_crop.c
@@ -50,6 +50,13 @@ static void node_composit_exec_crop(void *data, bNode *node, bNodeStack **in, bN
float *srcfp, *outfp;
rcti outputrect;
+ if(node->custom2) {
+ ntxy->x1= cbuf->x* ntxy->fac_x1;
+ ntxy->x2= cbuf->x* ntxy->fac_x2;
+ ntxy->y1= cbuf->y* ntxy->fac_y1;
+ ntxy->y2= cbuf->y* ntxy->fac_y2;
+ }
+
/* check input image size */
if(cbuf->x <= ntxy->x1 + 1)
ntxy->x1= cbuf->x - 1;
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_displace.c b/source/blender/nodes/intern/CMP_nodes/CMP_displace.c
index 6fe6dcd8440..7d64d4e719c 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_displace.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_displace.c
@@ -48,7 +48,7 @@ static bNodeSocketType cmp_node_displace_out[]= {
* in order to take effect */
#define DISPLACE_EPSILON 0.01
-static void do_displace(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *vecbuf, float *veccol, float *xscale, float *yscale)
+static void do_displace(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *vecbuf, float *veccol, CompBuf *xbuf, CompBuf *ybuf, float *xscale, float *yscale)
{
ImBuf *ibuf;
int x, y;
@@ -56,6 +56,7 @@ static void do_displace(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *vecbuf, float
float d_dx, d_dy;
float dxt, dyt;
float u, v;
+ float xs, ys;
float vec[3], vecdx[3], vecdy[3];
float col[3];
@@ -66,8 +67,20 @@ static void do_displace(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *vecbuf, float
for(x=0; x < stackbuf->x; x++) {
/* calc pixel coordinates */
qd_getPixel(vecbuf, x-vecbuf->xof, y-vecbuf->yof, vec);
- p_dx = vec[0] * xscale[0];
- p_dy = vec[1] * yscale[0];
+
+ if (xbuf)
+ qd_getPixel(xbuf, x-xbuf->xof, y-xbuf->yof, &xs);
+ else
+ xs = xscale[0];
+
+ if (ybuf)
+ qd_getPixel(ybuf, x-ybuf->xof, y-ybuf->yof, &ys);
+ else
+ ys = yscale[0];
+
+
+ p_dx = vec[0] * xs;
+ p_dy = vec[1] * ys;
/* if no displacement, then just copy this pixel */
if (p_dx < DISPLACE_EPSILON && p_dy < DISPLACE_EPSILON) {
@@ -84,8 +97,8 @@ static void do_displace(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *vecbuf, float
/* calc derivatives */
qd_getPixel(vecbuf, x-vecbuf->xof+1, y-vecbuf->yof, vecdx);
qd_getPixel(vecbuf, x-vecbuf->xof, y-vecbuf->yof+1, vecdy);
- d_dx = vecdx[0] * xscale[0];
- d_dy = vecdy[0] * yscale[0];
+ d_dx = vecdx[0] * xs;
+ d_dy = vecdy[0] * ys;
/* clamp derivatives to minimum displacement distance in UV space */
dxt = MAX2(p_dx - d_dx, DISPLACE_EPSILON)/(float)stackbuf->x;
@@ -132,13 +145,18 @@ static void node_composit_exec_displace(void *data, bNode *node, bNodeStack **in
if(in[0]->data && in[1]->data) {
CompBuf *cbuf= in[0]->data;
CompBuf *vecbuf= in[1]->data;
+ CompBuf *xbuf= in[2]->data;
+ CompBuf *ybuf= in[3]->data;
CompBuf *stackbuf;
cbuf= typecheck_compbuf(cbuf, CB_RGBA);
vecbuf= typecheck_compbuf(vecbuf, CB_VEC3);
+ xbuf= typecheck_compbuf(xbuf, CB_VAL);
+ ybuf= typecheck_compbuf(ybuf, CB_VAL);
+
stackbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_RGBA, 1); /* allocs */
- do_displace(stackbuf, cbuf, vecbuf, in[1]->vec, in[2]->vec, in[3]->vec);
+ do_displace(stackbuf, cbuf, vecbuf, in[1]->vec, xbuf, ybuf, in[2]->vec, in[3]->vec);
out[0]->data= stackbuf;
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_rotate.c b/source/blender/nodes/intern/CMP_nodes/CMP_rotate.c
index 4103981af46..ccb1d8abfd9 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_rotate.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_rotate.c
@@ -71,7 +71,7 @@ static void node_composit_exec_rotate(void *data, bNode *node, bNodeStack **in,
ibuf=IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0, 0);
obuf=IMB_allocImBuf(stackbuf->x, stackbuf->y, 32, 0, 0);
- if(ibuf){
+ if(ibuf && obuf){
ibuf->rect_float=cbuf->rect;
obuf->rect_float=stackbuf->rect;
@@ -103,6 +103,9 @@ static void node_composit_exec_rotate(void *data, bNode *node, bNodeStack **in,
centx= (float)cbuf->xof; centy= (float)cbuf->yof;
stackbuf->xof= (int)( c*centx + s*centy);
stackbuf->yof= (int)(-s*centx + c*centy);
+
+ IMB_freeImBuf(ibuf);
+ IMB_freeImBuf(obuf);
}
/* pass on output and free */
diff --git a/source/blender/python/SConscript b/source/blender/python/SConscript
index f062f64249c..097f69155d5 100644
--- a/source/blender/python/SConscript
+++ b/source/blender/python/SConscript
@@ -21,4 +21,4 @@ env.BlenderLib( libname = 'bf_python', sources = Split(sources), includes = Spli
# generic
sources = env.Glob('generic/*.c')
-env.BlenderLib( libname = 'bf_gen_python', sources = Split(sources), includes = Split(incs), defines = defs, libtype = ['core','player'], priority = [362,165]) # ketsji is 360
+env.BlenderLib( libname = 'bf_python_ext', sources = Split(sources), includes = Split(incs), defines = defs, libtype = ['core','player'], priority = [362,165]) # ketsji is 360
diff --git a/source/blender/python/doc/epy/Geometry.py b/source/blender/python/doc/epy/Geometry.py
index f8752a135c3..d0c4dfdfd8d 100644
--- a/source/blender/python/doc/epy/Geometry.py
+++ b/source/blender/python/doc/epy/Geometry.py
@@ -186,4 +186,4 @@ def BezierInterp(vec_knot_1, vec_handle_1, vec_handle_2, vec_knot_2, resolution)
@note: any vector size is supported, the largest dimension from the input will be used for all returned vectors/
@rtype: list
@return: a list of vectors the size of resolution including the start and end points (vec_knot_1 and vec_knot_2)
- """ \ No newline at end of file
+ """
diff --git a/source/blender/python/doc/epy/IDProp.py b/source/blender/python/doc/epy/IDProp.py
index 01d5136cd70..1fc26d7f65b 100644
--- a/source/blender/python/doc/epy/IDProp.py
+++ b/source/blender/python/doc/epy/IDProp.py
@@ -129,4 +129,4 @@ class IDArray:
def __len__():
pass
- \ No newline at end of file
+
diff --git a/source/blender/python/doc/examples/mathutils.Euler.py b/source/blender/python/doc/examples/mathutils.Euler.py
index f8294ce5545..bc7702c1d53 100644
--- a/source/blender/python/doc/examples/mathutils.Euler.py
+++ b/source/blender/python/doc/examples/mathutils.Euler.py
@@ -1,3 +1,3 @@
import mathutils
-# todo \ No newline at end of file
+# todo
diff --git a/source/blender/python/doc/examples/mathutils.Matrix.py b/source/blender/python/doc/examples/mathutils.Matrix.py
index f8294ce5545..bc7702c1d53 100644
--- a/source/blender/python/doc/examples/mathutils.Matrix.py
+++ b/source/blender/python/doc/examples/mathutils.Matrix.py
@@ -1,3 +1,3 @@
import mathutils
-# todo \ No newline at end of file
+# todo
diff --git a/source/blender/python/doc/examples/mathutils.Quaternion.py b/source/blender/python/doc/examples/mathutils.Quaternion.py
index f8294ce5545..bc7702c1d53 100644
--- a/source/blender/python/doc/examples/mathutils.Quaternion.py
+++ b/source/blender/python/doc/examples/mathutils.Quaternion.py
@@ -1,3 +1,3 @@
import mathutils
-# todo \ No newline at end of file
+# todo
diff --git a/source/blender/python/doc/examples/mathutils.py b/source/blender/python/doc/examples/mathutils.py
index 0b30a0f4505..02f69515f21 100644
--- a/source/blender/python/doc/examples/mathutils.py
+++ b/source/blender/python/doc/examples/mathutils.py
@@ -15,4 +15,4 @@ quat2 = mat3.to_quat()
angle = quat1.difference(quat2)
-print(angle) \ No newline at end of file
+print(angle)
diff --git a/source/blender/python/doc/sphinx_doc_gen.py b/source/blender/python/doc/sphinx_doc_gen.py
index 06d1a9021b8..6cc5049d29b 100644
--- a/source/blender/python/doc/sphinx_doc_gen.py
+++ b/source/blender/python/doc/sphinx_doc_gen.py
@@ -307,6 +307,9 @@ def rna2sphinx(BASEPATH):
if bpy.app.build_revision != "Unknown":
version_string = version_string + " r" + bpy.app.build_revision
+ # for use with files
+ version_string_fp = "_".join(str(v) for v in bpy.app.version)
+
fw("project = 'Blender'\n")
# fw("master_doc = 'index'\n")
fw("copyright = u'Blender Foundation'\n")
@@ -336,7 +339,7 @@ def rna2sphinx(BASEPATH):
fw("\n")
fw("An introduction to Blender and Python can be found at <http://wiki.blender.org/index.php/Dev:2.5/Py/API/Intro>\n")
fw("\n")
- fw("`A PDF version of this document is also available <blender_python_reference_250.pdf>`__\n")
+ fw("`A PDF version of this document is also available <blender_python_reference_%s.pdf>`__\n" % version_string_fp)
fw("\n")
fw(".. warning:: The Python API in Blender is **UNSTABLE**, It should only be used for testing, any script written now may break in future releases.\n")
fw(" \n")
@@ -440,7 +443,7 @@ def rna2sphinx(BASEPATH):
fw("\n")
fw(" Access to blenders internal data\n")
fw("\n")
- fw(" :type: :class:`bpy.types.Main`\n")
+ fw(" :type: :class:`bpy.types.BlendData`\n")
file.close()
EXAMPLE_SET_USED.add("bpy.data")
@@ -650,6 +653,10 @@ def rna2sphinx(BASEPATH):
if lines:
fw(".. rubric:: Inherited Properties\n\n")
+
+ fw(".. hlist::\n")
+ fw(" :columns: 2\n\n")
+
for line in lines:
fw(line)
fw("\n")
@@ -671,6 +678,10 @@ def rna2sphinx(BASEPATH):
if lines:
fw(".. rubric:: Inherited Functions\n\n")
+
+ fw(".. hlist::\n")
+ fw(" :columns: 2\n\n")
+
for line in lines:
fw(line)
fw("\n")
@@ -682,6 +693,9 @@ def rna2sphinx(BASEPATH):
# use this otherwise it gets in the index for a normal heading.
fw(".. rubric:: References\n\n")
+ fw(".. hlist::\n")
+ fw(" :columns: 2\n\n")
+
for ref in struct.references:
ref_split = ref.split(".")
if len(ref_split) > 2:
diff --git a/source/blender/python/doc/sphinx_doc_gen.sh b/source/blender/python/doc/sphinx_doc_gen.sh
index 4f5f55af2bd..989424ba7eb 100755
--- a/source/blender/python/doc/sphinx_doc_gen.sh
+++ b/source/blender/python/doc/sphinx_doc_gen.sh
@@ -5,7 +5,12 @@
BLENDER="./blender.bin"
SSH_HOST="ideasman42@emo.blender.org"
-SSH_UPLOAD="/data/www/vhosts/www.blender.org/documentation/250PythonDoc"
+SSH_UPLOAD="/data/www/vhosts/www.blender.org/documentation" # blender_python_api_VERSION, added after
+
+# sed string from hell, 'Blender 2.53 (sub 1) Build' --> '2_53_1'
+# "_".join(str(v) for v in bpy.app.version)
+BLENDER_VERSION=`$BLENDER --version | cut -f2-4 -d" " | sed 's/(//g' | sed 's/)//g' | sed 's/ sub /./g' | sed 's/\./_/g'`
+SSH_UPLOAD_FULL=$SSH_UPLOAD/"blender_python_api_"$BLENDER_VERSION
# dont delete existing docs, now partial updates are used for quick builds.
$BLENDER --background --python ./source/blender/python/doc/sphinx_doc_gen.py
@@ -13,12 +18,12 @@ $BLENDER --background --python ./source/blender/python/doc/sphinx_doc_gen.py
# html
sphinx-build source/blender/python/doc/sphinx-in source/blender/python/doc/sphinx-out
cp source/blender/python/doc/sphinx-out/contents.html source/blender/python/doc/sphinx-out/index.html
-ssh ideasman42@emo.blender.org 'rm -rf '$SSH_UPLOAD'/*'
-rsync --progress -avze "ssh -p 22" /b/source/blender/python/doc/sphinx-out/* $SSH_HOST:$SSH_UPLOAD/
+ssh ideasman42@emo.blender.org 'rm -rf '$SSH_UPLOAD_FULL'/*'
+rsync --progress -avze "ssh -p 22" /b/source/blender/python/doc/sphinx-out/* $SSH_HOST:$SSH_UPLOAD_FULL/
# pdf
sphinx-build -b latex source/blender/python/doc/sphinx-in source/blender/python/doc/sphinx-out
cd source/blender/python/doc/sphinx-out
make
cd ../../../../../
-rsync --progress -avze "ssh -p 22" source/blender/python/doc/sphinx-out/contents.pdf $SSH_HOST:$SSH_UPLOAD/blender_python_reference_250.pdf
+rsync --progress -avze "ssh -p 22" source/blender/python/doc/sphinx-out/contents.pdf $SSH_HOST:$SSH_UPLOAD_FULL/blender_python_reference_$BLENDER_VERSION.pdf
diff --git a/source/blender/python/generic/CMakeLists.txt b/source/blender/python/generic/CMakeLists.txt
index b6985458d0c..1a91abfbec8 100644
--- a/source/blender/python/generic/CMakeLists.txt
+++ b/source/blender/python/generic/CMakeLists.txt
@@ -31,4 +31,4 @@ SET(INC
${PYTHON_INC}
)
-BLENDERLIB(bf_gen_python "${SRC}" "${INC}")
+BLENDERLIB(bf_python_ext "${SRC}" "${INC}")
diff --git a/source/blender/python/generic/IDProp.c b/source/blender/python/generic/IDProp.c
index ba563f9fcbf..73e60a384a3 100644
--- a/source/blender/python/generic/IDProp.c
+++ b/source/blender/python/generic/IDProp.c
@@ -27,6 +27,15 @@
#include "IDProp.h"
#include "MEM_guardedalloc.h"
+#define USE_STRING_COERCE
+
+#ifdef USE_STRING_COERCE
+#include "py_capi_utils.h"
+#endif
+
+PyObject * PyC_UnicodeFromByte(const char *str);
+const char * PuC_UnicodeAsByte(PyObject *py_str, PyObject **coerce); /* coerce must be NULL */
+
/*** Function to wrap ID properties ***/
PyObject *BPy_Wrap_IDProperty(ID *id, IDProperty *prop, IDProperty *parent);
@@ -46,7 +55,11 @@ PyObject *BPy_IDGroup_WrapData( ID *id, IDProperty *prop )
{
switch ( prop->type ) {
case IDP_STRING:
+#ifdef USE_STRING_COERCE
+ return PyC_UnicodeFromByte(prop->data.pointer);
+#else
return PyUnicode_FromString( prop->data.pointer );
+#endif
case IDP_INT:
return PyLong_FromLong( (long)prop->data.val );
case IDP_FLOAT:
@@ -105,10 +118,25 @@ int BPy_IDGroup_SetData(BPy_IDProperty *self, IDProperty *prop, PyObject *value)
PyErr_SetString(PyExc_TypeError, "expected a string!");
return -1;
}
+#ifdef USE_STRING_COERCE
+ {
+ int alloc_len;
+ PyObject *value_coerce= NULL;
+
+ st= (char *)PuC_UnicodeAsByte(value, &value_coerce);
+ alloc_len= strlen(st) + 1;
st = _PyUnicode_AsString(value);
+ IDP_ResizeArray(prop, alloc_len);
+ memcpy(prop->data.pointer, st, alloc_len);
+ Py_XDECREF(value_coerce);
+ }
+#else
+ st = _PyUnicode_AsString(value);
IDP_ResizeArray(prop, strlen(st)+1);
strcpy(prop->data.pointer, st);
+#endif
+
return 0;
}
@@ -281,8 +309,15 @@ char *BPy_IDProperty_Map_ValidateAndCreate(char *name, IDProperty *group, PyObje
val.i = (int) PyLong_AsSsize_t(ob);
prop = IDP_New(IDP_INT, val, name);
} else if (PyUnicode_Check(ob)) {
+#ifdef USE_STRING_COERCE
+ PyObject *value_coerce= NULL;
+ val.str = (char *)PuC_UnicodeAsByte(ob, &value_coerce);
+ prop = IDP_New(IDP_STRING, val, name);
+ Py_XDECREF(value_coerce);
+#else
val.str = _PyUnicode_AsString(ob);
prop = IDP_New(IDP_STRING, val, name);
+#endif
} else if (PySequence_Check(ob)) {
PyObject *item;
int i;
@@ -432,7 +467,11 @@ static PyObject *BPy_IDGroup_MapDataToPy(IDProperty *prop)
{
switch (prop->type) {
case IDP_STRING:
+#ifdef USE_STRING_COERCE
+ return PyC_UnicodeFromByte(prop->data.pointer);
+#else
return PyUnicode_FromString(prop->data.pointer);
+#endif
break;
case IDP_FLOAT:
return PyFloat_FromDouble(*((float*)&prop->data.val));
diff --git a/source/blender/python/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c
index 5240daf76cb..9e47021afb2 100644
--- a/source/blender/python/generic/bpy_internal_import.c
+++ b/source/blender/python/generic/bpy_internal_import.c
@@ -35,6 +35,7 @@
#include "BKE_global.h" /* grr, only for G.sce */
#include "BLI_listbase.h"
#include "BLI_path_util.h"
+#include "BLI_string.h"
#include <stddef.h>
static Main *bpy_import_main= NULL;
@@ -61,6 +62,12 @@ void bpy_import_main_set(struct Main *maggie)
void bpy_text_filename_get(char *fn, Text *text)
{
sprintf(fn, "%s/%s", text->id.lib ? text->id.lib->filepath : G.sce, text->id.name+2);
+
+ /* XXX, this is a bug in python's Py_CompileString()!
+ the string encoding should not be required to be utf-8
+ reported: http://bugs.python.org/msg115202
+ */
+ BLI_utf8_invalid_strip(fn, strlen(fn));
}
PyObject *bpy_text_import( Text *text )
diff --git a/source/blender/python/generic/mathutils_euler.c b/source/blender/python/generic/mathutils_euler.c
index b36eb7803f1..84845002ce8 100644
--- a/source/blender/python/generic/mathutils_euler.c
+++ b/source/blender/python/generic/mathutils_euler.c
@@ -250,7 +250,7 @@ static PyObject *Euler_Rotate(EulerObject * self, PyObject *args)
PyErr_SetString(PyExc_TypeError, "euler.rotate(): expected angle (float) and axis (x,y,z)");
return NULL;
}
- if(ELEM3(*axis, 'X', 'Y', 'Z') && axis[1]=='\0'){
+ if(!(ELEM3(*axis, 'X', 'Y', 'Z') && axis[1]=='\0')){
PyErr_SetString(PyExc_TypeError, "euler.rotate(): expected axis to be 'X', 'Y' or 'Z'");
return NULL;
}
diff --git a/source/blender/python/generic/mathutils_matrix.c b/source/blender/python/generic/mathutils_matrix.c
index 24239e1f541..3b8c7d3122a 100644
--- a/source/blender/python/generic/mathutils_matrix.c
+++ b/source/blender/python/generic/mathutils_matrix.c
@@ -1526,7 +1526,6 @@ static PyObject *Matrix_mul(PyObject * m1, PyObject * m2)
return NULL;
}
else /* if(mat1) { */ {
-
if(VectorObject_Check(m2)) { /* MATRIX*VECTOR */
return column_vector_multiplication(mat1, (VectorObject *)m2); /* vector update done inside the function */
}
diff --git a/source/blender/python/generic/mathutils_vector.c b/source/blender/python/generic/mathutils_vector.c
index 75a695526fc..424ee546245 100644
--- a/source/blender/python/generic/mathutils_vector.c
+++ b/source/blender/python/generic/mathutils_vector.c
@@ -39,7 +39,7 @@
#define SWIZZLE_VALID_AXIS 0x4
#define SWIZZLE_AXIS 0x3
-static PyObject *row_vector_multiplication(VectorObject* vec, MatrixObject * mat); /* utility func */
+static int row_vector_multiplication(float rvec[4], VectorObject* vec, MatrixObject * mat); /* utility func */
static PyObject *Vector_ToTupleExt(VectorObject *self, int ndigits);
//----------------------------------mathutils.Vector() ------------------
@@ -1003,6 +1003,10 @@ static PyObject *Vector_mul(PyObject * v1, PyObject * v2)
}
/*swap so vec1 is always the vector */
+ /* note: it would seem from this code that the matrix multiplication below
+ * is communicative. however the matrix class will always handle the
+ * (matrix * vector) case so we can ignore it here.
+ * This is NOT so for Quaternions: TODO, check if communicative (vec * quat) is correct */
if (vec2) {
vec1= vec2;
v2= v1;
@@ -1010,7 +1014,10 @@ static PyObject *Vector_mul(PyObject * v1, PyObject * v2)
if (MatrixObject_Check(v2)) {
/* VEC * MATRIX */
- return row_vector_multiplication(vec1, (MatrixObject*)v2);
+ float tvec[4];
+ if(row_vector_multiplication(tvec, vec1, (MatrixObject*)v2) == -1)
+ return NULL;
+ return newVectorObject(tvec, vec1->size, Py_NEW, NULL);
} else if (QuaternionObject_Check(v2)) {
/* VEC * QUAT */
QuaternionObject *quat2 = (QuaternionObject*)v2;
@@ -1056,43 +1063,21 @@ static PyObject *Vector_imul(PyObject * v1, PyObject * v2)
/* only support vec*=float and vec*=mat
vec*=vec result is a float so that wont work */
if (MatrixObject_Check(v2)) {
- float vecCopy[4];
- int x,y, size = vec->size;
- MatrixObject *mat= (MatrixObject*)v2;
-
- if(!BaseMath_ReadCallback(mat))
+ float tvec[4];
+ if(row_vector_multiplication(tvec, vec, (MatrixObject*)v2) == -1)
return NULL;
- if(mat->colSize != size){
- if(mat->rowSize == 4 && vec->size != 3){
- PyErr_SetString(PyExc_AttributeError, "vector * matrix: matrix column size and the vector size must be the same");
- return NULL;
- } else {
- vecCopy[3] = 1.0f;
- }
- }
-
- for(i = 0; i < size; i++){
- vecCopy[i] = vec->vec[i];
- }
-
- size = MIN2(size, mat->colSize);
-
- /*muliplication*/
- for(x = 0, i = 0; x < size; x++, i++) {
- double dot = 0.0f;
- for(y = 0; y < mat->rowSize; y++) {
- dot += mat->matrix[y][x] * vecCopy[y];
+ i= vec->size - 1;
+ do {
+ vec->vec[i] = tvec[i];
+ } while(i--);
}
- vec->vec[i] = (float)dot;
- }
- }
else if (((scalar= PyFloat_AsDouble(v2)) == -1.0 && PyErr_Occurred())==0) { /* VEC*=FLOAT */
-
- for(i = 0; i < vec->size; i++) {
+ i= vec->size - 1;
+ do {
vec->vec[i] *= scalar;
+ } while(i--);
}
- }
else {
PyErr_SetString(PyExc_TypeError, "Vector multiplication: arguments not acceptable for this operation\n");
return NULL;
@@ -1992,37 +1977,37 @@ if len(unique) != len(items):
// [2][5][8]
// [3][6][9]
//vector/matrix multiplication IS NOT COMMUTATIVE!!!!
-static PyObject *row_vector_multiplication(VectorObject* vec, MatrixObject * mat)
+static int row_vector_multiplication(float rvec[4], VectorObject* vec, MatrixObject * mat)
{
- float vecNew[4], vecCopy[4];
+ float vecCopy[4];
double dot = 0.0f;
int x, y, z = 0, vec_size = vec->size;
if(mat->colSize != vec_size){
if(mat->colSize == 4 && vec_size != 3){
PyErr_SetString(PyExc_AttributeError, "vector * matrix: matrix column size and the vector size must be the same");
- return NULL;
+ return -1;
}else{
vecCopy[3] = 1.0f;
}
}
if(!BaseMath_ReadCallback(vec) || !BaseMath_ReadCallback(mat))
- return NULL;
+ return -1;
for(x = 0; x < vec_size; x++){
vecCopy[x] = vec->vec[x];
}
- vecNew[3] = 1.0f;
+ rvec[3] = 1.0f;
//muliplication
for(x = 0; x < mat->rowSize; x++) {
for(y = 0; y < mat->colSize; y++) {
dot += mat->matrix[x][y] * vecCopy[y];
}
- vecNew[z++] = (float)dot;
+ rvec[z++] = (float)dot;
dot = 0.0f;
}
- return newVectorObject(vecNew, vec_size, Py_NEW, NULL);
+ return 0;
}
/*----------------------------Vector.negate() -------------------- */
diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c
new file mode 100644
index 00000000000..ad109528a8c
--- /dev/null
+++ b/source/blender/python/generic/py_capi_utils.c
@@ -0,0 +1,271 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+*/
+
+#include <Python.h>
+#include "py_capi_utils.h"
+
+/* for debugging */
+void PyC_ObSpit(char *name, PyObject *var) {
+ fprintf(stderr, "<%s> : ", name);
+ if (var==NULL) {
+ fprintf(stderr, "<NIL>");
+ }
+ else {
+ PyObject_Print(var, stderr, 0);
+ fprintf(stderr, " ref:%d ", (int)var->ob_refcnt);
+ fprintf(stderr, " ptr:%p", (void *)var);
+
+ fprintf(stderr, " type:");
+ if(Py_TYPE(var))
+ fprintf(stderr, "%s", Py_TYPE(var)->tp_name);
+ else
+ fprintf(stderr, "<NIL>");
+ }
+ fprintf(stderr, "\n");
+}
+
+void PyC_LineSpit(void) {
+ const char *filename;
+ int lineno;
+
+ PyErr_Clear();
+ PyC_FileAndNum(&filename, &lineno);
+
+ fprintf(stderr, "%s:%d\n", filename, lineno);
+}
+
+void PyC_FileAndNum(const char **filename, int *lineno)
+{
+ PyObject *getframe, *frame;
+ PyObject *f_lineno= NULL, *co_filename= NULL;
+
+ if (filename) *filename= NULL;
+ if (lineno) *lineno = -1;
+
+ getframe = PySys_GetObject("_getframe"); // borrowed
+ if (getframe==NULL) {
+ PyErr_Clear();
+ return;
+ }
+
+ frame = PyObject_CallObject(getframe, NULL);
+ if (frame==NULL) {
+ PyErr_Clear();
+ return;
+ }
+
+ /* when executing a script */
+ if (filename) {
+ co_filename= PyC_Object_GetAttrStringArgs(frame, 1, "f_code", "co_filename");
+ if (co_filename==NULL) {
+ PyErr_SetString(PyExc_SystemError, "Could not access sys._getframe().f_code.co_filename");
+ Py_DECREF(frame);
+ return;
+ }
+
+ *filename = _PyUnicode_AsString(co_filename);
+ Py_DECREF(co_filename);
+ }
+
+ /* when executing a module */
+ if(filename && *filename == NULL) {
+ /* try an alternative method to get the filename - module based
+ * references below are all borrowed (double checked) */
+ PyObject *mod_name= PyDict_GetItemString(PyEval_GetGlobals(), "__name__");
+ if(mod_name) {
+ PyObject *mod= PyDict_GetItem(PyImport_GetModuleDict(), mod_name);
+ if(mod) {
+ *filename= PyModule_GetFilename(mod);
+ }
+
+ /* unlikely, fallback */
+ if(*filename == NULL) {
+ *filename= _PyUnicode_AsString(mod_name);
+ }
+ }
+ }
+
+
+ if (lineno) {
+ f_lineno= PyObject_GetAttrString(frame, "f_lineno");
+ if (f_lineno==NULL) {
+ PyErr_SetString(PyExc_SystemError, "Could not access sys._getframe().f_lineno");
+ Py_DECREF(frame);
+ return;
+ }
+
+ *lineno = (int)PyLong_AsSsize_t(f_lineno);
+ Py_DECREF(f_lineno);
+ }
+
+ Py_DECREF(frame);
+}
+
+/* Would be nice if python had this built in */
+PyObject *PyC_Object_GetAttrStringArgs(PyObject *o, Py_ssize_t n, ...)
+{
+ Py_ssize_t i;
+ PyObject *item= o;
+ char *attr;
+
+ va_list vargs;
+
+ va_start(vargs, n);
+ for (i=0; i<n; i++) {
+ attr = va_arg(vargs, char *);
+ item = PyObject_GetAttrString(item, attr);
+
+ if (item)
+ Py_DECREF(item);
+ else /* python will set the error value here */
+ break;
+
+ }
+ va_end(vargs);
+
+ Py_XINCREF(item); /* final value has is increfed, to match PyObject_GetAttrString */
+ return item;
+}
+
+/* returns the exception string as a new PyUnicode object, depends on external StringIO module */
+PyObject *PyC_ExceptionBuffer(void)
+{
+ PyObject *stdout_backup = PySys_GetObject("stdout"); /* borrowed */
+ PyObject *stderr_backup = PySys_GetObject("stderr"); /* borrowed */
+ PyObject *string_io = NULL;
+ PyObject *string_io_buf = NULL;
+ PyObject *string_io_mod= NULL;
+ PyObject *string_io_getvalue= NULL;
+
+ PyObject *error_type, *error_value, *error_traceback;
+
+ if (!PyErr_Occurred())
+ return NULL;
+
+ PyErr_Fetch(&error_type, &error_value, &error_traceback);
+
+ PyErr_Clear();
+
+ /* import io
+ * string_io = io.StringIO()
+ */
+
+ if(! (string_io_mod= PyImport_ImportModule("io")) ) {
+ goto error_cleanup;
+ } else if (! (string_io = PyObject_CallMethod(string_io_mod, "StringIO", NULL))) {
+ goto error_cleanup;
+ } else if (! (string_io_getvalue= PyObject_GetAttrString(string_io, "getvalue"))) {
+ goto error_cleanup;
+ }
+
+ Py_INCREF(stdout_backup); // since these were borrowed we dont want them freed when replaced.
+ Py_INCREF(stderr_backup);
+
+ PySys_SetObject("stdout", string_io); // both of these are free'd when restoring
+ PySys_SetObject("stderr", string_io);
+
+ PyErr_Restore(error_type, error_value, error_traceback);
+ PyErr_Print(); /* print the error */
+ PyErr_Clear();
+
+ string_io_buf = PyObject_CallObject(string_io_getvalue, NULL);
+
+ PySys_SetObject("stdout", stdout_backup);
+ PySys_SetObject("stderr", stderr_backup);
+
+ Py_DECREF(stdout_backup); /* now sys owns the ref again */
+ Py_DECREF(stderr_backup);
+
+ Py_DECREF(string_io_mod);
+ Py_DECREF(string_io_getvalue);
+ Py_DECREF(string_io); /* free the original reference */
+
+ PyErr_Clear();
+ return string_io_buf;
+
+
+error_cleanup:
+ /* could not import the module so print the error and close */
+ Py_XDECREF(string_io_mod);
+ Py_XDECREF(string_io);
+
+ PyErr_Restore(error_type, error_value, error_traceback);
+ PyErr_Print(); /* print the error */
+ PyErr_Clear();
+
+ return NULL;
+}
+
+
+/* string conversion, escape non-unicode chars, coerce must be set to NULL */
+const char *PuC_UnicodeAsByte(PyObject *py_str, PyObject **coerce)
+{
+ char *result;
+
+ result= _PyUnicode_AsString(py_str);
+
+ if(result) {
+ /* 99% of the time this is enough but we better support non unicode
+ * chars since blender doesnt limit this */
+ return result;
+ }
+ else {
+ /* mostly copied from fileio.c's, fileio_init */
+ PyObject *stringobj;
+ PyObject *u;
+
+ PyErr_Clear();
+
+ u= PyUnicode_FromObject(py_str); /* coerce into unicode */
+
+ if (u == NULL)
+ return NULL;
+
+ stringobj= PyUnicode_EncodeUTF8(PyUnicode_AS_UNICODE(u), PyUnicode_GET_SIZE(u), "surrogateescape");
+ Py_DECREF(u);
+ if (stringobj == NULL)
+ return NULL;
+ if (!PyBytes_Check(stringobj)) { /* this seems wrong but it works fine */
+ // printf("encoder failed to return bytes\n");
+ Py_DECREF(stringobj);
+ return NULL;
+ }
+ *coerce= stringobj;
+
+ return PyBytes_AS_STRING(stringobj);
+ }
+}
+
+PyObject *PyC_UnicodeFromByte(const char *str)
+{
+ PyObject *result= PyUnicode_FromString(str);
+ if(result) {
+ /* 99% of the time this is enough but we better support non unicode
+ * chars since blender doesnt limit this */
+ return result;
+ }
+ else {
+ PyErr_Clear();
+ result= PyUnicode_DecodeUTF8(str, strlen(str), "surrogateescape");
+ return result;
+ }
+}
diff --git a/source/blender/python/generic/py_capi_utils.h b/source/blender/python/generic/py_capi_utils.h
new file mode 100644
index 00000000000..180159ebddb
--- /dev/null
+++ b/source/blender/python/generic/py_capi_utils.h
@@ -0,0 +1,41 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Campbell Barton
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef PY_CAPI_UTILS_H
+#define PY_CAPI_UTILS_H
+
+struct PyObject;
+
+void PyC_ObSpit(char *name, PyObject *var);
+void PyC_LineSpit(void);
+PyObject * PyC_ExceptionBuffer(void);
+PyObject * PyC_Object_GetAttrStringArgs(PyObject *o, Py_ssize_t n, ...);
+void PyC_FileAndNum(const char **filename, int *lineno);
+int PyC_AsArray(void *array, PyObject *value, int length, PyTypeObject *type, char *error_prefix);
+
+/* follow http://www.python.org/dev/peps/pep-0383/ */
+PyObject * PyC_UnicodeFromByte(const char *str);
+const char * PuC_UnicodeAsByte(PyObject *py_str, PyObject **coerce); /* coerce must be NULL */
+
+#endif // PY_CAPI_UTILS_H
diff --git a/source/blender/python/intern/bpy.h b/source/blender/python/intern/bpy.h
index 114d0f9a43d..76eef6ea4b9 100644
--- a/source/blender/python/intern/bpy.h
+++ b/source/blender/python/intern/bpy.h
@@ -22,4 +22,4 @@
* ***** END GPL LICENSE BLOCK ***** */
void BPy_init_modules( void );
- \ No newline at end of file
+
diff --git a/source/blender/python/intern/bpy_array.c b/source/blender/python/intern/bpy_array.c
index 9ceba4ae004..1afd54b3607 100644
--- a/source/blender/python/intern/bpy_array.c
+++ b/source/blender/python/intern/bpy_array.c
@@ -24,6 +24,7 @@
#include "bpy_rna.h"
#include "BKE_global.h"
+#include "MEM_guardedalloc.h"
#define MAX_ARRAY_DIMENSION 10
@@ -144,8 +145,9 @@ static int validate_array_length(PyObject *rvalue, PointerRNA *ptr, PropertyRNA
return 0;
}
#else
- PyErr_Format(PyExc_ValueError, "%s %s.%s: array length cannot be changed to %d", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), tot);
- return 0;
+ *totitem= tot;
+ return 1;
+
#endif
}
@@ -248,22 +250,25 @@ static int py_to_array(PyObject *py, PointerRNA *ptr, PropertyRNA *prop, Paramet
}
if (totitem) {
- if (!param_data || RNA_property_flag(prop) & PROP_DYNAMIC)
- data= PyMem_MALLOC(item_size * totitem);
- else
+ /* note: this code is confusing */
+ if(param_data && RNA_property_flag(prop) & PROP_DYNAMIC) {
+ /* not freeing allocated mem, RNA_parameter_list_free() will do this */
+ ParameterDynAlloc *param_alloc= (ParameterDynAlloc *)param_data;
+ param_alloc->array_tot= (int)totitem;
+ param_alloc->array= MEM_callocN(item_size * totitem, "py_to_array dyn"); /* freeing param list will free */
+
+ data= param_alloc->array;
+ }
+ else if (param_data) {
data= param_data;
+ }
+ else {
+ data= PyMem_MALLOC(item_size * totitem);
+ }
copy_values(py, ptr, prop, 0, data, item_size, NULL, convert_item, NULL);
- if (param_data) {
- if (RNA_property_flag(prop) & PROP_DYNAMIC) {
- /* not freeing allocated mem, RNA_parameter_list_free will do this */
- *(char**)param_data= data;
-
- RNA_parameter_length_set_data(parms, prop, param_data, totitem);
- }
- }
- else {
+ if (param_data==NULL) {
/* NULL can only pass through in case RNA property arraylength is 0 (impossible?) */
rna_set_array(ptr, prop, data);
PyMem_FREE(data);
@@ -452,10 +457,10 @@ static PyObject *pyrna_py_from_array_internal(PointerRNA *ptr, PropertyRNA *prop
}
#endif
-PyObject *pyrna_py_from_array_index(BPy_PropertyRNA *self, PointerRNA *ptr, PropertyRNA *prop, int index)
+PyObject *pyrna_py_from_array_index(BPy_PropertyArrayRNA *self, PointerRNA *ptr, PropertyRNA *prop, int index)
{
int totdim, arraydim, arrayoffset, dimsize[MAX_ARRAY_DIMENSION], i, len;
- BPy_PropertyRNA *ret= NULL;
+ BPy_PropertyArrayRNA *ret= NULL;
arraydim= self ? self->arraydim : 0;
arrayoffset = self ? self->arrayoffset : 0;
@@ -473,7 +478,7 @@ PyObject *pyrna_py_from_array_index(BPy_PropertyRNA *self, PointerRNA *ptr, Prop
totdim= RNA_property_array_dimension(ptr, prop, dimsize);
if (arraydim + 1 < totdim) {
- ret= (BPy_PropertyRNA*)pyrna_prop_CreatePyObject(ptr, prop);
+ ret= (BPy_PropertyArrayRNA*)pyrna_prop_CreatePyObject(ptr, prop);
ret->arraydim= arraydim + 1;
/* arr[3][4][5]
@@ -491,7 +496,7 @@ PyObject *pyrna_py_from_array_index(BPy_PropertyRNA *self, PointerRNA *ptr, Prop
}
else {
index = arrayoffset + index;
- ret= (BPy_PropertyRNA*)pyrna_array_item(ptr, prop, index);
+ ret= (BPy_PropertyArrayRNA *)pyrna_array_item(ptr, prop, index);
}
return (PyObject*)ret;
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
index af2b5b41961..77d0f4fa90a 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -41,6 +41,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_path_util.h"
#include "BLI_math_base.h"
+#include "BLI_string.h"
#include "BKE_context.h"
#include "BKE_text.h"
diff --git a/source/blender/python/intern/bpy_operator.c b/source/blender/python/intern/bpy_operator.c
index c6c34fbcaf5..242a9e1fe5c 100644
--- a/source/blender/python/intern/bpy_operator.c
+++ b/source/blender/python/intern/bpy_operator.c
@@ -40,6 +40,45 @@
#include "MEM_guardedalloc.h"
#include "BKE_report.h"
+static PyObject *pyop_poll( PyObject * self, PyObject * args)
+{
+ wmOperatorType *ot;
+ char *opname;
+ PyObject *context_dict= NULL; /* optional args */
+ PyObject *context_dict_back;
+ PyObject *ret;
+
+ // XXX Todo, work out a better solution for passing on context, could make a tuple from self and pack the name and Context into it...
+ bContext *C = BPy_GetContext();
+
+ if (!PyArg_ParseTuple(args, "s|O:_bpy.ops.poll", &opname, &context_dict))
+ return NULL;
+
+ ot= WM_operatortype_find(opname, TRUE);
+
+ if (ot == NULL) {
+ PyErr_Format(PyExc_SystemError, "Polling operator \"bpy.ops.%s\" error, could not be found", opname);
+ return NULL;
+ }
+
+ if(!PyDict_Check(context_dict))
+ context_dict= NULL;
+
+ context_dict_back= CTX_py_dict_get(C);
+
+ CTX_py_dict_set(C, (void *)context_dict);
+ Py_XINCREF(context_dict); /* so we done loose it */
+
+ /* main purpose of thsi function */
+ ret= WM_operator_poll((bContext*)C, ot) ? Py_True : Py_False;
+
+ /* restore with original context dict, probably NULL but need this for nested operator calls */
+ Py_XDECREF(context_dict);
+ CTX_py_dict_set(C, (void *)context_dict_back);
+
+ Py_INCREF(ret);
+ return ret;
+}
static PyObject *pyop_call( PyObject * self, PyObject * args)
{
@@ -252,6 +291,7 @@ static PyObject *pyop_getrna(PyObject *self, PyObject *value)
PyObject *BPY_operator_module( void )
{
+ static PyMethodDef pyop_poll_meth = {"poll", (PyCFunction) pyop_poll, METH_VARARGS, NULL};
static PyMethodDef pyop_call_meth = {"call", (PyCFunction) pyop_call, METH_VARARGS, NULL};
static PyMethodDef pyop_as_string_meth ={"as_string", (PyCFunction) pyop_as_string, METH_VARARGS, NULL};
static PyMethodDef pyop_dir_meth = {"dir", (PyCFunction) pyop_dir, METH_NOARGS, NULL};
@@ -261,6 +301,7 @@ PyObject *BPY_operator_module( void )
PyObject *submodule = PyModule_New("_bpy.ops");
PyDict_SetItemString(PyImport_GetModuleDict(), "_bpy.ops", submodule);
+ PyModule_AddObject( submodule, "poll", PyCFunction_New(&pyop_poll_meth, NULL) );
PyModule_AddObject( submodule, "call", PyCFunction_New(&pyop_call_meth, NULL) );
PyModule_AddObject( submodule, "as_string",PyCFunction_New(&pyop_as_string_meth,NULL) );
PyModule_AddObject( submodule, "dir", PyCFunction_New(&pyop_dir_meth, NULL) );
diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c
index 9afe638908c..9ae7507a72a 100644
--- a/source/blender/python/intern/bpy_props.c
+++ b/source/blender/python/intern/bpy_props.c
@@ -26,11 +26,15 @@
#include "bpy_rna.h"
#include "bpy_util.h"
+#include "BKE_utildefines.h"
+
#include "RNA_define.h" /* for defining our own rna */
#include "RNA_enum_types.h"
#include "MEM_guardedalloc.h"
+#include "../generic/py_capi_utils.h"
+
EnumPropertyItem property_flag_items[] = {
{PROP_HIDDEN, "HIDDEN", 0, "Hidden", ""},
{PROP_ANIMATABLE, "ANIMATABLE", 0, "Animateable", ""},
@@ -219,7 +223,7 @@ PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject *kw)
return NULL;
}
- if(pydef && BPyAsPrimitiveArray(def, pydef, size, &PyBool_Type, "BoolVectorProperty(default=sequence)") < 0)
+ if(pydef && PyC_AsArray(def, pydef, size, &PyBool_Type, "BoolVectorProperty(default=sequence)") < 0)
return NULL;
// prop= RNA_def_boolean_array(srna, id, size, pydef ? def:NULL, name, description);
@@ -292,7 +296,7 @@ PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw)
RNA_def_property_int_default(prop, def);
RNA_def_property_range(prop, min, max);
RNA_def_property_ui_text(prop, name, description);
- RNA_def_property_ui_range(prop, soft_min, soft_max, step, 3);
+ RNA_def_property_ui_range(prop, MAX2(soft_min, min), MIN2(soft_max, max), step, 3);
if(pyopts) {
if(opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN);
@@ -361,7 +365,7 @@ PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject *kw)
return NULL;
}
- if(pydef && BPyAsPrimitiveArray(def, pydef, size, &PyLong_Type, "IntVectorProperty(default=sequence)") < 0)
+ if(pydef && PyC_AsArray(def, pydef, size, &PyLong_Type, "IntVectorProperty(default=sequence)") < 0)
return NULL;
prop= RNA_def_property(srna, id, PROP_INT, subtype);
@@ -369,7 +373,7 @@ PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject *kw)
if(pydef) RNA_def_property_int_array_default(prop, def);
RNA_def_property_range(prop, min, max);
RNA_def_property_ui_text(prop, name, description);
- RNA_def_property_ui_range(prop, soft_min, soft_max, step, 3);
+ RNA_def_property_ui_range(prop, MAX2(soft_min, min), MIN2(soft_max, max), step, 3);
if(pyopts) {
if(opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN);
@@ -446,7 +450,7 @@ PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw)
RNA_def_property_float_default(prop, def);
RNA_def_property_range(prop, min, max);
RNA_def_property_ui_text(prop, name, description);
- RNA_def_property_ui_range(prop, soft_min, soft_max, step, precision);
+ RNA_def_property_ui_range(prop, MAX2(soft_min, min), MIN2(soft_max, max), step, precision);
if(pyopts) {
if(opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN);
@@ -515,7 +519,7 @@ PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObject *kw)
return NULL;
}
- if(pydef && BPyAsPrimitiveArray(def, pydef, size, &PyFloat_Type, "FloatVectorProperty(default=sequence)") < 0)
+ if(pydef && PyC_AsArray(def, pydef, size, &PyFloat_Type, "FloatVectorProperty(default=sequence)") < 0)
return NULL;
prop= RNA_def_property(srna, id, PROP_FLOAT, subtype);
@@ -523,7 +527,7 @@ PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObject *kw)
if(pydef) RNA_def_property_float_array_default(prop, def);
RNA_def_property_range(prop, min, max);
RNA_def_property_ui_text(prop, name, description);
- RNA_def_property_ui_range(prop, soft_min, soft_max, step, precision);
+ RNA_def_property_ui_range(prop, MAX2(soft_min, min), MIN2(soft_max, max), step, precision);
if(pyopts) {
if(opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN);
@@ -717,7 +721,7 @@ static StructRNA *pointer_type_from_py(PyObject *value, const char *error_prefix
srna= srna_from_self(value, "BoolProperty(...):");
if(!srna) {
- PyObject *msg= BPY_exception_buffer();
+ PyObject *msg= PyC_ExceptionBuffer();
char *msg_char= _PyUnicode_AsString(msg);
PyErr_Format(PyExc_TypeError, "%.200s expected an RNA type derived from IDPropertyGroup, failed with: %s", error_prefix, msg_char);
Py_DECREF(msg);
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index 07b237a40f8..bc688aa1df8 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -49,14 +49,16 @@
#include "ED_keyframing.h"
#define USE_MATHUTILS
+#define USE_STRING_COERCE
#ifdef USE_MATHUTILS
#include "../generic/mathutils.h" /* so we can have mathutils callbacks */
#include "../generic/IDProp.h" /* for IDprop lookups */
+#include "../generic/py_capi_utils.h"
-
-static PyObject *pyrna_prop_array_subscript_slice(BPy_PropertyRNA *self, PointerRNA *ptr, PropertyRNA *prop, int start, int stop, int length);
-static Py_ssize_t pyrna_prop_array_length(BPy_PropertyRNA *self);
+static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, void *data, PyObject *value, const char *error_prefix);
+static PyObject *pyrna_prop_array_subscript_slice(BPy_PropertyArrayRNA *self, PointerRNA *ptr, PropertyRNA *prop, int start, int stop, int length);
+static Py_ssize_t pyrna_prop_array_length(BPy_PropertyArrayRNA *self);
static Py_ssize_t pyrna_prop_collection_length(BPy_PropertyRNA *self);
static short pyrna_rotation_euler_order_get(PointerRNA *ptr, PropertyRNA **prop_eul_order, short order_fallback);
@@ -100,6 +102,11 @@ static int mathutils_rna_vector_set(BaseMathObject *bmo, int subtype)
if(self->prop==NULL)
return 0;
+ if (!RNA_property_editable_flag(&self->ptr, self->prop)) {
+ PyErr_Format(PyExc_AttributeError, "bpy_prop \"%.200s.%.200s\" is read-only", RNA_struct_identifier(self->ptr.type), RNA_property_identifier(self->prop));
+ return 0;
+ }
+
RNA_property_float_range(&self->ptr, self->prop, &min, &max);
if(min != FLT_MIN || max != FLT_MAX) {
@@ -143,6 +150,11 @@ static int mathutils_rna_vector_set_index(BaseMathObject *bmo, int subtype, int
if(self->prop==NULL)
return 0;
+ if (!RNA_property_editable_flag(&self->ptr, self->prop)) {
+ PyErr_Format(PyExc_AttributeError, "bpy_prop \"%.200s.%.200s\" is read-only", RNA_struct_identifier(self->ptr.type), RNA_property_identifier(self->prop));
+ return 0;
+ }
+
RNA_property_float_clamp(&self->ptr, self->prop, &bmo->data[index]);
RNA_property_float_set_index(&self->ptr, self->prop, index, bmo->data[index]);
RNA_property_update(BPy_GetContext(), &self->ptr, self->prop);
@@ -178,6 +190,12 @@ static int mathutils_rna_matrix_set(BaseMathObject *bmo, int subtype)
if(self->prop==NULL)
return 0;
+
+ if (!RNA_property_editable_flag(&self->ptr, self->prop)) {
+ PyErr_Format(PyExc_AttributeError, "bpy_prop \"%.200s.%.200s\" is read-only", RNA_struct_identifier(self->ptr.type), RNA_property_identifier(self->prop));
+ return 0;
+ }
+
/* can ignore clamping here */
RNA_property_float_set_array(&self->ptr, self->prop, bmo->data);
RNA_property_update(BPy_GetContext(), &self->ptr, self->prop);
@@ -483,7 +501,7 @@ static PyObject *pyrna_prop_str( BPy_PropertyRNA *self )
if(type==PROP_COLLECTION) {
len= pyrna_prop_collection_length(self);
} else if (RNA_property_array_check(&self->ptr, self->prop)) {
- len= pyrna_prop_array_length(self);
+ len= pyrna_prop_array_length((BPy_PropertyArrayRNA *)self);
}
if(len != -1)
@@ -768,9 +786,20 @@ PyObject * pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop)
break;
case PROP_STRING:
{
+ int subtype= RNA_property_subtype(prop);
char *buf;
buf = RNA_property_string_get_alloc(ptr, prop, NULL, -1);
+#ifdef USE_STRING_COERCE
+ /* only file paths get special treatment, they may contain non utf-8 chars */
+ if(ELEM3(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME)) {
+ ret= PyC_UnicodeFromByte(buf);
+ }
+ else {
ret = PyUnicode_FromString( buf );
+ }
+#else
+ ret= PyUnicode_FromString(buf);
+#endif
MEM_freeN(buf);
break;
}
@@ -888,7 +917,7 @@ static PyObject *pyrna_func_to_py(BPy_DummyPointerRNA *pyrna, FunctionRNA *func)
-int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, void *data, PyObject *value, const char *error_prefix)
+static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, void *data, PyObject *value, const char *error_prefix)
{
/* XXX hard limits should be checked here */
int type = RNA_property_type(prop);
@@ -971,16 +1000,31 @@ int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, v
}
case PROP_STRING:
{
- char *param = _PyUnicode_AsString(value);
+ const char *param;
+#ifdef USE_STRING_COERCE
+ PyObject *value_coerce= NULL;
+ int subtype= RNA_property_subtype(prop);
+ if(ELEM3(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME)) {
+ param= PuC_UnicodeAsByte(value, &value_coerce);
+ }
+ else {
+ param= _PyUnicode_AsString(value);
+ }
+#else
+ param= _PyUnicode_AsString(value);
+#endif
if (param==NULL) {
PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s expected a string type", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop));
return -1;
}
else {
- if(data) *((char**)data)= param;
+ if(data) *((char**)data)= param; /*XXX, this assignes a pointer, wouldnt it be better to copy??? */
else RNA_property_string_set(ptr, prop, param);
}
+#ifdef USE_STRING_COERCE
+ Py_XDECREF(value_coerce);
+#endif
break;
}
case PROP_ENUM:
@@ -1016,6 +1060,8 @@ int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, v
}
case PROP_POINTER:
{
+ PyObject *value_new= NULL;
+
StructRNA *ptype= RNA_property_pointer_type(ptr, prop);
int flag = RNA_property_flag(prop);
@@ -1025,15 +1071,29 @@ int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, v
return pyrna_pydict_to_props(&opptr, value, 0, error_prefix);
}
+ /* another exception, allow to pass a collection as an RNA property */
+ if(Py_TYPE(value)==&pyrna_prop_collection_Type) { /* ok to ignore idprop collections */
+ PointerRNA c_ptr;
+ BPy_PropertyRNA *value_prop= (BPy_PropertyRNA *)value;
+ if(RNA_property_collection_type_get(&value_prop->ptr, value_prop->prop, &c_ptr)) {
+ value= pyrna_struct_CreatePyObject(&c_ptr);
+ value_new= value;
+ }
+ else {
+ PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s collection has no type, cant be used as a %.200s type", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), RNA_struct_identifier(ptype));
+ return -1;
+ }
+ }
+
if(!BPy_StructRNA_Check(value) && value != Py_None) {
PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s expected a %.200s type", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), RNA_struct_identifier(ptype));
- return -1;
+ Py_XDECREF(value_new); return -1;
} else if((flag & PROP_NEVER_NULL) && value == Py_None) {
PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s does not support a 'None' assignment %.200s type", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), RNA_struct_identifier(ptype));
- return -1;
+ Py_XDECREF(value_new); return -1;
} else if(value != Py_None && ((flag & PROP_ID_SELF_CHECK) && ptr->id.data == ((BPy_StructRNA*)value)->ptr.id.data)) {
PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s ID type does not support assignment to its self", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop));
- return -1;
+ Py_XDECREF(value_new); return -1;
} else {
BPy_StructRNA *param= (BPy_StructRNA*)value;
int raise_error= FALSE;
@@ -1069,7 +1129,7 @@ int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, v
PointerRNA tmp;
RNA_pointer_create(NULL, ptype, NULL, &tmp);
PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s expected a %.200s type", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), RNA_struct_identifier(tmp.type));
- return -1;
+ Py_XDECREF(value_new); return -1;
}
}
@@ -1077,9 +1137,10 @@ int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, v
PointerRNA tmp;
RNA_pointer_create(NULL, ptype, NULL, &tmp);
PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s expected a %.200s type", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), RNA_struct_identifier(tmp.type));
- return -1;
+ Py_XDECREF(value_new); return -1;
}
}
+
break;
}
case PROP_COLLECTION:
@@ -1123,7 +1184,7 @@ int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, v
RNA_property_collection_add(ptr, prop, &itemptr);
if(pyrna_pydict_to_props(&itemptr, item, 1, "Converting a python list to an RNA collection")==-1) {
- PyObject *msg= BPY_exception_buffer();
+ PyObject *msg= PyC_ExceptionBuffer();
char *msg_char= _PyUnicode_AsString(msg);
PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s error converting a member of a collection from a dicts into an RNA collection, failed with: %s", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), msg_char);
@@ -1150,12 +1211,12 @@ int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, v
return 0;
}
-static PyObject * pyrna_prop_to_py_index(BPy_PropertyRNA *self, int index)
+static PyObject * pyrna_prop_array_to_py_index(BPy_PropertyArrayRNA *self, int index)
{
return pyrna_py_from_array_index(self, &self->ptr, self->prop, index);
}
-static int pyrna_py_to_prop_index(BPy_PropertyRNA *self, int index, PyObject *value)
+static int pyrna_py_to_prop_array_index(BPy_PropertyArrayRNA *self, int index, PyObject *value)
{
int ret = 0;
int totdim;
@@ -1225,7 +1286,7 @@ static int pyrna_py_to_prop_index(BPy_PropertyRNA *self, int index, PyObject *va
}
//---------------sequence-------------------------------------------
-static Py_ssize_t pyrna_prop_array_length(BPy_PropertyRNA *self)
+static Py_ssize_t pyrna_prop_array_length(BPy_PropertyArrayRNA *self)
{
if (RNA_property_array_dimension(&self->ptr, self->prop, NULL) > 1)
return RNA_property_multi_array_length(&self->ptr, self->prop, self->arraydim);
@@ -1238,6 +1299,25 @@ static Py_ssize_t pyrna_prop_collection_length( BPy_PropertyRNA *self )
return RNA_property_collection_length(&self->ptr, self->prop);
}
+/* bool funcs are for speed, so we can avoid getting the length
+ * of 1000's of items in a linked list for eg. */
+static int pyrna_prop_array_bool(BPy_PropertyRNA *self)
+{
+ return RNA_property_array_length(&self->ptr, self->prop) ? 1 : 0;
+}
+
+static int pyrna_prop_collection_bool( BPy_PropertyRNA *self )
+{
+ /* no callback defined, just iterate and find the nth item */
+ CollectionPropertyIterator iter;
+ int test;
+
+ RNA_property_collection_begin(&self->ptr, self->prop, &iter);
+ test = iter.valid;
+ RNA_property_collection_end(&iter);
+ return test;
+}
+
/* internal use only */
static PyObject *pyrna_prop_collection_subscript_int(BPy_PropertyRNA *self, Py_ssize_t keynum)
{
@@ -1258,20 +1338,20 @@ static PyObject *pyrna_prop_collection_subscript_int(BPy_PropertyRNA *self, Py_s
return NULL;
}
-static PyObject *pyrna_prop_array_subscript_int(BPy_PropertyRNA *self, int keynum)
+static PyObject *pyrna_prop_array_subscript_int(BPy_PropertyArrayRNA *self, int keynum)
{
int len= pyrna_prop_array_length(self);
if(keynum < 0) keynum += len;
if(keynum >= 0 && keynum < len)
- return pyrna_prop_to_py_index(self, keynum);
+ return pyrna_prop_array_to_py_index(self, keynum);
PyErr_Format(PyExc_IndexError, "bpy_prop_array[index]: index %d out of range", keynum);
return NULL;
}
-static PyObject *pyrna_prop_collection_subscript_str(BPy_PropertyRNA *self, char *keyname)
+static PyObject *pyrna_prop_collection_subscript_str(BPy_PropertyRNA *self, const char *keyname)
{
PointerRNA newptr;
if(RNA_property_collection_lookup_string(&self->ptr, self->prop, keyname, &newptr))
@@ -1306,10 +1386,10 @@ static PyObject *pyrna_prop_collection_subscript_slice(PointerRNA *ptr, Property
}
/* TODO - dimensions
- * note: could also use pyrna_prop_to_py_index(self, count) in a loop but its a lot slower
+ * note: could also use pyrna_prop_array_to_py_index(self, count) in a loop but its a lot slower
* since at the moment it reads (and even allocates) the entire array for each index.
*/
-static PyObject *pyrna_prop_array_subscript_slice(BPy_PropertyRNA *self, PointerRNA *ptr, PropertyRNA *prop, int start, int stop, int length)
+static PyObject *pyrna_prop_array_subscript_slice(BPy_PropertyArrayRNA *self, PointerRNA *ptr, PropertyRNA *prop, int start, int stop, int length)
{
int count, totdim;
@@ -1319,7 +1399,7 @@ static PyObject *pyrna_prop_array_subscript_slice(BPy_PropertyRNA *self, Pointer
if (totdim > 1) {
for (count = start; count < stop; count++)
- PyList_SET_ITEM(list, count - start, pyrna_prop_to_py_index(self, count));
+ PyList_SET_ITEM(list, count - start, pyrna_prop_array_to_py_index(self, count));
}
else {
switch (RNA_property_type(prop)) {
@@ -1417,7 +1497,7 @@ static PyObject *pyrna_prop_collection_subscript(BPy_PropertyRNA *self, PyObject
}
}
-static PyObject *pyrna_prop_array_subscript(BPy_PropertyRNA *self, PyObject *key)
+static PyObject *pyrna_prop_array_subscript(BPy_PropertyArrayRNA *self, PyObject *key)
{
/*if (PyUnicode_Check(key)) {
return pyrna_prop_array_subscript_str(self, _PyUnicode_AsString(key));
@@ -1452,7 +1532,7 @@ static PyObject *pyrna_prop_array_subscript(BPy_PropertyRNA *self, PyObject *key
}
}
-/* could call (pyrna_py_to_prop_index(self, i, value) in a loop but it is slow */
+/* could call (pyrna_py_to_prop_array_index(self, i, value) in a loop but it is slow */
static int prop_subscript_ass_array_slice(PointerRNA *ptr, PropertyRNA *prop, int start, int stop, int length, PyObject *value_orig)
{
PyObject *value;
@@ -1555,20 +1635,20 @@ static int prop_subscript_ass_array_slice(PointerRNA *ptr, PropertyRNA *prop, in
}
-static int prop_subscript_ass_array_int(BPy_PropertyRNA *self, Py_ssize_t keynum, PyObject *value)
+static int prop_subscript_ass_array_int(BPy_PropertyArrayRNA *self, Py_ssize_t keynum, PyObject *value)
{
int len= pyrna_prop_array_length(self);
if(keynum < 0) keynum += len;
if(keynum >= 0 && keynum < len)
- return pyrna_py_to_prop_index(self, keynum, value);
+ return pyrna_py_to_prop_array_index(self, keynum, value);
PyErr_SetString(PyExc_IndexError, "bpy_prop_array[index] = value: index out of range");
return -1;
}
-static int pyrna_prop_array_ass_subscript( BPy_PropertyRNA *self, PyObject *key, PyObject *value )
+static int pyrna_prop_array_ass_subscript( BPy_PropertyArrayRNA *self, PyObject *key, PyObject *value )
{
/* char *keyname = NULL; */ /* not supported yet */
int ret= -1;
@@ -1630,6 +1710,31 @@ static PyMappingMethods pyrna_prop_collection_as_mapping = {
( objobjargproc ) NULL, /* mp_ass_subscript */
};
+/* only for fast bool's, large structs, assign nb_bool on init */
+static PyNumberMethods pyrna_prop_array_as_number = {
+ NULL, /* nb_add */
+ NULL, /* nb_subtract */
+ NULL, /* nb_multiply */
+ NULL, /* nb_remainder */
+ NULL, /* nb_divmod */
+ NULL, /* nb_power */
+ NULL, /* nb_negative */
+ NULL, /* nb_positive */
+ NULL, /* nb_absolute */
+ (inquiry) pyrna_prop_array_bool, /* nb_bool */
+};
+static PyNumberMethods pyrna_prop_collection_as_number = {
+ NULL, /* nb_add */
+ NULL, /* nb_subtract */
+ NULL, /* nb_multiply */
+ NULL, /* nb_remainder */
+ NULL, /* nb_divmod */
+ NULL, /* nb_power */
+ NULL, /* nb_negative */
+ NULL, /* nb_positive */
+ NULL, /* nb_absolute */
+ (inquiry) pyrna_prop_collection_bool, /* nb_bool */
+};
static int pyrna_prop_array_contains(BPy_PropertyRNA *self, PyObject *value)
{
@@ -2142,25 +2247,42 @@ static PyObject *pyrna_struct_is_property_hidden(BPy_StructRNA *self, PyObject *
}
static char pyrna_struct_path_resolve_doc[] =
-".. method:: path_resolve(path)\n"
+".. method:: path_resolve(path, coerce=True)\n"
+"\n"
+" Returns the property from the path, raise an exception when not found.\n"
"\n"
-" Returns the property from the path given or None if the property is not found.";
+" :arg path: path which this property resolves.\n"
+" :type path: string\n"
+" :arg coerce: optional argument, when True, the property will be converted into its python representation.\n"
+" :type coerce: boolean\n";
-static PyObject *pyrna_struct_path_resolve(BPy_StructRNA *self, PyObject *value)
+static PyObject *pyrna_struct_path_resolve(BPy_StructRNA *self, PyObject *args)
{
- char *path= _PyUnicode_AsString(value);
+ char *path;
+ PyObject *coerce= Py_True;
PointerRNA r_ptr;
PropertyRNA *r_prop;
- if(path==NULL) {
- PyErr_SetString(PyExc_TypeError, "bpy_struct.path_resolve(): accepts only a single string argument");
+ if (!PyArg_ParseTuple(args, "s|O!:path_resolve", &path, &PyBool_Type, &coerce))
return NULL;
- }
- if (RNA_path_resolve(&self->ptr, path, &r_ptr, &r_prop))
+ if (RNA_path_resolve(&self->ptr, path, &r_ptr, &r_prop)) {
+ if(r_prop) {
+ if(coerce == Py_False) {
return pyrna_prop_CreatePyObject(&r_ptr, r_prop);
-
- Py_RETURN_NONE;
+}
+ else {
+ return pyrna_prop_to_py(&r_ptr, r_prop);
+ }
+ }
+ else {
+ return pyrna_struct_CreatePyObject(&r_ptr);
+ }
+ }
+ else {
+ PyErr_Format(PyExc_TypeError, "%.200s.path_resolve(\"%.200s\") could not be resolved", RNA_struct_identifier(self->ptr.type), path);
+ return NULL;
+ }
}
static char pyrna_struct_path_from_id_doc[] =
@@ -2235,15 +2357,15 @@ static PyObject *pyrna_prop_path_from_id(BPy_PropertyRNA *self)
return ret;
}
-static char pyrna_struct_recast_type_doc[] =
-".. method:: recast_type()\n"
+static char pyrna_struct_type_recast_doc[] =
+".. method:: type_recast()\n"
"\n"
" Return a new instance, this is needed because types such as textures can be changed at runtime.\n"
"\n"
" :return: a new instance of this object with the type initialized again.\n"
" :rtype: subclass of :class:`bpy_struct`";
-static PyObject *pyrna_struct_recast_type(BPy_StructRNA *self, PyObject *args)
+static PyObject *pyrna_struct_type_recast(BPy_StructRNA *self, PyObject *args)
{
PointerRNA r_ptr;
RNA_pointer_recast(&self->ptr, &r_ptr);
@@ -2497,11 +2619,17 @@ static int pyrna_struct_setattro( BPy_StructRNA *self, PyObject *pyname, PyObjec
}
/* pyrna_py_to_prop sets its own exceptions */
- if(prop)
+ if(prop) {
+ if(value == NULL) {
+ PyErr_SetString(PyExc_AttributeError, "bpy_struct: del not supported");
+ return -1;
+ }
return pyrna_py_to_prop(&self->ptr, prop, NULL, NULL, value, "bpy_struct: item.attr = val:");
- else
+ }
+ else {
return PyObject_GenericSetAttr((PyObject *)self, pyname, value);
}
+}
static PyObject *pyrna_prop_dir(BPy_PropertyRNA *self)
{
@@ -2565,6 +2693,11 @@ static int pyrna_prop_collection_setattro( BPy_PropertyRNA *self, PyObject *pyna
PropertyRNA *prop;
PointerRNA r_ptr;
+ if(value == NULL) {
+ PyErr_SetString(PyExc_AttributeError, "bpy_prop: del not supported");
+ return -1;
+ }
+
if(RNA_property_collection_type_get(&self->ptr, self->prop, &r_ptr)) {
if ((prop = RNA_struct_find_property(&r_ptr, name))) {
/* pyrna_py_to_prop sets its own exceptions */
@@ -2577,7 +2710,7 @@ static int pyrna_prop_collection_setattro( BPy_PropertyRNA *self, PyObject *pyna
}
/* odd case, we need to be able return a python method from a tp_getset */
-static PyObject *pyrna_prop_add(BPy_PropertyRNA *self)
+static PyObject *pyrna_prop_collection_idprop_add(BPy_PropertyRNA *self)
{
PointerRNA r_ptr;
@@ -2591,7 +2724,7 @@ static PyObject *pyrna_prop_add(BPy_PropertyRNA *self)
}
}
-static PyObject *pyrna_prop_remove(BPy_PropertyRNA *self, PyObject *value)
+static PyObject *pyrna_prop_collection_idprop_remove(BPy_PropertyRNA *self, PyObject *value)
{
PyObject *ret;
int key= PyLong_AsSsize_t(value);
@@ -2612,7 +2745,7 @@ static PyObject *pyrna_prop_remove(BPy_PropertyRNA *self, PyObject *value)
return ret;
}
-static PyObject *pyrna_prop_move(BPy_PropertyRNA *self, PyObject *args)
+static PyObject *pyrna_prop_collection_idprop_move(BPy_PropertyRNA *self, PyObject *args)
{
PyObject *ret;
int key=0, pos=0;
@@ -2633,8 +2766,9 @@ static PyObject *pyrna_prop_move(BPy_PropertyRNA *self, PyObject *args)
return ret;
}
-static PyObject *pyrna_struct_get_id_data(BPy_StructRNA *self)
+static PyObject *pyrna_struct_get_id_data(BPy_DummyPointerRNA *self)
{
+ /* used for struct and pointer since both have a ptr */
if(self->ptr.id.data) {
PointerRNA id_ptr;
RNA_id_pointer_create((ID *)self->ptr.id.data, &id_ptr);
@@ -2647,12 +2781,12 @@ static PyObject *pyrna_struct_get_id_data(BPy_StructRNA *self)
/*****************************************************************************/
/* Python attributes get/set structure: */
/*****************************************************************************/
-#if 0
+
static PyGetSetDef pyrna_prop_getseters[] = {
- {"active", (getter)pyrna_prop_get_active, (setter)pyrna_prop_set_active, "", NULL},
+ {"id_data", (getter)pyrna_struct_get_id_data, (setter)NULL, "The :class:`ID` object this datablock is from or None, (not available for all data types)", NULL},
{NULL,NULL,NULL,NULL,NULL} /* Sentinel */
};
-#endif
+
static PyGetSetDef pyrna_struct_getseters[] = {
{"id_data", (getter)pyrna_struct_get_id_data, (setter)NULL, "The :class:`ID` object this datablock is from or None, (not available for all data types)", NULL},
@@ -2775,19 +2909,16 @@ static PyObject *pyrna_struct_get(BPy_StructRNA *self, PyObject *args)
static char pyrna_struct_as_pointer_doc[] =
".. method:: as_pointer()\n"
"\n"
-" Returns capsule which holds a pointer to blenders internal data\n"
+" Returns the memory address which holds a pointer to blenders internal data\n"
"\n"
" :return: capsule with a name set from the struct type.\n"
-" :rtype: PyCapsule\n"
+" :rtype: int\n"
"\n"
" .. note:: This is intended only for advanced script writers who need to pass blender data to their own C/Python modules.\n";
static PyObject *pyrna_struct_as_pointer(BPy_StructRNA *self)
{
- if(self->ptr.data)
- return PyCapsule_New(self->ptr.data, RNA_struct_identifier(self->ptr.type), NULL);
-
- Py_RETURN_NONE;
+ return PyLong_FromVoidPtr(self->ptr.data);
}
static PyObject *pyrna_prop_get(BPy_PropertyRNA *self, PyObject *args)
@@ -3060,7 +3191,7 @@ static PyObject *pyrna_prop_foreach_set(BPy_PropertyRNA *self, PyObject *args)
/* A bit of a kludge, make a list out of a collection or array,
* then return the lists iter function, not especially fast but convenient for now */
-PyObject *pyrna_prop_array_iter(BPy_PropertyRNA *self)
+PyObject *pyrna_prop_array_iter(BPy_PropertyArrayRNA *self)
{
/* Try get values from a collection */
PyObject *ret;
@@ -3112,15 +3243,29 @@ static struct PyMethodDef pyrna_struct_methods[] = {
{"driver_remove", (PyCFunction)pyrna_struct_driver_remove, METH_VARARGS, pyrna_struct_driver_remove_doc},
{"is_property_set", (PyCFunction)pyrna_struct_is_property_set, METH_VARARGS, pyrna_struct_is_property_set_doc},
{"is_property_hidden", (PyCFunction)pyrna_struct_is_property_hidden, METH_VARARGS, pyrna_struct_is_property_hidden_doc},
- {"path_resolve", (PyCFunction)pyrna_struct_path_resolve, METH_O, pyrna_struct_path_resolve_doc},
+ {"path_resolve", (PyCFunction)pyrna_struct_path_resolve, METH_VARARGS, pyrna_struct_path_resolve_doc},
{"path_from_id", (PyCFunction)pyrna_struct_path_from_id, METH_VARARGS, pyrna_struct_path_from_id_doc},
- {"recast_type", (PyCFunction)pyrna_struct_recast_type, METH_NOARGS, pyrna_struct_recast_type_doc},
+ {"type_recast", (PyCFunction)pyrna_struct_type_recast, METH_NOARGS, pyrna_struct_type_recast_doc},
{"__dir__", (PyCFunction)pyrna_struct_dir, METH_NOARGS, NULL},
/* experemental */
{"callback_add", (PyCFunction)pyrna_callback_add, METH_VARARGS, NULL},
{"callback_remove", (PyCFunction)pyrna_callback_remove, METH_VARARGS, NULL},
+ /* class methods, only valid for subclasses */
+ {"BoolProperty", (PyCFunction)BPy_BoolProperty, METH_VARARGS|METH_KEYWORDS|METH_CLASS, BPy_BoolProperty_doc},
+ {"BoolVectorProperty", (PyCFunction)BPy_BoolVectorProperty, METH_VARARGS|METH_KEYWORDS|METH_CLASS, BPy_BoolVectorProperty_doc},
+ {"IntProperty", (PyCFunction)BPy_IntProperty, METH_VARARGS|METH_KEYWORDS|METH_CLASS, BPy_IntProperty_doc},
+ {"IntVectorProperty", (PyCFunction)BPy_IntVectorProperty, METH_VARARGS|METH_KEYWORDS|METH_CLASS, BPy_IntVectorProperty_doc},
+ {"FloatProperty", (PyCFunction)BPy_FloatProperty, METH_VARARGS|METH_KEYWORDS|METH_CLASS, BPy_FloatProperty_doc},
+ {"FloatVectorProperty", (PyCFunction)BPy_FloatVectorProperty, METH_VARARGS|METH_KEYWORDS|METH_CLASS, BPy_FloatVectorProperty_doc},
+ {"StringProperty", (PyCFunction)BPy_StringProperty, METH_VARARGS|METH_KEYWORDS|METH_CLASS, BPy_StringProperty_doc},
+ {"EnumProperty", (PyCFunction)BPy_EnumProperty, METH_VARARGS|METH_KEYWORDS|METH_CLASS, BPy_EnumProperty_doc},
+ {"PointerProperty", (PyCFunction)BPy_PointerProperty, METH_VARARGS|METH_KEYWORDS|METH_CLASS, BPy_PointerProperty_doc},
+ {"CollectionProperty", (PyCFunction)BPy_CollectionProperty, METH_VARARGS|METH_KEYWORDS|METH_CLASS, BPy_CollectionProperty_doc},
+
+ {"RemoveProperty", (PyCFunction)BPy_RemoveProperty, METH_VARARGS|METH_KEYWORDS|METH_CLASS, BPy_RemoveProperty_doc},
+
{NULL, NULL, 0, NULL}
};
@@ -3143,11 +3288,13 @@ static struct PyMethodDef pyrna_prop_collection_methods[] = {
{"values", (PyCFunction)pyrna_prop_values, METH_NOARGS, NULL},
{"get", (PyCFunction)pyrna_prop_get, METH_VARARGS, NULL},
+ {NULL, NULL, 0, NULL}
+};
- /* moved into a getset */
- {"add", (PyCFunction)pyrna_prop_add, METH_NOARGS, NULL},
- {"remove", (PyCFunction)pyrna_prop_remove, METH_O, NULL},
- {"move", (PyCFunction)pyrna_prop_move, METH_VARARGS, NULL},
+static struct PyMethodDef pyrna_prop_collection_idprop_methods[] = {
+ {"add", (PyCFunction)pyrna_prop_collection_idprop_add, METH_NOARGS, NULL},
+ {"remove", (PyCFunction)pyrna_prop_collection_idprop_remove, METH_O, NULL},
+ {"move", (PyCFunction)pyrna_prop_collection_idprop_move, METH_VARARGS, NULL},
{NULL, NULL, 0, NULL}
};
@@ -3209,9 +3356,9 @@ PyObject *pyrna_param_to_py(PointerRNA *ptr, ParameterList *parms, PropertyRNA *
int len;
if (flag & PROP_DYNAMIC) {
- len= RNA_parameter_length_get_data(parms, prop, data);
-
- data= *((void **)data);
+ ParameterDynAlloc *data_alloc= data;
+ len= data_alloc->array_tot;
+ data= data_alloc->array;
}
else
len= RNA_property_array_length(ptr, prop);
@@ -3273,10 +3420,30 @@ PyObject *pyrna_param_to_py(PointerRNA *ptr, ParameterList *parms, PropertyRNA *
break;
case PROP_STRING:
{
+ char *data_ch;
+ PyObject *value_coerce= NULL;
+ int subtype= RNA_property_subtype(prop);
+
if(flag & PROP_THICK_WRAP)
- ret = PyUnicode_FromString( (char*)data );
+ data_ch= (char *)data;
else
- ret = PyUnicode_FromString( *(char**)data );
+ data_ch= *(char **)data;
+
+#ifdef USE_STRING_COERCE
+ if(ELEM3(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME)) {
+ ret= PyC_UnicodeFromByte(data_ch);
+ }
+ else {
+ ret= PyUnicode_FromString(data_ch);
+ }
+#else
+ ret = PyUnicode_FromString(data_ch);
+#endif
+
+#ifdef USE_STRING_COERCE
+ Py_XDECREF(value_coerce);
+#endif
+
break;
}
case PROP_ENUM:
@@ -3713,7 +3880,7 @@ PyTypeObject pyrna_prop_Type = {
/*** Attribute descriptor and subclassing stuff ***/
pyrna_prop_methods, /* struct PyMethodDef *tp_methods; */
NULL, /* struct PyMemberDef *tp_members; */
- NULL /*pyrna_prop_getseters*/, /* struct PyGetSetDef *tp_getset; */
+ pyrna_prop_getseters, /* struct PyGetSetDef *tp_getset; */
NULL, /* struct _typeobject *tp_base; */
NULL, /* PyObject *tp_dict; */
NULL, /* descrgetfunc tp_descr_get; */
@@ -3738,7 +3905,7 @@ PyTypeObject pyrna_prop_Type = {
PyTypeObject pyrna_prop_array_Type = {
PyVarObject_HEAD_INIT(NULL, 0)
"bpy_prop_array", /* tp_name */
- sizeof( BPy_PropertyRNA ), /* tp_basicsize */
+ sizeof( BPy_PropertyArrayRNA ), /* tp_basicsize */
0, /* tp_itemsize */
/* methods */
NULL, /* tp_dealloc */
@@ -3750,7 +3917,7 @@ PyTypeObject pyrna_prop_array_Type = {
/* Method suites for standard classes */
- NULL, /* PyNumberMethods *tp_as_number; */
+ &pyrna_prop_array_as_number, /* PyNumberMethods *tp_as_number; */
&pyrna_prop_array_as_sequence, /* PySequenceMethods *tp_as_sequence; */
&pyrna_prop_array_as_mapping, /* PyMappingMethods *tp_as_mapping; */
@@ -3830,7 +3997,7 @@ PyTypeObject pyrna_prop_collection_Type = {
/* Method suites for standard classes */
- NULL, /* PyNumberMethods *tp_as_number; */
+ &pyrna_prop_collection_as_number, /* PyNumberMethods *tp_as_number; */
&pyrna_prop_collection_as_sequence, /* PySequenceMethods *tp_as_sequence; */
&pyrna_prop_collection_as_mapping, /* PyMappingMethods *tp_as_mapping; */
@@ -3895,33 +4062,97 @@ PyTypeObject pyrna_prop_collection_Type = {
NULL
};
-static struct PyMethodDef pyrna_struct_subtype_methods[] = {
- {"BoolProperty", (PyCFunction)BPy_BoolProperty, METH_VARARGS|METH_KEYWORDS, BPy_BoolProperty_doc},
- {"BoolVectorProperty", (PyCFunction)BPy_BoolVectorProperty, METH_VARARGS|METH_KEYWORDS, BPy_BoolVectorProperty_doc},
- {"IntProperty", (PyCFunction)BPy_IntProperty, METH_VARARGS|METH_KEYWORDS, BPy_IntProperty_doc},
- {"IntVectorProperty", (PyCFunction)BPy_IntVectorProperty, METH_VARARGS|METH_KEYWORDS, BPy_IntVectorProperty_doc},
- {"FloatProperty", (PyCFunction)BPy_FloatProperty, METH_VARARGS|METH_KEYWORDS, BPy_FloatProperty_doc},
- {"FloatVectorProperty", (PyCFunction)BPy_FloatVectorProperty, METH_VARARGS|METH_KEYWORDS, BPy_FloatVectorProperty_doc},
- {"StringProperty", (PyCFunction)BPy_StringProperty, METH_VARARGS|METH_KEYWORDS, BPy_StringProperty_doc},
- {"EnumProperty", (PyCFunction)BPy_EnumProperty, METH_VARARGS|METH_KEYWORDS, BPy_EnumProperty_doc},
- {"PointerProperty", (PyCFunction)BPy_PointerProperty, METH_VARARGS|METH_KEYWORDS, BPy_PointerProperty_doc},
- {"CollectionProperty", (PyCFunction)BPy_CollectionProperty, METH_VARARGS|METH_KEYWORDS, BPy_CollectionProperty_doc},
+/* only for add/remove/move methods */
+PyTypeObject pyrna_prop_collection_idprop_Type = {
+ PyVarObject_HEAD_INIT(NULL, 0)
+ "bpy_prop_collection_idprop", /* tp_name */
+ sizeof( BPy_PropertyRNA ), /* tp_basicsize */
+ 0, /* tp_itemsize */
+ /* methods */
+ NULL, /* tp_dealloc */
+ NULL, /* printfunc tp_print; */
+ NULL, /* getattrfunc tp_getattr; */
+ NULL, /* setattrfunc tp_setattr; */
+ NULL, /* tp_compare */ /* DEPRECATED in python 3.0! */
+ NULL, /* subclassed */ /* tp_repr */
- {"RemoveProperty", (PyCFunction)BPy_RemoveProperty, METH_VARARGS|METH_KEYWORDS, BPy_RemoveProperty_doc},
+ /* Method suites for standard classes */
-// {"__get_rna", (PyCFunction)BPy_GetStructRNA, METH_NOARGS, ""},
- {NULL, NULL, 0, NULL}
+ NULL, /* PyNumberMethods *tp_as_number; */
+ NULL, /* PySequenceMethods *tp_as_sequence; */
+ NULL, /* PyMappingMethods *tp_as_mapping; */
+
+ /* More standard operations (here for binary compatibility) */
+
+ NULL, /* hashfunc tp_hash; */
+ NULL, /* ternaryfunc tp_call; */
+ NULL, /* reprfunc tp_str; */
+
+ /* will only use these if this is a subtype of a py class */
+ NULL, /* getattrofunc tp_getattro; */
+ NULL, /* setattrofunc tp_setattro; */
+
+ /* Functions to access object as input/output buffer */
+ NULL, /* PyBufferProcs *tp_as_buffer; */
+
+ /*** Flags to define presence of optional/expanded features ***/
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* long tp_flags; */
+
+ NULL, /* char *tp_doc; Documentation string */
+ /*** Assigned meaning in release 2.0 ***/
+ /* call function for all accessible objects */
+ NULL, /* traverseproc tp_traverse; */
+
+ /* delete references to contained objects */
+ NULL, /* inquiry tp_clear; */
+
+ /*** Assigned meaning in release 2.1 ***/
+ /*** rich comparisons ***/
+ NULL, /* subclassed */ /* richcmpfunc tp_richcompare; */
+
+ /*** weak reference enabler ***/
+ 0, /* long tp_weaklistoffset; */
+
+ /*** Added in release 2.2 ***/
+ /* Iterators */
+ NULL, /* getiterfunc tp_iter; */
+ NULL, /* iternextfunc tp_iternext; */
+
+ /*** Attribute descriptor and subclassing stuff ***/
+ pyrna_prop_collection_idprop_methods, /* struct PyMethodDef *tp_methods; */
+ NULL, /* struct PyMemberDef *tp_members; */
+ NULL /*pyrna_prop_getseters*/, /* struct PyGetSetDef *tp_getset; */
+ &pyrna_prop_collection_Type, /* struct _typeobject *tp_base; */
+ NULL, /* PyObject *tp_dict; */
+ NULL, /* descrgetfunc tp_descr_get; */
+ NULL, /* descrsetfunc tp_descr_set; */
+ 0, /* long tp_dictoffset; */
+ NULL, /* initproc tp_init; */
+ NULL, /* allocfunc tp_alloc; */
+ NULL, /* newfunc tp_new; */
+ /* Low-level free-memory routine */
+ NULL, /* freefunc tp_free; */
+ /* For PyObject_IS_GC */
+ NULL, /* inquiry tp_is_gc; */
+ NULL, /* PyObject *tp_bases; */
+ /* method resolution order */
+ NULL, /* PyObject *tp_mro; */
+ NULL, /* PyObject *tp_cache; */
+ NULL, /* PyObject *tp_subclasses; */
+ NULL, /* PyObject *tp_weaklist; */
+ NULL
};
static void pyrna_subtype_set_rna(PyObject *newclass, StructRNA *srna)
{
PointerRNA ptr;
PyObject *item;
+ PyObject *newclass_dict= ((PyTypeObject *)newclass)->tp_dict;
Py_INCREF(newclass);
if (RNA_struct_py_type_get(srna))
- PyObSpit("RNA WAS SET - ", RNA_struct_py_type_get(srna));
+ PyC_ObSpit("RNA WAS SET - ", RNA_struct_py_type_get(srna));
Py_XDECREF(((PyObject *)RNA_struct_py_type_get(srna)));
@@ -3935,21 +4166,10 @@ static void pyrna_subtype_set_rna(PyObject *newclass, StructRNA *srna)
item = pyrna_struct_CreatePyObject(&ptr);
//item = PyCapsule_New(srna, NULL, NULL);
- PyDict_SetItemString(((PyTypeObject *)newclass)->tp_dict, "bl_rna", item);
+ PyDict_SetItemString(newclass_dict, "bl_rna", item);
Py_DECREF(item);
/* done with rna instance */
-
- /* attach functions into the class
- * so you can do... bpy.types.Scene.SomeFunction()
- */
- {
- PyMethodDef *ml;
-
- for(ml= pyrna_struct_subtype_methods; ml->ml_name; ml++){
- PyObject_SetAttrString(newclass, ml->ml_name, PyCFunction_New(ml, newclass));
}
- }
-}
static PyObject* pyrna_srna_Subtype(StructRNA *srna);
@@ -4018,7 +4238,7 @@ static PyObject* pyrna_srna_ExternalType(StructRNA *srna)
if(base_compare != base) {
fprintf(stderr, "pyrna_srna_ExternalType: incorrect subclassing of SRNA '%s'\nSee bpy_types.py\n", idname);
- PyObSpit("Expected! ", base_compare);
+ PyC_ObSpit("Expected! ", base_compare);
newclass= NULL;
}
else {
@@ -4035,14 +4255,19 @@ static PyObject* pyrna_srna_Subtype(StructRNA *srna)
{
PyObject *newclass = NULL;
+ /* stupid/simple case */
if (srna == NULL) {
newclass= NULL; /* Nothing to do */
- } else if ((newclass= RNA_struct_py_type_get(srna))) {
+ } /* the class may have alredy been declared & allocated */
+ else if ((newclass= RNA_struct_py_type_get(srna))) {
Py_INCREF(newclass);
- } else if ((newclass= pyrna_srna_ExternalType(srna))) {
+ } /* check if bpy_types.py module has the class defined in it */
+ else if ((newclass= pyrna_srna_ExternalType(srna))) {
pyrna_subtype_set_rna(newclass, srna);
Py_INCREF(newclass);
- } else {
+ } /* create a new class instance with the C api
+ * maintly for the purposing of matching the C/rna type hierarchy */
+ else {
/* subclass equivelents
- class myClass(myBase):
some='value' # or ...
@@ -4053,21 +4278,24 @@ static PyObject* pyrna_srna_Subtype(StructRNA *srna)
PyObject *py_base= pyrna_srna_PyBase(srna);
const char *idname= RNA_struct_identifier(srna);
- const char *descr= RNA_struct_ui_description(srna);
- if(!descr) descr= "(no docs)";
+ /* remove __doc__ for now */
+ // const char *descr= RNA_struct_ui_description(srna);
+ // if(!descr) descr= "(no docs)";
+ // "__doc__",descr
/* always use O not N when calling, N causes refcount errors */
- newclass = PyObject_CallFunction( (PyObject*)&PyType_Type, "s(O){sssss()}", idname, py_base, "__module__","bpy.types", "__doc__",descr, "__slots__");
+ newclass = PyObject_CallFunction((PyObject*)&PyType_Type, "s(O){sss()}", idname, py_base, "__module__","bpy.types", "__slots__");
/* newclass will now have 2 ref's, ???, probably 1 is internal since decrefing here segfaults */
- /* PyObSpit("new class ref", newclass); */
+ /* PyC_ObSpit("new class ref", newclass); */
if (newclass) {
/* srna owns one, and the other is owned by the caller */
pyrna_subtype_set_rna(newclass, srna);
- Py_DECREF(newclass); /* let srna own */
+ // XXX, adding this back segfaults blender on load.
+ // Py_DECREF(newclass); /* let srna own */
}
else {
/* this should not happen */
@@ -4126,7 +4354,7 @@ PyObject *pyrna_struct_CreatePyObject( PointerRNA *ptr )
pyrna->ptr= *ptr;
pyrna->freeptr= FALSE;
- // PyObSpit("NewStructRNA: ", (PyObject *)pyrna);
+ // PyC_ObSpit("NewStructRNA: ", (PyObject *)pyrna);
return ( PyObject * ) pyrna;
}
@@ -4134,12 +4362,29 @@ PyObject *pyrna_struct_CreatePyObject( PointerRNA *ptr )
PyObject *pyrna_prop_CreatePyObject( PointerRNA *ptr, PropertyRNA *prop )
{
BPy_PropertyRNA *pyrna;
+
+ if (RNA_property_array_check(ptr, prop) == 0) {
PyTypeObject *type;
- if (RNA_property_type(prop) == PROP_COLLECTION) type= &pyrna_prop_collection_Type;
- else if (RNA_property_array_check(ptr, prop)) type= &pyrna_prop_array_Type;
- else type= &pyrna_prop_Type;
+
+ if (RNA_property_type(prop) != PROP_COLLECTION) {
+ type= &pyrna_prop_Type;
+ }
+ else {
+ if((RNA_property_flag(prop) & PROP_IDPROPERTY) == 0) {
+ type= &pyrna_prop_collection_Type;
+ }
+ else {
+ type= &pyrna_prop_collection_idprop_Type;
+ }
+ }
pyrna = ( BPy_PropertyRNA * ) PyObject_NEW(BPy_PropertyRNA, type);
+ }
+ else {
+ pyrna = (BPy_PropertyRNA *) PyObject_NEW(BPy_PropertyArrayRNA, &pyrna_prop_array_Type);
+ ((BPy_PropertyArrayRNA *)pyrna)->arraydim= 0;
+ ((BPy_PropertyArrayRNA *)pyrna)->arrayoffset= 0;
+ }
if( !pyrna ) {
PyErr_SetString( PyExc_MemoryError, "couldn't create BPy_rna object" );
@@ -4149,9 +4394,6 @@ PyObject *pyrna_prop_CreatePyObject( PointerRNA *ptr, PropertyRNA *prop )
pyrna->ptr = *ptr;
pyrna->prop = prop;
- pyrna->arraydim= 0;
- pyrna->arrayoffset= 0;
-
return ( PyObject * ) pyrna;
}
@@ -4173,6 +4415,9 @@ void BPY_rna_init(void)
if( PyType_Ready( &pyrna_prop_collection_Type ) < 0 )
return;
+
+ if( PyType_Ready( &pyrna_prop_collection_idprop_Type ) < 0 )
+ return;
}
/* bpy.data from python */
@@ -4286,7 +4531,6 @@ PyObject *BPY_rna_types(void)
}
self= (BPy_BaseTypeRNA *)PyObject_NEW( BPy_BaseTypeRNA, &pyrna_basetype_Type );
- self->arraydim = self->arrayoffset = 0; /* unused but better set */
/* avoid doing this lookup for every getattr */
RNA_blender_rna_pointer_create(&self->ptr);
@@ -4391,7 +4635,7 @@ static int deferred_register_prop(StructRNA *srna, PyObject *item, PyObject *key
PyErr_Print();
PyErr_Clear();
- // PyLineSpit();
+ // PyC_LineSpit();
PyErr_Format(PyExc_ValueError, "bpy_struct \"%.200s\" registration error: %.200s could not register\n", RNA_struct_identifier(srna), _PyUnicode_AsString(key));
return -1;
}
@@ -4400,7 +4644,7 @@ static int deferred_register_prop(StructRNA *srna, PyObject *item, PyObject *key
/* Since this is a class dict, ignore args that can't be passed */
/* for testing only */
- /* PyObSpit("Why doesn't this work??", item);
+ /* PyC_ObSpit("Why doesn't this work??", item);
PyErr_Print(); */
PyErr_Clear();
}
@@ -4845,7 +5089,7 @@ static void bpy_class_free(void *pyob_ptr)
if(G.f&G_DEBUG) {
if(self->ob_refcnt > 1) {
- PyObSpit("zombie class - ref should be 1", self);
+ PyC_ObSpit("zombie class - ref should be 1", self);
}
}
@@ -5025,7 +5269,7 @@ static PyObject *pyrna_basetype_unregister(PyObject *self, PyObject *py_class)
/*if(PyDict_GetItemString(((PyTypeObject*)py_class)->tp_dict, "bl_rna")==NULL) {
PWM_cursor_wait(0);
-yErr_SetString(PyExc_ValueError, "bpy.types.unregister(): not a registered as a subclass.");
+ PyErr_SetString(PyExc_ValueError, "bpy.types.unregister(): not a registered as a subclass.");
return NULL;
}*/
diff --git a/source/blender/python/intern/bpy_rna.h b/source/blender/python/intern/bpy_rna.h
index 63f6997d82c..14c6ff4a1a3 100644
--- a/source/blender/python/intern/bpy_rna.h
+++ b/source/blender/python/intern/bpy_rna.h
@@ -55,11 +55,17 @@ typedef struct {
PyObject_HEAD /* required python macro */
PointerRNA ptr;
PropertyRNA *prop;
+} BPy_PropertyRNA;
+
+typedef struct {
+ PyObject_HEAD /* required python macro */
+ PointerRNA ptr;
+ PropertyRNA *prop;
/* Arystan: this is a hack to allow sub-item r/w access like: face.uv[n][m] */
int arraydim; /* array dimension, e.g: 0 for face.uv, 2 for face.uv[n][m], etc. */
int arrayoffset; /* array first item offset, e.g. if face.uv is [4][2], arrayoffset for face.uv[n] is 2n */
-} BPy_PropertyRNA;
+} BPy_PropertyArrayRNA;
/* cheap trick */
#define BPy_BaseTypeRNA BPy_PropertyRNA
@@ -77,7 +83,6 @@ PyObject *pyrna_struct_CreatePyObject( PointerRNA *ptr );
PyObject *pyrna_prop_CreatePyObject( PointerRNA *ptr, PropertyRNA *prop );
/* operators also need this to set args */
-int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, void *data, PyObject *value, const char *error_prefix);
int pyrna_pydict_to_props(PointerRNA *ptr, PyObject *kw, int all_args, const char *error_prefix);
PyObject * pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop);
@@ -97,7 +102,7 @@ int pyrna_py_to_array(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms,
int pyrna_py_to_array_index(PointerRNA *ptr, PropertyRNA *prop, int arraydim, int arrayoffset, int index, PyObject *py, const char *error_prefix);
PyObject *pyrna_py_from_array(PointerRNA *ptr, PropertyRNA *prop);
-PyObject *pyrna_py_from_array_index(BPy_PropertyRNA *self, PointerRNA *ptr, PropertyRNA *prop, int index);
+PyObject *pyrna_py_from_array_index(BPy_PropertyArrayRNA *self, PointerRNA *ptr, PropertyRNA *prop, int index);
PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop);
int pyrna_array_contains_py(PointerRNA *ptr, PropertyRNA *prop, PyObject *value);
diff --git a/source/blender/python/intern/bpy_util.c b/source/blender/python/intern/bpy_util.c
index 1d14ab67510..1a2d7b297b6 100644
--- a/source/blender/python/intern/bpy_util.c
+++ b/source/blender/python/intern/bpy_util.c
@@ -26,136 +26,14 @@
#include "BLI_dynstr.h"
#include "MEM_guardedalloc.h"
#include "BKE_report.h"
+#include "BKE_context.h"
+#include "../generic/py_capi_utils.h"
-#include "BKE_context.h"
bContext* __py_context = NULL;
bContext* BPy_GetContext(void) { return __py_context; };
void BPy_SetContext(bContext *C) { __py_context= C; };
-/* for debugging */
-void PyObSpit(char *name, PyObject *var) {
- fprintf(stderr, "<%s> : ", name);
- if (var==NULL) {
- fprintf(stderr, "<NIL>");
- }
- else {
- PyObject_Print(var, stderr, 0);
- fprintf(stderr, " ref:%d ", (int)var->ob_refcnt);
- fprintf(stderr, " ptr:%p", (void *)var);
-
- fprintf(stderr, " type:");
- if(Py_TYPE(var))
- fprintf(stderr, "%s", Py_TYPE(var)->tp_name);
- else
- fprintf(stderr, "<NIL>");
- }
- fprintf(stderr, "\n");
-}
-
-void PyLineSpit(void) {
- const char *filename;
- int lineno;
-
- PyErr_Clear();
- BPY_getFileAndNum(&filename, &lineno);
-
- fprintf(stderr, "%s:%d\n", filename, lineno);
-}
-
-void BPY_getFileAndNum(const char **filename, int *lineno)
-{
- PyObject *getframe, *frame;
- PyObject *f_lineno= NULL, *co_filename= NULL;
-
- if (filename) *filename= NULL;
- if (lineno) *lineno = -1;
-
- getframe = PySys_GetObject("_getframe"); // borrowed
- if (getframe==NULL) {
- PyErr_Clear();
- return;
- }
-
- frame = PyObject_CallObject(getframe, NULL);
- if (frame==NULL) {
- PyErr_Clear();
- return;
- }
-
- /* when executing a script */
- if (filename) {
- co_filename= PyObject_GetAttrStringArgs(frame, 1, "f_code", "co_filename");
- if (co_filename==NULL) {
- PyErr_SetString(PyExc_SystemError, "Could not access sys._getframe().f_code.co_filename");
- Py_DECREF(frame);
- return;
- }
-
- *filename = _PyUnicode_AsString(co_filename);
- Py_DECREF(co_filename);
- }
-
- /* when executing a module */
- if(filename && *filename == NULL) {
- /* try an alternative method to get the filename - module based
- * references below are all borrowed (double checked) */
- PyObject *mod_name= PyDict_GetItemString(PyEval_GetGlobals(), "__name__");
- if(mod_name) {
- PyObject *mod= PyDict_GetItem(PyImport_GetModuleDict(), mod_name);
- if(mod) {
- *filename= PyModule_GetFilename(mod);
- }
-
- /* unlikely, fallback */
- if(*filename == NULL) {
- *filename= _PyUnicode_AsString(mod_name);
- }
- }
- }
-
-
- if (lineno) {
- f_lineno= PyObject_GetAttrString(frame, "f_lineno");
- if (f_lineno==NULL) {
- PyErr_SetString(PyExc_SystemError, "Could not access sys._getframe().f_lineno");
- Py_DECREF(frame);
- return;
- }
-
- *lineno = (int)PyLong_AsSsize_t(f_lineno);
- Py_DECREF(f_lineno);
- }
-
- Py_DECREF(frame);
-}
-
-/* Would be nice if python had this built in */
-PyObject *PyObject_GetAttrStringArgs(PyObject *o, Py_ssize_t n, ...)
-{
- Py_ssize_t i;
- PyObject *item= o;
- char *attr;
-
- va_list vargs;
-
- va_start(vargs, n);
- for (i=0; i<n; i++) {
- attr = va_arg(vargs, char *);
- item = PyObject_GetAttrString(item, attr);
-
- if (item)
- Py_DECREF(item);
- else /* python will set the error value here */
- break;
-
- }
- va_end(vargs);
-
- Py_XINCREF(item); /* final value has is increfed, to match PyObject_GetAttrString */
- return item;
-}
-
int BPY_class_validate(const char *class_type, PyObject *class, PyObject *base_class, BPY_class_attr_check* class_attrs, PyObject **py_class_attrs)
{
PyObject *item, *fitem;
@@ -244,75 +122,6 @@ int BPY_class_validate(const char *class_type, PyObject *class, PyObject *base_c
-/* returns the exception string as a new PyUnicode object, depends on external StringIO module */
-PyObject *BPY_exception_buffer(void)
-{
- PyObject *stdout_backup = PySys_GetObject("stdout"); /* borrowed */
- PyObject *stderr_backup = PySys_GetObject("stderr"); /* borrowed */
- PyObject *string_io = NULL;
- PyObject *string_io_buf = NULL;
- PyObject *string_io_mod= NULL;
- PyObject *string_io_getvalue= NULL;
-
- PyObject *error_type, *error_value, *error_traceback;
-
- if (!PyErr_Occurred())
- return NULL;
-
- PyErr_Fetch(&error_type, &error_value, &error_traceback);
-
- PyErr_Clear();
-
- /* import io
- * string_io = io.StringIO()
- */
-
- if(! (string_io_mod= PyImport_ImportModule("io")) ) {
- goto error_cleanup;
- } else if (! (string_io = PyObject_CallMethod(string_io_mod, "StringIO", NULL))) {
- goto error_cleanup;
- } else if (! (string_io_getvalue= PyObject_GetAttrString(string_io, "getvalue"))) {
- goto error_cleanup;
- }
-
- Py_INCREF(stdout_backup); // since these were borrowed we dont want them freed when replaced.
- Py_INCREF(stderr_backup);
-
- PySys_SetObject("stdout", string_io); // both of these are free'd when restoring
- PySys_SetObject("stderr", string_io);
-
- PyErr_Restore(error_type, error_value, error_traceback);
- PyErr_Print(); /* print the error */
- PyErr_Clear();
-
- string_io_buf = PyObject_CallObject(string_io_getvalue, NULL);
-
- PySys_SetObject("stdout", stdout_backup);
- PySys_SetObject("stderr", stderr_backup);
-
- Py_DECREF(stdout_backup); /* now sys owns the ref again */
- Py_DECREF(stderr_backup);
-
- Py_DECREF(string_io_mod);
- Py_DECREF(string_io_getvalue);
- Py_DECREF(string_io); /* free the original reference */
-
- PyErr_Clear();
- return string_io_buf;
-
-
-error_cleanup:
- /* could not import the module so print the error and close */
- Py_XDECREF(string_io_mod);
- Py_XDECREF(string_io);
-
- PyErr_Restore(error_type, error_value, error_traceback);
- PyErr_Print(); /* print the error */
- PyErr_Clear();
-
- return NULL;
-}
-
char *BPy_enum_as_string(EnumPropertyItem *item)
{
DynStr *dynstr= BLI_dynstr_new();
@@ -363,14 +172,14 @@ int BPy_errors_to_report(ReportList *reports)
return 1;
}
- pystring= BPY_exception_buffer();
+ pystring= PyC_ExceptionBuffer();
if(pystring==NULL) {
BKE_report(reports, RPT_ERROR, "unknown py-exception, could not convert");
return 0;
}
- BPY_getFileAndNum(&filename, &lineno);
+ PyC_FileAndNum(&filename, &lineno);
if(filename==NULL)
filename= "<unknown location>";
@@ -392,7 +201,7 @@ int BPy_errors_to_report(ReportList *reports)
}
/* array utility function */
-int BPyAsPrimitiveArray(void *array, PyObject *value, int length, PyTypeObject *type, char *error_prefix)
+int PyC_AsArray(void *array, PyObject *value, int length, PyTypeObject *type, char *error_prefix)
{
PyObject *value_fast;
int value_len;
diff --git a/source/blender/python/intern/bpy_util.h b/source/blender/python/intern/bpy_util.h
index cfe820b53b0..ae215725087 100644
--- a/source/blender/python/intern/bpy_util.h
+++ b/source/blender/python/intern/bpy_util.h
@@ -36,17 +36,6 @@
struct EnumPropertyItem;
struct ReportList;
-void PyObSpit(char *name, PyObject *var);
-void PyLineSpit(void);
-void BPY_getFileAndNum(const char **filename, int *lineno);
-
-PyObject *BPY_exception_buffer(void);
-
-/* own python like utility function */
-PyObject *PyObject_GetAttrStringArgs(PyObject *o, Py_ssize_t n, ...);
-
-
-
/* Class type checking, use for checking classes can be added as operators, panels etc */
typedef struct BPY_class_attr_check {
const char *name; /* name of the class attribute */
@@ -77,6 +66,4 @@ void BPy_SetContext(struct bContext *C);
extern void bpy_context_set(struct bContext *C, PyGILState_STATE *gilstate);
extern void bpy_context_clear(struct bContext *C, PyGILState_STATE *gilstate);
-
-int BPyAsPrimitiveArray(void *array, PyObject *value, int length, PyTypeObject *type, char *error_prefix);
#endif
diff --git a/source/blender/quicktime/quicktime_import.h b/source/blender/quicktime/quicktime_import.h
index 1fccc776620..150aa07b1c2 100644
--- a/source/blender/quicktime/quicktime_import.h
+++ b/source/blender/quicktime/quicktime_import.h
@@ -72,4 +72,4 @@ ImBuf *qtime_fetchibuf (struct anim *anim, int position);
int imb_is_a_quicktime (char *name);
ImBuf *imb_quicktime_decode(unsigned char *mem, int size, int flags);
-#endif // __QUICKTIME_IMP_H__ \ No newline at end of file
+#endif // __QUICKTIME_IMP_H__
diff --git a/source/blender/render/CMakeLists.txt b/source/blender/render/CMakeLists.txt
index caa0e0a9a41..169e9b7fa87 100644
--- a/source/blender/render/CMakeLists.txt
+++ b/source/blender/render/CMakeLists.txt
@@ -54,4 +54,4 @@ IF(APPLE)
ENDIF(CMAKE_OSX_ARCHITECTURES MATCHES "i386" OR CMAKE_OSX_ARCHITECTURES MATCHES "x86_64")
ENDIF(APPLE)
-BLENDERLIB_NOLIST(blender_render "${SRC}" "${INC}")
+BLENDERLIB_NOLIST(bf_render "${SRC}" "${INC}")
diff --git a/source/blender/render/intern/source/imagetexture.c b/source/blender/render/intern/source/imagetexture.c
index f08529b3f2c..f78031c9030 100644
--- a/source/blender/render/intern/source/imagetexture.c
+++ b/source/blender/render/intern/source/imagetexture.c
@@ -1784,4 +1784,4 @@ void ibuf_sample(ImBuf *ibuf, float fx, float fy, float dx, float dy, float *res
result[1]= texres.tg;
result[2]= texres.tb;
result[3]= texres.ta;
-} \ No newline at end of file
+}
diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c
index 502bd09c2de..78cad1bd48e 100644
--- a/source/blender/render/intern/source/pipeline.c
+++ b/source/blender/render/intern/source/pipeline.c
@@ -2474,19 +2474,20 @@ static void do_render_seq(Render * re)
if (!rr->rectf)
rr->rectf= MEM_mallocN(4*sizeof(float)*rr->rectx*rr->recty, "render_seq rectf");
+ /* color management: when off ensure rectf is non-lin, since thats what the internal
+ * render engine delivers */
+ if(re->r.color_mgt_flag & R_COLOR_MANAGEMENT) {
+ if(ibuf->profile == IB_PROFILE_LINEAR_RGB)
memcpy(rr->rectf, ibuf->rect_float, 4*sizeof(float)*rr->rectx*rr->recty);
+ else
+ srgb_to_linearrgb_rgba_rgba_buf(rr->rectf, ibuf->rect_float, rr->rectx*rr->recty);
- /* sequencer float buffer is not in linear color space, convert
- * should always be true, use a fake ibuf for the colorspace conversion */
- if(ibuf->profile != IB_PROFILE_LINEAR_RGB) {
- ImBuf ibuf_dummy;
- memset(&ibuf_dummy, 0, sizeof(ImBuf));
- ibuf_dummy.profile= ibuf->profile;
- ibuf_dummy.x= rr->rectx;
- ibuf_dummy.y= rr->recty;
- ibuf_dummy.rect_float= rr->rectf;
- /* only touch the rr->rectf */
- IMB_convert_profile(&ibuf_dummy, IB_PROFILE_LINEAR_RGB);
+ }
+ else {
+ if(ibuf->profile != IB_PROFILE_LINEAR_RGB)
+ memcpy(rr->rectf, ibuf->rect_float, 4*sizeof(float)*rr->rectx*rr->recty);
+ else
+ linearrgb_to_srgb_rgba_rgba_buf(rr->rectf, ibuf->rect_float, rr->rectx*rr->recty);
}
/* TSK! Since sequence render doesn't free the *rr render result, the old rect32
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index 9fe09c0836c..9668b2e17c9 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -97,8 +97,8 @@ void WM_paint_cursor_end(struct wmWindowManager *wm, void *handle);
void WM_cursor_warp (struct wmWindow *win, int x, int y);
/* keyconfig and keymap */
-wmKeyConfig *WM_keyconfig_add (struct wmWindowManager *wm, char *idname);
-wmKeyConfig *WM_keyconfig_add_user(struct wmWindowManager *wm, char *idname);
+wmKeyConfig *WM_keyconfig_new (struct wmWindowManager *wm, char *idname);
+wmKeyConfig *WM_keyconfig_new_user(struct wmWindowManager *wm, char *idname);
void WM_keyconfig_remove (struct wmWindowManager *wm, struct wmKeyConfig *keyconf);
void WM_keyconfig_free (struct wmKeyConfig *keyconf);
void WM_keyconfig_userdef(struct wmWindowManager *wm);
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h
index c84a5e64889..807125765f7 100644
--- a/source/blender/windowmanager/WM_types.h
+++ b/source/blender/windowmanager/WM_types.h
@@ -184,6 +184,7 @@ typedef struct wmNotifier {
#define ND_TOOLSETTINGS (13<<16)
#define ND_LAYER (14<<16)
#define ND_FRAME_RANGE (15<<16)
+#define ND_LAYER_CONTENT (101<<16)
/* NC_OBJECT Object */
#define ND_TRANSFORM (16<<16)
diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c
index 8d36711032b..5f386170c54 100644
--- a/source/blender/windowmanager/intern/wm.c
+++ b/source/blender/windowmanager/intern/wm.c
@@ -29,6 +29,8 @@
#include <string.h>
#include <stddef.h>
+#include "BLO_sys_types.h"
+
#include "DNA_windowmanager_types.h"
#include "GHOST_C-api.h"
@@ -195,7 +197,7 @@ void WM_keymap_init(bContext *C)
wmWindowManager *wm= CTX_wm_manager(C);
if(!wm->defaultconf)
- wm->defaultconf= WM_keyconfig_add(wm, "Blender");
+ wm->defaultconf= WM_keyconfig_new(wm, "Blender");
if(wm && CTX_py_init_get(C) && (wm->initialized & WM_INIT_KEYMAP) == 0) {
/* create default key config */
diff --git a/source/blender/windowmanager/intern/wm_cursors.c b/source/blender/windowmanager/intern/wm_cursors.c
index b16e82726b4..1803a1cee91 100644
--- a/source/blender/windowmanager/intern/wm_cursors.c
+++ b/source/blender/windowmanager/intern/wm_cursors.c
@@ -32,6 +32,8 @@
#include "GHOST_C-api.h"
+#include "BLO_sys_types.h"
+
#include "DNA_listBase.h"
#include "DNA_userdef_types.h"
diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c
index aa26d4444b1..81417e8f8f1 100644
--- a/source/blender/windowmanager/intern/wm_draw.c
+++ b/source/blender/windowmanager/intern/wm_draw.c
@@ -710,6 +710,8 @@ static int wm_automatic_draw_method(wmWindow *win)
/* Windows software driver darkens color on each redraw */
else if(GPU_type_matches(GPU_DEVICE_SOFTWARE, GPU_OS_WIN, GPU_DRIVER_SOFTWARE))
return USER_DRAW_OVERLAP_FLIP;
+ else if(GPU_type_matches(GPU_DEVICE_SOFTWARE, GPU_OS_UNIX, GPU_DRIVER_SOFTWARE))
+ return USER_DRAW_OVERLAP;
/* drawing lower color depth again degrades colors each time */
else if(GPU_color_depth() < 24)
return USER_DRAW_OVERLAP;
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index e1fc934ee3e..3d5ae66236d 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -1800,10 +1800,18 @@ void WM_event_fileselect_event(bContext *C, void *ophandle, int eventval)
void WM_event_add_fileselect(bContext *C, wmOperator *op)
{
- wmEventHandler *handler= MEM_callocN(sizeof(wmEventHandler), "fileselect handler");
+ wmEventHandler *handler;
wmWindow *win= CTX_wm_window(C);
int full= 1; // XXX preset?
+ /* only allow file selector open per window bug [#23553] */
+ for(handler= win->modalhandlers.first; handler; handler=handler->next) {
+ if(handler->type == WM_HANDLER_FILESELECT)
+ return;
+ }
+
+ handler = MEM_callocN(sizeof(wmEventHandler), "fileselect handler");
+
handler->type= WM_HANDLER_FILESELECT;
handler->op= op;
handler->op_area= CTX_wm_area(C);
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index e2293f79e95..5287ce5eb28 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -334,6 +334,9 @@ void WM_read_file(bContext *C, char *name, ReportList *reports)
/* called on startup, (context entirely filled with NULLs) */
/* or called for 'New File' */
/* op can be NULL */
+/* note: G.sce is used to store the last saved path so backup and restore after loading
+ * G.main->name is similar to G.sce but when loading from memory set the name to startup.blend
+ * ...this could be changed but seems better then setting to "" */
int WM_read_homefile(bContext *C, wmOperator *op)
{
ListBase wmbase;
@@ -376,6 +379,7 @@ int WM_read_homefile(bContext *C, wmOperator *op)
WM_check(C); /* opens window(s), checks keymaps */
strcpy(G.sce, scestr); /* restore */
+ G.main->name[0]= '\0';
wm_init_userdef(C);
@@ -522,7 +526,7 @@ static ImBuf *blend_file_thumb(const char *path, Scene *scene, int **thumb_pt)
return NULL;
/* gets scaled to BLEN_THUMB_SIZE */
- ibuf= ED_view3d_draw_offscreen_imbuf_simple(scene, BLEN_THUMB_SIZE * 2, BLEN_THUMB_SIZE * 2, OB_SOLID);
+ ibuf= ED_view3d_draw_offscreen_imbuf_simple(scene, BLEN_THUMB_SIZE * 2, BLEN_THUMB_SIZE * 2, IB_rect, OB_SOLID);
if(ibuf) {
float aspect= (scene->r.xsch*scene->r.xasp) / (scene->r.ysch*scene->r.yasp);
diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c
index e79d08dc2f1..f1873b14232 100644
--- a/source/blender/windowmanager/intern/wm_keymap.c
+++ b/source/blender/windowmanager/intern/wm_keymap.c
@@ -74,7 +74,7 @@ void WM_keymap_properties_reset(wmKeyMapItem *kmi)
keymap_properties_set(kmi);
}
-wmKeyConfig *WM_keyconfig_add(wmWindowManager *wm, char *idname)
+wmKeyConfig *WM_keyconfig_new(wmWindowManager *wm, char *idname)
{
wmKeyConfig *keyconf;
@@ -85,9 +85,9 @@ wmKeyConfig *WM_keyconfig_add(wmWindowManager *wm, char *idname)
return keyconf;
}
-wmKeyConfig *WM_keyconfig_add_user(wmWindowManager *wm, char *idname)
+wmKeyConfig *WM_keyconfig_new_user(wmWindowManager *wm, char *idname)
{
- wmKeyConfig *keyconf = WM_keyconfig_add(wm, idname);
+ wmKeyConfig *keyconf = WM_keyconfig_new(wm, idname);
keyconf->flag |= KEYCONF_USER;
diff --git a/source/blenderplayer/CMakeLists.txt b/source/blenderplayer/CMakeLists.txt
index 566bc88e46d..8fcea674ebb 100644
--- a/source/blenderplayer/CMakeLists.txt
+++ b/source/blenderplayer/CMakeLists.txt
@@ -64,8 +64,8 @@ IF(UNIX)
SET(BLENDER_SORTED_LIBS
gp_ghost
gp_common
- bf_string
- bf_ghost
+ bf_intern_string
+ bf_intern_ghost
bf_rna
bf_blenkernel
bf_blenloader
@@ -82,11 +82,11 @@ IF(UNIX)
bf_expressions
bf_scenegraph
bf_ikplugin
- bf_ITASC
- bf_IK
- bf_smoke
+ bf_intern_itasc
+ bf_intern_ik
+ bf_intern_smoke
bf_modifiers
- bf_moto
+ bf_intern_moto
bf_kernel
bf_nodes
bf_gpu
@@ -96,20 +96,20 @@ IF(UNIX)
bf_ngnetwork
bf_loopbacknetwork
extern_bullet
- bf_guardedalloc
- bf_memutil
+ bf_intern_guardedalloc
+ bf_intern_memutil
bf_python
- bf_gen_python
+ bf_python_ext
bf_blenlib
bf_cineon
bf_openexr
- extern_libopenjpeg
+ extern_openjpeg
bf_dds
bf_readblenfile
bf_dna
bf_videotex
bf_blenfont
- bf_audaspace
+ bf_intern_audaspace
blenkernel_blc
extern_binreloc
extern_glew
@@ -120,7 +120,7 @@ IF(UNIX)
ENDIF(WITH_QUICKTIME)
IF(WITH_CXX_GUARDEDALLOC)
- SET(BLENDER_SORTED_LIBS ${BLENDER_SORTED_LIBS} bf_guardedalloc_cpp)
+ SET(BLENDER_SORTED_LIBS ${BLENDER_SORTED_LIBS} bf_intern_guardedalloc_cpp)
ENDIF(WITH_CXX_GUARDEDALLOC)
FOREACH(SORTLIB ${BLENDER_SORTED_LIBS})
diff --git a/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt b/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt
index 9a53997fd66..2449c8050ba 100644
--- a/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt
+++ b/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt
@@ -34,6 +34,7 @@ ENDIF(WITH_BUILDINFO)
SET(INC
.
..
+ ../../../intern/guardedalloc
../../../source/blender/makesdna
../../../source/blender/makesrna
)
diff --git a/source/blenderplayer/bad_level_call_stubs/SConscript b/source/blenderplayer/bad_level_call_stubs/SConscript
index aa84b88932e..a35375f2980 100644
--- a/source/blenderplayer/bad_level_call_stubs/SConscript
+++ b/source/blenderplayer/bad_level_call_stubs/SConscript
@@ -3,7 +3,8 @@ Import ('env')
sources = 'stubs.c'
-incs = '#/source/blender/makesdna'
+incs = '#/intern/guardedalloc'
+incs += ' #/source/blender/makesdna'
incs += ' #/source/blender/makesrna'
defs = ''
diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c
index 1688b6e3d96..7d63d1e07af 100644
--- a/source/blenderplayer/bad_level_call_stubs/stubs.c
+++ b/source/blenderplayer/bad_level_call_stubs/stubs.c
@@ -145,6 +145,9 @@ void WM_operator_stack_clear(struct bContext *C) {}
void WM_autosave_init(struct bContext *C){}
void WM_jobs_stop_all(struct wmWindowManager *wm){}
+char *WM_clipboard_text_get(int selection){return (char*)0;}
+void WM_clipboard_text_set(char *buf, int selection){}
+
struct wmKeyMapItem *WM_keymap_item_find_id(struct wmKeyMap *keymap, int id){return (struct wmKeyMapItem *) NULL;}
int WM_enum_search_invoke(struct bContext *C, struct wmOperator *op, struct wmEvent *event){return 0;}
void WM_event_add_notifier(const struct bContext *C, unsigned int type, void *reference){}
@@ -182,8 +185,8 @@ struct wmKeyMap *WM_keymap_find(struct wmKeyConfig *keyconf, char *idname, int s
struct wmKeyMap *WM_keymap_add_item(struct wmKeyMap *keymap, char *idname, int type, int val, int modifier, int keymodifier){return (struct wmKeyMap *) NULL;}
struct wmKeyMap *WM_keymap_copy_to_user(struct wmKeyMap *kemap){return (struct wmKeyMap *) NULL;}
struct wmKeyMap *WM_keymap_list_find(struct ListBase *lb, char *idname, int spaceid, int regionid){return (struct wmKeyMap *) NULL;}
-struct wmKeyConfig *WM_keyconfig_add(struct wmWindowManager *wm, char *idname){return (struct wmKeyConfig *) NULL;}
-struct wmKeyConfig *WM_keyconfig_add_user(struct wmWindowManager *wm, char *idname){return (struct wmKeyConfig *) NULL;}
+struct wmKeyConfig *WM_keyconfig_new(struct wmWindowManager *wm, char *idname){return (struct wmKeyConfig *) NULL;}
+struct wmKeyConfig *WM_keyconfig_new_user(struct wmWindowManager *wm, char *idname){return (struct wmKeyConfig *) NULL;}
void WM_keyconfig_remove(struct wmWindowManager *wm, char *idname){}
void WM_keymap_remove_item(struct wmKeyMap *keymap, struct wmKeyMapItem *kmi){}
void WM_keymap_restore_to_default(struct wmKeyMap *keymap){}
@@ -245,6 +248,10 @@ void ED_mesh_geometry_add(struct Mesh *mesh, struct ReportList *reports, int ver
void ED_mesh_material_add(struct Mesh *me, struct Material *ma){}
void ED_mesh_transform(struct Mesh *me, float *mat){}
void ED_mesh_update(struct Mesh *mesh, struct bContext *C){}
+void ED_mesh_vertices_add(struct Mesh *mesh, struct ReportList *reports, int count){}
+void ED_mesh_edges_add(struct Mesh *mesh, struct ReportList *reports, int count){}
+void ED_mesh_faces_add(struct Mesh *mesh, struct ReportList *reports, int count){}
+void ED_mesh_material_link(struct Mesh *mesh, struct Material *ma){}
int ED_mesh_color_add(struct bContext *C, struct Scene *scene, struct Object *ob, struct Mesh *me){return 0;}
int ED_mesh_uv_texture_add(struct bContext *C, struct Scene *scene, struct Object *ob, struct Mesh *me){return 0;}
void ED_object_constraint_dependency_update(struct Scene *scene, struct Object *ob){}
@@ -283,6 +290,7 @@ void uiItemsEnumR(struct uiLayout *layout, struct PointerRNA *ptr, char *propnam
void uiItemMenuEnumR(struct uiLayout *layout, struct PointerRNA *ptr, char *propname, char *name, int icon){}
void uiItemEnumR_string(struct uiLayout *layout, struct PointerRNA *ptr, char *propname, char *value, char *name, int icon){}
void uiItemPointerR(struct uiLayout *layout, struct PointerRNA *ptr, char *propname, struct PointerRNA *searchptr, char *searchpropname, char *name, int icon){}
+void uiItemPointerSubR(struct uiLayout *layout, struct PointerRNA *ptr, char *propname, char *searchpropname, char *name, int icon){}
void uiItemsEnumO(struct uiLayout *layout, char *opname, char *propname){}
void uiItemEnumO_string(struct uiLayout *layout, char *name, int icon, char *opname, char *propname, char *value_str){}
void uiItemMenuEnumO(struct uiLayout *layout, char *opname, char *propname, char *name, int icon){}
@@ -309,7 +317,6 @@ void uiTemplateIDPreview(struct uiLayout *layout, struct bContext *C, struct Poi
void uiTemplateCurveMapping(struct uiLayout *layout, struct CurveMapping *cumap, int type, int compact){}
void uiTemplateColorRamp(struct uiLayout *layout, struct ColorBand *coba, int expand){}
void uiTemplateLayers(struct uiLayout *layout, struct PointerRNA *ptr, char *propname){}
-void uiTemplateTriColorSet(struct uiLayout *layout, struct PointerRNA *ptr, char *propname){}
void uiTemplateImageLayers(struct uiLayout *layout, struct bContext *C, struct Image *ima, struct ImageUser *iuser){}
ListBase uiTemplateList(struct uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, char *propname, struct PointerRNA *activeptr, char *activepropname, int rows, int listtype){struct ListBase b = {0,0}; return b;}
void uiTemplateRunningJobs(struct uiLayout *layout, struct bContext *C){}
diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index e05b9d33a4a..0ce02926e0d 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -290,40 +290,86 @@ SET(TARGETDIR ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR})
ADD_CUSTOM_COMMAND(TARGET blender
POST_BUILD
MAIN_DEPENDENCY blender
- COMMAND if not exist \"${TARGETDIR}\\.blender\" mkdir \"${TARGETDIR}\\.blender\"
- COMMAND if not exist \"${TARGETDIR}\\.blender\\locale\" mkdir \"${TARGETDIR}\\.blender\\locale\"
- COMMAND if not exist \"${TARGETDIR}\\.blender\\scripts\" mkdir \"${TARGETDIR}\\.blender\\scripts\"
+ COMMAND if not exist \"${TARGETDIR}\\${BLENDER_VERSION}\" mkdir \"${TARGETDIR}\\${BLENDER_VERSION}\"
+ COMMAND if not exist \"${TARGETDIR}\\${BLENDER_VERSION}\\scripts\" mkdir \"${TARGETDIR}\\${BLENDER_VERSION}\\scripts\"
+ COMMAND if not exist \"${TARGETDIR}\\${BLENDER_VERSION}\\config\" mkdir \"${TARGETDIR}\\${BLENDER_VERSION}\\config\"
COMMAND if not exist \"${TARGETDIR}\\plugins\" mkdir \"${TARGETDIR}\\plugins\"
- COMMAND copy /Y \"${CMAKE_SOURCE_DIR}\\release\\bin\\.blender\\.Blanguages\" \"${TARGETDIR}\\.blender\\\"
- COMMAND copy /Y \"${CMAKE_SOURCE_DIR}\\release\\bin\\.blender\\.bfont.ttf\" \"${TARGETDIR}\\.blender\\\"
- COMMAND xcopy /E /Y \"${CMAKE_SOURCE_DIR}\\release\\bin\\.blender\\locale\\*.*\" \"${TARGETDIR}\\.blender\\locale\"
- COMMAND xcopy /E /Y \"${CMAKE_SOURCE_DIR}\\release\\scripts\\*.*\" \"${TARGETDIR}\\.blender\\scripts\"
- COMMAND xcopy /E /Y \"${CMAKE_SOURCE_DIR}\\release\\plugins\\*.*\" \"${TARGETDIR}\\plugins\"
- COMMAND copy /Y \"${CMAKE_SOURCE_DIR}\\release\\text\\*.*\" \"${TARGETDIR}\"
- # TODO, copy python bundle
- # COMMAND copy /Y \"${CMAKE_SOURCE_DIR}\\release\\windows\\extra\\python31.zip\" \"${TARGETDIR}\\\"
+ COMMAND copy /Y \"${CMAKE_SOURCE_DIR}\\release\\bin\\.blender\\.bfont.ttf\" \"${TARGETDIR}\\${BLENDER_VERSION}\\config\\\"
+ COMMAND xcopy /E /Y \"${CMAKE_SOURCE_DIR}\\release\\scripts\\*.*\" \"${TARGETDIR}\\${BLENDER_VERSION}\\scripts\\\"
+ COMMAND xcopy /E /Y \"${CMAKE_SOURCE_DIR}\\release\\plugins\\*.*\" \"${TARGETDIR}\\${BLENDER_VERSION}\\plugins\\\"
+ COMMAND copy /Y \"${CMAKE_SOURCE_DIR}\\release\\text\\*.*\" \"${TARGETDIR}\\\"
)
+ IF(CMAKE_CL_64)
+ # gettext and png are statically linked on win64
ADD_CUSTOM_COMMAND(TARGET blender
POST_BUILD
MAIN_DEPENDENCY blender
- COMMAND copy /Y \"${LIBDIR}\\release\\python31.zip\" \"${TARGETDIR}\\\"
- COMMAND copy /Y \"${LIBDIR}\\release\\python31.zip\" \"${TARGETDIR}\\python31_d.zip\"
+ COMMAND copy /Y \"${LIBDIR}\\zlib\\lib\\zlib.dll\" \"${TARGETDIR}\\\"
+ COMMAND copy /Y \"${LIBDIR}\\pthreads\\lib\\pthreadVC2.dll\" \"${TARGETDIR}\\\"
+ # COMMAND copy /Y \"${LIBDIR}\\samplerate\\lib\\libsamplerate-0.dll\" \"${TARGETDIR}\\\"
+ )
+ ELSE(CMAKE_CL_64)
+ ADD_CUSTOM_COMMAND(TARGET blender
+ POST_BUILD
+ MAIN_DEPENDENCY blender
COMMAND copy /Y \"${LIBDIR}\\gettext\\lib\\gnu_gettext.dll\" \"${TARGETDIR}\\\"
COMMAND copy /Y \"${LIBDIR}\\png\\lib\\libpng.dll\" \"${TARGETDIR}\\\"
- COMMAND copy /Y \"${LIBDIR}\\sdl\\lib\\SDL.dll\" \"${TARGETDIR}\\\"
COMMAND copy /Y \"${LIBDIR}\\zlib\\lib\\zlib.dll\" \"${TARGETDIR}\\\"
- COMMAND copy /Y \"${LIBDIR}\\python\\lib\\python31.dll\" \"${TARGETDIR}\\\"
- COMMAND copy /Y \"${LIBDIR}\\python\\lib\\python31_d.dll\" \"${TARGETDIR}\\\"
COMMAND copy /Y \"${LIBDIR}\\pthreads\\lib\\pthreadVC2.dll\" \"${TARGETDIR}\\\"
# COMMAND copy /Y \"${LIBDIR}\\samplerate\\lib\\libsamplerate-0.dll\" \"${TARGETDIR}\\\"
)
+ ENDIF(CMAKE_CL_64)
+
+ IF(WITH_PYTHON)
+ IF(NOT CMAKE_BUILD_TYPE) # hack: with multi-configuration generator this is "", so for now copy both python31.dll/zip and python31_d.dll/zip
+ ADD_CUSTOM_COMMAND(TARGET blender
+ POST_BUILD
+ MAIN_DEPENDENCY blender
+ COMMAND copy /Y \"${LIBDIR}\\python\\lib\\python31_d.dll\" \"${TARGETDIR}\\\"
+ COMMAND copy /Y \"${LIBDIR}\\release\\python31_d.zip\" \"${TARGETDIR}\\\"
+ COMMAND copy /Y \"${LIBDIR}\\python\\lib\\python31.dll\" \"${TARGETDIR}\\\"
+ COMMAND copy /Y \"${LIBDIR}\\release\\python31.zip\" \"${TARGETDIR}\\\"
+ )
+ ELSE(NOT CMAKE_BUILD_TYPE)
+ IF(CMAKE_BUILD_TYPE STREQUAL Debug OR CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo)
+ ADD_CUSTOM_COMMAND(TARGET blender
+ POST_BUILD
+ MAIN_DEPENDENCY blender
+ COMMAND copy /Y \"${LIBDIR}\\python\\lib\\python31_d.dll\" \"${TARGETDIR}\\\"
+ COMMAND copy /Y \"${LIBDIR}\\release\\python31_d.zip\" \"${TARGETDIR}\\\"
+ )
+ ELSE(CMAKE_BUILD_TYPE STREQUAL Debug OR CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo)
+ ADD_CUSTOM_COMMAND(TARGET blender
+ POST_BUILD
+ MAIN_DEPENDENCY blender
+ COMMAND copy /Y \"${LIBDIR}\\python\\lib\\python31.dll\" \"${TARGETDIR}\\\"
+ COMMAND copy /Y \"${LIBDIR}\\release\\python31.zip\" \"${TARGETDIR}\\\"
+ )
+ ENDIF(CMAKE_BUILD_TYPE STREQUAL Debug OR CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo)
+ ENDIF(NOT CMAKE_BUILD_TYPE)
+ ENDIF(WITH_PYTHON)
+
IF(WITH_INTERNATIONAL)
+ IF(CMAKE_CL_64)
+ # iconv is statically linked on win64
ADD_CUSTOM_COMMAND(TARGET blender
POST_BUILD
MAIN_DEPENDENCY blender
+ COMMAND if not exist \"${TARGETDIR}\\${BLENDER_VERSION}\\config\\locale\" mkdir \"${TARGETDIR}\\${BLENDER_VERSION}\\config\\locale\"
+ COMMAND copy /Y \"${CMAKE_SOURCE_DIR}\\release\\bin\\.blender\\.Blanguages\" \"${TARGETDIR}\\${BLENDER_VERSION}\\config\\\"
+ COMMAND xcopy /E /Y \"${CMAKE_SOURCE_DIR}\\release\\bin\\.blender\\locale\\*.*\" \"${TARGETDIR}\\${BLENDER_VERSION}\\config\\locale\\\"
+ )
+ ELSE(CMAKE_CL_64)
+ ADD_CUSTOM_COMMAND(TARGET blender
+ POST_BUILD
+ MAIN_DEPENDENCY blender
COMMAND copy /Y \"${LIBDIR}\\iconv\\lib\\iconv.dll\" \"${TARGETDIR}\\\"
+ COMMAND if not exist \"${TARGETDIR}\\${BLENDER_VERSION}\\config\\locale\" mkdir \"${TARGETDIR}\\${BLENDER_VERSION}\\config\\locale\"
+ COMMAND copy /Y \"${CMAKE_SOURCE_DIR}\\release\\bin\\.blender\\.Blanguages\" \"${TARGETDIR}\\${BLENDER_VERSION}\\config\\\"
+ COMMAND xcopy /E /Y \"${CMAKE_SOURCE_DIR}\\release\\bin\\.blender\\locale\\*.*\" \"${TARGETDIR}\\${BLENDER_VERSION}\\config\\locale\\\"
)
+ ENDIF(CMAKE_CL_64)
ENDIF(WITH_INTERNATIONAL)
IF(WITH_FFMPEG)
@@ -368,16 +414,27 @@ SET(TARGETDIR ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR})
)
ENDIF(WITH_OPENAL)
+
+ IF(WITH_SDL)
+ IF(NOT CMAKE_CL_64)
+ ADD_CUSTOM_COMMAND(TARGET blender
+ POST_BUILD
+ MAIN_DEPENDENCY blender
+ COMMAND copy /Y \"${LIBDIR}\\sdl\\lib\\SDL.dll\" \"${TARGETDIR}\\\"
+ )
+ ENDIF(NOT CMAKE_CL_64)
+ ENDIF(WITH_SDL)
+
ENDIF(WIN32)
ADD_DEPENDENCIES(blender makesdna)
FILE(READ ${CMAKE_BINARY_DIR}/cmake_blender_libs.txt BLENDER_LINK_LIBS)
-SET(BLENDER_LINK_LIBS bf_nodes ${BLENDER_LINK_LIBS} bf_windowmanager blender_render)
+SET(BLENDER_LINK_LIBS bf_nodes ${BLENDER_LINK_LIBS} bf_windowmanager bf_render)
IF(WITH_FLUID)
- SET(BLENDER_LINK_LIBS ${BLENDER_LINK_LIBS} bf_elbeem)
+ SET(BLENDER_LINK_LIBS ${BLENDER_LINK_LIBS} bf_intern_elbeem)
ENDIF(WITH_FLUID)
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
@@ -427,11 +484,11 @@ ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
bf_editor_animation
bf_editor_datafiles
- blender_BSP
- blender_render
- blender_ONL
+ bf_intern_bsp
+ bf_render
+ bf_intern_opennl
bf_python
- bf_gen_python
+ bf_python_ext
bf_ikplugin
bf_bmesh
bf_modifiers
@@ -440,8 +497,8 @@ ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
bf_gpu
bf_blenloader
bf_blenlib
- bf_ghost
- bf_string
+ bf_intern_ghost
+ bf_intern_string
bf_blenpluginapi
bf_imbuf
bf_avi
@@ -450,24 +507,24 @@ ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
bf_dds
bf_readblenfile
bf_collada
- blender_BSP
- blender_bop
+ bf_intern_bsp
+ bf_intern_bop
bf_kernel
- bf_decimation
- bf_elbeem
- bf_IK
- bf_memutil
- bf_guardedalloc
- blender_CTR
- bf_moto
+ bf_intern_decimate
+ bf_intern_elbeem
+ bf_intern_ik
+ bf_intern_memutil
+ bf_intern_guardedalloc
+ bf_intern_ctr
+ bf_intern_moto
bf_windowmanager
bf_blroutines
bf_converter
bf_dummy
bf_bullet
- bf_smoke
- bf_minilzo
- bf_lzma
+ bf_intern_smoke
+ extern_minilzo
+ extern_lzma
bf_common
bf_ketsji
bf_logic
@@ -475,31 +532,31 @@ ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
bf_oglrasterizer
bf_expressions
bf_scenegraph
- bf_moto
+ bf_intern_moto
bf_blroutines
kx_network
bf_kernel
bf_ngnetwork
extern_bullet
bf_loopbacknetwork
- bf_ITASC
+ bf_intern_itasc
bf_common
- bf_moto
+ bf_intern_moto
bf_python
- bf_gen_python
+ bf_python_ext
extern_binreloc
extern_glew
- extern_libopenjpeg
+ extern_openjpeg
bf_videotex
bf_rna
bf_dna
bf_blenfont
- bf_audaspace
- bf_decimation
+ bf_intern_audaspace
+ bf_intern_decimate
)
IF(WITH_CXX_GUARDEDALLOC)
- SET(BLENDER_SORTED_LIBS ${BLENDER_SORTED_LIBS} bf_guardedalloc_cpp)
+ SET(BLENDER_SORTED_LIBS ${BLENDER_SORTED_LIBS} bf_intern_guardedalloc_cpp)
ENDIF(WITH_CXX_GUARDEDALLOC)
IF(WITH_QUICKTIME)
diff --git a/source/creator/creator.c b/source/creator/creator.c
index 492864ec05a..709b4bc5047 100644
--- a/source/creator/creator.c
+++ b/source/creator/creator.c
@@ -134,6 +134,8 @@ extern int pluginapi_force_ref(void); /* from blenpluginapi:pluginapi.c */
char bprogname[FILE_MAXDIR+FILE_MAXFILE]; /* from blenpluginapi:pluginapi.c */
char btempdir[FILE_MAXDIR+FILE_MAXFILE];
+#define BLEND_VERSION_STRING_FMT "Blender %d.%02d (sub %d) Build\n", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION
+
/* Initialise callbacks for the modules that need them */
static void setCallbacks(void);
@@ -178,17 +180,14 @@ static void strip_quotes(char *str)
static int print_version(int argc, char **argv, void *data)
{
+ printf (BLEND_VERSION_STRING_FMT);
#ifdef BUILD_DATE
- printf ("Blender %d.%02d (sub %d) Build\n", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION);
printf ("\tbuild date: %s\n", build_date);
printf ("\tbuild time: %s\n", build_time);
printf ("\tbuild revision: %s\n", build_rev);
printf ("\tbuild platform: %s\n", build_platform);
printf ("\tbuild type: %s\n", build_type);
-#else
- printf ("Blender %d.%02d (sub %d) Build\n", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION);
#endif
-
exit(0);
return 0;
@@ -198,7 +197,7 @@ static int print_help(int argc, char **argv, void *data)
{
bArgs *ba = (bArgs*)data;
- printf ("Blender %d.%02d (sub %d) Build\n", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION);
+ printf (BLEND_VERSION_STRING_FMT);
printf ("Usage: blender [args ...] [file] [args ...]\n\n");
printf ("Render Options:\n");
@@ -375,7 +374,7 @@ static int background_mode(int argc, char **argv, void *data)
static int debug_mode(int argc, char **argv, void *data)
{
G.f |= G_DEBUG; /* std output printf's */
- printf ("Blender %d.%02d (sub %d) Build\n", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION);
+ printf(BLEND_VERSION_STRING_FMT);
MEM_set_memory_debug();
#ifdef NAN_BUILDINFO
diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
index d34e86fd556..ad92048ca13 100644
--- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp
+++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
@@ -726,16 +726,16 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene,
MVert *mvert = dm->getVertArray(dm);
int totvert = dm->getNumVerts(dm);
- MFace *mface = dm->getFaceArray(dm);
- MTFace *tface = static_cast<MTFace*>(dm->getFaceDataArray(dm, CD_MTFACE));
- MCol *mcol = static_cast<MCol*>(dm->getFaceDataArray(dm, CD_MCOL));
+ MFace *mface = dm->getTessFaceArray(dm);
+ MTFace *tface = static_cast<MTFace*>(dm->getTessFaceDataArray(dm, CD_MTFACE));
+ MCol *mcol = static_cast<MCol*>(dm->getTessFaceDataArray(dm, CD_MCOL));
float (*tangent)[3] = NULL;
- int totface = dm->getNumFaces(dm);
+ int totface = dm->getNumTessFaces(dm);
const char *tfaceName = "";
if(tface) {
DM_add_tangent_layer(dm);
- tangent = (float(*)[3])dm->getFaceDataArray(dm, CD_TANGENT);
+ tangent = (float(*)[3])dm->getTessFaceDataArray(dm, CD_TANGENT);
}
meshobj = new RAS_MeshObject(mesh);
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
index 421a9fc64b8..26265cb7e74 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
@@ -1417,11 +1417,11 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm,
}
MVert *mvert = dm->getVertArray(dm);
- MFace *mface = dm->getFaceArray(dm);
- numpolys = dm->getNumFaces(dm);
+ MFace *mface = dm->getTessFaceArray(dm);
+ numpolys = dm->getNumTessFaces(dm);
numverts = dm->getNumVerts(dm);
- int* index = (int*)dm->getFaceDataArray(dm, CD_ORIGINDEX);
- MTFace *tface = (MTFace *)dm->getFaceDataArray(dm, CD_MTFACE);
+ int* index = (int*)dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
+ MTFace *tface = (MTFace *)dm->getTessFaceDataArray(dm, CD_MTFACE);
m_shapeType = (polytope) ? PHY_SHAPE_POLYTOPE : PHY_SHAPE_MESH;
@@ -1715,10 +1715,10 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA
DerivedMesh* dm= gameobj->GetDeformer()->GetFinalMesh();
MVert *mvert = dm->getVertArray(dm);
- MFace *mface = dm->getFaceArray(dm);
- numpolys = dm->getNumFaces(dm);
+ MFace *mface = dm->getTessFaceArray(dm);
+ numpolys = dm->getNumTessFaces(dm);
numverts = dm->getNumVerts(dm);
- int* index = (int*)dm->getFaceDataArray(dm, CD_ORIGINDEX);
+ int* index = (int*)dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
MFace *mf;
MVert *mv;
@@ -1727,7 +1727,7 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA
if(CustomData_has_layer(&dm->faceData, CD_MTFACE))
{
- MTFace *tface = (MTFace *)dm->getFaceDataArray(dm, CD_MTFACE);
+ MTFace *tface = (MTFace *)dm->getTessFaceDataArray(dm, CD_MTFACE);
MTFace *tf;
vector<bool> vert_tag_array(numverts, false);
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
index 122a738e4f3..71f53bc5301 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
@@ -783,7 +783,7 @@ void RAS_OpenGLRasterizer::IndexPrimitivesInternal(RAS_MeshSlot& ms, bool multi)
current_ms = &ms;
current_mesh = ms.m_mesh;
current_wireframe = wireframe;
- MCol *mcol = (MCol*)ms.m_pDerivedMesh->getFaceDataArray(ms.m_pDerivedMesh, CD_MCOL);
+ MCol *mcol = (MCol*)ms.m_pDerivedMesh->getTessFaceDataArray(ms.m_pDerivedMesh, CD_MCOL);
if (current_polymat->GetFlag() & RAS_BLENDERGLSL) {
// GetMaterialIndex return the original mface material index,
// increment by 1 to match what derived mesh is doing
diff --git a/source/kernel/gen_system/GEN_HashedPtr.cpp b/source/kernel/gen_system/GEN_HashedPtr.cpp
index 4713c9d5eed..f6c71c34896 100644
--- a/source/kernel/gen_system/GEN_HashedPtr.cpp
+++ b/source/kernel/gen_system/GEN_HashedPtr.cpp
@@ -54,4 +54,4 @@ unsigned int GEN_Hash(void * inDWord)
return (unsigned int)(key ^ (key>>4));
#endif
}
-#endif \ No newline at end of file
+#endif